1/******************************************************************************
2*
3* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at:
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17******************************************************************************/
18/**
19 *******************************************************************************
20 * @file
21 *  ihevc_mem_fns.c
22 *
23 * @brief
24 *  Functions used for memory operations
25 *
26 * @author
27 *  Ittiam
28 *
29 * @par List of Functions:
30 *
31 * @remarks
32 *  None
33 *
34 *******************************************************************************
35 */
36
37/*****************************************************************************/
38/* File Includes                                                             */
39/*****************************************************************************/
40#include <stdio.h>
41#include <stddef.h>
42#include <stdlib.h>
43#include <string.h>
44#include <assert.h>
45
46#include "ihevc_typedefs.h"
47#include "ihevc_func_selector.h"
48#include "ihevc_mem_fns.h"
49
50/**
51 *******************************************************************************
52 *
53 * @brief
54 *   memcpy of a 8,16 or 32 bytes
55 *
56 * @par Description:
57 *   Does memcpy of 8bit data from source to destination for 8,16 or 32 number of bytes
58 *
59 * @param[in] pu1_dst
60 *  UWORD8 pointer to the destination
61 *
62 * @param[in] pu1_src
63 *  UWORD8 pointer to the source
64 *
65 * @param[in] num_bytes
66 *  number of bytes to copy
67 * @returns
68 *
69 * @remarks
70 *  None
71 *
72 *******************************************************************************
73 */
74
75void ihevc_memcpy(UWORD8 *pu1_dst, UWORD8 *pu1_src, UWORD32 num_bytes)
76{
77    memcpy(pu1_dst, pu1_src, num_bytes);
78}
79
80
81void ihevc_memcpy_mul_8(UWORD8 *pu1_dst, UWORD8 *pu1_src, UWORD32 num_bytes)
82{
83    memcpy(pu1_dst, pu1_src, num_bytes);
84}
85
86/**
87 *******************************************************************************
88 *
89 * @brief
90 *   memset of a 8,16 or 32 bytes
91 *
92 * @par Description:
93 *   Does memset of 8bit data for 8,16 or 32 number of bytes
94 *
95 * @param[in] pu1_dst
96 *  UWORD8 pointer to the destination
97 *
98 * @param[in] value
99 *  UWORD8 value used for memset
100 *
101 * @param[in] num_bytes
102 *  number of bytes to set
103 * @returns
104 *
105 * @remarks
106 *  None
107 *
108 *******************************************************************************
109 */
110
111void ihevc_memset(UWORD8 *pu1_dst, UWORD8 value, UWORD32 num_bytes)
112{
113    memset(pu1_dst, value, num_bytes);
114}
115
116
117void ihevc_memset_mul_8(UWORD8 *pu1_dst, UWORD8 value, UWORD32 num_bytes)
118{
119    memset(pu1_dst, value, num_bytes);
120}
121
122/**
123 *******************************************************************************
124 *
125 * @brief
126 *   memset of 16bit data of a 8,16 or 32 bytes
127 *
128 * @par Description:
129 *   Does memset of 16bit data for 8,16 or 32 number of bytes
130 *
131 * @param[in] pu2_dst
132 *  UWORD8 pointer to the destination
133 *
134 * @param[in] value
135 *  UWORD16 value used for memset
136 *
137 * @param[in] num_words
138 *  number of words to set
139 * @returns
140 *
141 * @remarks
142 *  None
143 *
144 *******************************************************************************
145 */
146
147void ihevc_memset_16bit(UWORD16 *pu2_dst, UWORD16 value, UWORD32 num_words)
148{
149    UWORD32 i;
150    for(i = 0; i < num_words; i++)
151    {
152        *pu2_dst++ = value;
153    }
154}
155
156
157
158void ihevc_memset_16bit_mul_8(UWORD16 *pu2_dst, UWORD16 value, UWORD32 num_words)
159{
160    UWORD32 i;
161    for(i = 0; i < num_words; i++)
162    {
163        *pu2_dst++ = value;
164    }
165}
166
167