@@ -39,7 +39,8 @@ bool DecodeJpegXlOneShot(const uint8_t *jxl, size_t size,
3939 std::vector<uint8_t > *icc_profile,
4040 int * depth,
4141 int * components,
42- bool * useFloats) {
42+ bool * useFloats,
43+ JxlExposedOrientation* exposedOrientation) {
4344 // Multi-threaded parallel runner.
4445 auto runner = JxlResizableParallelRunnerMake (nullptr );
4546
@@ -57,8 +58,11 @@ bool DecodeJpegXlOneShot(const uint8_t *jxl, size_t size,
5758 return false ;
5859 }
5960
61+ JxlDecoderSetKeepOrientation (dec.get (), JXL_TRUE);
62+ JxlDecoderSetUnpremultiplyAlpha (dec.get (), JXL_TRUE);
63+
6064 JxlBasicInfo info;
61- JxlPixelFormat format = {4 , JXL_TYPE_UINT8, JXL_NATIVE_ENDIAN , 0 };
65+ JxlPixelFormat format = {4 , JXL_TYPE_UINT8, JXL_LITTLE_ENDIAN , 0 };
6266
6367 JxlDecoderSetInput (dec.get (), jxl, size);
6468 JxlDecoderCloseInput (dec.get ());
@@ -90,10 +94,11 @@ bool DecodeJpegXlOneShot(const uint8_t *jxl, size_t size,
9094 baseComponents = 4 ;
9195 }
9296 *components = baseComponents;
97+ *exposedOrientation = static_cast <JxlExposedOrientation>(info.orientation );
9398 if (bitDepth > 8 ) {
9499 *useFloats = true ;
95100 hdrImage = true ;
96- format = { static_cast <uint32_t >(baseComponents), JXL_TYPE_FLOAT16, JXL_NATIVE_ENDIAN , 0 };
101+ format = { static_cast <uint32_t >(baseComponents), JXL_TYPE_FLOAT16, JXL_LITTLE_ENDIAN , 0 };
97102 } else {
98103 format.num_channels = baseComponents;
99104 *useFloats = false ;
@@ -212,7 +217,7 @@ bool DecodeBasicInfo(const uint8_t *jxl, size_t size, size_t *xsize, size_t *ysi
212217 */
213218bool EncodeJxlOneshot (const std::vector<uint8_t > &pixels, const uint32_t xsize,
214219 const uint32_t ysize, std::vector<uint8_t > *compressed,
215- jxl_colorspace colorspace, jxl_compression_option compression_option,
220+ JxlPixelType colorspace, JxlCompressionOption compression_option,
216221 float compression_distance) {
217222 auto enc = JxlEncoderMake (/* memory_manager=*/ nullptr );
218223 auto runner = JxlThreadParallelRunnerMake (
0 commit comments