• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "mp4def.h" /* typedef */
25 #include "mp4lib_int.h" /* main video structure */
26 
27 /*----------------------------------------------------------------------------
28 ; MACROS
29 ; Define module specific macros here
30 ----------------------------------------------------------------------------*/
31 
32 /*----------------------------------------------------------------------------
33 ; DEFINES
34 ; Include all pre-processor statements here.
35 ----------------------------------------------------------------------------*/
36 
37 /*----------------------------------------------------------------------------
38 ; EXTERNAL VARIABLES REFERENCES
39 ; Declare variables used in this module but defined elsewhere
40 ----------------------------------------------------------------------------*/
41 
42 /*----------------------------------------------------------------------------
43 ; SIMPLE TYPEDEF'S
44 ----------------------------------------------------------------------------*/
45 
46 /*----------------------------------------------------------------------------
47 ; ENUMERATED TYPEDEF'S
48 ----------------------------------------------------------------------------*/
49 
50 /*----------------------------------------------------------------------------
51 ; STRUCTURES TYPEDEF'S
52 ----------------------------------------------------------------------------*/
53 
54 /*----------------------------------------------------------------------------
55 ; GLOBAL FUNCTION DEFINITIONS
56 ; Function Prototype declaration
57 ----------------------------------------------------------------------------*/
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif /* __cplusplus */
62 
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);
66 
67 #ifdef ENABLE_LOG
68     void m4vdec_dprintf(char *format, ...);
69 #define mp4dec_log(message) m4vdec_dprintf(message)
70 #else
71 #define mp4dec_log(message)
72 #endif
73 
74     /*--------------------------------------------------------------------------*/
75     /* defined in frame_buffer.c */
76     PV_STATUS FillFrameBufferNew(BitstreamDecVideo *stream);
77     PV_STATUS FillFrameBuffer(BitstreamDecVideo *stream, int short_header);
78 
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);
84 
85     void    doDCACPrediction(VideoDecData *video, int comp, int16 *q_block,
86                              int *direction);
87 
88 #ifdef PV_ANNEX_IJKT_SUPPORT
89     void    doDCACPrediction_I(VideoDecData *video, int comp, int16 *q_block);
90 #endif
91     /*--------------------------------------------------------------------------*/
92     /* defined in block_idct.c */
93     void MBlockIDCTAdd(VideoDecData *video, int nz_coefs[]);
94 
95     void BlockIDCT(uint8 *dst, uint8 *pred, int16 *blk, int width, int nzcoefs,
96                    uint8 *bitmapcol, uint8 bitmaprow);
97 
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);
105 
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);
114 
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);
123 #endif
124     /*--------------------------------------------------------------------------*/
125     /* defined in motion_comp.c */
126     void MBMotionComp(VideoDecData *video, int CBP);
127     void  SkippedMBMotionComp(VideoDecData *video);
128 
129     /*--------------------------------------------------------------------------*/
130     /* defined in chrominance_pred.c */
131     void chrominance_pred(
132         int xpred,          /* i */
133         int ypred,          /* i */
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 */
139         int round1
140     );
141 
142     /*--------------------------------------------------------------------------*/
143     /* defined in luminance_pred_mode_inter.c */
144     void luminance_pred_mode_inter(
145         int xpred,          /* i */
146         int ypred,          /* i */
147         uint8 *c_prev,      /* i */
148         uint8 *pred_block,  /* i */
149         int width,          /* i */
150         int height,         /* i */
151         int round1
152     );
153 
154     /*--------------------------------------------------------------------------*/
155     /* defined in luminance_pred_mode_inter4v.c */
156     void luminance_pred_mode_inter4v(
157         int xpos,           /* i */
158         int ypos,           /* i */
159         MOT *px,            /* i */
160         MOT *py,            /* i */
161         uint8 *c_prev,      /* i */
162         uint8 *pred_block,  /* i */
163         int width,          /* i */
164         int height,         /* i */
165         int round1,         /* i */
166         int mvwidth,            /* i */
167         int *xsum_ptr,          /* i/o */
168         int *ysum_ptr           /* i/o */
169     );
170 
171     /*--------------------------------------------------------------------------*/
172     /* defined in pp_semaphore_chroma_inter.c */
173     /*--------------------------------------------------------------------------*/
174     /* defined in get_pred_adv_mb_add.c */
175     int GetPredAdvancedMB(
176         int xpos,
177         int ypos,
178         uint8 *c_prev,
179         uint8 *pred_block,
180         int width,
181         int rnd1
182     );
183 
184     /*--------------------------------------------------------------------------*/
185     /* defined in get_pred_adv_b_add.c */
186     int GetPredAdvancedBy0x0(
187         uint8 *c_prev,      /* i */
188         uint8 *pred_block,      /* i */
189         int width,      /* i */
190         int pred_width_rnd /* i */
191     );
192 
193     int GetPredAdvancedBy0x1(
194         uint8 *c_prev,      /* i */
195         uint8 *pred_block,      /* i */
196         int width,      /* i */
197         int pred_width_rnd /* i */
198     );
199 
200     int GetPredAdvancedBy1x0(
201         uint8 *c_prev,      /* i */
202         uint8 *pred_block,      /* i */
203         int width,      /* i */
204         int pred_width_rnd /* i */
205     );
206 
207     int GetPredAdvancedBy1x1(
208         uint8 *c_prev,      /* i */
209         uint8 *pred_block,      /* i */
210         int width,      /* i */
211         int pred_width_rnd /* i */
212     );
213 
214     /*--------------------------------------------------------------------------*/
215     /* defined in get_pred_outside.c */
216     int GetPredOutside(
217         int xpos,
218         int ypos,
219         uint8 *c_prev,
220         uint8 *pred_block,
221         int width,
222         int height,
223         int rnd1,
224         int pred_width
225     );
226 
227     /*--------------------------------------------------------------------------*/
228     /* defined in find_pmvsErrRes.c */
229     void mv_prediction(VideoDecData *video, int block, MOT *mvx, MOT *mvy);
230 
231     /*--------------------------------------------------------------------------*/
232 
233     /*--------------------------------------------------------------------------*/
234     /* defined in mb_utils.c */
235     void Copy_MB_into_Vop(uint8 *comp, int yChan[][NCOEFF_BLOCK], int width);
236     void Copy_B_into_Vop(uint8 *comp, int cChan[], int width);
237     void PutSKIPPED_MB(uint8 *comp, uint8 *c_prev, int width);
238     void PutSKIPPED_B(uint8 *comp, uint8 *c_prev, int width);
239 
240     /*--------------------------------------------------------------------------*/
241     /* defined in vop.c */
242     PV_STATUS DecodeGOVHeader(BitstreamDecVideo *stream, uint32 *time_base);
243     PV_STATUS DecodeVOLHeader(VideoDecData *video, int layer);
244     PV_STATUS DecodeVOPHeader(VideoDecData *video, Vop *currVop, Bool use_ext_tiemstamp);
245     PV_STATUS DecodeShortHeader(VideoDecData *video, Vop *currVop);
246     PV_STATUS PV_DecodeVop(VideoDecData *video);
247     uint32 CalcVopDisplayTime(Vol *currVol, Vop *currVop, int shortVideoHeader);
248 
249     /*--------------------------------------------------------------------------*/
250     /* defined in post_proc.c */
251 #ifdef PV_ANNEX_IJKT_SUPPORT
252     void H263_Deblock(uint8 *rec,   int width, int height, int16 *QP_store, uint8 *mode, int chr, int T);
253 #endif
254     int  PostProcSemaphore(int16 *q_block);
255     void PostFilter(VideoDecData *video, int filer_type, uint8 *output);
256     void FindMaxMin(uint8 *ptr, int *min, int *max, int incr);
257     void DeringAdaptiveSmoothMMX(uint8 *img, int incr, int thres, int mxdf);
258     void AdaptiveSmooth_NoMMX(uint8 *Rec_Y, int v0, int h0, int v_blk, int h_blk,
259                               int thr, int width, int max_diff);
260     void Deringing_Luma(uint8 *Rec_Y, int width, int height, int16 *QP_store,
261                         int Combined, uint8 *pp_mod);
262     void Deringing_Chroma(uint8 *Rec_C, int width, int height, int16 *QP_store,
263                           int Combined, uint8 *pp_mod);
264     void CombinedHorzVertFilter(uint8 *rec, int width, int height, int16 *QP_store,
265                                 int chr, uint8 *pp_mod);
266     void CombinedHorzVertFilter_NoSoftDeblocking(uint8 *rec, int width, int height, int16 *QP_store,
267             int chr, uint8 *pp_mod);
268     void CombinedHorzVertRingFilter(uint8 *rec, int width, int height,
269                                     int16 *QP_store, int chr, uint8 *pp_mod);
270 
271     /*--------------------------------------------------------------------------*/
272     /* defined in conceal.c */
273     void ConcealTexture_I(VideoDecData *video, int32 startFirstPartition, int mb_start, int mb_stop,
274                           int slice_counter);
275     void ConcealTexture_P(VideoDecData *video, int mb_start, int mb_stop,
276                           int slice_counter);
277     void ConcealPacket(VideoDecData *video, int mb_start, int mb_stop,
278                        int slice_counter);
279     void CopyVopMB(Vop *curr, uint8 *prev, int mbnum, int width, int height);
280 
281     /* define in vlc_dequant.c ,  09/18/2000*/
282 #ifdef PV_SUPPORT_MAIN_PROFILE
283     int VlcDequantMpegIntraBlock(void *video, int comp, int switched,
284                                  uint8 *bitmapcol, uint8 *bitmaprow);
285     int VlcDequantMpegInterBlock(void *video, int comp,
286                                  uint8 *bitmapcol, uint8 *bitmaprow);
287 #endif
288     int VlcDequantH263IntraBlock(VideoDecData *video, int comp, int switched,
289                                  uint8 *bitmapcol, uint8 *bitmaprow);
290     int VlcDequantH263IntraBlock_SH(VideoDecData *video, int comp,
291                                     uint8 *bitmapcol, uint8 *bitmaprow);
292     int VlcDequantH263InterBlock(VideoDecData *video, int comp,
293                                  uint8 *bitmapcol, uint8 *bitmaprow);
294 
295 #ifdef __cplusplus
296 }
297 #endif /* __cplusplus */
298 
299 /*----------------------------------------------------------------------------
300 ; END
301 ----------------------------------------------------------------------------*/
302 #endif
303 
304