• Home
  • Raw
  • Download

Lines Matching refs:frame

75 int AudioFrameOperations::MonoToStereo(AudioFrame* frame) {  in MonoToStereo()  argument
76 if (frame->num_channels_ != 1) { in MonoToStereo()
79 UpmixChannels(2, frame); in MonoToStereo()
83 int AudioFrameOperations::StereoToMono(AudioFrame* frame) { in StereoToMono() argument
84 if (frame->num_channels_ != 2) { in StereoToMono()
87 DownmixChannels(1, frame); in StereoToMono()
88 return frame->num_channels_ == 1 ? 0 : -1; in StereoToMono()
103 int AudioFrameOperations::QuadToStereo(AudioFrame* frame) { in QuadToStereo() argument
104 if (frame->num_channels_ != 4) { in QuadToStereo()
108 RTC_DCHECK_LE(frame->samples_per_channel_ * 4, in QuadToStereo()
111 if (!frame->muted()) { in QuadToStereo()
112 QuadToStereo(frame->data(), frame->samples_per_channel_, in QuadToStereo()
113 frame->mutable_data()); in QuadToStereo()
115 frame->num_channels_ = 2; in QuadToStereo()
139 AudioFrame* frame) { in DownmixChannels() argument
140 RTC_DCHECK_LE(frame->samples_per_channel_ * frame->num_channels_, in DownmixChannels()
142 if (frame->num_channels_ > 1 && dst_channels == 1) { in DownmixChannels()
143 if (!frame->muted()) { in DownmixChannels()
144 DownmixInterleavedToMono(frame->data(), frame->samples_per_channel_, in DownmixChannels()
145 frame->num_channels_, frame->mutable_data()); in DownmixChannels()
147 frame->num_channels_ = 1; in DownmixChannels()
148 } else if (frame->num_channels_ == 4 && dst_channels == 2) { in DownmixChannels()
149 int err = QuadToStereo(frame); in DownmixChannels()
152 RTC_NOTREACHED() << "src_channels: " << frame->num_channels_ in DownmixChannels()
158 AudioFrame* frame) { in UpmixChannels() argument
159 RTC_DCHECK_EQ(frame->num_channels_, 1); in UpmixChannels()
160 RTC_DCHECK_LE(frame->samples_per_channel_ * target_number_of_channels, in UpmixChannels()
163 if (frame->num_channels_ != 1 || in UpmixChannels()
164 frame->samples_per_channel_ * target_number_of_channels > in UpmixChannels()
169 if (!frame->muted()) { in UpmixChannels()
172 for (int i = frame->samples_per_channel_ - 1; i >= 0; i--) { in UpmixChannels()
174 frame->mutable_data()[target_number_of_channels * i + j] = in UpmixChannels()
175 frame->data()[i]; in UpmixChannels()
179 frame->num_channels_ = target_number_of_channels; in UpmixChannels()
182 void AudioFrameOperations::SwapStereoChannels(AudioFrame* frame) { in SwapStereoChannels() argument
183 RTC_DCHECK(frame); in SwapStereoChannels()
184 if (frame->num_channels_ != 2 || frame->muted()) { in SwapStereoChannels()
188 int16_t* frame_data = frame->mutable_data(); in SwapStereoChannels()
189 for (size_t i = 0; i < frame->samples_per_channel_ * 2; i += 2) { in SwapStereoChannels()
194 void AudioFrameOperations::Mute(AudioFrame* frame, in Mute() argument
197 RTC_DCHECK(frame); in Mute()
202 size_t total_samples = frame->samples_per_channel_ * frame->num_channels_; in Mute()
204 frame->Mute(); in Mute()
207 if (frame->muted()) { in Mute()
214 if (frame->samples_per_channel_ < kMuteFadeFrames) { in Mute()
215 count = frame->samples_per_channel_; in Mute()
227 start = frame->samples_per_channel_ - count; in Mute()
228 end = frame->samples_per_channel_; in Mute()
237 int16_t* frame_data = frame->mutable_data(); in Mute()
238 size_t channels = frame->num_channels_; in Mute()
249 void AudioFrameOperations::Mute(AudioFrame* frame) { in Mute() argument
250 Mute(frame, true, true); in Mute()
253 void AudioFrameOperations::ApplyHalfGain(AudioFrame* frame) { in ApplyHalfGain() argument
254 RTC_DCHECK(frame); in ApplyHalfGain()
255 RTC_DCHECK_GT(frame->num_channels_, 0); in ApplyHalfGain()
256 if (frame->num_channels_ < 1 || frame->muted()) { in ApplyHalfGain()
260 int16_t* frame_data = frame->mutable_data(); in ApplyHalfGain()
261 for (size_t i = 0; i < frame->samples_per_channel_ * frame->num_channels_; in ApplyHalfGain()
267 int AudioFrameOperations::Scale(float left, float right, AudioFrame* frame) { in Scale() argument
268 if (frame->num_channels_ != 2) { in Scale()
270 } else if (frame->muted()) { in Scale()
274 int16_t* frame_data = frame->mutable_data(); in Scale()
275 for (size_t i = 0; i < frame->samples_per_channel_; i++) { in Scale()
282 int AudioFrameOperations::ScaleWithSat(float scale, AudioFrame* frame) { in ScaleWithSat() argument
283 if (frame->muted()) { in ScaleWithSat()
287 int16_t* frame_data = frame->mutable_data(); in ScaleWithSat()
288 for (size_t i = 0; i < frame->samples_per_channel_ * frame->num_channels_; in ScaleWithSat()