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 _MP4DECLIB_H_ 19 #define _MP4DECLIB_H_ 20 21 /*---------------------------------------------------------------------------- 22 ; INCLUDES 23 ----------------------------------------------------------------------------*/ 24 #include "oscl_mem.h" 25 #include "mp4def.h" /* typedef */ 26 #include "mp4lib_int.h" /* main video structure */ 27 28 /*---------------------------------------------------------------------------- 29 ; MACROS 30 ; Define module specific macros here 31 ----------------------------------------------------------------------------*/ 32 33 /*---------------------------------------------------------------------------- 34 ; DEFINES 35 ; Include all pre-processor statements here. 36 ----------------------------------------------------------------------------*/ 37 38 /*---------------------------------------------------------------------------- 39 ; EXTERNAL VARIABLES REFERENCES 40 ; Declare variables used in this module but defined elsewhere 41 ----------------------------------------------------------------------------*/ 42 43 /*---------------------------------------------------------------------------- 44 ; SIMPLE TYPEDEF'S 45 ----------------------------------------------------------------------------*/ 46 47 /*---------------------------------------------------------------------------- 48 ; ENUMERATED TYPEDEF'S 49 ----------------------------------------------------------------------------*/ 50 51 /*---------------------------------------------------------------------------- 52 ; STRUCTURES TYPEDEF'S 53 ----------------------------------------------------------------------------*/ 54 55 /*---------------------------------------------------------------------------- 56 ; GLOBAL FUNCTION DEFINITIONS 57 ; Function Prototype declaration 58 ----------------------------------------------------------------------------*/ 59 #ifdef __cplusplus 60 extern "C" 61 { 62 #endif /* __cplusplus */ 63 64 /* defined in pvdec_api.c, these function are not supposed to be */ 65 /* exposed to programmers outside PacketVideo. 08/15/2000. */ 66 uint VideoDecoderErrorDetected(VideoDecData *video); 67 68 #ifdef ENABLE_LOG 69 void m4vdec_dprintf(char *format, ...); 70 #define mp4dec_log(message) m4vdec_dprintf(message) 71 #else 72 #define mp4dec_log(message) 73 #endif 74 75 /*--------------------------------------------------------------------------*/ 76 /* defined in frame_buffer.c */ 77 PV_STATUS FillFrameBufferNew(BitstreamDecVideo *stream); 78 PV_STATUS FillFrameBuffer(BitstreamDecVideo *stream, int short_header); 79 80 /*--------------------------------------------------------------------------*/ 81 /* defined in dc_ac_pred.c */ 82 int cal_dc_scaler(int QP, int type); 83 PV_STATUS PV_DecodePredictedIntraDC(int compnum, BitstreamDecVideo *stream, 84 int16 *IntraDC_delta); 85 86 void doDCACPrediction(VideoDecData *video, int comp, int16 *q_block, 87 int *direction); 88 89 #ifdef PV_ANNEX_IJKT_SUPPORT 90 void doDCACPrediction_I(VideoDecData *video, int comp, int16 *q_block); 91 #endif 92 /*--------------------------------------------------------------------------*/ 93 /* defined in block_idct.c */ 94 void MBlockIDCTAdd(VideoDecData *video, int nz_coefs[]); 95 96 void BlockIDCT(uint8 *dst, uint8 *pred, int16 *blk, int width, int nzcoefs, 97 uint8 *bitmapcol, uint8 bitmaprow); 98 99 void MBlockIDCT(VideoDecData *video); 100 void BlockIDCT_intra(MacroBlock *mblock, PIXEL *c_comp, int comp, int width_offset); 101 /*--------------------------------------------------------------------------*/ 102 /* defined in combined_decode.c */ 103 PV_STATUS DecodeFrameCombinedMode(VideoDecData *video); 104 PV_STATUS GetMBheader(VideoDecData *video, int16 *QP); 105 PV_STATUS GetMBData(VideoDecData *video); 106 107 /*--------------------------------------------------------------------------*/ 108 /* defined in datapart_decode.c */ 109 PV_STATUS DecodeFrameDataPartMode(VideoDecData *video); 110 PV_STATUS GetMBheaderDataPart_DQUANT_DC(VideoDecData *video, int16 *QP); 111 PV_STATUS GetMBheaderDataPart_P(VideoDecData *video); 112 PV_STATUS DecodeDataPart_I_VideoPacket(VideoDecData *video, int slice_counter); 113 PV_STATUS DecodeDataPart_P_VideoPacket(VideoDecData *video, int slice_counter); 114 PV_STATUS GetMBData_DataPart(VideoDecData *video); 115 116 /*--------------------------------------------------------------------------*/ 117 /* defined in packet_util.c */ 118 PV_STATUS PV_ReadVideoPacketHeader(VideoDecData *video, int *next_MB); 119 PV_STATUS RecoverPacketError(BitstreamDecVideo *stream, int marker_length, int32 *nextVop); 120 PV_STATUS RecoverGOBError(BitstreamDecVideo *stream, int marker_length, int32 *vopPos); 121 PV_STATUS PV_GobHeader(VideoDecData *video); 122 #ifdef PV_ANNEX_IJKT_SUPPORT 123 PV_STATUS PV_H263SliceHeader(VideoDecData *videoInt, int *next_MB); 124 #endif 125 /*--------------------------------------------------------------------------*/ 126 /* defined in motion_comp.c */ 127 void MBMotionComp(VideoDecData *video, int CBP); 128 void SkippedMBMotionComp(VideoDecData *video); 129 130 /*--------------------------------------------------------------------------*/ 131 /* defined in chrominance_pred.c */ 132 void chrominance_pred( 133 int xpred, /* i */ 134 int ypred, /* i */ 135 uint8 *cu_prev, /* i */ 136 uint8 *cv_prev, /* i */ 137 uint8 *pred_block, /* i */ 138 int width_uv, /* i */ 139 int height_uv, /* i */ 140 int round1 141 ); 142 143 /*--------------------------------------------------------------------------*/ 144 /* defined in luminance_pred_mode_inter.c */ 145 void luminance_pred_mode_inter( 146 int xpred, /* i */ 147 int ypred, /* i */ 148 uint8 *c_prev, /* i */ 149 uint8 *pred_block, /* i */ 150 int width, /* i */ 151 int height, /* i */ 152 int round1 153 ); 154 155 /*--------------------------------------------------------------------------*/ 156 /* defined in luminance_pred_mode_inter4v.c */ 157 void luminance_pred_mode_inter4v( 158 int xpos, /* i */ 159 int ypos, /* i */ 160 MOT *px, /* i */ 161 MOT *py, /* i */ 162 uint8 *c_prev, /* i */ 163 uint8 *pred_block, /* i */ 164 int width, /* i */ 165 int height, /* i */ 166 int round1, /* i */ 167 int mvwidth, /* i */ 168 int *xsum_ptr, /* i/o */ 169 int *ysum_ptr /* i/o */ 170 ); 171 172 /*--------------------------------------------------------------------------*/ 173 /* defined in pp_semaphore_chroma_inter.c */ 174 #ifdef PV_POSTPROC_ON 175 void pp_semaphore_chroma_inter( 176 int xpred, /* i */ 177 int ypred, /* i */ 178 uint8 *pp_dec_u, /* i/o */ 179 uint8 *pstprcTypPrv, /* i */ 180 int dx, /* i */ 181 int dy, /* i */ 182 int mvwidth, /* i */ 183 int height, /* i */ 184 int32 size, /* i */ 185 int mv_loc, /* i */ 186 uint8 msk_deblock /* i */ 187 ); 188 189 /*--------------------------------------------------------------------------*/ 190 /* defined in pp_semaphore_luma.c */ 191 uint8 pp_semaphore_luma( 192 int xpred, /* i */ 193 int ypred, /* i */ 194 uint8 *pp_dec_y, /* i/o */ 195 uint8 *pstprcTypPrv, /* i */ 196 int *ll, /* i */ 197 int *mv_loc, /* i/o */ 198 int dx, /* i */ 199 int dy, /* i */ 200 int mvwidth, /* i */ 201 int width, /* i */ 202 int height /* i */ 203 ); 204 #endif 205 /*--------------------------------------------------------------------------*/ 206 /* defined in get_pred_adv_mb_add.c */ 207 int GetPredAdvancedMB( 208 int xpos, 209 int ypos, 210 uint8 *c_prev, 211 uint8 *pred_block, 212 int width, 213 int rnd1 214 ); 215 216 /*--------------------------------------------------------------------------*/ 217 /* defined in get_pred_adv_b_add.c */ 218 int GetPredAdvancedBy0x0( 219 uint8 *c_prev, /* i */ 220 uint8 *pred_block, /* i */ 221 int width, /* i */ 222 int pred_width_rnd /* i */ 223 ); 224 225 int GetPredAdvancedBy0x1( 226 uint8 *c_prev, /* i */ 227 uint8 *pred_block, /* i */ 228 int width, /* i */ 229 int pred_width_rnd /* i */ 230 ); 231 232 int GetPredAdvancedBy1x0( 233 uint8 *c_prev, /* i */ 234 uint8 *pred_block, /* i */ 235 int width, /* i */ 236 int pred_width_rnd /* i */ 237 ); 238 239 int GetPredAdvancedBy1x1( 240 uint8 *c_prev, /* i */ 241 uint8 *pred_block, /* i */ 242 int width, /* i */ 243 int pred_width_rnd /* i */ 244 ); 245 246 /*--------------------------------------------------------------------------*/ 247 /* defined in get_pred_outside.c */ 248 int GetPredOutside( 249 int xpos, 250 int ypos, 251 uint8 *c_prev, 252 uint8 *pred_block, 253 int width, 254 int height, 255 int rnd1, 256 int pred_width 257 ); 258 259 /*--------------------------------------------------------------------------*/ 260 /* defined in find_pmvsErrRes.c */ 261 void mv_prediction(VideoDecData *video, int block, MOT *mvx, MOT *mvy); 262 263 /*--------------------------------------------------------------------------*/ 264 265 /*--------------------------------------------------------------------------*/ 266 /* defined in mb_utils.c */ 267 void Copy_MB_into_Vop(uint8 *comp, int yChan[][NCOEFF_BLOCK], int width); 268 void Copy_B_into_Vop(uint8 *comp, int cChan[], int width); 269 void PutSKIPPED_MB(uint8 *comp, uint8 *c_prev, int width); 270 void PutSKIPPED_B(uint8 *comp, uint8 *c_prev, int width); 271 272 /*--------------------------------------------------------------------------*/ 273 /* defined in vop.c */ 274 PV_STATUS DecodeGOVHeader(BitstreamDecVideo *stream, uint32 *time_base); 275 PV_STATUS DecodeVOLHeader(VideoDecData *video, int layer); 276 PV_STATUS DecodeVOPHeader(VideoDecData *video, Vop *currVop, Bool use_ext_tiemstamp); 277 PV_STATUS DecodeShortHeader(VideoDecData *video, Vop *currVop); 278 PV_STATUS PV_DecodeVop(VideoDecData *video); 279 uint32 CalcVopDisplayTime(Vol *currVol, Vop *currVop, int shortVideoHeader); 280 281 /*--------------------------------------------------------------------------*/ 282 /* defined in post_proc.c */ 283 #ifdef PV_ANNEX_IJKT_SUPPORT 284 void H263_Deblock(uint8 *rec, int width, int height, int16 *QP_store, uint8 *mode, int chr, int T); 285 #endif 286 int PostProcSemaphore(int16 *q_block); 287 void PostFilter(VideoDecData *video, int filer_type, uint8 *output); 288 void FindMaxMin(uint8 *ptr, int *min, int *max, int incr); 289 void DeringAdaptiveSmoothMMX(uint8 *img, int incr, int thres, int mxdf); 290 void AdaptiveSmooth_NoMMX(uint8 *Rec_Y, int v0, int h0, int v_blk, int h_blk, 291 int thr, int width, int max_diff); 292 void Deringing_Luma(uint8 *Rec_Y, int width, int height, int16 *QP_store, 293 int Combined, uint8 *pp_mod); 294 void Deringing_Chroma(uint8 *Rec_C, int width, int height, int16 *QP_store, 295 int Combined, uint8 *pp_mod); 296 void CombinedHorzVertFilter(uint8 *rec, int width, int height, int16 *QP_store, 297 int chr, uint8 *pp_mod); 298 void CombinedHorzVertFilter_NoSoftDeblocking(uint8 *rec, int width, int height, int16 *QP_store, 299 int chr, uint8 *pp_mod); 300 void CombinedHorzVertRingFilter(uint8 *rec, int width, int height, 301 int16 *QP_store, int chr, uint8 *pp_mod); 302 303 /*--------------------------------------------------------------------------*/ 304 /* defined in conceal.c */ 305 void ConcealTexture_I(VideoDecData *video, int32 startFirstPartition, int mb_start, int mb_stop, 306 int slice_counter); 307 void ConcealTexture_P(VideoDecData *video, int mb_start, int mb_stop, 308 int slice_counter); 309 void ConcealPacket(VideoDecData *video, int mb_start, int mb_stop, 310 int slice_counter); 311 void CopyVopMB(Vop *curr, uint8 *prev, int mbnum, int width, int height); 312 313 /* define in vlc_dequant.c , 09/18/2000*/ 314 #ifdef PV_SUPPORT_MAIN_PROFILE 315 int VlcDequantMpegIntraBlock(void *video, int comp, int switched, 316 uint8 *bitmapcol, uint8 *bitmaprow); 317 int VlcDequantMpegInterBlock(void *video, int comp, 318 uint8 *bitmapcol, uint8 *bitmaprow); 319 #endif 320 int VlcDequantH263IntraBlock(VideoDecData *video, int comp, int switched, 321 uint8 *bitmapcol, uint8 *bitmaprow); 322 int VlcDequantH263IntraBlock_SH(VideoDecData *video, int comp, 323 uint8 *bitmapcol, uint8 *bitmaprow); 324 int VlcDequantH263InterBlock(VideoDecData *video, int comp, 325 uint8 *bitmapcol, uint8 *bitmaprow); 326 327 #ifdef __cplusplus 328 } 329 #endif /* __cplusplus */ 330 331 /*---------------------------------------------------------------------------- 332 ; END 333 ----------------------------------------------------------------------------*/ 334 #endif 335 336