// build the bitstream
vp9_pack_bitstream(cpi, dest, size);
+ {
+ const RefCntBuffer *coded_frame_buf =
+ get_ref_cnt_buffer(cm, cm->new_fb_idx);
+ vp9_extrc_update_encodeframe_result(&cpi->ext_ratectrl, (*size) << 3,
+ cpi->Source, &coded_frame_buf->buf,
+ cpi->oxcf.input_bit_depth);
+ }
#if CONFIG_REALTIME_ONLY
(void)encode_frame_result;
assert(encode_frame_result == NULL);
#if CONFIG_RATE_CTRL
PSNR_STATS psnr;
#if CONFIG_VP9_HIGHBITDEPTH
- vpx_calc_highbd_psnr(source_frame, coded_frame_buf->buf, &psnr, bit_depth,
+ vpx_calc_highbd_psnr(source_frame, &coded_frame_buf->buf, &psnr, bit_depth,
input_bit_depth);
#else // CONFIG_VP9_HIGHBITDEPTH
(void)bit_depth;
#include "vp9/encoder/vp9_ext_ratectrl.h"
#include "vp9/common/vp9_common.h"
+#include "vpx_dsp/psnr.h"
void vp9_extrc_init(EXT_RATECTRL *ext_ratectrl) { vp9_zero(*ext_ratectrl); }
ext_ratectrl->model, &encode_frame_info, encode_frame_decision);
}
}
+
+void vp9_extrc_update_encodeframe_result(EXT_RATECTRL *ext_ratectrl,
+ int64_t bit_count,
+ const YV12_BUFFER_CONFIG *source_frame,
+ const YV12_BUFFER_CONFIG *coded_frame,
+ uint32_t input_bit_depth) {
+ if (ext_ratectrl->ready) {
+ PSNR_STATS psnr;
+ vpx_rc_encodeframe_result_t encode_frame_result;
+ encode_frame_result.bit_count = bit_count;
+ encode_frame_result.pixel_count =
+ source_frame->y_width * source_frame->y_height +
+ 2 * source_frame->uv_width * source_frame->uv_height;
+#if CONFIG_VP9_HIGHBITDEPTH
+ vpx_calc_highbd_psnr(source_frame, coded_frame, &psnr,
+ source_frame->bit_depth, input_bit_depth);
+#else
+ (void)input_bit_depth;
+ vpx_calc_psnr(source_frame, coded_frame, &psnr);
+#endif
+ encode_frame_result.sse = psnr.sse[0];
+ ext_ratectrl->funcs.update_encodeframe_result(ext_ratectrl->model,
+ &encode_frame_result);
+ }
+}
EXT_RATECTRL *ext_ratectrl, const GF_GROUP *gf_group, int show_index,
int coding_index, vpx_rc_encodeframe_decision_t *encode_frame_decision);
+void vp9_extrc_update_encodeframe_result(EXT_RATECTRL *ext_ratectrl,
+ int64_t bit_count,
+ const YV12_BUFFER_CONFIG *source_frame,
+ const YV12_BUFFER_CONFIG *coded_frame,
+ uint32_t input_bit_depth);
+
#endif // VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_
*/
typedef int (*vpx_rc_update_encodeframe_result_cb_fn_t)(
vpx_rc_model_t rate_ctrl_model,
- vpx_rc_encodeframe_result_t *encode_frame_result);
+ const vpx_rc_encodeframe_result_t *encode_frame_result);
/*!\brief Delete the external rate control model callback prototype
*