1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Header file for definitions and common structures for |
|
17 * compressed domain transcoding. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef INCLUDE_COMMON |
|
23 #define INCLUDE_COMMON |
|
24 |
|
25 /* |
|
26 * Includes |
|
27 */ |
|
28 # include "epoclib.h" |
|
29 |
|
30 /* |
|
31 * Defines |
|
32 */ |
|
33 |
|
34 /* General */ |
|
35 #define E_SUCCESS 0 |
|
36 #define E_FAILURE (-1) |
|
37 #define NULL 0 |
|
38 |
|
39 /* Data */ |
|
40 #define MB_SIZE 16 |
|
41 #define BLOCK_SIZE 8 |
|
42 #define LOG_BLOCK_WIDTH 3 |
|
43 #define BLOCK_COEFF_SIZE 64 |
|
44 |
|
45 /* Bit stream formating */ |
|
46 #define MOTION_MARKER 0x1F001 |
|
47 #define DC_MARKER 0x6B001 |
|
48 #define DC_MARKER_LENGTH 19 |
|
49 #define MOTION_MARKER_LENGTH 17 |
|
50 |
|
51 /* Codes */ |
|
52 #define VISUAL_OBJECT_SEQUENCE_START_CODE 0x1B0 |
|
53 #define VISUAL_OBJECT_SEQUENCE_END_CODE 0x1B1 |
|
54 #define VIDEO_OBJECT_START_CODE 0x0100 |
|
55 #define VIDEO_OBJECT_LAYER_START_CODE 0x120 |
|
56 #define USER_DATA_START_CODE 0x1B2 |
|
57 #define GROUP_OF_VOP_START_CODE 0x1B3 |
|
58 #define VISUAL_OBJECT_START_CODE 0x1B5 |
|
59 #define VOP_START_CODE 0x1B6 |
|
60 #define PROFILE_LEVEL 0x3 |
|
61 #define VISUAL_OBJECT 0x1 |
|
62 #define SIMPLE_OBJECT 0x1 |
|
63 #define ASPECT_RATIO_INFO 0x1 |
|
64 #define CHROMA_FORMAT 0x1 |
|
65 #define RECTANGULAR 0x0 |
|
66 #define MARKER_BIT 1 |
|
67 #define SHORT_VIDEO_START_MARKER 0x20 |
|
68 #define SHORT_VIDEO_END_MARKER 0x3F |
|
69 #define GOB_RESYNC_MARKER 0x01 |
|
70 |
|
71 /* Quantization */ |
|
72 #define MAX_SAT_VAL_SVH 127 |
|
73 #define MIN_SAT_VAL_SVH -127 |
|
74 #define FIXED_PT_BITS 16 |
|
75 |
|
76 /* Variable length encoding */ |
|
77 #define NOT_VALID 65535 |
|
78 #define ESCAPE_CODE_VLC 0x03 |
|
79 #define ESCAPE_CODE_LENGTH_VLC 7 |
|
80 |
|
81 /* Constant multipliers */ |
|
82 #define TAN_PI_BY_8 27145 |
|
83 #define TAN_PI_BY_16 13036 |
|
84 #define TAN_3PI_BY_16 43789 |
|
85 #define COS_PI_BY_4 46340 |
|
86 #define COS_PI_BY_8 60546 |
|
87 #define COS_PI_BY_16 64276 |
|
88 #define COS_3PI_BY_16 54490 |
|
89 |
|
90 /* Shift amount and corresponding rounding constants for DCT */ |
|
91 #define DCT_PRECISION 16 |
|
92 #define DCT_ROUND 0 /*32768*/ /* 2^(DCT_PRECISION - 1) */ |
|
93 #define DCT_KEPT_PRECISION 1 |
|
94 #define DCT_PRECISION_PLUS_KEPT 19 /* DCT_PRECISION + 2 + DCT_KEPT_PRECISION */ |
|
95 #define DCT_ROUND_PLUS_KEPT 0 /*262144*/ /* 2^(DCT_PRECISION_PLUS_KEPT - 1) */ |
|
96 |
|
97 |
|
98 /* Macros */ |
|
99 #define ABS(x) ((x) >= 0 ? (x) :-(x)) |
|
100 |
|
101 /* |
|
102 * Enumerations |
|
103 */ |
|
104 enum { |
|
105 INTRA, |
|
106 INTER |
|
107 }; |
|
108 |
|
109 enum { |
|
110 ONEMV, |
|
111 FOURMV |
|
112 }; |
|
113 |
|
114 enum { |
|
115 I_VOP, |
|
116 P_VOP |
|
117 }; |
|
118 |
|
119 enum { |
|
120 H263, |
|
121 MPEG4 |
|
122 }; |
|
123 |
|
124 enum { |
|
125 OFF, |
|
126 ON |
|
127 }; |
|
128 |
|
129 enum { |
|
130 CODE_FOUND, |
|
131 CODE_NOT_FOUND |
|
132 }; |
|
133 |
|
134 |
|
135 /* |
|
136 * Structs and typedefs |
|
137 */ |
|
138 typedef unsigned char tBool; |
|
139 /* Typedef for 8 bit pixel */ |
|
140 typedef u_int8 tPixel; |
|
141 |
|
142 /* Macroblock position in yuv frame data */ |
|
143 typedef struct{ |
|
144 tPixel *yFrame; |
|
145 u_int32 yFrameWidth; |
|
146 tPixel *uFrame; |
|
147 u_int32 uFrameWidth; |
|
148 tPixel *vFrame; |
|
149 u_int32 vFrameWidth; |
|
150 } tMBPosInYUVFrame; |
|
151 |
|
152 /* Motion vector information */ |
|
153 typedef struct{ |
|
154 int16 mvx; |
|
155 int16 mvy; |
|
156 u_int32 SAD; |
|
157 } tMotionVector; |
|
158 |
|
159 /* Macroblock information */ |
|
160 typedef struct |
|
161 { |
|
162 int16 MV[4][2]; |
|
163 u_int32 SAD; |
|
164 int16 QuantScale; |
|
165 int16 CodedBlockPattern; |
|
166 int16 dQuant; |
|
167 int16 SkippedMB; |
|
168 } tMBInfo; |
|
169 |
|
170 /* Macroblock position */ |
|
171 typedef struct{ |
|
172 u_int32 x; |
|
173 u_int32 y; |
|
174 int32 LeftBound; |
|
175 int32 RightBound; |
|
176 int32 TopBound; |
|
177 int32 BottomBound; |
|
178 } tMBPosition; |
|
179 |
|
180 /* Macroblock data (16x16 Y, 8x8 UV) */ |
|
181 typedef struct{ |
|
182 int16 Data[384]; |
|
183 } tMacroblockData; |
|
184 |
|
185 #endif /* INCLUDE_COMMON */ |
|