xref: /rockchip-linux_mpp/mpp/legacy/ppOp.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2015 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 _PPOP_H_
18 #define _PPOP_H_
19 
20 #include <sys/types.h>
21 
22 typedef RK_S32     status_t;
23 
24 namespace android
25 {
26 
27 #define PP_IN_FORMAT_YUV422INTERLAVE                0
28 #define PP_IN_FORMAT_YUV420SEMI                     1
29 #define PP_IN_FORMAT_YUV420PLANAR                   2
30 #define PP_IN_FORMAT_YUV400                         3
31 #define PP_IN_FORMAT_YUV422SEMI                     4
32 #define PP_IN_FORMAT_YUV420SEMITIELED               5
33 #define PP_IN_FORMAT_YUV440SEMI                     6
34 #define PP_IN_FORMAT_YUV444_SEMI                    7
35 #define PP_IN_FORMAT_YUV411_SEMI                    8
36 
37 #define PP_OUT_FORMAT_RGB565                        0
38 #define PP_OUT_FORMAT_ARGB                          1
39 #define PP_OUT_FORMAT_ABGR                          2
40 #define PP_OUT_FORMAT_YUV422INTERLAVE               3
41 #define PP_OUT_FORMAT_YUV420INTERLAVE               5
42 
43 #define PP_ROTATION_NONE                                0U
44 #define PP_ROTATION_RIGHT_90                            1U
45 #define PP_ROTATION_LEFT_90                             2U
46 #define PP_ROTATION_HOR_FLIP                            3U
47 #define PP_ROTATION_VER_FLIP                            4U
48 #define PP_ROTATION_180                                 5U
49 
50 typedef struct {
51     RK_U32 srcAddr;           // 16 align
52     RK_U32 srcFormat;
53     RK_U32 srcWidth;          // 16 align max 2048
54     RK_U32 srcHeight;         // 16 align max 2048
55     RK_U32 srcHStride;        // 16 align max 2048
56     RK_U32 srcVStride;        // 16 align max 2048
57     RK_U32 srcCrop8R;         // crop rigth
58     RK_U32 srcCrop8D;         // crop down
59     RK_U32 srcX;                  // src x
60     RK_U32 srcY;                  // src y
61     RK_U32 srcReserv[2];
62 
63     RK_U32 dstAddr;           // 16 align
64     RK_U32 dstFormat;
65     RK_U32 dstWidth;          // 16 align max 2048
66     RK_U32 dstHeight;         // 16 align max 2048
67     RK_U32 dstHStride;        // 16 align max 2048
68     RK_U32 dstVStride;        // 16 align max 2048
69     RK_U32 dstReserv[2];
70     RK_U32 dstX;                  // dst x
71     RK_U32 dstY;                  // dst y
72 
73     RK_U32 vpuFd;             // VPUClient handle
74     RK_U32 rotation;          // rotation angel
75     RK_U32 yuvFullRange;      // yuv is full range or not, set yuv trans table
76     RK_U32 deinterlace;       // do deinterlace or not
77     RK_U32 optReserv[13];
78 } PP_OPERATION;
79 
80 
81 typedef enum {
82     PP_SET_SRC_ADDR         = 0,
83     PP_SET_SRC_FORMAT,
84     PP_SET_SRC_WIDTH,
85     PP_SET_SRC_HEIGHT,
86     PP_SET_SRC_HSTRIDE,
87     PP_SET_SRC_VSTRIDE,
88 
89     PP_SET_DST_ADDR         = 8,
90     PP_SET_DST_FORMAT,
91     PP_SET_DST_WIDTH,
92     PP_SET_DST_HEIGHT,
93     PP_SET_DST_HSTRIDE,
94     PP_SET_DST_VSTRIDE,
95 
96     PP_SET_VPU_FD           = 16,           // important must be set or use ppOpSet to set this fd
97     PP_SET_ROTATION,
98     PP_SET_YUV_RANGE,
99     PP_SET_DEINTERLACE,
100 
101     PP_SET_BUTT             = 32,
102 } PP_SET_OPT;
103 
104 typedef void* PP_OP_HANDLE;
105 
106 status_t ppOpInit(PP_OP_HANDLE *hnd, PP_OPERATION *init);
107 status_t ppOpSet(PP_OP_HANDLE hnd, PP_SET_OPT opt, RK_U32 val);
108 status_t ppOpPerform(PP_OP_HANDLE hnd);
109 status_t ppOpSync(PP_OP_HANDLE hnd);
110 status_t ppOpRelease(PP_OP_HANDLE hnd);
111 
112 }
113 
114 #endif  // _PPOP_H_
115 
116