[FFmpeg-devel] [PATCH/RFC] libavcodec/cinepak: Separate decoding from parsing

Tomas Härdin tjoppen at acc.umu.se
Sun Sep 1 23:58:27 EEST 2019


Hi

Attached patch separates parsing from decoding in the Cinepak decoder.
It puts in some rather strict checks which are in line with how I've
figured the VfW 1.1 decoder works. Parsing is still intermixed with
validation, but the code should be much easier to read this way
compared to before. Some avpriv_request_sample()s should probably be
switched to outright rejection, I haven't decided yet

I've tested it on all samples on samples.mplayerhq.hu, both under 
http://samples.mplayerhq.hu/V-codecs/CVID and 
http://samples.mplayerhq.hu/game-formats/film-cpk/

I've discovered some bugs in the existing decoder. It considers frames
with any strip being intra as being a keyframe, when in fact mixing
intra and inter strips is allowed. A similar issue exists with files
that use 0x00 and 0x01 as strip IDs, like 1984.apple_ad.mov

FATE references updated since this now rejects invalid frames

There is still some work to do, like properly inspecting what type of
mode is used in each chunk. The larger picture here is that the project
at large might benefit from a general parsing and validation framework.
I don't like that we keep having these KLV-type parsers reimplemented
all over the place. Even with this simple decoder I'm going to have to
implement a second layer of KLV parsing to validate the chunks inside
each strip. Tedious and error-prone.

/Tomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libavcodec-cinepak-Separate-decoding-from-parsing.patch
Type: text/x-patch
Size: 19057 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190901/36c2da64/attachment.bin>


More information about the ffmpeg-devel mailing list