1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
21 /*----------------------------------------------------------------------------
23 ----------------------------------------------------------------------------*/
24 #include "mp4def.h" /* typedef */
25 #include "mp4lib_int.h" /* main video structure */
27 /*----------------------------------------------------------------------------
29 ; Define module specific macros here
30 ----------------------------------------------------------------------------*/
32 /*----------------------------------------------------------------------------
34 ; Include all pre-processor statements here.
35 ----------------------------------------------------------------------------*/
37 /*----------------------------------------------------------------------------
38 ; EXTERNAL VARIABLES REFERENCES
39 ; Declare variables used in this module but defined elsewhere
40 ----------------------------------------------------------------------------*/
42 /*----------------------------------------------------------------------------
44 ----------------------------------------------------------------------------*/
46 /*----------------------------------------------------------------------------
47 ; ENUMERATED TYPEDEF'S
48 ----------------------------------------------------------------------------*/
50 /*----------------------------------------------------------------------------
51 ; STRUCTURES TYPEDEF'S
52 ----------------------------------------------------------------------------*/
54 /*----------------------------------------------------------------------------
55 ; GLOBAL FUNCTION DEFINITIONS
56 ; Function Prototype declaration
57 ----------------------------------------------------------------------------*/
61 #endif /* __cplusplus */
63 /* defined in pvdec_api.c, these function are not supposed to be */
64 /* exposed to programmers outside PacketVideo. 08/15/2000. */
65 uint VideoDecoderErrorDetected(VideoDecData *video);
68 void m4vdec_dprintf(char *format, ...);
69 #define mp4dec_log(message) m4vdec_dprintf(message)
71 #define mp4dec_log(message)
74 /*--------------------------------------------------------------------------*/
75 /* defined in frame_buffer.c */
76 PV_STATUS FillFrameBufferNew(BitstreamDecVideo *stream);
77 PV_STATUS FillFrameBuffer(BitstreamDecVideo *stream, int short_header);
79 /*--------------------------------------------------------------------------*/
80 /* defined in dc_ac_pred.c */
81 int cal_dc_scaler(int QP, int type);
82 PV_STATUS PV_DecodePredictedIntraDC(int compnum, BitstreamDecVideo *stream,
83 int16 *IntraDC_delta);
85 void doDCACPrediction(VideoDecData *video, int comp, int16 *q_block,
88 #ifdef PV_ANNEX_IJKT_SUPPORT
89 void doDCACPrediction_I(VideoDecData *video, int comp, int16 *q_block);
91 /*--------------------------------------------------------------------------*/
92 /* defined in block_idct.c */
93 void MBlockIDCTAdd(VideoDecData *video, int nz_coefs[]);
95 void BlockIDCT(uint8 *dst, uint8 *pred, int16 *blk, int width, int nzcoefs,
96 uint8 *bitmapcol, uint8 bitmaprow);
98 void MBlockIDCT(VideoDecData *video);
99 void BlockIDCT_intra(MacroBlock *mblock, PIXEL *c_comp, int comp, int width_offset);
100 /*--------------------------------------------------------------------------*/
101 /* defined in combined_decode.c */
102 PV_STATUS DecodeFrameCombinedMode(VideoDecData *video);
103 PV_STATUS GetMBheader(VideoDecData *video, int16 *QP);
104 PV_STATUS GetMBData(VideoDecData *video);
106 /*--------------------------------------------------------------------------*/
107 /* defined in datapart_decode.c */
108 PV_STATUS DecodeFrameDataPartMode(VideoDecData *video);
109 PV_STATUS GetMBheaderDataPart_DQUANT_DC(VideoDecData *video, int16 *QP);
110 PV_STATUS GetMBheaderDataPart_P(VideoDecData *video);
111 PV_STATUS DecodeDataPart_I_VideoPacket(VideoDecData *video, int slice_counter);
112 PV_STATUS DecodeDataPart_P_VideoPacket(VideoDecData *video, int slice_counter);
113 PV_STATUS GetMBData_DataPart(VideoDecData *video);
115 /*--------------------------------------------------------------------------*/
116 /* defined in packet_util.c */
117 PV_STATUS PV_ReadVideoPacketHeader(VideoDecData *video, int *next_MB);
118 PV_STATUS RecoverPacketError(BitstreamDecVideo *stream, int marker_length, int32 *nextVop);
119 PV_STATUS RecoverGOBError(BitstreamDecVideo *stream, int marker_length, int32 *vopPos);
120 PV_STATUS PV_GobHeader(VideoDecData *video);
121 #ifdef PV_ANNEX_IJKT_SUPPORT
122 PV_STATUS PV_H263SliceHeader(VideoDecData *videoInt, int *next_MB);
124 /*--------------------------------------------------------------------------*/
125 /* defined in motion_comp.c */
126 void MBMotionComp(VideoDecData *video, int CBP);
127 void SkippedMBMotionComp(VideoDecData *video);
129 /*--------------------------------------------------------------------------*/
130 /* defined in chrominance_pred.c */
131 void chrominance_pred(
134 uint8 *cu_prev, /* i */
135 uint8 *cv_prev, /* i */
136 uint8 *pred_block, /* i */
137 int width_uv, /* i */
138 int height_uv, /* i */
142 /*--------------------------------------------------------------------------*/
143 /* defined in luminance_pred_mode_inter.c */
144 void luminance_pred_mode_inter(
147 uint8 *c_prev, /* i */
148 uint8 *pred_block, /* i */
154 /*--------------------------------------------------------------------------*/
155 /* defined in luminance_pred_mode_inter4v.c */
156 void luminance_pred_mode_inter4v(
161 uint8 *c_prev, /* i */
162 uint8 *pred_block, /* i */
167 int *xsum_ptr, /* i/o */
168 int *ysum_ptr /* i/o */
171 /*--------------------------------------------------------------------------*/
172 /* defined in pp_semaphore_chroma_inter.c */
173 #ifdef PV_POSTPROC_ON
174 void pp_semaphore_chroma_inter(
177 uint8 *pp_dec_u, /* i/o */
178 uint8 *pstprcTypPrv, /* i */
185 uint8 msk_deblock /* i */
188 /*--------------------------------------------------------------------------*/
189 /* defined in pp_semaphore_luma.c */
190 uint8 pp_semaphore_luma(
193 uint8 *pp_dec_y, /* i/o */
194 uint8 *pstprcTypPrv, /* i */
196 int *mv_loc, /* i/o */
204 /*--------------------------------------------------------------------------*/
205 /* defined in get_pred_adv_mb_add.c */
206 int GetPredAdvancedMB(
215 /*--------------------------------------------------------------------------*/
216 /* defined in get_pred_adv_b_add.c */
217 int GetPredAdvancedBy0x0(
218 uint8 *c_prev, /* i */
219 uint8 *pred_block, /* i */
221 int pred_width_rnd /* i */
224 int GetPredAdvancedBy0x1(
225 uint8 *c_prev, /* i */
226 uint8 *pred_block, /* i */
228 int pred_width_rnd /* i */
231 int GetPredAdvancedBy1x0(
232 uint8 *c_prev, /* i */
233 uint8 *pred_block, /* i */
235 int pred_width_rnd /* i */
238 int GetPredAdvancedBy1x1(
239 uint8 *c_prev, /* i */
240 uint8 *pred_block, /* i */
242 int pred_width_rnd /* i */
245 /*--------------------------------------------------------------------------*/
246 /* defined in get_pred_outside.c */
258 /*--------------------------------------------------------------------------*/
259 /* defined in find_pmvsErrRes.c */
260 void mv_prediction(VideoDecData *video, int block, MOT *mvx, MOT *mvy);
262 /*--------------------------------------------------------------------------*/
264 /*--------------------------------------------------------------------------*/
265 /* defined in mb_utils.c */
266 void Copy_MB_into_Vop(uint8 *comp, int yChan[][NCOEFF_BLOCK], int width);
267 void Copy_B_into_Vop(uint8 *comp, int cChan[], int width);
268 void PutSKIPPED_MB(uint8 *comp, uint8 *c_prev, int width);
269 void PutSKIPPED_B(uint8 *comp, uint8 *c_prev, int width);
271 /*--------------------------------------------------------------------------*/
272 /* defined in vop.c */
273 PV_STATUS DecodeGOVHeader(BitstreamDecVideo *stream, uint32 *time_base);
274 PV_STATUS DecodeVOLHeader(VideoDecData *video, int layer);
275 PV_STATUS DecodeVOPHeader(VideoDecData *video, Vop *currVop, Bool use_ext_tiemstamp);
276 PV_STATUS DecodeShortHeader(VideoDecData *video, Vop *currVop);
277 PV_STATUS PV_DecodeVop(VideoDecData *video);
278 uint32 CalcVopDisplayTime(Vol *currVol, Vop *currVop, int shortVideoHeader);
280 /*--------------------------------------------------------------------------*/
281 /* defined in post_proc.c */
282 #ifdef PV_ANNEX_IJKT_SUPPORT
283 void H263_Deblock(uint8 *rec, int width, int height, int16 *QP_store, uint8 *mode, int chr, int T);
285 int PostProcSemaphore(int16 *q_block);
286 void PostFilter(VideoDecData *video, int filer_type, uint8 *output);
287 void FindMaxMin(uint8 *ptr, int *min, int *max, int incr);
288 void DeringAdaptiveSmoothMMX(uint8 *img, int incr, int thres, int mxdf);
289 void AdaptiveSmooth_NoMMX(uint8 *Rec_Y, int v0, int h0, int v_blk, int h_blk,
290 int thr, int width, int max_diff);
291 void Deringing_Luma(uint8 *Rec_Y, int width, int height, int16 *QP_store,
292 int Combined, uint8 *pp_mod);
293 void Deringing_Chroma(uint8 *Rec_C, int width, int height, int16 *QP_store,
294 int Combined, uint8 *pp_mod);
295 void CombinedHorzVertFilter(uint8 *rec, int width, int height, int16 *QP_store,
296 int chr, uint8 *pp_mod);
297 void CombinedHorzVertFilter_NoSoftDeblocking(uint8 *rec, int width, int height, int16 *QP_store,
298 int chr, uint8 *pp_mod);
299 void CombinedHorzVertRingFilter(uint8 *rec, int width, int height,
300 int16 *QP_store, int chr, uint8 *pp_mod);
302 /*--------------------------------------------------------------------------*/
303 /* defined in conceal.c */
304 void ConcealTexture_I(VideoDecData *video, int32 startFirstPartition, int mb_start, int mb_stop,
306 void ConcealTexture_P(VideoDecData *video, int mb_start, int mb_stop,
308 void ConcealPacket(VideoDecData *video, int mb_start, int mb_stop,
310 void CopyVopMB(Vop *curr, uint8 *prev, int mbnum, int width, int height);
312 /* define in vlc_dequant.c , 09/18/2000*/
313 #ifdef PV_SUPPORT_MAIN_PROFILE
314 int VlcDequantMpegIntraBlock(void *video, int comp, int switched,
315 uint8 *bitmapcol, uint8 *bitmaprow);
316 int VlcDequantMpegInterBlock(void *video, int comp,
317 uint8 *bitmapcol, uint8 *bitmaprow);
319 int VlcDequantH263IntraBlock(VideoDecData *video, int comp, int switched,
320 uint8 *bitmapcol, uint8 *bitmaprow);
321 int VlcDequantH263IntraBlock_SH(VideoDecData *video, int comp,
322 uint8 *bitmapcol, uint8 *bitmaprow);
323 int VlcDequantH263InterBlock(VideoDecData *video, int comp,
324 uint8 *bitmapcol, uint8 *bitmaprow);
328 #endif /* __cplusplus */
330 /*----------------------------------------------------------------------------
332 ----------------------------------------------------------------------------*/