24 #define BITSTREAM_READER_LE
60 #define jxl_bits(n) get_bits_long(gb, (n))
61 #define jxl_bits_skip(n) skip_bits_long(gb, (n))
62 #define jxl_u32(c0, c1, c2, c3, u0, u1, u2, u3) jpegxl_u32(gb, \
63 (const uint32_t[]){c0, c1, c2, c3}, (const uint32_t[]){u0, u1, u2, u3})
64 #define jxl_u64() jpegxl_u64(gb)
65 #define jxl_enum() jxl_u32(0, 1, 2, 18, 0, 0, 4, 6)
69 const uint32_t
constants[4],
const uint32_t ubits[4])
114 uint64_t height64 =
height;
119 return (uint32_t)((height64 * 12) / 10);
121 return (uint32_t)((height64 * 4) / 3);
123 return (uint32_t)((height64 * 3) / 2);
125 return (uint32_t)((height64 * 16) / 9);
127 return (uint32_t)((height64 * 5) / 4);
129 return (uint32_t)(height64 * 2);
199 jxl_u32(32, 16, 24, 1, 0, 0, 0, 6);
203 jxl_u32(8, 10, 12, 1, 0, 0, 0, 6);
214 uint32_t
type, name_len = 0;
223 jxl_u32(0, 3, 4, 1, 0, 0, 0, 3);
225 name_len =
jxl_u32(0, 0, 16, 48, 0, 4, 5, 10);
240 jxl_u32(1, 0, 3, 19, 0, 2, 4, 8);
249 int all_default, extra_fields = 0;
250 int xyb_encoded = 1, have_icc_profile = 0;
251 uint32_t num_extra_channels;
288 jxl_u32(100, 1000, 1, 1, 0, 0, 10, 30);
289 jxl_u32(1, 1001, 1, 1, 0, 0, 8, 10);
290 jxl_u32(0, 0, 0, 0, 0, 3, 16, 32);
302 num_extra_channels =
jxl_u32(0, 1, 2, 1, 0, 0, 4, 12);
303 if (num_extra_channels > 4)
305 for (uint32_t
i = 0;
i < num_extra_channels;
i++) {
314 uint32_t color_space;
317 if (color_space > 63)
320 if (!have_icc_profile) {
323 if (white_point > 63)
327 jxl_u32(0, 524288, 1048576, 2097152, 19, 19, 20, 21);
328 jxl_u32(0, 524288, 1048576, 2097152, 19, 19, 20, 21);
337 for (
int i = 0;
i < 6;
i++)
338 jxl_u32(0, 524288, 1048576, 2097152, 19, 19, 20, 21);
365 for (
int i = 0;
i < 64;
i++) {
366 if (extensions & (UINT64_C(1) <<
i))
386 if (!have_icc_profile) {
388 if (bits_remaining &&
jxl_bits(bits_remaining))