1. {
    2. WelsDecodeBs(pDstInfo)
    3. {
    4. ConstructAccessUnit()
    5. {
    6. DecodeCurrentAccessUnit()
    7. {
    8. int32_t iIdx = pCurAu->uiStartPos;
    9. int32_t iEndIdx = pCurAu->uiEndPos;
    10. while (iIdx <= iEndIdx)
    11. {
    12. /*
    13. * Loop decoding for slices (even FMO and/ multiple slices) within a dq layer
    14. */
    15. while (iIdx <= iEndIdx)
    16. {
    17. WelsDecodeSlice()
    18. {
    19. WelsCabacContextInit()
    20. InitCabacDecEngineFromBS()
    21. do
    22. {
    23. if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb))
    24. { // slice group boundary or end of a frame
    25. break;
    26. }
    27. WelsDecodeMbCabacISlice()
    28. {
    29. WelsDecodeMbCabacISliceBaseMode0()
    30. {//解析宏块,从MB_Type开始解析,到resi结束
    31. }
    32. if (pSliceHeader->pPps->uiNumSliceGroups > 1) {
    33. iNextMbXyIndex = FmoNextMb (pFmo, iNextMbXyIndex);
    34. } else {
    35. ++iNextMbXyIndex;
    36. }
    37. }
    38. }while(1)
    39. }
    40. WelsDecodeConstructSlice(pCtx)//解码得到Y值
    41. {
    42. WelsTargetSliceConstruction(pCtx)//得到Y值
    43. do{
    44. if (iCountNumMb >= iTotalNumMb)
    45. {
    46. break;
    47. }
    48. WelsTargetMbConstruction(pCtx)//解码一个宏块得到Y值
    49. {
    50. if(MbType == MB_TYPE_INTRA_PCM)
    51. {
    52. }
    53. else if(MbType == IS_INTRA)
    54. {//帧内预测
    55. PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
    56. WelsMbIntraPredictionConstruction(PWelsDecoderContext pCtx, PDqLayer pCurDqLayer, bool bOutput)//预测得到Y U V的值
    57. {//根据pDqLayer->pPred获得YUV的值
    58. //根据pCurDqLayer->pNzc[iMBXY]和pCurDqLayer->pScaledTCoeff
    59. if (IS_INTRA16x16)
    60. {
    61. RecI16x16Mb(iMbXy, pCtx, pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer)
    62. } else if (IS_INTRA8x8)
    63. {
    64. RecI8x8Mb();
    65. } else if (IS_INTRA4x4) {
    66. RecI4x4Mb();
    67. }
    68. }
    69. }
    70. else if(MbType == IS_INTER)
    71. {
    72. if (0 == pCurDqLayer->pCbp[pCurDqLayer->iMbXyIndex])
    73. { //uiCbp==0 include SKIP
    74. if (!CheckRefPics (pCtx)) {
    75. return ERR_INFO_MB_RECON_FAIL;
    76. }
    77. return WelsMbInterPrediction (pCtx, pCurDqLayer);
    78. }
    79. else
    80. {
    81. WelsMbInterConstruction (pCtx, pCurDqLayer);
    82. }
    83. }
    84. }
    85. }while(1)
    86. }
    87. }
    88. DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
    89. }
    90. }
    91. }
    92. }
    93. if (pDstInfo->iBufferStatus == 1)
    94. for(int i = 0; i < 32; i++)
    95. {//Y值
    96. printf("%d ", pDstInfo->pDst[0][i]);
    97. }
    98. }