[FFmpeg-devel] [PATCH v2 2/2] avcodec/pngdec: read colorspace info when decoding with AVDISCARD_ALL

Leo Izen leo.izen at gmail.com
Thu Feb 2 01:08:41 EET 2023


On 2/1/23 14:32, Andreas Rheinhardt wrote:
> Leo Izen:
>> These chunks are lightweight and it's useful information to have when
>> running ffmpeg -i or ffprobe, for example.
>>
>> +    } else if (s->gamma) {
>> +        /*
>> +         * these values are 100000/2.2, 100000/2.8, and 100000/2.6
>> +         * respectively. 45455, 35714, and 38462. There's a 0.001
>> +         * gamma tolerance here in case of floating point issues
>> +         * when the PNG was written.
>> +         *
>> +         * None of the other enums have a pure gamma curve so it makes
>> +         * sense to leave those to sRGB and cICP.
>> +         */
>> +        if (s->gamma > 45355 && s->gamma < 45555)
>> +            avctx->color_trc = p->color_trc = AVCOL_TRC_GAMMA22;
>> +        else if (s->gamma > 35614 && s->gamma < 35814)
>> +            avctx->color_trc = p->color_trc = AVCOL_TRC_GAMMA28;
>> +        else if (s->gamma > 38362 && s->gamma < 38562)
>> +            avctx->color_trc = p->color_trc = AVCOL_TRC_SMPTE428;
> 
> It seems that this patch does more than the commit message claims.
> 

Would it be ideal to split this off into a third patch?

- Leo Izen (thebombzen)



More information about the ffmpeg-devel mailing list