📄 umc_dv_store.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 <ippvc.h>#include "umc_dv_decoder.h"#include "umc_dv_internal.h"#include "vm_sys_info.h"namespace UMC{//////////////////////////////////////////////////////////////////// DV segment store functionsconst vm_var32 lMacroBlockWidth420 = 8 * 2;const vm_var32 lMacroBlockHeight420 = 8 * 2;const vm_var32 lSuperBlockWidth420 = (lMacroBlockWidth420 * 9);const vm_var32 lSuperBlockHeight420 = (lMacroBlockHeight420 * 3);const vm_var32 lMacroBlockWidth411 = 8 * 4;const vm_var32 lMacroBlockHeight411 = 8;const vm_var32 lSuperBlockHeight411 = (lMacroBlockHeight411 * 6);void DVVideoDecoder::InitializeStoreDVSDInfo(STORE_DV_SEGMENT_INFO &StoreInfo, vm_var32 i, vm_var32 k, vm_var32 nThreadNum){ vm_var32 lSizeSubSampled; vm_var16 *lpsBlock = m_ppShortBlocks[nThreadNum]; StoreInfo.m_lPitch = m_nPitch; StoreInfo.m_lWidth = m_ConversionParam.ConversionInit.SizeDest.width; StoreInfo.m_lHeight = m_ConversionParam.ConversionInit.SizeDest.height; switch (StoreInfo.m_lWidth) { case WIDTH_DV / 2: lSizeSubSampled = 2; break; case WIDTH_DV / 4: lSizeSubSampled = 4; break; case WIDTH_DV / 8: lSizeSubSampled = 8; break; default: lSizeSubSampled = 1; break; } // fill system 625 store info if (SYSTEM_625 == m_nSystem) { vm_var32 lRow, lCol, lBytesPerPixel = 0; // get current column lCol = k / 3; // get current row if (lCol & 0x01) lRow = 2 - (k % 3); else lRow = (k % 3); // we use following formula: // dest buffer + // needed super block row offset + // needed super block column offset + // needed macro block row offset + // needed macro block column offset lBytesPerPixel = 2; StoreInfo.m_lpsSource[0] = lpsBlock + (6 * 64 * 0); StoreInfo.m_lpbDestination[0] = m_lpDestination + (((i + 2) % 12) * m_nPitch * lSuperBlockHeight420 + m_nPitch * lMacroBlockHeight420 * lRow + ((2) * lSuperBlockWidth420 + lMacroBlockWidth420 * lCol) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[1] = lpsBlock + (6 * 64 * 1); StoreInfo.m_lpbDestination[1] = m_lpDestination + (((i + 6) % 12) * m_nPitch * lSuperBlockHeight420 + m_nPitch * lMacroBlockHeight420 * lRow + ((1) * lSuperBlockWidth420 + lMacroBlockWidth420 * lCol) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[2] = lpsBlock + (6 * 64 * 2); StoreInfo.m_lpbDestination[2] = m_lpDestination + (((i + 8) % 12) * m_nPitch * lSuperBlockHeight420 + m_nPitch * lMacroBlockHeight420 * lRow + ((3) * lSuperBlockWidth420 + lMacroBlockWidth420 * lCol) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[3] = lpsBlock + (6 * 64 * 3); StoreInfo.m_lpbDestination[3] = m_lpDestination + (((i + 0) % 12) * m_nPitch * lSuperBlockHeight420 + m_nPitch * lMacroBlockHeight420 * lRow + ((0) * lSuperBlockWidth420 + lMacroBlockWidth420 * lCol) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[4] = lpsBlock + (6 * 64 * 4); StoreInfo.m_lpbDestination[4] = m_lpDestination + (((i + 4) % 12) * m_nPitch * lSuperBlockHeight420 + m_nPitch * lMacroBlockHeight420 * lRow + ((4) * lSuperBlockWidth420 + lMacroBlockWidth420 * lCol) * lBytesPerPixel) / lSizeSubSampled; } // fill system 525 store info else { vm_var32 lRowA, lRowB, lRowC, lColA, lColB, lBytesPerPixel = 0; // get current column lColA = k / 6; lColB = (k + 3) / 6; // get current row if (lColA & 0x01) lRowC = lRowA = 5 - (k % 6); else lRowC = lRowA = (k % 6); if (lColB & 0x01) lRowB = 5 - ((k + 3) % 6); else lRowB = ((k + 3) % 6); if (24 < k) lRowC += (k - 24); // we use following formula: // dest buffer + // needed super block row offset + // needed super block column offset + // needed macro block row offset + // needed macro block column offset lBytesPerPixel = 2; StoreInfo.m_lpsSource[0] = lpsBlock + (6 * 64 * 0); StoreInfo.m_lpbDestination[0] = m_lpDestination + (((i + 2) % 10) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowA + ((9) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColA) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[1] = lpsBlock + (6 * 64 * 1); StoreInfo.m_lpbDestination[1] = m_lpDestination + (((i + 6) % 10) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowB + ((4) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColB) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[2] = lpsBlock + (6 * 64 * 2); StoreInfo.m_lpbDestination[2] = m_lpDestination + (((i + 8) % 10) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowB + ((13) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColB) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[3] = lpsBlock + (6 * 64 * 3); StoreInfo.m_lpbDestination[3] = m_lpDestination + (((i + 0) % 10) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowA + ((0) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColA) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[4] = lpsBlock + (6 * 64 * 4); StoreInfo.m_lpbDestination[4] = m_lpDestination + (((i + 4) % 10) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowC + ((18) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColA) * lBytesPerPixel) / lSizeSubSampled; }} // void DVVideoDecoder::InitializeStoreDVSDInfo(STORE_DV_SEGMENT_INFO &StoreInfo,void DVVideoDecoder::InitializeStoreDV25Info(STORE_DV_SEGMENT_INFO &StoreInfo, vm_var32 i, vm_var32 k, vm_var32 nThreadNum){ vm_var32 lSizeSubSampled; vm_var16 *lpsBlock = m_ppShortBlocks[nThreadNum]; vm_var32 lRowA, lRowB, lRowC, lColA, lColB, lBytesPerPixel = 0; StoreInfo.m_lPitch = m_nPitch; StoreInfo.m_lWidth = m_ConversionParam.ConversionInit.SizeDest.width; StoreInfo.m_lHeight = m_ConversionParam.ConversionInit.SizeDest.height; switch (StoreInfo.m_lWidth) { case WIDTH_DV / 2: lSizeSubSampled = 2; break; case WIDTH_DV / 4: lSizeSubSampled = 4; break; case WIDTH_DV / 8: lSizeSubSampled = 8; break; default: lSizeSubSampled = 1; break; } // get current column lColA = k / 6; lColB = (k + 3) / 6; // get current row if (lColA & 0x01) lRowC = lRowA = 5 - (k % 6); else lRowC = lRowA = (k % 6); if (lColB & 0x01) lRowB = 5 - ((k + 3) % 6); else lRowB = ((k + 3) % 6); if (24 < k) lRowC += (k - 24); // we use following formula: // dest buffer + // needed super block row offset + // needed super block column offset + // needed macro block row offset + // needed macro block column offset lBytesPerPixel = 2; StoreInfo.m_lpsSource[0] = lpsBlock + (6 * 64 * 0); StoreInfo.m_lpbDestination[0] = m_lpDestination + (((i + 2) % m_nMaxNumberOfDIFSequences) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowA + ((9) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColA) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[1] = lpsBlock + (6 * 64 * 1); StoreInfo.m_lpbDestination[1] = m_lpDestination + (((i + 6) % m_nMaxNumberOfDIFSequences) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowB + ((4) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColB) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[2] = lpsBlock + (6 * 64 * 2); StoreInfo.m_lpbDestination[2] = m_lpDestination + (((i + 8) % m_nMaxNumberOfDIFSequences) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowB + ((13) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColB) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[3] = lpsBlock + (6 * 64 * 3); StoreInfo.m_lpbDestination[3] = m_lpDestination + (((i + 0) % m_nMaxNumberOfDIFSequences) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowA + ((0) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColA) * lBytesPerPixel) / lSizeSubSampled; StoreInfo.m_lpsSource[4] = lpsBlock + (6 * 64 * 4); StoreInfo.m_lpbDestination[4] = m_lpDestination + (((i + 4) % m_nMaxNumberOfDIFSequences) * m_nPitch * lSuperBlockHeight411 + m_nPitch * lMacroBlockHeight411 * lRowC + ((18) * lMacroBlockWidth411 + lMacroBlockWidth411 * lColA) * lBytesPerPixel) / lSizeSubSampled;} // void DVVideoDecoder::InitializeStoreDV25Info(STORE_DV_SEGMENT_INFO &StoreInfo,void DVVideoDecoder::StoreDVSDSegment(vm_var32 i, vm_var32 k, vm_var32 nThreadNum){ STORE_DV_SEGMENT_INFO RealStoreInfo; // reset pointers InitializeStoreDVSDInfo(RealStoreInfo, i, k, nThreadNum); // Store system 525 DV segment if (SYSTEM_525 == m_nSystem) { if (24 <= k) { ippiYCrCb411ToYCbCr422_EdgeDV_16s8u_P3C2R((Ipp16s *) RealStoreInfo.m_lpsSource[4], RealStoreInfo.m_lpbDestination[4], (vm_var32) RealStoreInfo.m_lPitch); RealStoreInfo.m_lpbDestination[4] = NULL; RealStoreInfo.m_lpsSource[4] = NULL; } ippiYCrCb411ToYCbCr422_5MBDV_16s8u_P3C2R((const Ipp16s **) RealStoreInfo.m_lpsSource, RealStoreInfo.m_lpbDestination, (vm_var32) RealStoreInfo.m_lPitch); } else { ippiYCrCb420ToYCbCr422_5MBDV_16s8u_P3C2R((const Ipp16s **) RealStoreInfo.m_lpsSource, RealStoreInfo.m_lpbDestination, (vm_var32) RealStoreInfo.m_lPitch); }} // void DVVideoDecoder::StoreDVSegment(vm_var32 i, vm_var32 k, vm_var32 nThreadNum)void DVVideoDecoder::StoreDV25Segment(vm_var32 i, vm_var32 k, vm_var32 nThreadNum){ STORE_DV_SEGMENT_INFO RealStoreInfo; // reset pointers InitializeStoreDV25Info(RealStoreInfo, i, k, nThreadNum); // Store system 525 DV segment (system 625 has equal storing structure) if (24 <= k) { ippiYCrCb411ToYCbCr422_EdgeDV_16s8u_P3C2R((Ipp16s *) RealStoreInfo.m_lpsSource[4], RealStoreInfo.m_lpbDestination[4], (vm_var32) RealStoreInfo.m_lPitch); RealStoreInfo.m_lpbDestination[4] = NULL; RealStoreInfo.m_lpsSource[4] = NULL; } ippiYCrCb411ToYCbCr422_5MBDV_16s8u_P3C2R((const Ipp16s **) RealStoreInfo.m_lpsSource, RealStoreInfo.m_lpbDestination, (vm_var32) RealStoreInfo.m_lPitch);} // void DVVideoDecoder::StoreDV25Segment(vm_var32 i, vm_var32 k, vm_var32 nThreadNum)} // end namespace UMC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -