[FFmpeg-devel] [PATCH v12 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

Li, Zhong zhong.li at intel.com
Fri May 10 08:23:06 EEST 2019


> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of James Almer
> Sent: Friday, May 10, 2019 12:05 PM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v12 1/2] lavc/svt_hevc: add libsvt hevc
> encoder wrapper
> 
> >You used av_mallocz() to allocate the buffer, so it's already fully zeroed.
> >In any case, it would be faster to instead use av_malloc() above, then only
> zero the padding bytes here. Since you're copying the actual data in the line
> below, nothing will remain uninitialized.
> 
> Hi Almer,
> 
> Thanks for the review! Indeed the explicit memset() is redundant and I have
> removed that.
> 
> void *av_mallocz(size_t size)
> {
>     void *ptr = av_malloc(size);
>     if (ptr)
>         memset(ptr, 0, size);
>     return ptr;
> }
> 
> -Jing
The better solution should be: use av_malloc and just memset the padding bytes.


More information about the ffmpeg-devel mailing list