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