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

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

Issue 1168753002: Match existing type usage better. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync 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
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 int16_t WebRtcIsac_Encode(ISACStruct* ISAC_main_inst, 497 int16_t WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
498 const int16_t* speechIn, 498 const int16_t* speechIn,
499 uint8_t* encoded) { 499 uint8_t* encoded) {
500 float inFrame[FRAMESAMPLES_10ms]; 500 float inFrame[FRAMESAMPLES_10ms];
501 int16_t speechInLB[FRAMESAMPLES_10ms]; 501 int16_t speechInLB[FRAMESAMPLES_10ms];
502 int16_t speechInUB[FRAMESAMPLES_10ms]; 502 int16_t speechInUB[FRAMESAMPLES_10ms];
503 int16_t streamLenLB = 0; 503 int16_t streamLenLB = 0;
504 int16_t streamLenUB = 0; 504 int16_t streamLenUB = 0;
505 int16_t streamLen = 0; 505 int16_t streamLen = 0;
506 int16_t k = 0; 506 int16_t k = 0;
507 int garbageLen = 0; 507 uint8_t garbageLen = 0;
508 int32_t bottleneck = 0; 508 int32_t bottleneck = 0;
509 int16_t bottleneckIdx = 0; 509 int16_t bottleneckIdx = 0;
510 int16_t jitterInfo = 0; 510 int16_t jitterInfo = 0;
511 511
512 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; 512 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
513 ISACLBStruct* instLB = &(instISAC->instLB); 513 ISACLBStruct* instLB = &(instISAC->instLB);
514 ISACUBStruct* instUB = &(instISAC->instUB); 514 ISACUBStruct* instUB = &(instISAC->instUB);
515 const int16_t* speech_in_ptr = speechIn; 515 const int16_t* speech_in_ptr = speechIn;
516 int16_t resampled_buff[FRAMESAMPLES_10ms * 2]; 516 int16_t resampled_buff[FRAMESAMPLES_10ms * 2];
517 517
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 if ((streamLenUB > (255 - (LEN_CHECK_SUM_WORD8 + 1))) || 638 if ((streamLenUB > (255 - (LEN_CHECK_SUM_WORD8 + 1))) ||
639 (streamLenUB == -ISAC_PAYLOAD_LARGER_THAN_LIMIT)) { 639 (streamLenUB == -ISAC_PAYLOAD_LARGER_THAN_LIMIT)) {
640 /* We have got a too long bit-stream we skip the upper-band 640 /* We have got a too long bit-stream we skip the upper-band
641 * bit-stream for this frame. */ 641 * bit-stream for this frame. */
642 streamLenUB = 0; 642 streamLenUB = 0;
643 } 643 }
644 644
645 memcpy(encoded, instLB->ISACencLB_obj.bitstr_obj.stream, streamLenLB); 645 memcpy(encoded, instLB->ISACencLB_obj.bitstr_obj.stream, streamLenLB);
646 streamLen = streamLenLB; 646 streamLen = streamLenLB;
647 if (streamLenUB > 0) { 647 if (streamLenUB > 0) {
648 encoded[streamLenLB] = streamLenUB + 1 + LEN_CHECK_SUM_WORD8; 648 encoded[streamLenLB] = (uint8_t)(streamLenUB + 1 + LEN_CHECK_SUM_WORD8);
649 memcpy(&encoded[streamLenLB + 1], 649 memcpy(&encoded[streamLenLB + 1],
650 instUB->ISACencUB_obj.bitstr_obj.stream, 650 instUB->ISACencUB_obj.bitstr_obj.stream,
651 streamLenUB); 651 streamLenUB);
652 streamLen += encoded[streamLenLB]; 652 streamLen += encoded[streamLenLB];
653 } else { 653 } else {
654 encoded[streamLenLB] = 0; 654 encoded[streamLenLB] = 0;
655 } 655 }
656 } else { 656 } else {
657 if (streamLenLB == 0) { 657 if (streamLenLB == 0) {
658 return 0; 658 return 0;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 if ((instISAC->bandwidthKHz == isac8kHz) || 696 if ((instISAC->bandwidthKHz == isac8kHz) ||
697 (streamLenUB == 0)) { 697 (streamLenUB == 0)) {
698 ptrGarbage = &encoded[streamLenLB]; 698 ptrGarbage = &encoded[streamLenLB];
699 limit = streamLen + 255; 699 limit = streamLen + 255;
700 } else { 700 } else {
701 ptrGarbage = &encoded[streamLenLB + 1 + streamLenUB]; 701 ptrGarbage = &encoded[streamLenLB + 1 + streamLenUB];
702 limit = streamLen + (255 - encoded[streamLenLB]); 702 limit = streamLen + (255 - encoded[streamLenLB]);
703 } 703 }
704 minBytes = (minBytes > limit) ? limit : minBytes; 704 minBytes = (minBytes > limit) ? limit : minBytes;
705 705
706 garbageLen = (minBytes > streamLen) ? (minBytes - streamLen) : 0; 706 garbageLen = (minBytes > streamLen) ? (uint8_t)(minBytes - streamLen) : 0;
707 707
708 /* Save data for creation of multiple bit-streams. */ 708 /* Save data for creation of multiple bit-streams. */
709 /* If bit-stream too short then add garbage at the end. */ 709 /* If bit-stream too short then add garbage at the end. */
710 if (garbageLen > 0) { 710 if (garbageLen > 0) {
711 for (k = 0; k < garbageLen; k++) { 711 for (k = 0; k < garbageLen; k++) {
712 ptrGarbage[k] = (uint8_t)(rand() & 0xFF); 712 ptrGarbage[k] = (uint8_t)(rand() & 0xFF);
713 } 713 }
714 /* For a correct length of the upper-band bit-stream together 714 /* For a correct length of the upper-band bit-stream together
715 * with the garbage. Garbage is embeded in upper-band bit-stream. 715 * with the garbage. Garbage is embeded in upper-band bit-stream.
716 * That is the only way to preserve backward compatibility. */ 716 * That is the only way to preserve backward compatibility. */
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 * - ISAC_main_inst : iSAC instance 2368 * - ISAC_main_inst : iSAC instance
2369 * 2369 *
2370 * Return value : sampling rate in Hertz. Decoder output is 2370 * Return value : sampling rate in Hertz. Decoder output is
2371 * sampled at this rate. 2371 * sampled at this rate.
2372 * 2372 *
2373 */ 2373 */
2374 uint16_t WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst) { 2374 uint16_t WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst) {
2375 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; 2375 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
2376 return instISAC->decoderSamplingRateKHz == kIsacWideband ? 16000 : 32000; 2376 return instISAC->decoderSamplingRateKHz == kIsacWideband ? 16000 : 32000;
2377 } 2377 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698