📄 umc_avs_dec_memory_piece.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) 2007 Intel Corporation. All Rights Reserved.
//
//
*/
#ifndef __UMC_AVS_DEC_MEMORY_PIECE_H
#define __UMC_AVS_DEC_MEMORY_PIECE_H
#include "ippdefs.h"
#include "ipps.h"
#include "umc_structures.h"
namespace UMC
{
class AVSMemory
{
public:
// Default constructor
AVSMemory(void)
{
m_pbAllocated = 0;
m_nAllocated = 0;
m_nDataSize = 0;
}
// Destructor
~AVSMemory(void)
{
Close();
}
// Initialize memory piece
Status Init(size_t nSize)
{
if (nSize > m_nAllocated)
{
// release the object before initialization
Close();
m_pbAllocated = ippsMalloc_8u(align_value<Ipp32s> (nSize, 4));
if (NULL == m_pbAllocated)
return UMC_ERR_ALLOC;
m_nAllocated = nSize;
}
return UMC_OK;
}
// Release the object
Status Close(void)
{
if (m_pbAllocated)
ippsFree(m_pbAllocated);
m_pbAllocated = 0;
m_nAllocated = 0;
m_nDataSize = 0;
return UMC_OK;
}
// Get pointer to the memory
inline
Ipp32u *GetBuffer(void)
{
return align_pointer<Ipp32u *> (m_pbAllocated, 4);
}
// Get the allocated buffer's size
inline
size_t GetSize(void)
{
return m_nAllocated;
}
// Get the valid data size
inline
size_t GetDataSize(void)
{
return m_nDataSize;
}
// Get the valid data size
inline
void SetDataSize(size_t dataSize)
{
m_nDataSize = dataSize;
}
protected:
Ipp8u *m_pbAllocated; // (Ipp8u *) pointer to the allocated buffer
size_t m_nAllocated; // (size_t) size of the allocated buffer
size_t m_nDataSize; // (size_t) amount of valid data in dwords
};
} // namespace UMC
#endif // __UMC_AVS_DEC_MEMORY_PIECE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -