summaryrefslogtreecommitdiff
path: root/media/libjxl/src/lib/jxl/enc_xyb.h
diff options
context:
space:
mode:
authorJob Bautista <jobbautista9@protonmail.com>2022-06-19 15:34:18 +0800
committerJob Bautista <jobbautista9@protonmail.com>2022-06-29 13:53:09 +0800
commit73e06b6df9e396ef080fefcaa3196265bff723c4 (patch)
tree47caa76143ab4bdf70c2a0eb5f4657d2fe0ee22b /media/libjxl/src/lib/jxl/enc_xyb.h
parent8c1064bc1cb494e445a6447587afb8942a6b783b (diff)
downloaduxp-73e06b6df9e396ef080fefcaa3196265bff723c4.tar.gz
Issue #1769 - Part 1: Add vendored libjxl and highway sources.
Used old-configure to add the build option for enabling JPEG-XL support. Highway version: 0.17.0 libjxl version: tree of commit 318c592d98b97d103941b90d47107f06a10c71da
Diffstat (limited to 'media/libjxl/src/lib/jxl/enc_xyb.h')
-rw-r--r--media/libjxl/src/lib/jxl/enc_xyb.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/media/libjxl/src/lib/jxl/enc_xyb.h b/media/libjxl/src/lib/jxl/enc_xyb.h
new file mode 100644
index 0000000000..aaa0ccc920
--- /dev/null
+++ b/media/libjxl/src/lib/jxl/enc_xyb.h
@@ -0,0 +1,45 @@
+// Copyright (c) the JPEG XL Project Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#ifndef LIB_JXL_ENC_XYB_H_
+#define LIB_JXL_ENC_XYB_H_
+
+// Converts to XYB color space.
+
+#include "lib/jxl/aux_out_fwd.h"
+#include "lib/jxl/base/compiler_specific.h"
+#include "lib/jxl/base/data_parallel.h"
+#include "lib/jxl/base/status.h"
+#include "lib/jxl/enc_bit_writer.h"
+#include "lib/jxl/image.h"
+#include "lib/jxl/image_bundle.h"
+
+namespace jxl {
+
+// Converts any color space to XYB. If `linear` is not null, returns `linear`
+// after filling it with a linear sRGB copy of `in`. Otherwise, returns `&in`.
+//
+// NOTE this return value can avoid an extra color conversion if `in` would
+// later be passed to JxlButteraugliComparator.
+const ImageBundle* ToXYB(const ImageBundle& in, ThreadPool* pool,
+ Image3F* JXL_RESTRICT xyb, const JxlCmsInterface& cms,
+ ImageBundle* JXL_RESTRICT linear = nullptr);
+
+// Bt.601 to match JPEG/JFIF. Outputs _signed_ YCbCr values suitable for DCT,
+// see F.1.1.3 of T.81 (because our data type is float, there is no need to add
+// a bias to make the values unsigned).
+Status RgbToYcbcr(const ImageF& r_plane, const ImageF& g_plane,
+ const ImageF& b_plane, ImageF* y_plane, ImageF* cb_plane,
+ ImageF* cr_plane, ThreadPool* pool);
+
+// DEPRECATED, used by opsin_image_wrapper.
+Image3F OpsinDynamicsImage(const Image3B& srgb8, const JxlCmsInterface& cms);
+
+// For opsin_image_test.
+void TestCubeRoot();
+
+} // namespace jxl
+
+#endif // LIB_JXL_ENC_XYB_H_