libjpegrecoverymap: refactor encode APIs
1. remove hdr_ratio as an input parameter
2. pass quality into encoder
Bug: b/252835416
Test: build
Change-Id: If877e153f786e9b7daeacb7a65ab1296455faf67
diff --git a/libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h b/libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h
index 94b7543..8e36250 100644
--- a/libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h
+++ b/libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h
@@ -82,16 +82,13 @@
* @param quality target quality of the JPEG encoding, must be in range of 0-100 where 100 is
* the highest quality
* @param exif pointer to the exif metadata.
- * @param hdr_ratio HDR ratio. If not configured, this value will be calculated by the JPEG/R
- * encoder.
* @return NO_ERROR if encoding succeeds, error code if error occurs.
*/
status_t encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
jr_uncompressed_ptr uncompressed_yuv_420_image,
jr_compressed_ptr dest,
int quality,
- jr_exif_ptr exif,
- float hdr_ratio = 0.0f);
+ jr_exif_ptr exif);
/*
* Compress JPEGR image from 10-bit HDR YUV, 8-bit SDR YUV and compressed 8-bit JPEG.
@@ -104,15 +101,12 @@
* @param uncompressed_yuv_420_image uncompressed SDR image in YUV_420 color format
* @param compressed_jpeg_image compressed 8-bit JPEG image
* @param dest destination of the compressed JPEGR image
- * @param hdr_ratio HDR ratio. If not configured, this value will be calculated by the JPEG/R
- * encoder.
* @return NO_ERROR if encoding succeeds, error code if error occurs.
*/
status_t encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
jr_uncompressed_ptr uncompressed_yuv_420_image,
jr_compressed_ptr compressed_jpeg_image,
- jr_compressed_ptr dest,
- float hdr_ratio = 0.0f);
+ jr_compressed_ptr dest);
/*
* Compress JPEGR image from 10-bit HDR YUV and 8-bit SDR YUV.
@@ -125,14 +119,11 @@
* @param uncompressed_p010_image uncompressed HDR image in P010 color format
* @param compressed_jpeg_image compressed 8-bit JPEG image
* @param dest destination of the compressed JPEGR image
- * @param hdr_ratio HDR ratio. If not configured, this value will be calculated by the JPEG/R
- * encoder.
* @return NO_ERROR if encoding succeeds, error code if error occurs.
*/
status_t encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
jr_compressed_ptr compressed_jpeg_image,
- jr_compressed_ptr dest,
- float hdr_ratio = 0.0f);
+ jr_compressed_ptr dest);
/*
* Decompress JPEGR image.
diff --git a/libs/jpegrecoverymap/recoverymap.cpp b/libs/jpegrecoverymap/recoverymap.cpp
index 4a90053..d46025c 100644
--- a/libs/jpegrecoverymap/recoverymap.cpp
+++ b/libs/jpegrecoverymap/recoverymap.cpp
@@ -64,8 +64,7 @@
jr_uncompressed_ptr uncompressed_yuv_420_image,
jr_compressed_ptr dest,
int quality,
- jr_exif_ptr /* exif */,
- float /* hdr_ratio */) {
+ jr_exif_ptr /* exif */) {
if (uncompressed_p010_image == nullptr
|| uncompressed_yuv_420_image == nullptr
|| dest == nullptr) {
@@ -93,11 +92,10 @@
JPEGR_CHECK(compressRecoveryMap(&map, &compressed_map));
JpegEncoder jpeg_encoder;
- // TODO: what quality to use?
// TODO: ICC data - need color space information
if (!jpeg_encoder.compressImage(uncompressed_yuv_420_image->data,
uncompressed_yuv_420_image->width,
- uncompressed_yuv_420_image->height, 95, nullptr, 0)) {
+ uncompressed_yuv_420_image->height, quality, nullptr, 0)) {
return ERROR_JPEGR_ENCODE_ERROR;
}
jpegr_compressed_struct jpeg;
@@ -112,8 +110,7 @@
status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
jr_uncompressed_ptr uncompressed_yuv_420_image,
jr_compressed_ptr compressed_jpeg_image,
- jr_compressed_ptr dest,
- float /* hdr_ratio */) {
+ jr_compressed_ptr dest) {
if (uncompressed_p010_image == nullptr
|| uncompressed_yuv_420_image == nullptr
|| compressed_jpeg_image == nullptr
@@ -144,8 +141,7 @@
status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
jr_compressed_ptr compressed_jpeg_image,
- jr_compressed_ptr dest,
- float /* hdr_ratio */) {
+ jr_compressed_ptr dest) {
if (uncompressed_p010_image == nullptr
|| compressed_jpeg_image == nullptr
|| dest == nullptr) {