• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  #ifndef NV12_RESIZE_H_
2  #define NV12_RESIZE_H_
3  
4  #ifdef __cplusplus
5  extern "C" {
6  #endif
7  
8  typedef unsigned char       mmBool;
9  typedef unsigned char       mmUchar;
10  typedef unsigned char       mmUint8;
11  typedef unsigned char       mmByte;
12  typedef unsigned short      mmUint16;
13  typedef unsigned int        mmUint32;
14  typedef unsigned long       mmUint64;
15  typedef signed char         mmInt8;
16  typedef char		        mmChar;
17  typedef signed short        mmInt16;
18  typedef signed int          mmInt32;
19  typedef signed long         mmLong;
20  typedef signed int          mmHandle;
21  typedef float        mmFloat;
22  typedef double       mmDouble;
23  typedef int 		    HObj;
24  typedef HObj		    HFile;
25  typedef int 		    HDir;
26  typedef void* mmMutexHandle;
27  typedef struct _fstat
28  {
29        mmInt32 fileSize;
30  }VE_FileAttribute;
31  
32  typedef struct
33  {
34  	mmInt32		second;
35  	mmInt32 	millisecond;
36  }tsVE_Time;
37  
38  typedef 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  
64  const 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  
90  typedef 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 */
102  typedef struct
103  {
104    mmInt32                       uWidth;
105    mmInt32                       uHeight;
106    mmInt32                       uStride;
107    enumImageFormat               eFormat;
108    mmByte                        *imgPtr;
109    mmByte                        *clrPtr;
110    mmInt32                       uOffset;
111  } structConvImage;
112  
113  typedef struct IC_crop_struct
114  {
115    mmUint32 x;             /* x pos of rectangle                              */
116    mmUint32 y;             /* y pos of rectangle                              */
117    mmUint32 uWidth;        /* dx of rectangle                                 */
118    mmUint32 uHeight;       /* dy of rectangle                                 */
119  } IC_rect_type;
120  
121  /*==========================================================================
122  * Function Name  : VT_resizeFrame_Video_opt2_lp
123  *
124  * Description    : Resize a yuv frame.
125  *
126  * Input(s)       : input_img_ptr        -> Input Image Structure
127  *                : output_img_ptr       -> Output Image Structure
128  *                : cropout             -> crop structure
129  *
130  * Value Returned : mmBool               -> FALSE on error TRUE on success
131  * NOTE:
132  *            Not tested for crop funtionallity.
133  *            faster version.
134  ============================================================================*/
135  mmBool
136  VT_resizeFrame_Video_opt2_lp
137  (
138   structConvImage* i_img_ptr,        /* Points to the input image           */
139   structConvImage* o_img_ptr,        /* Points to the output image          */
140   IC_rect_type*  cropout,          /* how much to resize to in final image */
141   mmUint16 dummy                         /* Transparent pixel value              */
142   );
143  
144  #ifdef __cplusplus
145  }
146  #endif
147  
148  #endif //#define NV12_RESIZE_H_
149