[FFmpeg-devel] [PATCH] lavc/ffv1: Properly check that the 4th and 5th quant tables are zeroes

Derek Buitenhuis derek.buitenhuis at gmail.com
Thu Jan 2 18:27:52 EET 2020


On 02/01/2020 16:17, Jerome Martinez wrote:
>> @@ -797,9 +800,11 @@ static int read_header(FFV1Context *f)
>>                   p->quant_table_index = idx;
>>                   memcpy(p->quant_table, f->quant_tables[idx],
>>                          sizeof(p->quant_table));
>> +                p->three_quant_tables = f->three_quant_tables[idx];
>>                   context_count = f->context_count[idx];
>>               } else {
>>                   memcpy(p->quant_table, f->quant_table, sizeof(p->quant_table));
>> +                p->three_quant_tables = f->three_quant_table;
>>               }
> 
> Couldn't three_quant_table be a local value instead of being stored in 
> the context?

I'm not sure that is possible - there is a subtle ifference between the
->quant_table and ->quant_tables (i.e. one is for version 2, which does
not have extradata). I followed what is done for the the quant table itself.

Michael can likely comment on it.

>> diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> 
> I may have missed something, but I don't get what the additional code in 
> the encoding part does, value seems not used.
> And I am reluctant to change anything in the encoder in this patch as we 
> consider that the issue is "only" a too aggressive optimization in the 
> decoder.

The encoder does use it, because the encoder calls get_context, of which
the template is shared between the encoder and decoder, so it has to be
changed. The optimization is/was for both encoding and decoding.

- Derek


More information about the ffmpeg-devel mailing list