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

📄 umc_dv100_dec_1080_60i_system_store.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) 2006 Intel Corporation. All Rights Reserved.
//
//
*/

#include "umc_dv100_decoder.h"
#include <ippvc.h>

namespace UMC
{

static const Ipp32s MacroBlockWidth = 16;
static const Ipp32s MacroBlockHeight = 16;
static const Ipp32s MacroBlockHalfHeight = 8;
static const Ipp32s SuperBlockWidth = 9 * MacroBlockWidth;

static
void InitializeOffsets(Ipp8u **pDestinations,
                       Ipp8u *pDestImage,
                       size_t nDestPitch,
                       Ipp32s nChannelNum,
                       Ipp32s nDIFSeqNum,
                       Ipp32s nVideoSegmentNum)
{
    Ipp32s MBNum;
    Ipp32s s = nDIFSeqNum / 5;
    Ipp32s x = nDIFSeqNum % 5;
    Ipp32s t = (nVideoSegmentNum + 27*x) % 5;
    Ipp32s k = (nVideoSegmentNum + 27*x) / 5;
    Ipp32s h = nChannelNum;
    Ipp32s SuperBlockVertOrder[]=
    {
        (4*h + s + 2*t + 2) % 10, // a
        (4*h + s + 2*t + 6) % 10, // b
        (4*h + s + 2*t + 8) % 10, // c
        (4*h + s + 2*t + 0) % 10, // d
        (4*h + s + 2*t + 4) % 10  // e
    };
    Ipp32s SuperBlockHorzOrder[] = {2, 1, 3, 0, 4};
    Ipp32s BytesPerPixel = 2;

    for(MBNum = 0; MBNum<5; MBNum++)
    {
        Ipp32s Row = k/9;
        Ipp32s Col = k%9;
        Ipp32s MBVertOrder =  h/2 + SuperBlockVertOrder[MBNum]*6 + Row*2;
        Ipp32s MBHorzOrder = (h%2 + SuperBlockHorzOrder[MBNum]*2 ) * 9 + Col;
        if( MBHorzOrder < 80 )
        {
            pDestinations[2*MBNum] = pDestImage +
                               MacroBlockHeight * 4  * nDestPitch +    //skip 4 macro blocks from A0-A7
                               MBVertOrder * MacroBlockHeight * nDestPitch +
                               MBHorzOrder * MacroBlockWidth * BytesPerPixel;

            pDestinations[2*MBNum + 1] = pDestinations[2*MBNum] + nDestPitch * MacroBlockHalfHeight;
        }
        else if ( MBVertOrder < 4 * 8 )
        {
            //A0-A7
            Ipp32s A = MBVertOrder / 4;
            pDestinations[2*MBNum] = pDestImage +
                                   (MBVertOrder % 4) * MacroBlockHeight * nDestPitch +
                                   (A * 10 + (MBHorzOrder - 80) ) * MacroBlockWidth * BytesPerPixel;

            pDestinations[2*MBNum+1] = pDestinations[2*MBNum] + nDestPitch * MacroBlockHalfHeight;
        }
        else if ( MBVertOrder < 4 * 8  + 3*8)
        {
            //A8-A15
            Ipp32s A = (MBVertOrder - 4 * 8) / 3;
            pDestinations[2*MBNum] = pDestImage +
                                   (60 + 4) * MacroBlockHeight * nDestPitch + //Skip A0-A7 and main part of the frame
                                   ( (MBVertOrder - 4*8) % 3) * MacroBlockHeight * nDestPitch +
                                   (A * 10 + (MBHorzOrder - 80) ) * MacroBlockWidth * BytesPerPixel;

            pDestinations[2*MBNum+1] = pDestinations[2*MBNum] + nDestPitch * MacroBlockHalfHeight;
        }
        else
        {
            //B16
            pDestinations[2*MBNum] = pDestImage +
                                   (60 + 4 + 3) * MacroBlockHeight * nDestPitch + //Skip A0-A7, main part of the frame and A8-A15
                                   ( (MBVertOrder - (4*8 + 3*8) ) * 10 + (MBHorzOrder - 80) ) * 32 * BytesPerPixel;

            pDestinations[2*MBNum+1] = pDestinations[2*MBNum] + MacroBlockWidth * BytesPerPixel;
        }
    }
}

void DV100VideoDecoder::Store_System1080_60i_Segment(Ipp16s* pDecodedVideoSegment, Ipp32s nChannelNum, Ipp32s nDIFSeqNum, Ipp32s nVideoSegmentNum)
{
    Ipp8u *pDestinations[10];
    // reset pointers
    InitializeOffsets(pDestinations, m_pDestination, m_nDestPitch, nChannelNum, nDIFSeqNum, nVideoSegmentNum);
    ippiYCrCb422ToYCbCr422_10HalvesMB16x8_DV100_16s8u_P3C2R(pDecodedVideoSegment, pDestinations, m_nDestPitch);
}


}//namespace UMC

⌨️ 快捷键说明

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