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

Commit 54e369b1 authored by Dichen Zhang's avatar Dichen Zhang Committed by Automerger Merge Worker
Browse files

Merge "JPEG/R: add encode API-4" into udc-dev am: bfb278d0

parents 432b6d13 bfb278d0
Loading
Loading
Loading
Loading
+35 −4
Original line number Original line Diff line number Diff line
@@ -103,7 +103,10 @@ public:
     * JPEG.
     * JPEG.
     * @param uncompressed_p010_image uncompressed HDR image in P010 color format
     * @param uncompressed_p010_image uncompressed HDR image in P010 color format
     * @param hdr_tf transfer function of the HDR image
     * @param hdr_tf transfer function of the HDR image
     * @param dest destination of the compressed JPEGR image
     * @param dest destination of the compressed JPEGR image. Please note that {@code maxLength}
     *             represents the maximum available size of the desitination buffer, and it must be
     *             set before calling this method. If the encoded JPEGR size exceeds
     *             {@code maxLength}, this method will return {@code ERROR_JPEGR_BUFFER_TOO_SMALL}.
     * @param quality target quality of the JPEG encoding, must be in range of 0-100 where 100 is
     * @param quality target quality of the JPEG encoding, must be in range of 0-100 where 100 is
     *                the highest quality
     *                the highest quality
     * @param exif pointer to the exif metadata.
     * @param exif pointer to the exif metadata.
@@ -125,7 +128,10 @@ public:
     * @param uncompressed_p010_image uncompressed HDR image in P010 color format
     * @param uncompressed_p010_image uncompressed HDR image in P010 color format
     * @param uncompressed_yuv_420_image uncompressed SDR image in YUV_420 color format
     * @param uncompressed_yuv_420_image uncompressed SDR image in YUV_420 color format
     * @param hdr_tf transfer function of the HDR image
     * @param hdr_tf transfer function of the HDR image
     * @param dest destination of the compressed JPEGR image
     * @param dest destination of the compressed JPEGR image. Please note that {@code maxLength}
     *             represents the maximum available size of the desitination buffer, and it must be
     *             set before calling this method. If the encoded JPEGR size exceeds
     *             {@code maxLength}, this method will return {@code ERROR_JPEGR_BUFFER_TOO_SMALL}.
     * @param quality target quality of the JPEG encoding, must be in range of 0-100 where 100 is
     * @param quality target quality of the JPEG encoding, must be in range of 0-100 where 100 is
     *                the highest quality
     *                the highest quality
     * @param exif pointer to the exif metadata.
     * @param exif pointer to the exif metadata.
@@ -152,7 +158,10 @@ public:
     *                                         input
     *                                         input
     * @param compressed_jpeg_image compressed 8-bit JPEG image
     * @param compressed_jpeg_image compressed 8-bit JPEG image
     * @param hdr_tf transfer function of the HDR image
     * @param hdr_tf transfer function of the HDR image
     * @param dest destination of the compressed JPEGR image
     * @param dest destination of the compressed JPEGR image. Please note that {@code maxLength}
     *             represents the maximum available size of the desitination buffer, and it must be
     *             set before calling this method. If the encoded JPEGR size exceeds
     *             {@code maxLength}, this method will return {@code ERROR_JPEGR_BUFFER_TOO_SMALL}.
     * @return NO_ERROR if encoding succeeds, error code if error occurs.
     * @return NO_ERROR if encoding succeeds, error code if error occurs.
     */
     */
    status_t encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
    status_t encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
@@ -173,7 +182,10 @@ public:
     * @param uncompressed_p010_image uncompressed HDR image in P010 color format
     * @param uncompressed_p010_image uncompressed HDR image in P010 color format
     * @param compressed_jpeg_image compressed 8-bit JPEG image
     * @param compressed_jpeg_image compressed 8-bit JPEG image
     * @param hdr_tf transfer function of the HDR image
     * @param hdr_tf transfer function of the HDR image
     * @param dest destination of the compressed JPEGR image
     * @param dest destination of the compressed JPEGR image. Please note that {@code maxLength}
     *             represents the maximum available size of the desitination buffer, and it must be
     *             set before calling this method. If the encoded JPEGR size exceeds
     *             {@code maxLength}, this method will return {@code ERROR_JPEGR_BUFFER_TOO_SMALL}.
     * @return NO_ERROR if encoding succeeds, error code if error occurs.
     * @return NO_ERROR if encoding succeeds, error code if error occurs.
     */
     */
    status_t encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
    status_t encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
@@ -181,6 +193,25 @@ public:
                         ultrahdr_transfer_function hdr_tf,
                         ultrahdr_transfer_function hdr_tf,
                         jr_compressed_ptr dest);
                         jr_compressed_ptr dest);


    /*
     * Encode API-4
     * Assemble JPEGR image from SDR JPEG and gainmap JPEG.
     *
     * Assemble the primary JPEG image, the gain map and the metadata to JPEG/R format.
     * @param compressed_jpeg_image compressed 8-bit JPEG image
     * @param compressed_gainmap compressed 8-bit JPEG single channel image
     * @param metadata metadata to be written in XMP of the primary jpeg
     * @param dest destination of the compressed JPEGR image. Please note that {@code maxLength}
     *             represents the maximum available size of the desitination buffer, and it must be
     *             set before calling this method. If the encoded JPEGR size exceeds
     *             {@code maxLength}, this method will return {@code ERROR_JPEGR_BUFFER_TOO_SMALL}.
     * @return NO_ERROR if encoding succeeds, error code if error occurs.
     */
    status_t encodeJPEGR(jr_compressed_ptr compressed_jpeg_image,
                         jr_compressed_ptr compressed_gainmap,
                         ultrahdr_metadata_ptr metadata,
                         jr_compressed_ptr dest);

    /*
    /*
     * Decode API
     * Decode API
     * Decompress JPEGR image.
     * Decompress JPEGR image.
+10 −0
Original line number Original line Diff line number Diff line
@@ -338,6 +338,16 @@ status_t JpegR::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
  return NO_ERROR;
  return NO_ERROR;
}
}


/* Encode API-4 */
status_t JpegR::encodeJPEGR(jr_compressed_ptr compressed_jpeg_image,
                            jr_compressed_ptr compressed_gainmap,
                            ultrahdr_metadata_ptr metadata,
                            jr_compressed_ptr dest) {
  JPEGR_CHECK(appendGainMap(compressed_jpeg_image, compressed_gainmap, /* exif */ nullptr,
          metadata, dest));
  return NO_ERROR;
}

status_t JpegR::getJPEGRInfo(jr_compressed_ptr compressed_jpegr_image, jr_info_ptr jpegr_info) {
status_t JpegR::getJPEGRInfo(jr_compressed_ptr compressed_jpegr_image, jr_info_ptr jpegr_info) {
  if (compressed_jpegr_image == nullptr || jpegr_info == nullptr) {
  if (compressed_jpegr_image == nullptr || jpegr_info == nullptr) {
    return ERROR_JPEGR_INVALID_NULL_PTR;
    return ERROR_JPEGR_INVALID_NULL_PTR;