On 09/08/17 10:28, walter harms wrote: > > > Am 07.09.2017 20:03, schrieb Hans Verkuil: >> From: Hans Verkuil <hans.verk...@cisco.com> >> >> Add support for the new CTA-861-G Hybrid Log-Gamma transfer >> function. >> >> Also decode the luminance values in the static metadata block to >> cd/m^2 values. >> >> Signed-off-by: Hans Verkuil <hans.verk...@cisco.com> >> --- >> Makefile | 2 +- >> edid-decode.c | 15 ++++++++++----- >> 2 files changed, 11 insertions(+), 6 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index 21b811ed..b698c579 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -2,7 +2,7 @@ bindir ?= /usr/bin >> mandir ?= /usr/share/man >> >> edid-decode: edid-decode.c >> - $(CC) $(CFLAGS) -g -Wall -o $@ $< >> + $(CC) $(CFLAGS) -g -Wall -lm -o $@ $< >> >> clean: >> rm -f edid-decode >> diff --git a/edid-decode.c b/edid-decode.c >> index d0da48e2..effcf777 100644 >> --- a/edid-decode.c >> +++ b/edid-decode.c >> @@ -31,6 +31,7 @@ >> #include <stdlib.h> >> #include <time.h> >> #include <ctype.h> >> +#include <math.h> >> >> #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) >> #define min(a, b) ((a) < (b) ? (a) : (b)) >> @@ -1827,10 +1828,11 @@ static const char *eotf_map[] = { >> "Traditional gamma - SDR luminance range", >> "Traditional gamma - HDR luminance range", >> "SMPTE ST2084", >> + "Hybrid Log-Gamma", >> }; >> >> static void >> -cea_hdr_metadata_block(unsigned char *x) >> +cea_hdr_static_metadata_block(unsigned char *x) >> { >> int length = x[0] & 0x1f; >> int i; >> @@ -1851,13 +1853,16 @@ cea_hdr_metadata_block(unsigned char *x) >> } >> >> if (length >= 4) >> - printf(" Desired content max luminance: %d\n", x[4]); >> + printf(" Desired content max luminance: %d (%.3f cd/m^2)\n", >> + x[4], 50.0 * pow(2, x[4] / 32.0)); >> >> if (length >= 5) >> - printf(" Desired content max frame-average luminance: %d\n", x[5]); >> + printf(" Desired content max frame-average luminance: %d (%.3f >> cd/m^2)\n", >> + x[5], 50.0 * pow(2, x[5] / 32.0)); >> >> if (length >= 6) >> - printf(" Desired content min luminance: %d\n", x[6]); >> + printf(" Desired content min luminance: %d (%.3f cd/m^2)\n", >> + x[6], (50.0 * pow(2, x[4] / 32.0)) * pow(x[6] / 255.0, 2) / >> 100.0); > > are you sure that pow(x[6] / 255.0, 2) is correct ? other terms are pow( 2, > ...).
Yes, it's correct. I double checked this. Regards, Hans > > re, > wh > >> } >> >> static void >> @@ -1924,7 +1929,7 @@ cea_block(unsigned char *x) >> break; >> case 0x06: >> printf("HDR static metadata data block\n"); >> - cea_hdr_metadata_block(x); >> + cea_hdr_static_metadata_block(x); >> break; >> case 0x0d: >> printf("Video format preference data block\n"); > _______________________________________________ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: https://lists.x.org/mailman/listinfo/xorg-devel > _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel