Server IP : 23.254.227.96 / Your IP : 216.73.216.7 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/root/usr/local/src/libavif-0.11.1/tests/gtest/ |
Upload File : |
// Copyright 2022 Google LLC. All rights reserved. // SPDX-License-Identifier: BSD-2-Clause #include <ostream> #include "avif/avif.h" #include "avif/internal.h" #include "gtest/gtest.h" namespace { struct SetTileConfigurationTestParams { int threads; uint32_t width; uint32_t height; int expected_tile_rows_log2; int expected_tile_cols_log2; }; std::ostream& operator<<(std::ostream& os, const SetTileConfigurationTestParams& test) { return os << "SetTileConfigurationTestParams { threads:" << test.threads << " width:" << test.width << " height:" << test.height << " }"; } TEST(TilingTest, SetTileConfiguration) { constexpr int kThreads = 8; int tile_rows_log2; int tile_cols_log2; constexpr SetTileConfigurationTestParams kTests[]{ // 144p {kThreads, 256, 144, 0, 0}, // 240p {kThreads, 426, 240, 0, 0}, // 360p {kThreads, 640, 360, 0, 0}, // 480p {kThreads, 854, 480, 0, 1}, // 720p {kThreads, 1280, 720, 1, 1}, // 1080p {kThreads, 1920, 1080, 1, 2}, // 2K {kThreads, 2560, 1440, 1, 2}, // 4K {32, 3840, 2160, 2, 3}, // 8K {32, 7680, 4320, 2, 3}, // Kodak image set: 768x512 {kThreads, 768, 512, 0, 1}, {kThreads, 16384, 64, 0, 2}, }; for (const auto& test : kTests) { avifSetTileConfiguration(test.threads, test.width, test.height, &tile_rows_log2, &tile_cols_log2); EXPECT_EQ(tile_rows_log2, test.expected_tile_rows_log2) << test; EXPECT_EQ(tile_cols_log2, test.expected_tile_cols_log2) << test; // Swap width and height. avifSetTileConfiguration(test.threads, test.height, test.width, &tile_rows_log2, &tile_cols_log2); EXPECT_EQ(tile_rows_log2, test.expected_tile_cols_log2) << test; EXPECT_EQ(tile_cols_log2, test.expected_tile_rows_log2) << test; } } } // namespace