| OLD | NEW |
| 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 |
| 11 // ReleaseTest-API.cpp : Defines the entry point for the console application. | 11 // ReleaseTest-API.cpp : Defines the entry point for the console application. |
| 12 // | 12 // |
| 13 | 13 |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 #include <string.h> | 16 #include <string.h> |
| 17 #include <time.h> | 17 #include <time.h> |
| 18 #include <ctype.h> | 18 #include <ctype.h> |
| 19 #include <iostream> | 19 #include <iostream> |
| 20 | 20 |
| 21 /* include API */ | 21 /* include API */ |
| 22 #include "isac.h" | 22 #include "isac.h" |
| 23 #include "utility.h" | 23 #include "utility.h" |
| 24 #include "webrtc/base/format_macros.h" |
| 24 | 25 |
| 25 /* Defines */ | 26 /* Defines */ |
| 26 #define SEED_FILE "randseed.txt" /* Used when running decoder on garbage data */ | 27 #define SEED_FILE "randseed.txt" /* Used when running decoder on garbage data */ |
| 27 #define MAX_FRAMESAMPLES 960 /* max number of samples per frame | 28 #define MAX_FRAMESAMPLES 960 /* max number of samples per frame |
| 28 (= 60 ms frame & 16 kHz) or | 29 (= 60 ms frame & 16 kHz) or |
| 29 (= 30 ms frame & 32 kHz) */ | 30 (= 30 ms frame & 32 kHz) */ |
| 30 #define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */ | 31 #define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */ |
| 31 #define SWBFRAMESAMPLES_10ms 320 | 32 #define SWBFRAMESAMPLES_10ms 320 |
| 32 //#define FS 16000 /* sampling frequency (Hz) */ | 33 //#define FS 16000 /* sampling frequency (Hz) */ |
| 33 | 34 |
| 34 #ifdef WIN32 | 35 #ifdef WIN32 |
| 35 #define CLOCKS_PER_SEC 1000 /* Runtime statistics */ | 36 #define CLOCKS_PER_SEC 1000 /* Runtime statistics */ |
| 36 #endif | 37 #endif |
| 37 | 38 |
| 38 using namespace std; | 39 using namespace std; |
| 39 | 40 |
| 40 int main(int argc, char* argv[]) { | 41 int main(int argc, char* argv[]) { |
| 41 char inname[100], outname[100], bottleneck_file[100], vadfile[100]; | 42 char inname[100], outname[100], bottleneck_file[100], vadfile[100]; |
| 42 FILE* inp, *outp, * f_bn = NULL, * vadp = NULL, *bandwidthp; | 43 FILE* inp, *outp, * f_bn = NULL, * vadp = NULL, *bandwidthp; |
| 43 int framecnt, endfile; | 44 int framecnt, endfile; |
| 44 | 45 |
| 45 int i, errtype, VADusage = 0, packetLossPercent = 0; | 46 size_t i; |
| 47 int errtype, VADusage = 0, packetLossPercent = 0; |
| 46 int16_t CodingMode; | 48 int16_t CodingMode; |
| 47 int32_t bottleneck = 0; | 49 int32_t bottleneck = 0; |
| 48 int framesize = 30; /* ms */ | 50 int framesize = 30; /* ms */ |
| 49 int cur_framesmpls, err; | 51 int cur_framesmpls, err; |
| 50 | 52 |
| 51 /* Runtime statistics */ | 53 /* Runtime statistics */ |
| 52 double starttime, runtime, length_file; | 54 double starttime, runtime, length_file; |
| 53 | 55 |
| 54 int16_t stream_len = 0; | 56 size_t stream_len = 0; |
| 55 int declen = 0, declenTC = 0; | 57 int declen = 0, declenTC = 0; |
| 56 bool lostFrame = false; | 58 bool lostFrame = false; |
| 57 | 59 |
| 58 int16_t shortdata[SWBFRAMESAMPLES_10ms]; | 60 int16_t shortdata[SWBFRAMESAMPLES_10ms]; |
| 59 int16_t vaddata[SWBFRAMESAMPLES_10ms * 3]; | 61 int16_t vaddata[SWBFRAMESAMPLES_10ms * 3]; |
| 60 int16_t decoded[MAX_FRAMESAMPLES << 1]; | 62 int16_t decoded[MAX_FRAMESAMPLES << 1]; |
| 61 int16_t decodedTC[MAX_FRAMESAMPLES << 1]; | 63 int16_t decodedTC[MAX_FRAMESAMPLES << 1]; |
| 62 uint16_t streamdata[500]; | 64 uint16_t streamdata[500]; |
| 63 int16_t speechType[1]; | 65 int16_t speechType[1]; |
| 64 int16_t rateBPS = 0; | 66 int16_t rateBPS = 0; |
| 65 int16_t fixedFL = 0; | 67 int16_t fixedFL = 0; |
| 66 int16_t payloadSize = 0; | 68 int16_t payloadSize = 0; |
| 67 int32_t payloadRate = 0; | 69 int32_t payloadRate = 0; |
| 68 int setControlBWE = 0; | 70 int setControlBWE = 0; |
| 69 short FL, testNum; | 71 short FL, testNum; |
| 70 char version_number[20]; | 72 char version_number[20]; |
| 71 FILE* plFile; | 73 FILE* plFile; |
| 72 int32_t sendBN; | 74 int32_t sendBN; |
| 73 | 75 |
| 74 #ifdef _DEBUG | 76 #ifdef _DEBUG |
| 75 FILE* fy; | 77 FILE* fy; |
| 76 double kbps; | 78 double kbps; |
| 77 #endif /* _DEBUG */ | 79 #endif /* _DEBUG */ |
| 78 int totalbits = 0; | 80 size_t totalbits = 0; |
| 79 int totalsmpls = 0; | 81 int totalsmpls = 0; |
| 80 | 82 |
| 81 /* If use GNS file */ | 83 /* If use GNS file */ |
| 82 FILE* fp_gns = NULL; | 84 FILE* fp_gns = NULL; |
| 83 char gns_file[100]; | 85 char gns_file[100]; |
| 84 short maxStreamLen30 = 0; | 86 size_t maxStreamLen30 = 0; |
| 85 short maxStreamLen60 = 0; | 87 size_t maxStreamLen60 = 0; |
| 86 short sampFreqKHz = 32; | 88 short sampFreqKHz = 32; |
| 87 short samplesIn10Ms; | 89 short samplesIn10Ms; |
| 88 short useAssign = 0; | 90 short useAssign = 0; |
| 89 // FILE logFile; | 91 // FILE logFile; |
| 90 bool doTransCoding = false; | 92 bool doTransCoding = false; |
| 91 int32_t rateTransCoding = 0; | 93 int32_t rateTransCoding = 0; |
| 92 uint8_t streamDataTransCoding[1200]; | 94 uint8_t streamDataTransCoding[1200]; |
| 93 int16_t streamLenTransCoding = 0; | 95 size_t streamLenTransCoding = 0; |
| 94 FILE* transCodingFile = NULL; | 96 FILE* transCodingFile = NULL; |
| 95 FILE* transcodingBitstream = NULL; | 97 FILE* transcodingBitstream = NULL; |
| 96 uint32_t numTransCodingBytes = 0; | 98 size_t numTransCodingBytes = 0; |
| 97 | 99 |
| 98 /* only one structure used for ISAC encoder */ | 100 /* only one structure used for ISAC encoder */ |
| 99 ISACStruct* ISAC_main_inst = NULL; | 101 ISACStruct* ISAC_main_inst = NULL; |
| 100 ISACStruct* decoderTransCoding = NULL; | 102 ISACStruct* decoderTransCoding = NULL; |
| 101 | 103 |
| 102 BottleNeckModel BN_data; | 104 BottleNeckModel BN_data; |
| 103 | 105 |
| 104 #ifdef _DEBUG | 106 #ifdef _DEBUG |
| 105 fy = fopen("bit_rate.dat", "w"); | 107 fy = fopen("bit_rate.dat", "w"); |
| 106 fclose(fy); | 108 fclose(fy); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 printf("iSAC version %s \n\n", version_number); | 180 printf("iSAC version %s \n\n", version_number); |
| 179 | 181 |
| 180 /* Loop over all command line arguments */ | 182 /* Loop over all command line arguments */ |
| 181 CodingMode = 0; | 183 CodingMode = 0; |
| 182 testNum = 0; | 184 testNum = 0; |
| 183 useAssign = 0; | 185 useAssign = 0; |
| 184 // logFile = NULL; | 186 // logFile = NULL; |
| 185 char transCodingFileName[500]; | 187 char transCodingFileName[500]; |
| 186 int16_t totFileLoop = 0; | 188 int16_t totFileLoop = 0; |
| 187 int16_t numFileLoop = 0; | 189 int16_t numFileLoop = 0; |
| 188 for (i = 1; i + 2 < argc; i++) { | 190 for (i = 1; i + 2 < static_cast<size_t>(argc); i++) { |
| 189 if (!strcmp("-LOOP", argv[i])) { | 191 if (!strcmp("-LOOP", argv[i])) { |
| 190 i++; | 192 i++; |
| 191 totFileLoop = (int16_t)atol(argv[i]); | 193 totFileLoop = (int16_t)atol(argv[i]); |
| 192 if (totFileLoop <= 0) { | 194 if (totFileLoop <= 0) { |
| 193 fprintf(stderr, "Invalid number of runs for the given input file, %d.", | 195 fprintf(stderr, "Invalid number of runs for the given input file, %d.", |
| 194 totFileLoop); | 196 totFileLoop); |
| 195 exit(0); | 197 exit(0); |
| 196 } | 198 } |
| 197 } | 199 } |
| 198 | 200 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 /* Error check */ | 574 /* Error check */ |
| 573 if (err < 0) { | 575 if (err < 0) { |
| 574 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); | 576 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); |
| 575 printf("\n\n Error in decoderinit: %d.\n\n", errtype); | 577 printf("\n\n Error in decoderinit: %d.\n\n", errtype); |
| 576 cout << flush; | 578 cout << flush; |
| 577 } | 579 } |
| 578 } | 580 } |
| 579 | 581 |
| 580 cur_framesmpls = 0; | 582 cur_framesmpls = 0; |
| 581 while (1) { | 583 while (1) { |
| 584 int stream_len_int = 0; |
| 585 |
| 582 /* Read 10 ms speech block */ | 586 /* Read 10 ms speech block */ |
| 583 endfile = readframe(shortdata, inp, samplesIn10Ms); | 587 endfile = readframe(shortdata, inp, samplesIn10Ms); |
| 584 | 588 |
| 585 if (endfile) { | 589 if (endfile) { |
| 586 numFileLoop++; | 590 numFileLoop++; |
| 587 if (numFileLoop < totFileLoop) { | 591 if (numFileLoop < totFileLoop) { |
| 588 rewind(inp); | 592 rewind(inp); |
| 589 framecnt = 0; | 593 framecnt = 0; |
| 590 fprintf(stderr, "\n"); | 594 fprintf(stderr, "\n"); |
| 591 endfile = readframe(shortdata, inp, samplesIn10Ms); | 595 endfile = readframe(shortdata, inp, samplesIn10Ms); |
| 592 } | 596 } |
| 593 } | 597 } |
| 594 | 598 |
| 595 if (testNum == 7) { | 599 if (testNum == 7) { |
| 596 srand((unsigned int)time(NULL)); | 600 srand((unsigned int)time(NULL)); |
| 597 } | 601 } |
| 598 | 602 |
| 599 /* iSAC encoding */ | 603 /* iSAC encoding */ |
| 600 if (!(testNum == 3 && framecnt == 0)) { | 604 if (!(testNum == 3 && framecnt == 0)) { |
| 601 stream_len = | 605 stream_len_int = |
| 602 WebRtcIsac_Encode(ISAC_main_inst, shortdata, (uint8_t*)streamdata); | 606 WebRtcIsac_Encode(ISAC_main_inst, shortdata, (uint8_t*)streamdata); |
| 603 if ((payloadSize != 0) && (stream_len > payloadSize)) { | 607 if ((payloadSize != 0) && (stream_len_int > payloadSize)) { |
| 604 if (testNum == 0) { | 608 if (testNum == 0) { |
| 605 printf("\n\n"); | 609 printf("\n\n"); |
| 606 } | 610 } |
| 607 | 611 |
| 608 printf("\nError: Streamsize out of range %d\n", | 612 printf("\nError: Streamsize out of range %d\n", |
| 609 stream_len - payloadSize); | 613 stream_len_int - payloadSize); |
| 610 cout << flush; | 614 cout << flush; |
| 611 } | 615 } |
| 612 | 616 |
| 613 WebRtcIsac_GetUplinkBw(ISAC_main_inst, &sendBN); | 617 WebRtcIsac_GetUplinkBw(ISAC_main_inst, &sendBN); |
| 614 | 618 |
| 615 if (stream_len > 0) { | 619 if (stream_len_int > 0) { |
| 616 if (doTransCoding) { | 620 if (doTransCoding) { |
| 617 int16_t indexStream; | 621 int16_t indexStream; |
| 618 uint8_t auxUW8; | 622 uint8_t auxUW8; |
| 619 | 623 |
| 620 /******************** Main Transcoding stream ********************/ | 624 /******************** Main Transcoding stream ********************/ |
| 621 WebRtcIsac_GetDownLinkBwIndex(ISAC_main_inst, &bnIdxTC, | 625 WebRtcIsac_GetDownLinkBwIndex(ISAC_main_inst, &bnIdxTC, |
| 622 &jitterInfoTC); | 626 &jitterInfoTC); |
| 623 streamLenTransCoding = WebRtcIsac_GetNewBitStream( | 627 int streamLenTransCoding_int = WebRtcIsac_GetNewBitStream( |
| 624 ISAC_main_inst, bnIdxTC, jitterInfoTC, rateTransCoding, | 628 ISAC_main_inst, bnIdxTC, jitterInfoTC, rateTransCoding, |
| 625 streamDataTransCoding, false); | 629 streamDataTransCoding, false); |
| 626 if (streamLenTransCoding < 0) { | 630 if (streamLenTransCoding_int < 0) { |
| 627 fprintf(stderr, "Error in trans-coding\n"); | 631 fprintf(stderr, "Error in trans-coding\n"); |
| 628 exit(0); | 632 exit(0); |
| 629 } | 633 } |
| 634 streamLenTransCoding = |
| 635 static_cast<size_t>(streamLenTransCoding_int); |
| 630 auxUW8 = (uint8_t)(((streamLenTransCoding & 0xFF00) >> 8) & 0x00FF); | 636 auxUW8 = (uint8_t)(((streamLenTransCoding & 0xFF00) >> 8) & 0x00FF); |
| 631 if (fwrite(&auxUW8, sizeof(uint8_t), 1, transcodingBitstream) != | 637 if (fwrite(&auxUW8, sizeof(uint8_t), 1, transcodingBitstream) != |
| 632 1) { | 638 1) { |
| 633 return -1; | 639 return -1; |
| 634 } | 640 } |
| 635 | 641 |
| 636 auxUW8 = (uint8_t)(streamLenTransCoding & 0x00FF); | 642 auxUW8 = (uint8_t)(streamLenTransCoding & 0x00FF); |
| 637 if (fwrite(&auxUW8, sizeof(uint8_t), 1, transcodingBitstream) != | 643 if (fwrite(&auxUW8, sizeof(uint8_t), 1, transcodingBitstream) != |
| 638 1) { | 644 1) { |
| 639 return -1; | 645 return -1; |
| 640 } | 646 } |
| 641 | 647 |
| 642 if (fwrite(streamDataTransCoding, sizeof(uint8_t), | 648 if (fwrite(streamDataTransCoding, sizeof(uint8_t), |
| 643 streamLenTransCoding, transcodingBitstream) != | 649 streamLenTransCoding, transcodingBitstream) != |
| 644 static_cast<size_t>(streamLenTransCoding)) { | 650 streamLenTransCoding) { |
| 645 return -1; | 651 return -1; |
| 646 } | 652 } |
| 647 | 653 |
| 648 WebRtcIsac_ReadBwIndex(streamDataTransCoding, &indexStream); | 654 WebRtcIsac_ReadBwIndex(streamDataTransCoding, &indexStream); |
| 649 if (indexStream != bnIdxTC) { | 655 if (indexStream != bnIdxTC) { |
| 650 fprintf(stderr, | 656 fprintf(stderr, |
| 651 "Error in inserting Bandwidth index into transcoding " | 657 "Error in inserting Bandwidth index into transcoding " |
| 652 "stream.\n"); | 658 "stream.\n"); |
| 653 exit(0); | 659 exit(0); |
| 654 } | 660 } |
| 655 numTransCodingBytes += streamLenTransCoding; | 661 numTransCodingBytes += streamLenTransCoding; |
| 656 } | 662 } |
| 657 } | 663 } |
| 658 } else { | 664 } else { |
| 659 break; | 665 break; |
| 660 } | 666 } |
| 661 | 667 |
| 662 if (stream_len < 0) { | 668 if (stream_len_int < 0) { |
| 663 /* exit if returned with error */ | 669 /* exit if returned with error */ |
| 664 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); | 670 errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); |
| 665 fprintf(stderr, "Error in encoder: %d.\n", errtype); | 671 fprintf(stderr, "Error in encoder: %d.\n", errtype); |
| 666 cout << flush; | 672 cout << flush; |
| 667 exit(0); | 673 exit(0); |
| 668 } | 674 } |
| 675 stream_len = static_cast<size_t>(stream_len_int); |
| 676 |
| 669 cur_framesmpls += samplesIn10Ms; | 677 cur_framesmpls += samplesIn10Ms; |
| 670 /* exit encoder loop if the encoder returned a bitstream */ | 678 /* exit encoder loop if the encoder returned a bitstream */ |
| 671 if (stream_len != 0) | 679 if (stream_len != 0) |
| 672 break; | 680 break; |
| 673 } | 681 } |
| 674 | 682 |
| 675 /* read next bottleneck rate */ | 683 /* read next bottleneck rate */ |
| 676 if (f_bn != NULL) { | 684 if (f_bn != NULL) { |
| 677 if (fscanf(f_bn, "%d", &bottleneck) == EOF) { | 685 if (fscanf(f_bn, "%d", &bottleneck) == EOF) { |
| 678 /* Set pointer to beginning of file */ | 686 /* Set pointer to beginning of file */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 696 } | 704 } |
| 697 | 705 |
| 698 if (!lostFrame) { | 706 if (!lostFrame) { |
| 699 lostFrame = ((rand() % 100) < packetLossPercent); | 707 lostFrame = ((rand() % 100) < packetLossPercent); |
| 700 } else { | 708 } else { |
| 701 lostFrame = false; | 709 lostFrame = false; |
| 702 } | 710 } |
| 703 | 711 |
| 704 // RED. | 712 // RED. |
| 705 if (lostFrame) { | 713 if (lostFrame) { |
| 706 stream_len = WebRtcIsac_GetRedPayload( | 714 int stream_len_int = WebRtcIsac_GetRedPayload( |
| 707 ISAC_main_inst, reinterpret_cast<uint8_t*>(streamdata)); | 715 ISAC_main_inst, reinterpret_cast<uint8_t*>(streamdata)); |
| 716 if (stream_len_int < 0) { |
| 717 fprintf(stderr, "Error getting RED payload\n"); |
| 718 exit(0); |
| 719 } |
| 720 stream_len = static_cast<size_t>(stream_len_int); |
| 708 | 721 |
| 709 if (doTransCoding) { | 722 if (doTransCoding) { |
| 710 streamLenTransCoding = WebRtcIsac_GetNewBitStream( | 723 int streamLenTransCoding_int = WebRtcIsac_GetNewBitStream( |
| 711 ISAC_main_inst, bnIdxTC, jitterInfoTC, rateTransCoding, | 724 ISAC_main_inst, bnIdxTC, jitterInfoTC, rateTransCoding, |
| 712 streamDataTransCoding, true); | 725 streamDataTransCoding, true); |
| 713 if (streamLenTransCoding < 0) { | 726 if (streamLenTransCoding_int < 0) { |
| 714 fprintf(stderr, "Error in RED trans-coding\n"); | 727 fprintf(stderr, "Error in RED trans-coding\n"); |
| 715 exit(0); | 728 exit(0); |
| 716 } | 729 } |
| 730 streamLenTransCoding = |
| 731 static_cast<size_t>(streamLenTransCoding_int); |
| 717 } | 732 } |
| 718 } | 733 } |
| 719 | 734 |
| 720 /* make coded sequence to short be inreasing */ | 735 /* make coded sequence to short be inreasing */ |
| 721 /* the length the decoder expects */ | 736 /* the length the decoder expects */ |
| 722 if (testNum == 4) { | 737 if (testNum == 4) { |
| 723 stream_len += 10; | 738 stream_len += 10; |
| 724 } | 739 } |
| 725 | 740 |
| 726 /* make coded sequence to long be decreasing */ | 741 /* make coded sequence to long be decreasing */ |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 #ifdef _DEBUG | 899 #ifdef _DEBUG |
| 885 kbps = ((double)sampFreqKHz * 1000.) / ((double)cur_framesmpls) * 8.0 * | 900 kbps = ((double)sampFreqKHz * 1000.) / ((double)cur_framesmpls) * 8.0 * |
| 886 stream_len / 1000.0; // kbits/s | 901 stream_len / 1000.0; // kbits/s |
| 887 fy = fopen("bit_rate.dat", "a"); | 902 fy = fopen("bit_rate.dat", "a"); |
| 888 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); | 903 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); |
| 889 fclose(fy); | 904 fclose(fy); |
| 890 | 905 |
| 891 #endif /* _DEBUG */ | 906 #endif /* _DEBUG */ |
| 892 } | 907 } |
| 893 printf("\n"); | 908 printf("\n"); |
| 894 printf("total bits = %d bits\n", totalbits); | 909 printf("total bits = %" PRIuS " bits\n", totalbits); |
| 895 printf("measured average bitrate = %0.3f kbits/s\n", | 910 printf("measured average bitrate = %0.3f kbits/s\n", |
| 896 (double)totalbits * (sampFreqKHz) / totalsmpls); | 911 (double)totalbits * (sampFreqKHz) / totalsmpls); |
| 897 if (doTransCoding) { | 912 if (doTransCoding) { |
| 898 printf("Transcoding average bit-rate = %0.3f kbps\n", | 913 printf("Transcoding average bit-rate = %0.3f kbps\n", |
| 899 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); | 914 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); |
| 900 fclose(transCodingFile); | 915 fclose(transCodingFile); |
| 901 } | 916 } |
| 902 printf("\n"); | 917 printf("\n"); |
| 903 | 918 |
| 904 /* Runtime statistics */ | 919 /* Runtime statistics */ |
| 905 runtime = (double)(clock() / (double)CLOCKS_PER_SEC - starttime); | 920 runtime = (double)(clock() / (double)CLOCKS_PER_SEC - starttime); |
| 906 length_file = length_file / (sampFreqKHz * 1000.); | 921 length_file = length_file / (sampFreqKHz * 1000.); |
| 907 | 922 |
| 908 printf("\n\nLength of speech file: %.1f s\n", length_file); | 923 printf("\n\nLength of speech file: %.1f s\n", length_file); |
| 909 printf("Time to run iSAC: %.2f s (%.2f %% of realtime)\n\n", runtime, | 924 printf("Time to run iSAC: %.2f s (%.2f %% of realtime)\n\n", runtime, |
| 910 (100 * runtime / length_file)); | 925 (100 * runtime / length_file)); |
| 911 | 926 |
| 912 if (maxStreamLen30 != 0) { | 927 if (maxStreamLen30 != 0) { |
| 913 printf("Maximum payload size 30ms Frames %d bytes (%0.3f kbps)\n", | 928 printf("Maximum payload size 30ms Frames %" PRIuS " bytes (%0.3f kbps)\n", |
| 914 maxStreamLen30, maxStreamLen30 * 8 / 30.); | 929 maxStreamLen30, maxStreamLen30 * 8 / 30.); |
| 915 } | 930 } |
| 916 if (maxStreamLen60 != 0) { | 931 if (maxStreamLen60 != 0) { |
| 917 printf("Maximum payload size 60ms Frames %d bytes (%0.3f kbps)\n", | 932 printf("Maximum payload size 60ms Frames %" PRIuS " bytes (%0.3f kbps)\n", |
| 918 maxStreamLen60, maxStreamLen60 * 8 / 60.); | 933 maxStreamLen60, maxStreamLen60 * 8 / 60.); |
| 919 } | 934 } |
| 920 // fprintf(stderr, "\n"); | 935 // fprintf(stderr, "\n"); |
| 921 | 936 |
| 922 fprintf(stderr, " %.1f s", length_file); | 937 fprintf(stderr, " %.1f s", length_file); |
| 923 fprintf(stderr, " %0.1f kbps", | 938 fprintf(stderr, " %0.1f kbps", |
| 924 (double)totalbits * (sampFreqKHz) / totalsmpls); | 939 (double)totalbits * (sampFreqKHz) / totalsmpls); |
| 925 if (maxStreamLen30 != 0) { | 940 if (maxStreamLen30 != 0) { |
| 926 fprintf(stderr, " plmax-30ms %d bytes (%0.0f kbps)", maxStreamLen30, | 941 fprintf(stderr, " plmax-30ms %" PRIuS " bytes (%0.0f kbps)", |
| 927 maxStreamLen30 * 8 / 30.); | 942 maxStreamLen30, maxStreamLen30 * 8 / 30.); |
| 928 } | 943 } |
| 929 if (maxStreamLen60 != 0) { | 944 if (maxStreamLen60 != 0) { |
| 930 fprintf(stderr, " plmax-60ms %d bytes (%0.0f kbps)", maxStreamLen60, | 945 fprintf(stderr, " plmax-60ms %" PRIuS " bytes (%0.0f kbps)", |
| 931 maxStreamLen60 * 8 / 60.); | 946 maxStreamLen60, maxStreamLen60 * 8 / 60.); |
| 932 } | 947 } |
| 933 if (doTransCoding) { | 948 if (doTransCoding) { |
| 934 fprintf(stderr, " transcoding rate %.0f kbps", | 949 fprintf(stderr, " transcoding rate %.0f kbps", |
| 935 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); | 950 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); |
| 936 } | 951 } |
| 937 | 952 |
| 938 fclose(inp); | 953 fclose(inp); |
| 939 fclose(outp); | 954 fclose(outp); |
| 940 WebRtcIsac_Free(ISAC_main_inst); | 955 WebRtcIsac_Free(ISAC_main_inst); |
| 941 | 956 |
| 942 exit(0); | 957 exit(0); |
| 943 } | 958 } |
| OLD | NEW |