• Leo Izen's avatar
    avcodec/png: use libavutil/csp.h for cHRM chunks · 2548c32c
    Leo Izen authored
    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: 's avatarLeo Izen <leo.izen@gmail.com>
    2548c32c
Name
Last commit
Last update
..
api Loading commit data...
checkasm Loading commit data...
fate Loading commit data...
filtergraphs Loading commit data...
ref Loading commit data...
.gitignore Loading commit data...
Makefile Loading commit data...
audiogen.c Loading commit data...
audiomatch.c Loading commit data...
base64.c Loading commit data...
copycooker.sh Loading commit data...
extended.ffconcat Loading commit data...
fate-run.sh Loading commit data...
fate-valgrind.supp Loading commit data...
fate.sh Loading commit data...
md5.sh Loading commit data...
refcmp-metadata.awk Loading commit data...
reference.pnm Loading commit data...
rotozoom.c Loading commit data...
simple1.ffconcat Loading commit data...
simple2.ffconcat Loading commit data...
test.ffmeta Loading commit data...
tiny_psnr.c Loading commit data...
tiny_ssim.c Loading commit data...
utils.c Loading commit data...
videogen.c Loading commit data...