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

📄 umc_mpeg2_dec_defs.h

📁 audio-video-codecs.rar语音编解码器
💻 H
📖 第 1 页 / 共 3 页
字号:

//Bitstream
    Ipp8u*       bs_curr_ptr;
    Ipp32s       bs_bit_offset;
    Ipp8u*       bs_start_ptr;
    Ipp8u*       bs_end_ptr;

} IppVideoContext;

} // namespace UMC

extern Ipp16s zero_memory[64*8];

/*******************************************************/

#ifdef __cplusplus
extern "C" {
#endif

#define ippiCopy8x16_8u_C1R(pSrc, srcStep, pDst, dstStep)                   \
  ippiCopy8x8_8u_C1R(pSrc, srcStep, pDst, dstStep);                         \
  ippiCopy8x8_8u_C1R(pSrc + 8*(srcStep), srcStep, pDst + 8*(dstStep), dstStep);

#define ippiCopy8x16HP_8u_C1R(pSrc, srcStep, pDst, dstStep, acc, rounding)  \
  ippiCopy8x8HP_8u_C1R(pSrc, srcStep, pDst, dstStep, acc, rounding);        \
  ippiCopy8x8HP_8u_C1R(pSrc + 8 * srcStep, srcStep, pDst + 8 * dstStep, dstStep, acc, rounding);

#define ippiInterpolateAverage8x16_8u_C1IR(pSrc, srcStep, pDst, dstStep, acc, rounding)  \
  ippiInterpolateAverage8x8_8u_C1IR(pSrc, srcStep, pDst, dstStep, acc, rounding);        \
  ippiInterpolateAverage8x8_8u_C1IR(pSrc + 8 * srcStep, srcStep, pDst + 8 * dstStep, dstStep, acc, rounding);

/********************************************************************************/

typedef void (*ownvc_CopyHP_8u_C1R_func) (const Ipp8u *pSrc, Ipp32s srcStep, Ipp8u *pDst, Ipp32s dstStep);
typedef void (*ownvc_AverageHP_8u_C1R_func) (const Ipp8u *pSrc, Ipp32s srcStep, Ipp8u *pDst, Ipp32s dstStep);

/********************************************************************************/


#define FUNC_COPY_HP(W, H, pSrc, srcStep, pDst, dstStep, acc, rounding) \
  ippiCopy##W##x##H##HP_8u_C1R(pSrc, srcStep, pDst, dstStep, acc, rounding)

#define FUNC_AVE_HP(W, H, pSrc, srcStep, pDst, dstStep, mcType, roundControl) \
  ippiInterpolateAverage##W##x##H##_8u_C1IR(pSrc, srcStep, pDst, dstStep, mcType, roundControl);

#define FUNC_AVE_HP_B(W, H, pSrcRefF, srcStepF, mcTypeF, pSrcRefB, srcStepB, mcTypeB, \
                      pDst, dstStep, roundControl) \
  FUNC_COPY_HP(W, H, pSrcRefF, srcStepF, pDst, dstStep, mcTypeF, roundControl); \
  FUNC_AVE_HP(W, H, pSrcRefB, srcStepB, pDst, dstStep, mcTypeB, roundControl)


/********************************************************************************/

#ifdef __cplusplus
} /* extern "C" */
#endif

/*******************************************************/

#define HP_FLAG_MC(flag, x, y) \
  flag = ((x + x) & 2) | (y & 1); \
  flag = (flag << 2)

#define HP_FLAG_CP(flag, x, y) \
  flag = (x & 1) | ((y + y) & 2)

#define HP_FLAG_AV  HP_FLAG_CP

#define CHECK_OFFSET_L(offs, pitch, hh) \
  if (offs < 0 || offs+(hh-1)*(pitch)+15 > (Ipp32s)frame_buffer.pic_size) \
{ \
  return UMC_ERR_INVALID_STREAM; \
}

#define CALC_OFFSETS_FRAME_420(offs_l, offs_c, flag_l, flag_c, xl, yl, HP_FLAG) \
{ \
  Ipp32s xc = xl/2; \
  Ipp32s yc = yl/2; \
\
  offs_l = video->offset_l + (yl >> 1)*pitch_l + (xl >> 1); \
  offs_c = video->offset_c + (yc >> 1)*pitch_c + (xc >> 1); \
  HP_FLAG(flag_l, xl, yl); \
  HP_FLAG(flag_c, xc, yc); \
}

#define CALC_OFFSETS_FULLPEL(offs_l, offs_c, xl, yl, pitch_l, pitch_c) \
{ \
  Ipp32s xc = xl/2; \
  Ipp32s yc = yl/2; \
\
  offs_l = video->offset_l + (yl >> 1)*pitch_l + (xl >> 1); \
  offs_c = video->offset_c + (yc >> 1)*pitch_c + (xc >> 1); \
}

