xref: /OK3568_Linux_fs/external/rockit/mpi/example/common/test_comm_vo.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2021 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "rk_mpi_vo.h"
18 
19 #ifdef __cplusplus
20 #if __cplusplus
21 extern "C" {
22 #endif
23 #endif /* End of #ifdef __cplusplus */
24 
25 #ifndef ARRAY_LENGTH
26 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
27 #endif
28 
29 typedef struct rkVO_Timing_S {
30     RK_S32  enIntfSync;
31     RK_U32  u32Width;
32     RK_U32  u32Height;
33 } VO_Timing_S;
34 
35 static VO_Timing_S stVoTimings[] = {
36     {VO_OUTPUT_640x480_60, 640, 480},
37     {VO_OUTPUT_800x600_60, 800, 600},
38     {VO_OUTPUT_1024x768_60, 1024, 768},
39     {VO_OUTPUT_1280x1024_60, 1280, 1024},
40     {VO_OUTPUT_1366x768_60, 1366, 768},
41     {VO_OUTPUT_1440x900_60, 1440, 900},
42     {VO_OUTPUT_1280x800_60, 1280, 800},
43     {VO_OUTPUT_1600x1200_60, 1600, 1200},
44     {VO_OUTPUT_1680x1050_60, 1680, 1050},
45     {VO_OUTPUT_1920x1200_60, 1920, 1200},
46 };
47 
TEST_VO_GetDisplaySize(RK_S32 enIntfSync,RK_U32 * s32W,RK_U32 * s32H)48 void TEST_VO_GetDisplaySize(RK_S32 enIntfSync, RK_U32 *s32W, RK_U32 *s32H) {
49     switch (enIntfSync) {
50         case VO_OUTPUT_PAL:
51         case VO_OUTPUT_576P50:
52             *s32W = 720;
53             *s32H = 576;
54             break;
55         case VO_OUTPUT_NTSC:
56         case VO_OUTPUT_480P60:
57             *s32W = 720;
58             *s32H = 480;
59             break;
60         case VO_OUTPUT_720P50:
61         case VO_OUTPUT_720P60:
62             *s32W = 1280;
63             *s32H = 720;
64             break;
65         case VO_OUTPUT_1080P24:
66         case VO_OUTPUT_1080P25:
67         case VO_OUTPUT_1080P30:
68         case VO_OUTPUT_1080I50:
69         case VO_OUTPUT_1080I60:
70         case VO_OUTPUT_1080P50:
71         case VO_OUTPUT_1080P60:
72             *s32W = 1920;
73             *s32H = 1080;
74             break;
75         case VO_OUTPUT_3840x2160_24:
76         case VO_OUTPUT_3840x2160_25:
77         case VO_OUTPUT_3840x2160_30:
78         case VO_OUTPUT_3840x2160_50:
79         case VO_OUTPUT_3840x2160_60:
80             *s32W = 3840;
81             *s32H = 2160;
82             break;
83         case VO_OUTPUT_4096x2160_24:
84         case VO_OUTPUT_4096x2160_25:
85         case VO_OUTPUT_4096x2160_30:
86         case VO_OUTPUT_4096x2160_50:
87         case VO_OUTPUT_4096x2160_60:
88             *s32W = 4096;
89             *s32H = 2160;
90             break;
91         default:
92             for (RK_S32 i = 0; i < ARRAY_LENGTH(stVoTimings); i++) {
93                 if (stVoTimings[i].enIntfSync == enIntfSync) {
94                     *s32W = stVoTimings[i].u32Width;
95                     *s32H = stVoTimings[i].u32Height;
96                     break;
97                 }
98             }
99             break;
100     }
101 }
102 
103 #ifdef __cplusplus
104 #if __cplusplus
105 }
106 #endif
107 #endif /* End of #ifdef __cplusplus */
108