History

Add vp9_extrc_update_encodeframe_result()

Bug: webm:1707

angiebird committed 6 years ago

Commit 8bfc9201 parent f71dd6e4 files · +41 −2Browse files

Unified · Split

4 files
  1. vp9/encoder/vp9_encoder.c +8 −1
  2. vp9/encoder/vp9_ext_ratectrl.c +26 −0
  3. vp9/encoder/vp9_ext_ratectrl.h +6 −0
  4. vpx/vpx_ext_ratectrl.h +1 −1
vp9/encoder/vp9_encoder.c+8−1
@@ -5479,6 +5479,13 @@ static void encode_frame_to_data_rate( · 5478 unmodified lines
54795479 // build the bitstream
54805480 vp9_pack_bitstream(cpi, dest, size);
54815481
5482+ {
5483+ const RefCntBuffer *coded_frame_buf =
5484+ get_ref_cnt_buffer(cm, cm->new_fb_idx);
5485+ vp9_extrc_update_encodeframe_result(&cpi->ext_ratectrl, (*size) << 3,
5486+ cpi->Source, &coded_frame_buf->buf,
5487+ cpi->oxcf.input_bit_depth);
5488+ }
54825489 #if CONFIG_REALTIME_ONLY
54835490 (void)encode_frame_result;
54845491 assert(encode_frame_result == NULL);
@@ -7541,7 +7548,7 @@ static void update_encode_frame_result( · 2056 unmodified lines
75417548 #if CONFIG_RATE_CTRL
75427549 PSNR_STATS psnr;
75437550 #if CONFIG_VP9_HIGHBITDEPTH
7544− vpx_calc_highbd_psnr(source_frame, coded_frame_buf->buf, &psnr, bit_depth,
7551+ vpx_calc_highbd_psnr(source_frame, &coded_frame_buf->buf, &psnr, bit_depth,
75457552 input_bit_depth);
75467553 #else // CONFIG_VP9_HIGHBITDEPTH
75477554 (void)bit_depth;
vp9/encoder/vp9_ext_ratectrl.c+26−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010
1111 #include "vp9/encoder/vp9_ext_ratectrl.h"
1212 #include "vp9/common/vp9_common.h"
13+#include "vpx_dsp/psnr.h"
1314
1415 void vp9_extrc_init(EXT_RATECTRL *ext_ratectrl) { vp9_zero(*ext_ratectrl); }
1516
@@ -112,3 +113,28 @@ void vp9_extrc_get_encodeframe_decision( · 96 unmodified lines
112113 ext_ratectrl->model, &encode_frame_info, encode_frame_decision);
113114 }
114115 }
116+
117+void vp9_extrc_update_encodeframe_result(EXT_RATECTRL *ext_ratectrl,
118+ int64_t bit_count,
119+ const YV12_BUFFER_CONFIG *source_frame,
120+ const YV12_BUFFER_CONFIG *coded_frame,
121+ uint32_t input_bit_depth) {
122+ if (ext_ratectrl->ready) {
123+ PSNR_STATS psnr;
124+ vpx_rc_encodeframe_result_t encode_frame_result;
125+ encode_frame_result.bit_count = bit_count;
126+ encode_frame_result.pixel_count =
127+ source_frame->y_width * source_frame->y_height +
128+ 2 * source_frame->uv_width * source_frame->uv_height;
129+#if CONFIG_VP9_HIGHBITDEPTH
130+ vpx_calc_highbd_psnr(source_frame, coded_frame, &psnr,
131+ source_frame->bit_depth, input_bit_depth);
132+#else
133+ (void)input_bit_depth;
134+ vpx_calc_psnr(source_frame, coded_frame, &psnr);
135+#endif
136+ encode_frame_result.sse = psnr.sse[0];
137+ ext_ratectrl->funcs.update_encodeframe_result(ext_ratectrl->model,
138+ &encode_frame_result);
139+ }
140+}
vp9/encoder/vp9_ext_ratectrl.h+6−0
@@ -36,4 +36,10 @@ void vp9_extrc_get_encodeframe_decision( · 35 unmodified lines
3636 EXT_RATECTRL *ext_ratectrl, const GF_GROUP *gf_group, int show_index,
3737 int coding_index, vpx_rc_encodeframe_decision_t *encode_frame_decision);
3838
39+void vp9_extrc_update_encodeframe_result(EXT_RATECTRL *ext_ratectrl,
40+ int64_t bit_count,
41+ const YV12_BUFFER_CONFIG *source_frame,
42+ const YV12_BUFFER_CONFIG *coded_frame,
43+ uint32_t input_bit_depth);
44+
3945 #endif // VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_
vpx/vpx_ext_ratectrl.h+1−1
@@ -133,7 +133,7 @@ typedef int (*vpx_rc_get_encodeframe_decision_cb_fn_t)( · 132 unmodified lines
133133 */
134134 typedef int (*vpx_rc_update_encodeframe_result_cb_fn_t)(
135135 vpx_rc_model_t rate_ctrl_model,
136− vpx_rc_encodeframe_result_t *encode_frame_result);
136+ const vpx_rc_encodeframe_result_t *encode_frame_result);
137137
138138 /*!\brief Delete the external rate control model callback prototype
139139 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t