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

📄 umc_h264_padd.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 "umc_h264_padd.h"namespace UMC{PaddedYUVBuffer::PaddedYUVBuffer()    : m_pAllocatedBuffer(0)    , m_allocatedSize(0)    , m_pBuffer(0)    , m_lumaSize(0, 0)    , m_pitch(0){}PaddedYUVBuffer::~PaddedYUVBuffer(){    deallocate();}voidPaddedYUVBuffer::deallocate(){    m_allocatedSize = 0;    m_pBuffer = 0;    YUVPointers::clear();    m_lumaSize = sDimensions(0, 0);    m_pitch = 0;    if (m_pAllocatedBuffer)    {        H264_Free(m_pAllocatedBuffer);        m_pAllocatedBuffer = 0;    }}voidPaddedYUVBuffer::conditionalDeallocate(const sDimensions &dim){    if (dim != lumaSize())        deallocate();}StatusPaddedYUVBuffer::allocate(const sDimensions &lumaSize){    Ipp32u newSize;    // Y plane dimensions better be even, so width/2 correctly gives U,V size    // YUV_ALIGNMENT must be a power of 2.  Since this is unlikely to change,    // and since checking for a power of 2 is painful, let's just put a simple    // assert here, that can be updated as needed for other powers of 2.    newSize =        ((YUV_Y_PADDING << 1) + lumaSize.width)        *        (3*YUV_Y_PADDING + ((3*lumaSize.height) >> 1))        + YUV_ALIGNMENT;    // Reallocate only if needed    if (newSize > m_allocatedSize)    {        if (m_pAllocatedBuffer)            H264_Free(m_pAllocatedBuffer);        m_pAllocatedBuffer = (Ipp8u*)H264_Allocate(newSize, false);        if (!m_pAllocatedBuffer)        {            // Reset all our state variables            deallocate();            return UMC_FAILED_TO_ALLOCATE_BUFFER;        }        m_allocatedSize = newSize;        m_pBuffer = m_pAllocatedBuffer;        Ipp32u extraBytes = (Ipp32u) ((m_pBuffer - (Ipp8u*)0) & (YUV_ALIGNMENT - 1));        if (extraBytes)            m_pBuffer += YUV_ALIGNMENT - extraBytes;    }    m_lumaSize = lumaSize;    m_pitch = m_lumaSize.width + (YUV_Y_PADDING << 1);    m_pYPlane = m_pBuffer + YUV_Y_PADDING * (m_pitch + 1);    m_pUPlane = m_pBuffer + YUV_UV_PADDING +                m_pitch * (2*YUV_Y_PADDING + m_lumaSize.height + YUV_UV_PADDING);    m_pVPlane = m_pUPlane + (m_lumaSize.width >> 1) + YUV_Y_PADDING;    return UMC_OK;}} //namespace UMC

⌨️ 快捷键说明

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