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