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