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

📄 umc_vc1_common_defs.h

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

//typedef struct
//{
//    Ipp32u PS_HOFFSET;        //18                pan scan window horizontaloffset
//    Ipp32u PS_VOFFSET;        //18                pan scan vertical window
//    Ipp32u PS_WIDTH;          //14                pan scan window width
//    Ipp32u PS_HEIGHT;         //14                pan scan window width
//}PanScanWindow;

typedef struct
{
  //common fields
    //Ipp32u  INTERPFRM;
    Ipp32u  PTYPE;
    Ipp32u  PQINDEX;
    Ipp32u  HALFQP;
    //Ipp32u  POSTPROC;       // 2 post processing
//common fields.Slice parameters
    Ipp32u  is_slice;

//interlace fields
    Ipp8u  TFF;           // 1 top field first
    Ipp8u  PTypeField1;
    Ipp8u  PTypeField2;
    Ipp8u  CurrField;
    Ipp8u  BottomField;    //Is current field top or nor
    Ipp32u  INTCOMFIELD;     //variable size intensity compensation field

    //range reduce simple/main profile
    Ipp32s RANGEREDFRM;      //1

//I P B picture
    //Ipp32u TRANSACFRM;
    //Ipp32u TRANSACFRM2;
//I P B picture. VopDQuant
    Ipp32u  m_DQProfile;
    Ipp32u  m_DQuantFRM;
    Ipp32u  m_DQBILevel;
    //Ipp32u  m_PQDiff;
    Ipp32u  m_AltPQuant;
    Ipp32u  PQUANT;
    Ipp32u  m_PQuant_mode;
    //Ipp32u  m_curQPDeadZone;
    Ipp32u  QuantizationType;      //0 - uniform, 1 - nonuniform

//only for advanced profile
    Ipp32u  FCM;           // variable size frame coding mode

//practically not used
    //Ipp32u  RPTFRM;        // 2 repeat frame count
    //Ipp32u  UVSAMP;
    //Ipp32u  m_number_of_pan_scan_window;
    //PanScanWindow m_PanScanWindows[4];

//I BI picture
    VC1Bitplane    ACPRED;    // variable size  AC Prediction
    Ipp32u   CONDOVER;  // variable size  conditional overlap flag
    VC1Bitplane    OVERFLAGS; // variable size  conditional overlap macroblock pattern flags
//I BI picture. interlace frame
    VC1Bitplane    FIELDTX;     //variable size field transform flag

// P B picture
    Ipp32u   TTMBF;
    Ipp32u   TTFRM;
    Ipp32u    TTFRM_ORIG; //for future H/W support needs
    VC1Bitplane    SKIPMB;
    VC1Bitplane    MVTYPEMB;
    Ipp32u   MVMODE;

// P B picture. Interlace frame
    Ipp32u   DMVRANGE;              //variable size extended differential MV Range Flag
// P B picture. Interlace field
    Ipp32s   REFDIST;               //variable size  P Reference Distance


//P only. Interlace frame
 //   Ipp32u MV4SWITCH;             //1     4 motion vector switch
//P only. Interlace field
    Ipp32u NUMREF;                //1     Number of reference picture
    Ipp32u REFFIELD;              //1     Reference field picture indicator


//B only
    Ipp32u     BFRACTION;
    VC1Bitplane      m_DirectMB;
    Ipp32s           ScaleFactor;
// B only. Interlace field
    VC1Bitplane      FORWARDMB;         //variable size B Field forward mode
                                        //MB bit syntax element
// tables
    const IppiACDecodeSet_VC1* m_pCurrIntraACDecSet;
    const IppiACDecodeSet_VC1* m_pCurrInterACDecSet;
    Ipp32s*             m_pCurrCBPCYtbl;
    Ipp32s*             m_pCurrMVDifftbl;
    const VC1MVRange*  m_pCurrMVRangetbl;
    Ipp32s*             m_pCurrLumaDCDiff;
    Ipp32s*             m_pCurrChromaDCDiff;
    Ipp32s*             m_pCurrTTMBtbl;
    Ipp32s*             m_pCurrTTBLKtbl;
    Ipp32s*             m_pCurrSBPtbl;
    Ipp32s*             m_pMBMode;
    Ipp32s*             m_pMV2BP;
    Ipp32s*             m_pMV4BP;

    const VC1PredictScaleValuesPPic*      m_pCurrPredScaleValuePPictbl;
    const VC1PredictScaleValuesBPic*      m_pCurrPredScaleValueB_BPictbl;
    const VC1PredictScaleValuesPPic*      m_pCurrPredScaleValueP_BPictbl[2];//0 - forward, 1 - back

    Ipp32u RNDCTRL;     // 1 rounding control bit

    Ipp32u TRANSDCTAB;
    Ipp32u MVMODE2;
    Ipp32u MVTAB;
    Ipp32u CBPTAB;
    Ipp32u MBMODETAB;
    Ipp32u MV2BPTAB;   //2             2 mv block pattern table
    Ipp32u MV4BPTAB;   //2             4 mv block pattern table
    Ipp32u PQUANTIZER;
    Ipp32u MVRANGE;
    Ipp32u DQSBEdge;
    // P picture
    Ipp32u LUMSCALE;
    Ipp32u LUMSHIFT;
    Ipp32u LUMSCALE1;
    Ipp32u LUMSHIFT1;

    Ipp32u POSTPROC;

    Ipp32u TRANSACFRM;
    Ipp32u TRANSACFRM2;

    Ipp32u  RPTFRM;        // 2 repeat frame count
    Ipp32u  UVSAMP;

    Ipp32u MV4SWITCH;
}VC1PictureLayerHeader;

