special-case WHT transform when there's only DC

happens surprisingly often at low quality, so we might
as well hard-code a simplified TransformWHT() directly.

Change-Id: Ib7a858ef74e8f334bd59d6512bf5bd3e455c5459
This commit is contained in:
skal 2013-10-02 14:27:36 +02:00
parent 80911aef38
commit 63f9aba4b3

View File

@ -519,9 +519,15 @@ static int ParseResiduals(VP8Decoder* const dec,
if (!block->is_i4x4_) { // parse DC if (!block->is_i4x4_) { // parse DC
int16_t dc[16] = { 0 }; int16_t dc[16] = { 0 };
const int ctx = mb->nz_dc_ + left_mb->nz_dc_; const int ctx = mb->nz_dc_ + left_mb->nz_dc_;
mb->nz_dc_ = left_mb->nz_dc_ = const int nz = GetCoeffs(token_br, bands[1], ctx, q->y2_mat_, 0, dc);
(GetCoeffs(token_br, bands[1], ctx, q->y2_mat_, 0, dc) > 0); mb->nz_dc_ = left_mb->nz_dc_ = (nz > 0);
VP8TransformWHT(dc, dst); if (nz > 1) { // more than just the DC -> perform the full transform
VP8TransformWHT(dc, dst);
} else { // only DC is non-zero -> inlined simplified transform
int i;
const int dc0 = (dc[0] + 3) >> 3;
for (i = 0; i < 16 * 16; i += 16) dst[i] = dc0;
}
first = 1; first = 1;
ac_proba = bands[0]; ac_proba = bands[0];
} else { } else {