⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h263dec.h

📁 audio-video-codecs.rar语音编解码器
💻 H
📖 第 1 页 / 共 2 页
字号:
        h263_Copy8x8HP_8u(pRef, stepRef, pCur, stepCur, mv, rc); \
    } \
}

#define h263_MC(pat, pRef, stepRef, pCur, stepCur, coeffMB) \
{ \
  if (pat) { \
    ippiAdd8x8HP_16s8u_C1RS(coeffMB, 16, pRef, stepRef, pCur, stepCur, 0, 0); \
  } else { \
    ippiCopy8x8_8u_C1R(pRef, stepRef, pCur, stepCur); \
  } \
}

#define h263_AddResidual(pat, pc, stepc, coeffMB) \
{ \
    if (pat) { \
        h263_Add8x8_16s8u(pc, coeffMB, stepc); \
    } \
}

#define h263_DecodeMCBlockInter(pInfo, quant, pat, pRef, pCur, step, coeffMB, mv, rounding) \
{ \
  if (pat) { \
    Ipp32s lnz; \
    Ipp32s modQ = pInfo->VideoSequence.VideoPicture.oppmodes.modQuant; \
    if (!pInfo->VideoSequence.VideoPicture.oppmodes.altInterVLC) { \
      if (ippiReconstructCoeffsInter_H263_1u16s(&pInfo->bufptr, &pInfo->bitoff, coeffMB, &lnz, quant, modQ) != ippStsNoErr) { \
        h263_Error("Error when decoding coefficients of Inter block"); \
        goto Err_1; \
      } \
    } else { \
      if (ippiDecodeCoeffsInter_H263_1u16s(&pInfo->bufptr, &pInfo->bitoff, coeffMB+64, &lnz, modQ, IPPVC_SCAN_NONE) != ippStsNoErr) { \
        if (ippiDecodeCoeffsIntra_H263_1u16s(&pInfo->bufptr, &pInfo->bitoff, coeffMB+64, &lnz, 1, modQ, IPPVC_SCAN_NONE) != ippStsNoErr) { \
          h263_Error("Error when decoding coefficients of a block in advanced INTER VLC mode"); \
          goto Err_1; \
        } \
      } \
      ippiQuantInvInter_H263_16s_C1I(coeffMB+64, lnz, quant, modQ); \
      ippiScanInv_16s_C1(coeffMB+64, coeffMB, lnz, IPPVC_SCAN_ZIGZAG); \
    } \
    if (lnz != 0) { \
      if ((lnz <= 4) && (coeffMB[16] == 0)) \
        ippiDCT8x8Inv_2x2_16s_C1I(coeffMB); \
      else if ((lnz <= 13) && (coeffMB[32] == 0)) \
        ippiDCT8x8Inv_4x4_16s_C1I(coeffMB); \
      else \
        ippiDCT8x8Inv_16s_C1I(coeffMB); \
    } else { \
      h263_Set64_16s((Ipp16s)((coeffMB[0] + 4) >> 3), coeffMB); \
    } \
    h263_Add8x8HP_16s8u(pRef, step, coeffMB, pCur, step, mv, rounding); \
    h263_StatisticInc_(&pInfo->VideoSequence.Statistic.nB_INTER_C); \
  } else { \
    h263_Copy8x8HP_8u(pRef, step, pCur, step, mv, rounding); \
    h263_StatisticInc_(&pInfo->VideoSequence.Statistic.nB_INTER_NC); \
  } \
}

