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

📄 umc_h264_pub.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) 2004 - 2005 Intel Corporation. All Rights Reserved.//#include <string.h>#include "umc_h264_pub.h"#include <stdlib.h>//// We override the C++ "new" and "delete" operators for two reasons.// First, this allows us to guarantee synchronous access in multithreaded// environments (if necessary).// Second, by intercepting all memory allocation and deallocation// calls, we have the option of adding DEBUG support to help find// memory problems.//// We currently do neither of these, but might in the future.// Note that this implementation of 'new' clears the allocated memory// to zero.  This is not required by the C++ definition of new, and should// not be depended upon, but it probably will head off some undefined// variable bugs.///*void *operator new(size_t size){    void *p = H264_Allocate(Ipp32u(size), true);#if defined(PUT_TRASH_IN_NEWD_MEMORY)    // Enable this code if you want to simulate having garbage    // in freshly new'd memory.  This can help detect problems    // due to erroneously relying on operator new to zero memory.    if (p && size > 0)        (void)memset(p, 0xa5, size);#endif    return p;}voidoperator delete(void* p){    // Deleting a NULL pointer has no effect, according to C++ semantics.    if (p)        H264_Free(p);}*/namespace UMC{H264_Image_Format::H264_Image_Format(){    this->Clear();}voidH264_Image_Format::Clear(){//    fid = H264_FID_UNDEFINED;    dimensions.width = dimensions.height = 0;    Propagate_Defaults();    // The yuv_info member is not relevant to H264_FID_UNDEFINED,    // but go ahead and zero it anyway, for safety.    yuv_info.y_pitch = yuv_info.u_pitch = yuv_info.v_pitch = 0;}voidH264_Image_Format::Propagate_Defaults(){    rectangle = dimensions;    topdown = false;//bool(!H264_FID_Is_Topdown_Meaningful(fid));    //if (H264_FID_Uses_YUV_Info(fid))    {        yuv_info.y_pitch = dimensions.width;        //if (fid == H264_FID_YVU9)          //  yuv_info.u_pitch = yuv_info.v_pitch = dimensions.width / 4;        //else            yuv_info.u_pitch = yuv_info.v_pitch = dimensions.width / 2;    }}boolH264_Image_Format::operator == (const H264_Image_Format &oprnd) const{/*    if (H264_FID_Uses_YUV_Info(fid))*/    {        if (   yuv_info.y_pitch != oprnd.yuv_info.y_pitch            || yuv_info.u_pitch != oprnd.yuv_info.u_pitch            || yuv_info.v_pitch != oprnd.yuv_info.v_pitch           )            return false;    }    return true;}H264_Image::H264_Image()    :    format(){    size = 0;    sequence_number = 0;    yuv_info.y_plane = yuv_info.u_plane = yuv_info.v_plane = NULL;}voidH264_Image::Set_Buffer_Pointers(void *buffer){//    if (H264_FID_Uses_YUV_Info(format.fid))    {        yuv_info.y_plane = (Ipp8u*)buffer;        if (!buffer)        {            yuv_info.u_plane = yuv_info.v_plane = 0;        }        else //if (format.fid == H264_FID_YUV12 || format.fid == H264_FID_IYUV)        {            yuv_info.u_plane = yuv_info.y_plane +                (format.yuv_info.y_pitch * format.rectangle.height);            yuv_info.v_plane = yuv_info.u_plane +                (format.yuv_info.u_pitch * format.rectangle.height / 2);        }        /*else if (format.fid == H264_FID_YV12)        {            // For YV12, the v plane comes before the u plane            yuv_info.v_plane = yuv_info.y_plane +                (format.yuv_info.y_pitch * format.rectangle.height);            yuv_info.u_plane = yuv_info.v_plane +                (format.yuv_info.v_pitch * format.rectangle.height / 2);        }        else if (format.fid == H264_FID_YVU9)        {            // For YVU9, the v plane comes before the u plane            yuv_info.v_plane = yuv_info.y_plane +                (format.yuv_info.y_pitch * format.rectangle.height);            yuv_info.u_plane = yuv_info.v_plane +                (format.yuv_info.v_pitch * format.rectangle.height / 4);        }*/    }    //else      //  data = (Ipp8u*)buffer;}voidH264_Image::Set_Buffer_Pointers(void *y_arg,                                void *u_arg,                                void *v_arg){    yuv_info.y_plane = (Ipp8u*)y_arg;    yuv_info.u_plane = (Ipp8u*)u_arg;    yuv_info.v_plane = (Ipp8u*)v_arg;}Ipp8u*H264_Image::Get_Base_Pointer(void) const{//    if (H264_FID_Uses_YUV_Info(format.fid))        return yuv_info.y_plane;//    return data;}////////////////////////// H264_Encoder methods////////////////////////// Define an array that gives the name of each image format.} //namespace UMC

⌨️ 快捷键说明

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