[FFmpeg-devel] [PATCH 1/2] lavu: add a gamma field to AVMasteringDisplayMetadata

wm4 nfxjfg at googlemail.com
Wed Sep 20 21:31:51 EEST 2017


On Wed, 20 Sep 2017 15:28:26 -0300
James Almer <jamrial at gmail.com> wrote:

> On 9/20/2017 3:18 PM, wm4 wrote:
> > On Wed, 20 Sep 2017 04:00:27 +0100
> > Rostislav Pehlivanov <atomnuker at gmail.com> wrote:
> >   
> >> PNG exposes it and its required in order to correctly display some images,
> >> particularly images crafted to contain 2 different images which appear
> >> differently depending on whether the gamma has been taken into account.
> >>
> >> Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
> >> ---
> >>  libavutil/mastering_display_metadata.h | 10 ++++++++++
> >>  libavutil/version.h                    |  2 +-
> >>  2 files changed, 11 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libavutil/mastering_display_metadata.h b/libavutil/mastering_display_metadata.h
> >> index 847b0b62c6..3de58bf468 100644
> >> --- a/libavutil/mastering_display_metadata.h
> >> +++ b/libavutil/mastering_display_metadata.h
> >> @@ -66,6 +66,16 @@ typedef struct AVMasteringDisplayMetadata {
> >>       */
> >>      int has_luminance;
> >>  
> >> +    /**
> >> +     * The power-law response exponent needed to compensate for nonlinearity.
> >> +     */
> >> +    AVRational gamma;
> >> +
> >> +    /**
> >> +     * Flag indicating whether the gamma has been set.
> >> +     */
> >> +    int has_gamma;
> >> +
> >>  } AVMasteringDisplayMetadata;  
> > 
> > Why have the last field, instead of making gamma={0,0} mean unset?  
> 
> Didn't check the spec about it, but 0 could very well be a valid value.
> 
> In any case this will go in a separate struct, so there will be no need
> for a has_gama field. The mere fact the side data exists will mean the
> gamma value was filled.

A valid value of 0 would be {0,1}. {0,0} is akin to NAN.


More information about the ffmpeg-devel mailing list