// 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.
#define TEST_LIBJPEG_SUPPORT() \ do { \ if (!jxl::extras::CanDecode(jxl::extras::Codec::kJPG)) { \
fprintf(stderr, "Skipping test because of missing libjpeg codec.\n"); \ return; \
} \
} while (0)
namespace jxl {
struct AuxOut; class CodecInOut; class PaddedBytes; struct PassesEncoderState; class ThreadPool;
// Returns an ICC profile output by the JPEG XL decoder for RGB_D65_SRG_Rel_Lin, // but with, on purpose, rXYZ, bXYZ and gXYZ (the RGB primaries) switched to a // different order to ensure the profile does not match any known profile, so // the encoder cannot encode it in a compact struct instead.
jxl::IccBytes GetIccTestProfile();
// A POD descriptor of a ColorEncoding. Only used in tests as the return value // of AllEncodings(). struct ColorEncodingDescriptor {
ColorSpace color_space;
WhitePoint white_point;
Primaries primaries;
TransferFunction tf;
RenderingIntent rendering_intent;
};
// Define the operator<< for tests. staticinline ::std::ostream& operator<<(::std::ostream& os, const ColorEncodingDescriptor& c) { return os << "ColorEncoding/" << Description(ColorEncodingFromDescriptor(c));
}
// Returns ColorEncodingDescriptors, which are only used in tests. To obtain a // ColorEncoding object call ColorEncodingFromDescriptor and then call // ColorEncoding::CreateProfile() on that object to generate a profile.
std::vector<ColorEncodingDescriptor> AllEncodings();
// Returns a CodecInOut based on the buf, xsize, ysize, and the assumption // that the buffer was created using `GetSomeTestImage`.
jxl::CodecInOut SomeTestImageToCodecInOut(const std::vector<uint8_t>& buf,
size_t num_channels, size_t xsize,
size_t ysize);
// Procedure to convert pixels to double precision, not efficient, but // well-controlled for testing. It uses double, to be able to represent all // precisions needed for the maximum data types the API supports: uint32_t // integers, and, single precision float. The values are in range 0-1 for SDR.
std::vector<double> ConvertToRGBA32(const uint8_t* pixels, size_t xsize,
size_t ysize, const JxlPixelFormat& format, double factor = 0.0);
// Returns amount of pixels which differ between the two pictures. Image b is // the image after roundtrip after roundtrip, image a before roundtrip. There // are more strict requirements for the alpha channel and grayscale values of // the output image.
size_t ComparePixels(const uint8_t* a, const uint8_t* b, size_t xsize,
size_t ysize, const JxlPixelFormat& format_a, const JxlPixelFormat& format_b, double threshold_multiplier = 1.0);
// `icc` may be empty afterwards - if so, call CreateProfile. Does not append, // clears any original data that was in icc. // If `output_limit` is not 0, then returns error if resulting profile would be // longer than `output_limit`
Status ReadICC(BitReader* JXL_RESTRICT reader,
std::vector<uint8_t>* JXL_RESTRICT icc);
// Compresses pixels from `io` (given in any ColorEncoding). // `io->metadata.m.original` must be set.
Status EncodeFile(const CompressParams& params, CodecInOut* io,
std::vector<uint8_t>* compressed, ThreadPool* pool = nullptr);
constexpr constchar* BoolToCStr(bool b) { return b ? "true" : "false"; }
} // namespace test
booloperator==(const jxl::Bytes& a, const jxl::Bytes& b);
// Allow using EXPECT_EQ on jxl::Bytes booloperator!=(const jxl::Bytes& a, const jxl::Bytes& b);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.