diff options
author | Angie Chiang <angiebird@google.com> | 2020-10-21 00:21:51 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-10-21 00:21:51 +0000 |
commit | 13aad8bb6404d56138c16886939cf50c63850651 (patch) | |
tree | e4b4bec979ed377c6aa5351dbb5e6eeb53fa1f5b /vp9/encoder | |
parent | 94384b5c685ad3baac8989f19ee587eb72093a7f (diff) | |
parent | e94000aa35c5beb8901952abb9c0d037d3c977f1 (diff) | |
download | libvpx-13aad8bb6404d56138c16886939cf50c63850651.tar libvpx-13aad8bb6404d56138c16886939cf50c63850651.tar.gz libvpx-13aad8bb6404d56138c16886939cf50c63850651.tar.bz2 libvpx-13aad8bb6404d56138c16886939cf50c63850651.zip |
Merge "Add unit test for vp9_ext_ratectrl"
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 15 | ||||
-rw-r--r-- | vp9/encoder/vp9_ext_ratectrl.c | 9 | ||||
-rw-r--r-- | vp9/encoder/vp9_ext_ratectrl.h | 1 |
3 files changed, 16 insertions, 9 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 6ffe41edf..8d1d3b805 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2538,8 +2538,6 @@ VP9_COMP *vp9_create_compressor(const VP9EncoderConfig *oxcf, num_frames = packets - 1; fps_init_first_pass_info(&cpi->twopass.first_pass_info, oxcf->two_pass_stats_in.buf, num_frames); - vp9_extrc_send_firstpass_stats(&cpi->ext_ratectrl, - &cpi->twopass.first_pass_info); vp9_init_second_pass(cpi); } @@ -5483,9 +5481,9 @@ static void encode_frame_to_data_rate( { 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); + vp9_extrc_update_encodeframe_result( + &cpi->ext_ratectrl, (*size) << 3, cpi->Source, &coded_frame_buf->buf, + cm->bit_depth, cpi->oxcf.input_bit_depth); } #if CONFIG_REALTIME_ONLY (void)encode_frame_result; @@ -5517,7 +5515,7 @@ static void encode_frame_to_data_rate( ref_frame_flags, cpi->twopass.gf_group.update_type[cpi->twopass.gf_group.index], cpi->Source, coded_frame_buf, ref_frame_bufs, vp9_get_quantizer(cpi), - cpi->oxcf.input_bit_depth, cm->bit_depth, cpi->td.counts, + cm->bit_depth, cpi->oxcf.input_bit_depth, cpi->td.counts, #if CONFIG_RATE_CTRL cpi->partition_info, cpi->motion_vector_info, #endif // CONFIG_RATE_CTRL @@ -5674,6 +5672,11 @@ static void Pass2Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest, unsigned int *frame_flags, ENCODE_FRAME_RESULT *encode_frame_result) { cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED; + + if (cpi->common.current_frame_coding_index == 0) { + vp9_extrc_send_firstpass_stats(&cpi->ext_ratectrl, + &cpi->twopass.first_pass_info); + } #if CONFIG_MISMATCH_DEBUG mismatch_move_frame_idx_w(); #endif diff --git a/vp9/encoder/vp9_ext_ratectrl.c b/vp9/encoder/vp9_ext_ratectrl.c index 64414cd38..ca75651d4 100644 --- a/vp9/encoder/vp9_ext_ratectrl.c +++ b/vp9/encoder/vp9_ext_ratectrl.c @@ -22,7 +22,7 @@ void vp9_extrc_create(vpx_rc_funcs_t funcs, vpx_rc_config_t ratectrl_config, ext_ratectrl->ratectrl_config = ratectrl_config; ext_ratectrl->funcs.create_model(ext_ratectrl->funcs.priv, &ext_ratectrl->ratectrl_config, - ext_ratectrl->model); + &ext_ratectrl->model); rc_firstpass_stats = &ext_ratectrl->rc_firstpass_stats; rc_firstpass_stats->num_frames = ratectrl_config.show_frame_count; rc_firstpass_stats->frame_stats = @@ -34,6 +34,7 @@ void vp9_extrc_create(vpx_rc_funcs_t funcs, vpx_rc_config_t ratectrl_config, void vp9_extrc_delete(EXT_RATECTRL *ext_ratectrl) { if (ext_ratectrl->ready) { ext_ratectrl->funcs.delete_model(ext_ratectrl->model); + vpx_free(ext_ratectrl->rc_firstpass_stats.frame_stats); } vp9_extrc_init(ext_ratectrl); } @@ -118,6 +119,7 @@ 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 bit_depth, uint32_t input_bit_depth) { if (ext_ratectrl->ready) { PSNR_STATS psnr; @@ -127,9 +129,10 @@ void vp9_extrc_update_encodeframe_result(EXT_RATECTRL *ext_ratectrl, 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); + vpx_calc_highbd_psnr(source_frame, coded_frame, &psnr, bit_depth, + input_bit_depth); #else + (void)bit_depth; (void)input_bit_depth; vpx_calc_psnr(source_frame, coded_frame, &psnr); #endif diff --git a/vp9/encoder/vp9_ext_ratectrl.h b/vp9/encoder/vp9_ext_ratectrl.h index 82f300c3a..fe8a66cf3 100644 --- a/vp9/encoder/vp9_ext_ratectrl.h +++ b/vp9/encoder/vp9_ext_ratectrl.h @@ -40,6 +40,7 @@ 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 bit_depth, uint32_t input_bit_depth); #endif // VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_ |