webrtc/modules/audio_coding/acm2/acm_resampler.h
Tommi 5d3e6805f2 Add audio view classes
From the new header file:
* MonoView<>: A single channel contiguous buffer of samples.
* InterleavedView<>: Channel samples are interleaved (side-by-side) in
  the buffer. A single channel InterleavedView<> is the same thing as a
  MonoView<>
* DeinterleavedView<>: Each channel's samples are contiguous within the
  buffer. Channels can be enumerated and accessing the
  individual channel data is done via MonoView<>.

There are also a few utility functions that offer a unified way to check
the properties regardless of what view type is in use.

Bug: chromium:335805780
Change-Id: I28196f8f4ded4fadc72ee32b62af304c62f4fc47
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349300
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42377}
2024-05-24 18:08:37 +00:00

42 lines
1.2 KiB
C++

/*
* Copyright (c) 2012 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.
*/
#ifndef MODULES_AUDIO_CODING_ACM2_ACM_RESAMPLER_H_
#define MODULES_AUDIO_CODING_ACM2_ACM_RESAMPLER_H_
#include <stddef.h>
#include <stdint.h>
#include "common_audio/resampler/include/push_resampler.h"
namespace webrtc {
namespace acm2 {
class ACMResampler {
public:
ACMResampler();
~ACMResampler();
// TODO: b/335805780 - Change to accept InterleavedView<>.
int Resample10Msec(const int16_t* in_audio,
int in_freq_hz,
int out_freq_hz,
size_t num_audio_channels,
size_t out_capacity_samples,
int16_t* out_audio);
private:
PushResampler<int16_t> resampler_;
};
} // namespace acm2
} // namespace webrtc
#endif // MODULES_AUDIO_CODING_ACM2_ACM_RESAMPLER_H_