xref: /OK3568_Linux_fs/external/rockit/mpi/sdk/include/rk_comm_video.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* GPL-2.0 WITH Linux-syscall-note OR Apache 2.0 */
2 /* Copyright (c) 2021 Fuzhou Rockchip Electronics Co., Ltd */
3 
4 #ifndef INCLUDE_RT_MPI_RK_COMMON_VIDEO_H_
5 #define INCLUDE_RT_MPI_RK_COMMON_VIDEO_H_
6 
7 #include "rk_type.h"
8 #include "rk_common.h"
9 #include "rk_comm_mb.h"
10 
11 #ifdef __cplusplus
12 #if __cplusplus
13 extern "C" {
14 #endif
15 #endif /* __cplusplus */
16 
17 #define SRC_LENS_COEF_SEG  2
18 #define DST_LENS_COEF_SEG  3
19 #define SRC_LENS_COEF_NUM  4
20 #define DST_LENS_COEF_NUM  4
21 #define DST_LENS_COEF_SEG_POINT  (DST_LENS_COEF_SEG - 1)
22 
23 #define RK_COLOR_YUV_Y_PLANE    0
24 #define RK_COLOR_YUV_UV_PLANE   1
25 #define RK_COLOR_RGB_PLANE      0
26 #define RK_MAX_COLOR_COMPONENT  2
27 
28 #define ISP_BAYER_CHN   (4)
29 
30 typedef enum rkOPERATION_MODE_E {
31     OPERATION_MODE_AUTO   = 0,
32     OPERATION_MODE_MANUAL = 1,
33     OPERATION_MODE_BUTT
34 } OPERATION_MODE_E;
35 
36 
37 /*Angle of rotation*/
38 typedef enum rkROTATION_E {
39     ROTATION_0        = 0,
40     ROTATION_90       = 1,
41     ROTATION_180      = 2,
42     ROTATION_270      = 3,
43     ROTATION_BUTT
44 } ROTATION_E;
45 
46 typedef enum rkMIRROR_E {
47     MIRROR_NONE       = 0,
48     MIRROR_HORIZONTAL = 1,  /* RW; MIRROR */
49     MIRROR_VERTICAL   = 2,  /* RW; FLIP */
50     MIRROR_BOTH       = 3,  /* RW; MIRROR and FLIP */
51     MIRROR_BUTT
52 } MIRROR_E;
53 
54 typedef enum rkMB_SOURCE_E {
55     MB_SOURCE_COMMON  = 0,
56     MB_SOURCE_MODULE  = 1,
57     MB_SOURCE_PRIVATE = 2,
58     MB_SOURCE_USER    = 3,
59     MB_SOURCE_BUTT
60 } MB_SOURCE_E;
61 
62 typedef enum rkDATA_RATE_E {
63     DATA_RATE_X1 = 0,         /* RW; output 1 pixel per clock */
64     DATA_RATE_X2 = 1,         /* RW; output 2 pixel per clock */
65 
66     DATA_RATE_BUTT
67 } DATA_RATE_E;
68 
69 typedef struct rkBORDER_S {
70     RK_U32 u32TopWidth;
71     RK_U32 u32BottomWidth;
72     RK_U32 u32LeftWidth;
73     RK_U32 u32RightWidth;
74     RK_U32 u32Color;
75 } BORDER_S;
76 
77 typedef struct rkPOINT_S {
78     RK_S32 s32X;
79     RK_S32 s32Y;
80 } POINT_S;
81 
82 typedef struct rkSIZE_S {
83     RK_U32 u32Width;
84     RK_U32 u32Height;
85 } SIZE_S;
86 
87 typedef struct rkRECT_S {
88     RK_S32 s32X;
89     RK_S32 s32Y;
90     RK_U32 u32Width;
91     RK_U32 u32Height;
92 } RECT_S;
93 
94 typedef struct rkVIDEO_REGION_INFO_S {
95     RK_U32           u32RegionNum;       /* W; count of the region */
96     RECT_S ATTRIBUTE* pstRegion;         /* W; region attribute */
97 } VIDEO_REGION_INFO_S;
98 
99 typedef struct rkCROP_INFO_S {
100     RK_BOOL bEnable;
101     RECT_S  stRect;
102 } CROP_INFO_S;
103 
104 typedef struct rkFRAME_RATE_CTRL_S {
105     RK_S32  s32SrcFrameRate;        /* RW; source frame rate */
106     RK_S32  s32DstFrameRate;        /* RW; dest frame rate */
107 } FRAME_RATE_CTRL_S;
108 
109 typedef enum rkASPECT_RATIO_E {
110     ASPECT_RATIO_NONE   = 0,        /* full screen */
111     ASPECT_RATIO_AUTO   = 1,        /* ratio no change, 1:1*/
112     ASPECT_RATIO_MANUAL = 2,        /* ratio manual set */
113     ASPECT_RATIO_BUTT
114 } ASPECT_RATIO_E;
115 
116 typedef struct rkASPECT_RATIO_S {
117     ASPECT_RATIO_E enMode;          /* aspect ratio mode: none/auto/manual */
118     RK_U32         u32BgColor;      /* background color, RGB 888 */
119     RECT_S         stVideoRect;     /* valid in ASPECT_RATIO_MANUAL mode */
120 } ASPECT_RATIO_S;
121 
122 #define RK_VIDEO_FMT_MASK                   0x000f0000
123 #define RK_VIDEO_FMT_YUV                    0x00000000
124 #define RK_VIDEO_FMT_RGB                    0x00010000
125 #define RK_VIDEO_FMT_BAYER                  0X00020000
126 
127 typedef enum rkPIXEL_FORMAT_E {
128     RK_FMT_YUV420SP         = RK_VIDEO_FMT_YUV,        /* YYYY... UV...            */
129     RK_FMT_YUV420SP_10BIT,
130     RK_FMT_YUV422SP,                                   /* YYYY... UVUV...          */
131     RK_FMT_YUV422SP_10BIT,                             ///< Not part of ABI
132     RK_FMT_YUV420P,                                    /* YYYY... UUUU... VVVV     */
133     RK_FMT_YUV420P_VU,                                 /* YYYY... VVVV... UUUU     */
134     RK_FMT_YUV420SP_VU,                                /* YYYY... VUVUVU...        */
135     RK_FMT_YUV422P,                                    /* YYYY... UUUU... VVVV     */
136     RK_FMT_YUV422SP_VU,                                /* YYYY... VUVUVU...        */
137     RK_FMT_YUV422_YUYV,                                /* YUYVYUYV...              */
138     RK_FMT_YUV422_UYVY,                                /* UYVYUYVY...              */
139     RK_FMT_YUV400SP,                                   /* YYYY...                  */
140     RK_FMT_YUV440SP,                                   /* YYYY... UVUV...          */
141     RK_FMT_YUV411SP,                                   /* YYYY... UV...            */
142     RK_FMT_YUV444,                                     /* YUVYUVYUV...             */
143     RK_FMT_YUV444SP,                                   /* YYYY... UVUVUVUV...      */
144     RK_FMT_YUV444P,                                    /* YYYY... UUUU... VVVV     */
145     RK_FMT_YUV422_YVYU,                                /* YVYUYVYU...              */
146     RK_FMT_YUV422_VYUY,                                /* VYUYVYUY...              */
147     RK_FMT_YUV_BUTT,
148 
149     RK_FMT_RGB565          = RK_VIDEO_FMT_RGB,         /* 16-bit RGB               */
150     RK_FMT_BGR565,                                     /* 16-bit RGB               */
151     RK_FMT_RGB555,                                     /* 15-bit RGB               */
152     RK_FMT_BGR555,                                     /* 15-bit RGB               */
153     RK_FMT_RGB444,                                     /* 12-bit RGB               */
154     RK_FMT_BGR444,                                     /* 12-bit RGB               */
155     RK_FMT_RGB888,                                     /* 24-bit RGB               */
156     RK_FMT_BGR888,                                     /* 24-bit RGB               */
157     RK_FMT_RGB101010,                                  /* 30-bit RGB               */
158     RK_FMT_BGR101010,                                  /* 30-bit RGB               */
159     RK_FMT_ARGB1555,                                   /* 16-bit RGB               */
160     RK_FMT_ABGR1555,                                   /* 16-bit RGB               */
161     RK_FMT_ARGB4444,                                   /* 16-bit RGB               */
162     RK_FMT_ABGR4444,                                   /* 16-bit RGB               */
163     RK_FMT_ARGB8565,                                   /* 24-bit RGB               */
164     RK_FMT_ABGR8565,                                   /* 24-bit RGB               */
165     RK_FMT_ARGB8888,                                   /* 32-bit RGB               */
166     RK_FMT_ABGR8888,                                   /* 32-bit RGB               */
167     RK_FMT_BGRA8888,                                   /* 32-bit RGB               */
168     RK_FMT_RGBA8888,                                   /* 32-bit RGB               */
169     RK_FMT_RGBA5551,                                   /* 16-bit RGB               */
170     RK_FMT_BGRA5551,                                   /* 16-bit RGB               */
171     RK_FMT_BGRA4444,                                   /* 16-bit RGB               */
172     RK_FMT_RGBA4444,                                   /* 16-bit RGB               */
173     RK_FMT_XBGR8888,                                   /* 32-bit RGB               */
174     RK_FMT_RGB_BUTT,
175 
176     RK_FMT_2BPP,
177 
178     RK_FMT_RGB_BAYER_SBGGR_8BPP = RK_VIDEO_FMT_BAYER,  /* 8-bit raw                */
179     RK_FMT_RGB_BAYER_SGBRG_8BPP,                       /* 8-bit raw                */
180     RK_FMT_RGB_BAYER_SGRBG_8BPP,                       /* 8-bit raw                */
181     RK_FMT_RGB_BAYER_SRGGB_8BPP,                       /* 8-bit raw                */
182     RK_FMT_RGB_BAYER_SBGGR_10BPP,                      /* 10-bit raw               */
183     RK_FMT_RGB_BAYER_SGBRG_10BPP,                      /* 10-bit raw               */
184     RK_FMT_RGB_BAYER_SGRBG_10BPP,                      /* 10-bit raw               */
185     RK_FMT_RGB_BAYER_SRGGB_10BPP,                      /* 10-bit raw               */
186     RK_FMT_RGB_BAYER_SBGGR_12BPP,                      /* 12-bit raw               */
187     RK_FMT_RGB_BAYER_SGBRG_12BPP,                      /* 12-bit raw               */
188     RK_FMT_RGB_BAYER_SGRBG_12BPP,                      /* 12-bit raw               */
189     RK_FMT_RGB_BAYER_SRGGB_12BPP,                      /* 12-bit raw               */
190     RK_FMT_RGB_BAYER_14BPP,                            /* 14-bit raw               */
191     RK_FMT_RGB_BAYER_SBGGR_16BPP,                      /* 16-bit raw               */
192     RK_FMT_RGB_BAYER_BUTT,
193     RK_FMT_BUTT            = RK_FMT_RGB_BAYER_BUTT,
194 } PIXEL_FORMAT_E;
195 
196 typedef enum rkVIDEO_PROC_DEV_TYPE_E {
197     VIDEO_PROC_DEV_GPU = 0x0,       /* GPU device */
198     VIDEO_PROC_DEV_RGA = 0x1,       /* RGA device */
199 
200     VIDEO_PROC_DEV_BUTT
201 } VIDEO_PROC_DEV_TYPE_E;
202 
203 typedef enum rkVIDEO_FIELD_E {
204     VIDEO_FIELD_TOP         = 0x1,    /* even field */
205     VIDEO_FIELD_BOTTOM      = 0x2,    /* odd field */
206     VIDEO_FIELD_INTERLACED  = 0x3,    /* two interlaced fields */
207     VIDEO_FIELD_FRAME       = 0x4,    /* frame */
208 
209     VIDEO_FIELD_BUTT
210 } VIDEO_FIELD_E;
211 
212 typedef enum rkVIDEO_FORMAT_E {
213     VIDEO_FORMAT_LINEAR = 0,       /* nature video line */
214     VIDEO_FORMAT_TILE_64x16,       /* tile cell: 64pixel x 16line */
215     VIDEO_FORMAT_TILE_16x8,        /* tile cell: 16pixel x 8line */
216     VIDEO_FORMAT_LINEAR_DISCRETE,  /* The data bits are aligned in bytes */
217     VIDEO_FORMAT_BUTT
218 } VIDEO_FORMAT_E;
219 
220 typedef enum rkCOMPRESS_MODE_E {
221     COMPRESS_MODE_NONE = 0,   /* no compress */
222     COMPRESS_AFBC_16x16,
223 
224     COMPRESS_MODE_BUTT
225 } COMPRESS_MODE_E;
226 
227 typedef enum rkVIDEO_DISPLAY_MODE_E {
228     VIDEO_DISPLAY_MODE_PREVIEW  = 0x0,
229     VIDEO_DISPLAY_MODE_PLAYBACK = 0x1,
230 
231     VIDEO_DISPLAY_MODE_BUTT
232 } VIDEO_DISPLAY_MODE_E;
233 
234 typedef struct rkLUMA_INFO_S {
235     RK_U64 u64LumaPixSum;      /* Luma sum of current frame */
236     RK_U32 u32LumaPixAverage;  /* Luma average of current frame */
237     RK_U64 u64PTS;             /* PTS of current frame  */
238 } LUMA_INFO_S;
239 
240 #define LDCI_STAT_WND_X             24
241 #define LDCI_STAT_WND_Y             16
242 
243 #define DCF_DRSCRIPTION_LENGTH      32
244 #define DCF_CAPTURE_TIME_LENGTH     20
245 
246 typedef struct rkISP_DCF_CONST_INFO_S {
247     /* Describes image*/
248     RK_U8       au8ImageDescription[DCF_DRSCRIPTION_LENGTH];
249     /* Shows manufacturer of digital cameras*/
250     RK_U8       au8Make[DCF_DRSCRIPTION_LENGTH];
251     /* Shows model number of digital cameras*/
252     RK_U8       au8Model[DCF_DRSCRIPTION_LENGTH];
253     /* Shows firmware (internal software of digital cameras) version number*/
254     RK_U8       au8Software[DCF_DRSCRIPTION_LENGTH];
255     /*
256      * Light source, actually this means white balance setting.
257      * '0' means unknown, '1' daylight, '2' fluorescent, '3' tungsten,
258      * '10' flash, '17' standard light A, '18' standard light B,
259      * '19' standard light C, '20' D55, '21' D65, '22' D75, '255' other
260      */
261     RK_U8       u8LightSource;
262     /* Focal length of lens used to take image. Unit is millimeter*/
263     RK_U32      u32FocalLength;
264     /* Indicates the type of scene. Value '0x01' means that the image was directly photographed.*/
265     RK_U8       u8SceneType;
266     /*
267      * Indicates the use of special processing on image data,
268      * such as rendering geared to output.0 = Normal process
269      * 1 = Custom process
270      */
271     RK_U8       u8CustomRendered;
272     /* Indicates the equivalent focal length assuming a 35mm film camera, in mm*/
273     RK_U8       u8FocalLengthIn35mmFilm;
274     /*
275      * Indicates the type of scene that was shot. 0 = Standard,
276      * 1 = Landscape,2 = Portrait,3 = Night scene.
277      */
278     RK_U8       u8SceneCaptureType;
279     /*
280      * Indicates the degree of overall image gain adjustment.
281      * 0 = None,1 = Low gain up,2 = High gain up,
282      * 3 = Low gain down,4 = High gain down.
283      */
284     RK_U8       u8GainControl;
285     /*
286      * Indicates the direction of contrast processing applied
287      * by the camera when the image was shot.0 = Normal,1 = Soft,2 = Hard
288      */
289     RK_U8       u8Contrast;
290     /*
291      * Indicates the direction of saturation processing applied
292      * by the camera when the image was shot.
293      * 0 = Normal,1 = Low saturation,2 = High saturation
294      */
295     RK_U8       u8Saturation;
296     /*
297      * Indicates the direction of sharpness processing applied by
298      * the camera when the image was shot.0 = Normal,1 = Soft,2 = Hard
299      */
300     RK_U8       u8Sharpness;
301     /*
302      * Exposure metering method. '0' means unknown, '1' average,
303      * '2' center weighted average, '3'spot, '4' multi-spot,
304      * '5' multi-segment, '6' partial, '255' other
305      */
306     RK_U8       u8MeteringMode;
307 } ISP_DCF_CONST_INFO_S;
308 
309 typedef struct rkISP_DCF_UPDATE_INFO_S {
310     /* CCD sensitivity equivalent to Ag-Hr film speedrate*/
311     RK_U32      u32ISOSpeedRatings;
312     /* Exposure time (reciprocal of shutter speed).*/
313     RK_U32      u32ExposureTime;
314     /* Exposure bias (compensation) value of taking picture*/
315     RK_U32      u32ExposureBiasValue;
316     /*
317      * Exposure program that the camera used when image was taken.
318      * '1' means manual control, '2' program normal, '3' aperture priority,
319      * '4' shutter priority, '5' program creative (slow program),
320      * '6' program action(high-speed program), '7' portrait mode,
321      * '8' landscape mode
322      */
323     RK_U8       u8ExposureProgram;
324     /* The actual F-number (F-stop) of lens when the image was taken*/
325     RK_U32      u32FNumber;
326     /* Maximum aperture value of lens.*/
327     RK_U32      u32MaxApertureValue;
328     /*
329      * Indicates the exposure mode set when the image was shot.
330      * 0 = Auto exposure,1 = Manual exposure, 2 = Auto bracket
331      */
332     RK_U8       u8ExposureMode;
333     /*
334      * Indicates the white balance mode set when the image was shot.
335      * 0 = Auto white balance ,1 = Manual white balance
336      */
337     RK_U8       u8WhiteBalance;
338 } ISP_DCF_UPDATE_INFO_S;
339 
340 typedef struct rkISP_DCF_INFO_S {
341     ISP_DCF_CONST_INFO_S  stIspDCFConstInfo;
342     ISP_DCF_UPDATE_INFO_S stIspDCFUpdateInfo;
343 } ISP_DCF_INFO_S;
344 
345 typedef struct rkJPEG_DCF_S {
346     /* The date and time when the picture data was generated*/
347     RK_U8           au8CaptureTime[DCF_CAPTURE_TIME_LENGTH];
348     /* whether the picture is captured when a flash lamp is on*/
349     RK_BOOL         bFlash;
350     /*
351      * Indicates the digital zoom ratio when the image was shot.
352      * If the numerator of the recorded value is 0, this indicates
353      * that digital zoom was not used.
354      */
355     RK_U32          u32DigitalZoomRatio;
356     ISP_DCF_INFO_S  stIspDCFInfo;
357 } JPEG_DCF_S;
358 
359 typedef struct rkISP_FRAME_INFO_S {
360     RK_U32      u32ISO;                    /* ISP internal ISO : Again*Dgain*ISPgain */
361     RK_U32      u32ExposureTime;           /* Exposure time (reciprocal of shutter speed),unit is us */
362     RK_U32      u32IspDgain;
363     RK_U32      u32Again;
364     RK_U32      u32Dgain;
365     RK_U32      au32Ratio[3];
366     RK_U32      u32IspNrStrength;
367     RK_U32      u32FNumber;                /* The actual F-number (F-stop) of lens when the image was taken */
368     RK_U32      u32SensorID;               /* which sensor is used */
369     RK_U32      u32SensorMode;
370     RK_U32      u32HmaxTimes;              /* Sensor HmaxTimes,unit is ns */
371     RK_U32      u32Vmax;                   /* Sensor Vmax,unit is line */
372     RK_U32      u32VcNum;                  /* when dump wdr frame, which is long or short  exposure frame. */
373 } ISP_FRAME_INFO_S;
374 
375 #define CFACOLORPLANE     (3)
376 #define DNG_NP_SIZE       (6)
377 
378 typedef struct rkDNG_RATIONAL_S {
379     RK_U32 u32Numerator;/*represents the numerator of a fraction,*/
380     RK_U32 u32Denominator;/* the denominator. */
381 } DNG_RATIONAL_S;
382 
383 /*
384 Defines the structure of DNG image dynamic infomation
385 */
386 typedef struct rkDNG_IMAGE_DYNAMIC_INFO_S {
387     /* RO;Range: [0x0, 0xFFFF]; black level*/
388     RK_U32 au32BlackLevel[ISP_BAYER_CHN];
389     /*
390      * specifies the selected white balance at time of capture,
391      * encoded as the coordinates of a perfectly neutral
392      * color in linear reference space values.
393      */
394     DNG_RATIONAL_S astAsShotNeutral[CFACOLORPLANE];
395     /* RO;describes the amount of noise in a raw image */
396     RK_DOUBLE adNoiseProfile[DNG_NP_SIZE];
397 } DNG_IMAGE_DYNAMIC_INFO_S;
398 
399 
400 typedef struct rkISP_HDR_INFO_S {
401     RK_U32 u32ColorTemp;
402     RK_U16 au16CCM[9];
403     RK_U8  u8Saturation;
404 } ISP_HDR_INFO_S;
405 
406 typedef struct rkISP_ATTACH_INFO_S {
407     ISP_HDR_INFO_S     stIspHdr;
408     RK_U32 u32ISO;
409     RK_U8 u8SnsWDRMode;
410 } ISP_ATTACH_INFO_S;
411 
412 typedef enum rkFRAME_FLAG_E {
413     FRAME_FLAG_SNAP_FLASH  = 0x1 << 0,
414     FRAME_FLAG_SNAP_CUR    = 0x1 << 1,
415     FRAME_FLAG_SNAP_REF    = 0x1 << 2,
416     FRAME_FLAG_SNAP_END    = 0x1 << 31,
417     FRAME_FLAG_BUTT
418 } FRAME_FLAG_E;
419 
420 /* RGGB=4 */
421 #define ISP_WB_GAIN_NUM  4
422 /* 3*3=9 matrix */
423 #define ISP_CAP_CCM_NUM   9
424 
425 typedef struct rkISP_CONFIG_INFO_S {
426     RK_U32  u32ISO;
427     RK_U32  u32IspDgain;
428     RK_U32  u32ExposureTime;
429     RK_U32  au32WhiteBalanceGain[ISP_WB_GAIN_NUM];
430     RK_U32  u32ColorTemperature;
431     RK_U16  au16CapCCM[ISP_CAP_CCM_NUM];
432 } ISP_CONFIG_INFO_S;
433 
434 typedef struct rkVIDEO_SUPPLEMENT_S {
435     RK_U64   u64JpegDCFPhyAddr;
436     RK_U64   u64IspInfoPhyAddr;
437     RK_U64   u64LowDelayPhyAddr;
438     RK_U64   u64MotionDataPhyAddr;
439     RK_U64   u64FrameDNGPhyAddr;
440 
441     RK_VOID* ATTRIBUTE pJpegDCFVirAddr;        /* JPEG_DCF_S, used in JPEG DCF */
442     RK_VOID* ATTRIBUTE pIspInfoVirAddr;        /* ISP_FRAME_INFO_S, used in ISP debug, when get raw and send raw */
443     RK_VOID* ATTRIBUTE pLowDelayVirAddr;       /* used in low delay */
444     RK_VOID* ATTRIBUTE pMotionDataVirAddr;     /* vpss 3dnr use: gme motion data, Filter motion data, gyro data.*/
445     RK_VOID* ATTRIBUTE pFrameDNGVirAddr;
446 } VIDEO_SUPPLEMENT_S;
447 
448 typedef enum rkCOLOR_GAMUT_E {
449     COLOR_GAMUT_BT601 = 0,
450     COLOR_GAMUT_BT709,
451     COLOR_GAMUT_BT2020,
452     COLOR_GAMUT_USER,
453     COLOR_GAMUT_BUTT
454 } COLOR_GAMUT_E;
455 
456 typedef struct rkISP_COLORGAMMUT_INFO_S {
457         COLOR_GAMUT_E enColorGamut;
458 } ISP_COLORGAMMUT_INFO_S;
459 
460 typedef enum rkDYNAMIC_RANGE_E {
461     DYNAMIC_RANGE_SDR8 = 0,
462     DYNAMIC_RANGE_SDR10,
463     DYNAMIC_RANGE_HDR10,
464     DYNAMIC_RANGE_HLG,
465     DYNAMIC_RANGE_SLF,
466     DYNAMIC_RANGE_XDR,
467     DYNAMIC_RANGE_BUTT
468 } DYNAMIC_RANGE_E;
469 
470 typedef enum rkDATA_BITWIDTH_E {
471     DATA_BITWIDTH_8 = 0,
472     DATA_BITWIDTH_10,
473     DATA_BITWIDTH_12,
474     DATA_BITWIDTH_14,
475     DATA_BITWIDTH_16,
476     DATA_BITWIDTH_BUTT
477 } DATA_BITWIDTH_E;
478 
479 typedef struct rkVIDEO_FRAME_S {
480     MB_BLK              pMbBlk;
481     RK_U32              u32Width;
482     RK_U32              u32Height;
483     RK_U32              u32VirWidth;
484     RK_U32              u32VirHeight;
485     VIDEO_FIELD_E       enField;
486     PIXEL_FORMAT_E      enPixelFormat;
487     VIDEO_FORMAT_E      enVideoFormat;
488     COMPRESS_MODE_E     enCompressMode;
489     DYNAMIC_RANGE_E     enDynamicRange;
490     COLOR_GAMUT_E       enColorGamut;
491 
492     RK_VOID            *pVirAddr[RK_MAX_COLOR_COMPONENT];
493 
494     RK_U32              u32TimeRef;
495     RK_U64              u64PTS;
496 
497     RK_U64              u64PrivateData;
498     RK_U32              u32FrameFlag;     /* FRAME_FLAG_E, can be OR operation. */
499 } VIDEO_FRAME_S;
500 
501 typedef struct rkVIDEO_FRAME_INFO_S {
502     VIDEO_FRAME_S stVFrame;
503 } VIDEO_FRAME_INFO_S;
504 
505 typedef struct rkMB_PIC_CAL_S {
506     RK_U32 u32MBSize;
507     RK_U32 u32VirWidth;
508     RK_U32 u32VirHeight;
509 } MB_PIC_CAL_S;
510 
511 typedef struct rkPIC_BUF_ATTR_S {
512     RK_U32 u32Width;
513     RK_U32 u32Height;
514     PIXEL_FORMAT_E enPixelFormat;
515     COMPRESS_MODE_E enCompMode;
516 } PIC_BUF_ATTR_S;
517 
518 typedef struct rkVDEC_PIC_BUF_ATTR_S {
519     RK_CODEC_ID_E enCodecType;
520     PIC_BUF_ATTR_S stPicBufAttr;
521 } VDEC_PIC_BUF_ATTR_S;
522 
523 typedef struct rkBITMAP_S {
524     PIXEL_FORMAT_E enPixelFormat;  /* Bitmap's pixel format */
525     RK_U32 u32Width;               /* Bitmap's width */
526     RK_U32 u32Height;              /* Bitmap's height */
527     RK_VOID* ATTRIBUTE pData;      /* Address of Bitmap's data */
528 } BITMAP_S;
529 
530 typedef struct rkLDC_ATTR_S {
531     /* RW;Range: [0, 1];Whether aspect ration  is keep */
532     RK_BOOL    bAspect;
533     /* RW; Range: [0, 100]; field angle ration of  horizontal,valid when bAspect=0.*/
534     RK_S32     s32XRatio;
535     /* RW; Range: [0, 100]; field angle ration of  vertical,valid when bAspect=0.*/
536     RK_S32     s32YRatio;
537     /* RW; Range: [0, 100]; field angle ration of  all,valid when bAspect=1.*/
538     RK_S32     s32XYRatio;
539     /* RW; Range: [-511, 511]; horizontal offset of the image distortion center relative to image center.*/
540     RK_S32 s32CenterXOffset;
541     /* RW; Range: [-511, 511]; vertical offset of the image distortion center relative to image center.*/
542     RK_S32 s32CenterYOffset;
543     /* RW; Range: [-300, 500]; LDC Distortion ratio.When spread on,s32DistortionRatio range should be [0, 500]*/
544     RK_S32 s32DistortionRatio;
545 } LDC_ATTR_S;
546 
547 typedef struct rkLDCV2_ATTR_S {
548     /* RW; focal length in horizontal direction, with 2 decimal numbers */
549     RK_S32 s32FocalLenX;
550     /* RW; focal length in vertical direction, with 2 decimal numbers */
551     RK_S32 s32FocalLenY;
552     /* RW; coordinate of image center, with 2 decimal numbers */
553     RK_S32 s32CoorShiftX;
554     /* RW; Y coordinate of image center, with 2 decimal numbers */
555     RK_S32 s32CoorShiftY;
556     /* RW; lens distortion coefficients of the source image, with 5 decimal numbers */
557     RK_S32 as32SrcCaliRatio[SRC_LENS_COEF_SEG][SRC_LENS_COEF_NUM];
558     /* RW; Junction Point of the two segments */
559     RK_S32 s32SrcJunPt;
560     /* RW; lens distortion coefficients, with 5 decimal numbers */
561     RK_S32 as32DstCaliRatio[DST_LENS_COEF_SEG][DST_LENS_COEF_NUM];
562     /* RW; Junction Point of the three segments */
563     RK_S32 as32DstJunPt[DST_LENS_COEF_SEG_POINT];
564     /* RW; max undistorted distance before 3rd polynomial drop, with 16bits decimal */
565     RK_S32 s32MaxDu;
566 } LDCV2_ATTR_S;
567 
568 typedef enum rkLDC_VIEW_TYPE_E {
569     /*
570      * View scale all but x and y independtly, this will keep
571      * both x and y axis ,but corner maybe lost
572      */
573     LDC_VIEW_TYPE_ALL  = 0,
574     /* Not use view scale, this will lost some side and corner */
575     LDC_VIEW_TYPE_CROP = 1,
576 
577     LDC_VIEW_TYPE_BUTT,
578 } LDC_VIEW_TYPE_E;
579 
580 typedef struct rkLDCV3_ATTR_S {
581     /* RW; Range: [0, 1], 0: all mode, 1: crop mode.*/
582     LDC_VIEW_TYPE_E enViewType;
583     /*
584      * RW; Range: ABS(s32CenterXOffset)->[0, min(128, width*0.08)],
585      * horizontal offset of the image distortion center relative to image center.
586      */
587     RK_S32 s32CenterXOffset;
588     /*
589      * RW; Range: ABS(s32CenterXOffset)->[0, min(128, height*0.08)],
590      * vertical offset of the image distortion center relative to image center.
591      */
592     RK_S32 s32CenterYOffset;
593     /* RW; Range: [-300, 300], LDC Distortion ratio.*/
594     RK_S32 s32DistortionRatio;
595     /*
596      * RW; Range: [-300, 300], to remove the black region around when
597      * performing pinchusion distortion correction with crop mode.
598      */
599     RK_S32 s32MinRatio;
600 } LDCV3_ATTR_S;
601 
602 typedef enum rkROTATION_VIEW_TYPE_E {
603     ROTATION_VIEW_TYPE_ALL      = 0, /* View all source Image,no lose*/
604     ROTATION_VIEW_TYPE_TYPICAL  = 1, /* View from rotation Image with source size,same lose*/
605     ROTATION_VIEW_TYPE_INSIDE   = 2, /* View with no black section,all  in dest Image*/
606     ROTATION_VIEW_TYPE_BUTT,
607 } ROTATION_VIEW_TYPE_E;
608 
609 typedef struct rkROTATION_EX_S {
610     /* RW;Range: [0, 2];Rotation mode*/
611     ROTATION_VIEW_TYPE_E enViewType;
612     /* RW;Range: [0,360];Rotation Angle:[0,360]*/
613     RK_U32               u32Angle;
614     /*
615      * RW;Range: [-511, 511];Horizontal offset of the image
616      * distortion center relative to image center.
617      */
618     RK_S32               s32CenterXOffset;
619     /*
620      * RW;Range: [-511, 511];Vertical offset of the image
621      * distortion center relative to image center.
622      */
623     RK_S32               s32CenterYOffset;
624     /* RW;Dest size of any angle rotation*/
625     SIZE_S               stDestSize;
626 } ROTATION_EX_S;
627 
628 
629 typedef enum rkWDR_MODE_E {
630     WDR_MODE_NONE = 0,
631     WDR_MODE_BUILT_IN,
632     WDR_MODE_QUDRA,
633 
634     WDR_MODE_2To1_LINE,
635     WDR_MODE_2To1_FRAME,
636     WDR_MODE_2To1_FRAME_FULL_RATE,
637 
638     WDR_MODE_3To1_LINE,
639     WDR_MODE_3To1_FRAME,
640     WDR_MODE_3To1_FRAME_FULL_RATE,
641 
642     WDR_MODE_4To1_LINE,
643     WDR_MODE_4To1_FRAME,
644     WDR_MODE_4To1_FRAME_FULL_RATE,
645 
646     WDR_MODE_BUTT,
647 } WDR_MODE_E;
648 
649 typedef enum rkFRAME_INTERRUPT_TYPE_E {
650     FRAME_INTERRUPT_START,
651     FRAME_INTERRUPT_EARLY,
652     FRAME_INTERRUPT_EARLY_END,
653     FRAME_INTERRUPT_BUTT,
654 } FRAME_INTERRUPT_TYPE_E;
655 
656 typedef struct rkFRAME_INTERRUPT_ATTR_S {
657     FRAME_INTERRUPT_TYPE_E enIntType;
658     RK_U32 u32EarlyLine;
659 } FRAME_INTERRUPT_ATTR_S;
660 
661 #ifdef __cplusplus
662 #if __cplusplus
663 }
664 #endif
665 #endif /* __cplusplus */
666 
667 #endif /* INCLUDE_RT_MPI_RK_COMMON_VIDEO_H_ */
668 
669