• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2015 Rockchip Electronics Co., LTD.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _PPOP_H_
19 #define _PPOP_H_
20 
21 #include <sys/types.h>
22 
23 typedef RK_S32     status_t;
24 
25 namespace ppOp {
26 #define PP_IN_FORMAT_YUV422INTERLAVE                0
27 #define PP_IN_FORMAT_YUV420SEMI                     1
28 #define PP_IN_FORMAT_YUV420PLANAR                   2
29 #define PP_IN_FORMAT_YUV400                         3
30 #define PP_IN_FORMAT_YUV422SEMI                     4
31 #define PP_IN_FORMAT_YUV420SEMITIELED               5
32 #define PP_IN_FORMAT_YUV440SEMI                     6
33 #define PP_IN_FORMAT_YUV444_SEMI                    7
34 #define PP_IN_FORMAT_YUV411_SEMI                    8
35 
36 #define PP_OUT_FORMAT_RGB565                        0
37 #define PP_OUT_FORMAT_ARGB                          1
38 #define PP_OUT_FORMAT_ABGR                          2
39 #define PP_OUT_FORMAT_YUV422INTERLAVE               3
40 #define PP_OUT_FORMAT_YUV420INTERLAVE               5
41 
42 #define PP_ROTATION_NONE                                0U
43 #define PP_ROTATION_RIGHT_90                            1U
44 #define PP_ROTATION_LEFT_90                             2U
45 #define PP_ROTATION_HOR_FLIP                            3U
46 #define PP_ROTATION_VER_FLIP                            4U
47 #define PP_ROTATION_180                                 5U
48 
49 typedef struct {
50     RK_U32 srcAddr;           // 16 align
51     RK_U32 srcFormat;
52     RK_U32 srcWidth;          // 16 align max 2048
53     RK_U32 srcHeight;         // 16 align max 2048
54     RK_U32 srcHStride;        // 16 align max 2048
55     RK_U32 srcVStride;        // 16 align max 2048
56     RK_U32 srcCrop8R;         // crop rigth
57     RK_U32 srcCrop8D;         // crop down
58     RK_U32 srcX;                  // src x
59     RK_U32 srcY;                  // src y
60     RK_U32 srcReserv[2];
61 
62     RK_U32 dstAddr;           // 16 align
63     RK_U32 dstFormat;
64     RK_U32 dstWidth;          // 16 align max 2048
65     RK_U32 dstHeight;         // 16 align max 2048
66     RK_U32 dstHStride;        // 16 align max 2048
67     RK_U32 dstVStride;        // 16 align max 2048
68     RK_U32 dstReserv[2];
69     RK_U32 dstX;                  // dst x
70     RK_U32 dstY;                  // dst y
71 
72     RK_U32 vpuFd;             // VPUClient handle
73     RK_U32 rotation;          // rotation angel
74     RK_U32 yuvFullRange;      // yuv is full range or not, set yuv trans table
75     RK_U32 deinterlace;       // do deinterlace or not
76     RK_U32 optReserv[13];
77 } PP_OPERATION;
78 
79 
80 typedef enum {
81     PP_SET_SRC_ADDR         = 0,
82     PP_SET_SRC_FORMAT,
83     PP_SET_SRC_WIDTH,
84     PP_SET_SRC_HEIGHT,
85     PP_SET_SRC_HSTRIDE,
86     PP_SET_SRC_VSTRIDE,
87 
88     PP_SET_DST_ADDR         = 8,
89     PP_SET_DST_FORMAT,
90     PP_SET_DST_WIDTH,
91     PP_SET_DST_HEIGHT,
92     PP_SET_DST_HSTRIDE,
93     PP_SET_DST_VSTRIDE,
94 
95     PP_SET_VPU_FD           = 16,           // important must be set or use ppOpSet to set this fd
96     PP_SET_ROTATION,
97     PP_SET_YUV_RANGE,
98     PP_SET_DEINTERLACE,
99 
100     PP_SET_BUTT             = 32,
101 } PP_SET_OPT;
102 
103 typedef void* PP_OP_HANDLE;
104 
105 status_t ppOpInit(PP_OP_HANDLE *hnd, PP_OPERATION *init);
106 status_t ppOpSet(PP_OP_HANDLE hnd, PP_SET_OPT opt, RK_U32 val);
107 status_t ppOpPerform(PP_OP_HANDLE hnd);
108 status_t ppOpSync(PP_OP_HANDLE hnd);
109 status_t ppOpRelease(PP_OP_HANDLE hnd);
110 }
111 
112 #endif  // _PPOP_H_
113 
114