On 08/06/18 05:18, James Almer wrote:
> On 6/7/2018 8:43 PM, Mark Thompson wrote:
>> +static int cbs_jpeg_write_unit(CodedBitstreamContext *ctx,
>> +                                CodedBitstreamUnit *unit)
>> +{
>> +    CodedBitstreamJPEGContext *priv = ctx->priv_data;
>> +    PutBitContext pbc;
>> +    int err;
>> +
>> +    if (!priv->write_buffer) {
>> +        // Initial write buffer size is 1MB.
>> +        priv->write_buffer_size = 1024 * 1024;
>> +
>> +    reallocate_and_try_again:
>> +        err = av_reallocp(&priv->write_buffer, priv->write_buffer_size);
> 
> You could use av_fast_malloc() instead, since you don't care about the
> previous contents of the buffer. But it will make no real difference
> admittedly since at most it will be reallocated twice or thrice for
> really big files and that's it.
> 
> I sent a patch implementing this change for the other modules some
> weeks, which i guess you didn't see and i forgot about :p

That seems reasonable, but we should probably split this whole write-buffer 
stuff into a separate function so it doesn't keep being repeated in new places.

I'll leave it identical to the existing ones for now - if you'd like to pursue 
the fast_malloc patch (which I think looks fine) then I'll change it to match, 
and likewise if we can make a suitable new function.

Thanks,

- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to