1 /* 2 * Copyright 2021 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SRC_TESTS_RT_MPI_COMMON_TEST_COMM_AO_H_ 18 #define SRC_TESTS_RT_MPI_COMMON_TEST_COMM_AO_H_ 19 20 #ifdef __cplusplus 21 #if __cplusplus 22 extern "C" { 23 #endif 24 #endif /* End of #ifdef __cplusplus */ 25 26 #include "rk_comm_avs.h" 27 #include "rk_comm_mb.h" 28 #include "rk_comm_video.h" 29 30 #ifdef MAX_FILE_NAME_LEN 31 #undef MAX_FILE_NAME_LEN 32 #define MAX_FILE_NAME_LEN 64 33 #else 34 #define MAX_FILE_NAME_LEN 64 35 #endif 36 37 #ifdef MAX_FILE_PATH_LEN 38 #undef MAX_FILE_PATH_LEN 39 #define MAX_FILE_PATH_LEN 256 40 #else 41 #define MAX_FILE_PATH_LEN 256 42 #endif 43 44 #define AVS_GET_CHN_FRAME_TIMEOUT_MS 200 45 #define VO_RGA 0 46 47 #ifdef ENABLE_COM_POOL 48 #undef ENABLE_COM_POOL 49 #define ENABLE_COM_POOL 0 50 #else 51 #define ENABLE_COM_POOL 0 52 #endif 53 54 typedef enum rkTEST_MODE_E { 55 TEST_MODE_AVS_ONLY = 0, 56 TEST_MODE_AVS_VO = 1, 57 TEST_MODE_AVS_VPSS_VENC = 2, 58 TEST_MODE_VI_AVS_VO = 3, 59 TEST_MODE_VI_AVS_VPSS_VENC = 4, 60 } TEST_MODE_E; 61 62 typedef struct _rkMpiAvsCtx { 63 const RK_CHAR *srcFilePath; 64 const RK_CHAR *dstFilePath; 65 RK_S32 s32LoopCount; 66 RK_S32 s32GrpNum; 67 RK_S32 s32PipeNum; 68 RK_S32 s32ChnNum; 69 70 RK_U32 u32SrcWidth; 71 RK_U32 u32SrcHeight; 72 RK_U32 u32SrcVirWidth; 73 RK_U32 u32SrcVirHeight; 74 PIXEL_FORMAT_E enSrcPixFormat; 75 COMPRESS_MODE_E enSrcCompressMode; 76 77 RK_U32 u32DstWidth; 78 RK_U32 u32DstHeight; 79 PIXEL_FORMAT_E enDstPixFormat; 80 COMPRESS_MODE_E enDstCompressMode; 81 RK_U32 u32ChnDepth; 82 RK_U32 u32FrameBufCnt; 83 RK_S32 s32SrcChnRate; 84 RK_S32 s32DstChnRate; 85 86 TEST_MODE_E enTestMode; 87 AVS_MODE_E enAvsWorkMode; 88 AVS_PARAM_SOURCE_E enParamSource; 89 AVS_PROJECTION_MODE_E enAvsProjMode; 90 91 RK_BOOL bFrameSync; 92 AVS_ROTATION_S stOriRotation; 93 AVS_ROTATION_S stRotation; 94 AVS_FOV_S stFov; 95 POINT_S stCenter; 96 AVS_LUT_ACCURACY_E enLutAccuracy; 97 AVS_FUSE_WIDTH_E enLutFuseWidth; 98 AVS_STEP_ATTR_S stLutStep; 99 const RK_CHAR *lutFilePath; 100 const RK_CHAR *calibFileName; 101 const RK_CHAR *meshFilePath; 102 RK_FLOAT fDistance; 103 RK_S32 s32SrcGrpRate; 104 RK_S32 s32DstGrpRate; 105 RK_S32 s32GrpIndex; 106 RK_BOOL bCommPool; 107 MB_CONFIG_S stMbConfig; 108 MB_POOL srcVFramePools[AVS_PIPE_NUM]; 109 RK_BOOL bGrpExSize; 110 RK_U32 u32GrpWidth; 111 RK_U32 u32GrpHeight; 112 RK_BOOL bGetFinalLut; 113 } TEST_AVS_CTX_S; 114 115 RK_U32 TEST_AVS_GetFileLen(const RK_CHAR* File); 116 RK_S32 TEST_AVS_LoadFile(const RK_CHAR* File, RK_VOID* Addr, RK_U32 u32Size); 117 118 RK_S32 TEST_AVS_Start(AVS_GRP AvsGrp, RK_U32 u32ChnNum, 119 AVS_GRP_ATTR_S *pstAvsGrpAttr, 120 AVS_CHN_ATTR_S *pstAvsChnAttr); 121 RK_S32 TEST_AVS_Stop(AVS_GRP AvsGrp, RK_U32 u32ChnNum); 122 123 RK_S32 TEST_AVS_ModCreateFrame(TEST_AVS_CTX_S *pstCtx, 124 VIDEO_FRAME_INFO_S **pstVideoFramess); 125 126 RK_S32 TEST_AVS_ModSendFrame(AVS_GRP AvsGrp, 127 RK_U32 u32PipeNum, 128 VIDEO_FRAME_INFO_S **pstVideoFrames); 129 130 RK_S32 TEST_AVS_ModGetChnFrame(AVS_GRP AvsGrp, 131 RK_U32 u32ChnNum, 132 VIDEO_FRAME_INFO_S **pstVideoFrames); 133 134 RK_S32 TEST_AVS_ModSaveChnFrame(AVS_GRP AvsGrp, 135 RK_U32 u32ChnNum, 136 const RK_CHAR *dstFilePath, 137 VIDEO_FRAME_INFO_S **pstVideoFrames); 138 139 RK_S32 TEST_AVS_ModReleaseChnFrame(AVS_GRP AvsGrp, 140 RK_U32 u32ChnNum, 141 VIDEO_FRAME_INFO_S **pstVideoFrames); 142 143 RK_S32 TEST_AVS_ModInit(TEST_AVS_CTX_S *pstCtx); 144 145 RK_S32 TEST_AVS_ModDeInit(TEST_AVS_CTX_S *pstCtx); 146 147 RK_S32 TEST_AVS_UnitTest(TEST_AVS_CTX_S *pstCtx); 148 149 RK_S32 TEST_AVS_InitAttr(TEST_AVS_CTX_S *pstCtx, 150 AVS_GRP_ATTR_S *pstAvsGrpAttr, 151 AVS_CHN_ATTR_S *pstAvsChnAttrs); 152 153 RK_S32 TEST_AVS_InitAttr_Blend_Lut(TEST_AVS_CTX_S *pstCtx, 154 AVS_GRP_ATTR_S *pstAvsGrpAttr, 155 AVS_CHN_ATTR_S *pstAvsChnAttrs); 156 157 RK_S32 TEST_AVS_InitAttr_Blend_Calib(TEST_AVS_CTX_S *pstCtx, 158 AVS_GRP_ATTR_S *pstAvsGrpAttr, 159 AVS_CHN_ATTR_S *pstAvsChnAttrs); 160 161 RK_S32 TEST_AVS_InitAttr_NoBlend(TEST_AVS_CTX_S *pstCtx, 162 AVS_GRP_ATTR_S *pstAvsGrpAttr, 163 AVS_CHN_ATTR_S *pstAvsChnAttrs); 164 165 RK_S32 TEST_AVS_MallocLutBuf(TEST_AVS_CTX_S *pstCtx, RK_VOID ***lutBufsVirAddr); 166 RK_S32 TEST_AVS_FreeLutBuf(AVS_GRP_ATTR_S *pstAvsGrpAttr); 167 168 169 RK_S32 TEST_AVS_ModCreateFramePool(TEST_AVS_CTX_S *pstCtx); 170 RK_S32 TEST_AVS_ModDestroyFramePool(TEST_AVS_CTX_S *pstCtx); 171 172 RK_S32 TEST_AVS_ModGetFrameFromPool(TEST_AVS_CTX_S *pstCtx, 173 VIDEO_FRAME_INFO_S **pstVideoFrames); 174 RK_S32 TEST_AVS_ModReleaseFrameToPool(TEST_AVS_CTX_S *pstCtx, 175 VIDEO_FRAME_INFO_S **pstVideoFrames); 176 177 178 RK_S32 TEST_AVS_ComChnSetScale(TEST_AVS_CTX_S *pstCtx); 179 RK_S32 TEST_AVS_ComGrpChnSetScale(TEST_AVS_CTX_S *pstCtx); 180 181 RK_S32 TEST_AVS_GetFinalLut(AVS_GRP AvsGrp, AVS_GRP_ATTR_S *pstAvsGrpAttr); 182 183 #ifdef __cplusplus 184 #if __cplusplus 185 } 186 #endif 187 #endif /* End of #ifdef __cplusplus */ 188 189 #endif // SRC_TESTS_RT_MPI_COMMON_TEST_COMM_AO_H_ 190