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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/encode.c

Issue 2274083002: Replace calls to assert() with RTC_DCHECK_*() in .c code (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 4 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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
11 /* 11 /*
12 * encode.c 12 * encode.c
13 * 13 *
14 * Encoding function for the iSAC coder. 14 * Encoding function for the iSAC coder.
15 * 15 *
16 */ 16 */
17 17
18 #include "webrtc/base/checks.h"
18 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h" 19 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h"
19 20
20 #include <assert.h>
21 #include <stdio.h> 21 #include <stdio.h>
22 22
23 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h" 23 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h"
24 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator .h" 24 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator .h"
25 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h" 25 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h"
26 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h " 26 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h "
27 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h" 27 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h"
28 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h" 28 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h"
29 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h " 29 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h "
30 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h" 30 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 MinBytes = usefulstr_len + 255; 448 MinBytes = usefulstr_len + 255;
449 } 449 }
450 450
451 /* Save data for creation of multiple bitstreams */ 451 /* Save data for creation of multiple bitstreams */
452 if (ISACenc_obj->SaveEnc_ptr != NULL) { 452 if (ISACenc_obj->SaveEnc_ptr != NULL) {
453 (ISACenc_obj->SaveEnc_ptr)->minBytes = MinBytes; 453 (ISACenc_obj->SaveEnc_ptr)->minBytes = MinBytes;
454 } 454 }
455 455
456 while (stream_length < MinBytes) 456 while (stream_length < MinBytes)
457 { 457 {
458 assert(stream_length >= 0); 458 RTC_DCHECK_GE(stream_length, 0);
459 if (stream_length & 0x0001){ 459 if (stream_length & 0x0001){
460 ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed ); 460 ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed );
461 ISACenc_obj->bitstr_obj.stream[stream_length / 2] |= 461 ISACenc_obj->bitstr_obj.stream[stream_length / 2] |=
462 (uint16_t)(ISACenc_obj->bitstr_seed & 0xFF); 462 (uint16_t)(ISACenc_obj->bitstr_seed & 0xFF);
463 } else { 463 } else {
464 ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed ); 464 ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed );
465 ISACenc_obj->bitstr_obj.stream[stream_length / 2] = 465 ISACenc_obj->bitstr_obj.stream[stream_length / 2] =
466 ((uint16_t)ISACenc_obj->bitstr_seed << 8); 466 ((uint16_t)ISACenc_obj->bitstr_seed << 8);
467 } 467 }
468 stream_length++; 468 stream_length++;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 if (status < 0) { 626 if (status < 0) {
627 return status; 627 return status;
628 } 628 }
629 } 629 }
630 630
631 /* complete arithmetic coding */ 631 /* complete arithmetic coding */
632 stream_length = WebRtcIsacfix_EncTerminate(&ISACenc_obj->bitstr_obj); 632 stream_length = WebRtcIsacfix_EncTerminate(&ISACenc_obj->bitstr_obj);
633 633
634 return stream_length; 634 return stream_length;
635 } 635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698