xref: /OK3568_Linux_fs/external/rockit/mpi/example/mod/test_mpi_gdc.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright 2022 Rockchip Electronics Co. LTD
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Licensed under the Apache License, Version 2.0 (the "License");
5*4882a593Smuzhiyun  * you may not use this file except in compliance with the License.
6*4882a593Smuzhiyun  * You may obtain a copy of the License at
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  *      http://www.apache.org/licenses/LICENSE-2.0
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * Unless required by applicable law or agreed to in writing, software
11*4882a593Smuzhiyun  * distributed under the License is distributed on an "AS IS" BASIS,
12*4882a593Smuzhiyun  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4882a593Smuzhiyun  * See the License for the specific language governing permissions and
14*4882a593Smuzhiyun  * limitations under the License.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  */
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #undef DBG_MOD_ID
19*4882a593Smuzhiyun #define DBG_MOD_ID       RK_ID_GDC
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #include <unistd.h>
22*4882a593Smuzhiyun #include <pthread.h>
23*4882a593Smuzhiyun #include <stdlib.h>
24*4882a593Smuzhiyun #include <cstdio>
25*4882a593Smuzhiyun #include <cerrno>
26*4882a593Smuzhiyun #include <cstring>
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #include "rk_type.h"
29*4882a593Smuzhiyun #include "rk_debug.h"
30*4882a593Smuzhiyun #include "rk_mpi_gdc.h"
31*4882a593Smuzhiyun #include "rk_mpi_mb.h"
32*4882a593Smuzhiyun #include "rk_mpi_sys.h"
33*4882a593Smuzhiyun #include "rk_mpi_cal.h"
34*4882a593Smuzhiyun #include "rk_mpi_vo.h"
35*4882a593Smuzhiyun #include "rk_comm_vo.h"
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #include "test_comm_argparse.h"
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun // for vo
40*4882a593Smuzhiyun #define RK35XX_VO_DEV_HD0 0
41*4882a593Smuzhiyun #define RK35XX_VO_DEV_HD1 1
42*4882a593Smuzhiyun #define RK35XX_VO_GDC_CHN 0
43*4882a593Smuzhiyun #define RK35XX_VOP_LAYER_CLUSTER_0 0
44*4882a593Smuzhiyun #define RK35XX_VOP_LAYER_CLUSTER_1 2
45*4882a593Smuzhiyun #define RK35XX_VOP_LAYER_ESMART_0 4
46*4882a593Smuzhiyun #define RK35XX_VOP_LAYER_ESMART_1 5
47*4882a593Smuzhiyun #define RK35XX_VOP_LAYER_SMART_0 6
48*4882a593Smuzhiyun #define RK35XX_VOP_LAYER_SMART_1 7
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #define RK35XX_VO_LINE_CHN 127
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun RK_U16 gau16PointColor[9] = {
53*4882a593Smuzhiyun     0x8000 | 0x44c4,  // red
54*4882a593Smuzhiyun     0x8000 | 0x1234,  // blue
55*4882a593Smuzhiyun     0x8000 | 0x7fff,  // white
56*4882a593Smuzhiyun     0x8000 | 0x7322,
57*4882a593Smuzhiyun     0x8000 | 0x5433,
58*4882a593Smuzhiyun     0x8000 | 0x6544,
59*4882a593Smuzhiyun     0x8000 | 0x7644,
60*4882a593Smuzhiyun     0x8000 | 0x8744,
61*4882a593Smuzhiyun     0x8000 | 0x9844
62*4882a593Smuzhiyun };
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun typedef enum _TestGdcDeskCeilMode {
65*4882a593Smuzhiyun     TEST_GDC_DESK_CEIL_MODE_1P_ADD_1     = 0,
66*4882a593Smuzhiyun     TEST_GDC_DESK_CEIL_MODE_2P           = 1,
67*4882a593Smuzhiyun     TEST_GDC_DESK_CEIL_MODE_1_ADD_3      = 2,
68*4882a593Smuzhiyun     TEST_GDC_DESK_CEIL_MODE_1_ADD_4      = 3,
69*4882a593Smuzhiyun     TEST_GDC_DESK_CEIL_MODE_1P_ADD_6     = 4,
70*4882a593Smuzhiyun     TEST_GDC_DESK_CEIL_MODE_1_ADD_8      = 5,
71*4882a593Smuzhiyun     TEST_GDC_DESK_CEIL_MODE_BUTT
72*4882a593Smuzhiyun } TestGdcDeskCeilMode;
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun typedef enum _TestGdcWallMode {
75*4882a593Smuzhiyun     TEST_GDC_WALL_MODE_1P                = 0,
76*4882a593Smuzhiyun     TEST_GDC_WALL_MODE_1P_ADD_3          = 1,
77*4882a593Smuzhiyun     TEST_GDC_WALL_MODE_1P_ADD_4          = 2,
78*4882a593Smuzhiyun     TEST_GDC_WALL_MODE_1P_ADD_8          = 3,
79*4882a593Smuzhiyun     TEST_GDC_WALL_MODE_BUTT
80*4882a593Smuzhiyun } TestGdcWallMode;
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun typedef struct _rkMpiGdcCtx {
83*4882a593Smuzhiyun     const char *srcFilePath;
84*4882a593Smuzhiyun     RK_S32  s32LoopCount;
85*4882a593Smuzhiyun     RK_S32  s32JobNum;
86*4882a593Smuzhiyun     RK_S32  s32TaskSum;
87*4882a593Smuzhiyun     RK_S32  s32TaskType;
88*4882a593Smuzhiyun     RK_S32  s32TaskMode;
89*4882a593Smuzhiyun     RK_S32  u32SrcWidth;
90*4882a593Smuzhiyun     RK_S32  u32SrcHeight;
91*4882a593Smuzhiyun     RK_S32  u32SrcVirWidth;
92*4882a593Smuzhiyun     RK_S32  u32SrcVirHeight;
93*4882a593Smuzhiyun     RK_S32  u32LineWidth;
94*4882a593Smuzhiyun     RK_S32  u32LineHeight;
95*4882a593Smuzhiyun     RK_S32  s32SrcCompressMode;
96*4882a593Smuzhiyun     RK_S32  s32SrcPixFormat;
97*4882a593Smuzhiyun     RK_S32  u32DstWidth;
98*4882a593Smuzhiyun     RK_S32  u32DstHeight;
99*4882a593Smuzhiyun     RK_S32  s32DstCompressMode;
100*4882a593Smuzhiyun     RK_S32  s32DstPixFormat;
101*4882a593Smuzhiyun     RK_S32  s32JobIdx;
102*4882a593Smuzhiyun     RK_U32  u32SrcSize;
103*4882a593Smuzhiyun     RK_U32  u32ShowPoint;
104*4882a593Smuzhiyun     RK_U32  u32ChangeParam;
105*4882a593Smuzhiyun     RK_U32  u32PointLen;
106*4882a593Smuzhiyun     MB_POOL inPool;
107*4882a593Smuzhiyun     TestGdcDeskCeilMode enDeskCeilMode;
108*4882a593Smuzhiyun     TestGdcWallMode enWallMode;
109*4882a593Smuzhiyun     FISHEYE_JOB_CONFIG_S stFisheyeJobConfig;
110*4882a593Smuzhiyun     GDC_TASK_ATTR_S stTask;
111*4882a593Smuzhiyun     FISHEYE_ATTR_S stFisheyeAttr;
112*4882a593Smuzhiyun     POINT_S *pastDstPoint;
113*4882a593Smuzhiyun     POINT_S *pastSrcPoint;
114*4882a593Smuzhiyun     // for vo
115*4882a593Smuzhiyun     VO_CHN_ATTR_S stChnAttr;
116*4882a593Smuzhiyun     VO_VIDEO_LAYER_ATTR_S stLayerAttr;
117*4882a593Smuzhiyun     VO_LAYER s32VoLayer;
118*4882a593Smuzhiyun     VO_DEV s32VoDev;
119*4882a593Smuzhiyun     VO_CHN s32VoChn;
120*4882a593Smuzhiyun     VO_INTF_SYNC_E stVoOutputResolution;
121*4882a593Smuzhiyun     RK_S32 u32VoWidth;
122*4882a593Smuzhiyun     RK_S32 u32VoHeight;
123*4882a593Smuzhiyun     RECT_S stChnRect;
124*4882a593Smuzhiyun } TEST_GDC_CTX_S;
125*4882a593Smuzhiyun 
126*4882a593Smuzhiyun typedef enum _rkGdcChangeType {
127*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_VIEW_MODE,
128*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_IN_RADIUS,
129*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_OUT_RADIUS,
130*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_PAN,
131*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_TILT,
132*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_HOR_ZOOM,
133*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_VER_ZOOM,
134*4882a593Smuzhiyun     TEST_GDC_CHANGE_TYPE_ALL
135*4882a593Smuzhiyun } TEST_GDC_CHANGE_TYPE;
136*4882a593Smuzhiyun 
create_vo(TEST_GDC_CTX_S * ctx,RK_U32 u32Ch)137*4882a593Smuzhiyun static RK_S32 create_vo(TEST_GDC_CTX_S *ctx, RK_U32 u32Ch) {
138*4882a593Smuzhiyun     /* Enable VO */
139*4882a593Smuzhiyun     VO_PUB_ATTR_S VoPubAttr;
140*4882a593Smuzhiyun     RK_S32 s32Ret = RK_SUCCESS;
141*4882a593Smuzhiyun     VO_LAYER VoLayer = ctx->s32VoLayer;
142*4882a593Smuzhiyun     VO_DEV VoDev = ctx->s32VoDev;
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun     memset(&VoPubAttr, 0, sizeof(VO_PUB_ATTR_S));
145*4882a593Smuzhiyun 
146*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_GetPubAttr(VoDev, &VoPubAttr);
147*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
148*4882a593Smuzhiyun         return s32Ret;
149*4882a593Smuzhiyun     }
150*4882a593Smuzhiyun 
151*4882a593Smuzhiyun     VoPubAttr.enIntfType = VO_INTF_HDMI;
152*4882a593Smuzhiyun     VoPubAttr.enIntfSync = ctx->stVoOutputResolution;
153*4882a593Smuzhiyun 
154*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_SetPubAttr(VoDev, &VoPubAttr);
155*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
156*4882a593Smuzhiyun         return s32Ret;
157*4882a593Smuzhiyun     }
158*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_Enable(VoDev);
159*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
160*4882a593Smuzhiyun         return s32Ret;
161*4882a593Smuzhiyun     }
162*4882a593Smuzhiyun 
163*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_SetLayerAttr(VoLayer, &ctx->stLayerAttr);
164*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
165*4882a593Smuzhiyun         RK_LOGE("RK_MPI_VO_SetLayerAttr failed,s32Ret:%d\n", s32Ret);
166*4882a593Smuzhiyun         return RK_FAILURE;
167*4882a593Smuzhiyun     }
168*4882a593Smuzhiyun 
169*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_BindLayer(VoLayer, VoDev, VO_LAYER_MODE_VIDEO);
170*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
171*4882a593Smuzhiyun         RK_LOGE("RK_MPI_VO_BindLayer failed,s32Ret:%d\n", s32Ret);
172*4882a593Smuzhiyun         return RK_FAILURE;
173*4882a593Smuzhiyun     }
174*4882a593Smuzhiyun 
175*4882a593Smuzhiyun 
176*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_EnableLayer(VoLayer);
177*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
178*4882a593Smuzhiyun         RK_LOGE("RK_MPI_VO_EnableLayer failed,s32Ret:%d\n", s32Ret);
179*4882a593Smuzhiyun         return RK_FAILURE;
180*4882a593Smuzhiyun     }
181*4882a593Smuzhiyun 
182*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_SetChnAttr(VoLayer, u32Ch, &ctx->stChnAttr);
183*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
184*4882a593Smuzhiyun         RK_LOGE("set chn Attr failed,s32Ret:%d\n", s32Ret);
185*4882a593Smuzhiyun         return RK_FAILURE;
186*4882a593Smuzhiyun     }
187*4882a593Smuzhiyun 
188*4882a593Smuzhiyun     return s32Ret;
189*4882a593Smuzhiyun }
190*4882a593Smuzhiyun 
191*4882a593Smuzhiyun #if 0
192*4882a593Smuzhiyun RK_S32 unit_test_mpi_gdc(TEST_GDC_CTX_S *ctx) {
193*4882a593Smuzhiyun     RK_S32 s32Ret = RK_SUCCESS;
194*4882a593Smuzhiyun     pthread_t tids[GDC_MAX_JOB_NUM];
195*4882a593Smuzhiyun     TEST_GDC_CTX_S tmpCtx[GDC_MAX_JOB_NUM];
196*4882a593Smuzhiyun 
197*4882a593Smuzhiyun     for (RK_S32 jobIndex = 0; jobIndex < ctx->s32JobNum; jobIndex++) {
198*4882a593Smuzhiyun         memcpy(&(tmpCtx[jobIndex]), ctx, sizeof(TEST_GDC_CTX_S));
199*4882a593Smuzhiyun         pthread_create(&tids[jobIndex], 0, unit_test_gdc_counts, reinterpret_cast<void *>(&tmpCtx[jobIndex]));
200*4882a593Smuzhiyun         ctx->s32JobIdx++;
201*4882a593Smuzhiyun     }
202*4882a593Smuzhiyun 
203*4882a593Smuzhiyun     for (RK_S32 jobIndex = 0; jobIndex < ctx->s32JobNum; jobIndex++) {
204*4882a593Smuzhiyun         pthread_join(tids[jobIndex], RK_NULL);
205*4882a593Smuzhiyun     }
206*4882a593Smuzhiyun 
207*4882a593Smuzhiyun     return s32Ret;
208*4882a593Smuzhiyun }
209*4882a593Smuzhiyun #endif
read_with_pixel_width(RK_U8 * pBuf,RK_U32 u32Width,RK_U32 u32VirHeight,RK_U32 u32VirWidth,RK_U32 u32PixWidth,FILE * fp)210*4882a593Smuzhiyun static RK_S32 read_with_pixel_width(RK_U8 *pBuf, RK_U32 u32Width, RK_U32 u32VirHeight,
211*4882a593Smuzhiyun                                      RK_U32 u32VirWidth, RK_U32 u32PixWidth, FILE *fp) {
212*4882a593Smuzhiyun     RK_U32 u32Row;
213*4882a593Smuzhiyun     RK_S32 s32ReadSize;
214*4882a593Smuzhiyun 
215*4882a593Smuzhiyun     for (u32Row = 0; u32Row < u32VirHeight; u32Row++) {
216*4882a593Smuzhiyun         s32ReadSize = fread(pBuf + u32Row * u32VirWidth * u32PixWidth, 1, u32Width * u32PixWidth, fp);
217*4882a593Smuzhiyun         if (s32ReadSize != u32Width * u32PixWidth) {
218*4882a593Smuzhiyun             RK_LOGE("read file failed expect %d vs %d\n",
219*4882a593Smuzhiyun                       u32Width * u32PixWidth, s32ReadSize);
220*4882a593Smuzhiyun             return RK_FAILURE;
221*4882a593Smuzhiyun         }
222*4882a593Smuzhiyun     }
223*4882a593Smuzhiyun 
224*4882a593Smuzhiyun     return RK_SUCCESS;
225*4882a593Smuzhiyun }
226*4882a593Smuzhiyun 
read_image(RK_U8 * pVirAddr,RK_U32 u32Width,RK_U32 u32Height,RK_U32 u32VirWidth,RK_U32 u32VirHeight,RK_U32 u32PixFormat,FILE * fp)227*4882a593Smuzhiyun static RK_S32 read_image(RK_U8 *pVirAddr, RK_U32 u32Width, RK_U32 u32Height,
228*4882a593Smuzhiyun                             RK_U32 u32VirWidth, RK_U32 u32VirHeight, RK_U32 u32PixFormat, FILE *fp) {
229*4882a593Smuzhiyun     RK_U32 u32Row = 0;
230*4882a593Smuzhiyun     RK_U32 u32ReadSize = 0;
231*4882a593Smuzhiyun     RK_S32 s32Ret = RK_SUCCESS;
232*4882a593Smuzhiyun 
233*4882a593Smuzhiyun     RK_U8 *pBufy = pVirAddr;
234*4882a593Smuzhiyun     RK_U8 *pBufu = pBufy + u32VirWidth * u32VirHeight;
235*4882a593Smuzhiyun     RK_U8 *pBufv = pBufu + u32VirWidth * u32VirHeight / 4;
236*4882a593Smuzhiyun 
237*4882a593Smuzhiyun     switch (u32PixFormat) {
238*4882a593Smuzhiyun         case RK_FMT_YUV420SP:
239*4882a593Smuzhiyun         case RK_FMT_YUV420SP_VU: {
240*4882a593Smuzhiyun             for (u32Row = 0; u32Row < u32VirHeight; u32Row++) {
241*4882a593Smuzhiyun                 u32ReadSize = fread(pBufy + u32Row * u32VirWidth, 1, u32Width, fp);
242*4882a593Smuzhiyun                 if (u32ReadSize != u32Width) {
243*4882a593Smuzhiyun                      return RK_FAILURE;
244*4882a593Smuzhiyun                 }
245*4882a593Smuzhiyun             }
246*4882a593Smuzhiyun 
247*4882a593Smuzhiyun             for (u32Row = 0; u32Row < u32VirHeight / 2; u32Row++) {
248*4882a593Smuzhiyun                 u32ReadSize = fread(pBufu + u32Row * u32VirWidth, 1, u32Width, fp);
249*4882a593Smuzhiyun                 if (u32ReadSize != u32Width) {
250*4882a593Smuzhiyun                     return RK_FAILURE;
251*4882a593Smuzhiyun                 }
252*4882a593Smuzhiyun             }
253*4882a593Smuzhiyun         } break;
254*4882a593Smuzhiyun         case RK_FMT_RGB888:
255*4882a593Smuzhiyun         case RK_FMT_BGR888: {
256*4882a593Smuzhiyun             s32Ret = read_with_pixel_width(pBufy, u32Width, u32VirHeight, u32VirWidth, 3, fp);
257*4882a593Smuzhiyun         } break;
258*4882a593Smuzhiyun         default : {
259*4882a593Smuzhiyun             RK_LOGE("read image do not support fmt %d\n", u32PixFormat);
260*4882a593Smuzhiyun             return RK_FAILURE;
261*4882a593Smuzhiyun         } break;
262*4882a593Smuzhiyun     }
263*4882a593Smuzhiyun 
264*4882a593Smuzhiyun     return s32Ret;
265*4882a593Smuzhiyun }
266*4882a593Smuzhiyun 
unit_test_gdc_get_size(TEST_GDC_CTX_S * ctx)267*4882a593Smuzhiyun RK_U32 unit_test_gdc_get_size(TEST_GDC_CTX_S *ctx) {
268*4882a593Smuzhiyun     RK_S32 s32Ret = RK_SUCCESS;
269*4882a593Smuzhiyun     PIC_BUF_ATTR_S stPicBufAttr;
270*4882a593Smuzhiyun     MB_PIC_CAL_S   stMbPicCalResult;
271*4882a593Smuzhiyun 
272*4882a593Smuzhiyun     if (ctx->u32SrcVirWidth == 0) {
273*4882a593Smuzhiyun         ctx->u32SrcVirWidth = ctx->u32SrcWidth;
274*4882a593Smuzhiyun     }
275*4882a593Smuzhiyun     if (ctx->u32SrcVirHeight == 0) {
276*4882a593Smuzhiyun         ctx->u32SrcVirHeight = ctx->u32SrcHeight;
277*4882a593Smuzhiyun     }
278*4882a593Smuzhiyun 
279*4882a593Smuzhiyun     stPicBufAttr.u32Width = ctx->u32SrcVirWidth;
280*4882a593Smuzhiyun     stPicBufAttr.u32Height = ctx->u32SrcVirHeight;
281*4882a593Smuzhiyun     stPicBufAttr.enPixelFormat = (PIXEL_FORMAT_E)ctx->s32SrcPixFormat;
282*4882a593Smuzhiyun     stPicBufAttr.enCompMode = (COMPRESS_MODE_E)ctx->s32SrcCompressMode;
283*4882a593Smuzhiyun     s32Ret = RK_MPI_CAL_COMM_GetPicBufferSize(&stPicBufAttr, &stMbPicCalResult);
284*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
285*4882a593Smuzhiyun         RK_LOGE("get picture buffer size failed. err 0x%x", s32Ret);
286*4882a593Smuzhiyun         return s32Ret;
287*4882a593Smuzhiyun     }
288*4882a593Smuzhiyun 
289*4882a593Smuzhiyun     return stMbPicCalResult.u32MBSize;
290*4882a593Smuzhiyun }
291*4882a593Smuzhiyun 
test_mpi_gdc_change_parameter(TEST_GDC_CTX_S * ctx,RK_S32 index,TEST_GDC_CHANGE_TYPE type)292*4882a593Smuzhiyun RK_VOID test_mpi_gdc_change_parameter(TEST_GDC_CTX_S *ctx, RK_S32 index, TEST_GDC_CHANGE_TYPE type) {
293*4882a593Smuzhiyun     FISHEYE_REGION_ATTR_S regionAttr;
294*4882a593Smuzhiyun     memcpy(&regionAttr, &ctx->stFisheyeAttr.astFishEyeRegionAttr[index], sizeof(FISHEYE_REGION_ATTR_S));
295*4882a593Smuzhiyun 
296*4882a593Smuzhiyun     switch (type) {
297*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_VIEW_MODE:
298*4882a593Smuzhiyun         break;
299*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_IN_RADIUS:
300*4882a593Smuzhiyun         break;
301*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_OUT_RADIUS:
302*4882a593Smuzhiyun         break;
303*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_PAN:
304*4882a593Smuzhiyun             if (regionAttr.u32Pan < 360)
305*4882a593Smuzhiyun                 regionAttr.u32Pan++;
306*4882a593Smuzhiyun             else
307*4882a593Smuzhiyun                 regionAttr.u32Pan = 0;
308*4882a593Smuzhiyun         break;
309*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_TILT:
310*4882a593Smuzhiyun             if (regionAttr.u32Tilt < 360)
311*4882a593Smuzhiyun                 regionAttr.u32Tilt++;
312*4882a593Smuzhiyun             else
313*4882a593Smuzhiyun                 regionAttr.u32Tilt = 0;
314*4882a593Smuzhiyun         break;
315*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_HOR_ZOOM:
316*4882a593Smuzhiyun             if (regionAttr.u32HorZoom < 4095)
317*4882a593Smuzhiyun                 regionAttr.u32HorZoom++;
318*4882a593Smuzhiyun             else
319*4882a593Smuzhiyun                 regionAttr.u32HorZoom = 1;
320*4882a593Smuzhiyun         break;
321*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_VER_ZOOM:
322*4882a593Smuzhiyun             if (regionAttr.u32VerZoom < 4095)
323*4882a593Smuzhiyun                 regionAttr.u32VerZoom++;
324*4882a593Smuzhiyun             else
325*4882a593Smuzhiyun                 regionAttr.u32VerZoom = 1;
326*4882a593Smuzhiyun         break;
327*4882a593Smuzhiyun         case TEST_GDC_CHANGE_TYPE_ALL:
328*4882a593Smuzhiyun         break;
329*4882a593Smuzhiyun     }
330*4882a593Smuzhiyun     memcpy(&ctx->stFisheyeAttr.astFishEyeRegionAttr[index], &regionAttr, sizeof(FISHEYE_REGION_ATTR_S));
331*4882a593Smuzhiyun }
332*4882a593Smuzhiyun 
test_mpi_gdc_get_src_point(TEST_GDC_CTX_S * ctx)333*4882a593Smuzhiyun RK_VOID test_mpi_gdc_get_src_point(TEST_GDC_CTX_S *ctx) {
334*4882a593Smuzhiyun     RK_S32 s32Ret;
335*4882a593Smuzhiyun     for (RK_U32 region = 1; region < ctx->stFisheyeAttr.u32RegionNum; region++) {
336*4882a593Smuzhiyun         GDC_FISHEYE_POINT_QUERY_ATTR_S stQuery;
337*4882a593Smuzhiyun         POINT_S stDstPoint, stSrcPoint;
338*4882a593Smuzhiyun         memset(&stQuery, 0, sizeof(sizeof(FISHEYE_ATTR_S)));
339*4882a593Smuzhiyun         stQuery.pstFishEyeAttr = &ctx->stFisheyeAttr;
340*4882a593Smuzhiyun         stQuery.u32RegionIndex = region;
341*4882a593Smuzhiyun         stDstPoint.s32X = 0;
342*4882a593Smuzhiyun         stDstPoint.s32Y = 540;
343*4882a593Smuzhiyun         s32Ret = RK_MPI_GDC_FisheyePosQueryDst2Src(&stQuery, &ctx->stTask.stImgIn, &stDstPoint, &stSrcPoint);
344*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
345*4882a593Smuzhiyun             RK_LOGE("RK_MPI_GDC_FisheyePosQueryDst2Src err:0x%x!", s32Ret);
346*4882a593Smuzhiyun         }
347*4882a593Smuzhiyun         RK_LOGD("region:%d dst:%d,%d src:%d,%d", region, stDstPoint.s32X, stDstPoint.s32Y,
348*4882a593Smuzhiyun                                                  stSrcPoint.s32X, stSrcPoint.s32Y);
349*4882a593Smuzhiyun     }
350*4882a593Smuzhiyun }
351*4882a593Smuzhiyun 
test_mpi_gdc_get_pano_point(TEST_GDC_CTX_S * ctx)352*4882a593Smuzhiyun RK_VOID test_mpi_gdc_get_pano_point(TEST_GDC_CTX_S *ctx) {
353*4882a593Smuzhiyun     RK_S32 s32Ret;
354*4882a593Smuzhiyun     for (RK_U32 region = 1; region < ctx->stFisheyeAttr.u32RegionNum; region++) {
355*4882a593Smuzhiyun         GDC_FISHEYE_POINT_QUERY_ATTR_S stQuery;
356*4882a593Smuzhiyun         POINT_S stDstPoint, stPanoPoint;
357*4882a593Smuzhiyun         memset(&stQuery, 0, sizeof(sizeof(FISHEYE_ATTR_S)));
358*4882a593Smuzhiyun         stQuery.pstFishEyeAttr = &ctx->stFisheyeAttr;
359*4882a593Smuzhiyun         stQuery.u32RegionIndex = region;
360*4882a593Smuzhiyun         stDstPoint.s32X = 0;
361*4882a593Smuzhiyun         stDstPoint.s32Y = 540;
362*4882a593Smuzhiyun         s32Ret = RK_MPI_GDC_FisheyePosQueryDst2Pano(&stQuery, &ctx->stTask.stImgIn, 0, &stDstPoint, &stPanoPoint);
363*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
364*4882a593Smuzhiyun             RK_LOGE("RK_MPI_GDC_FisheyePosQueryDst2Pano err:0x%x!", s32Ret);
365*4882a593Smuzhiyun         }
366*4882a593Smuzhiyun         RK_LOGD("region:%d dst:%d,%d pano:%d,%d", region, stDstPoint.s32X, stDstPoint.s32Y,
367*4882a593Smuzhiyun                                                   stPanoPoint.s32X, stPanoPoint.s32Y);
368*4882a593Smuzhiyun     }
369*4882a593Smuzhiyun }
370*4882a593Smuzhiyun 
test_mpi_gdc_get_src_point_array(TEST_GDC_CTX_S * ctx,RK_U32 region)371*4882a593Smuzhiyun RK_S32 test_mpi_gdc_get_src_point_array(TEST_GDC_CTX_S *ctx, RK_U32 region) {
372*4882a593Smuzhiyun     RK_S32 s32Ret;
373*4882a593Smuzhiyun     RK_FLOAT step;
374*4882a593Smuzhiyun     RK_U32 w = ctx->stFisheyeAttr.astFishEyeRegionAttr[region].stOutRect.u32Width;
375*4882a593Smuzhiyun     RK_U32 h = ctx->stFisheyeAttr.astFishEyeRegionAttr[region].stOutRect.u32Height;
376*4882a593Smuzhiyun 
377*4882a593Smuzhiyun     ctx->u32PointLen = ctx->u32PointLen > ((w + h) * 2) ? (w + h) * 2 : ctx->u32PointLen;
378*4882a593Smuzhiyun     step = (RK_FLOAT)((w + h) * 2) / ctx->u32PointLen;
379*4882a593Smuzhiyun 
380*4882a593Smuzhiyun     for (RK_U32 i = 0; i < ctx->u32PointLen; i++) {
381*4882a593Smuzhiyun         if ((step * i) <= w) {
382*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = step * i;
383*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = 0;
384*4882a593Smuzhiyun         } else if ((step * i) <= (w + h)) {
385*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = (w - 1);
386*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = (step * i - w);
387*4882a593Smuzhiyun             // printf("22 region:%d i%d= %d,%d\n", region, i, ctx->pastDstPoint[i].s32X, ctx->pastDstPoint[i].s32Y);
388*4882a593Smuzhiyun         } else if ((step * i) <= (2 * w + h)) {
389*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = 2 * w + h - step * i;
390*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = h - 1;
391*4882a593Smuzhiyun             // printf("33 region:%d i%d=%d\n", region, i, ctx->pastDstPoint[i].s32X);
392*4882a593Smuzhiyun         } else {
393*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = 0;
394*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = (2 * (w + h)- step * i);
395*4882a593Smuzhiyun             // printf("44 region:%d i%d=%d\n", region, i, ctx->pastDstPoint[i].s32Y);
396*4882a593Smuzhiyun         }
397*4882a593Smuzhiyun     }
398*4882a593Smuzhiyun 
399*4882a593Smuzhiyun     // get the array
400*4882a593Smuzhiyun     GDC_FISHEYE_POINT_QUERY_ATTR_S stQuery;
401*4882a593Smuzhiyun     memset(&stQuery, 0, sizeof(sizeof(FISHEYE_ATTR_S)));
402*4882a593Smuzhiyun     stQuery.pstFishEyeAttr = &ctx->stFisheyeAttr;
403*4882a593Smuzhiyun     stQuery.u32RegionIndex = region;
404*4882a593Smuzhiyun     s32Ret = RK_MPI_GDC_FisheyePosQueryDst2SrcArray(&stQuery, &ctx->stTask.stImgIn, ctx->u32PointLen,
405*4882a593Smuzhiyun                                                     ctx->pastDstPoint, ctx->pastSrcPoint);
406*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
407*4882a593Smuzhiyun         RK_LOGE("RK_MPI_GDC_FisheyePosQueryDst2SrcArray err:0x%x!", s32Ret);
408*4882a593Smuzhiyun     }
409*4882a593Smuzhiyun 
410*4882a593Smuzhiyun     return s32Ret;
411*4882a593Smuzhiyun }
412*4882a593Smuzhiyun 
test_mpi_gdc_get_pano_point_array(TEST_GDC_CTX_S * ctx,RK_U32 region,RK_U32 pano_region)413*4882a593Smuzhiyun RK_S32 test_mpi_gdc_get_pano_point_array(TEST_GDC_CTX_S *ctx, RK_U32 region, RK_U32 pano_region) {
414*4882a593Smuzhiyun     RK_S32 s32Ret;
415*4882a593Smuzhiyun     RK_FLOAT step;
416*4882a593Smuzhiyun     RK_U32 w = ctx->stFisheyeAttr.astFishEyeRegionAttr[region].stOutRect.u32Width;
417*4882a593Smuzhiyun     RK_U32 h = ctx->stFisheyeAttr.astFishEyeRegionAttr[region].stOutRect.u32Height;
418*4882a593Smuzhiyun 
419*4882a593Smuzhiyun     ctx->u32PointLen = ctx->u32PointLen > ((w + h) * 2) ? (w + h) * 2 : ctx->u32PointLen;
420*4882a593Smuzhiyun     step = (RK_FLOAT)((w + h) * 2) / ctx->u32PointLen;
421*4882a593Smuzhiyun 
422*4882a593Smuzhiyun     for (RK_U32 i = 0; i < ctx->u32PointLen; i++) {
423*4882a593Smuzhiyun         if ((step * i) <= w) {
424*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = step * i;
425*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = 0;
426*4882a593Smuzhiyun         } else if ((step * i) <= (w + h)) {
427*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = (w - 1);
428*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = (step * i - w);
429*4882a593Smuzhiyun             // printf("22 region:%d i%d= %d,%d\n", region, i, ctx->pastDstPoint[i].s32X, ctx->pastDstPoint[i].s32Y);
430*4882a593Smuzhiyun         } else if ((step * i) <= (2 * w + h)) {
431*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = 2 * w + h - step * i;
432*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = h - 1;
433*4882a593Smuzhiyun             // printf("33 region:%d i%d=%d\n", region, i, ctx->pastDstPoint[i].s32X);
434*4882a593Smuzhiyun         } else {
435*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32X = 0;
436*4882a593Smuzhiyun             ctx->pastDstPoint[i].s32Y = (2 * (w + h)- step * i);
437*4882a593Smuzhiyun             // printf("44 region:%d i%d=%d\n", region, i, ctx->pastDstPoint[i].s32Y);
438*4882a593Smuzhiyun         }
439*4882a593Smuzhiyun     }
440*4882a593Smuzhiyun 
441*4882a593Smuzhiyun     // get the array
442*4882a593Smuzhiyun     GDC_FISHEYE_POINT_QUERY_ATTR_S stQuery;
443*4882a593Smuzhiyun     memset(&stQuery, 0, sizeof(sizeof(FISHEYE_ATTR_S)));
444*4882a593Smuzhiyun     stQuery.pstFishEyeAttr = &ctx->stFisheyeAttr;
445*4882a593Smuzhiyun     stQuery.u32RegionIndex = region;
446*4882a593Smuzhiyun     s32Ret = RK_MPI_GDC_FisheyePosQueryDst2PanoArray(&stQuery, &ctx->stTask.stImgIn, pano_region, ctx->u32PointLen,
447*4882a593Smuzhiyun                                                      ctx->pastDstPoint, ctx->pastSrcPoint);
448*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
449*4882a593Smuzhiyun         RK_LOGE("RK_MPI_GDC_FisheyePosQueryDst2PanoArray err:0x%x!", s32Ret);
450*4882a593Smuzhiyun     }
451*4882a593Smuzhiyun 
452*4882a593Smuzhiyun     return s32Ret;
453*4882a593Smuzhiyun }
454*4882a593Smuzhiyun 
test_mpi_gdc_desktop_ceil_mount_1p_add_1(TEST_GDC_CTX_S * ctx)455*4882a593Smuzhiyun RK_VOID test_mpi_gdc_desktop_ceil_mount_1p_add_1(TEST_GDC_CTX_S *ctx) {
456*4882a593Smuzhiyun     RK_S32 index = 0;
457*4882a593Smuzhiyun     RK_U32 fishOptParam_originX, fishOptParam_originY;
458*4882a593Smuzhiyun     fishOptParam_originX = 4132;
459*4882a593Smuzhiyun     fishOptParam_originY = 4169;
460*4882a593Smuzhiyun     RK_U32 outWidthBase = 1920;
461*4882a593Smuzhiyun     RK_U32 outHeightBase = 360;
462*4882a593Smuzhiyun     RK_U32 outYBase = 720;
463*4882a593Smuzhiyun 
464*4882a593Smuzhiyun     if (ctx->u32SrcWidth == 1920 && ctx->u32SrcHeight == 1080) {
465*4882a593Smuzhiyun         outWidthBase = 1920;
466*4882a593Smuzhiyun         outHeightBase = 360;
467*4882a593Smuzhiyun         outYBase = ctx->u32SrcHeight - outHeightBase;
468*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 2560 && ctx->u32SrcHeight == 1440) {
469*4882a593Smuzhiyun         outWidthBase = 2560;
470*4882a593Smuzhiyun         outHeightBase = 480;
471*4882a593Smuzhiyun         outYBase = ctx->u32SrcHeight - outHeightBase;
472*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 3840 && ctx->u32SrcHeight == 2160) {
473*4882a593Smuzhiyun         outWidthBase = 3840;
474*4882a593Smuzhiyun         outHeightBase = 720;
475*4882a593Smuzhiyun         outYBase = ctx->u32SrcHeight - outHeightBase;
476*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 7680 && ctx->u32SrcHeight == 4320) {
477*4882a593Smuzhiyun         outWidthBase = 7680;
478*4882a593Smuzhiyun         outHeightBase = 1440;
479*4882a593Smuzhiyun         outYBase = ctx->u32SrcHeight - outHeightBase;
480*4882a593Smuzhiyun     }
481*4882a593Smuzhiyun 
482*4882a593Smuzhiyun     ctx->stFisheyeAttr.bEnable = RK_TRUE;
483*4882a593Smuzhiyun     ctx->stFisheyeAttr.bLMF = RK_FALSE;
484*4882a593Smuzhiyun     ctx->stFisheyeAttr.bBgColor = RK_TRUE;
485*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32BgColor = 0;
486*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32HorOffset = ((fishOptParam_originX >> 3) - 512);
487*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32VerOffset = ((fishOptParam_originY >> 3) - 512);
488*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32TrapezoidCoef = 0;
489*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32FanStrength = 0;
490*4882a593Smuzhiyun     // ctx->stFisheyeAttr.enMountMode = FISHEYE_WALL_MOUNT;
491*4882a593Smuzhiyun 
492*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
493*4882a593Smuzhiyun 
494*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
495*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
496*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
497*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
498*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
499*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
500*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
501*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
502*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
503*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outYBase;
504*4882a593Smuzhiyun     index++;
505*4882a593Smuzhiyun 
506*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_360_PANORAMA;
507*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
508*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
509*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
510*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
511*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
512*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
513*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
514*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outYBase;
515*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
516*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
517*4882a593Smuzhiyun     index++;
518*4882a593Smuzhiyun 
519*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32RegionNum = index;
520*4882a593Smuzhiyun }
521*4882a593Smuzhiyun 
test_mpi_gdc_desktop_ceil_mount_1_add_3(TEST_GDC_CTX_S * ctx)522*4882a593Smuzhiyun RK_VOID test_mpi_gdc_desktop_ceil_mount_1_add_3(TEST_GDC_CTX_S *ctx) {
523*4882a593Smuzhiyun     RK_S32 index = 0;
524*4882a593Smuzhiyun     RK_U32 fishOptParam_originX, fishOptParam_originY;
525*4882a593Smuzhiyun     fishOptParam_originX = 4132;
526*4882a593Smuzhiyun     fishOptParam_originY = 4169;
527*4882a593Smuzhiyun     RK_U32 outWidthBase = 640;
528*4882a593Smuzhiyun     RK_U32 outHeightBase = 360;
529*4882a593Smuzhiyun 
530*4882a593Smuzhiyun     if (ctx->u32SrcWidth == 1920 && ctx->u32SrcHeight == 1080) {
531*4882a593Smuzhiyun         outWidthBase = 960;
532*4882a593Smuzhiyun         outHeightBase = 540;
533*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 2560 && ctx->u32SrcHeight == 1440) {
534*4882a593Smuzhiyun         outWidthBase = 1280;
535*4882a593Smuzhiyun         outHeightBase = 720;
536*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 3840 && ctx->u32SrcHeight == 2160) {
537*4882a593Smuzhiyun         outWidthBase = 1920;
538*4882a593Smuzhiyun         outHeightBase = 1080;
539*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 7680 && ctx->u32SrcHeight == 4320) {
540*4882a593Smuzhiyun         outWidthBase = 3840;
541*4882a593Smuzhiyun         outHeightBase = 2160;
542*4882a593Smuzhiyun     }
543*4882a593Smuzhiyun 
544*4882a593Smuzhiyun     ctx->stFisheyeAttr.bEnable = RK_TRUE;
545*4882a593Smuzhiyun     ctx->stFisheyeAttr.bLMF = RK_FALSE;
546*4882a593Smuzhiyun     ctx->stFisheyeAttr.bBgColor = RK_TRUE;
547*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32BgColor = 0;
548*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32HorOffset = ((fishOptParam_originX >> 3) - 512);
549*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32VerOffset = ((fishOptParam_originY >> 3) - 512);
550*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32TrapezoidCoef = 0;
551*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32FanStrength = 0;
552*4882a593Smuzhiyun     // ctx->stFisheyeAttr.enMountMode = FISHEYE_WALL_MOUNT;
553*4882a593Smuzhiyun 
554*4882a593Smuzhiyun     if (ctx->u32ShowPoint == 1)
555*4882a593Smuzhiyun         ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_NO_TRANSFORMATION;
556*4882a593Smuzhiyun     else
557*4882a593Smuzhiyun         ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_360_PANORAMA;
558*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
559*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
560*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
561*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
562*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
563*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
564*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
565*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
566*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
567*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
568*4882a593Smuzhiyun     index++;
569*4882a593Smuzhiyun 
570*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
571*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
572*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
573*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 120; /* RW; Range: [0, 360] */
574*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
575*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
576*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
577*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
578*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
579*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
580*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
581*4882a593Smuzhiyun     index++;
582*4882a593Smuzhiyun 
583*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
584*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
585*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
586*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 240; /* RW; Range: [0, 360] */
587*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
588*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
589*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
590*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
591*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
592*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
593*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
594*4882a593Smuzhiyun     index++;
595*4882a593Smuzhiyun 
596*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
597*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
598*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
599*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 0; /* RW; Range: [0, 360] */
600*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
601*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
602*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
603*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
604*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
605*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
606*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
607*4882a593Smuzhiyun     index++;
608*4882a593Smuzhiyun 
609*4882a593Smuzhiyun     // ctx->stFisheyeAttr.u32RegionNum = index;
610*4882a593Smuzhiyun }
611*4882a593Smuzhiyun 
test_mpi_gdc_desktop_ceil_mount_1_add_8(TEST_GDC_CTX_S * ctx)612*4882a593Smuzhiyun RK_VOID test_mpi_gdc_desktop_ceil_mount_1_add_8(TEST_GDC_CTX_S *ctx) {
613*4882a593Smuzhiyun     RK_S32 index = 0;
614*4882a593Smuzhiyun     RK_U32 fishOptParam_originX, fishOptParam_originY;
615*4882a593Smuzhiyun     fishOptParam_originX = 4132;
616*4882a593Smuzhiyun     fishOptParam_originY = 4169;
617*4882a593Smuzhiyun     RK_U32 outWidthBase = 640;
618*4882a593Smuzhiyun     RK_U32 outHeightBase = 360;
619*4882a593Smuzhiyun 
620*4882a593Smuzhiyun     if (ctx->u32SrcWidth == 1920 && ctx->u32SrcHeight == 1080) {
621*4882a593Smuzhiyun         outWidthBase = 640;
622*4882a593Smuzhiyun         outHeightBase = 360;
623*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 2560 && ctx->u32SrcHeight == 1440) {
624*4882a593Smuzhiyun         outWidthBase = 848;
625*4882a593Smuzhiyun         outHeightBase = 480;
626*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 3840 && ctx->u32SrcHeight == 2160) {
627*4882a593Smuzhiyun         outWidthBase = 1280;
628*4882a593Smuzhiyun         outHeightBase = 720;
629*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 7680 && ctx->u32SrcHeight == 4320) {
630*4882a593Smuzhiyun         outWidthBase = 2560;
631*4882a593Smuzhiyun         outHeightBase = 1440;
632*4882a593Smuzhiyun     }
633*4882a593Smuzhiyun 
634*4882a593Smuzhiyun     ctx->stFisheyeAttr.bEnable = RK_TRUE;
635*4882a593Smuzhiyun     ctx->stFisheyeAttr.bLMF = RK_FALSE;
636*4882a593Smuzhiyun     ctx->stFisheyeAttr.bBgColor = RK_TRUE;
637*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32BgColor = 0;
638*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32HorOffset = ((fishOptParam_originX >> 3) - 512);
639*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32VerOffset = ((fishOptParam_originY >> 3) - 512);
640*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32TrapezoidCoef = 0;
641*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32FanStrength = 0;
642*4882a593Smuzhiyun     // ctx->stFisheyeAttr.enMountMode = FISHEYE_WALL_MOUNT;
643*4882a593Smuzhiyun 
644*4882a593Smuzhiyun     // 0
645*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
646*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
647*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
648*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 0; /* RW; Range: [0, 360] */
649*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
650*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
651*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
652*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
653*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
654*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
655*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
656*4882a593Smuzhiyun     index++;
657*4882a593Smuzhiyun 
658*4882a593Smuzhiyun     // 1
659*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
660*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
661*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
662*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 45; /* RW; Range: [0, 360] */
663*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
664*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
665*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
666*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
667*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
668*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
669*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
670*4882a593Smuzhiyun     index++;
671*4882a593Smuzhiyun 
672*4882a593Smuzhiyun     // 2
673*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
674*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
675*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
676*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 90; /* RW; Range: [0, 360] */
677*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
678*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
679*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
680*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase * 2;
681*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
682*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
683*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
684*4882a593Smuzhiyun     index++;
685*4882a593Smuzhiyun 
686*4882a593Smuzhiyun     // 3
687*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
688*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
689*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
690*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 135; /* RW; Range: [0, 360] */
691*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
692*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
693*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
694*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
695*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
696*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
697*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
698*4882a593Smuzhiyun     index++;
699*4882a593Smuzhiyun 
700*4882a593Smuzhiyun     // 4
701*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
702*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
703*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
704*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
705*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
706*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
707*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
708*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase * 2;
709*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
710*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
711*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
712*4882a593Smuzhiyun     index++;
713*4882a593Smuzhiyun 
714*4882a593Smuzhiyun     // 5
715*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
716*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
717*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
718*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
719*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
720*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
721*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
722*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
723*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase * 2;
724*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
725*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
726*4882a593Smuzhiyun     index++;
727*4882a593Smuzhiyun 
728*4882a593Smuzhiyun     // 6
729*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
730*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
731*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
732*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 225; /* RW; Range: [0, 360] */
733*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
734*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
735*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
736*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
737*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase * 2;
738*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
739*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
740*4882a593Smuzhiyun     index++;
741*4882a593Smuzhiyun 
742*4882a593Smuzhiyun     // 7
743*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
744*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
745*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
746*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 270; /* RW; Range: [0, 360] */
747*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
748*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
749*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
750*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase * 2;
751*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase * 2;
752*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
753*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
754*4882a593Smuzhiyun     index++;
755*4882a593Smuzhiyun 
756*4882a593Smuzhiyun     // 8
757*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_NO_TRANSFORMATION;
758*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
759*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
760*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 315; /* RW; Range: [0, 360] */
761*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 98; /* RW; Range: [0, 360] */
762*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
763*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
764*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
765*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
766*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
767*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
768*4882a593Smuzhiyun     index++;
769*4882a593Smuzhiyun 
770*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32RegionNum = index;
771*4882a593Smuzhiyun }
772*4882a593Smuzhiyun 
test_mpi_gdc_desktop_ceil_mount_2p(TEST_GDC_CTX_S * ctx)773*4882a593Smuzhiyun RK_VOID test_mpi_gdc_desktop_ceil_mount_2p(TEST_GDC_CTX_S *ctx) {
774*4882a593Smuzhiyun     RK_S32 index = 0;
775*4882a593Smuzhiyun     RK_U32 fishOptParam_originX, fishOptParam_originY;
776*4882a593Smuzhiyun     fishOptParam_originX = 4132;
777*4882a593Smuzhiyun     fishOptParam_originY = 4169;
778*4882a593Smuzhiyun     RK_U32 outWidthBase = 1920;
779*4882a593Smuzhiyun     RK_U32 outHeightBase = 540;
780*4882a593Smuzhiyun 
781*4882a593Smuzhiyun     if (ctx->u32SrcWidth == 1920 && ctx->u32SrcHeight == 1080) {
782*4882a593Smuzhiyun         outWidthBase = 1920;
783*4882a593Smuzhiyun         outHeightBase = 540;
784*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 2560 && ctx->u32SrcHeight == 1440) {
785*4882a593Smuzhiyun         outWidthBase = 2560;
786*4882a593Smuzhiyun         outHeightBase = 720;
787*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 3840 && ctx->u32SrcHeight == 2160) {
788*4882a593Smuzhiyun         outWidthBase = 3840;
789*4882a593Smuzhiyun         outHeightBase = 1080;
790*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 7680 && ctx->u32SrcHeight == 4320) {
791*4882a593Smuzhiyun         outWidthBase = 7680;
792*4882a593Smuzhiyun         outHeightBase = 2160;
793*4882a593Smuzhiyun     }
794*4882a593Smuzhiyun 
795*4882a593Smuzhiyun     ctx->stFisheyeAttr.bEnable = RK_TRUE;
796*4882a593Smuzhiyun     ctx->stFisheyeAttr.bLMF = RK_FALSE;
797*4882a593Smuzhiyun     ctx->stFisheyeAttr.bBgColor = RK_TRUE;
798*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32BgColor = 0;
799*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32HorOffset = ((fishOptParam_originX >> 3) - 512);
800*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32VerOffset = ((fishOptParam_originY >> 3) - 512);
801*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32TrapezoidCoef = 0;
802*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32FanStrength = 0;
803*4882a593Smuzhiyun     // ctx->stFisheyeAttr.enMountMode = FISHEYE_WALL_MOUNT;
804*4882a593Smuzhiyun 
805*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_360_PANORAMA;
806*4882a593Smuzhiyun 
807*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
808*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
809*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 0; /* RW; Range: [0, 360] */
810*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
811*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 2047; /* RW; Range: [1, 4095] */
812*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
813*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
814*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
815*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
816*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
817*4882a593Smuzhiyun     index++;
818*4882a593Smuzhiyun 
819*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_360_PANORAMA;
820*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
821*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 474; /* RW; out radius of gdc correction region */
822*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
823*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
824*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 2047; /* RW; Range: [1, 4095] */
825*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
826*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
827*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
828*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
829*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
830*4882a593Smuzhiyun     index++;
831*4882a593Smuzhiyun 
832*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32RegionNum = index;
833*4882a593Smuzhiyun }
834*4882a593Smuzhiyun 
test_mpi_gdc_desktop_mount(TEST_GDC_CTX_S * ctx)835*4882a593Smuzhiyun RK_VOID test_mpi_gdc_desktop_mount(TEST_GDC_CTX_S *ctx) {
836*4882a593Smuzhiyun     switch (ctx->enDeskCeilMode) {
837*4882a593Smuzhiyun         case TEST_GDC_DESK_CEIL_MODE_1P_ADD_1:
838*4882a593Smuzhiyun             test_mpi_gdc_desktop_ceil_mount_1p_add_1(ctx);
839*4882a593Smuzhiyun         break;
840*4882a593Smuzhiyun         case TEST_GDC_DESK_CEIL_MODE_1_ADD_3:
841*4882a593Smuzhiyun             test_mpi_gdc_desktop_ceil_mount_1_add_3(ctx);
842*4882a593Smuzhiyun         break;
843*4882a593Smuzhiyun         case TEST_GDC_DESK_CEIL_MODE_1_ADD_8:
844*4882a593Smuzhiyun             test_mpi_gdc_desktop_ceil_mount_1_add_8(ctx);
845*4882a593Smuzhiyun         break;
846*4882a593Smuzhiyun          case TEST_GDC_DESK_CEIL_MODE_2P:
847*4882a593Smuzhiyun             test_mpi_gdc_desktop_ceil_mount_2p(ctx);
848*4882a593Smuzhiyun         break;
849*4882a593Smuzhiyun         default:
850*4882a593Smuzhiyun             RK_LOGE("not support this mode:%d", ctx->enDeskCeilMode);
851*4882a593Smuzhiyun         break;
852*4882a593Smuzhiyun     }
853*4882a593Smuzhiyun }
854*4882a593Smuzhiyun 
test_mpi_gdc_ceiling_mount(TEST_GDC_CTX_S * ctx)855*4882a593Smuzhiyun RK_VOID test_mpi_gdc_ceiling_mount(TEST_GDC_CTX_S *ctx) {
856*4882a593Smuzhiyun     test_mpi_gdc_desktop_mount(ctx);
857*4882a593Smuzhiyun }
858*4882a593Smuzhiyun 
test_mpi_gdc_wall_mount_1p_add_3(TEST_GDC_CTX_S * ctx)859*4882a593Smuzhiyun RK_VOID test_mpi_gdc_wall_mount_1p_add_3(TEST_GDC_CTX_S *ctx) {
860*4882a593Smuzhiyun     RK_S32 index = 0;
861*4882a593Smuzhiyun     RK_U32 fishOptParam_originX, fishOptParam_originY;
862*4882a593Smuzhiyun     fishOptParam_originX = 4364;
863*4882a593Smuzhiyun     fishOptParam_originY = 4136;
864*4882a593Smuzhiyun     RK_U32 outWidthBase = 640;
865*4882a593Smuzhiyun     RK_U32 outHeightBase = 360;
866*4882a593Smuzhiyun 
867*4882a593Smuzhiyun     if (ctx->u32SrcWidth == 1920 && ctx->u32SrcHeight == 1080) {
868*4882a593Smuzhiyun         outWidthBase = 960;
869*4882a593Smuzhiyun         outHeightBase = 540;
870*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 2560 && ctx->u32SrcHeight == 1440) {
871*4882a593Smuzhiyun         outWidthBase = 1280;
872*4882a593Smuzhiyun         outHeightBase = 720;
873*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 3840 && ctx->u32SrcHeight == 2160) {
874*4882a593Smuzhiyun         outWidthBase = 1920;
875*4882a593Smuzhiyun         outHeightBase = 1080;
876*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 7680 && ctx->u32SrcHeight == 4320) {
877*4882a593Smuzhiyun         outWidthBase = 3840;
878*4882a593Smuzhiyun         outHeightBase = 2160;
879*4882a593Smuzhiyun     }
880*4882a593Smuzhiyun 
881*4882a593Smuzhiyun     ctx->stFisheyeAttr.bEnable = RK_TRUE;
882*4882a593Smuzhiyun     ctx->stFisheyeAttr.bLMF = RK_FALSE;
883*4882a593Smuzhiyun     ctx->stFisheyeAttr.bBgColor = RK_TRUE;
884*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32BgColor = 0;
885*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32HorOffset = ((fishOptParam_originX >> 3) - 512);
886*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32VerOffset = ((fishOptParam_originY >> 3) - 512);
887*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32TrapezoidCoef = 0;
888*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32FanStrength = 0;
889*4882a593Smuzhiyun     // ctx->stFisheyeAttr.enMountMode = FISHEYE_WALL_MOUNT;
890*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_180_PANORAMA;
891*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
892*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
893*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
894*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
895*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
896*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
897*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
898*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
899*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
900*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
901*4882a593Smuzhiyun     index++;
902*4882a593Smuzhiyun 
903*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
904*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
905*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
906*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
907*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
908*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
909*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
910*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
911*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
912*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
913*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
914*4882a593Smuzhiyun     index++;
915*4882a593Smuzhiyun 
916*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
917*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
918*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
919*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
920*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 207; /* RW; Range: [0, 360] */
921*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
922*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
923*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
924*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
925*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
926*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
927*4882a593Smuzhiyun     index++;
928*4882a593Smuzhiyun 
929*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
930*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
931*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
932*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
933*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 153; /* RW; Range: [0, 360] */
934*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
935*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
936*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
937*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
938*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
939*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
940*4882a593Smuzhiyun     index++;
941*4882a593Smuzhiyun 
942*4882a593Smuzhiyun     // ctx->stFisheyeAttr.u32RegionNum = index;
943*4882a593Smuzhiyun }
944*4882a593Smuzhiyun 
test_mpi_gdc_wall_mount_1p_add_8(TEST_GDC_CTX_S * ctx)945*4882a593Smuzhiyun RK_VOID test_mpi_gdc_wall_mount_1p_add_8(TEST_GDC_CTX_S *ctx) {
946*4882a593Smuzhiyun     RK_S32 index = 0;
947*4882a593Smuzhiyun     RK_U32 fishOptParam_originX, fishOptParam_originY;
948*4882a593Smuzhiyun     fishOptParam_originX = 4364;
949*4882a593Smuzhiyun     fishOptParam_originY = 4136;
950*4882a593Smuzhiyun     RK_U32 outWidthBase = 640;
951*4882a593Smuzhiyun     RK_U32 outHeightBase = 360;
952*4882a593Smuzhiyun 
953*4882a593Smuzhiyun     if (ctx->u32SrcWidth == 1920 && ctx->u32SrcHeight == 1080) {
954*4882a593Smuzhiyun         outWidthBase = 640;
955*4882a593Smuzhiyun         outHeightBase = 360;
956*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 2560 && ctx->u32SrcHeight == 1440) {
957*4882a593Smuzhiyun         outWidthBase = 848;
958*4882a593Smuzhiyun         outHeightBase = 480;
959*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 3840 && ctx->u32SrcHeight == 2160) {
960*4882a593Smuzhiyun         outWidthBase = 1280;
961*4882a593Smuzhiyun         outHeightBase = 720;
962*4882a593Smuzhiyun     } else if (ctx->u32SrcWidth == 7680 && ctx->u32SrcHeight == 4320) {
963*4882a593Smuzhiyun         outWidthBase = 2560;
964*4882a593Smuzhiyun         outHeightBase = 1440;
965*4882a593Smuzhiyun     }
966*4882a593Smuzhiyun 
967*4882a593Smuzhiyun     ctx->stFisheyeAttr.bEnable = RK_TRUE;
968*4882a593Smuzhiyun     ctx->stFisheyeAttr.bLMF = RK_FALSE;
969*4882a593Smuzhiyun     ctx->stFisheyeAttr.bBgColor = RK_TRUE;
970*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32BgColor = 0;
971*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32HorOffset = ((fishOptParam_originX >> 3) - 512);
972*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32VerOffset = ((fishOptParam_originY >> 3) - 512);
973*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32TrapezoidCoef = 0;
974*4882a593Smuzhiyun     ctx->stFisheyeAttr.s32FanStrength = 0;
975*4882a593Smuzhiyun     // ctx->stFisheyeAttr.enMountMode = FISHEYE_WALL_MOUNT;
976*4882a593Smuzhiyun 
977*4882a593Smuzhiyun     // 0
978*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
979*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
980*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
981*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 153; /* RW; Range: [0, 360] */
982*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 153; /* RW; Range: [0, 360] */
983*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
984*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
985*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
986*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
987*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
988*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
989*4882a593Smuzhiyun     index++;
990*4882a593Smuzhiyun 
991*4882a593Smuzhiyun     // 1
992*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
993*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
994*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
995*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 153; /* RW; Range: [0, 360] */
996*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
997*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
998*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
999*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
1000*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
1001*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1002*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1003*4882a593Smuzhiyun     index++;
1004*4882a593Smuzhiyun 
1005*4882a593Smuzhiyun     // 2
1006*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
1007*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
1008*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
1009*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 153; /* RW; Range: [0, 360] */
1010*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 207; /* RW; Range: [0, 360] */
1011*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
1012*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
1013*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase * 2;
1014*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = 0;
1015*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1016*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1017*4882a593Smuzhiyun     index++;
1018*4882a593Smuzhiyun 
1019*4882a593Smuzhiyun     // 3
1020*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
1021*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
1022*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
1023*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
1024*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 207; /* RW; Range: [0, 360] */
1025*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
1026*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
1027*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
1028*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
1029*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1030*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1031*4882a593Smuzhiyun     index++;
1032*4882a593Smuzhiyun 
1033*4882a593Smuzhiyun     // 4 scale
1034*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_180_PANORAMA;
1035*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
1036*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
1037*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
1038*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
1039*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
1040*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
1041*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
1042*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
1043*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1044*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1045*4882a593Smuzhiyun     index++;
1046*4882a593Smuzhiyun 
1047*4882a593Smuzhiyun     // 5
1048*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
1049*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
1050*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
1051*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 180; /* RW; Range: [0, 360] */
1052*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 153; /* RW; Range: [0, 360] */
1053*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
1054*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
1055*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase * 2;
1056*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase;
1057*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1058*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1059*4882a593Smuzhiyun     index++;
1060*4882a593Smuzhiyun 
1061*4882a593Smuzhiyun     // 6
1062*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
1063*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
1064*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
1065*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 207; /* RW; Range: [0, 360] */
1066*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 153; /* RW; Range: [0, 360] */
1067*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
1068*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
1069*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = 0; /* RW; out Imge rectangle attribute */
1070*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase * 2;
1071*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1072*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1073*4882a593Smuzhiyun     index++;
1074*4882a593Smuzhiyun 
1075*4882a593Smuzhiyun     // 7
1076*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
1077*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
1078*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
1079*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 207; /* RW; Range: [0, 360] */
1080*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 180; /* RW; Range: [0, 360] */
1081*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
1082*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
1083*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase; /* RW; out Imge rectangle attribute */
1084*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase * 2;
1085*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1086*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1087*4882a593Smuzhiyun     index++;
1088*4882a593Smuzhiyun 
1089*4882a593Smuzhiyun     // 8
1090*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].enViewMode = FISHEYE_VIEW_NORMAL;
1091*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32InRadius = 0; /* RW; inner radius of gdc correction region */
1092*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32OutRadius = 442; /* RW; out radius of gdc correction region */
1093*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Pan = 207; /* RW; Range: [0, 360] */
1094*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32Tilt = 207; /* RW; Range: [0, 360] */
1095*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32HorZoom = 4095; /* RW; Range: [1, 4095] */
1096*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].u32VerZoom = 4095; /* RW; Range: [1, 4095] */
1097*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32X = outWidthBase * 2;
1098*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.s32Y = outHeightBase * 2;
1099*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Width = outWidthBase;
1100*4882a593Smuzhiyun     ctx->stFisheyeAttr.astFishEyeRegionAttr[index].stOutRect.u32Height = outHeightBase;
1101*4882a593Smuzhiyun     index++;
1102*4882a593Smuzhiyun 
1103*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32RegionNum = index;
1104*4882a593Smuzhiyun }
1105*4882a593Smuzhiyun 
test_mpi_gdc_wall_mount(TEST_GDC_CTX_S * ctx)1106*4882a593Smuzhiyun RK_VOID test_mpi_gdc_wall_mount(TEST_GDC_CTX_S *ctx) {
1107*4882a593Smuzhiyun     switch (ctx->enWallMode) {
1108*4882a593Smuzhiyun         case TEST_GDC_WALL_MODE_1P_ADD_3:
1109*4882a593Smuzhiyun             test_mpi_gdc_wall_mount_1p_add_3(ctx);
1110*4882a593Smuzhiyun         break;
1111*4882a593Smuzhiyun         case TEST_GDC_WALL_MODE_1P_ADD_8:
1112*4882a593Smuzhiyun             test_mpi_gdc_wall_mount_1p_add_8(ctx);
1113*4882a593Smuzhiyun         break;
1114*4882a593Smuzhiyun         default:
1115*4882a593Smuzhiyun             RK_LOGE("not support this mode:%d", ctx->enWallMode);
1116*4882a593Smuzhiyun         break;
1117*4882a593Smuzhiyun     }
1118*4882a593Smuzhiyun }
1119*4882a593Smuzhiyun 
test_mpi_gdc_xy_in_valid(RK_U32 xy,RK_U32 max,RK_S32 op)1120*4882a593Smuzhiyun static RK_BOOL test_mpi_gdc_xy_in_valid(RK_U32 xy, RK_U32 max, RK_S32 op) {
1121*4882a593Smuzhiyun      RK_S32 result = xy + op;
1122*4882a593Smuzhiyun      if (result < max && result >= 0)
1123*4882a593Smuzhiyun          return RK_TRUE;
1124*4882a593Smuzhiyun      else
1125*4882a593Smuzhiyun          return RK_FALSE;
1126*4882a593Smuzhiyun }
1127*4882a593Smuzhiyun 
1128*4882a593Smuzhiyun // tmp code
test_mpi_gdc_api(TEST_GDC_CTX_S * ctx)1129*4882a593Smuzhiyun RK_S32 test_mpi_gdc_api(TEST_GDC_CTX_S *ctx) {
1130*4882a593Smuzhiyun     RK_S32 s32Ret;
1131*4882a593Smuzhiyun     GDC_HANDLE hHandle = -1;
1132*4882a593Smuzhiyun     void *pSrcData = RK_NULL;
1133*4882a593Smuzhiyun     RK_S32 loopCount = 0;
1134*4882a593Smuzhiyun     FILE *pFile = NULL;
1135*4882a593Smuzhiyun     RK_U32 u32ReadSize = 0;
1136*4882a593Smuzhiyun     MB_POOL_CONFIG_S stMbPoolCfg;
1137*4882a593Smuzhiyun     VIDEO_FRAME_INFO_S stFrame;
1138*4882a593Smuzhiyun     VIDEO_FRAME_INFO_S stLineFrame;
1139*4882a593Smuzhiyun     VO_FRAME_INFO_S voLineFrame;
1140*4882a593Smuzhiyun     MB_BLK pLineMbBlk;
1141*4882a593Smuzhiyun 
1142*4882a593Smuzhiyun     memset(&stFrame, 0, sizeof(VIDEO_FRAME_INFO_S));
1143*4882a593Smuzhiyun     memset(&stMbPoolCfg, 0, sizeof(MB_POOL_CONFIG_S));
1144*4882a593Smuzhiyun 
1145*4882a593Smuzhiyun     ctx->u32SrcSize = unit_test_gdc_get_size(ctx);
1146*4882a593Smuzhiyun     stMbPoolCfg.u64MBSize = ctx->u32SrcSize;
1147*4882a593Smuzhiyun     stMbPoolCfg.u32MBCnt = 4;
1148*4882a593Smuzhiyun     stMbPoolCfg.enAllocType = MB_ALLOC_TYPE_DMA;
1149*4882a593Smuzhiyun     ctx->inPool = RK_MPI_MB_CreatePool(&stMbPoolCfg);
1150*4882a593Smuzhiyun 
1151*4882a593Smuzhiyun     pFile = fopen(ctx->srcFilePath, "rb+");
1152*4882a593Smuzhiyun     if (pFile == RK_NULL) {
1153*4882a593Smuzhiyun         RK_LOGE("open path %s failed because %s", ctx->srcFilePath, strerror(errno));
1154*4882a593Smuzhiyun         goto __FAILED;
1155*4882a593Smuzhiyun     }
1156*4882a593Smuzhiyun 
1157*4882a593Smuzhiyun     // vo init and create
1158*4882a593Smuzhiyun     ctx->s32VoLayer = RK35XX_VOP_LAYER_CLUSTER_0;
1159*4882a593Smuzhiyun     ctx->s32VoDev = RK35XX_VO_DEV_HD0;
1160*4882a593Smuzhiyun     ctx->s32VoChn = RK35XX_VO_GDC_CHN;
1161*4882a593Smuzhiyun     ctx->stLayerAttr.enPixFormat = RK_FMT_BGR888;
1162*4882a593Smuzhiyun     ctx->stLayerAttr.stDispRect.s32X = 0;
1163*4882a593Smuzhiyun     ctx->stLayerAttr.stDispRect.s32Y = 0;
1164*4882a593Smuzhiyun     ctx->stLayerAttr.u32DispFrmRt = 30;
1165*4882a593Smuzhiyun     ctx->stLayerAttr.stDispRect.u32Width = ctx->u32VoWidth;
1166*4882a593Smuzhiyun     ctx->stLayerAttr.stDispRect.u32Height = ctx->u32VoHeight;
1167*4882a593Smuzhiyun     ctx->stLayerAttr.stImageSize.u32Width = ctx->u32VoWidth;
1168*4882a593Smuzhiyun     ctx->stLayerAttr.stImageSize.u32Height = ctx->u32VoHeight;
1169*4882a593Smuzhiyun 
1170*4882a593Smuzhiyun     ctx->stChnAttr.stRect.s32X = ctx->stChnRect.s32X;
1171*4882a593Smuzhiyun     ctx->stChnAttr.stRect.s32Y = ctx->stChnRect.s32Y;
1172*4882a593Smuzhiyun     ctx->stChnAttr.stRect.u32Width = ctx->stChnRect.u32Width;
1173*4882a593Smuzhiyun     ctx->stChnAttr.stRect.u32Height = ctx->stChnRect.u32Height;
1174*4882a593Smuzhiyun     ctx->stChnAttr.u32Priority = 0;
1175*4882a593Smuzhiyun     ctx->stChnAttr.u32FgAlpha = 128;
1176*4882a593Smuzhiyun     ctx->stChnAttr.u32BgAlpha = 0;
1177*4882a593Smuzhiyun     // ctx->stChnAttr.bGdc = RK_TRUE;  // reserve
1178*4882a593Smuzhiyun 
1179*4882a593Smuzhiyun     s32Ret = create_vo(ctx, ctx->s32VoChn);
1180*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
1181*4882a593Smuzhiyun         RK_LOGE("create vo dev:%d failed:0x%x", ctx->s32VoDev, s32Ret);
1182*4882a593Smuzhiyun         goto __FAILED;
1183*4882a593Smuzhiyun     }
1184*4882a593Smuzhiyun     // enable vo
1185*4882a593Smuzhiyun     s32Ret = RK_MPI_VO_EnableChn(ctx->s32VoLayer, ctx->s32VoChn);
1186*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
1187*4882a593Smuzhiyun         RK_LOGE("Enalbe vo chn failed, s32Ret = %d", s32Ret);
1188*4882a593Smuzhiyun         goto __FAILED;
1189*4882a593Smuzhiyun     }
1190*4882a593Smuzhiyun     // test vo chn127 for show line
1191*4882a593Smuzhiyun     if (ctx->u32ShowPoint) {
1192*4882a593Smuzhiyun         /*ctx->u32LineWidth = 640;
1193*4882a593Smuzhiyun         ctx->u32LineHeight = 480;*/
1194*4882a593Smuzhiyun         RK_MPI_VO_CreateGraphicsFrameBuffer(ctx->u32LineWidth, ctx->u32LineHeight, RK_FMT_BGRA5551, &pLineMbBlk);
1195*4882a593Smuzhiyun         stLineFrame.stVFrame.u32Width = ctx->u32LineWidth;
1196*4882a593Smuzhiyun         stLineFrame.stVFrame.u32Height = ctx->u32LineHeight;
1197*4882a593Smuzhiyun         stLineFrame.stVFrame.u32VirWidth = ctx->u32LineWidth;
1198*4882a593Smuzhiyun         stLineFrame.stVFrame.u32VirHeight = ctx->u32LineHeight;
1199*4882a593Smuzhiyun         stLineFrame.stVFrame.enPixelFormat = RK_FMT_BGRA5551;
1200*4882a593Smuzhiyun         stLineFrame.stVFrame.enCompressMode = COMPRESS_MODE_NONE;
1201*4882a593Smuzhiyun         stLineFrame.stVFrame.pMbBlk = pLineMbBlk;
1202*4882a593Smuzhiyun 
1203*4882a593Smuzhiyun         ctx->stChnAttr.stRect.s32X = 0;
1204*4882a593Smuzhiyun         ctx->stChnAttr.stRect.s32Y = 0;
1205*4882a593Smuzhiyun         ctx->stChnAttr.stRect.u32Width = 960;
1206*4882a593Smuzhiyun         ctx->stChnAttr.stRect.u32Height = 540;
1207*4882a593Smuzhiyun         ctx->stChnAttr.u32Priority = RK35XX_VO_LINE_CHN;
1208*4882a593Smuzhiyun         ctx->stChnAttr.u32FgAlpha = 255;
1209*4882a593Smuzhiyun         ctx->stChnAttr.u32BgAlpha = 0;
1210*4882a593Smuzhiyun         // ctx->stChnAttr.bGdc = RK_FALSE;  // reserve
1211*4882a593Smuzhiyun         s32Ret = RK_MPI_VO_SetChnAttr(ctx->s32VoLayer, RK35XX_VO_LINE_CHN, &ctx->stChnAttr);
1212*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1213*4882a593Smuzhiyun             RK_LOGE("set chn Attr failed,s32Ret:%d\n", s32Ret);
1214*4882a593Smuzhiyun             return RK_FAILURE;
1215*4882a593Smuzhiyun         }
1216*4882a593Smuzhiyun         s32Ret = RK_MPI_VO_EnableChn(ctx->s32VoLayer, RK35XX_VO_LINE_CHN);
1217*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1218*4882a593Smuzhiyun             RK_LOGE("Enalbe vo chn failed, s32Ret = %d", s32Ret);
1219*4882a593Smuzhiyun             goto __FAILED;
1220*4882a593Smuzhiyun         }
1221*4882a593Smuzhiyun     }
1222*4882a593Smuzhiyun 
1223*4882a593Smuzhiyun     // gdc test config
1224*4882a593Smuzhiyun     if (ctx->stFisheyeAttr.enMountMode == FISHEYE_DESKTOP_MOUNT) {
1225*4882a593Smuzhiyun         test_mpi_gdc_desktop_mount(ctx);
1226*4882a593Smuzhiyun     } else if (ctx->stFisheyeAttr.enMountMode == FISHEYE_CEILING_MOUNT) {
1227*4882a593Smuzhiyun         test_mpi_gdc_ceiling_mount(ctx);
1228*4882a593Smuzhiyun     } else if (ctx->stFisheyeAttr.enMountMode == FISHEYE_WALL_MOUNT) {
1229*4882a593Smuzhiyun         test_mpi_gdc_wall_mount(ctx);
1230*4882a593Smuzhiyun     } else {
1231*4882a593Smuzhiyun         RK_LOGE("not support this mount = %d", ctx->stFisheyeAttr.enMountMode);
1232*4882a593Smuzhiyun         goto __FAILED;
1233*4882a593Smuzhiyun     }
1234*4882a593Smuzhiyun 
1235*4882a593Smuzhiyun     while (1) {
1236*4882a593Smuzhiyun         // img in
1237*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.pMbBlk = RK_MPI_MB_GetMB(ctx->inPool, ctx->u32SrcSize, RK_TRUE);
1238*4882a593Smuzhiyun         if (RK_NULL == ctx->stTask.stImgIn.stVFrame.pMbBlk) {
1239*4882a593Smuzhiyun             usleep(10000llu);
1240*4882a593Smuzhiyun             continue;
1241*4882a593Smuzhiyun         }
1242*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.u32Width = ctx->u32SrcWidth;
1243*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.u32Height = ctx->u32SrcHeight;
1244*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.u32VirWidth = ctx->u32SrcVirWidth;
1245*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.u32VirHeight = ctx->u32SrcVirHeight;
1246*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.enPixelFormat = (PIXEL_FORMAT_E)ctx->s32SrcPixFormat;
1247*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.u32FrameFlag = 0;
1248*4882a593Smuzhiyun         ctx->stTask.stImgIn.stVFrame.enCompressMode = (COMPRESS_MODE_E)ctx->s32SrcCompressMode;
1249*4882a593Smuzhiyun         // img out
1250*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.u32Width = ctx->u32DstWidth;
1251*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.u32Height = ctx->u32DstHeight;
1252*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.u32VirWidth = ctx->u32DstWidth;
1253*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.u32VirHeight = ctx->u32DstHeight;
1254*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.enPixelFormat = (PIXEL_FORMAT_E)ctx->s32SrcPixFormat;
1255*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.u32FrameFlag = 0;
1256*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.enCompressMode = (COMPRESS_MODE_E)ctx->s32SrcCompressMode;
1257*4882a593Smuzhiyun         ctx->stTask.stImgOut.stVFrame.pMbBlk = ctx->stTask.stImgIn.stVFrame.pMbBlk;
1258*4882a593Smuzhiyun         // usleep(100*1000);
1259*4882a593Smuzhiyun 
1260*4882a593Smuzhiyun         // test_mpi_gdc_get_src_point(ctx);
1261*4882a593Smuzhiyun         // test_mpi_gdc_get_pano_point(ctx);
1262*4882a593Smuzhiyun 
1263*4882a593Smuzhiyun         // read image
1264*4882a593Smuzhiyun         pSrcData = RK_MPI_MB_Handle2VirAddr(ctx->stTask.stImgIn.stVFrame.pMbBlk);
1265*4882a593Smuzhiyun         if (ctx->s32SrcCompressMode == COMPRESS_AFBC_16x16) {
1266*4882a593Smuzhiyun             if (fread(pSrcData, 1, ctx->u32SrcSize, pFile) != ctx->u32SrcSize)
1267*4882a593Smuzhiyun                 s32Ret = RK_FAILURE;
1268*4882a593Smuzhiyun             else
1269*4882a593Smuzhiyun                 s32Ret = RK_SUCCESS;
1270*4882a593Smuzhiyun         } else {
1271*4882a593Smuzhiyun             s32Ret = read_image(reinterpret_cast<RK_U8 *>(pSrcData), ctx->u32SrcWidth, ctx->u32SrcHeight,
1272*4882a593Smuzhiyun                                 ctx->u32SrcVirWidth, ctx->u32SrcVirHeight, ctx->s32SrcPixFormat, pFile);
1273*4882a593Smuzhiyun         }
1274*4882a593Smuzhiyun 
1275*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1276*4882a593Smuzhiyun             if (loopCount < ctx->s32LoopCount) {
1277*4882a593Smuzhiyun                 fseek(pFile, 0L, SEEK_SET);
1278*4882a593Smuzhiyun                 // RK_LOGI("seek:%d", loopCount);
1279*4882a593Smuzhiyun                 RK_MPI_MB_ReleaseMB(ctx->stTask.stImgIn.stVFrame.pMbBlk);
1280*4882a593Smuzhiyun                 continue;
1281*4882a593Smuzhiyun             } else {
1282*4882a593Smuzhiyun                 RK_LOGD("loop:%d end!", loopCount);
1283*4882a593Smuzhiyun                 break;
1284*4882a593Smuzhiyun             }
1285*4882a593Smuzhiyun         }
1286*4882a593Smuzhiyun         RK_MPI_SYS_MmzFlushCache(ctx->stTask.stImgIn.stVFrame.pMbBlk, RK_FALSE);
1287*4882a593Smuzhiyun         RK_LOGD("gdc loop:%d!", loopCount);
1288*4882a593Smuzhiyun #if 1
1289*4882a593Smuzhiyun         // test gdc
1290*4882a593Smuzhiyun         s32Ret = RK_MPI_GDC_BeginJob(&hHandle);
1291*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1292*4882a593Smuzhiyun             RK_LOGE("RK_MPI_GDC_BeginJob err:0x%x!", s32Ret);
1293*4882a593Smuzhiyun             goto __FAILED;
1294*4882a593Smuzhiyun         }
1295*4882a593Smuzhiyun         s32Ret = RK_MPI_GDC_SetConfig(hHandle, &ctx->stFisheyeJobConfig);
1296*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1297*4882a593Smuzhiyun             RK_MPI_GDC_CancelJob(hHandle);
1298*4882a593Smuzhiyun             RK_LOGE("RK_MPI_GDC_SetConfig err:0x%x!", s32Ret);
1299*4882a593Smuzhiyun             goto __FAILED;
1300*4882a593Smuzhiyun         }
1301*4882a593Smuzhiyun         for (RK_S32 multi = 0; multi < ctx->s32TaskSum; multi++) {
1302*4882a593Smuzhiyun             s32Ret = RK_MPI_GDC_AddCorrectionTask(hHandle, &ctx->stTask, &ctx->stFisheyeAttr);
1303*4882a593Smuzhiyun             if (s32Ret != RK_SUCCESS) {
1304*4882a593Smuzhiyun                 RK_MPI_GDC_CancelJob(hHandle);
1305*4882a593Smuzhiyun                 RK_LOGE("RK_MPI_GDC_AddCorrectionTask err:0x%x!", s32Ret);
1306*4882a593Smuzhiyun                 goto __FAILED;
1307*4882a593Smuzhiyun             }
1308*4882a593Smuzhiyun             // ctx->stTask.u64TaskId = 0;
1309*4882a593Smuzhiyun         }
1310*4882a593Smuzhiyun #if 0  // test multi diff task
1311*4882a593Smuzhiyun         ctx->stTask.u64TaskId = ctx->stTask.u64TaskId + 10;
1312*4882a593Smuzhiyun         s32Ret = RK_MPI_GDC_AddCorrectionTask(hHandle, &ctx->stTask, &ctx->stFisheyeAttr);
1313*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1314*4882a593Smuzhiyun             RK_MPI_GDC_CancelJob(hHandle);
1315*4882a593Smuzhiyun             RK_LOGE("RK_MPI_GDC_AddCorrectionTask err:0x%x!", s32Ret);
1316*4882a593Smuzhiyun             goto __FAILED;
1317*4882a593Smuzhiyun         }
1318*4882a593Smuzhiyun #endif
1319*4882a593Smuzhiyun         if (ctx->u32ChangeParam) {
1320*4882a593Smuzhiyun             test_mpi_gdc_change_parameter(ctx, 1, TEST_GDC_CHANGE_TYPE_PAN);
1321*4882a593Smuzhiyun             test_mpi_gdc_change_parameter(ctx, 2, TEST_GDC_CHANGE_TYPE_TILT);
1322*4882a593Smuzhiyun             test_mpi_gdc_change_parameter(ctx, 3, TEST_GDC_CHANGE_TYPE_HOR_ZOOM);
1323*4882a593Smuzhiyun             test_mpi_gdc_change_parameter(ctx, 3, TEST_GDC_CHANGE_TYPE_VER_ZOOM);
1324*4882a593Smuzhiyun         }
1325*4882a593Smuzhiyun 
1326*4882a593Smuzhiyun         s32Ret = RK_MPI_GDC_EndJob(hHandle);
1327*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1328*4882a593Smuzhiyun             RK_MPI_GDC_CancelJob(hHandle);
1329*4882a593Smuzhiyun             RK_LOGE("RK_MPI_GDC_EndJob err:0x%x!", s32Ret);
1330*4882a593Smuzhiyun             goto __FAILED;
1331*4882a593Smuzhiyun         }
1332*4882a593Smuzhiyun #endif
1333*4882a593Smuzhiyun         // gdc out show to vo
1334*4882a593Smuzhiyun         stFrame.stVFrame = ctx->stTask.stImgOut.stVFrame;
1335*4882a593Smuzhiyun 
1336*4882a593Smuzhiyun         s32Ret = RK_MPI_VO_SendFrame(ctx->s32VoLayer, ctx->s32VoChn, &stFrame, -1);
1337*4882a593Smuzhiyun         if (s32Ret != RK_SUCCESS) {
1338*4882a593Smuzhiyun             RK_LOGE("RK_MPI_VO_SendFrame failed ret:0x%x", s32Ret);
1339*4882a593Smuzhiyun             RK_MPI_VO_DestroyGraphicsFrameBuffer(ctx->stTask.stImgIn.stVFrame.pMbBlk);
1340*4882a593Smuzhiyun         }
1341*4882a593Smuzhiyun         // test chn 127 show point chain
1342*4882a593Smuzhiyun         if (ctx->u32ShowPoint && (loopCount == 0 || ctx->u32ChangeParam)) {
1343*4882a593Smuzhiyun             if (ctx->u32ChangeParam) {
1344*4882a593Smuzhiyun                 memset(RK_MPI_MB_Handle2VirAddr(pLineMbBlk), 0x0, ctx->u32LineWidth * ctx->u32LineHeight * 2);
1345*4882a593Smuzhiyun                 RK_MPI_SYS_MmzFlushCache(pLineMbBlk, RK_FALSE);
1346*4882a593Smuzhiyun             }
1347*4882a593Smuzhiyun             RK_U16 *pLineData = (RK_U16 *)RK_MPI_MB_Handle2VirAddr(pLineMbBlk);
1348*4882a593Smuzhiyun             if (ctx->u32ShowPoint == 1) {
1349*4882a593Smuzhiyun                 RK_U32 x, y;
1350*4882a593Smuzhiyun                 for (RK_U32 region = 1; region < ctx->stFisheyeAttr.u32RegionNum; region++) {
1351*4882a593Smuzhiyun                     if (ctx->stFisheyeAttr.enMountMode == FISHEYE_WALL_MOUNT) {  // pano
1352*4882a593Smuzhiyun                         test_mpi_gdc_get_pano_point_array(ctx, region, 0);
1353*4882a593Smuzhiyun                         for (RK_U32 l = 0; l < ctx->u32PointLen; l++) {
1354*4882a593Smuzhiyun                             x = ctx->pastSrcPoint[l].s32X *
1355*4882a593Smuzhiyun                                 (ctx->u32LineWidth / ctx->stFisheyeAttr.astFishEyeRegionAttr[0].stOutRect.u32Width);
1356*4882a593Smuzhiyun                             y = ctx->pastSrcPoint[l].s32Y *
1357*4882a593Smuzhiyun                                 (ctx->u32LineHeight / ctx->stFisheyeAttr.astFishEyeRegionAttr[0].stOutRect.u32Height);
1358*4882a593Smuzhiyun                             if (test_mpi_gdc_xy_in_valid(y * ctx->u32LineWidth + x,
1359*4882a593Smuzhiyun                                                          ctx->u32LineWidth * ctx->u32LineHeight, 0))
1360*4882a593Smuzhiyun                                 pLineData[y * ctx->u32LineWidth + x] = gau16PointColor[region - 1];
1361*4882a593Smuzhiyun                         }
1362*4882a593Smuzhiyun                     } else {  // src
1363*4882a593Smuzhiyun                         test_mpi_gdc_get_src_point_array(ctx, region);
1364*4882a593Smuzhiyun                         for (RK_U32 l = 0; l < ctx->u32PointLen; l++) {
1365*4882a593Smuzhiyun                             x = ctx->pastSrcPoint[l].s32X / (ctx->u32SrcWidth / ctx->u32LineWidth);
1366*4882a593Smuzhiyun                             y = ctx->pastSrcPoint[l].s32Y / (ctx->u32SrcHeight / ctx->u32LineHeight);
1367*4882a593Smuzhiyun                             if (test_mpi_gdc_xy_in_valid(y * ctx->u32LineWidth + x,
1368*4882a593Smuzhiyun                                                          ctx->u32LineWidth * ctx->u32LineHeight, 0))
1369*4882a593Smuzhiyun                                 pLineData[y * ctx->u32LineWidth + x] = gau16PointColor[region - 1];
1370*4882a593Smuzhiyun                         }
1371*4882a593Smuzhiyun                     }
1372*4882a593Smuzhiyun                 }
1373*4882a593Smuzhiyun             }
1374*4882a593Smuzhiyun             RK_MPI_SYS_MmzFlushCache(pLineMbBlk, RK_FALSE);
1375*4882a593Smuzhiyun             s32Ret = RK_MPI_VO_SendFrame(ctx->s32VoLayer, RK35XX_VO_LINE_CHN, &stLineFrame, -1);
1376*4882a593Smuzhiyun             if (s32Ret != RK_SUCCESS) {
1377*4882a593Smuzhiyun                 RK_LOGE("RK_MPI_VO_SendFrame failed ret:0x%x", s32Ret);
1378*4882a593Smuzhiyun                 RK_MPI_VO_DestroyGraphicsFrameBuffer(pLineMbBlk);
1379*4882a593Smuzhiyun             }
1380*4882a593Smuzhiyun         }
1381*4882a593Smuzhiyun         RK_MPI_MB_ReleaseMB(ctx->stTask.stImgIn.stVFrame.pMbBlk);
1382*4882a593Smuzhiyun 
1383*4882a593Smuzhiyun         loopCount++;
1384*4882a593Smuzhiyun         if (loopCount >= ctx->s32LoopCount) {
1385*4882a593Smuzhiyun             RK_LOGD("gdc loop:%d end!", loopCount);
1386*4882a593Smuzhiyun             break;
1387*4882a593Smuzhiyun         }
1388*4882a593Smuzhiyun         usleep(1*1000);
1389*4882a593Smuzhiyun     }
1390*4882a593Smuzhiyun 
1391*4882a593Smuzhiyun __FAILED:
1392*4882a593Smuzhiyun     // disable vo
1393*4882a593Smuzhiyun     RK_MPI_VO_ClearChnBuffer(ctx->s32VoLayer, ctx->s32VoChn, RK_TRUE);
1394*4882a593Smuzhiyun     RK_MPI_VO_DisableChn(ctx->s32VoLayer, ctx->s32VoChn);
1395*4882a593Smuzhiyun     if (ctx->u32ShowPoint) {
1396*4882a593Smuzhiyun         RK_MPI_VO_ReleaseGfxFrameBuffer(ctx->s32VoLayer, RK35XX_VO_LINE_CHN);
1397*4882a593Smuzhiyun         RK_MPI_VO_ClearChnBuffer(ctx->s32VoLayer, RK35XX_VO_LINE_CHN, RK_TRUE);
1398*4882a593Smuzhiyun         RK_MPI_VO_DisableChn(ctx->s32VoLayer, RK35XX_VO_LINE_CHN);
1399*4882a593Smuzhiyun     }
1400*4882a593Smuzhiyun     RK_MPI_VO_DisableLayer(ctx->s32VoLayer);
1401*4882a593Smuzhiyun     RK_MPI_VO_DisableLayer(RK35XX_VOP_LAYER_ESMART_0);
1402*4882a593Smuzhiyun     RK_MPI_VO_DisableLayer(RK35XX_VOP_LAYER_ESMART_1);
1403*4882a593Smuzhiyun     RK_MPI_VO_DisableLayer(RK35XX_VOP_LAYER_SMART_0);
1404*4882a593Smuzhiyun     RK_MPI_VO_DisableLayer(RK35XX_VOP_LAYER_SMART_1);
1405*4882a593Smuzhiyun     RK_MPI_VO_Disable(ctx->s32VoDev);
1406*4882a593Smuzhiyun 
1407*4882a593Smuzhiyun     RK_LOGE("exit err:0x%x!", s32Ret);
1408*4882a593Smuzhiyun     RK_MPI_GDC_StopJob(hHandle);
1409*4882a593Smuzhiyun     RK_MPI_MB_DestroyPool(ctx->inPool);
1410*4882a593Smuzhiyun 
1411*4882a593Smuzhiyun     if (pFile) {
1412*4882a593Smuzhiyun         fclose(pFile);
1413*4882a593Smuzhiyun     }
1414*4882a593Smuzhiyun 
1415*4882a593Smuzhiyun     return s32Ret;
1416*4882a593Smuzhiyun }
1417*4882a593Smuzhiyun 
1418*4882a593Smuzhiyun static const char *const usages[] = {
1419*4882a593Smuzhiyun     "./rk_mpi_gdc_test -i /data/fisheye_in_s1920_h1080_w1920_14.yuv -w 1920 -h 1080  -f 6 -l 1000"
1420*4882a593Smuzhiyun     " --region_num 4 --show_point 1 --point_len 6000 --change_param 0",
1421*4882a593Smuzhiyun     NULL,
1422*4882a593Smuzhiyun };
1423*4882a593Smuzhiyun 
mpi_gdc_test_show_options(const TEST_GDC_CTX_S * ctx)1424*4882a593Smuzhiyun static void mpi_gdc_test_show_options(const TEST_GDC_CTX_S *ctx) {
1425*4882a593Smuzhiyun     RK_PRINT("cmd parse result:\n");
1426*4882a593Smuzhiyun     RK_PRINT("input  file name       : %s\n", ctx->srcFilePath);
1427*4882a593Smuzhiyun     RK_PRINT("src width              : %d\n", ctx->u32SrcWidth);
1428*4882a593Smuzhiyun     RK_PRINT("src height             : %d\n", ctx->u32SrcHeight);
1429*4882a593Smuzhiyun     RK_PRINT("dst width              : %d\n", ctx->u32DstWidth);
1430*4882a593Smuzhiyun     RK_PRINT("dst height             : %d\n", ctx->u32DstHeight);
1431*4882a593Smuzhiyun     RK_PRINT("line width             : %d\n", ctx->u32LineWidth);
1432*4882a593Smuzhiyun     RK_PRINT("line height            : %d\n", ctx->u32LineHeight);
1433*4882a593Smuzhiyun     RK_PRINT("loop count             : %d\n", ctx->s32LoopCount);
1434*4882a593Smuzhiyun     RK_PRINT("src pixel format       : %d\n", ctx->s32SrcPixFormat);
1435*4882a593Smuzhiyun     RK_PRINT("compress mode          : %d\n", ctx->s32SrcCompressMode);
1436*4882a593Smuzhiyun     RK_PRINT("task_id                : %d\n", ctx->stTask.u64TaskId);
1437*4882a593Smuzhiyun     RK_PRINT("task_sum               : %d\n", ctx->s32TaskSum);
1438*4882a593Smuzhiyun     RK_PRINT("stepx                  : %d\n", ctx->stTask.au64privateData[0]);
1439*4882a593Smuzhiyun     RK_PRINT("stepy                  : %d\n", ctx->stTask.au64privateData[1]);
1440*4882a593Smuzhiyun     RK_PRINT("regionNum              : %d\n", ctx->stFisheyeAttr.u32RegionNum);
1441*4882a593Smuzhiyun     RK_PRINT("mount mode             : %d\n", ctx->stFisheyeAttr.enMountMode);
1442*4882a593Smuzhiyun     RK_PRINT("desk/ceil mode         : %d\n", ctx->enDeskCeilMode);
1443*4882a593Smuzhiyun     RK_PRINT("wall mode              : %d\n", ctx->enWallMode);
1444*4882a593Smuzhiyun     RK_PRINT("show_point             : %d\n", ctx->u32ShowPoint);
1445*4882a593Smuzhiyun     RK_PRINT("point_len              : %d\n", ctx->u32PointLen);
1446*4882a593Smuzhiyun     RK_PRINT("change param           : %d\n", ctx->u32ChangeParam);
1447*4882a593Smuzhiyun     RK_PRINT("vo out resolution      : %d\n", ctx->stVoOutputResolution);
1448*4882a593Smuzhiyun     RK_PRINT("vo chn rect x          : %d\n", ctx->stChnRect.s32X);
1449*4882a593Smuzhiyun     RK_PRINT("vo chn rect y          : %d\n", ctx->stChnRect.s32Y);
1450*4882a593Smuzhiyun     RK_PRINT("vo chn rect w          : %d\n", ctx->stChnRect.u32Width);
1451*4882a593Smuzhiyun     RK_PRINT("vo chn rect h          : %d\n", ctx->stChnRect.u32Height);
1452*4882a593Smuzhiyun 
1453*4882a593Smuzhiyun     return;
1454*4882a593Smuzhiyun }
1455*4882a593Smuzhiyun 
main(int argc,const char ** argv)1456*4882a593Smuzhiyun int main(int argc, const char **argv) {
1457*4882a593Smuzhiyun     RK_S32 s32Ret = RK_SUCCESS;
1458*4882a593Smuzhiyun     TEST_GDC_CTX_S *ctx;
1459*4882a593Smuzhiyun     ctx = (TEST_GDC_CTX_S *)calloc(1, sizeof(TEST_GDC_CTX_S));
1460*4882a593Smuzhiyun     if (!ctx) {
1461*4882a593Smuzhiyun         RK_LOGE("calloc gdc ctx fail!");
1462*4882a593Smuzhiyun         return 0;
1463*4882a593Smuzhiyun     }
1464*4882a593Smuzhiyun 
1465*4882a593Smuzhiyun     //  set default params.
1466*4882a593Smuzhiyun     ctx->s32LoopCount = 1;
1467*4882a593Smuzhiyun     ctx->stFisheyeAttr.u32RegionNum = 4;
1468*4882a593Smuzhiyun     ctx->s32TaskSum = 1;
1469*4882a593Smuzhiyun     ctx->u32ChangeParam = 0;
1470*4882a593Smuzhiyun     ctx->u32PointLen = 3000;
1471*4882a593Smuzhiyun     ctx->stFisheyeAttr.enMountMode = FISHEYE_WALL_MOUNT;
1472*4882a593Smuzhiyun     ctx->enWallMode = TEST_GDC_WALL_MODE_1P_ADD_3;
1473*4882a593Smuzhiyun     ctx->enDeskCeilMode = TEST_GDC_DESK_CEIL_MODE_1_ADD_3;
1474*4882a593Smuzhiyun     ctx->stVoOutputResolution = VO_OUTPUT_1080P30;
1475*4882a593Smuzhiyun     ctx->u32VoWidth = 1920;
1476*4882a593Smuzhiyun     ctx->u32VoHeight = 1080;
1477*4882a593Smuzhiyun     ctx->stChnRect.s32X = 0;
1478*4882a593Smuzhiyun     ctx->stChnRect.s32Y = 0;
1479*4882a593Smuzhiyun     ctx->stChnRect.u32Width = 1920;
1480*4882a593Smuzhiyun     ctx->stChnRect.u32Height = 1080;
1481*4882a593Smuzhiyun 
1482*4882a593Smuzhiyun     struct argparse_option options[] = {
1483*4882a593Smuzhiyun         OPT_HELP(),
1484*4882a593Smuzhiyun         OPT_GROUP("basic options:"),
1485*4882a593Smuzhiyun         OPT_STRING('i', "input",  &(ctx->srcFilePath),
1486*4882a593Smuzhiyun                    "input file name. <required>", NULL, 0, 0),
1487*4882a593Smuzhiyun         OPT_INTEGER('w', "src_width", &(ctx->u32SrcWidth),
1488*4882a593Smuzhiyun                     "input source width. <required>", NULL, 0, 0),
1489*4882a593Smuzhiyun         OPT_INTEGER('h', "src_height", &(ctx->u32SrcHeight),
1490*4882a593Smuzhiyun                     "input source height. <required>", NULL, 0, 0),
1491*4882a593Smuzhiyun         OPT_INTEGER('W', "dst_width", &(ctx->u32DstWidth),
1492*4882a593Smuzhiyun                     "output img width.default(src_width)", NULL, 0, 0),
1493*4882a593Smuzhiyun         OPT_INTEGER('H', "dst_height", &(ctx->u32DstHeight),
1494*4882a593Smuzhiyun                     "output img height.default(src_height).", NULL, 0, 0),
1495*4882a593Smuzhiyun         OPT_INTEGER('\0', "line_width", &(ctx->u32LineWidth),
1496*4882a593Smuzhiyun                     "line img width.(default src_width;range(0, src_width))", NULL, 0, 0),
1497*4882a593Smuzhiyun         OPT_INTEGER('\0', "line_height", &(ctx->u32LineHeight),
1498*4882a593Smuzhiyun                     "line img height.(default src_height;range(0, src_height)).", NULL, 0, 0),
1499*4882a593Smuzhiyun         OPT_INTEGER('f', "pixel_format", &(ctx->s32SrcPixFormat),
1500*4882a593Smuzhiyun                     "input source pixel format. default 0; (0:NV12 6:NV21).", NULL, 0, 0),
1501*4882a593Smuzhiyun         OPT_INTEGER('l', "loop_count", &(ctx->s32LoopCount),
1502*4882a593Smuzhiyun                     "loop running count. default(1)", NULL, 0, 0),
1503*4882a593Smuzhiyun         OPT_INTEGER('\0', "src_compress_mode", &(ctx->s32SrcCompressMode),
1504*4882a593Smuzhiyun                     "set input compressmode(default 0; 0:MODE_NONE 1:AFBC_16x16)", NULL, 0, 0),
1505*4882a593Smuzhiyun         OPT_INTEGER('\0', "task_id", &(ctx->stTask.u64TaskId),
1506*4882a593Smuzhiyun                     "set task id(default 0; 0:auto alloc task id >0:specify the task id)", NULL, 0, 0),
1507*4882a593Smuzhiyun         OPT_INTEGER('\0', "stepx", &(ctx->stTask.au64privateData[0]),
1508*4882a593Smuzhiyun                      "set step x(default 0)", NULL, 0, 0),
1509*4882a593Smuzhiyun         OPT_INTEGER('\0', "stepy", &(ctx->stTask.au64privateData[1]),
1510*4882a593Smuzhiyun                      "set step y(default 0)", NULL, 0, 0),
1511*4882a593Smuzhiyun         OPT_INTEGER('\0', "region_num", &(ctx->stFisheyeAttr.u32RegionNum),
1512*4882a593Smuzhiyun                      "set region num(default 4(1+3))", NULL, 0, 0),
1513*4882a593Smuzhiyun         OPT_INTEGER('\0', "mount_type", &(ctx->stFisheyeAttr.enMountMode),
1514*4882a593Smuzhiyun                      "set mount type(default 2;(0:desktop mount 1:ceiling mount 2:wall mount))", NULL, 0, 0),
1515*4882a593Smuzhiyun         OPT_INTEGER('\0', "desk_ceil_mode", &(ctx->enDeskCeilMode),
1516*4882a593Smuzhiyun                       "set desk or ceil mode(default 2;(0:1p+1 1:2p 2:1+3 3:1+4(not implement)"
1517*4882a593Smuzhiyun                       "4:1p+6(not implement) 5:1+8))", NULL, 0, 0),
1518*4882a593Smuzhiyun         OPT_INTEGER('\0', "wall_mode", &(ctx->enWallMode),
1519*4882a593Smuzhiyun                       "set wall moode(default 1;(0:1p(not implement) 1:1p+3 2:1p+4(not implement)"
1520*4882a593Smuzhiyun                       "3:1p+8))", NULL, 0, 0),
1521*4882a593Smuzhiyun         OPT_INTEGER('\0', "task_sum", &(ctx->s32TaskSum),
1522*4882a593Smuzhiyun                      "set test task sum(default 1)", NULL, 0, 0),
1523*4882a593Smuzhiyun         OPT_INTEGER('\0', "show_point", &(ctx->u32ShowPoint),
1524*4882a593Smuzhiyun                      "set show point chain(default 0; 0:no show point chain 1:show with scale"
1525*4882a593Smuzhiyun                      "2:show with pano(not unrealized))", NULL, 0, 0),
1526*4882a593Smuzhiyun         OPT_INTEGER('\0', "change_param", &(ctx->u32ChangeParam),
1527*4882a593Smuzhiyun                      "set change param test(default 0)", NULL, 0, 0),
1528*4882a593Smuzhiyun         OPT_INTEGER('\0', "point_len", &(ctx->u32PointLen),
1529*4882a593Smuzhiyun                      "set point len(default 3000, when ctx->u32ShowPoint > 0 valid;"
1530*4882a593Smuzhiyun                      "range:[0, line image perimeter])", NULL, 0, 0),
1531*4882a593Smuzhiyun         OPT_INTEGER('\0', "vo_resolution", &(ctx->stVoOutputResolution),
1532*4882a593Smuzhiyun                      "set change param test(default 4;(4:1080p30 10:1080p60 31:3840*2160p30"
1533*4882a593Smuzhiyun                      "41:7680*4320p30))", NULL, 0, 0),
1534*4882a593Smuzhiyun         OPT_INTEGER('\0', "vo_chn_x", &(ctx->stChnRect.s32X),
1535*4882a593Smuzhiyun                     "vo chn attr rect x.default(0)", NULL, 0, 0),
1536*4882a593Smuzhiyun         OPT_INTEGER('\0', "vo_chn_y", &(ctx->stChnRect.s32Y),
1537*4882a593Smuzhiyun                     "vo chn attr rect y.default(0).", NULL, 0, 0),
1538*4882a593Smuzhiyun         OPT_INTEGER('\0', "vo_chn_w", &(ctx->stChnRect.u32Width),
1539*4882a593Smuzhiyun                     "vo chn attr rect w.default(1920)", NULL, 0, 0),
1540*4882a593Smuzhiyun         OPT_INTEGER('\0', "vo_chn_h", &(ctx->stChnRect.u32Height),
1541*4882a593Smuzhiyun                     "vo chn attr rect h.default(1080).", NULL, 0, 0),
1542*4882a593Smuzhiyun         OPT_END(),
1543*4882a593Smuzhiyun     };
1544*4882a593Smuzhiyun 
1545*4882a593Smuzhiyun     struct argparse argparse;
1546*4882a593Smuzhiyun     argparse_init(&argparse, options, usages, 0);
1547*4882a593Smuzhiyun     argparse_describe(&argparse, "\nselect a test case to run.",
1548*4882a593Smuzhiyun                                  "\nuse --help for details.");
1549*4882a593Smuzhiyun 
1550*4882a593Smuzhiyun     argc = argparse_parse(&argparse, argc, argv);
1551*4882a593Smuzhiyun 
1552*4882a593Smuzhiyun     if (ctx->u32DstWidth == 0)
1553*4882a593Smuzhiyun         ctx->u32DstWidth = ctx->u32SrcWidth;
1554*4882a593Smuzhiyun     if (ctx->u32DstHeight == 0)
1555*4882a593Smuzhiyun         ctx->u32DstHeight = ctx->u32SrcHeight;
1556*4882a593Smuzhiyun 
1557*4882a593Smuzhiyun     if (ctx->u32LineWidth == 0)
1558*4882a593Smuzhiyun         ctx->u32LineWidth = ctx->u32SrcWidth;
1559*4882a593Smuzhiyun     if (ctx->u32LineHeight == 0)
1560*4882a593Smuzhiyun         ctx->u32LineHeight = ctx->u32SrcHeight;
1561*4882a593Smuzhiyun 
1562*4882a593Smuzhiyun     if (ctx->stVoOutputResolution == 31) {
1563*4882a593Smuzhiyun         ctx->u32VoWidth = 3840;
1564*4882a593Smuzhiyun         ctx->u32VoHeight = 2160;
1565*4882a593Smuzhiyun     } else if (ctx->stVoOutputResolution >= VO_OUTPUT_7680x4320_24 &&
1566*4882a593Smuzhiyun                ctx->stVoOutputResolution <= VO_OUTPUT_7680x4320_60) {
1567*4882a593Smuzhiyun         ctx->u32VoWidth = 7680;
1568*4882a593Smuzhiyun         ctx->u32VoHeight = 4320;
1569*4882a593Smuzhiyun     }
1570*4882a593Smuzhiyun 
1571*4882a593Smuzhiyun     mpi_gdc_test_show_options(ctx);
1572*4882a593Smuzhiyun     if (ctx->srcFilePath == RK_NULL ||
1573*4882a593Smuzhiyun         ctx->u32SrcWidth <= 0 ||
1574*4882a593Smuzhiyun         ctx->u32SrcHeight <= 0) {
1575*4882a593Smuzhiyun         argparse_usage(&argparse);
1576*4882a593Smuzhiyun         goto __FAILED;
1577*4882a593Smuzhiyun     }
1578*4882a593Smuzhiyun 
1579*4882a593Smuzhiyun     if (ctx->u32ShowPoint && ctx->u32PointLen) {
1580*4882a593Smuzhiyun         ctx->pastDstPoint = (POINT_S *)malloc(sizeof(POINT_S) * ctx->u32PointLen);
1581*4882a593Smuzhiyun         ctx->pastSrcPoint = (POINT_S *)malloc(sizeof(POINT_S) * ctx->u32PointLen);
1582*4882a593Smuzhiyun     }
1583*4882a593Smuzhiyun 
1584*4882a593Smuzhiyun     s32Ret = RK_MPI_SYS_Init();
1585*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
1586*4882a593Smuzhiyun         goto __FAILED;
1587*4882a593Smuzhiyun     }
1588*4882a593Smuzhiyun     test_mpi_gdc_api(ctx);
1589*4882a593Smuzhiyun     s32Ret = RK_MPI_SYS_Exit();
1590*4882a593Smuzhiyun     if (s32Ret != RK_SUCCESS) {
1591*4882a593Smuzhiyun         goto __FAILED;
1592*4882a593Smuzhiyun     }
1593*4882a593Smuzhiyun     RK_LOGD("gdc test done!");
1594*4882a593Smuzhiyun 
1595*4882a593Smuzhiyun __FAILED:
1596*4882a593Smuzhiyun     if (ctx->pastDstPoint)
1597*4882a593Smuzhiyun         free(ctx->pastDstPoint);
1598*4882a593Smuzhiyun     if (ctx->pastSrcPoint)
1599*4882a593Smuzhiyun         free(ctx->pastSrcPoint);
1600*4882a593Smuzhiyun     if (ctx)
1601*4882a593Smuzhiyun         free(ctx);
1602*4882a593Smuzhiyun 
1603*4882a593Smuzhiyun     return 0;
1604*4882a593Smuzhiyun }
1605