⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.23
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
local
/
src
/
libavif-0.11.1
/
tests
/
gtest
/
View File Name :
are_images_equal.cc
// Copyright 2022 Google LLC. All rights reserved. // SPDX-License-Identifier: BSD-2-Clause // Compares two files and returns whether they are the same once decoded. #include <iostream> #include <string> #include "aviftest_helpers.h" #include "avifutil.h" using libavif::testutil::AvifImagePtr; int main(int argc, char** argv) { if (argc != 4) { std::cerr << "Wrong argument: " << argv[0] << " file1 file2 ignore_alpha_flag" << std::endl; return 2; } AvifImagePtr decoded[2] = { AvifImagePtr(avifImageCreateEmpty(), avifImageDestroy), AvifImagePtr(avifImageCreateEmpty(), avifImageDestroy)}; if (!decoded[0] || !decoded[1]) { std::cerr << "Cannot create AVIF images." << std::endl; return 2; } uint32_t depth[2]; // Request the bit depth closest to the bit depth of the input file. constexpr int kRequestedDepth = 0; constexpr avifPixelFormat requestedFormat = AVIF_PIXEL_FORMAT_NONE; for (int i : {0, 1}) { // Make sure no color conversion happens. decoded[i]->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_IDENTITY; if (avifReadImage(argv[i + 1], requestedFormat, kRequestedDepth, AVIF_CHROMA_DOWNSAMPLING_AUTOMATIC, /*ignoreICC=*/AVIF_FALSE, /*ignoreExif=*/AVIF_FALSE, /*ignoreXMP=*/AVIF_FALSE, decoded[i].get(), &depth[i], nullptr, nullptr) == AVIF_APP_FILE_FORMAT_UNKNOWN) { std::cerr << "Image " << argv[i + 1] << " cannot be read." << std::endl; return 2; } } if (depth[0] != depth[1]) { std::cerr << "Images " << argv[1] << " and " << argv[2] << " have different depths." << std::endl; return 1; } if (!libavif::testutil::AreImagesEqual(*decoded[0], *decoded[1], std::stoi(argv[3]))) { std::cerr << "Images " << argv[1] << " and " << argv[2] << " are different." << std::endl; return 1; } std::cout << "Images " << argv[1] << " and " << argv[2] << " are identical." << std::endl; return 0; }