diff options
author | 2023-08-21 18:12:53 +0530 | |
---|---|---|
committer | 2023-08-29 21:06:01 +0000 | |
commit | ebfb373efedb052eb3c10fa4429459a70ed60701 (patch) | |
tree | b02947a572f1310032c4e7cbdca706890adef52b | |
parent | 0202c12515ed55a4450377776d1601bbc135f4b5 (diff) |
ultrahdr: Correct hdr white nits for linear input
The hdr white nits for linear input is set to sdr white nits. This
causes huge losses during gain map compression. For linear inputs
now we are marking peak white nits to peak hlg white nits
Bug:
Test: ./ultrahdr_sample_app -p inp_p010.yuv -w 1920 -h 1080
Change-Id: I635d7d4cb7d2d3de9b2b24a59b175e05fbb3c189
-rw-r--r-- | libs/ultrahdr/include/ultrahdr/ultrahdr.h | 1 | ||||
-rw-r--r-- | libs/ultrahdr/jpegr.cpp | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/libs/ultrahdr/include/ultrahdr/ultrahdr.h b/libs/ultrahdr/include/ultrahdr/ultrahdr.h index 66f70889fb..0252391a86 100644 --- a/libs/ultrahdr/include/ultrahdr/ultrahdr.h +++ b/libs/ultrahdr/include/ultrahdr/ultrahdr.h @@ -30,6 +30,7 @@ typedef enum { } ultrahdr_color_gamut; // Transfer functions for image data +// TODO: TF LINEAR is deprecated, remove this enum and the code surrounding it. typedef enum { ULTRAHDR_TF_UNSPECIFIED = -1, ULTRAHDR_TF_LINEAR = 0, diff --git a/libs/ultrahdr/jpegr.cpp b/libs/ultrahdr/jpegr.cpp index dc439d785a..55333b347a 100644 --- a/libs/ultrahdr/jpegr.cpp +++ b/libs/ultrahdr/jpegr.cpp @@ -817,10 +817,13 @@ status_t JpegR::generateGainMap(jr_uncompressed_ptr yuv420_image_ptr, map_data.reset(reinterpret_cast<uint8_t*>(dest->data)); ColorTransformFn hdrInvOetf = nullptr; - float hdr_white_nits = kSdrWhiteNits; + float hdr_white_nits; switch (hdr_tf) { case ULTRAHDR_TF_LINEAR: hdrInvOetf = identityConversion; + // Note: this will produce clipping if the input exceeds kHlgMaxNits. + // TODO: TF LINEAR will be deprecated. + hdr_white_nits = kHlgMaxNits; break; case ULTRAHDR_TF_HLG: #if USE_HLG_INVOETF_LUT |