forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-08-21 fc437ccf3419c424092701f3d883215fa4552a8b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/*------------------------------------------------------------------------------
--                                                                            --
--       This software is confidential and proprietary and may be used        --
--        only as expressly authorized by a licensing agreement from          --
--                                                                            --
--                            Rockchip Products .                             --
--                                                                            --
--                   (C) COPYRIGHT 2014 ROCKCHIP PRODUCTS                     --
--                            ALL RIGHTS RESERVED                             --
--                                                                            --
--                 The entire notice above must be reproduced                 --
--                  on all copies and should not be removed.                  --
--                                                                            --
--------------------------------------------------------------------------------
--
--  Description : The video post processor API
--
--------------------------------------------------------------------------------
--
--
--
------------------------------------------------------------------------------*/
 
#ifndef __PPAPI_H__
#define __PPAPI_H__
 
#ifdef __cplusplus
extern "C"
{
#endif
 
#include "vpu_type.h"
#include "decapicommon.h"
 
#define PP_PIPELINE_DISABLED                            0U
#define PP_PIPELINED_DEC_TYPE_H264                      1U
#define PP_PIPELINED_DEC_TYPE_MPEG4                     2U
#define PP_PIPELINED_DEC_TYPE_JPEG                      3U
#define PP_PIPELINED_DEC_TYPE_VC1                       4U
#define PP_PIPELINED_DEC_TYPE_MPEG2                     5U
#define PP_PIPELINED_DEC_TYPE_VP6                       6U
#define PP_PIPELINED_DEC_TYPE_AVS                       7U  /* not supported yet */
#define PP_PIPELINED_DEC_TYPE_RV                        8U
#define PP_PIPELINED_DEC_TYPE_VP8                       9U
 
#define PP_PIX_FMT_YCBCR_4_0_0                          0x080000U
 
#define PP_PIX_FMT_YCBCR_4_2_2_INTERLEAVED              0x010001U
#define PP_PIX_FMT_YCRYCB_4_2_2_INTERLEAVED             0x010005U
#define PP_PIX_FMT_CBYCRY_4_2_2_INTERLEAVED             0x010006U
#define PP_PIX_FMT_CRYCBY_4_2_2_INTERLEAVED             0x010007U
#define PP_PIX_FMT_YCBCR_4_2_2_SEMIPLANAR               0x010002U
 
#define PP_PIX_FMT_YCBCR_4_4_0                          0x010004U
 
#define PP_PIX_FMT_YCBCR_4_2_0_PLANAR                   0x020000U
#define PP_PIX_FMT_YCBCR_4_2_0_SEMIPLANAR               0x020001U
#define PP_PIX_FMT_YCBCR_4_2_0_TILED                    0x020002U
 
#define PP_PIX_FMT_YCBCR_4_1_1_SEMIPLANAR               0x100001U
#define PP_PIX_FMT_YCBCR_4_4_4_SEMIPLANAR               0x200001U
 
#define PP_PIX_FMT_RGB16_CUSTOM                         0x040000U
#define PP_PIX_FMT_RGB16_5_5_5                          0x040001U
#define PP_PIX_FMT_RGB16_5_6_5                          0x040002U
#define PP_PIX_FMT_BGR16_5_5_5                          0x040003U
#define PP_PIX_FMT_BGR16_5_6_5                          0x040004U
 
#define PP_PIX_FMT_RGB32_CUSTOM                         0x041000U
#define PP_PIX_FMT_RGB32                                0x041001U
#define PP_PIX_FMT_BGR32                                0x041002U
 
#define PP_YCBCR2RGB_TRANSFORM_CUSTOM                   0U
#define PP_YCBCR2RGB_TRANSFORM_BT_601                   1U
#define PP_YCBCR2RGB_TRANSFORM_BT_709                   2U
 
#define PP_ROTATION_NONE                                0U
#define PP_ROTATION_RIGHT_90                            1U
#define PP_ROTATION_LEFT_90                             2U
#define PP_ROTATION_HOR_FLIP                            3U
#define PP_ROTATION_VER_FLIP                            4U
#define PP_ROTATION_180                                 5U
 
#define PP_PIC_FRAME_OR_TOP_FIELD                       0U
#define PP_PIC_BOT_FIELD                                1U
#define PP_PIC_TOP_AND_BOT_FIELD                        2U
#define PP_PIC_TOP_AND_BOT_FIELD_FRAME                  3U
#define PP_PIC_TOP_FIELD_FRAME                          4U
#define PP_PIC_BOT_FIELD_FRAME                          5U
 
#define PP_MAX_MULTIBUFFER                              17
 
typedef const void *PPInst;
 
typedef enum PPResult_ {
    PP_OK = 0,
    PP_PARAM_ERROR = -1,
    PP_MEMFAIL = -4,
 
    PP_SET_IN_SIZE_INVALID = -64,
    PP_SET_IN_ADDRESS_INVALID = -65,
    PP_SET_IN_FORMAT_INVALID = -66,
    PP_SET_CROP_INVALID = -67,
    PP_SET_ROTATION_INVALID = -68,
    PP_SET_OUT_SIZE_INVALID = -69,
    PP_SET_OUT_ADDRESS_INVALID = -70,
    PP_SET_OUT_FORMAT_INVALID = -71,
    PP_SET_VIDEO_ADJUST_INVALID = -72,
    PP_SET_RGB_BITMASK_INVALID = -73,
    PP_SET_FRAMEBUFFER_INVALID = -74,
    PP_SET_MASK1_INVALID = -75,
    PP_SET_MASK2_INVALID = -76,
    PP_SET_DEINTERLACE_INVALID = -77,
    PP_SET_IN_STRUCT_INVALID = -78,
    PP_SET_IN_RANGE_MAP_INVALID = -79,
    PP_SET_ABLEND_UNSUPPORTED = -80,
    PP_SET_DEINTERLACING_UNSUPPORTED = -81,
    PP_SET_DITHERING_UNSUPPORTED = -82,
    PP_SET_SCALING_UNSUPPORTED = -83,
 
    PP_BUSY = -128,
    PP_HW_BUS_ERROR = -256,
    PP_HW_TIMEOUT = -257,
    PP_DWL_ERROR = -258,
    PP_SYSTEM_ERROR = -259,
    PP_DEC_COMBINED_MODE_ERROR = -512,
    PP_DEC_RUNTIME_ERROR = -513
} PPResult;
 
typedef struct PPInImage_ {
    RK_U32 pixFormat;
    RK_U32 picStruct;
    RK_U32 videoRange;
    RK_U32 width;
    RK_U32 height;
    RK_U32 bufferBusAddr;
    RK_U32 bufferCbBusAddr;
    RK_U32 bufferCrBusAddr;
    RK_U32 bufferBusAddrBot;
    RK_U32 bufferBusAddrChBot;
    RK_U32 vc1MultiResEnable;
    RK_U32 vc1RangeRedFrm;
    RK_U32 vc1RangeMapYEnable;
    RK_U32 vc1RangeMapYCoeff;
    RK_U32 vc1RangeMapCEnable;
    RK_U32 vc1RangeMapCCoeff;
} PPInImage;
 
typedef struct PPOutImage_ {
    RK_U32 pixFormat;
    RK_U32 width;
    RK_U32 height;
    RK_U32 bufferBusAddr;
    RK_U32 bufferChromaBusAddr;
} PPOutImage;
 
typedef struct PPRgbTransform_ {
    RK_U32 a;
    RK_U32 b;
    RK_U32 c;
    RK_U32 d;
    RK_U32 e;
} PPRgbTransform;
 
typedef struct PPRgbBitmask_ {
    RK_U32 maskR;
    RK_U32 maskG;
    RK_U32 maskB;
    RK_U32 maskAlpha;
} PPRgbBitmask;
 
typedef struct PPOutRgb_ {
    RK_U32 rgbTransform;
    RK_S32 contrast;
    RK_S32 brightness;
    RK_S32 saturation;
    RK_U32 alpha;
    RK_U32 transparency;
    PPRgbTransform rgbTransformCoeffs;
    PPRgbBitmask rgbBitmask;
    RK_U32 ditheringEnable;
} PPOutRgb;
 
typedef struct PPInCropping_ {
    RK_U32 enable;
    /* NOTE: these are coordinates relative to the input picture */
    RK_U32 originX;
    RK_U32 originY;
    RK_U32 height;
    RK_U32 width;
} PPInCropping;
 
typedef struct PPOutMask1_ {
    RK_U32 enable;
    /* NOTE: these are coordinates relative to the output image */
    RK_S32 originX;
    RK_S32 originY;
    RK_U32 height;
    RK_U32 width;
    RK_U32 alphaBlendEna;
    RK_U32 blendComponentBase;
} PPOutMask1;
 
typedef struct PPOutMask2_ {
    RK_U32 enable;
    /* NOTE: these are coordinates relative to the output image */
    RK_S32 originX;
    RK_S32 originY;
    RK_U32 height;
    RK_U32 width;
    RK_U32 alphaBlendEna;
    RK_U32 blendComponentBase;
} PPOutMask2;
 
typedef struct PPOutFrameBuffer_ {
    RK_U32 enable;
    /* NOTE: these are coordinates relative to the framebuffer */
    RK_S32 writeOriginX;
    RK_S32 writeOriginY;
    RK_U32 frameBufferWidth;
    RK_U32 frameBufferHeight;
} PPOutFrameBuffer;
 
typedef struct PPInRotation_ {
    RK_U32 rotation;
} PPInRotation;
 
typedef struct PPOutDeinterlace_ {
    RK_U32 enable;
} PPOutDeinterlace;
 
typedef struct PPConfig_ {
    PPInImage ppInImg;
    PPInCropping ppInCrop;
    PPInRotation ppInRotation;
    PPOutImage ppOutImg;
    PPOutRgb ppOutRgb;
    PPOutMask1 ppOutMask1;
    PPOutMask2 ppOutMask2;
    PPOutFrameBuffer ppOutFrmBuffer;
    PPOutDeinterlace ppOutDeinterlace;
} PPConfig;
 
/* Version information */
typedef struct PPApiVersion_ {
    RK_U32 major;           /* PP API major version */
    RK_U32 minor;           /* PP API minor version */
} PPApiVersion;
 
typedef struct PPBuild_ {
    RK_U32 swBuild;         /* Software build ID */
    RK_U32 hwBuild;         /* Hardware build ID */
    DecHwConfig hwConfig;   /* hardware supported configuration */
} PPBuild;
 
typedef struct PPOutput_ {
    RK_U32 bufferBusAddr;
    RK_U32 bufferChromaBusAddr;
} PPOutput;
 
typedef struct PPOutputBuffers_ {
    RK_U32 nbrOfBuffers;
    PPOutput ppOutputBuffers[PP_MAX_MULTIBUFFER];
} PPOutputBuffers;
 
/*------------------------------------------------------------------------------
    Prototypes of PP API functions
------------------------------------------------------------------------------*/
PPResult PPInit(PPInst * pPostPInst);
 
PPResult PPDecCombinedModeEnable(PPInst postPInst, const void *pDecInst,
                                 RK_U32 decType);
 
PPResult PPDecCombinedModeDisable(PPInst postPInst, const void *pDecInst);
 
PPResult PPGetConfig(PPInst postPInst, PPConfig * pPpConf);
 
PPResult PPSetConfig(PPInst postPInst, PPConfig * pPpConf);
 
PPResult PPDecSetMultipleOutput(PPInst postPInst,
                                const PPOutputBuffers * pBuffers);
 
PPResult PPGetNextOutput(PPInst postPInst, PPOutput * pOut);
 
void PPRelease(PPInst pPpInst);
 
PPResult PPGetResult(PPInst postPInst);
 
PPApiVersion PPGetAPIVersion(void);
 
PPBuild PPGetBuild(void);
 
void PPTrace(const char *string);
 
#ifdef __cplusplus
}
#endif
 
#endif                       /* __PPAPI_H__ */