[FFmpeg-devel] [PATCH v2 3/3] libdav1d: use film grain export flag to export AVFilmGrainParams side data

Lynne dev at lynne.ee
Thu Nov 12 20:44:55 EET 2020


Nov 12, 2020, 19:07 by jamrial at gmail.com:

> On 11/12/2020 2:42 PM, Lynne wrote:
>
>> +    if (p->frame_hdr->film_grain.present && (!dav1d->apply_grain ||
>> +        (c->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN))) {
>> +        AVFilmGrainParams *fgp;
>> +        if (p->frame_hdr->film_grain.update) {
>>
>
> You're not gaining anything by looking at this field. You're either allocating a new buffer or making the existing one writable. There is no case where it can be reused for more than one frame, so you'll be always allocating stuff and copying data.
>
> Also, libdav1d already takes care of ensuring p->frame_hdr->film_grain contains the correct values for every frame for us (It actually takes them from the correct reference frame pointed by film_grain_params_ref_idx when film_grain.update is false, whereas here you're always using the one from the previous returned frame), so just use av_film_grain_params_create_side_data() then copy the fields, like mastering and content level do above.
>

Fair enough. Still saved a copy occasionally.
v3 attached, does the same as all other side data.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-0001-libdav1d-use-film-grain-export-flag-to-export-AVF.patch
Type: text/x-patch
Size: 5094 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20201112/0b17fe6a/attachment.bin>


More information about the ffmpeg-devel mailing list