summaryrefslogtreecommitdiff
path: root/libs/jpegrecoverymap/jpegdecoder.cpp
diff options
context:
space:
mode:
author Nick Deakin <deakin@google.com> 2022-11-04 10:43:43 -0400
committer Nick Deakin <deakin@google.com> 2022-11-04 17:22:43 -0400
commitf6bca5a5233679a3dd59900c81e622a9c163599c (patch)
tree2d5ad4e41314986fc5c3c03c6621f9556dd8385c /libs/jpegrecoverymap/jpegdecoder.cpp
parentdc6e0d37393b1077dd940a071d20f893bf6c459d (diff)
jpegrecoverymap: add initial recovery map calculations.
This change adds the starting point for generating and applying the recovery map. A follow-up change will add more robust tests for this update (eg. unit testing color conversions). There are a few other known TODOs remaining for these map operations: * Clean up handling around hdr_ratio (ie. utilizing XMP) * Add color space information for inputs and utilize it for ICC data * Add handling for PQ encode/decode No-Typo-Check: Lint suggesting typo in code as if it's a comment Test: build Bug: b/252835416 Change-Id: I2f6a1bf3b046036292afe46bbd2396a87cdc5164
Diffstat (limited to 'libs/jpegrecoverymap/jpegdecoder.cpp')
-rw-r--r--libs/jpegrecoverymap/jpegdecoder.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/libs/jpegrecoverymap/jpegdecoder.cpp b/libs/jpegrecoverymap/jpegdecoder.cpp
index 22a5389648..c1fb6c3f1d 100644
--- a/libs/jpegrecoverymap/jpegdecoder.cpp
+++ b/libs/jpegrecoverymap/jpegdecoder.cpp
@@ -95,7 +95,7 @@ bool JpegDecoder::decompressImage(const void* image, int length) {
return true;
}
-const void* JpegDecoder::getDecompressedImagePtr() {
+void* JpegDecoder::getDecompressedImagePtr() {
return mResultBuffer.data();
}
@@ -103,6 +103,14 @@ size_t JpegDecoder::getDecompressedImageSize() {
return mResultBuffer.size();
}
+size_t JpegDecoder::getDecompressedImageWidth() {
+ return mWidth;
+}
+
+size_t JpegDecoder::getDecompressedImageHeight() {
+ return mHeight;
+}
+
bool JpegDecoder::decode(const void* image, int length) {
jpeg_decompress_struct cinfo;
jpegr_source_mgr mgr(static_cast<const uint8_t*>(image), length);
@@ -119,6 +127,9 @@ bool JpegDecoder::decode(const void* image, int length) {
cinfo.src = &mgr;
jpeg_read_header(&cinfo, TRUE);
+ mWidth = cinfo.image_width;
+ mHeight = cinfo.image_height;
+
if (cinfo.jpeg_color_space == JCS_YCbCr) {
mResultBuffer.resize(cinfo.image_width * cinfo.image_height * 3 / 2, 0);
} else if (cinfo.jpeg_color_space == JCS_GRAYSCALE) {
@@ -222,4 +233,4 @@ bool JpegDecoder::decompressSingleChannel(jpeg_decompress_struct* cinfo, const u
return true;
}
-} // namespace android \ No newline at end of file
+} // namespace android