• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <iostream>
16 #include "gtest/gtest.h"
17 #include "video_processing.h"
18 #include "image_processing_types.h"
19 #include "image_processing.h"
20 #include "enum_list.h"
21 #include "pixelmap_native.h"
22 #include "native_color_space_manager.h"
23 
24 using namespace std;
25 using namespace testing::ext;
26 namespace {
27 class VpeVideoCapTest : public testing::Test {
28 public:
29     // SetUpTestCase: Called before all test cases
30     static void SetUpTestCase(void);
31     // TearDownTestCase: Called after all test case
32     static void TearDownTestCase(void);
33     // SetUp: Called before each test cases
34     void SetUp(void);
35     // TearDown: Called after each test cases
36     void TearDown(void);
37 };
SetUpTestCase()38 void VpeVideoCapTest::SetUpTestCase()
39 {
40     OH_ImageProcessing_InitializeEnvironment();
41 }
TearDownTestCase()42 void VpeVideoCapTest::TearDownTestCase()
43 {
44     OH_ImageProcessing_DeinitializeEnvironment();
45 }
SetUp()46 void VpeVideoCapTest::SetUp() {}
TearDown()47 void VpeVideoCapTest::TearDown() {}
48 }
49 namespace {
50 #ifdef ENABLE_ALL_PROCESS
51 static bool g_suppported = true;
52 #else
53 static bool g_suppported = false;
54 #endif
55 
56 /**
57  * @tc.number    : COLORSPACE_SUPPORT_001
58  * @tc.name      : adobergb to srgb
59  * @tc.desc      : api test
60  */
61 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_001, TestSize.Level2)
62 {
63     ImageProcessing_ColorSpaceInfo inputFormat;
64     ImageProcessing_ColorSpaceInfo outputFormat;
65     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
66     inputFormat.colorSpace = ADOBE_RGB;
67     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
68     outputFormat.metadataType = HDR_METADATA_TYPE_NONE;
69     outputFormat.colorSpace = SRGB;
70     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
71     if (g_suppported) {
72         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
73     } else {
74         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
75     }
76 }
77 
78 
79 /**
80  * @tc.number    : COLORSPACE_SUPPORT_002
81  * @tc.name      : adobergb to display p3
82  * @tc.desc      : api test
83  */
84 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_002, TestSize.Level2)
85 {
86     ImageProcessing_ColorSpaceInfo inputFormat;
87     ImageProcessing_ColorSpaceInfo outputFormat;
88     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
89     inputFormat.colorSpace = ADOBE_RGB;
90     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
91     outputFormat.metadataType = HDR_METADATA_TYPE_NONE;
92     outputFormat.colorSpace = DISPLAY_P3;
93     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
94     if (g_suppported) {
95         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
96     } else {
97         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
98     }
99 }
100 
101 /**
102  * @tc.number    : COLORSPACE_SUPPORT_003
103  * @tc.name      : srgb to display p3
104  * @tc.desc      : api test
105  */
106 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_003, TestSize.Level2)
107 {
108     ImageProcessing_ColorSpaceInfo inputFormat;
109     ImageProcessing_ColorSpaceInfo outputFormat;
110     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
111     inputFormat.colorSpace = SRGB;
112     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
113     outputFormat.metadataType = HDR_METADATA_TYPE_NONE;
114     outputFormat.colorSpace = DISPLAY_P3;
115     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
116     if (g_suppported) {
117         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
118     } else {
119         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
120     }
121 }
122 
123 /**
124  * @tc.number    : COLORSPACE_SUPPORT_004
125  * @tc.name      : display p3 to srgb
126  * @tc.desc      : api test
127  */
128 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_004, TestSize.Level2)
129 {
130     ImageProcessing_ColorSpaceInfo inputFormat;
131     ImageProcessing_ColorSpaceInfo outputFormat;
132     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
133     inputFormat.colorSpace = DISPLAY_P3;
134     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
135     outputFormat.metadataType = HDR_METADATA_TYPE_NONE;
136     outputFormat.colorSpace = SRGB;
137     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
138     if (g_suppported) {
139         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
140     } else {
141         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
142     }
143 }
144 
145 /**
146  * @tc.number    : COLORSPACE_SUPPORT_005
147  * @tc.name      : srgb to hlg rgba
148  * @tc.desc      : api test
149  */
150 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_005, TestSize.Level2)
151 {
152     ImageProcessing_ColorSpaceInfo inputFormat;
153     ImageProcessing_ColorSpaceInfo outputFormat;
154     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
155     inputFormat.colorSpace = SRGB;
156     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
157     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
158     outputFormat.colorSpace = BT2020_HLG;
159     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
160     if (g_suppported) {
161         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
162     } else {
163         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
164     }
165 }
166 
167 /**
168  * @tc.number    : COLORSPACE_SUPPORT_006
169  * @tc.name      : srgb to hlg p010
170  * @tc.desc      : api test
171  */
172 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_006, TestSize.Level2)
173 {
174     ImageProcessing_ColorSpaceInfo inputFormat;
175     ImageProcessing_ColorSpaceInfo outputFormat;
176     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
177     inputFormat.colorSpace = SRGB;
178     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
179     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
180     outputFormat.colorSpace = BT2020_HLG;
181     outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
182     if (g_suppported) {
183         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
184     } else {
185         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
186     }
187 }
188 
189 
190 /**
191  * @tc.number    : COLORSPACE_SUPPORT_007
192  * @tc.name      : p3 to hlg rgba
193  * @tc.desc      : api test
194  */
195 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_007, TestSize.Level2)
196 {
197     ImageProcessing_ColorSpaceInfo inputFormat;
198     ImageProcessing_ColorSpaceInfo outputFormat;
199     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
200     inputFormat.colorSpace = DISPLAY_P3;
201     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
202     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
203     outputFormat.colorSpace = BT2020_HLG;
204     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
205     if (g_suppported) {
206         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
207     } else {
208         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
209     }
210 }
211 
212 /**
213  * @tc.number    : COLORSPACE_SUPPORT_008
214  * @tc.name      : p3 to hlg p010
215  * @tc.desc      : api test
216  */
217 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_008, TestSize.Level2)
218 {
219     ImageProcessing_ColorSpaceInfo inputFormat;
220     ImageProcessing_ColorSpaceInfo outputFormat;
221     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
222     inputFormat.colorSpace = DISPLAY_P3;
223     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
224     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
225     outputFormat.colorSpace = BT2020_HLG;
226     outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
227     if (g_suppported) {
228         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
229     } else {
230         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
231     }
232 }
233 
234 /**
235  * @tc.number    : COLORSPACE_DECOMPOSE_0010
236  * @tc.name      : hlg 10bit rgba to p3 8bit rgba
237  * @tc.desc      : api test
238  */
239 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0010, TestSize.Level0)
240 {
241     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
242                                         BT2020_HLG,
243                                         PIXEL_FORMAT_RGBA_1010102};
244     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
245                                             DISPLAY_P3,
246                                             PIXEL_FORMAT_RGBA_8888};
247     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
248                                         DISPLAY_P3,
249                                         PIXEL_FORMAT_RGBA_8888};
250     if (g_suppported) {
251         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
252             &destinationImageInfo, &destinationGainmapInfo));
253     }
254 }
255 /**
256  * @tc.number    : COLORSPACE_DECOMPOSE_0020
257  * @tc.name      : hlg 10bit rgba to srgb 8bit rgba
258  * @tc.desc      : api test
259  */
260 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0020, TestSize.Level1)
261 {
262     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
263                                         BT2020_HLG,
264                                         PIXEL_FORMAT_RGBA_1010102};
265     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
266                                             DISPLAY_SRGB,
267                                             PIXEL_FORMAT_RGBA_8888};
268     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
269                                         DISPLAY_SRGB,
270                                         PIXEL_FORMAT_RGBA_8888};
271     if (g_suppported) {
272         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
273             &destinationImageInfo, &destinationGainmapInfo));
274     }
275 }
276 /**
277  * @tc.number    : COLORSPACE_DECOMPOSE_0030
278  * @tc.name      : hlg 10bit nv12 to p3 8bit rgba
279  * @tc.desc      : api test
280  */
281 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0030, TestSize.Level2)
282 {
283     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
284                                         BT2020_HLG,
285                                         PIXEL_FORMAT_YCBCR_P010};
286     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
287                                             DISPLAY_P3,
288                                             PIXEL_FORMAT_RGBA_8888};
289     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
290                                         DISPLAY_P3,
291                                         PIXEL_FORMAT_RGBA_8888};
292     if (g_suppported) {
293         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
294             &destinationImageInfo, &destinationGainmapInfo));
295     }
296 }
297 
298 /**
299  * @tc.number    : COLORSPACE_DECOMPOSE_0040
300  * @tc.name      : hlg 10bit nv12 to hlg 8bit rgba
301  * @tc.desc      : api test
302  */
303 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0040, TestSize.Level2)
304 {
305     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
306                                         BT2020_HLG,
307                                         PIXEL_FORMAT_YCBCR_P010};
308     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
309                                             DISPLAY_SRGB,
310                                             PIXEL_FORMAT_RGBA_8888};
311     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
312                                         DISPLAY_SRGB,
313                                         PIXEL_FORMAT_RGBA_8888};
314     if (g_suppported) {
315         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
316             &destinationImageInfo, &destinationGainmapInfo));
317     }
318 }
319 
320 /**
321  * @tc.number    : COLORSPACE_DECOMPOSE_0050
322  * @tc.name      : hlg 10bit nv21 to P3 8bit rgba
323  * @tc.desc      : api test
324  */
325 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0050, TestSize.Level2)
326 {
327     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
328                                         BT2020_HLG,
329                                         PIXEL_FORMAT_YCRCB_P010};
330     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
331                                             DISPLAY_P3,
332                                             PIXEL_FORMAT_RGBA_8888};
333     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
334                                         DISPLAY_P3,
335                                         PIXEL_FORMAT_RGBA_8888};
336     if (g_suppported) {
337         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
338             &destinationImageInfo, &destinationGainmapInfo));
339     }
340 }
341 
342 /**
343  * @tc.number    : COLORSPACE_DECOMPOSE_0060
344  * @tc.name      : hlg 10bit nv21 to hlg 8bit rgba
345  * @tc.desc      : api test
346  */
347 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0060, TestSize.Level2)
348 {
349     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
350                                         BT2020_HLG,
351                                         PIXEL_FORMAT_YCRCB_P010};
352     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
353                                             DISPLAY_SRGB,
354                                             PIXEL_FORMAT_RGBA_8888};
355     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
356                                         DISPLAY_SRGB,
357                                         PIXEL_FORMAT_RGBA_8888};
358     if (g_suppported) {
359         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
360             &destinationImageInfo, &destinationGainmapInfo));
361     }
362 }
363 
364 /**
365  * @tc.number    : COLORSPACE_DECOMPOSE_0070
366  * @tc.name      : pq 10bit rgba to p3 8bit rgba
367  * @tc.desc      : api test
368  */
369 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0070, TestSize.Level0)
370 {
371     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
372                                         BT2020_PQ,
373                                         PIXEL_FORMAT_RGBA_1010102};
374     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
375                                             DISPLAY_P3,
376                                             PIXEL_FORMAT_RGBA_8888};
377     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
378                                         DISPLAY_P3,
379                                         PIXEL_FORMAT_RGBA_8888};
380     if (g_suppported) {
381         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
382             &destinationImageInfo, &destinationGainmapInfo));
383     }
384 }
385 
386 /**
387  * @tc.number    : COLORSPACE_DECOMPOSE_0080
388  * @tc.name      : pq 10bit rgba to srgb 8bit rgba
389  * @tc.desc      : api test
390  */
391 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0080, TestSize.Level1)
392 {
393     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
394                                         BT2020_PQ,
395                                         PIXEL_FORMAT_RGBA_1010102};
396     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
397                                             DISPLAY_SRGB,
398                                             PIXEL_FORMAT_RGBA_8888};
399     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
400                                         DISPLAY_SRGB,
401                                         PIXEL_FORMAT_RGBA_8888};
402     if (g_suppported) {
403         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
404             &destinationImageInfo, &destinationGainmapInfo));
405     }
406 }
407 
408 /**
409  * @tc.number    : COLORSPACE_DECOMPOSE_0090
410  * @tc.name      : pq 10bit nv12 to P3 8bit rgba
411  * @tc.desc      : api test
412  */
413 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0090, TestSize.Level2)
414 {
415     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
416                                         BT2020_PQ,
417                                         PIXEL_FORMAT_YCBCR_P010};
418     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
419                                             DISPLAY_P3,
420                                             PIXEL_FORMAT_RGBA_8888};
421     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
422                                         DISPLAY_P3,
423                                         PIXEL_FORMAT_RGBA_8888};
424     if (g_suppported) {
425         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
426             &destinationImageInfo, &destinationGainmapInfo));
427     }
428 }
429 
430 /**
431  * @tc.number    : COLORSPACE_DECOMPOSE_0100
432  * @tc.name      : pq 10bit nv12 to hlg 8bit rgba
433  * @tc.desc      : api test
434  */
435 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0100, TestSize.Level2)
436 {
437     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
438                                                       BT2020_PQ,
439                                                       PIXEL_FORMAT_YCBCR_P010};
440     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
441                                                            DISPLAY_SRGB,
442                                                            PIXEL_FORMAT_RGBA_8888};
443     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
444                                                              DISPLAY_SRGB,
445                                                              PIXEL_FORMAT_RGBA_8888};
446     if (g_suppported) {
447         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
448             &destinationImageInfo, &destinationGainmapInfo));
449     }
450 }
451 
452 /**
453  * @tc.number    : COLORSPACE_DECOMPOSE_0110
454  * @tc.name      : pq 10bit nv21 to p3 8bit rgba
455  * @tc.desc      : api test
456  */
457 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0110, TestSize.Level2)
458 {
459     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
460                                                     BT2020_PQ,
461                                                     PIXEL_FORMAT_YCRCB_P010};
462     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
463                                                         DISPLAY_P3,
464                                                         PIXEL_FORMAT_RGBA_8888};
465     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
466                                                             DISPLAY_P3,
467                                                             PIXEL_FORMAT_RGBA_8888};
468     if (g_suppported) {
469         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
470             &destinationImageInfo, &destinationGainmapInfo));
471     }
472 }
473 
474 /**
475  * @tc.number    : COLORSPACE_DECOMPOSE_0120
476  * @tc.name      : pq 10bit nv21 to hlg 8bit rgba
477  * @tc.desc      : api test
478  */
479 HWTEST_F(VpeVideoCapTest, COLORSPACE_DECOMPOSE_0120, TestSize.Level2)
480 {
481     ImageProcessing_ColorSpaceInfo sourceImageInfo = {HDR_METADATA_TYPE_ALTERNATE,
482                                         BT2020_PQ,
483                                         PIXEL_FORMAT_YCRCB_P010};
484     ImageProcessing_ColorSpaceInfo destinationImageInfo = {HDR_METADATA_TYPE_BASE,
485                                             DISPLAY_SRGB,
486                                             PIXEL_FORMAT_RGBA_8888};
487     ImageProcessing_ColorSpaceInfo destinationGainmapInfo = {HDR_METADATA_TYPE_GAINMAP,
488                                         DISPLAY_SRGB,
489                                         PIXEL_FORMAT_RGBA_8888};
490     if (g_suppported) {
491         ASSERT_TRUE(OH_ImageProcessing_IsDecompositionSupported(&sourceImageInfo,
492                                                             &destinationImageInfo, &destinationGainmapInfo));
493     }
494 }
495 
496 /**
497  * @tc.number    : METADATAGENERATE_SUPPORT_001
498  * @tc.name      : hlg rgba1010102 metadata generate
499  * @tc.desc      : api test
500  */
501 HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_001, TestSize.Level2)
502 {
503     ImageProcessing_ColorSpaceInfo inputFormat;
504     inputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
505     inputFormat.colorSpace = BT2020_HLG;
506     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
507     if (g_suppported) {
508         ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
509     } else {
510         ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
511     }
512 }
513 
514 /**
515  * @tc.number    : METADATAGENERATE_SUPPORT_002
516  * @tc.name      : hlg p010 metadata generate
517  * @tc.desc      : api test
518  */
519 HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_002, TestSize.Level2)
520 {
521     ImageProcessing_ColorSpaceInfo inputFormat;
522     inputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
523     inputFormat.colorSpace = BT2020_HLG;
524     inputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
525     if (g_suppported) {
526         ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
527     } else {
528         ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
529     }
530 }
531 
532 /**
533  * @tc.number    : METADATAGENERATE_SUPPORT_003
534  * @tc.name      : hlg p010_NV21 metadata generate
535  * @tc.desc      : api test
536  */
537 HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_003, TestSize.Level2)
538 {
539     ImageProcessing_ColorSpaceInfo inputFormat;
540     inputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
541     inputFormat.colorSpace = BT2020_HLG;
542     inputFormat.pixelFormat = PIXEL_FORMAT_YCRCB_P010;
543     if (g_suppported) {
544         ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
545     } else {
546         ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
547     }
548 }
549 
550 /**
551  * @tc.number    : METADATAGENERATE_SUPPORT_004
552  * @tc.name      : pq rgba1010102 metadata generate
553  * @tc.desc      : api test
554  */
555 HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_004, TestSize.Level2)
556 {
557     ImageProcessing_ColorSpaceInfo inputFormat;
558     inputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
559     inputFormat.colorSpace = BT2020_PQ;
560     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
561     if (g_suppported) {
562         ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
563     } else {
564         ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
565     }
566 }
567 
568 /**
569  * @tc.number    : METADATAGENERATE_SUPPORT_005
570  * @tc.name      : pq p010 metadata generate
571  * @tc.desc      : api test
572  */
573 HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_005, TestSize.Level2)
574 {
575     ImageProcessing_ColorSpaceInfo inputFormat;
576     inputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
577     inputFormat.colorSpace = BT2020_PQ;
578     inputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
579     if (g_suppported) {
580         ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
581     } else {
582         ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
583     }
584 }
585 
586 /**
587  * @tc.number    : METADATAGENERATE_SUPPORT_006
588  * @tc.name      : pq p010_NV21 metadata generate
589  * @tc.desc      : api test
590  */
591 HWTEST_F(VpeVideoCapTest, METADATAGENERATE_SUPPORT_006, TestSize.Level2)
592 {
593     ImageProcessing_ColorSpaceInfo inputFormat;
594     inputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
595     inputFormat.colorSpace = BT2020_PQ;
596     inputFormat.pixelFormat = PIXEL_FORMAT_YCRCB_P010;
597     if (g_suppported) {
598         ASSERT_EQ(true, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
599     } else {
600         ASSERT_EQ(false, OH_ImageProcessing_IsMetadataGenerationSupported(&inputFormat));
601     }
602 }
603 
604 /**
605  * @tc.number    : Composition_SUPPORT_001
606  * @tc.name      : srgb + srgb gainmap to PQ P010
607  * @tc.desc      : api test
608  */
609 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_001, TestSize.Level2)
610 {
611     ImageProcessing_ColorSpaceInfo inputFormat;
612     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
613     ImageProcessing_ColorSpaceInfo outputFormat;
614 
615     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
616     inputFormat.colorSpace = SRGB;
617     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
618 
619     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
620     inputGainmapFormat.colorSpace = SRGB;
621     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
622 
623     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
624     outputFormat.colorSpace = BT2020_PQ;
625     outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
626     if (g_suppported) {
627         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
628     } else {
629         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
630     }
631 }
632 
633 /**
634  * @tc.number    : Composition_SUPPORT_002
635  * @tc.name      : p3 + p3 gainmap to PQ P010
636  * @tc.desc      : api test
637  */
638 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_002, TestSize.Level2)
639 {
640     ImageProcessing_ColorSpaceInfo inputFormat;
641     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
642     ImageProcessing_ColorSpaceInfo outputFormat;
643 
644     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
645     inputFormat.colorSpace = DISPLAY_P3;
646     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
647 
648     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
649     inputGainmapFormat.colorSpace = DISPLAY_P3;
650     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
651 
652     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
653     outputFormat.colorSpace = BT2020_PQ;
654     outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
655     if (g_suppported) {
656         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
657     } else {
658         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
659     }
660 }
661 
662 /**
663  * @tc.number    : Composition_SUPPORT_005
664  * @tc.name      : srgb + srgb gainmap to PQ rgba1010102
665  * @tc.desc      : api test
666  */
667 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_005, TestSize.Level2)
668 {
669     ImageProcessing_ColorSpaceInfo inputFormat;
670     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
671     ImageProcessing_ColorSpaceInfo outputFormat;
672 
673     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
674     inputFormat.colorSpace = SRGB;
675     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
676 
677     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
678     inputGainmapFormat.colorSpace = SRGB;
679     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
680 
681     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
682     outputFormat.colorSpace = BT2020_PQ;
683     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
684     if (g_suppported) {
685         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
686     } else {
687         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
688     }
689 }
690 
691 /**
692  * @tc.number    : Composition_SUPPORT_006
693  * @tc.name      : p3 + p3 gainmap to PQ rgba1010102
694  * @tc.desc      : api test
695  */
696 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_006, TestSize.Level2)
697 {
698     ImageProcessing_ColorSpaceInfo inputFormat;
699     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
700     ImageProcessing_ColorSpaceInfo outputFormat;
701 
702     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
703     inputFormat.colorSpace = DISPLAY_P3;
704     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
705 
706     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
707     inputGainmapFormat.colorSpace = DISPLAY_P3;
708     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
709 
710     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
711     outputFormat.colorSpace = BT2020_PQ;
712     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
713     if (g_suppported) {
714         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
715     } else {
716         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
717     }
718 }
719 
720 /**
721  * @tc.number    : Composition_SUPPORT_007
722  * @tc.name      : srgb + srgb gainmap to HLG P010
723  * @tc.desc      : api test
724  */
725 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_007, TestSize.Level2)
726 {
727     ImageProcessing_ColorSpaceInfo inputFormat;
728     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
729     ImageProcessing_ColorSpaceInfo outputFormat;
730 
731     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
732     inputFormat.colorSpace = SRGB;
733     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
734 
735     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
736     inputGainmapFormat.colorSpace = SRGB;
737     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
738 
739     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
740     outputFormat.colorSpace = BT2020_HLG;
741     outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
742     if (g_suppported) {
743         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
744     } else {
745         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
746     }
747 }
748 
749 /**
750  * @tc.number    : Composition_SUPPORT_008
751  * @tc.name      : p3 + p3 gainmap to HLG P010
752  * @tc.desc      : api test
753  */
754 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_008, TestSize.Level2)
755 {
756     ImageProcessing_ColorSpaceInfo inputFormat;
757     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
758     ImageProcessing_ColorSpaceInfo outputFormat;
759 
760     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
761     inputFormat.colorSpace = DISPLAY_P3;
762     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
763 
764     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
765     inputGainmapFormat.colorSpace = DISPLAY_P3;
766     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
767 
768     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
769     outputFormat.colorSpace = BT2020_HLG;
770     outputFormat.pixelFormat = PIXEL_FORMAT_YCBCR_P010;
771     if (g_suppported) {
772         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
773     } else {
774         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
775     }
776 }
777 
778 /**
779  * @tc.number    : Composition_SUPPORT_011
780  * @tc.name      : srgb + srgb gainmap to HLG rgba1010102
781  * @tc.desc      : api test
782  */
783 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_011, TestSize.Level2)
784 {
785     ImageProcessing_ColorSpaceInfo inputFormat;
786     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
787     ImageProcessing_ColorSpaceInfo outputFormat;
788 
789     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
790     inputFormat.colorSpace = SRGB;
791     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
792 
793     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
794     inputGainmapFormat.colorSpace = SRGB;
795     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
796 
797     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
798     outputFormat.colorSpace = BT2020_HLG;
799     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
800     if (g_suppported) {
801         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
802     } else {
803         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
804     }
805 }
806 
807 /**
808  * @tc.number    : Composition_SUPPORT_012
809  * @tc.name      : p3 + p3 gainmap to HLG rgba1010102
810  * @tc.desc      : api test
811  */
812 HWTEST_F(VpeVideoCapTest, Composition_SUPPORT_012, TestSize.Level2)
813 {
814     ImageProcessing_ColorSpaceInfo inputFormat;
815     ImageProcessing_ColorSpaceInfo inputGainmapFormat;
816     ImageProcessing_ColorSpaceInfo outputFormat;
817 
818     inputFormat.metadataType = HDR_METADATA_TYPE_BASE;
819     inputFormat.colorSpace = DISPLAY_P3;
820     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
821 
822     inputGainmapFormat.metadataType = HDR_METADATA_TYPE_GAINMAP;
823     inputGainmapFormat.colorSpace = DISPLAY_P3;
824     inputGainmapFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
825 
826     outputFormat.metadataType = HDR_METADATA_TYPE_ALTERNATE;
827     outputFormat.colorSpace = BT2020_HLG;
828     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_1010102;
829     if (g_suppported) {
830         ASSERT_EQ(true, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
831     } else {
832         ASSERT_EQ(false, OH_ImageProcessing_IsCompositionSupported(&inputFormat, &inputGainmapFormat, &outputFormat));
833     }
834 }
835 
836 /**
837  * @tc.number    : COLORSPACE_SUPPORT_013
838  * @tc.name      : srgb to display p3
839  * @tc.desc      : api test
840  */
841 HWTEST_F(VpeVideoCapTest, COLORSPACE_SUPPORT_013, TestSize.Level2)
842 {
843     ImageProcessing_ColorSpaceInfo inputFormat;
844     ImageProcessing_ColorSpaceInfo outputFormat;
845     inputFormat.metadataType = HDR_METADATA_TYPE_NONE;
846     inputFormat.colorSpace = SRGB;
847     inputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
848     outputFormat.metadataType = HDR_METADATA_TYPE_NONE;
849     outputFormat.colorSpace = DISPLAY_P3;
850     outputFormat.pixelFormat = PIXEL_FORMAT_RGBA_8888;
851     if (g_suppported) {
852         ASSERT_EQ(true, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
853     } else {
854         ASSERT_EQ(false, OH_ImageProcessing_IsColorSpaceConversionSupported(&inputFormat, &outputFormat));
855     }
856 }
857 } // namespace