mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
remove the special casing for res->first in VP8SetResidualCoeffs
if res->first = 1, coeffs[0]=0 because of quant.c:749 and line added at quant.c:744 So, no need for the extra case. Going forward, TrellisQuantizeBlock() should also be calling a variant of VP8SetResidualCoeffs() to set the 'last' field. also: fixes a warning for win64 + slight speed-up Change-Id: Ib24b611f7396d24aeb5b56dc74d5c39160f048f0
This commit is contained in:
@ -562,7 +562,8 @@ static void SetResidualCoeffs(const int16_t* const coeffs,
|
||||
VP8Residual* const res) {
|
||||
int n;
|
||||
res->last = -1;
|
||||
for (n = 15; n >= res->first; --n) {
|
||||
assert(res->first == 0 || coeffs[0] == 0);
|
||||
for (n = 15; n >= 0; --n) {
|
||||
if (coeffs[n]) {
|
||||
res->last = n;
|
||||
break;
|
||||
|
@ -741,13 +741,17 @@ static int ReconstructIntra16(VP8EncIterator* const it,
|
||||
TrellisQuantizeBlock(enc, tmp[n], rd->y_ac_levels[n], ctx, 0,
|
||||
&dqm->y1_, dqm->lambda_trellis_i16_);
|
||||
it->top_nz_[x] = it->left_nz_[y] = non_zero;
|
||||
rd->y_ac_levels[n][0] = 0;
|
||||
nz |= non_zero << n;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (n = 0; n < 16; ++n) {
|
||||
tmp[n][0] = 0; // so that nz is correct below
|
||||
// Zero-out the first coeff, so that: a) nz is correct below, and
|
||||
// b) finding 'last' non-zero coeffs in SetResidualCoeffs() is simplified.
|
||||
tmp[n][0] = 0;
|
||||
nz |= VP8EncQuantizeBlock(tmp[n], rd->y_ac_levels[n], &dqm->y1_) << n;
|
||||
assert(rd->y_ac_levels[n][0] == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user