libultrahdr icon indicating copy to clipboard operation
libultrahdr copied to clipboard

Encoding error

Open suhailphotos opened this issue 1 year ago • 1 comments

I encountered an issue when combining the SDR base image with the YUV image. The error I received was "Encountered error during encodeJPEGR call, error code -20002." Interestingly, when I re-exported from Photoshop at a lower quality, everything worked smoothly.

I'm unsure if the problem is related to file size or chroma sampling rates like 4:2:0, or if there's another factor I'm not aware of. I've attached all four images for your reference.

File details:

  1. Source (quality set to maximum -12): trin_rain_acr_3d_gainmap.jpg (3D gain map from Adobe Camera RAW 16.2)
  2. YUV Conversion using FFMpeg: trin_rain_converted_using_ffmpeg.yuv
  3. High-Quality SDR base (output from FFmpeg): trin_rain_base_sdr_high_quality.jpeg
  4. Low-Quality (set to 5) re-export from Ps: trin_rain_base_sdr_low_quality.jpg

Combining images 2 and 3 failed, but combining 2 and 4 was successful.

The command used to run libultrahdr was: ./ultrahdr_app -m 0 -p trin_rain_converted_using_ffmpeg.yuv -i trin_rain_base_sdr_high_quality.jpeg -w 1080 -h 1350

FFmpeg version used: 6.1.1

Here is the link to the images: images link

suhailphotos avatar Mar 05 '24 01:03 suhailphotos

@suhailphotos Thank you for raising this issue. I have looked at the shared images. The problem is trin_rain_base_sdr_high_quality.jpeg internal color format is yuv444. Currently library is handling jpeg inputs with subsampling format yuv420 only. Hence during the decode, library is throwing the error you pointed. Supporting other sampling formats (422, 444, ...) does not require much changes. We will update the library to handle the same.

ram-mohan avatar Mar 07 '24 14:03 ram-mohan

Hi @ram-mohan @suhailphotos,

I believe this issue was fixed by one of our recent update. Could you check if we can close this issue?

Thank you!

DichenZhang1 avatar Jun 12 '24 22:06 DichenZhang1

@DichenZhang1 Some more changes are needed. We are decoding the file but the data is 444. GenerateGainMap has to make use of this correctly. Currently I am working on this.

ram-mohan avatar Jun 13 '24 07:06 ram-mohan

@ram-mohan OK thanks for the update!

DichenZhang1 avatar Jun 13 '24 15:06 DichenZhang1