[FFmpeg-devel] [PATCH v2 3/6] ffv1enc: split off encoder initialization into a separate function

Lynne dev at lynne.ee
Thu Nov 14 09:21:02 EET 2024


On 11/14/24 00:46, Michael Niedermayer wrote:

> On Mon, Nov 11, 2024 at 04:40:15AM +0100, Lynne via ffmpeg-devel wrote:
>> ---
>>   libavcodec/ffv1enc.c | 354 +++++++++++++++++++++++--------------------
>>   libavcodec/ffv1enc.h |  30 ++++
>>   2 files changed, 217 insertions(+), 167 deletions(-)
>>   create mode 100644 libavcodec/ffv1enc.h
>>
>> diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
>> index 7a6c718b41..ca2c9f32e2 100644
>> --- a/libavcodec/ffv1enc.c
>> +++ b/libavcodec/ffv1enc.c
> [...]
>
>> @@ -873,7 +907,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
>>                       continue;
>>                   if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24)
>>                       continue;
>> -                if (s->version < 4)
>> +                if (avctx->level < 4)
>>                       if (  ff_need_new_slices(avctx->width , s->num_h_slices, s->chroma_h_shift)
>>                           ||ff_need_new_slices(avctx->height, s->num_v_slices, s->chroma_v_shift))
>>                           continue;
> avctx->level is read only from the point of view of the encoder
> while s->level can (and is sometimes) changed by the encoder
> So in cases where version is adjusted across 4, level would be wrong,
> it may be that this doesnt occur ATM but its still not correct


It cannot happen, not with the way the code is written. This is 
functionally correct.


More information about the ffmpeg-devel mailing list