typedef struct
{
    Ipp32s *m_pLowMotionLumaDCDiff;
    Ipp32s *m_pHighMotionLumaDCDiff;
    Ipp32s *m_pLowMotionChromaDCDiff;
    Ipp32s *m_pHighMotionChromaDCDiff;
    Ipp32s *m_pCBPCY_Ipic;
    Ipp32s *m_Bitplane_IMODE;
    Ipp32s *m_BitplaneTaledbits;
    Ipp32s *MVDIFF_PB_TABLES[4];
    Ipp32s *CBPCY_PB_TABLES[4];
    Ipp32s *TTMB_PB_TABLES[3];
    Ipp32s *TTBLK_PB_TABLES[3];
    Ipp32s *SBP_PB_TABLES[3];
    Ipp32s *BFRACTION;
    Ipp32s *MBMODE_INTERLACE_FRAME_TABLES[8];
    Ipp32s *MV_INTERLACE_TABLES[12];
    Ipp32s *CBPCY_PB_INTERLACE_TABLES[8];
    Ipp32s *MV2BP_TABLES[4];
    Ipp32s *MV4BP_TABLES[4];
    Ipp32s *REFDIST_TABLE;
    Ipp32s *MBMODE_INTERLACE_FIELD_TABLES[8];
    Ipp32s *MBMODE_INTERLACE_FIELD_MIXED_TABLES[8];

}VC1VLCTables;

typedef struct
{
    Ipp16s          DC;
    Ipp16s          ACTOP[8];
    Ipp16s          ACLEFT[8];
}VC1DCBlkParam;

typedef struct
{
    VC1DCBlkParam   DCBlkPred[6];
    Ipp32u          DCStepSize;
    Ipp32u          DoubleQuant;
}VC1DCMBParam;

//  luma
//  |--|--|--|
//  | 3| 6| 7|
//  |--|--|--|
//  | 8| 0| 1|
//  |--|--|--|
//  | 9| 2|  |
//  |--|--|--|


//  chroma
//  |--|--|   |--|--|
//  | 4|10|   | 5|12|
//  |--|--|   |--|--|
//  |11|  |   |13|  |
//  |--|--|   |--|--|

typedef struct
{
    Ipp32u          DoubleQuant[3];
    Ipp16s          DC[14];
    Ipp16s*         ACTOP[14];
    Ipp16s*         ACLEFT[14];

    Ipp8u           BlkPattern[6];
}VC1DCPredictors;

typedef struct
{
    IppiSize        DstSizeNZ;
    Ipp32u          SBlkPattern;
    Ipp16s          mv[2][2];                   // [forw/back][x/y] top field
    Ipp16s          mv_bottom[2][2];            // [forw/back][x/y] bottom field
    Ipp8u           mv_s_polarity[2];
    Ipp8u           blkType;
    Ipp8u           fieldFlag[2];   //0 - top field, 1 - bottom field
}VC1Block;

typedef struct
{
    Ipp8u   Coded;
    Ipp8u numCoef; //subblocks in inter;
}VC1SingletonBlock;
typedef struct
{
    Ipp32u      bEscapeMode3Tbl;
    Ipp32s      levelSize;
    Ipp32s      runSize;
} IppiEscInfo_VC1;

typedef struct
{
    Ipp32u*     pBitstream;
    Ipp32s      bitOffset;
} IppiBitstream;

