Tuning for the more exact quantizer.
Small changes to the default zero bin and rounding tables. Though the tables are currently the same for the Y1 and Y2 cases I have left them as separate tables in case we want to tune this later. There is now some adjustment of the zbin based on the prediction mode. Previously this was restricted to an adjustment for gf/arf 0,0 MV. The exact quantizer now marginal outperforms and is the default. The overall average gain is about 0.5% Change-Id: I5e4353f3d5326dde4e86823684b236a1e9ea7f47
This commit is contained in:
parent
458f4fedd2
commit
6adbe09058
@ -62,7 +62,6 @@ unsigned int b_modes[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
static const int qrounding_factors[129] =
|
||||
{
|
||||
56, 56, 56, 56, 48, 48, 56, 56,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
@ -78,12 +77,18 @@ static const int qrounding_factors[129] =
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48
|
||||
};
|
||||
|
||||
static const int qzbin_factors[129] =
|
||||
{
|
||||
72, 72, 72, 72, 80, 80, 72, 72,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
@ -94,17 +99,11 @@ static const int qzbin_factors[129] =
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80,
|
||||
80
|
||||
};
|
||||
|
||||
static const int qrounding_factors_y2[129] =
|
||||
{
|
||||
56, 56, 56, 56, 48, 48, 56, 56,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
@ -120,12 +119,18 @@ static const int qrounding_factors_y2[129] =
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48
|
||||
};
|
||||
|
||||
static const int qzbin_factors_y2[129] =
|
||||
{
|
||||
72, 72, 72, 72, 80, 80, 72, 72,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
84, 84, 84, 84, 84, 84, 84, 84,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
@ -136,15 +141,10 @@ static const int qzbin_factors_y2[129] =
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80,
|
||||
80
|
||||
};
|
||||
|
||||
//#define EXACT_QUANT
|
||||
#define EXACT_QUANT
|
||||
#ifdef EXACT_QUANT
|
||||
static void vp8cx_invert_quant(short *quant, short *shift, short d)
|
||||
{
|
||||
@ -351,6 +351,9 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
|
||||
|
||||
void vp8cx_frame_init_quantizer(VP8_COMP *cpi)
|
||||
{
|
||||
// Clear Zbin mode boost for default case
|
||||
cpi->zbin_mode_boost = 0;
|
||||
|
||||
// vp8cx_init_quantizer() is first called in vp8_create_compressor(). A check is added here so that vp8cx_init_quantizer() is only called
|
||||
// when these values are not all zero.
|
||||
if (cpi->common.y1dc_delta_q | cpi->common.y2dc_delta_q | cpi->common.uvdc_delta_q | cpi->common.y2ac_delta_q | cpi->common.uvac_delta_q)
|
||||
@ -1214,11 +1217,25 @@ int vp8cx_encode_inter_macroblock
|
||||
// Experimental code. Special case for gf and arf zeromv modes. Increase zbin size to supress noise
|
||||
if (cpi->zbin_mode_boost_enabled)
|
||||
{
|
||||
if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame != LAST_FRAME))
|
||||
cpi->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
|
||||
if ( xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME )
|
||||
cpi->zbin_mode_boost = 0;
|
||||
else
|
||||
cpi->zbin_mode_boost = 0;
|
||||
{
|
||||
if (xd->mode_info_context->mbmi.mode == ZEROMV)
|
||||
{
|
||||
if (xd->mode_info_context->mbmi.ref_frame != LAST_FRAME)
|
||||
cpi->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
|
||||
else
|
||||
cpi->zbin_mode_boost = LF_ZEROMV_ZBIN_BOOST;
|
||||
}
|
||||
else if (xd->mode_info_context->mbmi.mode == SPLITMV)
|
||||
cpi->zbin_mode_boost = 0;
|
||||
else
|
||||
cpi->zbin_mode_boost = MV_ZBIN_BOOST;
|
||||
}
|
||||
}
|
||||
else
|
||||
cpi->zbin_mode_boost = 0;
|
||||
|
||||
vp8cx_mb_init_quantizer(cpi, x);
|
||||
}
|
||||
|
@ -3494,8 +3494,18 @@ static void encode_frame_to_data_rate
|
||||
cpi->zbin_over_quant = 0;
|
||||
cpi->zbin_mode_boost = 0;
|
||||
|
||||
// Enable mode based tweaking of the zbin
|
||||
// Enable or disable mode based tweaking of the zbin
|
||||
// For 2 Pass Only used where GF/ARF prediction quality
|
||||
// is above a threshold
|
||||
cpi->zbin_mode_boost = 0;
|
||||
cpi->zbin_mode_boost_enabled = TRUE;
|
||||
if (cpi->pass == 2)
|
||||
{
|
||||
if ( cpi->gfu_boost <= 400 )
|
||||
{
|
||||
cpi->zbin_mode_boost_enabled = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Current default encoder behaviour for the altref sign bias
|
||||
if (cpi->source_alt_ref_active)
|
||||
|
@ -46,6 +46,8 @@
|
||||
#define MAX_THRESHMULT 512
|
||||
|
||||
#define GF_ZEROMV_ZBIN_BOOST 24
|
||||
#define LF_ZEROMV_ZBIN_BOOST 12
|
||||
#define MV_ZBIN_BOOST 4
|
||||
#define ZBIN_OQ_MAX 192
|
||||
|
||||
#define VP8_TEMPORAL_ALT_REF 1
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "entropy.h"
|
||||
#include "predictdc.h"
|
||||
|
||||
//#define EXACT_QUANT
|
||||
#define EXACT_QUANT
|
||||
#ifdef EXACT_QUANT
|
||||
void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
|
||||
{
|
||||
|
@ -1626,10 +1626,22 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
|
||||
// Experimental code. Special case for gf and arf zeromv modes. Increase zbin size to supress noise
|
||||
if (cpi->zbin_mode_boost_enabled)
|
||||
{
|
||||
if ((vp8_mode_order[mode_index] == ZEROMV) && (vp8_ref_frame_order[mode_index] != LAST_FRAME))
|
||||
cpi->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
|
||||
else
|
||||
if ( vp8_ref_frame_order[mode_index] == INTRA_FRAME )
|
||||
cpi->zbin_mode_boost = 0;
|
||||
else
|
||||
{
|
||||
if (vp8_mode_order[mode_index] == ZEROMV)
|
||||
{
|
||||
if (vp8_ref_frame_order[mode_index] != LAST_FRAME)
|
||||
cpi->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
|
||||
else
|
||||
cpi->zbin_mode_boost = LF_ZEROMV_ZBIN_BOOST;
|
||||
}
|
||||
else if (vp8_ref_frame_order[mode_index] == SPLITMV)
|
||||
cpi->zbin_mode_boost = 0;
|
||||
else
|
||||
cpi->zbin_mode_boost = MV_ZBIN_BOOST;
|
||||
}
|
||||
|
||||
vp8cx_mb_init_quantizer(cpi, x);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user