[FFmpeg-devel] [PATCH v2 02/16] swscale/utils: add HDR metadata to SwsFormat

Niklas Haas ffmpeg at haasn.xyz
Wed Dec 11 15:28:31 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 ?

Nvm, I understand your comment now - the code as written was intended to
read "a.den && b.den" instead of "a.den || b.den".

But given that !av_cmp_q() already handles this case correctly, we could
just change the code to:

(!a.den && !b.den) || !av_cmp_q(a, b)

>
>
> [...]
>
> 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