typedef struct
{
    Ipp32s      m_currMBYpos;
    Ipp32s      m_currMBXpos;
    Ipp8u*      currYPlane;
    Ipp8u*      currUPlane;
    Ipp8u*      currVPlane;

    Ipp32u      currYPitch;
    Ipp32u      currUPitch;
    Ipp32u      currVPitch;

    Ipp32s      slice_currMBYpos;

    Ipp32u      ACPRED;
    Ipp32u      INTERPMVP;
    Ipp32s      MBMODEIndex;
    Ipp8u       m_ubNumFirstCodedBlk;

    VC1SingletonBlock   m_pSingleBlock[6];
    //for interpolation
    Ipp16s      xLuMV[VC1_NUM_OF_LUMA];
    Ipp16s      yLuMV[VC1_NUM_OF_LUMA];
    Ipp32u      MVcount;

    Ipp16s      xLuMVT[VC1_NUM_OF_LUMA];
    Ipp16s      yLuMVT[VC1_NUM_OF_LUMA];

    Ipp16s      xLuMVB[VC1_NUM_OF_LUMA];
    Ipp16s      yLuMVB[VC1_NUM_OF_LUMA];

    Ipp16s*     x_LuMV;
    Ipp16s*     y_LuMV;

    IppiEscInfo_VC1  EscInfo;
    const Ipp8u** ZigzagTable;
    Ipp32s      widthMB;
    Ipp32s      heightMB;
}VC1SingletonMB;

#ifdef UMC_STREAM_ANALYZER
   inline static Ipp32u CalculateUsedBits(IppiBitstream BitStartPos,IppiBitstream BitEndPos)
   {
       if (BitEndPos.pBitstream == BitStartPos.pBitstream)
           return BitStartPos.bitOffset - BitEndPos.bitOffset;
       else
           // offset is value between [0,31]
           return (BitEndPos.pBitstream - BitStartPos.pBitstream)*sizeof(Ipp32u)*8 - 1 -
                   BitEndPos.bitOffset + BitStartPos.bitOffset;
   }
#endif

typedef struct
{
    Ipp32s      m_cbpBits;

    VC1Block    m_pBlocks[6];
    Ipp8u       Overlap;
    Ipp8u       mbType;

    //interlace
    Ipp32u      FIELDTX;
    Ipp8u       IntraFlag;

    Ipp8u*      currYPlane;
    Ipp8u*      currUPlane;
    Ipp8u*      currVPlane;

    Ipp32u      currYPitch;
    Ipp32u      currUPitch;
    Ipp32u      currVPitch;

    Ipp32s      MVBP;
    Ipp32s      LeftTopRightPositionFlag;
    Ipp32s      MVSW;          // for interlace frame mode in B frames

    Ipp16s      bias;
    Ipp8u       SkipAndDirectFlag; //skip or not + direct or not
    Ipp16s      dmv_x[2][4]; //for split decode and prediction calculation in B frames
    Ipp16s      dmv_y[2][4]; //for split decode and prediction calculation in B frames
    Ipp8u       predictor_flag[4]; // for B interlace fields
    Ipp8u       fieldFlag[2];
    const Ipp8u* pInterpolLumaSrc[2];    //forward/backward or top/bottom
    Ipp32s       InterpolsrcLumaStep[2]; //forward/backward or top/bottom
    const Ipp8u* pInterpolChromaUSrc[2];    //forward/backward or top/bottom
    Ipp32s       InterpolsrcChromaUStep[2]; //forward/backward or top/bottom
    const Ipp8u* pInterpolChromaVSrc[2];    //forward/backward or top/bottom
    Ipp32s       InterpolsrcChromaVStep[2]; //forward/backward or top/bottom
#ifdef UMC_STREAM_ANALYZER
    ExtraMBAnalyzer* pMbAnalyzInfo;
#endif

}VC1MB;
typedef struct
{
    VC1Block* AMVPred[4];
    VC1Block* BMVPred[4];
    VC1Block* CMVPred[4];
    Ipp8u     FieldMB[4][3]; //4 blocks, A, B, C
}VC1MVPredictors;
//1.3.3    The decoder dynamically allocates memory for frame
//buffers and other structures. Following are the size requirements.
//For the frame buffer, the following formula indicates the memory requirement:
//frame_memory = {(h + 64) x (w + 64) + [(h / 2 + 32) x (w / 2 + 32)] x 2}bytes

struct Frame
{
    Frame():m_pAllocatedMemory(NULL),
            m_pY(NULL),
            m_pU(NULL),
            m_pV(NULL),
            RANGE_MAPY(-1),
            RANGE_MAPUV(-1),
            m_iYPitch(0),
            m_iUPitch(0),
            m_iVPitch(0),
            m_AllocatedMemorySize(0),
            m_bIsExpanded(0)
    {
    }



    Ipp8u*      m_pAllocatedMemory;
    Ipp8u*      m_pY;
    Ipp8u*      m_pU;
    Ipp8u*      m_pV;
    Ipp32s      RANGE_MAPY;
    Ipp32s      RANGE_MAPUV;//[2]; //rangeMapCoef[0] = RANGE_MAPY;  - luma
                         //rangeMapCoef[1] = RANGE_MAPUV; - chroma
    Ipp32s*     pRANGE_MAPY;

