Changed segmentation check order

In SPLITMV, the 8x8 segment will be checked first.  If the 8x8 rd
is better than the best, we check the other segments.  Otherwise
bail.  Adjustments to the thresh_mult were necessary to make
up for the initial quality loss.
The performance improved by 20% (average) for good quality,
speed 0 and speed 1, while the overall quality remained the same.

Change-Id: I717aef401323c8a254fba3e9777d2a316c774cc3
This commit is contained in:
Scott LaVarnway 2010-12-16 17:01:27 -05:00
Родитель 81cdeb7117
Коммит 64baa8df2e
2 изменённых файлов: 50 добавлений и 11 удалений

Просмотреть файл

@ -683,6 +683,32 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEARG ] = 1000; sf->thresh_mult[THR_NEARG ] = 1000;
sf->thresh_mult[THR_NEARA ] = 1000; sf->thresh_mult[THR_NEARA ] = 1000;
#if 1
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROG ] = 0;
sf->thresh_mult[THR_ZEROA ] = 0;
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_NEARESTG ] = 0;
sf->thresh_mult[THR_NEARESTA ] = 0;
sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_NEARG ] = 0;
sf->thresh_mult[THR_NEARA ] = 0;
// sf->thresh_mult[THR_DC ] = 0;
// sf->thresh_mult[THR_V_PRED ] = 1000;
// sf->thresh_mult[THR_H_PRED ] = 1000;
// sf->thresh_mult[THR_B_PRED ] = 2000;
// sf->thresh_mult[THR_TM ] = 1000;
sf->thresh_mult[THR_NEWMV ] = 1000;
sf->thresh_mult[THR_NEWG ] = 1000;
sf->thresh_mult[THR_NEWA ] = 1000;
sf->thresh_mult[THR_SPLITMV ] = 1700;
sf->thresh_mult[THR_SPLITG ] = 4500;
sf->thresh_mult[THR_SPLITA ] = 4500;
#else
sf->thresh_mult[THR_NEWMV ] = 1500; sf->thresh_mult[THR_NEWMV ] = 1500;
sf->thresh_mult[THR_NEWG ] = 1500; sf->thresh_mult[THR_NEWG ] = 1500;
sf->thresh_mult[THR_NEWA ] = 1500; sf->thresh_mult[THR_NEWA ] = 1500;
@ -690,7 +716,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_SPLITMV ] = 5000; sf->thresh_mult[THR_SPLITMV ] = 5000;
sf->thresh_mult[THR_SPLITG ] = 10000; sf->thresh_mult[THR_SPLITG ] = 10000;
sf->thresh_mult[THR_SPLITA ] = 10000; sf->thresh_mult[THR_SPLITA ] = 10000;
#endif
sf->full_freq[0] = 15; sf->full_freq[0] = 15;
sf->full_freq[1] = 31; sf->full_freq[1] = 31;
@ -731,7 +757,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
cpi->mode_check_freq[THR_SPLITG] = 4; cpi->mode_check_freq[THR_SPLITG] = 4;
cpi->mode_check_freq[THR_SPLITA] = 4; cpi->mode_check_freq[THR_SPLITA] = 4;
cpi->mode_check_freq[THR_SPLITMV] = 2; cpi->mode_check_freq[THR_SPLITMV] = 0;
sf->thresh_mult[THR_TM ] = 1500; sf->thresh_mult[THR_TM ] = 1500;
sf->thresh_mult[THR_V_PRED ] = 1500; sf->thresh_mult[THR_V_PRED ] = 1500;

Просмотреть файл

@ -1038,7 +1038,7 @@ typedef struct
int d; int d;
int segment_yrate; int segment_yrate;
B_PREDICTION_MODE modes[16]; B_PREDICTION_MODE modes[16];
MV mvs[16]; int_mv mvs[16];
unsigned char eobs[16]; unsigned char eobs[16];
int mvthresh; int mvthresh;
@ -1276,7 +1276,7 @@ void vp8_rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x, BEST_SEG_INFO *bsi,
{ {
BLOCKD *bd = &x->e_mbd.block[i]; BLOCKD *bd = &x->e_mbd.block[i];
bsi->mvs[i] = bd->bmi.mv.as_mv; bsi->mvs[i].as_mv = bd->bmi.mv.as_mv;
bsi->modes[i] = bd->bmi.mode; bsi->modes[i] = bd->bmi.mode;
bsi->eobs[i] = bd->eob; bsi->eobs[i] = bd->eob;
} }
@ -1305,19 +1305,32 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x,
{ {
bsi.modes[i] = ZERO4X4; bsi.modes[i] = ZERO4X4;
} }
if(cpi->compressor_speed == 0)
/* original */ {
vp8_rd_check_segment(cpi, x, &bsi, 0); /* for now, we will keep the original segmentation order
vp8_rd_check_segment(cpi, x, &bsi, 1); when in best quality mode */
vp8_rd_check_segment(cpi, x, &bsi, 2); vp8_rd_check_segment(cpi, x, &bsi, BLOCK_16X8);
vp8_rd_check_segment(cpi, x, &bsi, 3); vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X16);
vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X8);
vp8_rd_check_segment(cpi, x, &bsi, BLOCK_4X4);
}
else
{
vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X8);
if (bsi.segment_rd < best_rd)
{
vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X16);
vp8_rd_check_segment(cpi, x, &bsi, BLOCK_16X8);
vp8_rd_check_segment(cpi, x, &bsi, BLOCK_4X4);
}
}
/* set it to the best */ /* set it to the best */
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
BLOCKD *bd = &x->e_mbd.block[i]; BLOCKD *bd = &x->e_mbd.block[i];
bd->bmi.mv.as_mv = bsi.mvs[i]; bd->bmi.mv.as_mv = bsi.mvs[i].as_mv;
bd->bmi.mode = bsi.modes[i]; bd->bmi.mode = bsi.modes[i];
bd->eob = bsi.eobs[i]; bd->eob = bsi.eobs[i];
} }