xref: /rockchip-linux_mpp/mpp/hal/vpu/common/vepu_common.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 #ifndef __VEPU_COMMON_H__
17 #define __VEPU_COMMON_H__
18 
19 #include "mpp_frame.h"
20 
21 typedef enum VepuFormat_e {
22     VEPU_FMT_YUV420PLANAR,          //0
23     VEPU_FMT_YUV420SEMIPLANAR,      //1
24     VEPU_FMT_YUYV422INTERLEAVED,    //2
25     VEPU_FMT_UYVY422INTERLEAVED,    //3
26     VEPU_FMT_RGB565,                //4
27     VEPU_FMT_RGB555,                //5
28     VEPU_FMT_RGB444,                //6
29     VEPU_FMT_RGB888,                //7
30     VEPU_FMT_RGB101010,             //8
31     VEPU_FMT_BUTT,                  //9
32 } VepuFmt;
33 
34 typedef struct VepuFormatCfg_t {
35     VepuFmt format;
36     RK_U8   r_mask;
37     RK_U8   g_mask;
38     RK_U8   b_mask;
39     RK_U8   swap_8_in;
40     RK_U8   swap_16_in;
41     RK_U8   swap_32_in;
42 } VepuFormatCfg;
43 
44 typedef struct VepuStrideCfg_t {
45     MppFrameFormat fmt;
46     RK_S32  not_8_pixel;
47     RK_S32  is_pixel_stride;
48 
49     RK_U32  width;
50     RK_U32  stride;
51 
52     RK_U32  pixel_stride;
53     RK_U32  pixel_size;
54 } VepuStrideCfg;
55 
56 typedef struct VepuOffsetCfg_t {
57     /* input parameter */
58     MppFrameFormat fmt;
59     /* width / height by pixel */
60     RK_U32  width;
61     RK_U32  height;
62     /* stride by byte */
63     RK_U32  hor_stride;
64     RK_U32  ver_stride;
65     /* offset by pixel */
66     RK_U32  offset_x;
67     RK_U32  offset_y;
68 
69     /* output parameter */
70     /* offset by byte */
71     RK_U32  offset_byte[3];
72 
73     /* offset by pixel */
74     RK_U32  offset_pixel[3];
75 } VepuOffsetCfg;
76 
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 MPP_RET get_vepu_fmt(VepuFormatCfg *cfg, MppFrameFormat format);
82 RK_U32 get_vepu_pixel_stride(VepuStrideCfg *cfg, RK_U32 width,
83                              RK_U32 stride, MppFrameFormat fmt);
84 
85 MPP_RET get_vepu_offset_cfg(VepuOffsetCfg *cfg);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif
92