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

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

Issue 1181073002: Reland "Upconvert various types to int.", neteq portion. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/dsp_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return true; 156 return true;
157 } 157 }
158 158
159 int AudioDecoderIlbc::DecodeInternal(const uint8_t* encoded, 159 int AudioDecoderIlbc::DecodeInternal(const uint8_t* encoded,
160 size_t encoded_len, 160 size_t encoded_len,
161 int sample_rate_hz, 161 int sample_rate_hz,
162 int16_t* decoded, 162 int16_t* decoded,
163 SpeechType* speech_type) { 163 SpeechType* speech_type) {
164 DCHECK_EQ(sample_rate_hz, 8000); 164 DCHECK_EQ(sample_rate_hz, 8000);
165 int16_t temp_type = 1; // Default is speech. 165 int16_t temp_type = 1; // Default is speech.
166 int16_t ret = WebRtcIlbcfix_Decode(dec_state_, encoded, 166 int ret = WebRtcIlbcfix_Decode(dec_state_, encoded,
167 static_cast<int16_t>(encoded_len), decoded, 167 static_cast<int16_t>(encoded_len), decoded,
168 &temp_type); 168 &temp_type);
169 *speech_type = ConvertSpeechType(temp_type); 169 *speech_type = ConvertSpeechType(temp_type);
170 return ret; 170 return ret;
171 } 171 }
172 172
173 int AudioDecoderIlbc::DecodePlc(int num_frames, int16_t* decoded) { 173 int AudioDecoderIlbc::DecodePlc(int num_frames, int16_t* decoded) {
174 return WebRtcIlbcfix_NetEqPlc(dec_state_, decoded, num_frames); 174 return WebRtcIlbcfix_NetEqPlc(dec_state_, decoded, num_frames);
175 } 175 }
176 176
177 int AudioDecoderIlbc::Init() { 177 int AudioDecoderIlbc::Init() {
178 return WebRtcIlbcfix_Decoderinit30Ms(dec_state_); 178 return WebRtcIlbcfix_Decoderinit30Ms(dec_state_);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 WebRtcOpus_DecoderFree(dec_state_); 323 WebRtcOpus_DecoderFree(dec_state_);
324 } 324 }
325 325
326 int AudioDecoderOpus::DecodeInternal(const uint8_t* encoded, 326 int AudioDecoderOpus::DecodeInternal(const uint8_t* encoded,
327 size_t encoded_len, 327 size_t encoded_len,
328 int sample_rate_hz, 328 int sample_rate_hz,
329 int16_t* decoded, 329 int16_t* decoded,
330 SpeechType* speech_type) { 330 SpeechType* speech_type) {
331 DCHECK_EQ(sample_rate_hz, 48000); 331 DCHECK_EQ(sample_rate_hz, 48000);
332 int16_t temp_type = 1; // Default is speech. 332 int16_t temp_type = 1; // Default is speech.
333 int16_t ret = WebRtcOpus_Decode(dec_state_, encoded, 333 int ret = WebRtcOpus_Decode(dec_state_, encoded,
334 static_cast<int16_t>(encoded_len), decoded, 334 static_cast<int16_t>(encoded_len), decoded,
335 &temp_type); 335 &temp_type);
336 if (ret > 0) 336 if (ret > 0)
337 ret *= static_cast<int16_t>(channels_); // Return total number of samples. 337 ret *= static_cast<int>(channels_); // Return total number of samples.
338 *speech_type = ConvertSpeechType(temp_type); 338 *speech_type = ConvertSpeechType(temp_type);
339 return ret; 339 return ret;
340 } 340 }
341 341
342 int AudioDecoderOpus::DecodeRedundantInternal(const uint8_t* encoded, 342 int AudioDecoderOpus::DecodeRedundantInternal(const uint8_t* encoded,
343 size_t encoded_len, 343 size_t encoded_len,
344 int sample_rate_hz, 344 int sample_rate_hz,
345 int16_t* decoded, 345 int16_t* decoded,
346 SpeechType* speech_type) { 346 SpeechType* speech_type) {
347 if (!PacketHasFec(encoded, encoded_len)) { 347 if (!PacketHasFec(encoded, encoded_len)) {
348 // This packet is a RED packet. 348 // This packet is a RED packet.
349 return DecodeInternal(encoded, encoded_len, sample_rate_hz, decoded, 349 return DecodeInternal(encoded, encoded_len, sample_rate_hz, decoded,
350 speech_type); 350 speech_type);
351 } 351 }
352 352
353 DCHECK_EQ(sample_rate_hz, 48000); 353 DCHECK_EQ(sample_rate_hz, 48000);
354 int16_t temp_type = 1; // Default is speech. 354 int16_t temp_type = 1; // Default is speech.
355 int16_t ret = WebRtcOpus_DecodeFec(dec_state_, encoded, 355 int ret = WebRtcOpus_DecodeFec(dec_state_, encoded,
356 static_cast<int16_t>(encoded_len), decoded, 356 static_cast<int16_t>(encoded_len), decoded,
357 &temp_type); 357 &temp_type);
358 if (ret > 0) 358 if (ret > 0)
359 ret *= static_cast<int16_t>(channels_); // Return total number of samples. 359 ret *= static_cast<int>(channels_); // Return total number of samples.
360 *speech_type = ConvertSpeechType(temp_type); 360 *speech_type = ConvertSpeechType(temp_type);
361 return ret; 361 return ret;
362 } 362 }
363 363
364 int AudioDecoderOpus::Init() { 364 int AudioDecoderOpus::Init() {
365 return WebRtcOpus_DecoderInit(dec_state_); 365 return WebRtcOpus_DecoderInit(dec_state_);
366 } 366 }
367 367
368 int AudioDecoderOpus::PacketDuration(const uint8_t* encoded, 368 int AudioDecoderOpus::PacketDuration(const uint8_t* encoded,
369 size_t encoded_len) const { 369 size_t encoded_len) const {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 case kDecoderRED: 612 case kDecoderRED:
613 case kDecoderAVT: 613 case kDecoderAVT:
614 case kDecoderArbitrary: 614 case kDecoderArbitrary:
615 default: { 615 default: {
616 return NULL; 616 return NULL;
617 } 617 }
618 } 618 }
619 } 619 }
620 620
621 } // namespace webrtc 621 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/dsp_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698