#define h263_DecodeMCBlockInter_B(pInfo, quant, pat, pRef, stepR, pB, stepB, coeffMB) \
{ \
  if (pat) { \
    Ipp32s lnz; \
    Ipp32s modQ = pInfo->VideoSequence.VideoPicture.oppmodes.modQuant; \
    if (!pInfo->VideoSequence.VideoPicture.oppmodes.altInterVLC) { \
      if (ippiReconstructCoeffsInter_H263_1u16s(&pInfo->bufptr, &pInfo->bitoff, coeffMB, &lnz, quant, modQ) != ippStsNoErr) { \
        h263_Error("Error when decoding coefficients of Inter block"); \
        goto Err_1; \
      } \
    } else { \
      if (ippiDecodeCoeffsInter_H263_1u16s(&pInfo->bufptr, &pInfo->bitoff, coeffMB+64, &lnz, modQ, IPPVC_SCAN_NONE) != ippStsNoErr) { \
        if (ippiDecodeCoeffsIntra_H263_1u16s(&pInfo->bufptr, &pInfo->bitoff, coeffMB+64, &lnz, 1, modQ, IPPVC_SCAN_NONE) != ippStsNoErr) { \
          h263_Error("Error when decoding coefficients of a block in advanced INTER VLC mode"); \
          goto Err_1; \
        } \
      } \
      ippiQuantInvInter_H263_16s_C1I(coeffMB+64, lnz, quant, modQ); \
      ippiScanInv_16s_C1(coeffMB+64, coeffMB, lnz, IPPVC_SCAN_ZIGZAG); \
    } \
    if (lnz != 0) { \
      if ((lnz <= 4) && (coeffMB[16] == 0)) \
        ippiDCT8x8Inv_2x2_16s_C1I(coeffMB); \
      else if ((lnz <= 13) && (coeffMB[32] == 0)) \
        ippiDCT8x8Inv_4x4_16s_C1I(coeffMB); \
      else \
        ippiDCT8x8Inv_16s_C1I(coeffMB); \
    } else { \
      h263_Set64_16s((Ipp16s)((coeffMB[0] + 4) >> 3), coeffMB); \
    } \
    ippiAdd8x8HP_16s8u_C1RS(coeffMB, 16, pRef, stepR, pB, stepB, 0, 0); \
    h263_StatisticInc_(&pInfo->VideoSequence.Statistic.nB_INTER_C); \
  } else { \
    ippiCopy8x8_8u_C1R(pRef, stepR, pB, stepB); \
    h263_StatisticInc_(&pInfo->VideoSequence.Statistic.nB_INTER_NC); \
  } \
}

/*
//  decode cbpy for Intra MB
*/
__INLINE h263_Status h263_DecodeCBPY_I(h263_Info* pInfo, Ipp32s *yPattern)
{
  Ipp32u      code;

  code = h263_ShowBits9(pInfo, 6);
  *yPattern = h263_cbpy[code].code;
  if (h263_cbpy[code].len == 255) {
    h263_Error("Error when decoding cbpy of I-Frame macroblock");
    return H263_STATUS_ERROR;
  } else {
    h263_FlushBits(pInfo, h263_cbpy[code].len);
    return H263_STATUS_OK;
  }
}

/*
//  decode cbpy for Inter-Frame MB
*/
__INLINE h263_Status h263_DecodeCBPY_P(h263_Info* pInfo, Ipp32s *yPattern, Ipp32s mbType)
{
  Ipp32u code;

  code = h263_ShowBits9(pInfo, 6);
  if (mbType < IPPVC_MBTYPE_INTRA || mbType == IPPVC_MBTYPE_INTER4V_Q)
    *yPattern = 15 - h263_cbpy[code].code;
  else
    *yPattern = h263_cbpy[code].code;
  if (h263_cbpy[code].len == 255) {
    h263_Error("Error when decoding cbpy of P-Frame macroblock");
    return H263_STATUS_ERROR;
  } else {
    h263_FlushBits(pInfo, h263_cbpy[code].len);
    return H263_STATUS_OK;
  }
}

/*
//  decode cbpy for B-Frame MB
*/
__INLINE h263_Status h263_DecodeCBPY_B(h263_Info* pInfo, Ipp32s *yPattern, Ipp32s mbType)
{
  Ipp32u code;

  code = h263_ShowBits9(pInfo, 6);
  if (mbType == IPPVC_MBTYPE_INTRA || mbType == IPPVC_MBTYPE_INTRA_Q)
    *yPattern = h263_cbpy[code].code;
  else
    *yPattern = 15 - h263_cbpy[code].code;

  if (h263_cbpy[code].len == 255) {
    h263_Error("Error when decoding cbpy of B-Frame macroblock");
    return H263_STATUS_ERROR;
  } else {
    h263_FlushBits(pInfo, h263_cbpy[code].len);
    return H263_STATUS_OK;
  }
}

#define h263_Decode_CBPC_B(pInfo, cbpc) \
{ \
  Ipp32u code; \
  h263_VLC1 vlc; \
  code = h263_ShowBits9(pInfo, 3); \
  vlc = h263_Bmb_cbpc[code]; \
  cbpc = vlc.code; \
  h263_FlushBits(pInfo, vlc.len); \
}

