libhevc-mirror/tests/common/TestCommon.h
Harish Mahendrakar 9f7b41b36c
Some checks failed
CMake / build (cmake, aarch64-linux-gnu-gcc, -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch64_toolchain.cmake, aarch64-linux-gnu-g++, ubuntu-latest-cross-aarch64-cmake, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, arm-linux-gnueabihf-gcc, -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch32_toolchain.cmake, arm-linux-gnueabihf-g++, ubuntu-latest-cross-aarch32-cmake, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, clang, , clang++, macos-latest-clang-cmake, macos-latest) (push) Has been cancelled
CMake / build (cmake, clang, , clang++, ubuntu-24.04-arm-clang-cmake, ubuntu-24.04-arm) (push) Has been cancelled
CMake / build (cmake, clang, , clang++, ubuntu-latest-clang-cmake, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, clang, -DSANITIZE=fuzzer-no-link,address, clang++, ubuntu-latest-clang-cmake-asan-fuzzer, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, clang, -G Ninja, clang++, ubuntu-latest-clang-cmake-ninja, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, gcc, , g++, ubuntu-latest-gcc-cmake, ubuntu-latest) (push) Has been cancelled
Update tests to run with atest
Added Android.bp for the tests and updated them to ensure they run with atest.
2026-07-31 17:05:23 +00:00

66 lines
2 KiB
C++

/******************************************************************************
*
* Copyright (C) 2026 Ittiam Systems Pvt Ltd, Bangalore
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
#pragma once
#include <gtest/gtest.h>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <random>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// clang-format off
#include "ihevc_typedefs.h"
#include "ihevc_inter_pred.h"
#include "ihevc_function_selector.h"
#include "iv.h"
// clang-format on
#include "TestEnums.h"
static constexpr int kMaxSize = 64;
static constexpr int kTapSize = 8;
static constexpr int kMaxHeight = kMaxSize + kTapSize;
const std::vector<std::pair<int, int>>& getLumaPUBlockSizes();
const std::vector<std::pair<int, int>>& getChromaPUBlockSizes();
const std::vector<UWORD8>& getSrc8Buf();
const std::vector<IV_ARCH_T>& getTstArch();
// Compare outputs
template <typename T>
static void compare_output(const std::vector<T>& ref,
const std::vector<T>& test, int wd, int ht,
int dst_strd) {
int size_bytes = wd * sizeof(T);
for (int i = 0; i < ht; ++i) {
int cmp = memcmp(ref.data() + i * dst_strd, test.data() + i * dst_strd,
size_bytes);
ASSERT_EQ(0, cmp) << "Mismatch at row " << i << " for size " << wd << "x"
<< ht;
}
}
std::string get_arch_str(IV_ARCH_T arch);