[FFmpeg-devel] [PATCH 5/6] avutil/csp: add EOTF function definitions

Pavel Koshevoy pkoshevoy at gmail.com
Mon Nov 25 22:27:32 EET 2024


On Mon, Nov 25, 2024 at 12:43 PM Niklas Haas <ffmpeg at haasn.xyz> wrote:

> On Mon, 25 Nov 2024 14:16:19 +0100 Niklas Haas <ffmpeg at haasn.xyz> wrote:
> > From: Niklas Haas <git at haasn.dev>
>

<snip>


> >  av_csp_trc_function av_csp_trc_func_inv_from_id(enum
> AVColorTransferCharacteristic trc);
> >
> > +/**
> > + * Struct encapsulating a color in an arbitrary three-component
> colorspace.
> > + * This is typically RGB, but may also be e.g. CIE XYZ.
> > + */
> > +typedef struct AVColor {
> > +    double c[3];
> > +} AVColor;
> > +
> > +static inline AVColor av_color(double x, double y, double z)
> > +{
> > +    return (AVColor) {{ x, y, z }};
> > +}
>
> I'd appreciate suggestions on a better name, or another way to handle this.
> I'm not fond of the idea of functions that mutate a double[3] in place, but
> that might be the way to go if we want to avoid this awkward struct.
>

This looks a lot like a generic 3D vector ... and a constructor for it.
Why not use something more generic like av_vec3d_t, or AVVec3D ... if there
isn't a type like this already.

I personally use v3x1_t to represent xyY, XYZ
https://github.com/pkoshevoy/aeyae/blob/master/yae/video/yae_colorspace.h
https://github.com/pkoshevoy/aeyae/blob/master/yae/utils/yae_linear_algebra.h


More information about the ffmpeg-devel mailing list