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

📄 h263_enc.hpp

📁 audio-video-codecs.rar语音编解码器
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* ///////////////////////////////////////////////////////////////////////
//
//               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) 2005-2007 Intel Corporation. All Rights Reserved.
//
//  Description:    class ippVideoEncoderH263
//
*/

#include "h263_enc_bitstream.hpp"
#include "ippdefs.h"
#include "ipps.h"
#include "ippi.h"
#include "ippvc.h"
#include "vm_debug.h"

#pragma warning(disable : 4514)     // unreferenced inline function has been removed

/* H.263++ code values */
/* ITU-T Recommendation H.263, Table 5 */
enum {
  H263e_ASPECT_RATIO_FORBIDDEN  = 0,
  H263e_ASPECT_RATIO_1_1        = 1,
  H263e_ASPECT_RATIO_12_11      = 2,
  H263e_ASPECT_RATIO_10_11      = 3,
  H263e_ASPECT_RATIO_16_11      = 4,
  H263e_ASPECT_RATIO_40_33      = 5,
  H263e_ASPECT_RATIO_EXTPAR     = 15
};

enum {
  H263e_PIC_TYPE_I    = 0,
  H263e_PIC_TYPE_P    = 1,
  H263e_PIC_TYPE_iPB  = 2,
  H263e_PIC_TYPE_B    = 3,
  H263e_PIC_TYPE_EI   = 4,
  H263e_PIC_TYPE_EP   = 5,
  H263e_PIC_TYPE_PB   = 6
};

/* Block Info */
struct h263e_Block {
  h263e_Block *predA;
  h263e_Block *predC;
  Ipp16s      dct_acA[8];
  Ipp16s      dct_acC[8];
  Ipp8u       quant;
  Ipp8u       validPredIntra;

  // original (not reconstructed) DCT coeffs, used to decide on Intra prediction mode
  Ipp16s      dctOr_acA[8];
  Ipp16s      dctOr_acC[8];
};


/* MacroBlock Info */
struct h263e_MacroBlock {
  IppMotionVector mv[4];
  Ipp32s          lumaErr;
  h263e_Block     block[6];
  Ipp8u           type;
  Ipp8u           not_coded;
  Ipp8u           validPredInter;
};


/* Video Object Plane Info */
struct h263e_VideoPicture {
  Ipp32s      modulo_time_base;
  Ipp32s      pic_time_increment;
//    Ipp32s      pic_id;                             // verid != 1 (newpred)
//    Ipp32s      pic_id_for_prediction_indication;   // verid != 1 (newpred)
//    Ipp32s      pic_id_for_prediction;          // verid != 1 (newpred)
  Ipp32s      pic_rounding_type;
  Ipp32s      pic_reduced_resolution;             // verid != 1
  Ipp32s      pic_width;
  Ipp32s      pic_height;

  Ipp32s      pic_quant;

  Ipp32s      temporal_reference;
  Ipp32s      temporal_reference_increment;
  Ipp32s      split_screen_indicator;
  Ipp32s      document_camera_indicator;
  Ipp32s      full_picture_freeze_release;
  Ipp32s      source_format;
  Ipp32s      picture_coding_type;
  Ipp32s      gob_number;
  Ipp32s      num_gobs_in_pic;
  Ipp32s      num_macroblocks_in_gob;
  Ipp32s      num_MBrows_in_gob;
  Ipp32s      gob_header_empty;
  Ipp32s      gob_frame_id;
  Ipp32s      quant_scale;

  Ipp32s      UMV;
  Ipp32s      SAC;
  Ipp32s      advPred;
  Ipp32s      PBframes;
  Ipp32s      temporal_reference_B;
  Ipp32s      dbquant;

  /* plusptype fields  */

  Ipp32s      plusptype;
  Ipp32s      ufep;
  Ipp32s      advIntra;
  Ipp32s      deblockFilt;
  Ipp32s      sliceStruct;
  Ipp32s      RPS;
  Ipp32s      ISD;
  Ipp32s      altInterVLC;
  Ipp32s      modQuant;
  Ipp32s      resample;
  Ipp32s      redResUp;

  Ipp32s      PCF;
  Ipp32s      CPM;
  Ipp32s      PSBI;
  Ipp32s      PAR_code;
  Ipp32s      PAR_width;
  Ipp32s      PAR_height;
  Ipp32s      clock_conversion_code;
  Ipp32s      clock_divisor;
  Ipp32s      unlimited_UMV;
  Ipp32s      sliceSubmodes; /* bit 1 - Rectangular slices; bit 2 - Arbitrary slice ordering */
  Ipp32s      enh_layer_num;
  Ipp32s      ref_layer_num;
  Ipp32s      RPSflags;
  Ipp32s      pred_temp_ref;
  Ipp32s      wda;
  IppMotionVector warpParams[4];
  Ipp32s      fillMode;
  Ipp32s      fillColor[3];
  Ipp32s      scalability;
};

