[FFmpeg-devel] [PATCH] libsvtav1: Enable 2-pass encoding

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu May 16 13:13:55 EEST 2024


Fredrik Lundkvist via ffmpeg-devel:
>>> + ret = av_reallocp(&param->rc_stats_buffer.buf, param->rc_stats_buffer.sz);
> 
>> Why realloc instead of malloc?
> 
> As far as I gathered, rc_stats_buffer.buf is already allocated by SVT-AV1; if malloc is preferred, I can change it and test to make sure it doesn’t cause any obvious issues.
> 

https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Source/API/EbSvtAv1Enc.h?ref_type=heads#L163
says that this pointer is a non-ownership pointer. Which would imply
that you can't realloc the initial pointer at all and have to simply
replace it with something of our own.
(That we would probably also need to free on our own.)

> 
>> Wouldn't it be safer to free rc_stats_buffer.buf and set rc_stats_buffer.sz to 0 on failure here too?
> 
> Absolutely agree on setting rc_stats_buffer.sz to 0, not quite sure about freeing rc_stats_buffer_buf it is allocated by SVT-AV1.
> 
> Thank you for the review, the other comments will be fixed in V2.
> 
> /Fredrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list