/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /* * This file contains the resampling functions for 22 kHz. * The description header can be found in signal_processing_library.h * */ #include "common_audio/signal_processing/include/signal_processing_library.h" #include "common_audio/signal_processing/resample_by_2_internal.h" // Declaration of internally used functions static void WebRtcSpl_32khzTo22khzIntToShort(const int32_t *In, int16_t *Out, int32_t K); void WebRtcSpl_32khzTo22khzIntToInt(const int32_t *In, int32_t *Out, int32_t K); // interpolation coefficients static const int16_t kCoefficients32To22[5][9] = …; ////////////////////// // 22 kHz -> 16 kHz // ////////////////////// // number of subblocks; options: 1, 2, 4, 5, 10 #define SUB_BLOCKS_22_16 … // 22 -> 16 resampler void WebRtcSpl_Resample22khzTo16khz(const int16_t* in, int16_t* out, WebRtcSpl_State22khzTo16khz* state, int32_t* tmpmem) { … } // initialize state of 22 -> 16 resampler void WebRtcSpl_ResetResample22khzTo16khz(WebRtcSpl_State22khzTo16khz* state) { … } ////////////////////// // 16 kHz -> 22 kHz // ////////////////////// // number of subblocks; options: 1, 2, 4, 5, 10 #define SUB_BLOCKS_16_22 … // 16 -> 22 resampler void WebRtcSpl_Resample16khzTo22khz(const int16_t* in, int16_t* out, WebRtcSpl_State16khzTo22khz* state, int32_t* tmpmem) { … } // initialize state of 16 -> 22 resampler void WebRtcSpl_ResetResample16khzTo22khz(WebRtcSpl_State16khzTo22khz* state) { … } ////////////////////// // 22 kHz -> 8 kHz // ////////////////////// // number of subblocks; options: 1, 2, 5, 10 #define SUB_BLOCKS_22_8 … // 22 -> 8 resampler void WebRtcSpl_Resample22khzTo8khz(const int16_t* in, int16_t* out, WebRtcSpl_State22khzTo8khz* state, int32_t* tmpmem) { … } // initialize state of 22 -> 8 resampler void WebRtcSpl_ResetResample22khzTo8khz(WebRtcSpl_State22khzTo8khz* state) { … } ////////////////////// // 8 kHz -> 22 kHz // ////////////////////// // number of subblocks; options: 1, 2, 5, 10 #define SUB_BLOCKS_8_22 … // 8 -> 22 resampler void WebRtcSpl_Resample8khzTo22khz(const int16_t* in, int16_t* out, WebRtcSpl_State8khzTo22khz* state, int32_t* tmpmem) { … } // initialize state of 8 -> 22 resampler void WebRtcSpl_ResetResample8khzTo22khz(WebRtcSpl_State8khzTo22khz* state) { … } // compute two inner-products and store them to output array static void WebRtcSpl_DotProdIntToInt(const int32_t* in1, const int32_t* in2, const int16_t* coef_ptr, int32_t* out1, int32_t* out2) { … } // compute two inner-products and store them to output array static void WebRtcSpl_DotProdIntToShort(const int32_t* in1, const int32_t* in2, const int16_t* coef_ptr, int16_t* out1, int16_t* out2) { … } // Resampling ratio: 11/16 // input: int32_t (normalized, not saturated) :: size 16 * K // output: int32_t (shifted 15 positions to the left, + offset 16384) :: size 11 * K // K: Number of blocks void WebRtcSpl_32khzTo22khzIntToInt(const int32_t* In, int32_t* Out, int32_t K) { … } // Resampling ratio: 11/16 // input: int32_t (normalized, not saturated) :: size 16 * K // output: int16_t (saturated) :: size 11 * K // K: Number of blocks void WebRtcSpl_32khzTo22khzIntToShort(const int32_t *In, int16_t *Out, int32_t K) { … }