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

📄 umc_h264_pub.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
📖 第 1 页 / 共 3 页
字号:
// memory region.  This inner rectangle is specified by giving the (x,y)// coordinates of its upper left or lower left corner, and its dimensions.// The coordinates are relative to the upper left corner for a top-down DIB,// and relative to the lower left corner for a bottom-up DIB.struct sRectangle : public sDimensions{        Ipp32u     x;        Ipp32u     y;        // Quite frequently, a rectangle has origin (0,0), and dimensions        // equivalent to an existing sDimensions object.  We provide        // here an assignment operator that allows the dimensions object        // to be conveniently assigned to the rectangle.        sRectangle&  operator=(const sDimensions &dim)            {                x = y = 0;                width  = dim.width;                height = dim.height;                return *this;            }};// A H264_Image_Format object describes the *type* of an image.  The intent// is that it contains enough descriptive information so that a codec can// perform capability negotiations (i.e., advertise and agree on input and// output format types) and also allocate any dimension-dependent memory.struct H264_Image_Format{        //H264_FID         fid;        sDimensions  dimensions;            // Generally, this "dimensions" member specifies the dimensions            // of the image at hand (or perhaps the desired dimensions, if            // this format is describing a request for zoomed output).            // However, for DCI, this is not the case.            // For DCI (and only DCI), when a H264_Image_Format is describing            // a H264_Decoder's output image, then this "dimensions" member            // specifies the dimensions of the display screen, and the desired            // dimensions of the image are found in the "rectangle" member .        sRectangle   rectangle;            // In general, this "rectangle" member has origin (0, 0) and            // dimensions equivalent to the image at hand.            // However, when this H264_Image_Format is describing a            // H264_Decoder's output image for DCI, then this "rectangle"            // member specifies a rectangle within the screen.  In this            // case, it will have a non-zero origin, though its dimensions            // will still reflect those of the image at hand (or its desired            // dimensions, it zooming is being requested).            //            // In all cases (DCI and not DCI), the dimensions in the            // "rectangle" member are the dimensions of the image at hand            // (or its desired dimensions, if requesting zoomed output).            // In the non-DCI case, the rectangle's origin is zero, and its            // dimensions match the "dimensions" member.            // In the DCI case, the rectangle's origin may be non-zero, its            // dimensions represent the image at hand, and the above            // "dimensions" member reflects the display screen size.        bool     topdown;            // Indicates whether the image is represented in a top-down            // fashion, or is to be written in a top-down fashion.            // The alternative is that it is bottom-up.            // This member is not meaningful for all formats.            // See function H264_FID_Is_Topdown_Meaningful().        // The following union contains fid-specific type information.        union {            // The yuv_info struct represents the pitch values for YUV            // formats, e.g. YUV12, YVU9 et.al.            struct {                Ipp32u     y_pitch;                Ipp32u     u_pitch;                Ipp32u     v_pitch;            } yuv_info;        };        //        // Define Methods for operating on H264_Image_Formats        //                        H264_Image_Format();            // The constructor simply gives each field a "NULL"-like value,            // identical to the Clear() method.        void            Clear();            // The Clear() method can be called at any time to give each            // field a "NULL"-like value.  The fid will be H264_FID_UNDEFINED.        void            Propagate_Defaults();            // The Propagate_Defaults() method provides a convenient way to            // to complete the initialization of a H264_Image_Format structure            // after having set its fid and dimensions members.  Based on            // the fid and dimensions values, this method assigns reasonable            // values to the remaining members, including rectangle, topdown,            // and yuv_info if relevant.  topdown is set to false when            // it is meaningful, otherwise true.  When topdown is meaningful,            // this default assignment may not be appropriate in all contexts.        bool operator == (const H264_Image_Format &) const;            // Compare two image formats for equality        bool operator != (const H264_Image_Format &oprnd) const            { return bool(!(*this == oprnd)); }            // Compare two image formats for inequality};// A H264_Image object represents an actual instance of an image.  Thus it// includes a H264_Image_Format that describes the image, as well as pointers// to the image's data, among other information.struct H264_Image {        H264_Image_Format    format;        Ipp32u                 size;            // "size" gives the total length, in bytes, of the image's data.        Ipp32u                 sequence_number;            // This number indicates the temporal position of this image            // with respect to previous and future images.  Its value is            // specific to each video environment.        // The following union contains fid-specific representation        // information.  A given fid uses only one of the following        // union members.        union {            // The yuv_info struct points to the Y, U and V planes' data.            // It is used for YUV formats, e.g. YUV12, YVU9, et. al.            struct {                Ipp8u         *y_plane;                Ipp8u         *u_plane;                Ipp8u         *v_plane;            } yuv_info;            // The 'data' member points to the image data for non-YUV formats.            Ipp8u             *data;        };        //        // Define Methods for operating on H264_Images        //                        H264_Image(); // The constructor simply gives each field a "NULL"-like value.public:        void            Set_Buffer_Pointers(void *y, void *u, void *v); // Sets the plane pointers.private:        /* The (void*) parameter points to a buffer containing the         * image data.  For YUV formats, this method sets the plane         * pointers in the 'yuv_info' member.         * For other formats it sets 'data' to the given pointer.         */        void            Set_Buffer_Pointers(void*);        /* For YUV formats, this method returns yuv_info.y_plane.         * For other formats it returns the 'data' pointer.         */        Ipp8u*             Get_Base_Pointer(void) const;};// Motion vectors with RefIdxtypedef struct {    Ipp8s   iMVx;    Ipp8s   iMVy;} T_ECORE_MV;// Motion vectors, when 8 bits isn't enoughtypedef struct {    Ipp32s  iMVx;    Ipp32s  iMVy;} T_ECORE_BIGMV;struct H264Extra_MB_Info{    Ipp32u BestSADs[41];    T_ECORE_MV BestMVs[41];    Ipp32u MB_Inter_SAD,MB_Intra_SAD;    MB_Type MB_Mode;};// Maximum number of active reference frames in a reference picture list (0 or 1).// Slice data struct used by encoder and decoder for maintaining slice-level// data for a picture.struct SliceData {    EnumSliceType slice_type;    Ipp32s      DistScaleFactor[MAX_NUM_REF_FRAMES];    Ipp32s      DistScaleFactorMV[MAX_NUM_REF_FRAMES];    // Temporal scaling factor used for B slice temporal direct mode    // motion vector scaling and for implicit bidir prediction weighting.    Ipp32u      num_ref_idx_l0_active;          // num list 0 ref pics used to decode the slice    Ipp32u      num_ref_idx_l1_active;          // num list 0 ref pics used to decode the slice    Ipp8u       pic_parameter_set_id;           // of pic param set used for this slice    Ipp8u       disable_deblocking_filter_idc;  // deblock filter control, 0=filter all edges    Ipp8s       slice_alpha_c0_offset;          // deblock filter c0, alpha table offset    Ipp8s       slice_beta_offset;              // deblock filter beta table offset    Ipp8u       luma_log2_weight_denom;         // luma weighting denominator    Ipp8u       chroma_log2_weight_denom;       // chroma weighting denominator    Ipp8s       chroma_qp_index_offset;         // offset to add to QP for chroma};  // SliceDatatypedef enum {    H264_RCM_QUANT         = 0,    H264_RCM_BITRATE       = 1,    H264_RCM_MPEG2         = 2,    H264_RCM_DEBUG         = 3 // Fix quantizer values, no actual rate control.} H264_Rate_Control_Method;struct H264_Rate_Controls {    H264_Rate_Control_Method     method;    Ipp8u                      quant;    Ipp32u                     bitrate;};// A sDimensions object specifies the dimensions of any rectangle, such as// an image, or a buffer, or a display rectangle.  Note that the dimensions// are always non-negative.//// Define formats for representing key frame control options.//// Key frames can be requested at regular intervals.  Also, the target// frame size for key frames can be specified, independently of the rate// control for non-key frames.//typedef Ipp32u     H264_Key_Frame_Control_Method;// These methods control how often key frames are generated.// Note that, regardless which of these methods is used, additional// interfaces exist that allow a key frame to be requested on demand.const H264_Key_Frame_Control_Method      H264_KFCM_AUTO     = 0;// Let the encoder decide when to generate key frames.// This method typically causes the least number of key frames to// be generated.const H264_Key_Frame_Control_Method      H264_KFCM_INTERVAL = 1;// Generate key frames at a regular intervalstruct H264_Key_Frame_Controls {    H264_Key_Frame_Control_Method        method;    Ipp32u                               interval;    Ipp32u                               idr_interval;    // 'interval' is meaningful only when method == H264_KFCM_INTERVAL.    // It specifies the frequency of key frames.  A value of 1000,    // for example, means that a key frame should be generated    // approximately every 1000 frames.  A value of 1 means that    // every frame should be a key frame.    // The interval must always be >= 1.    H264_Rate_Controls                   rate_controls;    // Specifies the desired bit rate controls for key frames.    // This member allows an application to specify bit rate targets    // for key frames independently of the bit rate targets for non-key    // frames.  Note that the concept of frame rate does not necessarily    // make sense for key frames.  For this reason, the rate control    // method H264_RCM_FRAME_AND_DATA is not allowed here.};typedef struct {    H264_Rate_Controls           rate_controls;    H264_Key_Frame_Controls      key_frame_controls;    Ipp32u                         number_of_B_frames;    // Specifies the number of B frames to generate between non-B-frames.    // A value of zero indicates that no B-frames should be generated.    // This value may not be larger than H264_Max_B_Frames.} H264_Sequence_Controls;typedef struct {    Ipp32u uEdgeType;       // for the MB    Ipp32u uPitch;    Ipp32u uWidthIn4x4Blocks;    Ipp8u   uUseURPred[24]; // for each block, 1 if use upper right pred pels, else 0    Ipp8u   uQP;} T_4x4IntraModeSelParams;struct H264AdvRate_Options{    Ipp32u max_qp;    Ipp32u min_qp;    Ipp32u max_dqp;    Ipp32u max_intra_qp;    Ipp32u queue_size;    Ipp64f min_fsize;    Ipp64f max_fsize;    Ipp64f i_frames_mult;    H264AdvRate_Options()    {        max_qp = 51;        min_qp = 0;        max_dqp = 2;        max_intra_qp = 37;        queue_size = 0;        max_fsize = 2.0;        i_frames_mult = 2.0;        min_fsize = 0.5;    }    H264AdvRate_Options& operator= (const H264AdvRate_Options& val)    {        max_qp=val.max_qp;        min_qp=val.min_qp;        max_dqp=val.max_dqp;        max_intra_qp=val.max_intra_qp;        queue_size=val.queue_size;        min_fsize=val.min_fsize;        max_fsize=val.max_fsize;        i_frames_mult=val.i_frames_mult;        return *this;    }    int operator == (const H264AdvRate_Options &val) const    {        int ret=0;        ret+=max_qp==val.max_qp;        ret+=min_qp==val.min_qp;        ret+=max_dqp==val.max_dqp;        ret+=max_intra_qp==val.max_intra_qp;        ret+=queue_size==val.queue_size;        ret+=min_fsize==val.min_fsize;        ret+=max_fsize==val.max_fsize;        ret+=i_frames_mult==val.i_frames_mult;        return !ret;    };    int operator != (const H264AdvRate_Options &oprnd) const    { return !(*this == oprnd); };};enum{    DATA_ALIGN                  = 64,    LUMA_PADDING                = YUV_Y_PADDING * 2,    CHROMA_PADDING              = YUV_Y_PADDING};inline Ipp32u CalcPitchFromWidth(Ipp32u width){    return align_value<Ipp32u> (width + LUMA_PADDING * 2, DATA_ALIGN);}} //namespace UMC#endif // H264PUB_H__

⌨️ 快捷键说明

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