    Ipp32u      m_iYPitch;
    Ipp32u      m_iUPitch;
    Ipp32u      m_iVPitch;
    Ipp32s      m_AllocatedMemorySize;

    Ipp8u       m_bIsExpanded;
};

#define VC1MAXFRAMENUM 9*VC1FRAMEPARALLELPAIR + 9 // for <= 8 threads. Change if numThreads > 8
#define VC1NUMREFFRAMES 3 // 2 - reference frames, 1 - from intensity compensation
//typedef struct
//{
//    Frame         m_pFrames[VC1MAXFRAMENUM];
//
//    Ipp32s        m_iPrevIndex;
//    Ipp32s        m_iNextIndex;
//    Ipp32s        m_iCurrIndex;
//    Ipp32s        m_iICompFieldIndex;
//    Ipp32s        m_iDisplayIndex;
//}VC1FrameBuffer;
struct VC1FrameBuffer
{
    Frame*        m_pFrames;

    Ipp32s        m_iPrevIndex;
    Ipp32s        m_iNextIndex;
    Ipp32s        m_iCurrIndex;
    Ipp32s        m_iICompFieldIndex;
    Ipp32s        m_iDisplayIndex;

    Frame operator [] (Ipp32u number)
    {
        return m_pFrames[number];
    };

};

typedef struct
{
    Ipp16s**        SmoothUpperYRows;   //   Y:[MBwidth+1][16*2]
    Ipp16s**        SmoothUpperURows;   //   U:[MBwidth+1][8*2]
    Ipp16s**        SmoothUpperVRows;   //   V:[MBwidth+1][8*2]
}VC1Smoothing;

typedef struct
{
    Ipp32u start_pos;
    Ipp32u HeightMB;
    Ipp32u is_last_deblock;
}VC1DeblockInfo;


struct VC1Context
{
    VC1SequenceLayerHeader*    m_seqLayerHeader;
    VC1PictureLayerHeader*     m_picLayerHeader;

    VC1PictureLayerHeader*     m_InitPicLayer;

    VC1VLCTables*              m_vlcTbl;

    VC1FrameBuffer             m_frmBuff;

    //Ipp32u*                m_pbs;
    //Ipp32s                 m_bitOffset;
    IppiBitstream          m_bitstream;
    Ipp8u*                 m_pBufferStart;
    Ipp32u                 m_FrameSize;
    //start codes
    Ipp32u*                m_Offsets;
    Ipp32u*                m_values;

    Ipp32s                 m_seqInit;

    VC1MB*                 m_pCurrMB;
    VC1MB*                 m_MBs;         //MBwidth*MBheight
    VC1DCMBParam*          CurrDC;

    VC1Smoothing*          SmoothingInfo;
    Ipp16s*                savedMV;       //MBwidth*MBheight*4*2*2
                                          //(4 luma blocks, 2 coordinates,Top/Bottom),
                                          //MVs which are used for Direct mode
    Ipp8u*                 savedMVSamePolarity;
                                          // in B frame
    Ipp16s*                savedMV_Curr;     //pointer to current array of MVs. Need for inter-frame threading
    Ipp8u*                 savedMVSamePolarity_Curr; //pointer to current array of MVPolars. Need for inter-frame threading
    VC1Bitplane            m_pBitplane;
    VC1DeblockInfo         DeblockInfo;
    Ipp32u                 RefDist;
    Ipp32u*                pRefDist;

    _IppVCInterpolate_8u  interp_params_luma;
    _IppVCInterpolate_8u  interp_params_chroma;


    // Intensity compensation: lookup tables only for P-frames
    Ipp8u          m_bIntensityCompensation;
    Ipp8u          m_bNeedToUseCompBuffer;

    Ipp32u typeOfPreviousFrame;
    VC1SingletonMB*                m_pSingleMB;

    Ipp32s                         iNumber; /*thread number*/
    Ipp16s*                        m_pBlock; //memory for diffrences
    Ipp8u*                         m_pPredBlock; //memory for predicted block
    Ipp32s                         iPrevDblkStartPos;
    VC1DCMBParam*                  DCACParams;
    VC1DCPredictors                DCPred;
    VC1MVPredictors                MVPred;
    Ipp32s                         LumaTable[4][256]; //0,1 - top/bottom fields of first field. 2,3 of second field
    Ipp32s                         ChromaTable[4][256];
};


#endif //__umc_vc1_common_defs_H__
#endif //UMC_ENABLE_VC1_VIDEO_DECODER

⌨️ 快捷键说明

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