Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Hendrik Leppkes <h.leppkes@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [RFC] Bug in colorspace.c
Date: Wed, 29 Jun 2022 06:34:09 +0200
Message-ID: <CA+anqdyYaTsP=-UGea9cAUo63nkhvVg8g=q4GbcZWnrwrfNqcw@mail.gmail.com> (raw)
In-Reply-To: <DM8P223MB0365773FC9287BD33B998B12BAB89@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>

On Tue, Jun 28, 2022 at 11:38 PM Soft Works <softworkz@hotmail.com> wrote:
>
> Hi,
>
> in colorspace.c, there are two functions with contradicting behavior
> regarding reading/writing the max_luminance value from/to
> AVMasteringDisplayMetadata. The code seems to be unchanged since
> 3 years:
>
>
> 1. ff_determine_signal_peak()
>
>     sd = av_frame_get_side_data(in, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
>     if (!peak && sd) {
>         AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data;
>         if (metadata->has_luminance)
>             peak = av_q2d(metadata->max_luminance) / REFERENCE_WHITE;
>     }
>
>
> 2. ff_update_hdr_metadata()
>
>     sd = av_frame_get_side_data(in, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
>     if (sd) {
>         AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data;
>         if (metadata->has_luminance)
>             metadata->max_luminance = av_d2q(peak * REFERENCE_WHITE, 10000);
>     }
>
>
> The latter function writes the value as an AVRational with a denominator of
> 10000, but the former function doesn't multiply the value by 10000.
>

These two calls round-trip just fine. The 10000 is not a forced
denominator, divisor, or multiplier, it is the maximum denominator it
is allowed to use to convert the floating point value to a rational.
av_d2q will ensure the value is properly scaled.

- Hendrik
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2022-06-29  4:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 21:38 Soft Works
2022-06-29  4:34 ` Hendrik Leppkes [this message]
2022-06-29  7:50   ` Hendrik Leppkes
2022-06-29 21:38     ` Soft Works

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+anqdyYaTsP=-UGea9cAUo63nkhvVg8g=q4GbcZWnrwrfNqcw@mail.gmail.com' \
    --to=h.leppkes@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git