PageRenderTime 34ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/Avc/avcdec_lib.h

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