#define h263_AdvI_PredMode(pInfo, predMode) { \
  if (h263_GetBit(pInfo)) { \
    if (h263_GetBit(pInfo)) \
      predMode = IPPVC_SCAN_VERTICAL; \
    else \
      predMode = IPPVC_SCAN_HORIZONTAL; \
  } else \
    predMode = IPPVC_SCAN_ZIGZAG; \
}

#define H263_MB_INTERNAL_HOR_DEBLOCKING_LUM(pYc, stepYc, quant) \
{ \
  ippiFilterDeblocking8x8HorEdge_H263_8u_C1IR(pYc + 8*stepYc, stepYc, quant); \
  ippiFilterDeblocking8x8HorEdge_H263_8u_C1IR(pYc + 8 + 8*stepYc, stepYc, quant); \
}

#define H263_MB_INTERNAL_VER_DEBLOCKING_LUM(pYc, stepYc, quant) \
{ \
  ippiFilterDeblocking8x8VerEdge_H263_8u_C1IR(pYc + 8, stepYc, quant); \
  ippiFilterDeblocking8x8VerEdge_H263_8u_C1IR(pYc + 8 + 8*stepYc, stepYc, quant); \
}

#define H263_MB_HOR_DEBLOCKING(pYc, stepYc, pCbc, stepCbc, pCrc, stepCrc, quant, quant_c) \
{ \
  ippiFilterDeblocking8x8HorEdge_H263_8u_C1IR(pYc, stepYc, quant); \
  ippiFilterDeblocking8x8HorEdge_H263_8u_C1IR(pYc + 8, stepYc, quant); \
  ippiFilterDeblocking8x8HorEdge_H263_8u_C1IR(pCbc, stepCbc, quant_c); \
  ippiFilterDeblocking8x8HorEdge_H263_8u_C1IR(pCrc, stepCrc, quant_c); \
}

#define H263_MB_VER_DEBLOCKING(pYc, stepYc, pCbc, stepCbc, pCrc, stepCrc, quant, quant_c) \
{ \
  ippiFilterDeblocking8x8VerEdge_H263_8u_C1IR(pYc, stepYc, quant); \
  ippiFilterDeblocking8x8VerEdge_H263_8u_C1IR(pYc + 8*stepYc, stepYc, quant); \
  ippiFilterDeblocking8x8VerEdge_H263_8u_C1IR(pCbc, stepCbc, quant_c); \
  ippiFilterDeblocking8x8VerEdge_H263_8u_C1IR(pCrc, stepCrc, quant_c); \
}

extern void h263_DecodeMODB_iPB(h263_Info* pInfo, Ipp32s *bmb_type, Ipp32s *cbpb, Ipp32s *mvdb);
extern h263_Status h263_PredictDecodeMV(h263_Info *pInfo, h263_MacroBlock *MBcurr, Ipp32s frGOB, Ipp32s y, Ipp32s x, Ipp32s adv);
extern h263_Status h263_DecodeMVD(h263_Info *pInfo, Ipp32s *mvdx,  Ipp32s *mvdy, Ipp32s fcode);
extern h263_Status h263_DecodeMV(h263_Info *pInfo, IppMotionVector *mv, Ipp32s leftlim, Ipp32s rightlim);
extern h263_Status h263_DecodeMVD_umvplus(h263_Info *pInfo, Ipp32s *mvdx, Ipp32s *mvdy);
extern h263_Status h263_DecodeMacroBlockIntra(h263_Info *pInfo, Ipp32s pat, Ipp32s quant, Ipp32s quant_c, Ipp8u *pR[], Ipp32s stepR[]);
extern h263_Status h263_DecodeMacroBlockIntra_AdvI(h263_Info *pInfo, Ipp32s x, Ipp32s pat, Ipp32s quant, Ipp32s quant_c,
                                                   Ipp32s scan, Ipp8u *pR[], Ipp32s stepR[]);
extern h263_Status h263_DecodeMacroBlockInter(h263_Info *pInfo, Ipp16s *coeffMB, Ipp32s quant, Ipp32s quant_c, Ipp32s pat);
extern h263_Status h263_BidirPredMacroblock(Ipp8u *pYr, Ipp32s stepYr, Ipp8u *pCbr, Ipp8u* pCrr, Ipp32s stepCbr,
                                            Ipp8u *pYc, Ipp32s stepYc, Ipp8u *pCbc, Ipp8u* pCrc, Ipp32s stepCbc,
                                            Ipp8u *predMB, IppMotionVector *mvForw, IppMotionVector *mvFCbCr,
                                            IppMotionVector *mvBack,  IppMotionVector *mvBCbCr, Ipp32s fourMVmode);
