[FFmpeg-devel] [PATCH] avcodec/rv10: check size of s->mb_width * s->mb_height

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Mon Mar 2 19:18:10 CET 2015


On 02.03.2015 18:35, Michael Niedermayer wrote:
> On Mon, Mar 02, 2015 at 05:52:52PM +0100, Andreas Cadhalpun wrote:
>> Hi,
>>
>> encoding large frames with rv10 currently results in an assertion,
>> because the number of macro blocks doesn't fit into 12 bits.
>>
>> Attached patch avoids this by just not trying to write the macro
>> block number in that case. The decoder can figure it out on it's
>> own:
>
> what does the binary encoder / decoder do in this case ?
> changes to the encoded bitstream should be checked against a
> specification or if none exists the binary decoder or encoder
> to ensure that we arent generating invalid bitstreams

Probably it encodes multiple packets per frame then. This is what these fields 
are for, according to the comment above them. But despite setting full_frame=0, 
ff_rv10_encode_picture_header always writes 0 for mb_x and mb_y, i.e. it encodes 
a full frame.
So maybe a better fix would be to set full_frame=1?

> i suspect we dont have rv10 samples with high enough resolution but
> if we do have, these could be used to ensure what we store is
> correct
> real video samples should be here: http://samples.ffmpeg.org/real/

As said I think the correct way would be to encode multiple packets per frame, 
which is currently not supported in FFmpeg.

So would you prefer using avpriv_report_missing_feature, returning an error and 
checking the return value in libavcodec/mpegvideo_enc.c?

Best regards,
Andreas


More information about the ffmpeg-devel mailing list