1 /* 2 * Copyright (c) 2022-2023 HiHope Open Source Organization . 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HDI_MPP_CONFIG_H 17 #define HDI_MPP_CONFIG_H 18 19 #include "codec_type.h" 20 #include "hdi_mpp.h" 21 #include "rk_mpi.h" 22 #include "rk_vdec_cfg.h" 23 #include "rk_venc_cfg.h" 24 #include "rga.h" 25 26 typedef struct { 27 PixelFormat pixFormat; 28 MppFrameFormat mppFormat; 29 RgaSURF_FORMAT rgaFormat; 30 } CodecPixelFormatConvertTbl; 31 32 int32_t InitMppConfig(RKHdiBaseComponent *pBaseComponent); 33 int32_t DeinitMppConfig(RKHdiBaseComponent *pBaseComponent); 34 void SetDefaultFps(RKHdiEncodeSetup *setup); 35 void SetDefaultDropMode(RKHdiEncodeSetup *setup); 36 void SetDefaultGopMode(RKHdiEncodeSetup *setup); 37 MppFrameFormat ConvertHdiFormat2RKFormat(PixelFormat fmtHDI); 38 RgaSURF_FORMAT ConvertHdiFormat2RgaFormat(PixelFormat fmtHDI); 39 RgaSURF_FORMAT ConvertMppFormat2RgaFormat(MppFrameFormat mppFmt); 40 int32_t SetEncCfg(RKHdiBaseComponent *pBaseComponent); 41 int32_t SetDecCfg(RKHdiBaseComponent *pBaseComponent); 42 int32_t GetDefaultHorStride(int32_t width, PixelFormat fmtHDI); 43 int32_t SetParamWidth(RKHdiBaseComponent *pBaseComponent, Param *param); 44 int32_t SetParamHeight(RKHdiBaseComponent *pBaseComponent, Param *param); 45 int32_t SetParamPixelFmt(RKHdiBaseComponent *pBaseComponent, Param *param); 46 int32_t SetParamHorStride(RKHdiBaseComponent *pBaseComponent, Param *param); 47 int32_t SetParamVerStride(RKHdiBaseComponent *pBaseComponent, Param *param); 48 int32_t SetParamFps(RKHdiBaseComponent *pBaseComponent, Param *param); 49 int32_t SetParamDrop(RKHdiBaseComponent *pBaseComponent, Param *param); 50 int32_t SetParamRateControl(RKHdiBaseComponent *pBaseComponent, Param *param); 51 int32_t SetParamGop(RKHdiBaseComponent *pBaseComponent, Param *param); 52 int32_t SetParamMimeCodecType(RKHdiBaseComponent *pBaseComponent, Param *param); 53 int32_t SetParamCodecType(RKHdiBaseComponent *pBaseComponent, Param *param); 54 int32_t SetParamSplitParse(RKHdiBaseComponent *pBaseComponent, Param *param); 55 int32_t SetParamCodecFrameNum(RKHdiBaseComponent *pBaseComponent, Param *param); 56 int32_t CheckSetupStride(RKHdiBaseComponent *pBaseComponent); 57 int32_t GetParamInputBufferCount(RKHdiBaseComponent *pBaseComponent, Param *param); 58 int32_t GetParamOutputBufferCount(RKHdiBaseComponent *pBaseComponent, Param *param); 59 int32_t GetParamBufferSize(RKHdiBaseComponent *pBaseComponent, Param *param); 60 int32_t GetParamWidth(RKHdiBaseComponent *pBaseComponent, Param *param); 61 int32_t GetParamHeight(RKHdiBaseComponent *pBaseComponent, Param *param); 62 int32_t GetParamPixleFmt(RKHdiBaseComponent *pBaseComponent, Param *param); 63 int32_t GetParamStride(RKHdiBaseComponent *pBaseComponent, Param *param); 64 int32_t GetParamFps(RKHdiBaseComponent *pBaseComponent, Param *param); 65 int32_t GetParamRateControl(RKHdiBaseComponent *pBaseComponent, Param *param); 66 int32_t GetParamPixleFmt(RKHdiBaseComponent *pBaseComponent, Param *param); 67 int32_t GetParamGop(RKHdiBaseComponent *pBaseComponent, Param *param); 68 int32_t GetParamMimeCodecType(RKHdiBaseComponent *pBaseComponent, Param *param); 69 int32_t GetParamCodecType(RKHdiBaseComponent *pBaseComponent, Param *param); 70 int32_t GetParamSplitParse(RKHdiBaseComponent *pBaseComponent, Param *param); 71 int32_t GetParamCodecFrameNum(RKHdiBaseComponent *pBaseComponent, Param *param); 72 int32_t GetParamDrop(RKHdiBaseComponent *pBaseComponent, Param *param); 73 74 #endif // HDI_MPP_CONFIG_H