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

Side by Side Diff: webrtc/modules/audio_coding/neteq/audio_decoder_impl.h

Issue 1345433002: Add RTC_ prefix to contructormagic macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Formatting fix. Created 5 years, 3 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 28 matching lines...) Expand all
39 size_t Channels() const override; 39 size_t Channels() const override;
40 40
41 protected: 41 protected:
42 int DecodeInternal(const uint8_t* encoded, 42 int DecodeInternal(const uint8_t* encoded,
43 size_t encoded_len, 43 size_t encoded_len,
44 int sample_rate_hz, 44 int sample_rate_hz,
45 int16_t* decoded, 45 int16_t* decoded,
46 SpeechType* speech_type) override; 46 SpeechType* speech_type) override;
47 47
48 private: 48 private:
49 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmU); 49 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmU);
50 }; 50 };
51 51
52 class AudioDecoderPcmA : public AudioDecoder { 52 class AudioDecoderPcmA : public AudioDecoder {
53 public: 53 public:
54 AudioDecoderPcmA() {} 54 AudioDecoderPcmA() {}
55 void Reset() override; 55 void Reset() override;
56 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; 56 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
57 size_t Channels() const override; 57 size_t Channels() const override;
58 58
59 protected: 59 protected:
60 int DecodeInternal(const uint8_t* encoded, 60 int DecodeInternal(const uint8_t* encoded,
61 size_t encoded_len, 61 size_t encoded_len,
62 int sample_rate_hz, 62 int sample_rate_hz,
63 int16_t* decoded, 63 int16_t* decoded,
64 SpeechType* speech_type) override; 64 SpeechType* speech_type) override;
65 65
66 private: 66 private:
67 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmA); 67 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmA);
68 }; 68 };
69 69
70 class AudioDecoderPcmUMultiCh : public AudioDecoderPcmU { 70 class AudioDecoderPcmUMultiCh : public AudioDecoderPcmU {
71 public: 71 public:
72 explicit AudioDecoderPcmUMultiCh(size_t channels) 72 explicit AudioDecoderPcmUMultiCh(size_t channels)
73 : AudioDecoderPcmU(), channels_(channels) { 73 : AudioDecoderPcmU(), channels_(channels) {
74 assert(channels > 0); 74 assert(channels > 0);
75 } 75 }
76 size_t Channels() const override; 76 size_t Channels() const override;
77 77
78 private: 78 private:
79 const size_t channels_; 79 const size_t channels_;
80 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmUMultiCh); 80 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmUMultiCh);
81 }; 81 };
82 82
83 class AudioDecoderPcmAMultiCh : public AudioDecoderPcmA { 83 class AudioDecoderPcmAMultiCh : public AudioDecoderPcmA {
84 public: 84 public:
85 explicit AudioDecoderPcmAMultiCh(size_t channels) 85 explicit AudioDecoderPcmAMultiCh(size_t channels)
86 : AudioDecoderPcmA(), channels_(channels) { 86 : AudioDecoderPcmA(), channels_(channels) {
87 assert(channels > 0); 87 assert(channels > 0);
88 } 88 }
89 size_t Channels() const override; 89 size_t Channels() const override;
90 90
91 private: 91 private:
92 const size_t channels_; 92 const size_t channels_;
93 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh); 93 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh);
94 }; 94 };
95 95
96 #ifdef WEBRTC_CODEC_PCM16 96 #ifdef WEBRTC_CODEC_PCM16
97 // This class handles all four types (i.e., sample rates) of PCM16B codecs. 97 // This class handles all four types (i.e., sample rates) of PCM16B codecs.
98 // The type is specified in the constructor parameter |type|. 98 // The type is specified in the constructor parameter |type|.
99 class AudioDecoderPcm16B : public AudioDecoder { 99 class AudioDecoderPcm16B : public AudioDecoder {
100 public: 100 public:
101 AudioDecoderPcm16B(); 101 AudioDecoderPcm16B();
102 void Reset() override; 102 void Reset() override;
103 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; 103 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
104 size_t Channels() const override; 104 size_t Channels() const override;
105 105
106 protected: 106 protected:
107 int DecodeInternal(const uint8_t* encoded, 107 int DecodeInternal(const uint8_t* encoded,
108 size_t encoded_len, 108 size_t encoded_len,
109 int sample_rate_hz, 109 int sample_rate_hz,
110 int16_t* decoded, 110 int16_t* decoded,
111 SpeechType* speech_type) override; 111 SpeechType* speech_type) override;
112 112
113 private: 113 private:
114 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16B); 114 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16B);
115 }; 115 };
116 116
117 // This class handles all four types (i.e., sample rates) of PCM16B codecs. 117 // This class handles all four types (i.e., sample rates) of PCM16B codecs.
118 // The type is specified in the constructor parameter |type|, and the number 118 // The type is specified in the constructor parameter |type|, and the number
119 // of channels is derived from the type. 119 // of channels is derived from the type.
120 class AudioDecoderPcm16BMultiCh : public AudioDecoderPcm16B { 120 class AudioDecoderPcm16BMultiCh : public AudioDecoderPcm16B {
121 public: 121 public:
122 explicit AudioDecoderPcm16BMultiCh(size_t num_channels); 122 explicit AudioDecoderPcm16BMultiCh(size_t num_channels);
123 size_t Channels() const override; 123 size_t Channels() const override;
124 124
125 private: 125 private:
126 const size_t channels_; 126 const size_t channels_;
127 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16BMultiCh); 127 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16BMultiCh);
128 }; 128 };
129 #endif 129 #endif
130 130
131 #ifdef WEBRTC_CODEC_ILBC 131 #ifdef WEBRTC_CODEC_ILBC
132 class AudioDecoderIlbc : public AudioDecoder { 132 class AudioDecoderIlbc : public AudioDecoder {
133 public: 133 public:
134 AudioDecoderIlbc(); 134 AudioDecoderIlbc();
135 ~AudioDecoderIlbc() override; 135 ~AudioDecoderIlbc() override;
136 bool HasDecodePlc() const override; 136 bool HasDecodePlc() const override;
137 size_t DecodePlc(size_t num_frames, int16_t* decoded) override; 137 size_t DecodePlc(size_t num_frames, int16_t* decoded) override;
138 void Reset() override; 138 void Reset() override;
139 size_t Channels() const override; 139 size_t Channels() const override;
140 140
141 protected: 141 protected:
142 int DecodeInternal(const uint8_t* encoded, 142 int DecodeInternal(const uint8_t* encoded,
143 size_t encoded_len, 143 size_t encoded_len,
144 int sample_rate_hz, 144 int sample_rate_hz,
145 int16_t* decoded, 145 int16_t* decoded,
146 SpeechType* speech_type) override; 146 SpeechType* speech_type) override;
147 147
148 private: 148 private:
149 IlbcDecoderInstance* dec_state_; 149 IlbcDecoderInstance* dec_state_;
150 DISALLOW_COPY_AND_ASSIGN(AudioDecoderIlbc); 150 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIlbc);
151 }; 151 };
152 #endif 152 #endif
153 153
154 #ifdef WEBRTC_CODEC_G722 154 #ifdef WEBRTC_CODEC_G722
155 class AudioDecoderG722 : public AudioDecoder { 155 class AudioDecoderG722 : public AudioDecoder {
156 public: 156 public:
157 AudioDecoderG722(); 157 AudioDecoderG722();
158 ~AudioDecoderG722() override; 158 ~AudioDecoderG722() override;
159 bool HasDecodePlc() const override; 159 bool HasDecodePlc() const override;
160 void Reset() override; 160 void Reset() override;
161 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; 161 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
162 size_t Channels() const override; 162 size_t Channels() const override;
163 163
164 protected: 164 protected:
165 int DecodeInternal(const uint8_t* encoded, 165 int DecodeInternal(const uint8_t* encoded,
166 size_t encoded_len, 166 size_t encoded_len,
167 int sample_rate_hz, 167 int sample_rate_hz,
168 int16_t* decoded, 168 int16_t* decoded,
169 SpeechType* speech_type) override; 169 SpeechType* speech_type) override;
170 170
171 private: 171 private:
172 G722DecInst* dec_state_; 172 G722DecInst* dec_state_;
173 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722); 173 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722);
174 }; 174 };
175 175
176 class AudioDecoderG722Stereo : public AudioDecoder { 176 class AudioDecoderG722Stereo : public AudioDecoder {
177 public: 177 public:
178 AudioDecoderG722Stereo(); 178 AudioDecoderG722Stereo();
179 ~AudioDecoderG722Stereo() override; 179 ~AudioDecoderG722Stereo() override;
180 void Reset() override; 180 void Reset() override;
181 181
182 protected: 182 protected:
183 int DecodeInternal(const uint8_t* encoded, 183 int DecodeInternal(const uint8_t* encoded,
184 size_t encoded_len, 184 size_t encoded_len,
185 int sample_rate_hz, 185 int sample_rate_hz,
186 int16_t* decoded, 186 int16_t* decoded,
187 SpeechType* speech_type) override; 187 SpeechType* speech_type) override;
188 size_t Channels() const override; 188 size_t Channels() const override;
189 189
190 private: 190 private:
191 // Splits the stereo-interleaved payload in |encoded| into separate payloads 191 // Splits the stereo-interleaved payload in |encoded| into separate payloads
192 // for left and right channels. The separated payloads are written to 192 // for left and right channels. The separated payloads are written to
193 // |encoded_deinterleaved|, which must hold at least |encoded_len| samples. 193 // |encoded_deinterleaved|, which must hold at least |encoded_len| samples.
194 // The left channel starts at offset 0, while the right channel starts at 194 // The left channel starts at offset 0, while the right channel starts at
195 // offset encoded_len / 2 into |encoded_deinterleaved|. 195 // offset encoded_len / 2 into |encoded_deinterleaved|.
196 void SplitStereoPacket(const uint8_t* encoded, size_t encoded_len, 196 void SplitStereoPacket(const uint8_t* encoded, size_t encoded_len,
197 uint8_t* encoded_deinterleaved); 197 uint8_t* encoded_deinterleaved);
198 198
199 G722DecInst* dec_state_left_; 199 G722DecInst* dec_state_left_;
200 G722DecInst* dec_state_right_; 200 G722DecInst* dec_state_right_;
201 201
202 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo); 202 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo);
203 }; 203 };
204 #endif 204 #endif
205 205
206 // AudioDecoderCng is a special type of AudioDecoder. It inherits from 206 // AudioDecoderCng is a special type of AudioDecoder. It inherits from
207 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods 207 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods
208 // should be used, except constructor, destructor, and accessors. 208 // should be used, except constructor, destructor, and accessors.
209 // TODO(hlundin): Consider the possibility to create a super-class to 209 // TODO(hlundin): Consider the possibility to create a super-class to
210 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a 210 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a
211 // specific CngDecoder class could both inherit from that class. 211 // specific CngDecoder class could both inherit from that class.
212 class AudioDecoderCng : public AudioDecoder { 212 class AudioDecoderCng : public AudioDecoder {
(...skipping 12 matching lines...) Expand all
225 225
226 protected: 226 protected:
227 int DecodeInternal(const uint8_t* encoded, 227 int DecodeInternal(const uint8_t* encoded,
228 size_t encoded_len, 228 size_t encoded_len,
229 int sample_rate_hz, 229 int sample_rate_hz,
230 int16_t* decoded, 230 int16_t* decoded,
231 SpeechType* speech_type) override; 231 SpeechType* speech_type) override;
232 232
233 private: 233 private:
234 CNG_dec_inst* dec_state_; 234 CNG_dec_inst* dec_state_;
235 DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng); 235 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng);
236 }; 236 };
237 237
238 enum NetEqDecoder { 238 enum NetEqDecoder {
239 kDecoderPCMu, 239 kDecoderPCMu,
240 kDecoderPCMa, 240 kDecoderPCMa,
241 kDecoderPCMu_2ch, 241 kDecoderPCMu_2ch,
242 kDecoderPCMa_2ch, 242 kDecoderPCMa_2ch,
243 kDecoderILBC, 243 kDecoderILBC,
244 kDecoderISAC, 244 kDecoderISAC,
245 kDecoderISACswb, 245 kDecoderISACswb,
(...skipping 26 matching lines...) Expand all
272 // Returns the sample rate for |codec_type|. 272 // Returns the sample rate for |codec_type|.
273 int CodecSampleRateHz(NetEqDecoder codec_type); 273 int CodecSampleRateHz(NetEqDecoder codec_type);
274 274
275 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for 275 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for
276 // unsupported codecs, and when creating an AudioDecoder is not applicable 276 // unsupported codecs, and when creating an AudioDecoder is not applicable
277 // (e.g., for RED and DTMF/AVT types). 277 // (e.g., for RED and DTMF/AVT types).
278 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); 278 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type);
279 279
280 } // namespace webrtc 280 } // namespace webrtc
281 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ 281 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/accelerate.h ('k') | webrtc/modules/audio_coding/neteq/audio_multi_vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698