1 /* 2 * Copyright 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef RESAMPLER_POLYPHASE_RESAMPLER_H 18 #define RESAMPLER_POLYPHASE_RESAMPLER_H 19 20 #include <memory> 21 #include <vector> 22 #include <sys/types.h> 23 #include <unistd.h> 24 25 #include "MultiChannelResampler.h" 26 #include "ResamplerDefinitions.h" 27 28 namespace RESAMPLER_OUTER_NAMESPACE::resampler { 29 /** 30 * Resampler that is optimized for a reduced ratio of sample rates. 31 * All of the coefficients for each possible phase value are pre-calculated. 32 */ 33 class PolyphaseResampler : public MultiChannelResampler { 34 public: 35 /** 36 * 37 * @param builder containing lots of parameters 38 */ 39 explicit PolyphaseResampler(const MultiChannelResampler::Builder &builder); 40 41 virtual ~PolyphaseResampler() = default; 42 43 void readFrame(float *frame) override; 44 45 protected: 46 47 int32_t mCoefficientCursor = 0; 48 49 }; 50 51 } /* namespace RESAMPLER_OUTER_NAMESPACE::resampler */ 52 53 #endif //RESAMPLER_POLYPHASE_RESAMPLER_H 54