1 /*!
2 * \copy
3 * Copyright (c) 2011-2013, Cisco Systems
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * \file : memory.h
32 *
33 * \brief : memory definition for wels video processor class
34 *
35 * \date : 2011/02/22
36 *
37 * \description :
38 *
39 *************************************************************************************
40 */
41
42 #ifndef WELSVP_MEMORY_H
43 #define WELSVP_MEMORY_H
44
45 #include "util.h"
46 #include "typedef.h"
47
48 WELSVP_NAMESPACE_BEGIN
49
WelsMemset(void * pPointer,int32_t iValue,uint32_t uiSize)50 inline void* WelsMemset (void* pPointer, int32_t iValue, uint32_t uiSize) {
51 return ::memset (pPointer, iValue, uiSize);
52 }
53
WelsMemcpy(void * pDst,const void * kpSrc,uint32_t uiSize)54 inline void* WelsMemcpy (void* pDst, const void* kpSrc, uint32_t uiSize) {
55 return ::memcpy (pDst, kpSrc, uiSize);
56 }
57
WelsMemcmp(const void * kpBuf1,const void * kpBuf2,uint32_t uiSize)58 inline int32_t WelsMemcmp (const void* kpBuf1, const void* kpBuf2, uint32_t uiSize) {
59 return ::memcmp (kpBuf1, kpBuf2, uiSize);
60 }
61
62 /*!
63 *************************************************************************************
64 * \brief malloc with zero filled utilization in Wels
65 *
66 * \param i_size uiSize of memory block required
67 *
68 * \return allocated memory pointer exactly, failed in case of NULL return
69 *
70 * \note N/A
71 *************************************************************************************
72 */
73 void* WelsMalloc (const uint32_t kuiSize, char* pTag = NULL);
74
75 /*!
76 *************************************************************************************
77 * \brief free utilization in Wels
78 *
79 * \param p data pointer to be free.
80 * i.e, uint8_t *p = actual data to be free, argv = &p.
81 *
82 * \return NONE
83 *
84 * \note N/A
85 *************************************************************************************
86 */
87 void WelsFree (void* pPointer, char* pTag = NULL);
88
89 /*!
90 *************************************************************************************
91 * \brief reallocation in Wels. Do nothing and continue using old block
92 * in case the block is large enough currently
93 *
94 * \param p memory block required in old time
95 * \param i_size new uiSize of memory block requested
96 * \param sz_real pointer to the old uiSize of memory block
97 *
98 * \return reallocated memory pointer exactly, failed in case of NULL return
99 *
100 * \note N/A
101 *************************************************************************************
102 */
103 void* WelsRealloc (void* pPointer, uint32_t* pRealSize, const uint32_t kuiSize, char* pTag = NULL);
104
105 //////////////////////////////////////////////////////////////////////////////////////
106 WELSVP_NAMESPACE_END
107
108 #endif
109
110
111