NV12_resize.h revision 72b0d2814165e633385bd87a838fc9c3a8250113
1#ifndef NV12_RESIZE_H_
2#define NV12_RESIZE_H_
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8typedef unsigned char       mmBool;
9typedef unsigned char       mmUchar;
10typedef unsigned char       mmUint8;
11typedef unsigned char       mmByte;
12typedef unsigned short      mmUint16;
13typedef unsigned int        mmUint32;
14typedef unsigned long       mmUint64;
15typedef signed char         mmInt8;
16typedef char		        mmChar;
17typedef signed short        mmInt16;
18typedef signed int          mmInt32;
19typedef signed long         mmLong;
20typedef signed int          mmHandle;
21typedef float        mmFloat;
22typedef double       mmDouble;
23typedef int 		    HObj;
24typedef HObj		    HFile;
25typedef int 		    HDir;
26typedef void* mmMutexHandle;
27typedef struct _fstat
28{
29      mmInt32 fileSize;
30}VE_FileAttribute;
31
32typedef struct
33{
34	mmInt32		second;
35	mmInt32 	millisecond;
36}tsVE_Time;
37
38typedef struct
39{
40	mmInt32 	year;
41	mmInt32 	month;
42	mmInt32 	day;
43	mmInt32 	hour;
44	mmInt32 	minute;
45	mmInt32 	second;
46} TmDateTime;
47
48/*----------------------------------------------------------------------------
49    Define : TRUE/FALSE for boolean operations
50----------------------------------------------------------------------------*/
51
52#ifndef TRUE
53    #define TRUE    1
54#endif
55
56#ifndef FALSE
57    #define FALSE   0
58#endif
59
60#ifndef NULL
61   #define NULL        0
62#endif
63
64const mmUint8 bWeights[8][8][4] = {
65  {{64, 0, 0, 0}, {56, 0, 0, 8}, {48, 0, 0,16}, {40, 0, 0,24},
66   {32, 0, 0,32}, {24, 0, 0,40}, {16, 0, 0,48}, { 8, 0, 0,56}},
67
68  {{56, 8, 0, 0}, {49, 7, 1, 7}, {42, 6, 2,14}, {35, 5, 3,21},
69   {28, 4, 4,28}, {21, 3, 5,35}, {14, 2, 6,42}, { 7, 1, 7,49}},
70
71  {{48,16, 0, 0}, {42,14, 2, 6}, {36,12,4 ,12}, {30,10,6 ,18},
72   {24, 8, 8,24}, {18, 6,10,30}, {12,4 ,12,36}, { 6, 2,14,42}},
73
74  {{40,24,0 ,0 }, {35,21, 3, 5}, {30,18, 6,10}, {25,15, 9,15},
75   {20,12,12,20}, {15, 9,15,25}, {10, 6,18,30}, { 5, 3,21,35}},
76
77  {{32,32, 0,0 }, {28,28, 4, 4}, {24,24, 8, 8}, {20,20,12,12},
78   {16,16,16,16}, {12,12,20,20}, { 8, 8,24,24}, { 4, 4,28,28}},
79
80  {{24,40,0 ,0 }, {21,35, 5, 3}, {18,30,10, 6}, {15,25,15, 9},
81   {12,20,20,12}, { 9,15,25,15}, { 6,10,30,18}, { 3, 5,35,21}},
82
83  {{16,48, 0,0 }, {14,42, 6, 2}, {12,36,12, 4}, {10,30,18, 6},
84   {8 ,24,24,8 }, { 6,18,30,10}, { 4,12,36,12}, { 2, 6,42,14}},
85
86  {{ 8,56, 0,0 }, { 7,49, 7, 1}, { 6,42,14, 2}, { 5,35,21, 3},
87   { 4,28,28,4 }, { 3,21,35, 5}, { 2,14,42, 6}, { 1,7 ,49, 7}}
88};
89
90typedef enum
91{
92    IC_FORMAT_NONE,
93    IC_FORMAT_RGB565,
94    IC_FORMAT_RGB888,
95    IC_FORMAT_YCbCr420_lp,
96    IC_FORMAT_YCbCr,
97    IC_FORMAT_YCbCr420_FRAME_PK,
98    IC_FORMAT_MAX
99}enumImageFormat;
100
101/* This structure defines the format of an image */
102typedef struct
103{
104  mmInt32                       uWidth;
105  mmInt32                       uHeight;
106  enumImageFormat               eFormat;
107  mmByte                        *imgPtr;
108  mmByte                        *clrPtr;
109  mmInt32                       uOffset;
110} structConvImage;
111
112typedef struct IC_crop_struct
113{
114  mmUint32 x;             /* x pos of rectangle                              */
115  mmUint32 y;             /* y pos of rectangle                              */
116  mmUint32 uWidth;        /* dx of rectangle                                 */
117  mmUint32 uHeight;       /* dy of rectangle                                 */
118} IC_rect_type;
119
120/*==========================================================================
121* Function Name  : VT_resizeFrame_Video_opt2_lp
122*
123* Description    : Resize a yuv frame.
124*
125* Input(s)       : input_img_ptr        -> Input Image Structure
126*                : output_img_ptr       -> Output Image Structure
127*                : cropout             -> crop structure
128*
129* Value Returned : mmBool               -> FALSE on error TRUE on success
130* NOTE:
131*            Not tested for crop funtionallity.
132*            faster version.
133============================================================================*/
134mmBool
135VT_resizeFrame_Video_opt2_lp
136(
137 structConvImage* i_img_ptr,        /* Points to the input image           */
138 structConvImage* o_img_ptr,        /* Points to the output image          */
139 IC_rect_type*  cropout,          /* how much to resize to in final image */
140 mmUint16 dummy                         /* Transparent pixel value              */
141 );
142
143#ifdef __cplusplus
144}
145#endif
146
147#endif //#define NV12_RESIZE_H_
148