extern h263_Status h263_DecodeVideoPicture(h263_Info* pInfo);
extern h263_Status h263_DecodeMCBPC_P(h263_Info* pInfo, Ipp32s *mbType, Ipp32s *mbPattern, Ipp32s stat);
extern h263_Status h263_PredictDecode4MV(h263_Info *pInfo, h263_MacroBlock *MBcurr, Ipp32s frGOB, Ipp32s y, Ipp32s x);
extern void h263_OBMC(h263_Info *pInfo, h263_MacroBlock *pMBinfo, IppMotionVector *mvCur, Ipp32s colNum, Ipp32s rowNum,
                      IppiRect limitRectL, Ipp8u *pYc, Ipp32s stepYc, Ipp8u *pYr, Ipp32s stepYr, Ipp32s cbpy, Ipp16s *coeffMB);
extern h263_Status h263_DecodeFrame_I(h263_Info* pInfo);
extern h263_Status h263_DecodeFrame_P(h263_Info* pInfo, h263_Frame* refFrame);
extern h263_Status h263_DecodeFrame_B(h263_Info* pInfo, h263_EnhancedLayer *Layer, h263_Frame* refFrame);
extern h263_Status h263_DecodeFrame_EI(h263_Info* pInfo, h263_EnhancedLayer *Layer);
extern h263_Status h263_DecodeFrame_EP(h263_Info* pInfo, h263_EnhancedLayer *Layer, h263_Frame* refFrame);
extern Ipp32s h263_UpdateQuant_Mod(h263_Info *pInfo);
extern void h263_DeblockingFilter_P(h263_Info *pInfo, h263_Frame *frame);
extern void h263_DeblockingFilter_I(h263_Info *pInfo, h263_Frame *frame);
extern h263_Status h263_DecodeMBTYPE_B(h263_Info* pInfo, Ipp32s *mbType, Ipp32s *cbp, Ipp32s *dquant);
extern h263_Status h263_DecodeMCBPC_EI(h263_Info* pInfo, Ipp32s *mbType, Ipp32s *mbPattern);
extern h263_Status h263_DecodeMBTYPE_EP(h263_Info* pInfo, Ipp32s *mbType, Ipp32s *cbp, Ipp32s *dquant);
extern void h263_CopyMacroBlocks(h263_Frame *rFrame, h263_Frame *cFrame, Ipp32s mbPerRow, Ipp32s rowNum, Ipp32s colNum, Ipp32s n);

#ifdef _OMP_KARABAS

#define H263_NUM_THREADS 2

extern h263_Status h263_DecodeFrame_P_MT(h263_Info* pInfo, h263_Frame *refFrame);
extern h263_Status h263_DecodeFrame_I_MT(h263_Info* pInfo);
extern h263_Status h263_DecodeDequantMacroBlockIntra(h263_Info *pInfo, Ipp32s x, Ipp32s pat, Ipp32s quant, Ipp32s quant_c,
                                                     Ipp32s scan, Ipp16s *coeffMB, Ipp8u lastNZ[]);
extern h263_Status h263_DecodeDequantMacroBlockInter(h263_Info *pInfo, Ipp32s pat, Ipp32s quant, Ipp32s quant_c,
                                                     Ipp16s *coeffMB, Ipp8u lastNZ[]);
extern void h263_DCT_MacroBlockInter(Ipp16s *coeffMB, Ipp8u lastNZ[], Ipp32s pat);
extern void h263_DeblockingFilterHor_P_MT(h263_Info *pInfo, Ipp32s curRow);
extern void h263_DeblockingFilterVer_P_MT(h263_Info *pInfo, Ipp32s curRow);
extern void h263_DeblockingFilterHor_I_MT(h263_Info *pInfo, Ipp32s curRow);
extern void h263_DeblockingFilterVer_I_MT(h263_Info *pInfo, Ipp32s curRow);
#endif

#ifdef __cplusplus
}
#endif

#endif  /* _H263DEC_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -