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

📄 encode_i.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
字号:
/*//////////////////////////////////////////////////////////////////////////////////                  INTEL CORPORATION PROPRIETARY INFORMATION//     This software is supplied under the terms of a license agreement or//     nondisclosure agreement with Intel Corporation and may not be copied//     or disclosed except in accordance with the terms of that agreement.//          Copyright(c) 2002-2005 Intel Corporation. All Rights Reserved.//*/#include "ippi.h"#include "mpeg2_defs.h"void ippMPEG2VideoEncoder::EncodeMacroBlock(int numTh, int dct_type, Ipp16s *pDiff, Ipp32s *Count, Ipp32s *pCodedBlockPattern){  Ipp16s *pMBlock = threadSpec[numTh].pMBlock_;  const Ipp32s *dct_step, *diff_off;  int loop;  int CodedBlockPattern = 0;  if (dct_type == DCT_FRAME) {    dct_step = frm_dct_step;    diff_off = frm_diff_off;  } else {    dct_step = fld_dct_step;    diff_off = fld_diff_off;  }  for (loop = 0; loop < block_count; loop++) {    ippiDCT8x8Fwd_16s_C1R(pDiff + diff_off[loop], dct_step[loop], pMBlock);    ippiQuant_MPEG2_16s_C1I(pMBlock, quantiser_scale_value, InvNonIntraQMatrix, &Count[loop]);    CodedBlockPattern = (CodedBlockPattern << 1);    if (Count[loop] != 0) CodedBlockPattern++;    pMBlock += 64;  }  *pCodedBlockPattern = CodedBlockPattern;}/////////////////////////////////////////////////////////////////////////////////////////////////////////////// Coding I picture ///////////////////////////////////////////////////////////////////////////////////////////////////////////////void ippMPEG2VideoEncoder::encodeI(int numTh){  int         i, j, ic, jc, k;  int         Y_width  = YFrameHSize;  int         UV_width = UVFrameHSize;  Ipp32s var_fld, var;  int start_y;  int start_uv;  int stop_y;  CALC_START_STOP_ROWS  for(j=start_y, jc= start_uv; j < stop_y; j += 16, jc += BlkHeight_c)  {    Ipp32s dc_init = ResetTbl[encodeInfo.intra_dc_precision];    Ipp32s dc_dct_pred[3] = {dc_init, dc_init, dc_init};    for(i=ic=0; i < Y_width; i += 16, ic += BlkWidth_c)    {      Ipp8u *YBlock = (Ipp8u*)Y_src + i + j * Y_pitch;      Ipp8u *UBlock = (Ipp8u*)U_src + ic + jc * U_pitch;      Ipp8u *VBlock = (Ipp8u*)V_src + ic + jc * V_pitch;      Ipp8u *YBlockRef = (Ipp8u*)YRefFrameB + i + j * Y_width;      Ipp8u *UBlockRef = (Ipp8u*)URefFrameB + ic + jc * UV_width;      Ipp8u *VBlockRef = (Ipp8u*)VRefFrameB + ic + jc * UV_width;      pMBInfo[k].prediction_type = MC_FRAME;      pMBInfo[k].dct_type = DCT_FRAME;      if (!curr_frame_dct) {        var = var_fld = 0;        ippiFrameFieldSAD16x16_8u32s_C1R(YBlock, Y_pitch, &var, &var_fld);        if (var_fld < var) {          var = var_fld;          pMBInfo[k].dct_type = DCT_FIELD;        }      }      if (i==0) {        PutSliceHeader(j >> 4, numTh);      }      // macroblock in I picture cannot be skipped      PutAddrIncrement(1 , numTh);      Ipp8u *BlockSrc[3] = {YBlock, UBlock, VBlock};      Ipp8u *BlockRef[3] = {YBlockRef, UBlockRef, VBlockRef};      PutIntraMacroBlock(numTh, k, BlockSrc, BlockRef, dc_dct_pred, I_TYPE);      pMBInfo[k].mb_type = MB_INTRA;      k++;    } //for(i)  } //for(j)}

⌨️ 快捷键说明

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