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

Commit a6721acd authored by Ram Mohan's avatar Ram Mohan Committed by Automerger Merge Worker
Browse files

ultrahdr: Fix nan occurence during xmp generation am: cd3f6373 am: 43665b07

parents 59e302b8 43665b07
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ void JpegHDRFuzzer::process() {
                        } else if (tf == ULTRAHDR_TF_PQ) {
                            metadata.maxContentBoost = kPqMaxNits / kSdrWhiteNits;
                        } else {
                            metadata.maxContentBoost = 0;
                            metadata.maxContentBoost = 1.0f;
                        }
                        metadata.minContentBoost = 1.0f;
                        status = jpegHdr.encodeJPEGR(&jpegImg, &jpegGainMap, &metadata, &jpegImgR);
+7 −1
Original line number Diff line number Diff line
@@ -726,7 +726,7 @@ status_t JpegR::generateGainMap(jr_uncompressed_ptr uncompressed_yuv_420_image,
  map_data.reset(reinterpret_cast<uint8_t*>(dest->data));

  ColorTransformFn hdrInvOetf = nullptr;
  float hdr_white_nits = 0.0f;
  float hdr_white_nits = kSdrWhiteNits;
  switch (hdr_tf) {
    case ULTRAHDR_TF_LINEAR:
      hdrInvOetf = identityConversion;
@@ -1067,6 +1067,12 @@ status_t JpegR::appendGainMap(jr_compressed_ptr compressed_jpeg_image,
    return ERROR_JPEGR_INVALID_NULL_PTR;
  }

  if (metadata->minContentBoost < 1.0f || metadata->maxContentBoost < metadata->minContentBoost) {
    ALOGE("received bad value for content boost min %f, max %f", metadata->minContentBoost,
           metadata->maxContentBoost);
    return ERROR_JPEGR_INVALID_INPUT_TYPE;
  }

  const string nameSpace = "http://ns.adobe.com/xap/1.0/";
  const int nameSpaceLength = nameSpace.size() + 1;  // need to count the null terminator