Merge "Add checks in MB quantizer initialization"
This commit is contained in:
commit
e1a55b504a
@ -90,6 +90,7 @@ typedef struct
|
|||||||
unsigned int * mb_activity_ptr;
|
unsigned int * mb_activity_ptr;
|
||||||
int * mb_norm_activity_ptr;
|
int * mb_norm_activity_ptr;
|
||||||
signed int act_zbin_adj;
|
signed int act_zbin_adj;
|
||||||
|
signed int last_act_zbin_adj;
|
||||||
|
|
||||||
int mvcosts[2][MVvals+1];
|
int mvcosts[2][MVvals+1];
|
||||||
int *mvcost[2];
|
int *mvcost[2];
|
||||||
|
@ -411,6 +411,8 @@ typedef struct VP8_COMP
|
|||||||
int zbin_over_quant;
|
int zbin_over_quant;
|
||||||
int zbin_mode_boost;
|
int zbin_mode_boost;
|
||||||
int zbin_mode_boost_enabled;
|
int zbin_mode_boost_enabled;
|
||||||
|
int last_zbin_over_quant;
|
||||||
|
int last_zbin_mode_boost;
|
||||||
|
|
||||||
int64_t total_byte_count;
|
int64_t total_byte_count;
|
||||||
|
|
||||||
|
@ -565,6 +565,23 @@ void vp8cx_init_quantizer(VP8_COMP *cpi)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ZBIN_EXTRA_Y \
|
||||||
|
(( cpi->common.Y1dequant[QIndex][1] * \
|
||||||
|
( cpi->zbin_over_quant + \
|
||||||
|
cpi->zbin_mode_boost + \
|
||||||
|
x->act_zbin_adj ) ) >> 7)
|
||||||
|
|
||||||
|
#define ZBIN_EXTRA_UV \
|
||||||
|
(( cpi->common.UVdequant[QIndex][1] * \
|
||||||
|
( cpi->zbin_over_quant + \
|
||||||
|
cpi->zbin_mode_boost + \
|
||||||
|
x->act_zbin_adj ) ) >> 7)
|
||||||
|
|
||||||
|
#define ZBIN_EXTRA_Y2 \
|
||||||
|
(( cpi->common.Y2dequant[QIndex][1] * \
|
||||||
|
( (cpi->zbin_over_quant / 2) + \
|
||||||
|
cpi->zbin_mode_boost + \
|
||||||
|
x->act_zbin_adj ) ) >> 7)
|
||||||
|
|
||||||
void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
|
void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
|
||||||
{
|
{
|
||||||
@ -590,62 +607,83 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
|
|||||||
else
|
else
|
||||||
QIndex = cpi->common.base_qindex;
|
QIndex = cpi->common.base_qindex;
|
||||||
|
|
||||||
// Y
|
if (QIndex != x->q_index)
|
||||||
zbin_extra = ( cpi->common.Y1dequant[QIndex][1] *
|
|
||||||
( cpi->zbin_over_quant +
|
|
||||||
cpi->zbin_mode_boost +
|
|
||||||
x->act_zbin_adj ) ) >> 7;
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
{
|
{
|
||||||
x->block[i].quant = cpi->Y1quant[QIndex];
|
// Y
|
||||||
x->block[i].quant_fast = cpi->Y1quant_fast[QIndex];
|
zbin_extra = ZBIN_EXTRA_Y;
|
||||||
x->block[i].quant_shift = cpi->Y1quant_shift[QIndex];
|
|
||||||
x->block[i].zbin = cpi->Y1zbin[QIndex];
|
for (i = 0; i < 16; i++)
|
||||||
x->block[i].round = cpi->Y1round[QIndex];
|
{
|
||||||
x->e_mbd.block[i].dequant = cpi->common.Y1dequant[QIndex];
|
x->block[i].quant = cpi->Y1quant[QIndex];
|
||||||
x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex];
|
x->block[i].quant_fast = cpi->Y1quant_fast[QIndex];
|
||||||
x->block[i].zbin_extra = (short)zbin_extra;
|
x->block[i].quant_shift = cpi->Y1quant_shift[QIndex];
|
||||||
|
x->block[i].zbin = cpi->Y1zbin[QIndex];
|
||||||
|
x->block[i].round = cpi->Y1round[QIndex];
|
||||||
|
x->e_mbd.block[i].dequant = cpi->common.Y1dequant[QIndex];
|
||||||
|
x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex];
|
||||||
|
x->block[i].zbin_extra = (short)zbin_extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UV
|
||||||
|
zbin_extra = ZBIN_EXTRA_UV;
|
||||||
|
|
||||||
|
for (i = 16; i < 24; i++)
|
||||||
|
{
|
||||||
|
x->block[i].quant = cpi->UVquant[QIndex];
|
||||||
|
x->block[i].quant_fast = cpi->UVquant_fast[QIndex];
|
||||||
|
x->block[i].quant_shift = cpi->UVquant_shift[QIndex];
|
||||||
|
x->block[i].zbin = cpi->UVzbin[QIndex];
|
||||||
|
x->block[i].round = cpi->UVround[QIndex];
|
||||||
|
x->e_mbd.block[i].dequant = cpi->common.UVdequant[QIndex];
|
||||||
|
x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[QIndex];
|
||||||
|
x->block[i].zbin_extra = (short)zbin_extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Y2
|
||||||
|
zbin_extra = ZBIN_EXTRA_Y2;
|
||||||
|
|
||||||
|
x->block[24].quant_fast = cpi->Y2quant_fast[QIndex];
|
||||||
|
x->block[24].quant = cpi->Y2quant[QIndex];
|
||||||
|
x->block[24].quant_shift = cpi->Y2quant_shift[QIndex];
|
||||||
|
x->block[24].zbin = cpi->Y2zbin[QIndex];
|
||||||
|
x->block[24].round = cpi->Y2round[QIndex];
|
||||||
|
x->e_mbd.block[24].dequant = cpi->common.Y2dequant[QIndex];
|
||||||
|
x->block[24].zrun_zbin_boost = cpi->zrun_zbin_boost_y2[QIndex];
|
||||||
|
x->block[24].zbin_extra = (short)zbin_extra;
|
||||||
|
|
||||||
|
/* save this macroblock QIndex for vp8_update_zbin_extra() */
|
||||||
|
x->q_index = QIndex;
|
||||||
|
|
||||||
|
cpi->last_zbin_over_quant = cpi->zbin_over_quant;
|
||||||
|
cpi->last_zbin_mode_boost = cpi->zbin_mode_boost;
|
||||||
|
x->last_act_zbin_adj = x->act_zbin_adj;
|
||||||
}
|
}
|
||||||
|
else if(cpi->last_zbin_over_quant != cpi->zbin_over_quant
|
||||||
// UV
|
|| cpi->last_zbin_mode_boost != cpi->zbin_mode_boost
|
||||||
zbin_extra = ( cpi->common.UVdequant[QIndex][1] *
|
|| x->last_act_zbin_adj != x->act_zbin_adj)
|
||||||
( cpi->zbin_over_quant +
|
|
||||||
cpi->zbin_mode_boost +
|
|
||||||
x->act_zbin_adj ) ) >> 7;
|
|
||||||
|
|
||||||
for (i = 16; i < 24; i++)
|
|
||||||
{
|
{
|
||||||
x->block[i].quant = cpi->UVquant[QIndex];
|
// Y
|
||||||
x->block[i].quant_fast = cpi->UVquant_fast[QIndex];
|
zbin_extra = ZBIN_EXTRA_Y;
|
||||||
x->block[i].quant_shift = cpi->UVquant_shift[QIndex];
|
|
||||||
x->block[i].zbin = cpi->UVzbin[QIndex];
|
for (i = 0; i < 16; i++)
|
||||||
x->block[i].round = cpi->UVround[QIndex];
|
x->block[i].zbin_extra = (short)zbin_extra;
|
||||||
x->e_mbd.block[i].dequant = cpi->common.UVdequant[QIndex];
|
|
||||||
x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[QIndex];
|
// UV
|
||||||
x->block[i].zbin_extra = (short)zbin_extra;
|
zbin_extra = ZBIN_EXTRA_UV;
|
||||||
|
|
||||||
|
for (i = 16; i < 24; i++)
|
||||||
|
x->block[i].zbin_extra = (short)zbin_extra;
|
||||||
|
|
||||||
|
// Y2
|
||||||
|
zbin_extra = ZBIN_EXTRA_Y2;
|
||||||
|
x->block[24].zbin_extra = (short)zbin_extra;
|
||||||
|
|
||||||
|
cpi->last_zbin_over_quant = cpi->zbin_over_quant;
|
||||||
|
cpi->last_zbin_mode_boost = cpi->zbin_mode_boost;
|
||||||
|
x->last_act_zbin_adj = x->act_zbin_adj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Y2
|
|
||||||
zbin_extra = ( cpi->common.Y2dequant[QIndex][1] *
|
|
||||||
( (cpi->zbin_over_quant / 2) +
|
|
||||||
cpi->zbin_mode_boost +
|
|
||||||
x->act_zbin_adj ) ) >> 7;
|
|
||||||
|
|
||||||
x->block[24].quant_fast = cpi->Y2quant_fast[QIndex];
|
|
||||||
x->block[24].quant = cpi->Y2quant[QIndex];
|
|
||||||
x->block[24].quant_shift = cpi->Y2quant_shift[QIndex];
|
|
||||||
x->block[24].zbin = cpi->Y2zbin[QIndex];
|
|
||||||
x->block[24].round = cpi->Y2round[QIndex];
|
|
||||||
x->e_mbd.block[24].dequant = cpi->common.Y2dequant[QIndex];
|
|
||||||
x->block[24].zrun_zbin_boost = cpi->zrun_zbin_boost_y2[QIndex];
|
|
||||||
x->block[24].zbin_extra = (short)zbin_extra;
|
|
||||||
|
|
||||||
/* save this macroblock QIndex for vp8_update_zbin_extra() */
|
|
||||||
x->q_index = QIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x)
|
void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -653,35 +691,24 @@ void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x)
|
|||||||
int zbin_extra;
|
int zbin_extra;
|
||||||
|
|
||||||
// Y
|
// Y
|
||||||
zbin_extra = ( cpi->common.Y1dequant[QIndex][1] *
|
zbin_extra = ZBIN_EXTRA_Y;
|
||||||
( cpi->zbin_over_quant +
|
|
||||||
cpi->zbin_mode_boost +
|
|
||||||
x->act_zbin_adj ) ) >> 7;
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
|
||||||
x->block[i].zbin_extra = (short)zbin_extra;
|
x->block[i].zbin_extra = (short)zbin_extra;
|
||||||
}
|
|
||||||
|
|
||||||
// UV
|
// UV
|
||||||
zbin_extra = ( cpi->common.UVdequant[QIndex][1] *
|
zbin_extra = ZBIN_EXTRA_UV;
|
||||||
( cpi->zbin_over_quant +
|
|
||||||
cpi->zbin_mode_boost +
|
|
||||||
x->act_zbin_adj ) ) >> 7;
|
|
||||||
|
|
||||||
for (i = 16; i < 24; i++)
|
for (i = 16; i < 24; i++)
|
||||||
{
|
|
||||||
x->block[i].zbin_extra = (short)zbin_extra;
|
x->block[i].zbin_extra = (short)zbin_extra;
|
||||||
}
|
|
||||||
|
|
||||||
// Y2
|
// Y2
|
||||||
zbin_extra = ( cpi->common.Y2dequant[QIndex][1] *
|
zbin_extra = ZBIN_EXTRA_Y2;
|
||||||
( (cpi->zbin_over_quant / 2) +
|
|
||||||
cpi->zbin_mode_boost +
|
|
||||||
x->act_zbin_adj ) ) >> 7;
|
|
||||||
|
|
||||||
x->block[24].zbin_extra = (short)zbin_extra;
|
x->block[24].zbin_extra = (short)zbin_extra;
|
||||||
}
|
}
|
||||||
|
#undef ZBIN_EXTRA_Y
|
||||||
|
#undef ZBIN_EXTRA_UV
|
||||||
|
#undef ZBIN_EXTRA_Y2
|
||||||
|
|
||||||
void vp8cx_frame_init_quantizer(VP8_COMP *cpi)
|
void vp8cx_frame_init_quantizer(VP8_COMP *cpi)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user