[FFmpeg-devel] [PATCH] avcodec/h264_slice: compute and export film grain seed

James Almer jamrial at gmail.com
Thu Aug 12 15:53:17 EEST 2021


On 8/12/2021 9:08 AM, Niklas Haas wrote:
> On Wed, 04 Aug 2021 19:00:48 +0200 Niklas Haas <ffmpeg at haasn.xyz> wrote:
>> +    if ((sd = av_frame_get_side_data(cur->f, AV_FRAME_DATA_FILM_GRAIN_PARAMS))) {
>> +        AVFilmGrainParams *fgp = (AVFilmGrainParams *) sd->data;
>> +        fgp->seed = cur->poc + h->poc_offset << 5;
>> +    }
> 
> The order on this is wrong, it must be be (h->poc_offset << 5).
> 
> I'll submit a new patch when I can verify that I actually get the
> correct output. I'm not sure if my grain synthesis code is bugged or if
> the seed value is just wrong. (The grain I get looks visually similar,
> but completely different)

Did you try with only one frame thread? I recall Derek noticed that 
trying to attach something (like SEI derived values) to a frame long 
after slice contexts are initialized was not working for frame threaded 
scenarios.
If the output is bitexact regardless of amount of threads, it should be 
fine.


More information about the ffmpeg-devel mailing list