diff options
author | Leo Izen <leo.izen@gmail.com> | 2023-01-17 11:09:29 -0500 |
---|---|---|
committer | Leo Izen <leo.izen@gmail.com> | 2023-01-25 08:09:16 -0500 |
commit | 2548c32cc10f256cc0ff90457631ef7ef94070af (patch) | |
tree | 4b869f29ca8079402f3bded4faafa68b8bbe67f9 /libswscale | |
parent | 843a4467131fd677aacb46b8bbdea898e4fe12d5 (diff) | |
download | ffmpeg-2548c32cc10f256cc0ff90457631ef7ef94070af.tar.gz |
avcodec/png: use libavutil/csp.h for cHRM chunks
The cHRM chunk is descriptive. That is, it describes the primaries that should
be used to interpret the pixel data in the PNG file. This is notably different
from Mastering Display Metadata, which describes which subset of the presented
gamut is relevant. MDM describes a gamut and says colors outside the gamut are
not required to be preserved, but it does not actually describe the gamut that
the pixel data from the frame resides in. Thus, to decode a cHRM chunk present
in a PNG file to Mastering Display Metadata is incorrect.
This commit changes this behavior so the cHRM chunk, if present, is decoded to
color metadata. For example, if the cHRM chunk describes BT.709 primaries, the
resulting AVFrame will be tagged with AVCOL_PRI_BT709, as a description of its
pixel data. To do this, it utilizes libavutil/csp.h, which exposes a funcction
av_csp_primaries_id_from_desc, to detect which enum value accurately describes
the white point and primaries represented by the cHRM chunk.
This commit also changes pngenc.c to utilize the libavuitl/csp.h API, since it
previously duplicated code contained in that API. Instead, taking advantage of
the API that exists makes more sense. pngenc.c does properly utilize the color
tags rather than incorrectly using MDM, so that required no change.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
Diffstat (limited to 'libswscale')
0 files changed, 0 insertions, 0 deletions