diff options
author | angiebird <angiebird@google.com> | 2020-10-12 17:58:16 -0700 |
---|---|---|
committer | Angie Chiang <angiebird@google.com> | 2020-10-15 18:52:05 -0700 |
commit | 8bfc92063138476dee2d719ec45bb95d16a1a38f (patch) | |
tree | 08d2acf8a6d194671b7d696af2c08aa89b439b59 /vp9/encoder/vp9_ext_ratectrl.c | |
parent | f71dd6e23e9d238ab0b03cdf105db733b8486778 (diff) | |
download | libvpx-8bfc92063138476dee2d719ec45bb95d16a1a38f.tar libvpx-8bfc92063138476dee2d719ec45bb95d16a1a38f.tar.gz libvpx-8bfc92063138476dee2d719ec45bb95d16a1a38f.tar.bz2 libvpx-8bfc92063138476dee2d719ec45bb95d16a1a38f.zip |
Add vp9_extrc_update_encodeframe_result()
Bug: webm:1707
Change-Id: I962ffa23f03b953f7c0dfd81f49dc79d1975bbba
Diffstat (limited to 'vp9/encoder/vp9_ext_ratectrl.c')
-rw-r--r-- | vp9/encoder/vp9_ext_ratectrl.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_ext_ratectrl.c b/vp9/encoder/vp9_ext_ratectrl.c index 59b5c09b8..64414cd38 100644 --- a/vp9/encoder/vp9_ext_ratectrl.c +++ b/vp9/encoder/vp9_ext_ratectrl.c @@ -10,6 +10,7 @@ #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); } @@ -112,3 +113,28 @@ void vp9_extrc_get_encodeframe_decision( 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); + } +} |