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

📄 umc_h264_expand.cpp

📁 audio-video-codecs.rar语音编解码器
💻 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 - 2007 Intel Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------;

#include "umc_h264_pub.h"
#include "umc_h264_config.h"

//--------------------------------------------------------------------------;
//
//  The algorithm fills in (1) the bottom (not including corners),
//  then (2) the sides (including the bottom corners, but not the
//  top corners), then (3) the top (including the top
//  corners) as shown below, replicating the outermost bytes
//  of the original frame outward:
//
//               ----------------------------
//              |                            |
//              |            (3)             |
//              |                            |
//              |----------------------------|
//              |     |                |     |
//              |     |                |     |
//              |     |                |     |
//              |     |    original    |     |
//              |     |     frame      |     |
//              |     |                |     |
//              | (2) |                | (2) |
//              |     |                |     |
//              |     |                |     |
//              |     |----------------|     |
//              |     |                |     |
//              |     |      (1)       |     |
//              |     |                |     |
//               ----------------------------
//
//--------------------------------------------------------------------------;

namespace UMC_H264_ENCODER
{

template <class PixType> void ExpandPlane(
    PixType *StartPtr,
    Ipp32s   frameWidth,
    Ipp32s   frameHeight,
    Ipp32s   pitchPixels,
    Ipp32s   pels
)
{
    Ipp32s   row, col;
    PixType  uLeftFillVal;
    PixType  uRightFillVal;
    PixType* pByteSrc;

#ifndef NEW_INTERPOLATE
    PixType *pSrc = StartPtr + (frameHeight - 1)*pitchPixels;
    PixType *pDst = pSrc + pitchPixels;
    // section 1 at bottom
    // obtain pointer to start of bottom row of original frame
    for (row=0; row < pels; row++, pDst += pitchPixels) {
        memcpy(pDst, pSrc, frameWidth*sizeof(PixType));
    }
#endif

    // section 2 on left and right
    // obtain pointer to start of first row of original frame
    pByteSrc = StartPtr;
    for (row=0; row<(frameHeight + pels); row++, pByteSrc += pitchPixels)
    {
        // get fill values from left and right columns of original frame
        uLeftFillVal = *pByteSrc;
        uRightFillVal = *(pByteSrc + frameWidth - 1);

        // fill all bytes on both edges
        for (col=0; col<pels; col++)
        {
            *(pByteSrc - pels + col) = uLeftFillVal;
            *(pByteSrc + frameWidth + col) = uRightFillVal;
        }
    }

#ifndef NEW_INTERPOLATE
    // section 3 at top
    // obtain pointer to top row of original frame, less expand pels
    pSrc = StartPtr - pels;
    pDst = pSrc - pitchPixels;
    for (row=0; row<pels; row++, pDst -= pitchPixels) {
       memcpy(pDst, pSrc, sizeof(PixType)*(frameWidth + pels + pels));
    }
#endif
}   // end ExpandPlane

template void ExpandPlane<Ipp8u>(Ipp8u*   StartPtr,
                                 Ipp32s   frameWidth,
                                 Ipp32s   frameHeight,
                                 Ipp32s   pitchPixels,
                                 Ipp32s   pels);

#if defined BITDEPTH_9_12
template void ExpandPlane<Ipp16u>(Ipp16u*  StartPtr,
                                  Ipp32s   frameWidth,
                                  Ipp32s   frameHeight,
                                  Ipp32s   pitchPixels,
                                  Ipp32s   pels);
#endif // BITDEPTH_9_12

} //namespace UMC_H264_ENCODER

⌨️ 快捷键说明

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