• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Shenzhen Kaihong DID Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HDI_MPP_H
17 #define HDI_MPP_H
18 
19 #include "codec_type.h"
20 #include "rk_mpi.h"
21 #include "hdi_mpp_ext_param_keys.h"
22 #include "hdi_mpp_mpi.h"
23 
24 typedef struct {
25     int32_t profile;
26     int32_t level;
27     int32_t cabacEn;
28     int32_t cabacIdc;
29     int32_t trans8x8;
30 } RKHdiEncSetupAVC;
31 
32 typedef struct {
33     int32_t horStride;
34     int32_t verStride;
35 } RKHdiStrideSetup;
36 
37 typedef struct {
38     int32_t fpsInFlex;
39     int32_t fpsInNum;
40     int32_t fpsInDen;
41     int32_t fpsOutFlex;
42     int32_t fpsOutNum;
43     int32_t fpsOutDen;
44 } RKHdiFpsSetup;
45 
46 typedef struct {
47     uint32_t dropMode;
48     uint32_t dropThd;
49     uint32_t dropGap;
50 } RKHdiDropSetup;
51 
52 typedef struct {
53     int32_t rcMode;
54     int32_t bpsTarget;
55     int32_t bpsMax;
56     int32_t bpsMin;
57     int32_t qpInit;
58     int32_t qpMax;
59     int32_t qpMin;
60     int32_t qpMaxI;
61     int32_t qpMinI;
62     int32_t qpIp;
63 } RKHdiRcSetup;
64 
65 typedef struct {
66     VideoCodecGopMode gopMode;
67     uint32_t gopLen;
68     int32_t gop;
69     int32_t viLen;
70 } RKHdiGopSetup;
71 
72 typedef struct {
73     int32_t mimeCodecType;
74     RKHdiEncSetupAVC avcSetup;
75 } RKHdiCodecMimeSetup;
76 
77 typedef struct {
78     int32_t splitMode;
79     int32_t splitArg;
80 } RKHdiSplitSetup;
81 
82 typedef struct {
83     int32_t width;
84     int32_t height;
85     int32_t codecType;
86     uint32_t split;
87     RKHdiStrideSetup stride;
88     CodecPixelFormat fmt;
89     RKHdiFpsSetup fps;
90     RKHdiDropSetup drop;
91     RKHdiRcSetup rc;
92     RKHdiGopSetup gop;
93     RKHdiCodecMimeSetup codecMime;
94 } RKHdiEncodeSetup;
95 
96 typedef struct {
97     MppCtx ctx;
98     RKMppApi *mppApi;
99     char *componentName;
100     MppCtxType ctxType;
101     MppCodingType codingType;
102     CodecCallback *pCallbacks;
103     MppDecCfg cfg;
104     RKHdiEncodeSetup setup;
105     MppApi *mpi;
106 
107     MppBufferGroup frmGrp;
108     MppPacket packet;
109     size_t packetSize;
110     MppFrame frame;
111     RK_S32 frameCount;
112     RK_S32 frameErr;
113     RK_S32 frameNum;
114     size_t maxUsage;
115 
116     MppBuffer frmBuf;
117     size_t headerSize;
118     size_t frameSize;
119     MppBuffer pktBuf;
120 
121     MppFrameFormat fmt;
122 } RKHdiBaseComponent;
123 
124 #endif // HDI_MPP_H