#define CALC_OFFSETS_FIELD_420(offs_l, offs_c, flag_l, flag_c, xl, yl, field_sel, HP_FLAG) \
{ \
  Ipp32s xc = xl/2; \
  Ipp32s yc = yl/2; \
\
  offs_l = video->offset_l + ((yl &~ 1) + field_sel)*pitch_l + (xl >> 1); \
  offs_c = video->offset_c + ((yc &~ 1) + field_sel)*pitch_c + (xc >> 1); \
  HP_FLAG(flag_l, xl, yl); \
  HP_FLAG(flag_c, xc, yc); \
}

#define CALC_OFFSETS_FIELDX_420(offs_l, offs_c, flag_l, flag_c, xl, yl, field_sel, HP_FLAG) \
{ \
  Ipp32s xc = xl/2; \
  Ipp32s yc = yl/2; \
  offs_l = ((yl &~ 1) + 2*video->row_l + field_sel)*pitch_l + (xl >> 1) + video->col_l; \
  offs_c = ((yc &~ 1) + 2*video->row_c + field_sel)*pitch_c + (xc >> 1) + video->col_c; \
  HP_FLAG(flag_l, xl, yl); \
  HP_FLAG(flag_c, xc, yc); \
}

#define CALC_OFFSETS_FRAME_422(offs_l, offs_c, flag_l, flag_c, xl, yl, HP_FLAG) \
{ \
  Ipp32s xc = xl/2; \
  Ipp32s yc = yl; \
\
  offs_l = video->offset_l + (yl >> 1)*pitch_l + (xl >> 1); \
  offs_c = video->offset_c + (yc >> 1)*pitch_c + (xc >> 1); \
  HP_FLAG(flag_l, xl, yl); \
  HP_FLAG(flag_c, xc, yc); \
}

#define CALC_OFFSETS_FIELD_422(offs_l, offs_c, flag_l, flag_c, xl, yl, field_sel, HP_FLAG) \
{ \
  Ipp32s xc = xl/2; \
  Ipp32s yc = yl; \
\
  offs_l = video->offset_l + ((yl &~ 1) + field_sel)*pitch_l + (xl >> 1); \
  offs_c = video->offset_c + ((yc &~ 1) + field_sel)*pitch_c + (xc >> 1); \
  HP_FLAG(flag_l, xl, yl); \
  HP_FLAG(flag_c, xc, yc); \
}

#define CALC_OFFSETS_FIELDX_422(offs_l, offs_c, flag_l, flag_c, xl, yl, field_sel, HP_FLAG) \
{ \
  Ipp32s xc = xl/2; \
  Ipp32s yc = yl; \
  offs_l = ((yl &~ 1) + 2*video->row_l + field_sel)*pitch_l + (xl >> 1) + video->col_l; \
  offs_c = ((yc &~ 1) + 2*video->row_c + field_sel)*pitch_c + (xc >> 1) + video->col_c; \
  HP_FLAG(flag_l, xl, yl); \
  HP_FLAG(flag_c, xc, yc); \
}

#define MCZERO_FRAME(ADD, ref_Y_data1, ref_U_data1, ref_V_data1, flag1, flag2) \
  FUNC_##ADD##_HP(16, 16, ref_Y_data1,pitch_l,     \
                          cur_Y_data,                   \
                          pitch_l, flag1, 0);           \
  FUNC_##ADD##_HP(8, 8, ref_U_data1,pitch_c,     \
                              cur_U_data,               \
                              pitch_c, flag2, 0);      \
  FUNC_##ADD##_HP(8, 8, ref_V_data1,pitch_c,     \
                              cur_V_data,               \
                              pitch_c, flag2, 0);

#define MCZERO_FRAME_422(ADD, ref_Y_data1, ref_U_data1, ref_V_data1, flag1, flag2) \
  FUNC_##ADD##_HP(16, 16, ref_Y_data1,pitch_l,     \
                          cur_Y_data,                   \
                          pitch_l, flag1, 0);           \
  FUNC_##ADD##_HP(8, 16, ref_U_data1,pitch_c,     \
                              cur_U_data,               \
                              pitch_c, flag2, 0);      \
  FUNC_##ADD##_HP(8, 16, ref_V_data1,pitch_c,     \
                              cur_V_data,               \
                              pitch_c, flag2, 0);

