summaryrefslogtreecommitdiff
path: root/libs/ultrahdr/jpegencoderhelper.cpp
AgeCommit message (Collapse)Author
2024-01-04Removed duplicade library Dichen Zhang
Bug: 313791883 Test: build Change-Id: Ib4d58ebec02270f2c6dda4b307d03bd7e5526391
2023-08-02ultrahdr: update jpegencoderhelper to accept uncompressed struct fields Ram Mohan
With this change we can now pass luma/chroma ptrs and stride information to jpegencoderhelper class during compression. This by passes intermediate copy whenever possible Also updated fuzzer to incorporate 420 stride support updated jpegr unit tests for more combinations of gamuts and unusual strides Bug: 294218453 Test: ./ultrahdr_unit_test Test: ./ultrahdr_enc_fuzzer Change-Id: Ic50dd34b0c680618e73e0cb27f554b9bf8272e8f
2023-08-02ultrahdr: updates to jpegr impl Ram Mohan
- clang-format the code to a common guideline - return status of areInputArgumentsValid call as-is - rename variables for easier understanding - reduce control code by assigning stride(s) and chroma ptr after input validation - if 420 color space is bt601, do not perform copy before compressImage TODO: ensure compressImage function takes luma ptr, chroma ptrs, luma stride, chroma stride as well there by avoiding all clobbering/intermediate copying Bug: Test: ./ultrahdr_unit_test Change-Id: I9cda53419e1a7e8d68ddae571ea1bdd2ba5168f4
2023-08-02Merge "ultrahdr: do not select less accurate integer method during dct" into ↵ Dichen Zhang
main
2023-06-13ultrahdr: do not select less accurate integer method during dct Ram Mohan
At high quality setting, less accurate integer method can have larger psnr drops. Switch to default setting Bug: 286617381 Test: ./libultrahdr_app -p inp_p010.yuv -y inp_420p.yuv -w 1920 -h 1080 -o 0 Change-Id: Ide126b87262e1c9a20edca7873b6ca27fc52b2cb
2023-06-06ultrahdr: release memory if encode/decode fails Ram Mohan
If calls to encode/decode failed, release the allocated memory before returning the control to caller Bug: 285546217 Test: ./ultrahdr_dec_fuzzer Test: ./ultrahdr_enc_fuzzer Change-Id: I276c31cc56656aa41845a16f5d28783bc3adc772
2023-05-31ultrahdr: compress image reads outside bounds for non aligned widths Ram Mohan
jpeg_write_raw_data() processes one MCU row per call, and thus one must pass buffer of at least max_v_samp_factor * DCTSIZE scanlines. The buffer must be large enough to hold the actual data plus padding to DCT-block boundaries. Bug: 284117683 Test: ./ultrahdr_enc_fuzzer Change-Id: I993773817bf3805463bb21bb977624d6c2d45a0b
2023-04-18JPEG/R: lift the checking criteria for width 8-alignment Dichen Zhang
JPEG/R library uses jpeg-turbo for JPEG encoding, which runs DCT transform on block size of 16x16 for luma, and 8x8 for chroma. The resolution in the bug report is not 16-aligned and it results in null pointer dereference for the last line in jpeg-turbo. The original checking for 8-alignment width was wrong (should check 16-alignment). jpeg-turbo has some edge case handling for this case, and it requires some extra room at the end of input. This change removed the checking criteria by adding a padding zero method. A reason size of the padding zeros is a CB block, which is 8x8, 64 bytes. Bug: 277982036 Test: CTS: ImageReaderTest#testJpegR, uint test: jpegrencoderhelper_test.cpp Change-Id: I1313a002db6d4bc63b32dc3dd3d6ccdf06779149
2023-04-17JPEG/R refactor: rename jpegrecoverymap library to ultrahdr Dichen Zhang
Test: build Bug: b/264715926 Change-Id: I227fb5960f8fc7e13aae354bf77ec033850faf10