[FFmpeg-devel] [PATCH v2 02/16] swscale/utils: add HDR metadata to SwsFormat
Niklas Haas
ffmpeg at haasn.xyz
Wed Dec 11 15:18:13 EET 2024
On Wed, 11 Dec 2024 01:35:25 +0100 Michael Niedermayer <michael at niedermayer.cc> wrote:
> Hi
>
> On Fri, Dec 06, 2024 at 03:32:01PM +0100, Niklas Haas wrote:
> > From: Niklas Haas <git at haasn.dev>
> >
> > Only add the condensed values that we actually care about. Group them into
> > a new struct to make it easier to discard or replace this metadata.
> >
> > Define a special comparison function that does not choke on undefined/unknown
> > metadata.
>
> [...]
>
> > diff --git a/libswscale/utils.h b/libswscale/utils.h
> > index 4d204ef6cc..1263e3f8ed 100644
> > --- a/libswscale/utils.h
> > +++ b/libswscale/utils.h
> > @@ -21,26 +21,55 @@
> > #ifndef SWSCALE_UTILS_H
> > #define SWSCALE_UTILS_H
> >
> > +#include "libavutil/csp.h"
> > #include "libavutil/pixdesc.h"
> >
> > #include "swscale.h"
> >
> > +/* Like av_cmp_q but considers 0/0 == 0/0 */
> > +static inline int ff_q_equal(const AVRational a, const AVRational b)
> > +{
> > + return (a.den || b.den) ? !av_cmp_q(a, b) : a.den == b.den;
> > +}
>
> in which case is a.den == b.den untrue ?
AVRational undef = {0, 0};
AVRational zero = {0, 1};
AVRational one = {1, 1};
ff_q_equal(undef, undef) == 1
ff_q_equal(zero, zero) == 1
ff_q_equal(one, one) == 1
ff_q_equal(undef, zero) == 0
ff_q_equal(undef, one) == 0
ff_q_equal(zero, one) == 0
Contrast with av_cmp_q which would give INT_MIN for the cases involving undef.
>
>
> [...]
>
> thx
>
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you fake or manipulate statistics in a paper in physics you will never
> get a job again.
> If you fake or manipulate statistics in a paper in medicin you will get
> a job for life at the pharma industry.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list