📄 umc_mpeg2_spl_dword_pointer.h
字号:
/*////////////////////////////////////////////////////////////////////////////////// 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.//*/#ifndef __UMC_MPEG2_SPL_DWORD_POINTER_H#define __UMC_MPEG2_SPL_DWORD_POINTER_Hnamespace UMC{class DwordPointer{public: // Default constructor DwordPointer(void) { m_pDest = NULL; m_nByteNum = 0; } DwordPointer operator = (void *pDest) { m_pDest = (Ipp8u *) pDest; m_nByteNum = 3; return *this; } // Increment operator DwordPointer &operator ++ (void) { if (0 == m_nByteNum) { m_pDest += 4; m_nByteNum = 3; } else m_nByteNum -= 1; return *this; } Ipp8u operator = (Ipp8u nByte) { m_pDest[m_nByteNum] = nByte; return nByte; }protected: Ipp8u *m_pDest; // (Ipp8u *) pointer to destination buffer Ipp32u m_nByteNum; // (Ipp32u) number of current byte in dword};class H264SourcePointer{public: // Default constructor H264SourcePointer(void) { m_pSource = NULL; } H264SourcePointer &operator = (void *pSource) { m_pSource = (Ipp8u *) pSource; m_CurBytes[0] = m_pSource[0]; m_CurBytes[1] = m_pSource[1]; m_CurBytes[2] = m_pSource[2]; m_CurBytes[3] = m_pSource[3]; m_pSource += 4; m_nZeros = 0; m_nRemovedBytes = 0; if (0 == m_CurBytes[1]) { if (0 == m_CurBytes[0]) m_nZeros = 2; else m_nZeros = 1; } return *this; } Ipp32u Increment(void) { // remove preventing byte if ((2 <= m_nZeros) && (3 == m_CurBytes[2]) && (0 == (0x0fc & m_CurBytes[3]))) { m_nRemovedBytes += 1; if (0 == m_CurBytes[3]) m_nZeros = 1; else m_nZeros = 0; // first byte is zero m_CurBytes[1] = m_CurBytes[3]; m_CurBytes[2] = m_pSource[0]; m_CurBytes[3] = m_pSource[1]; m_pSource += 2; return 2; } else { // check current byte if (0 == m_CurBytes[2]) m_nZeros += 1; else m_nZeros = 0; // shift bytes m_CurBytes[0] = m_CurBytes[1]; m_CurBytes[1] = m_CurBytes[2]; m_CurBytes[2] = m_CurBytes[3]; m_CurBytes[3] = m_pSource[0]; m_pSource += 1; return 1; } } operator Ipp8u (void) { return m_CurBytes[0]; } Ipp32u GetRemovedBytes(void) { return m_nRemovedBytes; }protected: Ipp8u *m_pSource; // (Ipp8u *) pointer to destination buffer Ipp8u m_CurBytes[4]; // (Ipp8u) current bytes in stream Ipp32u m_nZeros; // (Ipp32u) number of preceding zeros Ipp32u m_nRemovedBytes; // (Ipp32u) number of removed bytes};} // namespace UMC#endif // __UMC_MPEG2_SPL_DWORD_POINTER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -