Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebfb373e authored by Ram Mohan's avatar Ram Mohan Committed by Dichen Zhang
Browse files

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
parent 0202c125
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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,
+4 −1
Original line number Diff line number Diff line
@@ -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