mp4def.h revision 59f566c4ec3dfc097ad8163523e522280b27e5c3
1/* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
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
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18#ifndef _PVDECDEF_H_
19#define _PVDECDEF_H_
20
21#include <stdlib.h>
22#include <string.h>
23
24// Redefine the int types
25typedef uint8_t uint8;
26typedef uint16_t uint16;
27typedef int16_t int16;
28typedef uint32_t uint32;
29typedef int32_t int32;
30typedef unsigned int uint;
31
32/********** platform dependent in-line assembly *****************************/
33
34/*************** Intel *****************/
35
36/*************** ARM *****************/
37/* for general ARM instruction. #define __ARM has to be defined in compiler set up.*/
38/* for DSP MUL */
39#ifdef __TARGET_FEATURE_DSPMUL
40#define _ARM_DSP_MUL
41#endif
42
43/* for Count Leading Zero instruction */
44#ifdef __TARGET_ARCH_5T
45#define _ARM_CLZ
46#endif
47#ifdef __TARGET_ARCH_5TE
48#define _ARM_CLZ
49#endif
50/****************************************************************************/
51
52#ifndef _PV_TYPES_
53#define _PV_TYPES_
54typedef unsigned char UChar;
55typedef char Char;
56typedef unsigned int UInt;
57typedef int Int;
58typedef unsigned short UShort;
59typedef short Short;
60typedef short int SInt;
61typedef unsigned int Bool;
62typedef unsigned long   ULong;
63typedef void Void;
64
65#define PV_CODEC_INIT       0
66#define PV_CODEC_STOP       1
67#define PV_CODEC_RUNNING    2
68#define PV_CODEC_RESET      3
69#endif
70
71typedef enum
72{
73    PV_SUCCESS,
74    PV_FAIL,
75    PV_EOS,             /* hit End_Of_Sequence     */
76    PV_MB_STUFFING,     /* hit Macroblock_Stuffing */
77    PV_END_OF_VOP,      /* hit End_of_Video_Object_Plane */
78    PV_END_OF_MB,       /* hit End_of_Macroblock */
79    PV_END_OF_BUF       /* hit End_of_Bitstream_Buffer */
80} PV_STATUS;
81
82typedef UChar PIXEL;
83//typedef Int MOT;   /* : "int" type runs faster on RISC machine */
84
85#define HTFM            /*  3/2/01, Hypothesis Test Fast Matching for early drop-out*/
86//#define _MOVE_INTERFACE
87
88//#define RANDOM_REFSELCODE
89
90/* handle the case of devision by zero in RC */
91#define MAD_MIN 1
92
93/* 4/11/01, if SSE or MMX, no HTFM, no SAD_HP_FLY */
94
95/* Code size reduction related Macros */
96#ifdef H263_ONLY
97#ifndef NO_RVLC
98#define NO_RVLC
99#endif
100#ifndef NO_MPEG_QUANT
101#define NO_MPEG_QUANT
102#endif
103#ifndef NO_INTER4V
104#define NO_INTER4V
105#endif
106#endif
107/**************************************/
108
109#define TRUE    1
110#define FALSE   0
111
112#define PV_ABS(x)       (((x)<0)? -(x) : (x))
113#define PV_SIGN(x)      (((x)<0)? -1 : 1)
114#define PV_SIGN0(a)     (((a)<0)? -1 : (((a)>0) ? 1 : 0))
115#define PV_MAX(a,b)     ((a)>(b)? (a):(b))
116#define PV_MIN(a,b)     ((a)<(b)? (a):(b))
117
118#define MODE_INTRA      0
119#define MODE_INTER      1
120#define MODE_INTRA_Q    2
121#define MODE_INTER_Q    3
122#define MODE_INTER4V    4
123#define MODE_SKIPPED    6
124
125#define I_VOP       0
126#define P_VOP       1
127#define B_VOP       2
128
129/*09/04/00 Add MB height and width */
130#define MB_WIDTH 16
131#define MB_HEIGHT 16
132
133#define VOP_BRIGHT_WHITEENC 255
134
135
136#define LUMINANCE_DC_TYPE   1
137#define CHROMINANCE_DC_TYPE 2
138
139#define EOB_CODE                        1
140#define EOB_CODE_LENGTH                32
141
142/* 11/30/98 */
143#define FoundRM     1   /* Resync Marker */
144#define FoundVSC    2   /* VOP_START_CODE. */
145#define FoundGSC    3   /* GROUP_START_CODE */
146#define FoundEOB    4   /* EOB_CODE */
147
148
149/* 05/08/2000, the error code returned from BitstreamShowBits() */
150#define BITSTREAM_ERROR_CODE 0xFFFFFFFF
151
152/* PacketVideo "absolution timestamp" object.  06/13/2000 */
153#define PVTS_START_CODE         0x01C4
154#define PVTS_START_CODE_LENGTH  32
155
156/* session layer and vop layer start codes */
157
158#define SESSION_START_CODE  0x01B0
159#define SESSION_END_CODE    0x01B1
160#define VISUAL_OBJECT_START_CODE 0x01B5
161
162#define VO_START_CODE           0x8
163#define VO_HEADER_LENGTH        32      /* lengtho of VO header: VO_START_CODE +  VO_ID */
164
165#define SOL_START_CODE          0x01BE
166#define SOL_START_CODE_LENGTH   32
167
168#define VOL_START_CODE 0x12
169#define VOL_START_CODE_LENGTH 28
170
171#define VOP_START_CODE 0x1B6
172#define VOP_START_CODE_LENGTH   32
173
174#define GROUP_START_CODE    0x01B3
175#define GROUP_START_CODE_LENGTH  32
176
177#define VOP_ID_CODE_LENGTH      5
178#define VOP_TEMP_REF_CODE_LENGTH    16
179
180#define USER_DATA_START_CODE        0x01B2
181#define USER_DATA_START_CODE_LENGTH 32
182
183#define START_CODE_PREFIX       0x01
184#define START_CODE_PREFIX_LENGTH    24
185
186#define SHORT_VIDEO_START_MARKER         0x20
187#define SHORT_VIDEO_START_MARKER_LENGTH  22
188#define SHORT_VIDEO_END_MARKER            0x3F
189#define GOB_RESYNC_MARKER         0x01
190#define GOB_RESYNC_MARKER_LENGTH  17
191
192/* motion and resync markers used in error resilient mode  */
193
194#define DC_MARKER                      438273
195#define DC_MARKER_LENGTH                19
196
197#define MOTION_MARKER_COMB             126977
198#define MOTION_MARKER_COMB_LENGTH       17
199
200#define MOTION_MARKER_SEP              81921
201#define MOTION_MARKER_SEP_LENGTH        17
202
203#define RESYNC_MARKER           1
204#define RESYNC_MARKER_LENGTH    17
205
206#define SPRITE_NOT_USED     0
207#define STATIC_SPRITE       1
208#define ONLINE_SPRITE       2
209#define GMC_SPRITE      3
210
211/* macroblock and block size */
212#define MB_SIZE 16
213#define NCOEFF_MB (MB_SIZE*MB_SIZE)
214#define B_SIZE 8
215#define NCOEFF_BLOCK (B_SIZE*B_SIZE)
216#define NCOEFF_Y NCOEFF_MB
217#define NCOEFF_U NCOEFF_BLOCK
218#define NCOEFF_V NCOEFF_BLOCK
219
220/* overrun buffer size  */
221#define DEFAULT_OVERRUN_BUFFER_SIZE 1000
222
223
224/* VLC decoding related definitions */
225#define VLC_ERROR   (-1)
226#define VLC_ESCAPE  7167
227
228#endif /* _PVDECDEF_H_ */
229