测试代码合入

Signed-off-by: wangyi <wangyi357@h-partners.com>
This commit is contained in:
wangyi
2025-03-13 09:06:33 +08:00
parent f3f32b97af
commit aaf41be20f
9 changed files with 2429 additions and 6 deletions
@@ -29,8 +29,7 @@ constexpr uint32_t DEFAULT_WIDTH = 3840;
constexpr uint32_t DEFAULT_HEIGHT = 2160;
OH_ImageProcessing* imageProcessor = nullptr;
static void CreatePixelmap(OH_PixelmapNative **pixelmap, int32_t width, int32_t height, int format,
OH_NativeColorSpaceManager *colorSpaceNative)
static void CreatePixelmap(OH_PixelmapNative **pixelmap, int32_t width, int32_t height, int format, OH_NativeColorSpaceManager *colorSpaceNative)
{
OH_Pixelmap_InintializationOptions *options = nullptr;
(void)OH_Pixelmap_InintializationOptions_Create(&options);
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VIDEO_SAMPLE_H
#define VIDEO_SAMPLE_H
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VIDEO_SAMPLE_H
#define VIDEO_SAMPLE_H
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VIDEO_SDR2SDR_SAMPLE_H
#define VIDEO_SDR2SDR_SAMPLE_H
+84
View File
@@ -0,0 +1,84 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# 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.
import("//build/test.gni")
import("//build/ohos.gni")
import("//foundation/multimedia/video_processing_engine/config.gni")
module_output_path = MODULE_TEST_OUTPUT_PATH
image_moduletest_native_include_dirs = [
"$CAPI_DIR",
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/test/moduletest/common",
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/../../graphic/graphic_2d/interfaces/inner_api",
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/../../window/window_manager/interfaces/innerkits",
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/../../interface/sdk_c/multimedia/image_framework/include",
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/../image_framework/interfaces/kits/native/include",
]
image_moduletest_cflags = [
"-std=c++17",
"-fno-rtti",
"-fno-exceptions",
"-Wall",
"-fno-common",
"-fstack-protector-strong",
"-Wshadow",
"-FPIC",
"-FS",
"-O2",
"-D_FORTIFY_SOURCE=2",
"-fvisibility=hidden",
"-Wformat=2",
"-Wdate-time",
"-Werror",
"-Wextra",
"-Wimplicit-fallthrough",
"-Wsign-compare",
"-Wunused-parameter",
]
##################################################################################################################
ohos_unittest("vpe_image_native_module_test") {
module_out_path = module_output_path
include_dirs = image_moduletest_native_include_dirs
include_dirs += [ "./" ]
cflags = image_moduletest_cflags
sources = [
"api_test.cpp",
"capability_test.cpp"
]
deps = [
"$FRAMEWORK_DIR:image_processing",
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/../../arkui/napi:ace_napi",
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/../image_framework/frameworks/kits/js/common/pixelmap_ndk:pixelmap_ndk",
]
external_deps = [
"c_utils:utils",
"graphic_2d:libgraphic_utils",
"graphic_2d:librender_service_client",
"graphic_surface:surface",
"hilog:libhilog",
"ipc:ipc_core",
"media_foundation:media_foundation",
"media_foundation:native_media_core",
"window_manager:libwm",
"image_framework:pixelmap",
]
resource_config_file =
"$VIDEO_PROCESSING_ENGINE_ROOT_DIR/test/ndk/moduletest/resources/ohos_test.xml"
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,817 @@
/*
* Copyright (C) 2024 Huawei Device Co., Ltd.
* 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.
*/
#include <iostream>
#include "gtest/gtest.h"
#include "video_processing.h"
#include "image_processing_types.h"
#include "image_processing.h"
#include "enum_list.h"
#include "image/pixelmap_native.h"
using namespace std;
// using namespace OHOS;
// using namespace OHOS::Media;
using namespace testing::ext;
namespace {
class VpeVideoCapTest : public testing::Test {
public:
// SetUpTestCase: Called before all test cases
static void SetUpTestCase(void);
// TearDownTestCase: Called after all test case
static void TearDownTestCase(void);
// SetUp: Called before each test cases
void SetUp(void);
// TearDown: Called after each test cases
void TearDown(void);
};
void VpeVideoCapTest::SetUpTestCase()
{
OH_ImageProcessing_InitializeEnvironment();
}
void VpeVideoCapTest::TearDownTestCase()
{
OH_ImageProcessing_DeinitializeEnvironment();
}
void VpeVideoCapTest::SetUp() {}
void VpeVideoCapTest::TearDown() {}
}
namespace {
/**
* @tc.number : COLORSPACE_SUPPORT_001
* @tc.name : adobergb to srgb
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_001, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = ADOBE_RGB_1998;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = NONE;
outputFormat.colorSpace = SRGB;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_002
* @tc.name : adobergb to display p3
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_002, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = ADOBE_RGB_1998;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = NONE;
outputFormat.colorSpace = DISPLAY_P3;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_003
* @tc.name : srgb to display p3
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_003, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = NONE;
outputFormat.colorSpace = DISPLAY_P3;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_004
* @tc.name : display p3 to srgb
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_004, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = DISPLAY_P3;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = NONE;
outputFormat.colorSpace = SRGB;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_005
* @tc.name : srgb to hlg rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_005, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_006
* @tc.name : srgb to hlg p010
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_006, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_007
* @tc.name : p3 to hlg rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_007, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = DISPLAY_P3;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_008
* @tc.name : p3 to hlg p010
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_008, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = DISPLAY_P3;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0010
* @tc.name : hlg 10bit rgba to p3 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0010, TestSize.Level0)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_HLG,
PIXEL_FORMAT_RGBA_1010102};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0020
* @tc.name : hlg 10bit rgba to srgb 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0020, TestSize.Level1)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_HLG,
PIXEL_FORMAT_RGBA_1010102};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0030
* @tc.name : hlg 10bit nv12 to p3 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0030, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_HLG,
PIXEL_FORMAT_YCBCR_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0040
* @tc.name : hlg 10bit nv12 to hlg 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0040, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_HLG,
PIXEL_FORMAT_YCBCR_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0050
* @tc.name : hlg 10bit nv21 to P3 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0050, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_HLG,
PIXEL_FORMAT_YCRCB_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0060
* @tc.name : hlg 10bit nv21 to hlg 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0060, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_HLG,
PIXEL_FORMAT_YCRCB_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0070
* @tc.name : pq 10bit rgba to p3 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0070, TestSize.Level0)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_PQ,
PIXEL_FORMAT_RGBA_1010102};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0080
* @tc.name : pq 10bit rgba to srgb 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0080, TestSize.Level1)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_PQ,
PIXEL_FORMAT_RGBA_1010102};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0090
* @tc.name : pq 10bit nv12 to P3 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0090, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_PQ,
PIXEL_FORMAT_YCBCR_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0100
* @tc.name : pq 10bit nv12 to hlg 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0100, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_PQ,
PIXEL_FORMAT_YCBCR_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0110
* @tc.name : pq 10bit nv21 to p3 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0110, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_PQ,
PIXEL_FORMAT_YCRCB_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_P3,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : COLORSPACE_DECOMPOSE_0120
* @tc.name : pq 10bit nv21 to hlg 8bit rgba
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0120, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo sourceImageInfo = {ALTERNATE,
BT2020_PQ,
PIXEL_FORMAT_YCRCB_P010};
ImageProcessing_ColorSpaceInfo destinationImageInfo = {BASE,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {GAINMAP,
DISPLAY_SRGB,
PIXEL_FORMAT_RGBA_8888};
ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
&destinationImageInfo, &destinationGainmapInfo));
}
/**
* @tc.number : METADATAGENERATE_SUPPORT_001
* @tc.name : hlg rgba1010102 metadata generate
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_001, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
inputFormat.metadataType = ALTERNATE;
inputFormat.colorSpace = BT2020_HLG;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
if (!access("/system/lib64/media/", 0)) {
// ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
}
}
/**
* @tc.number : METADATAGENERATE_SUPPORT_002
* @tc.name : hlg p010 metadata generate
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_002, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
inputFormat.metadataType = ALTERNATE;
inputFormat.colorSpace = BT2020_HLG;
inputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
}
}
/**
* @tc.number : METADATAGENERATE_SUPPORT_003
* @tc.name : hlg p010_NV21 metadata generate
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_003, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
inputFormat.metadataType = ALTERNATE;
inputFormat.colorSpace = BT2020_HLG;
inputFormat.pixelFormat = PIXEL_FORMAT_YCRCB_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
}
}
/**
* @tc.number : METADATAGENERATE_SUPPORT_004
* @tc.name : pq rgba1010102 metadata generate
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_004, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
inputFormat.metadataType = ALTERNATE;
inputFormat.colorSpace = BT2020_PQ;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
}
}
/**
* @tc.number : METADATAGENERATE_SUPPORT_005
* @tc.name : pq p010 metadata generate
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_005, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
inputFormat.metadataType = ALTERNATE;
inputFormat.colorSpace = BT2020_PQ;
inputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
}
}
/**
* @tc.number : METADATAGENERATE_SUPPORT_006
* @tc.name : pq p010_NV21 metadata generate
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_006, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
inputFormat.metadataType = ALTERNATE;
inputFormat.colorSpace = BT2020_PQ;
inputFormat.pixelFormat = PIXEL_FORMAT_YCRCB_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
}
}
/**
* @tc.number : Composition_SUPPORT_001
* @tc.name : srgb + srgb gainmap to PQ P010
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_001, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = SRGB;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_PQ;
outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
}
/**
* @tc.number : Composition_SUPPORT_002
* @tc.name : p3 + p3 gainmap to PQ P010
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_002, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = DISPLAY_P3;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = DISPLAY_P3;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_PQ;
outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
}
/**
* @tc.number : Composition_SUPPORT_005
* @tc.name : srgb + srgb gainmap to PQ rgba1010102
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_005, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = SRGB;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_PQ;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
}
/**
* @tc.number : Composition_SUPPORT_006
* @tc.name : p3 + p3 gainmap to PQ rgba1010102
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_006, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = DISPLAY_P3;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = DISPLAY_P3;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_PQ;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
}
/**
* @tc.number : Composition_SUPPORT_007
* @tc.name : srgb + srgb gainmap to HLG P010
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_007, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = SRGB;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
}
/**
* @tc.number : Composition_SUPPORT_008
* @tc.name : p3 + p3 gainmap to HLG P010
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_008, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = DISPLAY_P3;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = DISPLAY_P3;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
}
/**
* @tc.number : Composition_SUPPORT_011
* @tc.name : srgb + srgb gainmap to HLG rgba1010102
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_011, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = SRGB;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
/**
* @tc.number : Composition_SUPPORT_012
* @tc.name : p3 + p3 gainmap to HLG rgba1010102
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_012, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo inputGainmapFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = BASE;
inputFormat.colorSpace = DISPLAY_P3;
inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
inputGainmapFormat.metadataType = GAINMAP;
inputGainmapFormat.colorSpace = DISPLAY_P3;
inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
outputFormat.metadataType = ALTERNATE;
outputFormat.colorSpace = BT2020_HLG;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
}
}
/**
* @tc.number : COLORSPACE_SUPPORT_013
* @tc.name : srgb to display p3
* @tc.desc : api test
*/
HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_013, TestSize.Level2)
{
ImageProcessing_ColorSpaceInfo inputFormat;
ImageProcessing_ColorSpaceInfo outputFormat;
inputFormat.metadataType = NONE;
inputFormat.colorSpace = SRGB;
inputFormat.pixelFormat = PIXEL_FORMAT_NV21;
outputFormat.metadataType = NONE;
outputFormat.colorSpace = DISPLAY_P3;
outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
if (!access("/system/lib64/media/", 0)) {
ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
} else {
ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
}
}
} // namespace
+57
View File
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2025 Huawei Device Co., Ltd.
* 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.
*/
#ifndef VPE_IMAGE_TEST_ENUM_H
#define VPE_IMAGE_TEST_ENUM_H
enum COLORSPACE {
UNKNOWN = 0,
ADOBE_RGB_1998 = 1,
DCI_P3 = 2,
DISPLAY_P3 = 3,
SRGB = 4,
BT709 = 6,
BT601_EBU = 7,
BT601_SMPTE_C = 8,
BT2020_HLG = 9,
BT2020_PQ = 10,
P3_HLG = 11,
P3_PQ = 12,
ADOBE_RGB_1998_LIMIT = 13,
DISPLAY_P3_LIMIT = 14,
SRGB_LIMIT = 15,
BT709_LIMIT = 16,
BT601_EBU_LIMIT = 17,
BT601_SMPTE_C_LIMIT = 18,
BT2020_HLG_LIMIT = 19,
BT2020_PQ_LIMIT = 20,
P3_HLG_LIMIT = 21,
P3_PQ_LIMIT = 22,
LINEAR_P3 = 23,
LINEAR_SRGB = 24,
LINEAR_BT709 = LINEAR_SRGB,
LINEAR_BT2020 = 25,
DISPLAY_SRGB = SRGB,
DISPLAY_P3_SRGB = DISPLAY_P3,
DISPLAY_P3_HLG = P3_HLG,
DISPLAY_P3_PQ = P3_PQ,
CUSTOM = 5
};
enum HdrMetadataType {
NONE = 0,
BASE = 1,
GAINMAP = 2,
ALTERNATE = 3
};
#endif
+2 -1
View File
@@ -24,7 +24,8 @@
#include "surface/window.h"
#include "native_buffer.h"
int CheckAndRet(bool cond, int ret, char* msg) {
int CheckAndRet(bool cond, int ret, char* msg)
{
if (!cond) {
std::cout << msg <<" ErrCode:"<< ret << std::endl;
return ret;