diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/jpeg-xl/lib/jxl/test_utils.h | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/test_utils.h')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/test_utils.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/test_utils.h b/third_party/jpeg-xl/lib/jxl/test_utils.h index 6734380bf5..15057cc92d 100644 --- a/third_party/jpeg-xl/lib/jxl/test_utils.h +++ b/third_party/jpeg-xl/lib/jxl/test_utils.h @@ -18,13 +18,13 @@ #include <ostream> #include <vector> -#include "lib/extras/dec/decode.h" #include "lib/extras/dec/jxl.h" #include "lib/extras/enc/jxl.h" #include "lib/extras/packed_image.h" #include "lib/jxl/base/data_parallel.h" #include "lib/jxl/base/span.h" #include "lib/jxl/base/status.h" +#include "lib/jxl/butteraugli/butteraugli.h" #include "lib/jxl/codec_in_out.h" #include "lib/jxl/color_encoding_internal.h" #include "lib/jxl/enc_params.h" @@ -63,9 +63,8 @@ void SetThreadParallelRunner(Params params, ThreadPool* pool) { } } -Status DecodeFile(extras::JXLDecompressParams dparams, - const Span<const uint8_t> file, CodecInOut* JXL_RESTRICT io, - ThreadPool* pool = nullptr); +Status DecodeFile(extras::JXLDecompressParams dparams, Span<const uint8_t> file, + CodecInOut* JXL_RESTRICT io, ThreadPool* pool = nullptr); bool Roundtrip(const CodecInOut* io, const CompressParams& cparams, extras::JXLDecompressParams dparams, @@ -74,7 +73,7 @@ bool Roundtrip(const CodecInOut* io, const CompressParams& cparams, // Returns compressed size [bytes]. size_t Roundtrip(const extras::PackedPixelFile& ppf_in, - extras::JXLCompressParams cparams, + const extras::JXLCompressParams& cparams, extras::JXLDecompressParams dparams, ThreadPool* pool, extras::PackedPixelFile* ppf_out); @@ -141,6 +140,18 @@ float ButteraugliDistance(const extras::PackedPixelFile& a, const extras::PackedPixelFile& b, ThreadPool* pool = nullptr); +float ButteraugliDistance(const ImageBundle& rgb0, const ImageBundle& rgb1, + const ButteraugliParams& params, + const JxlCmsInterface& cms, ImageF* distmap = nullptr, + ThreadPool* pool = nullptr, + bool ignore_alpha = false); + +float ButteraugliDistance(const std::vector<ImageBundle>& frames0, + const std::vector<ImageBundle>& frames1, + const ButteraugliParams& params, + const JxlCmsInterface& cms, ImageF* distmap = nullptr, + ThreadPool* pool = nullptr); + float Butteraugli3Norm(const extras::PackedPixelFile& a, const extras::PackedPixelFile& b, ThreadPool* pool = nullptr); @@ -169,6 +180,7 @@ class ThreadPoolForTests { } ThreadPoolForTests(const ThreadPoolForTests&) = delete; ThreadPoolForTests& operator&(const ThreadPoolForTests&) = delete; + // TODO(eustas): avoid unary `&` overload? ThreadPool* operator&() { return pool_.get(); } private: @@ -188,6 +200,8 @@ Status ReadICC(BitReader* JXL_RESTRICT reader, Status EncodeFile(const CompressParams& params, const CodecInOut* io, std::vector<uint8_t>* compressed, ThreadPool* pool = nullptr); +constexpr const char* BoolToCStr(bool b) { return b ? "true" : "false"; } + } // namespace test bool operator==(const jxl::Bytes& a, const jxl::Bytes& b); |