Message ID | 20170920030028.3098-1-atomnuker@gmail.com |
---|---|
State | New |
Headers | show |
On Wed, 20 Sep 2017 04:00:27 +0100 Rostislav Pehlivanov <atomnuker@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@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?
On 9/20/2017 3:18 PM, wm4 wrote: > On Wed, 20 Sep 2017 04:00:27 +0100 > Rostislav Pehlivanov <atomnuker@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@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.
On Wed, 20 Sep 2017 15:28:26 -0300 James Almer <jamrial@gmail.com> wrote: > On 9/20/2017 3:18 PM, wm4 wrote: > > On Wed, 20 Sep 2017 04:00:27 +0100 > > Rostislav Pehlivanov <atomnuker@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@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.
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; /** diff --git a/libavutil/version.h b/libavutil/version.h index d99eff5d15..8ac41f49f5 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 75 +#define LIBAVUTIL_VERSION_MINOR 76 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
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@gmail.com> --- libavutil/mastering_display_metadata.h | 10 ++++++++++ libavutil/version.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)