1 /* 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 12 /* 13 * This file contains the implementation of functions 14 * WebRtcSpl_MemSetW16() 15 * WebRtcSpl_MemSetW32() 16 * WebRtcSpl_MemCpyReversedOrder() 17 * WebRtcSpl_CopyFromEndW16() 18 * WebRtcSpl_ZerosArrayW16() 19 * WebRtcSpl_ZerosArrayW32() 20 * 21 * The description header can be found in signal_processing_library.h 22 * 23 */ 24 25 #include <string.h> 26 #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" 27 28 29 void WebRtcSpl_MemSetW16(int16_t *ptr, int16_t set_value, int length) 30 { 31 int j; 32 int16_t *arrptr = ptr; 33 34 for (j = length; j > 0; j--) 35 { 36 *arrptr++ = set_value; 37 } 38 } 39 40 void WebRtcSpl_MemSetW32(int32_t *ptr, int32_t set_value, int length) 41 { 42 int j; 43 int32_t *arrptr = ptr; 44 45 for (j = length; j > 0; j--) 46 { 47 *arrptr++ = set_value; 48 } 49 } 50 51 void WebRtcSpl_MemCpyReversedOrder(int16_t* dest, int16_t* source, int length) 52 { 53 int j; 54 int16_t* destPtr = dest; 55 int16_t* sourcePtr = source; 56 57 for (j = 0; j < length; j++) 58 { 59 *destPtr-- = *sourcePtr++; 60 } 61 } 62 63 void WebRtcSpl_CopyFromEndW16(const int16_t *vector_in, 64 int length, 65 int samples, 66 int16_t *vector_out) 67 { 68 // Copy the last <samples> of the input vector to vector_out 69 WEBRTC_SPL_MEMCPY_W16(vector_out, &vector_in[length - samples], samples); 70 } 71 72 void WebRtcSpl_ZerosArrayW16(int16_t *vector, int length) 73 { 74 WebRtcSpl_MemSetW16(vector, 0, length); 75 } 76 77 void WebRtcSpl_ZerosArrayW32(int32_t *vector, int length) 78 { 79 WebRtcSpl_MemSetW32(vector, 0, length); 80 } 81