Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: webrtc/modules/audio_processing/audio_buffer.cc

Issue 1862553002: Fix the number of frames used when interleaving in AudioBuffer::InterleaveTo() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebasing Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 for (size_t i = 0; i < num_channels_; ++i) { 424 for (size_t i = 0; i < num_channels_; ++i) {
425 output_resamplers_[i]->Resample( 425 output_resamplers_[i]->Resample(
426 data_->fbuf()->channels()[i], proc_num_frames_, 426 data_->fbuf()->channels()[i], proc_num_frames_,
427 output_buffer_->fbuf()->channels()[i], output_num_frames_); 427 output_buffer_->fbuf()->channels()[i], output_num_frames_);
428 } 428 }
429 data_ptr = output_buffer_.get(); 429 data_ptr = output_buffer_.get();
430 } 430 }
431 431
432 if (frame->num_channels_ == num_channels_) { 432 if (frame->num_channels_ == num_channels_) {
433 Interleave(data_ptr->ibuf()->channels(), proc_num_frames_, num_channels_, 433 Interleave(data_ptr->ibuf()->channels(), output_num_frames_, num_channels_,
434 frame->data_); 434 frame->data_);
435 } else { 435 } else {
436 UpmixMonoToInterleaved(data_ptr->ibuf()->channels()[0], proc_num_frames_, 436 UpmixMonoToInterleaved(data_ptr->ibuf()->channels()[0], output_num_frames_,
437 frame->num_channels_, frame->data_); 437 frame->num_channels_, frame->data_);
438 } 438 }
439 } 439 }
440 440
441 void AudioBuffer::CopyLowPassToReference() { 441 void AudioBuffer::CopyLowPassToReference() {
442 reference_copied_ = true; 442 reference_copied_ = true;
443 if (!low_pass_reference_channels_.get() || 443 if (!low_pass_reference_channels_.get() ||
444 low_pass_reference_channels_->num_channels() != num_channels_) { 444 low_pass_reference_channels_->num_channels() != num_channels_) {
445 low_pass_reference_channels_.reset( 445 low_pass_reference_channels_.reset(
446 new ChannelBuffer<int16_t>(num_split_frames_, 446 new ChannelBuffer<int16_t>(num_split_frames_,
447 num_proc_channels_)); 447 num_proc_channels_));
448 } 448 }
449 for (size_t i = 0; i < num_proc_channels_; i++) { 449 for (size_t i = 0; i < num_proc_channels_; i++) {
450 memcpy(low_pass_reference_channels_->channels()[i], 450 memcpy(low_pass_reference_channels_->channels()[i],
451 split_bands_const(i)[kBand0To8kHz], 451 split_bands_const(i)[kBand0To8kHz],
452 low_pass_reference_channels_->num_frames_per_band() * 452 low_pass_reference_channels_->num_frames_per_band() *
453 sizeof(split_bands_const(i)[kBand0To8kHz][0])); 453 sizeof(split_bands_const(i)[kBand0To8kHz][0]));
454 } 454 }
455 } 455 }
456 456
457 void AudioBuffer::SplitIntoFrequencyBands() { 457 void AudioBuffer::SplitIntoFrequencyBands() {
458 splitting_filter_->Analysis(data_.get(), split_data_.get()); 458 splitting_filter_->Analysis(data_.get(), split_data_.get());
459 } 459 }
460 460
461 void AudioBuffer::MergeFrequencyBands() { 461 void AudioBuffer::MergeFrequencyBands() {
462 splitting_filter_->Synthesis(split_data_.get(), data_.get()); 462 splitting_filter_->Synthesis(split_data_.get(), data_.get());
463 } 463 }
464 464
465 } // namespace webrtc 465 } // namespace webrtc
OLDNEW
« no previous file with comments | « data/audio_processing/output_data_fixed.pb ('k') | webrtc/modules/audio_processing/test/audio_processing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698