[FFmpeg-devel] [PATCH 3/5] avcodec/fflcms2: add ff_icc_profile_sanitize

Niklas Haas ffmpeg at haasn.xyz
Wed Sep 27 13:26:06 EEST 2023


On Wed, 27 Sep 2023 12:20:37 +0200 Andreas Rheinhardt <andreas.rheinhardt at outlook.com> wrote:
> Why is this a separate function and not just a new parameter to
> ff_icc_profile_read_primaries() given that these seem to always be used
> a pair?

Because it mutates the profile. It seems strange to me for a function
named `ff_icc_profile_*read*_primaries` to modify the profile it's
reading from. If it were possible to easily add this sanitization logic
without touching the profile itself I would have merged the two.

Forcing it to be a separate function forces each caller to think about
whether they want to actually modify the profile or not. At present we
only have two callers, and both of them destroy the cmsHPROFILE after
calling this function, so mutating is fine. But is that a given?


More information about the ffmpeg-devel mailing list