/* Video Object Info */
struct h263e_VideoSequence {
  Ipp32s      aspect_ratio_info;
  Ipp32s      chroma_format;
  Ipp32s      pic_time_increment_resolution;
  Ipp32s      fixed_pic_time_increment;
  Ipp32s      data_partitioned;
/*
  Ipp32s      newpred_enable;                 // verid != 1
  Ipp32s      requested_upstream_message_type;// verid != 1
  Ipp32s      newpred_segment_type;           // verid != 1
  Ipp32s      reduced_resolution_pic_enable;  // verid != 1
  Ipp32s      scalability;
*/
};

struct h263e_Param
{
  Ipp32s      Width;
  Ipp32s      Height;
  //Ipp32s      NumOfFrames;
  Ipp32s      TimeResolution;
  Ipp32s      TimeIncrement;
/*
  Ipp32s      load_intra_quant_mat;
  Ipp32s      load_intra_quant_mat_len;
  Ipp8u       intra_quant_mat[64];
  Ipp32s      load_nonintra_quant_mat;
  Ipp32s      load_nonintra_quant_mat_len;
  Ipp8u       nonintra_quant_mat[64];
*/
  Ipp32s      quantIPic, quantPPic, quantBPic;
  Ipp32s      IPicdist, PPicdist;
  Ipp32s      PPicsearchWidth, PPicsearchHeight;
//    Ipp32s      BPicsearchWidthForw, BPicsearchHeightForw;
//    Ipp32s      BPicsearchWidthBack, BPicsearchHeightBack;
  Ipp32s      MEalgorithm;
  Ipp32s      MEaccuracy;

  Ipp32s      advPred;
  Ipp32s      deblockFilt;

  Ipp32s      calcPSNR;
//    Ipp32s      VideoPacketLength;
  Ipp32s      advIntra;
  Ipp32s      UMV;
  Ipp32s      modQuant;
//    Ipp32s      data_partitioned;
  Ipp8u       *bsBuffer;
  Ipp32s      bsBuffSize;
  Ipp32s      RateControl;
  Ipp32s      BitRate;
  Ipp32s      SceneChangeThreshold;
  Ipp32s      FrameSkip;
  Ipp32s      GOBheaders;
};

struct h263e_Frame {
  Ipp8u*      ap;
  Ipp8u*      pY;
  Ipp8u*      pU;
  Ipp8u*      pV;
  Ipp32u      mid;
//  Ipp32s      type;
//  Ipp64s      time;
};

struct h263e_VLC {
    Ipp32s  code;
    Ipp32s  len;
};

struct h263e_RTPdata
{
  Ipp32u                      *GOBstartPos;
  Ipp8u                       *MBquant;
  IppMotionVector             *MBpredMV;
  IppMotionVector             *MBpredMV1;
  Ipp32u                      *MBpos;
  Ipp8u                       codingModes;
};


#define YUV_CHROMA_420    0
#define YUV_CHROMA_422    1
#define YUV_CHROMA_444    2

#define H263_STS_SKIPPED_FRAME      -3
#define H263_STS_NODATA      -2
#define H263_STS_BUFFERED    -1
#define H263_STS_NOERR        0
#define H263_STS_ERR_NOTINIT  1
#define H263_STS_ERR_PARAM    2
#define H263_STS_ERR_NOMEM    3
#define H263_STS_ERR_BUFOVER  4


class ippVideoEncoderH263
{
public :
  Ipp32s      mSourceFormat;          // 4:2:0 only supported
  Ipp32s      mSourceWidth;           // width
  Ipp32s      mSourceHeight;          // height
  Ipp32s      mStepLuma;
  Ipp32s      mStepChroma;
  Ipp32s      mLumaPlaneSize;
  Ipp32s      mChromaPlaneSize;
  Ipp32s      mPlanes;
  h263e_Frame *mFrame;
  Ipp32s      mExpandSizeA;
  Ipp32s      mNumOfFrames;
  Ipp32s      mFrameCount;
//  Ipp64s      mQuantAvg;
  Ipp64s      mPSNR_Y, mPSNR_U, mPSNR_V;
  H263BitStream cBS;

⌨️ 快捷键说明

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