diff options
author | Guillaume Martres <gmartres@google.com> | 2013-10-07 19:20:10 +0100 |
---|---|---|
committer | Paul Wilkins <paulwilkins@google.com> | 2013-10-16 11:55:13 +0100 |
commit | e55f60240ac62455c61160e824660c0d22f8f7ed (patch) | |
tree | dfdf1dcdb79d66bfad9d45c3afbbc0e0f7301175 /vp9/encoder/vp9_quantize.c | |
parent | 660fc5f560f11d9cb95d960b123b913a33485b9f (diff) | |
download | libvpx-e55f60240ac62455c61160e824660c0d22f8f7ed.tar libvpx-e55f60240ac62455c61160e824660c0d22f8f7ed.tar.gz libvpx-e55f60240ac62455c61160e824660c0d22f8f7ed.tar.bz2 libvpx-e55f60240ac62455c61160e824660c0d22f8f7ed.zip |
Implement variance-based adaptive quantization
This should be similar to what x264 does with --aq-mode 1.
It works well with clips like parkjoy and touhou
(http://x264.nl/developers/Dark_Shikari/LosslessTouhou.mkv).
At low bitrates, the segmentation signaling overhead may negate the
benefits of this feature.
(PGW) Default changed to feature OFF to allow provisional merge.
Change-Id: I938abf9bb487e1d4ad3b0264ea03d9826275c70b
Diffstat (limited to 'vp9/encoder/vp9_quantize.c')
-rw-r--r-- | vp9/encoder/vp9_quantize.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index 05e893ee9..048a6e1eb 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -12,6 +12,7 @@ #include "vpx_mem/vpx_mem.h" #include "vp9/encoder/vp9_onyx_int.h" +#include "vp9/encoder/vp9_rdopt.h" #include "vp9/encoder/vp9_quantize.h" #include "vp9/common/vp9_quant_common.h" @@ -271,12 +272,15 @@ void vp9_init_quantizer(VP9_COMP *cpi) { void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) { int i; + VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; int zbin_extra; int segment_id = xd->this_mi->mbmi.segment_id; const int qindex = vp9_get_qindex(&cpi->common.seg, segment_id, cpi->common.base_qindex); + int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q); + // Y zbin_extra = (cpi->common.y_dequant[qindex][1] * (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7; @@ -315,6 +319,12 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) { /* save this macroblock QIndex for vp9_update_zbin_extra() */ x->e_mbd.q_index = qindex; + + /* R/D setup */ + cpi->mb.errorperbit = rdmult >> 6; + cpi->mb.errorperbit += (cpi->mb.errorperbit == 0); + + vp9_initialize_me_consts(cpi, xd->q_index); } void vp9_update_zbin_extra(VP9_COMP *cpi, MACROBLOCK *x) { |