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

📄 umc_h264_video_encoder.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
📖 第 1 页 / 共 2 页
字号:
    Status         Allocate_Buffers();    void                Deallocate_Buffers();    // public methods    // These should be the same for all cores.public:    CRateControl *m_rate_control;    H264Extra_MB_Info *ExMBInfo;        Status Start_Picture (        const EnumPicClass * pic_class,        const H264SeqParamSet * seq_parms,        const H264PicParamSet * pic_parms,        const H264SliceHeader * slice_header_param,        // input YUV ptrs, frametype and TR        CH264pBs * bitstream,        // pointer to bitstream        // when current frame is to be compressed        // as a B frame.        // Or reference frame below for SNR        // or spatial scalability.        EnumPicCodType pic_type        );    // allocate memory        Status     Allocate_Core_Memory(        const Ipp32u num_slices,        const Ipp32u frame_mb_width,        const Ipp32u frame_mb_height,        CBaseBitstream *bs);    // free memory        Status Free_Core_Memory();    // Compress picture slice        Status Compress_Slice (    const Ipp16u slice_num);        SliceData *     Get_SliceDataBase_Pointer();    // This routine returns pointer to the beginning of the    // slice database array.        Status     Force_MB_Type (        const MB_Type mb_type,        const Ipp32u MBIndex );    // Force the macroblock to be of type mb_type.  Call this before    // calling Compress_Segment to force the core to produce the    // specified type.    // returns UMC_OK if forcing of that mb_type is supported        bool              Intra_Slice_Test();    // This routine returns true if the current slice has coded a number of macroblocks    // as INTRA that exceeded the INTRA_PERCENTAGE_THRESHOLD constant.        T_EncodeMBData *    Get_MBInfoArray_Pointer();    // This routine returns pointer to the beginning of the    // macroblock info array.    // any processing needed after each picture    void End_Picture();#ifdef _DEBUG    static void PrintBufferLine( Ipp8u*, Ipp32u );#endif    // general frame data used by most core functionsprivate:    void            InitializeMBData();    Ipp32u          Make_MBEdgeType( Ipp32u MBIndex );    void            Make_MBSlices();    void AdvancedIntraModeSelectOneMacroblock(        Ipp32u uMB,         // which MB        Ipp32u *puAIMBSAD       // return total MB SAD here        );    void Intra4x4InitBlockParams(        T_4x4IntraModeSelParams *pModeSelParams,    // params to init        Ipp32u uMB);    void Intra16x16SelectAndPredict(        Ipp32u uMB,         // which MB        Ipp32u *puAIMBSAD,      // return total MB SAD here        Ipp8u *pPredBuf);       // return predictor pels here    void Init_VLC_LUTs();    void Init_CABAC(CBaseBitstream *bs);    void Init_LUTs();    void ReconstuctCBP(Ipp32u uMB);    Status PutVLC_MBHeader(Ipp32u uMB);    Status PutVLC_MBCoefficients_DC(Ipp32u uMB, Ipp32u uPlane);    Status PutVLC_MBCoefficients_Luma(Ipp32u uMB, Ipp32u uBlock, Ipp32u uIndex);    Status PutVLC_MBCoefficients_Chroma(Ipp32u uMB, Ipp32u uBlock);    //Status PutCABAC_MBHeader(Ipp32u uMB);    //Status PutCABAC_MBCoefficients_DC(Ipp32u uMB, Ipp32u uPlane);    //Status PutCABAC_MBCoefficients_Luma(Ipp32u uMB, Ipp32u uBlock, Ipp32u uIndex);    //Status PutCABAC_MBCoefficients_Chroma(Ipp32u uMB, Ipp32u uBlock);    void Encode_PCM_MB(Ipp32u uMB);    void Encode_AIC_Type_16x16(Ipp32u uMB);    void Encode_AIC_Type(Ipp32u uMB);    void Encode_CBP(int uMB);    void Encode_MB_Vectors(Ipp32u uMB);    void Encode_MB_Vectors_CABAC(Ipp32u uMB);    void Encode_Inter_Type(Ipp32u uMB);    void Encode_Inter_Type_CABAC(Ipp32u uMB);    void Encode_BiPred_Type(Ipp32u uMB);    void Encode_BiPred_Type_CABAC(Ipp32u uMB);    /* Supports ref_idx_val == 0 only!!!    * listNum is either REF_IDX_L0 or REF_IDX_L1    */    void Encode_ref_idx(int ref_idx_val, int ref_idx_ctxIdxInc, int listNum);    void Set_MVLimits();    void ScanSignificant_CABAC(Ipp16s coeff[], int ctxBlockCat,int numcoeff,Ipp32s *dec_single_scan,    T_Block_CABAC_Data* c_data);    void EncodeMV_CABAC(int uMB,Ipp32u dirPred,int num_vectors);    // Encode and reconstruct macroblock    void CEncAndRecMB(Ipp32u uMB);    Ipp32u CEncAndRec16x16IntraMB(Ipp32u uMB);    Ipp32u CEncAndRec4x4IntraMB(Ipp32u uMB);    Ipp32u CEncAndRecInterMB(Ipp32u uMB);    // luma MB motion comp    void MCOneMBLuma(        Ipp32u uMB,        Ipp32u uPitch,              // pitch of source data        const T_ECORE_MV *pMVFwd,   // motion vectors in subpel units        const T_ECORE_MV *pMVBwd,   // motion vectors in subpel units        Ipp8u* pDst,                // put the resulting block here        T_EncodeMBData *pMBData // MB Data structure        );    // chroma MB motion comp    void MCOneMBChroma(        const Ipp32u uMB,           // macroblock number        Ipp32u uPitch,              // pitch of source data        const T_ECORE_MV *pMVFwd,   // motion vectors in subpel units        const T_ECORE_MV *pMVBwd,   // motion vectors in subpel units        Ipp8u* pDst,                // put the resulting block here        T_EncodeMBData *pMBData, // MB Data structure        bool            is_v_plane);    // chroma BiDirectional MB motion comp    void MCOneBiDirMBChroma(        const Ipp32u uMB,           // macroblock        const Ipp32u uPitch,        // pitch of source data        const T_ECORE_MV *pMVL0,// Fwd motion vectors in subpel units        const T_ECORE_MV *pMVL1,// Bwd motion vectors in subpel units        Ipp8u* pDst,                // put the resulting block here        Ipp8u* tempBuff,            // working buffer pointer        bool    is_v_plane);    void setDeblockMVDelta(        Ipp32u uMB,        T_ECORE_MV *pMV,        T_ECORE_MV *pMV2,        MB_Type uDirectBRefMBType);    // Set mvdelta MB info for one MB    void CMEOneMB(        Ipp32u uMB,        Ipp32u *puMBSAD    // return best total MB SAD here        );    void  CMEOneMB_worker(        Ipp32u uMB,        T_RefIdx ref_idx,        const H264EncoderFrame *pRefFrame,        Ipp32s iSearchHor,        Ipp32s iSearchVer,        bool bBSlice,        T_RefIdx bestRefIdxs[41],        T_ECORE_MV BestMVs[41],        Ipp32u  BestSADs[41],        T_ECORE_MV PredictedMV[41]        );    void  CMESplitOneMB_P_Slice(        Ipp32u uMB,        Ipp32u *puMBSAD,    // return best total MB SAD here        T_RefIdx bestRefIdxs[41],        T_ECORE_MV BestMVs[41],        Ipp32u  BestSADs[41],        T_ECORE_MV PredictedMV[41]        );    void  CMESplitOneMB_B_Slice(        Ipp32u uMB,        Ipp32u *puMBSAD,    // return best total MB SAD here        T_ECORE_MV DirectMVs[32],        Ipp32u SADDirect[4],        T_RefIdx ref_idx_direct[16],        T_RefIdx bestRefIdxs[41],        T_ECORE_MV BestMVs[41],        Ipp32u  BestSADs[41],        T_ECORE_MV PredictedMV[41],        T_RefIdx bestRefIdxs_B[41],        T_ECORE_MV BestMVs_B[41],        Ipp32u  BestSADs_B[41],        T_ECORE_MV PredictedMV_B[41]        );    void Calc_One_MV_Predictor (        Ipp32u uMB,                 // which MB        Ipp32u uBlock,              // which 4x4 Block (UL Corner, Raster Order)        Ipp32u uList,               // 0 or 1 for L0 or L1        Ipp32u uBlocksWide,         // 1, 2, or 4        Ipp32u uBlocksHigh,         // 1, 2, or 4 (4x16 and 16x4 not permitted)        T_ECORE_MV *pMVPred,        // resulting MV predictor        T_ECORE_BIGMV *pMVDelta,    // resulting MV delta        int *pRefIdx_ctxIdxInc,     // Context increment for ref_idx CABAC coding.        bool   updateDMV = true        );    bool  Skip_MV_Predicted(        Ipp32u uMB,         // which MB        T_ECORE_MV *pMVOut  // Returns Skip MV if not NULL        );    bool  FindBestInitialMV(        const Ipp8u*            pCurrent,        const Ipp8u*            pPrev,        const Ipp32u            uMB,        // MB number        bool            bBSlice,        T_ECORE_MV&         BestMV16x16,    // resulting Best MV        Ipp32s&             uBestSAD16x16e, // resulting Best RD-Opt Distortion        Ipp32s&             uBestSAD16x16NoRD, // resulting Distortion        T_ECORE_MV&         PredictedMV,    // return the 16x16 predicted vector        const Ipp32s            xMin,        const Ipp32s            xMax,        const Ipp32s            yMin,        const Ipp32s            yMax);    void  CSubPelSearchOneBlock(        Ipp32u uMB,        const H264EncoderFrame *pRefFrame,        Ipp32u uWidth,        Ipp32u  uHeight,        Ipp32u uOffset,        T_ECORE_MV *pBestMV,        T_ECORE_MV *pPredictedMV,        Ipp32u  *puBestSAD        );    void ComputeDirectSpatialRefIdx(        Ipp32u uMB,        Ipp8s &pRefIndexL0,        Ipp8s &pRefIndexL1        );    bool ComputeDirectSpatialMV(        Ipp32u uMB,        T_RefIdx     *ref_direct, // array of 32 refs. first 16 for L0, other for L1        T_ECORE_MV   *mv_direct   // array of 32 mvs, forwards and backwards        );    bool ComputeDirectTemporalMV(        Ipp32u uMB,        T_RefIdx     *ref_direct, // array of 32 refs. first 16 for L0, other for L1        T_ECORE_MV   *mv_direct   // array of 32 mvs, forwards and backwards        );    void  CDirectBOneMB_worker(        const Ipp32u       uMB,        Ipp32u             *puMBSAD,    // return best total MB SAD here        T_RefIdx           *ref_direct,        T_ECORE_MV         *MVDir       // MVs used returned here.        );    void  CBiPredOneMB_worker(        const Ipp32u            uMB,        Ipp32u                  uWidth,        Ipp32u                  uHeight,        Ipp32u                  uBlock,     // which 4x4 Block (UL Corner, Raster Order),        Ipp32u*             puMBSAD,    // return best total MB SAD here        const H264EncoderFrame *pRefFramePrev,        const H264EncoderFrame *pRefFrameFutr,        Ipp32s              DistScaleFactor,        T_ECORE_MV         *MVFwd,      // MVs used returned here.        T_ECORE_MV         *MVBwd       // MVs used returned here.        );    void  CDirectBOneMB_Interp(        const Ipp32u            uMB,        // Current MB        const Ipp32u            uBlkIndex,  // first block index        T_RefIdx           *ref_direct,        T_ECORE_MV         *MVDir       // MVs used returned here.        );       // pointer to future frame buffer    bool  CDirectBOneMB_Interp_Cr(        const Ipp32u uMB,           // macroblock number        const Ipp32u uPitch,        // pitch of source data        const T_ECORE_MV *pMVL0,// Fwd motion vectors in subpel units        const T_ECORE_MV *pMVL1,// Bwd motion vectors in subpel units        Ipp8u* pDst,                // put the resulting block here with pitch of 16        Ipp8u* tempBuff,            // the pointer to the working buffer        bool   is_v_plane,        int offset        );public:    Ipp8s          GetReferenceField(Ipp8s *pFields,Ipp8s RefIndex)    {        if (RefIndex<0)        {            return -1;        }        else        {            VM_ASSERT(pFields[RefIndex]>=0);            return pFields[RefIndex];        }    }    int PictureRateControl(); // Computes quantisation parameters for a picture.    int PostPictureRateControl(Ipp64s bits_encoded);    int InitRateControl(int frame_width_in_mbs, int frame_height_in_mbs);    int ChangeBitrate(H264EncoderParams *info);private:    int mapQuant(int quant_value);    int changeQuant(int quant_value);    ///////////////////////////////////////////////////////////////////////    // Data    ///////////////////////////////////////////////////////////////////////    CH264pBs    *m_pbitstream;    // Which CPU-specific flavor of algorithm to use.    EnumPicClass            m_PicClass;    H264SliceHeader         m_SliceHeader;    H264SeqParamSet         m_SeqParamSet;    H264PicParamSet         m_PicParamSet;    EnumPicCodType          m_PicType;    Ipp32u                  m_FrameNum;    Ipp32s                  m_FrameNumGap;    Ipp32u                  m_PicOrderCnt;    Ipp32u                  m_PicOrderCntMsb;    Ipp32u                  m_PicOrderCntLsb;    Ipp32s                  m_FrameNumOffset;    Ipp32u                  m_TopFieldPOC;    Ipp32u                  m_BottomFieldPOC;    // buffer for Disposable frame reconstruction    H264EncoderFrame *m_pReconstructDisp;    Ipp8u      m_uLastXmittedQP;    // Temporal references    Ipp32s m_trd;    Ipp32s m_trb;    Ipp32u m_previous_tr;    Ipp32u m_current_tr;    // Counters for per slice coded macroblocks    Ipp32u m_MB_Counter;    Ipp32u m_Intra_MB_Counter;    // For INTRA/INTER MB type decision    MB_Type     m_uInterMBType;    Ipp32u      m_uMBInterSAD;    Ipp32u      m_uInterCBP4x4;    // For keeping track of skipped MBs to write mb_skip_run    Ipp32u      m_uSkipRun;    // Table to obtain value to advance the index into the AI and MV arrays    // for the next 4x4 block.    Ipp32s      m_EncBlockIndexInc[24];    // Table to obtain value to advance the 4x4 block offset for the next block.    Ipp32s      m_EncBlockOffsetInc[24];public:    // Rate control related fields.    double  FrameRate;    int     VBV_BufferSize;    int     BitRate;    int     vbv_delay;       // vbv_delay code for picture header    int     rc_vbv_max;      // max allowed size of the frame to be encoded in bits    int     rc_vbv_min;      // min allowed size of the frame to avoid overflow with next frame    double  rc_vbv_fullness; // buffer fullnes before frame removing in bits    double  rc_delay;        // vbv examination delay for current picture    double  rc_ip_delay;     // extra delay for I or P pictures in bits    double  rc_ave_frame_bits; // bits per frame    int     qscale[3];             // qscale codes for 3 frame types (signed!)    int     prsize[3];             // bitsize of previous frame of the type    int     prqscale[3];           // quant scale value, used with previous frame of the type    int     quantiser_scale_value; // for the current frame    int     q_scale_type;          // 0 for linear 1 for nonlinear    int     quantiser_scale_code;  // bitcode for curren scale value    double  rc_weight[3];          // frame weight (length proportion)    double  rc_tagsize[3];         // bitsize target of the type    double  rc_dev;                // bitrate deviation (sum of GOP's frame diffs)    int     N; // GOP size.    int     M; // IPDistance.    H264_Rate_Control_Method m_rate_control_method;    Ipp64s  lastEncodedBits;  // Number of encoded bits of the last frame/field.};} //namespace UMC#endif // __UMC_H264_VIDEO_ENCODER_H__

⌨️ 快捷键说明

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