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

📄 umc_video_data.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) 2003-2005 Intel Corporation. All Rights Reserved.//*/#include "umc_video_data.h"namespace UMC{enum{    ALIGN_VALUE                 = 128};VideoData::VideoData(void) :    m_lpDest(m_lpImageDest),    m_lPitch(m_lImagePitch),    m_FrameType(m_ImageFrameType),    m_ColorFormat(m_ImageColorFormat){    m_lpImageDest[0] =    m_lpImageDest[1] =    m_lpImageDest[2] = NULL;    m_lImagePitch[0] =    m_lImagePitch[1] =    m_lImagePitch[2] = 0;    m_ImageFrameType = NONE_PICTURE;    m_ImageColorFormat = NONE;    m_Width = 0;    m_Height = 0;} // VideoData::VideoData(void)VideoData::~VideoData(void){    Close();} // VideoData::~VideoData(void)Status VideoData::Close(void){    return MediaData::Close();} // Status VideoData::Close(void)size_t VideoData::GetImagesSize(vm_var32 width,                                vm_var32 height,                                ColorFormat cFormat){    size_t size = (unsigned) -1;    size_t nPitch = 0;    switch(cFormat)    {    case YV12:    case NV12:        nPitch =  align_value<size_t> (width, ALIGN_VALUE);        size = (nPitch * height * 3) / 2;        break;    case YUV422:        nPitch =  align_value<size_t> (width, ALIGN_VALUE);        size = nPitch * height * 2;        break;    case YUV444:        nPitch =  align_value<size_t> (width, ALIGN_VALUE);        size = nPitch * height * 4;        break;    case YUY2:    case UYVY:    case RGB565:    case RGB555:    case RGB444:        nPitch = align_value<size_t> (width * 2, ALIGN_VALUE);        size = nPitch * height;        break;    case RGB24:        nPitch =  align_value<size_t> (width * 3, ALIGN_VALUE);        size = nPitch * height;        break;    case RGB32:        nPitch =  align_value<size_t> (width * 4, ALIGN_VALUE);        size = nPitch * height;        break;        // bad image format    default:        return size;    }    return size;} // size_t VideoData::GetImagesSize(vm_var32 width,size_t VideoData::GetMappingSize(vm_var32 width,                                 vm_var32 height,                                 ColorFormat cFormat){    size_t size = GetImagesSize(width, height, cFormat);    return size;} // size_t VideoData::GetMappingSize(vm_var32 width,Status VideoData::GetVideoParameters(vm_var32& width,                                     vm_var32& height,                                     ColorFormat& cFormat){    width  = m_Width;    height = m_Height;    cFormat = m_ImageColorFormat;    return UMC_OK;}Status VideoData::SetVideoParameters(vm_var32 width,                                     vm_var32 height,                                     ColorFormat cFormat){    size_t nPitch = 0;    switch(cFormat)    {    case YV12:    case NV12:    case YUV422:    case YUV444:        nPitch =  align_value<size_t> (width, ALIGN_VALUE);        break;    case YUY2:    case UYVY:    case RGB565:    case RGB555:    case RGB444:        nPitch = align_value<size_t> (width * 2, ALIGN_VALUE);        break;    case RGB24:        nPitch =  align_value<size_t> (width * 3, ALIGN_VALUE);        break;    case RGB32:        nPitch =  align_value<size_t> (width * 4, ALIGN_VALUE);        break;        // bad image format    default:        return(UMC_BAD_FORMAT);    }    switch (cFormat)    {    case YV12:    case YUV422:        SetPitch(nPitch, nPitch / 2, nPitch / 2);        break;    case YUV444:        SetPitch(nPitch, nPitch, nPitch);        break;    case NV12:        SetPitch(nPitch, nPitch, 0);        break;    default:        SetPitch(nPitch);        break;    };    m_Width = width;    m_Height = height;    m_ImageColorFormat = cFormat;    return UMC_OK;} // Status VideoData::SetVideoParameters(vm_var32 width,Status VideoData::SetBufferPointer(vm_byte *ptr, size_t bytes){    Status res = MediaData::SetBufferPointer((vm_byte *)ptr, bytes);    if (res != UMC_OK)        return res;    switch (m_ImageColorFormat)    {    case YV12:        SetDest(ptr,                ptr + m_lPitch[0] * m_Height,                ptr + (m_lPitch[1]/2 + m_lPitch[0]) * m_Height);        break;    case YUV422:    case YUV444:        SetDest(ptr,                ptr + m_lPitch[0] * m_Height,                ptr + (m_lPitch[1] + m_lPitch[0]) * m_Height);        break;    case NV12:        SetDest(ptr,                ptr + m_lPitch[0] * m_Height,                NULL);        break;    default:        SetDest(ptr);        break;    }    return UMC_OK;} // Status VideoData::SetPointer(vm_byte *ptr, size_t bytes)} // end namespace UMC

⌨️ 快捷键说明

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