Centralize mb skip state calculation
authorJohn Koleszar <jkoleszar@google.com>
Thu, 7 Oct 2010 05:39:16 +0000 (22:39 -0700)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 12 Oct 2010 13:03:19 +0000 (09:03 -0400)
commit136857475ecbbcc4ae6fd24f8a9a82b5a2610e4a
tree83e7f4340657cd7593c64cca164adc291103279c
parentacff1627b8505f904fbbb787840fb7239f9ff544
Centralize mb skip state calculation

This patch moves the scattered updates to the mb skip state
(mode_info_context->mbmi.mb_skip_coeff) to vp8_tokenize_mb. Recent
changes to the quantizer exposed a bug where if a macroblock
could be coded as a skip but isn't, the encoder would run the
loopfilter but the decoder wouldn't, causing a reference buffer
mismatch.

The loopfilter is controlled by a flag called dc_diff. The decoder
looks at the number of decoded coefficients when setting this flag.
The encoder sets this flag based on the skip state, since any
skippable macroblock should be transmitted as a skip. The coefficient
optimization pass (vp8_optimize_b()) could change the coefficients
such that a block that was not a skip becomes one. The encoder was
not updating the skip state in this situation for intra coded blocks.

The underlying issue predates it, but this bug was recently triggered
by enabling trellis quantization on the Y2 block in commit dcd29e3,
and by changing the quantizer range control in commit 305be4e.

Change-Id: I5cce5da0dbc2d22f7d79ee48149f01e868a64802
vp8/encoder/encodeframe.c
vp8/encoder/encodeintra.c
vp8/encoder/encodemb.c
vp8/encoder/quantize.c
vp8/encoder/tokenize.c