#define MCZERO_FIELD0(ADD, ref_Y_data1, ref_U_data1, ref_V_data1, flag1, flag2) \
  FUNC_##ADD##_HP(16, 8, ref_Y_data1, pitch_l2,      \
                      cur_Y_data, pitch_l2,            \
                      flag1, 0);                        \
  FUNC_##ADD##_HP(8, 4, ref_U_data1, pitch_c2,     \
                      cur_U_data, pitch_c2,       \
                      flag2, 0);                    \
  FUNC_##ADD##_HP(8, 4, ref_V_data1, pitch_c2,     \
                      cur_V_data, pitch_c2,       \
                      flag2, 0);

#define MCZERO_FIELD0_422(ADD, ref_Y_data1, ref_U_data1, ref_V_data1, flag1, flag2) \
  FUNC_##ADD##_HP(16, 8, ref_Y_data1, pitch_l2,      \
                      cur_Y_data, pitch_l2,            \
                      flag1, 0);                        \
  FUNC_##ADD##_HP(8, 8, ref_U_data1, pitch_c2,     \
                      cur_U_data, pitch_c2,       \
                      flag2, 0);                    \
  FUNC_##ADD##_HP(8, 8, ref_V_data1, pitch_c2,     \
                      cur_V_data, pitch_c2,       \
                      flag2, 0);

#define MCZERO_FIELD1(ADD, ref_Y_data2, ref_U_data2, ref_V_data2, flag1, flag2) \
  FUNC_##ADD##_HP(16, 8, ref_Y_data2, pitch_l2,       \
                      cur_Y_data + pitch_l, pitch_l2,   \
                      flag1, 0);                         \
  FUNC_##ADD##_HP(8, 4, ref_U_data2, pitch_c2,          \
                      cur_U_data + pitch_c, pitch_c2, \
                      flag2, 0);                         \
  FUNC_##ADD##_HP(8, 4, ref_V_data2, pitch_c2,          \
                      cur_V_data + pitch_c, pitch_c2, \
                      flag2, 0);

#define MCZERO_FIELD1_422(ADD, ref_Y_data2, ref_U_data2, ref_V_data2, flag1, flag2) \
  FUNC_##ADD##_HP(16, 8, ref_Y_data2, pitch_l2,       \
                      cur_Y_data + pitch_l, pitch_l2,   \
                      flag1, 0);                         \
  FUNC_##ADD##_HP(8, 8, ref_U_data2, pitch_c2,          \
                      cur_U_data + pitch_c, pitch_c2, \
                      flag2, 0);                         \
  FUNC_##ADD##_HP(8, 8, ref_V_data2, pitch_c2,          \
                      cur_V_data + pitch_c, pitch_c2, \
                      flag2, 0);

#define SWAP(TYPE, _val0, _val1) { \
  TYPE _tmp = _val0; \
  _val0 = _val1; \
  _val1 = _tmp; \
}

#define RESET_PMV(array) {                         \
  Ipp32s nn;                                       \
  for(nn=0; nn<sizeof(array)/sizeof(Ipp32s); nn++) \
    ((Ipp32s*)array)[nn] = 0;                      \
}

#define COPY_PMV(adst,asrc) {                      \
  Ipp32s nn;                                       \
  for(nn=0; nn<sizeof(adst)/sizeof(Ipp32s); nn++)  \
    ((Ipp32s*)adst)[nn] = ((Ipp32s*)asrc)[nn];     \
}

#define RECONSTRUCT_INTRA_MB(BITSTREAM, NUM_BLK, DCT_TYPE)               \
{                                                                        \
  Ipp32s *pitch = blkPitches[DCT_TYPE];                                  \
  Ipp32s *offsets = blkOffsets[DCT_TYPE];                                \
  Ipp32s curr_index = frame_buffer.curr_index;                           \
  Ipp8u* yuv[3] = {                                                      \
    frame_buffer.frame_p_c_n[curr_index].Y_comp_data + video->offset_l,  \
    frame_buffer.frame_p_c_n[curr_index].U_comp_data + video->offset_c,  \
    frame_buffer.frame_p_c_n[curr_index].V_comp_data + video->offset_c   \
  };                                                                     \
  Ipp32s blk;                                                            \
  IppiDecodeIntraSpec_MPEG2 *intraSpec = &video->decodeIntraSpec;        \
                                                                         \
  for (blk = 0; blk < NUM_BLK; blk++) {                                  \
    IppStatus sts;                                                       \
    Ipp32s chromaFlag, cc;                                               \
    chromaFlag = blk >> 2;                                               \
    cc = chromaFlag + (blk & chromaFlag);                                \
    if (NUM_BLK > 6)                                                     \
      intraSpec = chromaFlag ? &video->decodeIntraSpecChroma : &video->decodeIntraSpec; \
                                                                         \
    sts = ippiDecodeIntra8x8IDCT_MPEG2_1u8u(                             \
      &BITSTREAM##_curr_ptr,                                             \

⌨️ 快捷键说明

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