[FFmpeg-devel] [PATCH]: libavcodec/webp

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Sep 18 09:33:12 CEST 2014

On 18.09.2014, at 08:45, Pascal Massimino <pascal.massimino at gmail.com> wrote:
> Hi,
> the webp lossless doc was unclear regarding palette index falling out of
> range.
> See issue #206 [1] for the bug report.
> The solution retained was to treat out-of-range index as color 0x00000000,
> so we could keep the speed-up in libwebp (we use fake extra entries in the
> cmap to handle out-of-bound values without the extra branch).
> The doc was clarified (along with few other loose ends) in patch #71605 [2]
> Attached is the fix for ffmpeg's webp decoder to treat out-of-bound index
> as transparent-black instead of reporting an error.

The spec now says "should be set". I don't fully understand why we would ordinarily expect out-of-range value.
I also don't understand why the issue talks about speed loss in the decoder, when it is the encoder that decides to use out-of-bounds values.
Why does the spec not e.g. say "the encoder MUST NOT produce out-of-range values. A decoder SHOULD interpret them as black" (in which case our decoder should still warn about the file being invalid).
Also, a branch per pixel is not necessary even if the spec required creating an error, you could just or the result of the range check together, which could/should come in at maybe 1 cycle/pixel.

More information about the ffmpeg-devel mailing list