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

Leo Izen leo.izen at gmail.com
Mon Dec 11 13:54:32 EET 2023


On 12/10/23 23:20, Kacper Michajlow wrote:
> On Tue, 28 Feb 2023 at 20:46, Leo Izen <leo.izen at gmail.com> wrote:
>>
>> On 2/27/23 11:34, Leo Izen wrote:
>>> On 2/21/23 17:35, Leo Izen wrote:
>>>> These chunks are lightweight and it's useful information to have when
>>>> running ffmpeg -i or ffprobe, for example.
>>>> ---
>>>>    libavcodec/pngdec.c          | 136 ++++++++++++++++++++++-------------
>>>>    tests/ref/fate/png-icc       |   8 +--
>>>>    tests/ref/fate/png-side-data |   2 +-
>>>>    3 files changed, 91 insertions(+), 55 deletions(-)
>>>>
>>>> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
>>>
>>> I will push this soon-ish if there's no other objections.
>>>
>>> - Leo Izen (thebombzen)
>>>
>>>
>>
>> Pushed as fadfa147f812a3fe9e68723347d37b9cccd6222d.
> 
> Hi, Sorry for digging this old patch, but I'm curious.
> 
> What does "unsupported tv-range cICP chunk\n" and "we only support
> pc-range RGB" mean?
> 
> Before this patch the range was properly set:
> avctx->color_range = f->color_range =
>              s->cicp_range == 0 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
> 
> Now it is ignored with a warning. Neither commit message, nor the
> comments in the code explain why the cICP range is now ignored in the
> decoder and the frames are no longer tagged with proper color range.
> 

It means FFmpeg itself doesn't support tv-range RGB. The PNG format 
supports it but FFmpeg does not. Since the PNG spec specifies the matrix 
must equal zero (aka RGB), we can't support tv-range here and print a 
warning.

- Leo Izen (Traneptora)


More information about the ffmpeg-devel mailing list