• 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 /**
19 This file contains declarations of internal functions for AVC decoder library.
20 @publishedAll
21 */
22 #ifndef _AVCDEC_LIB_H_
23 #define _AVCDEC_LIB_H_
24 
25 #include "avclib_common.h"
26 #include "avcdec_int.h"
27 
28 /*----------- avcdec_api.c -------------*/
29 /**
30 This function takes out the emulation prevention bytes from the input to creat RBSP.
31 The result is written over the input bitstream.
32 \param "nal_unit"   "(I/O) Pointer to the input buffer."
33 \param "size"       "(I/O) Pointer to the size of the input/output buffer."
34 \return "AVCDEC_SUCCESS for success and AVCDEC_FAIL otherwise."
35 */
36 AVCDec_Status EBSPtoRBSP(uint8 *nal_unit, int *size);
37 
38 /*------------- pred_intra.c ---------------*/
39 /**
40 This function is the main entry point to intra prediction operation on a
41 macroblock.
42 \param "video"  "Pointer to AVCCommonObj."
43 */
44 AVCStatus  IntraMBPrediction(AVCCommonObj *video);
45 
46 void SaveNeighborForIntraPred(AVCCommonObj *video, int offset);
47 
48 AVCStatus Intra_4x4(AVCCommonObj *video, int component, int SubBlock_indx, uint8 *comp);
49 void Intra_4x4_Vertical(AVCCommonObj *video, int block_offset);
50 void Intra_4x4_Horizontal(AVCCommonObj *video, int pitch, int block_offset);
51 void Intra_4x4_DC(AVCCommonObj *video, int pitch, int block_offset, AVCNeighborAvailability *availability);
52 void Intra_4x4_Down_Left(AVCCommonObj *video, int block_offset, AVCNeighborAvailability *availability);
53 void Intra_4x4_Diagonal_Down_Right(AVCCommonObj *video, int pitch, int block_offset);
54 void Intra_4x4_Diagonal_Vertical_Right(AVCCommonObj *video, int pitch, int block_offset);
55 void Intra_4x4_Diagonal_Horizontal_Down(AVCCommonObj *video, int pitch, int block_offset);
56 void Intra_4x4_Vertical_Left(AVCCommonObj *video,  int block_offset, AVCNeighborAvailability *availability);
57 void Intra_4x4_Horizontal_Up(AVCCommonObj *video, int pitch, int block_offset);
58 void  Intra_16x16_Vertical(AVCCommonObj *video);
59 void Intra_16x16_Horizontal(AVCCommonObj *video, int pitch);
60 void Intra_16x16_DC(AVCCommonObj *video, int pitch);
61 void Intra_16x16_Plane(AVCCommonObj *video, int pitch);
62 void Intra_Chroma_DC(AVCCommonObj *video, int pitch, uint8 *predCb, uint8 *predCr);
63 void  Intra_Chroma_Horizontal(AVCCommonObj *video, int pitch, uint8 *predCb, uint8 *predCr);
64 void  Intra_Chroma_Vertical(AVCCommonObj *video, uint8 *predCb, uint8 *predCr);
65 void  Intra_Chroma_Plane(AVCCommonObj *video, int pitch, uint8 *predCb, uint8 *predCr);
66 
67 /*------------ pred_inter.c ---------------*/
68 /**
69 This function is the main entrance to inter prediction operation for
70 a macroblock. For decoding, this function also calls inverse transform and
71 compensation.
72 \param "video"  "Pointer to AVCCommonObj."
73 \return "void"
74 */
75 void InterMBPrediction(AVCCommonObj *video);
76 
77 /**
78 This function is called for luma motion compensation.
79 \param "ref"    "Pointer to the origin of a reference luma."
80 \param "picwidth"   "Width of the picture."
81 \param "picheight"  "Height of the picture."
82 \param "x_pos"  "X-coordinate of the predicted block in quarter pel resolution."
83 \param "y_pos"  "Y-coordinate of the predicted block in quarter pel resolution."
84 \param "pred"   "Pointer to the output predicted block."
85 \param "pred_pitch" "Width of pred."
86 \param "blkwidth"   "Width of the current partition."
87 \param "blkheight"  "Height of the current partition."
88 \return "void"
89 */
90 void LumaMotionComp(uint8 *ref, int picwidth, int picheight,
91                     int x_pos, int y_pos,
92                     uint8 *pred, int pred_pitch,
93                     int blkwidth, int blkheight);
94 
95 /**
96 Functions below are special cases for luma motion compensation.
97 LumaFullPelMC is for full pixel motion compensation.
98 LumaBorderMC is for interpolation in only one dimension.
99 LumaCrossMC is for interpolation in one dimension and half point in the other dimension.
100 LumaDiagonalMC is for interpolation in diagonal direction.
101 
102 \param "ref"    "Pointer to the origin of a reference luma."
103 \param "picwidth"   "Width of the picture."
104 \param "picheight"  "Height of the picture."
105 \param "x_pos"  "X-coordinate of the predicted block in full pel resolution."
106 \param "y_pos"  "Y-coordinate of the predicted block in full pel resolution."
107 \param "dx"     "Fraction of x_pos in quarter pel."
108 \param "dy"     "Fraction of y_pos in quarter pel."
109 \param "curr"   "Pointer to the current partition in the current picture."
110 \param "residue"    "Pointer to the current partition for the residue block."
111 \param "blkwidth"   "Width of the current partition."
112 \param "blkheight"  "Height of the current partition."
113 \return "void"
114 */
115 void CreatePad(uint8 *ref, int picwidth, int picheight, int x_pos, int y_pos,
116                uint8 *out, int blkwidth, int blkheight);
117 
118 void FullPelMC(uint8 *in, int inwidth, uint8 *out, int outpitch,
119                int blkwidth, int blkheight);
120 
121 void HorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
122                    int blkwidth, int blkheight, int dx);
123 
124 void HorzInterp2MC(int *in, int inpitch, uint8 *out, int outpitch,
125                    int blkwidth, int blkheight, int dx);
126 
127 void HorzInterp3MC(uint8 *in, int inpitch, int *out, int outpitch,
128                    int blkwidth, int blkheight);
129 
130 void VertInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
131                    int blkwidth, int blkheight, int dy);
132 
133 void VertInterp2MC(uint8 *in, int inpitch, int *out, int outpitch,
134                    int blkwidth, int blkheight);
135 
136 void VertInterp3MC(int *in, int inpitch, uint8 *out, int outpitch,
137                    int blkwidth, int blkheight, int dy);
138 
139 void DiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
140                       uint8 *out, int outpitch,
141                       int blkwidth, int blkheight);
142 
143 
144 void ChromaMotionComp(uint8 *ref, int picwidth, int picheight,
145                       int x_pos, int y_pos, uint8 *pred, int pred_pitch,
146                       int blkwidth, int blkheight);
147 
148 void ChromaFullPelMC(uint8 *in, int inpitch, uint8 *out, int outpitch,
149                      int blkwidth, int blkheight) ;
150 void ChromaBorderMC(uint8 *ref, int picwidth, int dx, int dy,
151                     uint8 *pred, int pred_pitch, int blkwidth, int blkheight);
152 void ChromaDiagonalMC(uint8 *ref, int picwidth, int dx, int dy,
153                       uint8 *pred, int pred_pitch, int blkwidth, int blkheight);
154 
155 void ChromaFullPelMCOutside(uint8 *ref, uint8 *pred, int pred_pitch,
156                             int blkwidth, int blkheight, int x_inc,
157                             int y_inc0, int y_inc1, int x_mid, int y_mid);
158 void ChromaBorderMCOutside(uint8 *ref, int picwidth, int dx, int dy,
159                            uint8 *pred, int pred_pitch, int blkwidth, int blkheight,
160                            int x_inc, int z_inc, int y_inc0, int y_inc1, int x_mid, int y_mid);
161 void ChromaDiagonalMCOutside(uint8 *ref, int picwidth,
162                              int dx, int dy, uint8 *pred, int pred_pitch,
163                              int blkwidth, int blkheight, int x_inc, int z_inc,
164                              int y_inc0, int y_inc1, int x_mid, int y_mid);
165 
166 void ChromaDiagonalMC_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
167                            uint8 *pOut, int predPitch, int blkwidth, int blkheight);
168 
169 void ChromaHorizontalMC_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
170                              uint8 *pOut, int predPitch, int blkwidth, int blkheight);
171 
172 void ChromaVerticalMC_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
173                            uint8 *pOut, int predPitch, int blkwidth, int blkheight);
174 
175 void ChromaFullMC_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
176                        uint8 *pOut, int predPitch, int blkwidth, int blkheight);
177 
178 void ChromaVerticalMC2_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
179                             uint8 *pOut, int predPitch, int blkwidth, int blkheight);
180 
181 void ChromaHorizontalMC2_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
182                               uint8 *pOut, int predPitch, int blkwidth, int blkheight);
183 
184 void ChromaDiagonalMC2_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
185                             uint8 *pOut, int predPitch, int blkwidth, int blkheight);
186 
187 
188 /*----------- slice.c ---------------*/
189 /**
190 This function performs the main decoding loop for slice data including
191 INTRA/INTER prediction, transform and quantization and compensation.
192 See decode_frame_slice() in JM.
193 \param "video"  "Pointer to AVCDecObject."
194 \return "AVCDEC_SUCCESS for success, AVCDEC_PICTURE_READY for end-of-picture and AVCDEC_FAIL otherwise."
195 */
196 AVCDec_Status DecodeSlice(AVCDecObject *video);
197 AVCDec_Status ConcealSlice(AVCDecObject *decvid, int mbnum_start, int mbnum_end);
198 /**
199 This function performs the decoding of one macroblock.
200 \param "video"  "Pointer to AVCDecObject."
201 \param "prevMbSkipped"  "A value derived in 7.3.4."
202 \return "AVCDEC_SUCCESS for success or AVCDEC_FAIL otherwise."
203 */
204 AVCDec_Status DecodeMB(AVCDecObject *video);
205 
206 /**
207 This function performs macroblock prediction type decoding as in subclause 7.3.5.1.
208 \param "video" "Pointer to AVCCommonObj."
209 \param "currMB" "Pointer to the current macroblock."
210 \param "stream" "Pointer to AVCDecBitstream."
211 \return "AVCDEC_SUCCESS for success or AVCDEC_FAIL otherwise."
212 */
213 AVCDec_Status mb_pred(AVCCommonObj *video, AVCMacroblock *currMB, AVCDecBitstream *stream);
214 
215 /**
216 This function performs sub-macroblock prediction type decoding as in subclause 7.3.5.2.
217 \param "video" "Pointer to AVCCommonObj."
218 \param "currMB" "Pointer to the current macroblock."
219 \param "stream" "Pointer to AVCDecBitstream."
220 \return "AVCDEC_SUCCESS for success or AVCDEC_FAIL otherwise."
221 */
222 AVCDec_Status sub_mb_pred(AVCCommonObj *video, AVCMacroblock *currMB, AVCDecBitstream *stream);
223 
224 /**
225 This function interprets the mb_type and sets necessary information
226 when the slice type is AVC_I_SLICE.
227 in the macroblock structure.
228 \param "mblock" "Pointer to current AVCMacroblock."
229 \param "mb_type" "From the syntax bitstream."
230 \return "void"
231 */
232 void InterpretMBModeI(AVCMacroblock *mblock, uint mb_type);
233 
234 /**
235 This function interprets the mb_type and sets necessary information
236 when the slice type is AVC_P_SLICE.
237 in the macroblock structure.
238 \param "mblock" "Pointer to current AVCMacroblock."
239 \param "mb_type" "From the syntax bitstream."
240 \return "void"
241 */
242 void InterpretMBModeP(AVCMacroblock *mblock, uint mb_type);
243 
244 /**
245 This function interprets the mb_type and sets necessary information
246 when the slice type is AVC_B_SLICE.
247 in the macroblock structure.
248 \param "mblock" "Pointer to current AVCMacroblock."
249 \param "mb_type" "From the syntax bitstream."
250 \return "void"
251 */
252 void InterpretMBModeB(AVCMacroblock *mblock, uint mb_type);
253 
254 /**
255 This function interprets the mb_type and sets necessary information
256 when the slice type is AVC_SI_SLICE.
257 in the macroblock structure.
258 \param "mblock" "Pointer to current AVCMacroblock."
259 \param "mb_type" "From the syntax bitstream."
260 \return "void"
261 */
262 void InterpretMBModeSI(AVCMacroblock *mblock, uint mb_type);
263 
264 /**
265 This function interprets the sub_mb_type and sets necessary information
266 when the slice type is AVC_P_SLICE.
267 in the macroblock structure.
268 \param "mblock" "Pointer to current AVCMacroblock."
269 \param "sub_mb_type" "From the syntax bitstream."
270 \return "void"
271 */
272 void InterpretSubMBModeP(AVCMacroblock *mblock, uint *sub_mb_type);
273 
274 /**
275 This function interprets the sub_mb_type and sets necessary information
276 when the slice type is AVC_B_SLICE.
277 in the macroblock structure.
278 \param "mblock" "Pointer to current AVCMacroblock."
279 \param "sub_mb_type" "From the syntax bitstream."
280 \return "void"
281 */
282 void InterpretSubMBModeB(AVCMacroblock *mblock, uint *sub_mb_type);
283 
284 /**
285 This function decodes the Intra4x4 prediction mode from neighboring information
286 and from the decoded syntax.
287 \param "video"  "Pointer to AVCCommonObj."
288 \param "currMB" "Pointer to current macroblock."
289 \param "stream" "Pointer to AVCDecBitstream."
290 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
291 */
292 AVCDec_Status DecodeIntra4x4Mode(AVCCommonObj *video, AVCMacroblock *currMB, AVCDecBitstream *stream);
293 
294 /*----------- vlc.c -------------------*/
295 /**
296 This function reads and decodes Exp-Golomb codes.
297 \param "bitstream" "Pointer to AVCDecBitstream."
298 \param "codeNum" "Pointer to the value of the codeNum."
299 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
300 */
301 AVCDec_Status ue_v(AVCDecBitstream *bitstream, uint *codeNum);
302 
303 /**
304 This function reads and decodes signed Exp-Golomb codes.
305 \param "bitstream" "Pointer to AVCDecBitstream."
306 \param "value"  "Pointer to syntax element value."
307 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
308 */
309 AVCDec_Status  se_v(AVCDecBitstream *bitstream, int *value);
310 
311 /**
312 This function reads and decodes signed Exp-Golomb codes for
313 32 bit codeword.
314 \param "bitstream" "Pointer to AVCDecBitstream."
315 \param "value"  "Pointer to syntax element value."
316 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
317 */
318 AVCDec_Status  se_v32bit(AVCDecBitstream *bitstream, int32 *value);
319 
320 /**
321 This function reads and decodes truncated Exp-Golomb codes.
322 \param "bitstream" "Pointer to AVCDecBitstream."
323 \param "value"  "Pointer to syntax element value."
324 \param "range"  "Range of the value as input to determine the algorithm."
325 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
326 */
327 AVCDec_Status te_v(AVCDecBitstream *bitstream, uint *value, uint range);
328 
329 /**
330 This function parse Exp-Golomb code from the bitstream.
331 \param "bitstream" "Pointer to AVCDecBitstream."
332 \param "leadingZeros" "Pointer to the number of leading zeros."
333 \param "infobits"   "Pointer to the value after leading zeros and the first one.
334                     The total number of bits read is 2*leadingZeros + 1."
335 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
336 */
337 AVCDec_Status GetEGBitstring(AVCDecBitstream *bitstream, int *leadingZeros, int *infobits);
338 
339 /**
340 This function parse Exp-Golomb code from the bitstream for 32 bit codewords.
341 \param "bitstream" "Pointer to AVCDecBitstream."
342 \param "leadingZeros" "Pointer to the number of leading zeros."
343 \param "infobits"   "Pointer to the value after leading zeros and the first one.
344                     The total number of bits read is 2*leadingZeros + 1."
345 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
346 */
347 AVCDec_Status GetEGBitstring32bit(AVCDecBitstream *bitstream, int *leadingZeros, uint32 *infobits);
348 
349 /**
350 This function performs CAVLC decoding of the CBP (coded block pattern) of a macroblock
351 by calling ue_v() and then mapping the codeNum to the corresponding CBP value.
352 \param "currMB"  "Pointer to the current AVCMacroblock structure."
353 \param "stream"  "Pointer to the AVCDecBitstream."
354 \return "void"
355 */
356 AVCDec_Status DecodeCBP(AVCMacroblock *currMB, AVCDecBitstream *stream);
357 
358 /**
359 This function decodes the syntax for trailing ones and total coefficient.
360 Subject to optimization.
361 \param "stream" "Pointer to the AVCDecBitstream."
362 \param "TrailingOnes"   "Pointer to the trailing one variable output."
363 \param "TotalCoeff" "Pointer to the total coefficient variable output."
364 \param "nC" "Context for number of nonzero coefficient (prediction context)."
365 \return "AVCDEC_SUCCESS for success."
366 */
367 AVCDec_Status ce_TotalCoeffTrailingOnes(AVCDecBitstream *stream, int *TrailingOnes, int *TotalCoeff, int nC);
368 
369 /**
370 This function decodes the syntax for trailing ones and total coefficient for
371 chroma DC block. Subject to optimization.
372 \param "stream" "Pointer to the AVCDecBitstream."
373 \param "TrailingOnes"   "Pointer to the trailing one variable output."
374 \param "TotalCoeff" "Pointer to the total coefficient variable output."
375 \return "AVCDEC_SUCCESS for success."
376 */
377 AVCDec_Status ce_TotalCoeffTrailingOnesChromaDC(AVCDecBitstream *stream, int *TrailingOnes, int *TotalCoeff);
378 
379 /**
380 This function decode a VLC table with 2 output.
381 \param "stream" "Pointer to the AVCDecBitstream."
382 \param "lentab" "Table for code length."
383 \param "codtab" "Table for code value."
384 \param "tabwidth" "Width of the table or alphabet size of the first output."
385 \param "tabheight"  "Height of the table or alphabet size of the second output."
386 \param "code1"  "Pointer to the first output."
387 \param "code2"  "Pointer to the second output."
388 \return "AVCDEC_SUCCESS for success."
389 */
390 AVCDec_Status code_from_bitstream_2d(AVCDecBitstream *stream, int *lentab, int *codtab, int tabwidth,
391                                      int tabheight, int *code1, int *code2);
392 
393 /**
394 This function decodes the level_prefix VLC value as in Table 9-6.
395 \param "stream" "Pointer to the AVCDecBitstream."
396 \param "code"   "Pointer to the output."
397 \return "AVCDEC_SUCCESS for success."
398 */
399 AVCDec_Status ce_LevelPrefix(AVCDecBitstream *stream, uint *code);
400 
401 /**
402 This function decodes total_zeros VLC syntax as in Table 9-7 and 9-8.
403 \param "stream" "Pointer to the AVCDecBitstream."
404 \param "code"   "Pointer to the output."
405 \param "TotalCoeff" "Context parameter."
406 \return "AVCDEC_SUCCESS for success."
407 */
408 AVCDec_Status ce_TotalZeros(AVCDecBitstream *stream, int *code, int TotalCoeff);
409 
410 /**
411 This function decodes total_zeros VLC syntax for chroma DC as in Table 9-9.
412 \param "stream" "Pointer to the AVCDecBitstream."
413 \param "code"   "Pointer to the output."
414 \param "TotalCoeff" "Context parameter."
415 \return "AVCDEC_SUCCESS for success."
416 */
417 AVCDec_Status ce_TotalZerosChromaDC(AVCDecBitstream *stream, int *code, int TotalCoeff);
418 
419 /**
420 This function decodes run_before VLC syntax as in Table 9-10.
421 \param "stream" "Pointer to the AVCDecBitstream."
422 \param "code"   "Pointer to the output."
423 \param "zeroLeft"   "Context parameter."
424 \return "AVCDEC_SUCCESS for success."
425 */
426 AVCDec_Status ce_RunBefore(AVCDecBitstream *stream, int *code, int zeroLeft);
427 
428 /*----------- header.c -------------------*/
429 /**
430 This function parses vui_parameters.
431 \param "decvid" "Pointer to AVCDecObject."
432 \param "stream" "Pointer to AVCDecBitstream."
433 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
434 */
435 AVCDec_Status vui_parameters(AVCDecObject *decvid, AVCDecBitstream *stream, AVCSeqParamSet *currSPS);
436 AVCDec_Status sei_payload(AVCDecObject *decvid, AVCDecBitstream *stream, uint payloadType, uint payloadSize);
437 
438 AVCDec_Status buffering_period(AVCDecObject *decvid, AVCDecBitstream *stream);
439 AVCDec_Status pic_timing(AVCDecObject *decvid, AVCDecBitstream *stream);
440 AVCDec_Status recovery_point(AVCDecObject *decvid, AVCDecBitstream *stream);
441 AVCDec_Status dec_ref_pic_marking_repetition(AVCDecObject *decvid, AVCDecBitstream *stream);
442 AVCDec_Status motion_constrained_slice_group_set(AVCDecObject *decvid, AVCDecBitstream *stream);
443 
444 
445 /**
446 This function parses hrd_parameters.
447 \param "decvid" "Pointer to AVCDecObject."
448 \param "stream" "Pointer to AVCDecBitstream."
449 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
450 */
451 AVCDec_Status hrd_parameters(AVCDecObject *decvid, AVCDecBitstream *stream, AVCHRDParams *HRDParam);
452 
453 /**
454 This function decodes the syntax in sequence parameter set slice and fill up the AVCSeqParamSet
455 structure.
456 \param "decvid" "Pointer to AVCDecObject."
457 \param "video" "Pointer to AVCCommonObj."
458 \param "stream" "Pointer to AVCDecBitstream."
459 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
460 */
461 AVCDec_Status DecodeSPS(AVCDecObject *decvid, AVCDecBitstream *stream);
462 
463 /**
464 This function decodes the syntax in picture parameter set and fill up the AVCPicParamSet
465 structure.
466 \param "decvid" "Pointer to AVCDecObject."
467 \param "video" "Pointer to AVCCommonObj."
468 \param "stream" "Pointer to AVCDecBitstream."
469 \return "AVCDEC_SUCCESS or AVCDEC_FAIL."
470 */
471 AVCDec_Status DecodePPS(AVCDecObject *decvid, AVCCommonObj *video, AVCDecBitstream *stream);
472 AVCDec_Status DecodeSEI(AVCDecObject *decvid, AVCDecBitstream *stream);
473 
474 /**
475 This function decodes slice header, calls related functions such as
476 reference picture list reordering, prediction weight table, decode ref marking.
477 See FirstPartOfSliceHeader() and RestOfSliceHeader() in JM.
478 \param "decvid" "Pointer to AVCDecObject."
479 \param "video" "Pointer to AVCCommonObj."
480 \param "stream" "Pointer to AVCDecBitstream."
481 \return "AVCDEC_SUCCESS for success and AVCDEC_FAIL otherwise."
482 */
483 AVCDec_Status DecodeSliceHeader(AVCDecObject *decvid, AVCCommonObj *video, AVCDecBitstream *stream);
484 
485 /**
486 This function performes necessary operations to create dummy frames when
487 there is a gap in frame_num.
488 \param "video"  "Pointer to AVCCommonObj."
489 \return "AVCDEC_SUCCESS for success and AVCDEC_FAIL otherwise."
490 */
491 AVCDec_Status fill_frame_num_gap(AVCHandle *avcHandle, AVCCommonObj *video);
492 
493 /**
494 This function decodes ref_pic_list_reordering related syntax and fill up the AVCSliceHeader
495 structure.
496 \param "video" "Pointer to AVCCommonObj."
497 \param "stream" "Pointer to AVCDecBitstream."
498 \param "sliceHdr" "Pointer to AVCSliceHdr."
499 \param "slice_type" "Value of slice_type - 5 if greater than 5."
500 \return "AVCDEC_SUCCESS for success and AVCDEC_FAIL otherwise."
501 */
502 AVCDec_Status ref_pic_list_reordering(AVCCommonObj *video, AVCDecBitstream *stream, AVCSliceHeader *sliceHdr, int slice_type);
503 
504 /**
505 This function decodes dec_ref_pic_marking related syntax  and fill up the AVCSliceHeader
506 structure.
507 \param "video" "Pointer to AVCCommonObj."
508 \param "stream" "Pointer to AVCDecBitstream."
509 \param "sliceHdr" "Pointer to AVCSliceHdr."
510 \return "AVCDEC_SUCCESS for success and AVCDEC_FAIL otherwise."
511 */
512 AVCDec_Status dec_ref_pic_marking(AVCCommonObj *video, AVCDecBitstream *stream, AVCSliceHeader *sliceHdr);
513 
514 /**
515 This function performs POC related operation prior to decoding a picture
516 \param "video" "Pointer to AVCCommonObj."
517 \return "AVCDEC_SUCCESS for success and AVCDEC_FAIL otherwise."
518 See also PostPOC() for initialization of some variables.
519 */
520 AVCDec_Status DecodePOC(AVCCommonObj *video);
521 
522 
523 
524 /*------------ residual.c ------------------*/
525 /**
526 This function decodes the intra pcm data and fill it in the corresponding location
527 on the current picture.
528 \param "video"  "Pointer to AVCCommonObj."
529 \param "stream" "Pointer to AVCDecBitstream."
530 */
531 AVCDec_Status DecodeIntraPCM(AVCCommonObj *video, AVCDecBitstream *stream);
532 
533 /**
534 This function performs residual syntax decoding as well as quantization and transformation of
535 the decoded coefficients. See subclause 7.3.5.3.
536 \param "video"  "Pointer to AVCDecObject."
537 \param "currMB" "Pointer to current macroblock."
538 */
539 AVCDec_Status residual(AVCDecObject *video, AVCMacroblock *currMB);
540 
541 /**
542 This function performs CAVLC syntax decoding to get the run and level information of the coefficients.
543 \param "video"  "Pointer to AVCDecObject."
544 \param "type"   "One of AVCResidualType for a particular 4x4 block."
545 \param "bx"     "Horizontal block index."
546 \param "by"     "Vertical block index."
547 \param "level"  "Pointer to array of level for output."
548 \param "run"    "Pointer to array of run for output."
549 \param "numcoeff"   "Pointer to the total number of nonzero coefficients."
550 \return "AVCDEC_SUCCESS for success."
551 */
552 AVCDec_Status residual_block_cavlc(AVCDecObject *video, int nC, int maxNumCoeff,
553                                    int *level, int *run, int *numcoeff);
554 
555 #endif /* _AVCDEC_LIB_H_ */
556