From a9d103832ad5239d40d93e37e8adf914cd89e396 Mon Sep 17 00:00:00 2001 From: mediaTest Date: Tue, 22 Apr 2025 10:08:44 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=9B=BE=E7=89=87NDK?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mediaTest --- test/ndk/moduletest/image/BUILD.gn | 74 ++ test/ndk/moduletest/image/api_test.cpp | 1139 +++++++++++++++++ test/ndk/moduletest/image/capability_test.cpp | 850 ++++++++++++ 3 files changed, 2063 insertions(+) create mode 100644 test/ndk/moduletest/image/BUILD.gn create mode 100644 test/ndk/moduletest/image/api_test.cpp create mode 100644 test/ndk/moduletest/image/capability_test.cpp diff --git a/test/ndk/moduletest/image/BUILD.gn b/test/ndk/moduletest/image/BUILD.gn new file mode 100644 index 0000000..40430a3 --- /dev/null +++ b/test/ndk/moduletest/image/BUILD.gn @@ -0,0 +1,74 @@ +# 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") +image_moduletest_native_include_dirs = [ + "$CAPI_DIR", + "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/test/moduletest/common", +] + +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 = "video_processing_engine/moduletest" + include_dirs = image_moduletest_native_include_dirs + include_dirs += ["../common/"] + cflags = image_moduletest_cflags + + sources = [ + "api_test.cpp", + "capability_test.cpp" + ] + + deps = [ + "$FRAMEWORK_DIR:image_processing", + ] + + external_deps = [ + "c_utils:utils", + "graphic_2d:libgraphic_utils", + "graphic_2d:librender_service_client", + "graphic_2d:libnative_color_space_manager", + "graphic_surface:surface", + "hilog:libhilog", + "image_framework:pixelmap", + "image_framework:image", + "ipc:ipc_core", + ] + + resource_config_file = + "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/test/ndk/moduletest/resources/ohos_test.xml" +} diff --git a/test/ndk/moduletest/image/api_test.cpp b/test/ndk/moduletest/image/api_test.cpp new file mode 100644 index 0000000..13bbc72 --- /dev/null +++ b/test/ndk/moduletest/image/api_test.cpp @@ -0,0 +1,1139 @@ +/* + * 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. + */ +#include +#include +#include +#include +#include +#include +#include "gtest/gtest.h" +#include "image_processing.h" +#include "native_color_space_manager.h" +#include "nocopyable.h" +#include "pixelmap_native.h" +#include "native_buffer.h" +using namespace std; +using namespace OHOS; +using namespace testing::ext; +namespace { +constexpr uint32_t DEFAULT_WIDTH = 3840; +constexpr uint32_t DEFAULT_HEIGHT = 2160; +constexpr uint32_t PIX_SIZE = DEFAULT_WIDTH * DEFAULT_HEIGHT * 4; +uint8_t *g_pixData = nullptr; + +OH_Pixelmap_InitializationOptions *g_createOpts_RGBA = nullptr; +OH_Pixelmap_InitializationOptions *g_createOpts_BGRA = nullptr; +OH_PixelmapNative *pixelMap_RGBA = nullptr; +OH_PixelmapNative *pixelMap_BGRA = nullptr; +void InitCreatePixelmapParamRGBA() +{ + if (g_createOpts_RGBA == nullptr) { + OH_PixelmapInitializationOptions_Create(&g_createOpts_RGBA); + OH_PixelmapInitializationOptions_SetWidth(g_createOpts_RGBA, DEFAULT_WIDTH); + OH_PixelmapInitializationOptions_SetHeight(g_createOpts_RGBA, DEFAULT_HEIGHT); + OH_PixelmapInitializationOptions_SetPixelFormat(g_createOpts_RGBA, NATIVEBUFFER_PIXEL_FMT_RGBA_8888); + } +} +void InitCreatePixelmapParamBGRA() +{ + if (g_createOpts_BGRA == nullptr) { + OH_PixelmapInitializationOptions_Create(&g_createOpts_BGRA); + OH_PixelmapInitializationOptions_SetWidth(g_createOpts_BGRA, DEFAULT_WIDTH); + OH_PixelmapInitializationOptions_SetHeight(g_createOpts_BGRA, DEFAULT_HEIGHT); + OH_PixelmapInitializationOptions_SetPixelFormat(g_createOpts_BGRA, PIXEL_FORMAT_BGRA_8888); + } +} + + +class VpeImageApiTest : 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 VpeImageApiTest::SetUpTestCase() +{ + g_pixData = new uint8_t[PIX_SIZE]; + InitCreatePixelmapParamRGBA(); + InitCreatePixelmapParamBGRA(); + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &pixelMap_RGBA); + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_BGRA, &pixelMap_BGRA); +} +void VpeImageApiTest::TearDownTestCase() +{ + if (g_pixData) { + delete[] g_pixData; + g_pixData = nullptr; + } + if (g_createOpts_RGBA) { + OH_PixelmapInitializationOptions_Release(g_createOpts_RGBA); + g_createOpts_RGBA = nullptr; + } + if (g_createOpts_BGRA) { + OH_PixelmapInitializationOptions_Release(g_createOpts_BGRA); + g_createOpts_BGRA = nullptr; + } +} +void VpeImageApiTest::SetUp() +{ +} +void VpeImageApiTest::TearDown() +{ + OH_ImageProcessing_DeinitializeEnvironment(); +} + + +const ImageProcessing_ColorSpaceInfo CSC_SRC_INFO = {HDR_METADATA_TYPE_NONE, + SRGB, + PIXEL_FORMAT_RGBA_8888}; +const ImageProcessing_ColorSpaceInfo CSC_DST_INFO = {HDR_METADATA_TYPE_NONE, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; +const ImageProcessing_ColorSpaceInfo COMPOSE_SRC_INFO = {HDR_METADATA_TYPE_BASE, + SRGB, + PIXEL_FORMAT_RGBA_8888}; + +const ImageProcessing_ColorSpaceInfo COMPOSE_SRC_GAIN_INFO = {HDR_METADATA_TYPE_GAINMAP, + SRGB, + PIXEL_FORMAT_RGBA_8888}; +const ImageProcessing_ColorSpaceInfo COMPOSE_DST_INFO = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_HLG, + PIXEL_FORMAT_RGBA_1010102}; +const ImageProcessing_ColorSpaceInfo UNSUPPORTED_INFO = {HDR_METADATA_TYPE_NONE, + BT601_EBU, + PIXEL_FORMAT_BGRA_8888}; + +} + +namespace { +#ifdef ENABLE_ALL_PROCESS +static bool g_suppported = true; +#else +static bool g_suppported = false; +#endif + +/** + * @tc.number : VPE_IMAGE_API_TEST_0010 + * @tc.name : first call OH_ImageProcessing_InitializeEnvironment + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0010, TestSize.Level0) +{ + ImageProcessing_ErrorCode ret = OH_ImageProcessing_InitializeEnvironment(); + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_ImageProcessing_DeinitializeEnvironment(); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0020 + * @tc.name : first call OH_ImageProcessing_DeinitializeEnvironment + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0020, TestSize.Level0) +{ + ImageProcessing_ErrorCode ret = OH_ImageProcessing_DeinitializeEnvironment(); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0030 + * @tc.name : first call OH_ImageProcessing_DeinitializeEnvironment after initialize + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0030, TestSize.Level0) +{ + ImageProcessing_ErrorCode ret = OH_ImageProcessing_InitializeEnvironment(); + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_ImageProcessing_DeinitializeEnvironment(); + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0040 + * @tc.name : call OH_ImageProcessing_IsColorSpaceConversionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0040, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsColorSpaceConversionSupported(nullptr, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0050 + * @tc.name : call OH_ImageProcessing_IsColorSpaceConversionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0050, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsColorSpaceConversionSupported(&CSC_SRC_INFO, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0060 + * @tc.name : call OH_ImageProcessing_IsColorSpaceConversionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0060, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsColorSpaceConversionSupported(nullptr, &CSC_DST_INFO); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0070 + * @tc.name : call OH_ImageProcessing_IsColorSpaceConversionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0070, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsColorSpaceConversionSupported(&CSC_SRC_INFO, &CSC_DST_INFO); + if (g_suppported) { + ASSERT_TRUE(ret); + } else { + ASSERT_FALSE(ret); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0080 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0080, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(nullptr, nullptr, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0090 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0090, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(&COMPOSE_SRC_INFO, nullptr, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0100 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0100, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(nullptr, nullptr, &COMPOSE_DST_INFO); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0110 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0110, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(nullptr, &COMPOSE_SRC_GAIN_INFO, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0120 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0120, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(&COMPOSE_SRC_INFO, nullptr, &COMPOSE_DST_INFO); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0130 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0130, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(nullptr, &COMPOSE_SRC_GAIN_INFO, &COMPOSE_DST_INFO); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0131 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0131, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(&COMPOSE_SRC_INFO, &COMPOSE_SRC_GAIN_INFO, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0140 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0140, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(&COMPOSE_SRC_INFO, &COMPOSE_SRC_GAIN_INFO, &COMPOSE_DST_INFO); + if (g_suppported) { + ASSERT_TRUE(ret); + } else { + ASSERT_FALSE(ret); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0150 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0150, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(nullptr, nullptr, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0160 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0160, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(&COMPOSE_DST_INFO, nullptr, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0170 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0170, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(nullptr, &COMPOSE_SRC_INFO, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0180 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0180, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(nullptr, nullptr, &COMPOSE_SRC_GAIN_INFO); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0190 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0190, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(&COMPOSE_DST_INFO, nullptr, &COMPOSE_SRC_GAIN_INFO); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0200 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0200, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(nullptr, &COMPOSE_SRC_INFO, &COMPOSE_SRC_GAIN_INFO); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0201 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0201, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(&COMPOSE_DST_INFO, &COMPOSE_SRC_INFO, nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0210 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0210, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(&COMPOSE_DST_INFO, + &COMPOSE_SRC_INFO, &COMPOSE_SRC_GAIN_INFO); + if (g_suppported) { + ASSERT_TRUE(ret); + } else { + ASSERT_FALSE(ret); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0220 + * @tc.name : call OH_ImageProcessing_IsMetadataGenerationSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0220, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsMetadataGenerationSupported(nullptr); + ASSERT_FALSE(ret); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0230 + * @tc.name : call OH_ImageProcessing_IsMetadataGenerationSupported + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0230, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + const ImageProcessing_ColorSpaceInfo HDR_INFO = {HDR_METADATA_TYPE_ALTERNATE, BT2020_HLG, + PIXEL_FORMAT_RGBA_1010102}; + bool ret = OH_ImageProcessing_IsMetadataGenerationSupported(&HDR_INFO); + if (g_suppported) { + ASSERT_TRUE(ret); + } else { + ASSERT_FALSE(ret); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0240 + * @tc.name : call OH_ImageProcessing_Create + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0240, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(nullptr, INT_MAX); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0250 + * @tc.name : call OH_ImageProcessing_Create + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0250, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(nullptr, + IMAGE_PROCESSING_TYPE_METADATA_GENERATION); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0260 + * @tc.name : call OH_ImageProcessing_Create + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0260, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, INT_MAX); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0270 + * @tc.name : call OH_ImageProcessing_Create + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0270, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_METADATA_GENERATION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + } else { + EXPECT_NE(ret, IMAGE_PROCESSING_SUCCESS); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0280 + * @tc.name : call OH_ImageProcessing_Destroy + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0280, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Destroy(nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0290 + * @tc.name : call OH_ImageProcessing_Destroy + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0290, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_METADATA_GENERATION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + ret = OH_ImageProcessing_Destroy(imageProcessor); + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0450 + * @tc.name : call OH_ImageProcessing_ConvertColorSpace + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0450, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_ConvertColorSpace(nullptr, + nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0460 + * @tc.name : call OH_ImageProcessing_ConvertColorSpace + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0460, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COLOR_SPACE_CONVERSION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + ret = OH_ImageProcessing_ConvertColorSpace(imageProcessor, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0470 + * @tc.name : call OH_ImageProcessing_ConvertColorSpace + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0470, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_ConvertColorSpace(nullptr, pixelMap_RGBA, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0480 + * @tc.name : call OH_ImageProcessing_ConvertColorSpace + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0480, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_ConvertColorSpace( + nullptr, nullptr, pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0490 + * @tc.name : call OH_ImageProcessing_ConvertColorSpace + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0490, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COLOR_SPACE_CONVERSION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + ret = OH_ImageProcessing_ConvertColorSpace(imageProcessor, nullptr, pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0500 + * @tc.name : call OH_ImageProcessing_ConvertColorSpace + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0500, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + if (g_suppported) { + OH_PixelmapNative *src_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_pixelMap_RGBA); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_ConvertColorSpace( + nullptr, src_pixelMap_RGBA, dst_pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); + OH_PixelmapNative_Release(src_pixelMap_RGBA); + OH_PixelmapNative_Release(dst_pixelMap_RGBA); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0530 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0530, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Compose(nullptr, nullptr, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0540 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0540, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + ret = OH_ImageProcessing_Compose(imageProcessor, nullptr, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0550 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0550, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_PixelmapNative *src_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_pixelMap_RGBA); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Compose(nullptr, src_pixelMap_RGBA, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); + OH_PixelmapNative_Release(src_pixelMap_RGBA); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0560 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0560, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_PixelmapNative *src_gain_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_gain_pixelMap_RGBA); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Compose(nullptr, nullptr, src_gain_pixelMap_RGBA, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); + OH_PixelmapNative_Release(src_gain_pixelMap_RGBA); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0570 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0570, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Compose(nullptr, nullptr, nullptr, dst_pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); + + OH_PixelmapNative_Release(dst_pixelMap_RGBA); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0580 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0580, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *src_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_pixelMap_RGBA); + ret = OH_ImageProcessing_Compose(imageProcessor, src_pixelMap_RGBA, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_ImageProcessing_Destroy(imageProcessor); + OH_PixelmapNative_Release(src_pixelMap_RGBA); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0590 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0590, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *src_gain_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_gain_pixelMap_RGBA); + ret = OH_ImageProcessing_Compose(imageProcessor, nullptr, src_gain_pixelMap_RGBA, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_ImageProcessing_Destroy(imageProcessor); + OH_PixelmapNative_Release(src_gain_pixelMap_RGBA); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0600 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0600, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + ret = OH_ImageProcessing_Compose(imageProcessor, nullptr, nullptr, dst_pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_ImageProcessing_Destroy(imageProcessor); + OH_PixelmapNative_Release(dst_pixelMap_RGBA); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0610 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0610, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *src_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_pixelMap_RGBA); + OH_PixelmapNative *src_gain_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_gain_pixelMap_RGBA); + ret = OH_ImageProcessing_Compose(imageProcessor, src_pixelMap_RGBA, src_gain_pixelMap_RGBA, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_ImageProcessing_Destroy(imageProcessor); + OH_PixelmapNative_Release(src_pixelMap_RGBA); + OH_PixelmapNative_Release(src_gain_pixelMap_RGBA); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0620 + * @tc.name : call OH_ImageProcessing_Compose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0620, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_COMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *src_gain_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_gain_pixelMap_RGBA); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + ret = OH_ImageProcessing_Compose(imageProcessor, nullptr, src_gain_pixelMap_RGBA, dst_pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_ImageProcessing_Destroy(imageProcessor); + OH_PixelmapNative_Release(src_gain_pixelMap_RGBA); + OH_PixelmapNative_Release(dst_pixelMap_RGBA); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0650 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0650, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Decompose(nullptr, nullptr, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0660 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0660, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_DECOMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + ret = OH_ImageProcessing_Decompose(imageProcessor, nullptr, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0670 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0670, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_PixelmapNative *src_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_pixelMap_RGBA); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Decompose(nullptr, src_pixelMap_RGBA, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); + OH_PixelmapNative_Release(src_pixelMap_RGBA); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0680 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0680, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Decompose(nullptr, nullptr, dst_pixelMap_RGBA, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); + OH_PixelmapNative_Release(dst_pixelMap_RGBA); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0690 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0690, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_PixelmapNative *dst_gain_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_gain_pixelMap_RGBA); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Decompose(nullptr, nullptr, nullptr, dst_gain_pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); + OH_PixelmapNative_Release(dst_gain_pixelMap_RGBA); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0700 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0700, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_DECOMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *src_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_pixelMap_RGBA); + ret = OH_ImageProcessing_Decompose(imageProcessor, src_pixelMap_RGBA, nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_PixelmapNative_Release(src_pixelMap_RGBA); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0710 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0710, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_DECOMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + ret = OH_ImageProcessing_Decompose(imageProcessor, nullptr, dst_pixelMap_RGBA, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_PixelmapNative_Release(dst_pixelMap_RGBA); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0720 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0720, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_DECOMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *dst_gain_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_gain_pixelMap_RGBA); + ret = OH_ImageProcessing_Decompose(imageProcessor, nullptr, nullptr, dst_gain_pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_PixelmapNative_Release(dst_gain_pixelMap_RGBA); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0730 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0730, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_DECOMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *src_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &src_pixelMap_RGBA); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + ret = OH_ImageProcessing_Decompose(imageProcessor, src_pixelMap_RGBA, dst_pixelMap_RGBA, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_PixelmapNative_Release(src_pixelMap_RGBA); + OH_PixelmapNative_Release(dst_pixelMap_RGBA); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0740 + * @tc.name : call OH_ImageProcessing_Decompose + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0740, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_DECOMPOSITION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *dst_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_pixelMap_RGBA); + OH_PixelmapNative *dst_gain_pixelMap_RGBA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_RGBA, &dst_gain_pixelMap_RGBA); + ret = OH_ImageProcessing_Decompose(imageProcessor, nullptr, + dst_pixelMap_RGBA, dst_gain_pixelMap_RGBA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + OH_PixelmapNative_Release(dst_pixelMap_RGBA); + OH_PixelmapNative_Release(dst_gain_pixelMap_RGBA); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0770 + * @tc.name : call OH_ImageProcessing_GenerateMetadata + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0770, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + ImageProcessing_ErrorCode ret = OH_ImageProcessing_GenerateMetadata(nullptr, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_INSTANCE); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0780 + * @tc.name : call OH_ImageProcessing_GenerateMetadata + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0780, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_METADATA_GENERATION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + ret = OH_ImageProcessing_GenerateMetadata(imageProcessor, nullptr); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_INVALID_PARAMETER); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0790 + * @tc.name : call OH_ImageProcessing_GenerateMetadata by the color space + * of the image is unsupported. + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0790, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + OH_ImageProcessing* imageProcessor = nullptr; + ImageProcessing_ErrorCode ret = OH_ImageProcessing_Create(&imageProcessor, + IMAGE_PROCESSING_TYPE_METADATA_GENERATION); + if (g_suppported) { + EXPECT_EQ(ret, IMAGE_PROCESSING_SUCCESS); + OH_PixelmapNative *src_pixelMap_BGRA = nullptr; + OH_PixelmapNative_CreatePixelmap(g_pixData, PIX_SIZE, g_createOpts_BGRA, &src_pixelMap_BGRA); + ret = OH_ImageProcessing_GenerateMetadata(imageProcessor, src_pixelMap_BGRA); + EXPECT_EQ(ret, IMAGE_PROCESSING_ERROR_UNSUPPORTED_PROCESSING); + OH_PixelmapNative_Release(src_pixelMap_BGRA); + } + OH_ImageProcessing_Destroy(imageProcessor); +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0890 + * @tc.name : call OH_ImageProcessing_IsColorSpaceConversionSupported + * the the color space conversion is unsupported. + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0890, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsColorSpaceConversionSupported(&UNSUPPORTED_INFO, &CSC_DST_INFO); + if (g_suppported) { + ASSERT_FALSE(ret); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0900 + * @tc.name : call OH_ImageProcessing_IsCompositionSupported + * the the color space conversion is unsupported. + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0900, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsCompositionSupported(&UNSUPPORTED_INFO, + &COMPOSE_SRC_GAIN_INFO, &COMPOSE_DST_INFO); + if (g_suppported) { + ASSERT_FALSE(ret); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0910 + * @tc.name : call OH_ImageProcessing_IsDecompositionSupported + * the the color space conversion is unsupported. + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0910, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsDecompositionSupported(&UNSUPPORTED_INFO, + &COMPOSE_SRC_INFO, &COMPOSE_SRC_GAIN_INFO); + if (g_suppported) { + ASSERT_FALSE(ret); + } +} + +/** + * @tc.number : VPE_IMAGE_API_TEST_0920 + * @tc.name : call OH_ImageProcessing_IsMetadataGenerationSupported + * the the color space conversion is unsupported. + * @tc.desc : function test + */ +HWTEST_F(VpeImageApiTest, VPE_IMAGE_API_TEST_0920, TestSize.Level0) +{ + OH_ImageProcessing_InitializeEnvironment(); + bool ret = OH_ImageProcessing_IsMetadataGenerationSupported(&UNSUPPORTED_INFO); + if (g_suppported) { + ASSERT_FALSE(ret); + } +} +} \ No newline at end of file diff --git a/test/ndk/moduletest/image/capability_test.cpp b/test/ndk/moduletest/image/capability_test.cpp new file mode 100644 index 0000000..fc0a1dd --- /dev/null +++ b/test/ndk/moduletest/image/capability_test.cpp @@ -0,0 +1,850 @@ +/* + * 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 +#include "gtest/gtest.h" +#include "video_processing.h" +#include "image_processing_types.h" +#include "image_processing.h" +#include "enum_list.h" +#include "pixelmap_native.h" +#include "native_color_space_manager.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 { +#ifdef ENABLE_ALL_PROCESS +static bool g_suppported = true; +#else +static bool g_suppported = false; +#endif + +/** + * @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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = ADOBE_RGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_NONE; + outputFormat.colorSpace = SRGB; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = ADOBE_RGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_NONE; + outputFormat.colorSpace = DISPLAY_P3; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_NONE; + outputFormat.colorSpace = DISPLAY_P3; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = DISPLAY_P3; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_NONE; + outputFormat.colorSpace = SRGB; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = DISPLAY_P3; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = DISPLAY_P3; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_HLG, + PIXEL_FORMAT_RGBA_1010102}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_HLG, + PIXEL_FORMAT_RGBA_1010102}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_HLG, + PIXEL_FORMAT_YCBCR_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_HLG, + PIXEL_FORMAT_YCBCR_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_HLG, + PIXEL_FORMAT_YCRCB_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_HLG, + PIXEL_FORMAT_YCRCB_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_PQ, + PIXEL_FORMAT_RGBA_1010102}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_PQ, + PIXEL_FORMAT_RGBA_1010102}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_PQ, + PIXEL_FORMAT_YCBCR_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_PQ, + PIXEL_FORMAT_YCBCR_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_PQ, + PIXEL_FORMAT_YCRCB_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_P3, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = {HDR_METADATA_TYPE_ALTERNATE, + BT2020_PQ, + PIXEL_FORMAT_YCRCB_P010}; + ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP, + DISPLAY_SRGB, + PIXEL_FORMAT_RGBA_8888}; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_ALTERNATE; + inputFormat.colorSpace = BT2020_HLG; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_ALTERNATE; + inputFormat.colorSpace = BT2020_HLG; + inputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_ALTERNATE; + inputFormat.colorSpace = BT2020_HLG; + inputFormat.pixelFormat = PIXEL_FORMAT_YCRCB_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_ALTERNATE; + inputFormat.colorSpace = BT2020_PQ; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_ALTERNATE; + inputFormat.colorSpace = BT2020_PQ; + inputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_ALTERNATE; + inputFormat.colorSpace = BT2020_PQ; + inputFormat.pixelFormat = PIXEL_FORMAT_YCRCB_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = SRGB; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_PQ; + outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = DISPLAY_P3; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = DISPLAY_P3; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_PQ; + outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = SRGB; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_PQ; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = DISPLAY_P3; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = DISPLAY_P3; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_PQ; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = SRGB; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = DISPLAY_P3; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = DISPLAY_P3; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = SRGB; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat)); + } else { + ASSERT_EQ(false, 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 = HDR_METADATA_TYPE_BASE; + inputFormat.colorSpace = DISPLAY_P3; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP; + inputGainmapFormat.colorSpace = DISPLAY_P3; + inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + + outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE; + outputFormat.colorSpace = BT2020_HLG; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102; + if (g_suppported) { + 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 = HDR_METADATA_TYPE_NONE; + inputFormat.colorSpace = SRGB; + inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + outputFormat.metadataType = HDR_METADATA_TYPE_NONE; + outputFormat.colorSpace = DISPLAY_P3; + outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888; + if (g_suppported) { + ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat)); + } else { + ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat)); + } +} +} // namespace \ No newline at end of file -- Gitee From 651a4e5e7b7102e62cadb6a058d908e5da40f3c9 Mon Sep 17 00:00:00 2001 From: mediaTest Date: Tue, 22 Apr 2025 14:46:16 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mediaTest --- test/ndk/moduletest/image/BUILD.gn | 2 +- test/ndk/moduletest/image/capability_test.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/ndk/moduletest/image/BUILD.gn b/test/ndk/moduletest/image/BUILD.gn index 40430a3..2411a40 100644 --- a/test/ndk/moduletest/image/BUILD.gn +++ b/test/ndk/moduletest/image/BUILD.gn @@ -64,8 +64,8 @@ ohos_unittest("vpe_image_native_module_test") { "graphic_2d:libnative_color_space_manager", "graphic_surface:surface", "hilog:libhilog", - "image_framework:pixelmap", "image_framework:image", + "image_framework:pixelmap", "ipc:ipc_core", ] diff --git a/test/ndk/moduletest/image/capability_test.cpp b/test/ndk/moduletest/image/capability_test.cpp index fc0a1dd..f08b59f 100644 --- a/test/ndk/moduletest/image/capability_test.cpp +++ b/test/ndk/moduletest/image/capability_test.cpp @@ -416,7 +416,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0090, TestSize.Level2) DISPLAY_P3, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } @@ -459,7 +460,7 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0110, TestSize.Level2) DISPLAY_P3, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); } } -- Gitee From 78a204b11531d5315b2d106eead53bce2c71bcca Mon Sep 17 00:00:00 2001 From: mediaTest Date: Tue, 22 Apr 2025 15:58:24 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mediaTest --- test/ndk/moduletest/image/BUILD.gn | 15 +++++------- test/ndk/moduletest/image/capability_test.cpp | 24 ++++++++++++------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/test/ndk/moduletest/image/BUILD.gn b/test/ndk/moduletest/image/BUILD.gn index 2411a40..6434384 100644 --- a/test/ndk/moduletest/image/BUILD.gn +++ b/test/ndk/moduletest/image/BUILD.gn @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/test.gni") import("//build/ohos.gni") +import("//build/test.gni") import("//foundation/multimedia/video_processing_engine/config.gni") image_moduletest_native_include_dirs = [ "$CAPI_DIR", @@ -45,23 +45,21 @@ image_moduletest_cflags = [ ohos_unittest("vpe_image_native_module_test") { module_out_path = "video_processing_engine/moduletest" include_dirs = image_moduletest_native_include_dirs - include_dirs += ["../common/"] + include_dirs += [ "../common/" ] cflags = image_moduletest_cflags sources = [ "api_test.cpp", - "capability_test.cpp" + "capability_test.cpp", ] - deps = [ - "$FRAMEWORK_DIR:image_processing", - ] + deps = [ "$FRAMEWORK_DIR:image_processing" ] external_deps = [ "c_utils:utils", "graphic_2d:libgraphic_utils", - "graphic_2d:librender_service_client", "graphic_2d:libnative_color_space_manager", + "graphic_2d:librender_service_client", "graphic_surface:surface", "hilog:libhilog", "image_framework:image", @@ -69,6 +67,5 @@ ohos_unittest("vpe_image_native_module_test") { "ipc:ipc_core", ] - resource_config_file = - "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/test/ndk/moduletest/resources/ohos_test.xml" + resource_config_file = "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/test/ndk/moduletest/resources/ohos_test.xml" } diff --git a/test/ndk/moduletest/image/capability_test.cpp b/test/ndk/moduletest/image/capability_test.cpp index f08b59f..33bd137 100644 --- a/test/ndk/moduletest/image/capability_test.cpp +++ b/test/ndk/moduletest/image/capability_test.cpp @@ -250,7 +250,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0010, TestSize.Level0) DISPLAY_P3, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } /** @@ -270,7 +271,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0020, TestSize.Level1) DISPLAY_SRGB, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } /** @@ -290,7 +292,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0030, TestSize.Level2) DISPLAY_P3, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } @@ -311,7 +314,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0040, TestSize.Level2) DISPLAY_SRGB, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } @@ -332,7 +336,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0050, TestSize.Level2) DISPLAY_P3, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } @@ -353,7 +358,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0060, TestSize.Level2) DISPLAY_SRGB, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } @@ -374,7 +380,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0070, TestSize.Level0) DISPLAY_P3, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } @@ -395,7 +402,8 @@ HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0080, TestSize.Level1) DISPLAY_SRGB, PIXEL_FORMAT_RGBA_8888}; if (g_suppported) { - ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, &destinationImageInfo, &destinationGainmapInfo)); + ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo, + &destinationImageInfo, &destinationGainmapInfo)); } } -- Gitee From eb3c7f366d99e935f988c61a2a8b6a48fc032232 Mon Sep 17 00:00:00 2001 From: mediaTest Date: Wed, 23 Apr 2025 11:29:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0license=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mediaTest --- test/ndk/moduletest/image/BUILD.gn | 2 +- test/ndk/moduletest/image/capability_test.cpp | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/ndk/moduletest/image/BUILD.gn b/test/ndk/moduletest/image/BUILD.gn index 6434384..6b18aea 100644 --- a/test/ndk/moduletest/image/BUILD.gn +++ b/test/ndk/moduletest/image/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# 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 diff --git a/test/ndk/moduletest/image/capability_test.cpp b/test/ndk/moduletest/image/capability_test.cpp index 33bd137..8142048 100644 --- a/test/ndk/moduletest/image/capability_test.cpp +++ b/test/ndk/moduletest/image/capability_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Huawei Device Co., Ltd. + * 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 @@ -22,8 +22,6 @@ #include "native_color_space_manager.h" using namespace std; -// using namespace OHOS; -// using namespace OHOS::Media; using namespace testing::ext; namespace { class VpeVideoCapTest : public testing::Test { -- Gitee