jpegrecoverymap: use lookup for applyRecovery
Bug: 261877699
Test: push files from tests/data to /sdcard/Documents and then \
atest libjpegdecoder_test libjpegencoder_test libjpegrecoverymap_test
Change-Id: I1fe0650d53042985839185e31a7300f0fc33dd06
diff --git a/libs/jpegrecoverymap/recoverymap.cpp b/libs/jpegrecoverymap/recoverymap.cpp
index a898f1e..ef5498c 100644
--- a/libs/jpegrecoverymap/recoverymap.cpp
+++ b/libs/jpegrecoverymap/recoverymap.cpp
@@ -46,6 +46,7 @@
#define USE_PQ_OETF_LUT 1
#define USE_HLG_INVOETF_LUT 1
#define USE_PQ_INVOETF_LUT 1
+#define USE_APPLY_RECOVERY_LUT 1
#define JPEGR_CHECK(x) \
{ \
@@ -909,10 +910,12 @@
dest->width = uncompressed_yuv_420_image->width;
dest->height = uncompressed_yuv_420_image->height;
ShepardsIDW idwTable(kMapDimensionScaleFactor);
+ RecoveryLUT recoveryLUT(metadata->rangeScalingFactor);
JobQueue jobQueue;
std::function<void()> applyRecMap = [uncompressed_yuv_420_image, uncompressed_recovery_map,
- metadata, dest, &jobQueue, &idwTable]() -> void {
+ metadata, dest, &jobQueue, &idwTable,
+ &recoveryLUT]() -> void {
const float hdr_ratio = metadata->rangeScalingFactor;
size_t width = uncompressed_yuv_420_image->width;
size_t height = uncompressed_yuv_420_image->height;
@@ -964,8 +967,11 @@
recovery = sampleMap(uncompressed_recovery_map, map_scale_factor, x, y,
idwTable);
}
+#if USE_APPLY_RECOVERY_LUT
+ Color rgb_hdr = applyRecoveryLUT(rgb_sdr, recovery, recoveryLUT);
+#else
Color rgb_hdr = applyRecovery(rgb_sdr, recovery, hdr_ratio);
-
+#endif
Color rgb_gamma_hdr = hdrOetf(rgb_hdr / metadata->rangeScalingFactor);
uint32_t rgba1010102 = colorToRgba1010102(rgb_gamma_hdr);