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

Side by Side Diff: third_party/opus/src/src/opus_demo.c

Issue 2962373002: [Opus] Update to v1.2.1 (Closed)
Patch Set: Pre-increment instead of post-increment Created 3 years, 5 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 | « third_party/opus/src/src/opus_decoder.c ('k') | third_party/opus/src/src/opus_encoder.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2007-2008 CSIRO 1 /* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2009 Xiph.Org Foundation 2 Copyright (c) 2007-2009 Xiph.Org Foundation
3 Written by Jean-Marc Valin */ 3 Written by Jean-Marc Valin */
4 /* 4 /*
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions 6 modification, are permitted provided that the following conditions
7 are met: 7 are met:
8 8
9 - Redistributions of source code must retain the above copyright 9 - Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer. 10 notice, this list of conditions and the following disclaimer.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 fprintf(stderr, "Usage: %s [-e] <application> <sampling rate (Hz)> <channels (1/2)> " 47 fprintf(stderr, "Usage: %s [-e] <application> <sampling rate (Hz)> <channels (1/2)> "
48 "<bits per second> [options] <input> <output>\n", argv[0]); 48 "<bits per second> [options] <input> <output>\n", argv[0]);
49 fprintf(stderr, " %s -d <sampling rate (Hz)> <channels (1/2)> " 49 fprintf(stderr, " %s -d <sampling rate (Hz)> <channels (1/2)> "
50 "[options] <input> <output>\n\n", argv[0]); 50 "[options] <input> <output>\n\n", argv[0]);
51 fprintf(stderr, "application: voip | audio | restricted-lowdelay\n" ); 51 fprintf(stderr, "application: voip | audio | restricted-lowdelay\n" );
52 fprintf(stderr, "options:\n" ); 52 fprintf(stderr, "options:\n" );
53 fprintf(stderr, "-e : only runs the encoder (output the bi t-stream)\n" ); 53 fprintf(stderr, "-e : only runs the encoder (output the bi t-stream)\n" );
54 fprintf(stderr, "-d : only runs the decoder (reads the bit -stream as input)\n" ); 54 fprintf(stderr, "-d : only runs the decoder (reads the bit -stream as input)\n" );
55 fprintf(stderr, "-cbr : enable constant bitrate; default: va riable bitrate\n" ); 55 fprintf(stderr, "-cbr : enable constant bitrate; default: va riable bitrate\n" );
56 fprintf(stderr, "-cvbr : enable constrained variable bitrate; default: unconstrained\n" ); 56 fprintf(stderr, "-cvbr : enable constrained variable bitrate; default: unconstrained\n" );
57 fprintf(stderr, "-variable-duration : enable frames of variable duration ( experts only); default: disabled\n" ); 57 fprintf(stderr, "-delayed-decision : use look-ahead for speech/music dete ction (experts only); default: disabled\n" );
58 fprintf(stderr, "-bandwidth <NB|MB|WB|SWB|FB> : audio bandwidth (from narrow band to fullband); default: sampling rate\n" ); 58 fprintf(stderr, "-bandwidth <NB|MB|WB|SWB|FB> : audio bandwidth (from narrow band to fullband); default: sampling rate\n" );
59 fprintf(stderr, "-framesize <2.5|5|10|20|40|60> : frame size in ms; default: 20 \n" ); 59 fprintf(stderr, "-framesize <2.5|5|10|20|40|60|80|100|120> : frame size in m s; default: 20 \n" );
60 fprintf(stderr, "-max_payload <bytes> : maximum payload size in bytes, defau lt: 1024\n" ); 60 fprintf(stderr, "-max_payload <bytes> : maximum payload size in bytes, defau lt: 1024\n" );
61 fprintf(stderr, "-complexity <comp> : complexity, 0 (lowest) ... 10 (highe st); default: 10\n" ); 61 fprintf(stderr, "-complexity <comp> : complexity, 0 (lowest) ... 10 (highe st); default: 10\n" );
62 fprintf(stderr, "-inbandfec : enable SILK inband FEC\n" ); 62 fprintf(stderr, "-inbandfec : enable SILK inband FEC\n" );
63 fprintf(stderr, "-forcemono : force mono encoding, even for stereo input\n" ); 63 fprintf(stderr, "-forcemono : force mono encoding, even for stereo input\n" );
64 fprintf(stderr, "-dtx : enable SILK DTX\n" ); 64 fprintf(stderr, "-dtx : enable SILK DTX\n" );
65 fprintf(stderr, "-loss <perc> : simulate packet loss, in percent (0- 100); default: 0\n" ); 65 fprintf(stderr, "-loss <perc> : simulate packet loss, in percent (0- 100); default: 0\n" );
66 } 66 }
67 67
68 static void int_to_char(opus_uint32 i, unsigned char ch[4]) 68 static void int_to_char(opus_uint32 i, unsigned char ch[4])
69 { 69 {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 double tot_samples=0; 246 double tot_samples=0;
247 opus_uint64 tot_in, tot_out; 247 opus_uint64 tot_in, tot_out;
248 int bandwidth=OPUS_AUTO; 248 int bandwidth=OPUS_AUTO;
249 const char *bandwidth_string; 249 const char *bandwidth_string;
250 int lost = 0, lost_prev = 1; 250 int lost = 0, lost_prev = 1;
251 int toggle = 0; 251 int toggle = 0;
252 opus_uint32 enc_final_range[2]; 252 opus_uint32 enc_final_range[2];
253 opus_uint32 dec_final_range; 253 opus_uint32 dec_final_range;
254 int encode_only=0, decode_only=0; 254 int encode_only=0, decode_only=0;
255 int max_frame_size = 48000*2; 255 int max_frame_size = 48000*2;
256 size_t num_read;
256 int curr_read=0; 257 int curr_read=0;
257 int sweep_bps = 0; 258 int sweep_bps = 0;
258 int random_framesize=0, newsize=0, delayed_celt=0; 259 int random_framesize=0, newsize=0, delayed_celt=0;
259 int sweep_max=0, sweep_min=0; 260 int sweep_max=0, sweep_min=0;
260 int random_fec=0; 261 int random_fec=0;
261 const int (*mode_list)[4]=NULL; 262 const int (*mode_list)[4]=NULL;
262 int nb_modes_in_list=0; 263 int nb_modes_in_list=0;
263 int curr_mode=0; 264 int curr_mode=0;
264 int curr_mode_count=0; 265 int curr_mode_count=0;
265 int mode_switch_time = 48000; 266 int mode_switch_time = 48000;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 else if (strcmp(argv[ args + 1 ], "5")==0) 376 else if (strcmp(argv[ args + 1 ], "5")==0)
376 frame_size = sampling_rate/200; 377 frame_size = sampling_rate/200;
377 else if (strcmp(argv[ args + 1 ], "10")==0) 378 else if (strcmp(argv[ args + 1 ], "10")==0)
378 frame_size = sampling_rate/100; 379 frame_size = sampling_rate/100;
379 else if (strcmp(argv[ args + 1 ], "20")==0) 380 else if (strcmp(argv[ args + 1 ], "20")==0)
380 frame_size = sampling_rate/50; 381 frame_size = sampling_rate/50;
381 else if (strcmp(argv[ args + 1 ], "40")==0) 382 else if (strcmp(argv[ args + 1 ], "40")==0)
382 frame_size = sampling_rate/25; 383 frame_size = sampling_rate/25;
383 else if (strcmp(argv[ args + 1 ], "60")==0) 384 else if (strcmp(argv[ args + 1 ], "60")==0)
384 frame_size = 3*sampling_rate/50; 385 frame_size = 3*sampling_rate/50;
386 else if (strcmp(argv[ args + 1 ], "80")==0)
387 frame_size = 4*sampling_rate/50;
388 else if (strcmp(argv[ args + 1 ], "100")==0)
389 frame_size = 5*sampling_rate/50;
390 else if (strcmp(argv[ args + 1 ], "120")==0)
391 frame_size = 6*sampling_rate/50;
385 else { 392 else {
386 fprintf(stderr, "Unsupported frame size: %s ms. " 393 fprintf(stderr, "Unsupported frame size: %s ms. "
387 "Supported are 2.5, 5, 10, 20, 40, 60.\n", 394 "Supported are 2.5, 5, 10, 20, 40, 60, 80, 100, 120.\n",
388 argv[ args + 1 ]); 395 argv[ args + 1 ]);
389 return EXIT_FAILURE; 396 return EXIT_FAILURE;
390 } 397 }
391 args += 2; 398 args += 2;
392 } else if( strcmp( argv[ args ], "-max_payload" ) == 0 ) { 399 } else if( strcmp( argv[ args ], "-max_payload" ) == 0 ) {
393 check_encoder_option(decode_only, "-max_payload"); 400 check_encoder_option(decode_only, "-max_payload");
394 max_payload_bytes = atoi( argv[ args + 1 ] ); 401 max_payload_bytes = atoi( argv[ args + 1 ] );
395 args += 2; 402 args += 2;
396 } else if( strcmp( argv[ args ], "-complexity" ) == 0 ) { 403 } else if( strcmp( argv[ args ], "-complexity" ) == 0 ) {
397 check_encoder_option(decode_only, "-complexity"); 404 check_encoder_option(decode_only, "-complexity");
398 complexity = atoi( argv[ args + 1 ] ); 405 complexity = atoi( argv[ args + 1 ] );
399 args += 2; 406 args += 2;
400 } else if( strcmp( argv[ args ], "-inbandfec" ) == 0 ) { 407 } else if( strcmp( argv[ args ], "-inbandfec" ) == 0 ) {
401 use_inbandfec = 1; 408 use_inbandfec = 1;
402 args++; 409 args++;
403 } else if( strcmp( argv[ args ], "-forcemono" ) == 0 ) { 410 } else if( strcmp( argv[ args ], "-forcemono" ) == 0 ) {
404 check_encoder_option(decode_only, "-forcemono"); 411 check_encoder_option(decode_only, "-forcemono");
405 forcechannels = 1; 412 forcechannels = 1;
406 args++; 413 args++;
407 } else if( strcmp( argv[ args ], "-cvbr" ) == 0 ) { 414 } else if( strcmp( argv[ args ], "-cvbr" ) == 0 ) {
408 check_encoder_option(decode_only, "-cvbr"); 415 check_encoder_option(decode_only, "-cvbr");
409 cvbr = 1; 416 cvbr = 1;
410 args++; 417 args++;
411 } else if( strcmp( argv[ args ], "-variable-duration" ) == 0 ) {
412 check_encoder_option(decode_only, "-variable-duration");
413 variable_duration = OPUS_FRAMESIZE_VARIABLE;
414 args++;
415 } else if( strcmp( argv[ args ], "-delayed-decision" ) == 0 ) { 418 } else if( strcmp( argv[ args ], "-delayed-decision" ) == 0 ) {
416 check_encoder_option(decode_only, "-delayed-decision"); 419 check_encoder_option(decode_only, "-delayed-decision");
417 delayed_decision = 1; 420 delayed_decision = 1;
418 args++; 421 args++;
419 } else if( strcmp( argv[ args ], "-dtx") == 0 ) { 422 } else if( strcmp( argv[ args ], "-dtx") == 0 ) {
420 check_encoder_option(decode_only, "-dtx"); 423 check_encoder_option(decode_only, "-dtx");
421 use_dtx = 1; 424 use_dtx = 1;
422 args++; 425 args++;
423 } else if( strcmp( argv[ args ], "-loss" ) == 0 ) { 426 } else if( strcmp( argv[ args ], "-loss" ) == 0 ) {
424 packet_loss_perc = atoi( argv[ args + 1 ] ); 427 packet_loss_perc = atoi( argv[ args + 1 ] );
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 in = (short*)malloc(max_frame_size*channels*sizeof(short)); 595 in = (short*)malloc(max_frame_size*channels*sizeof(short));
593 out = (short*)malloc(max_frame_size*channels*sizeof(short)); 596 out = (short*)malloc(max_frame_size*channels*sizeof(short));
594 /* We need to allocate for 16-bit PCM data, but we store it as unsigned char . */ 597 /* We need to allocate for 16-bit PCM data, but we store it as unsigned char . */
595 fbytes = (unsigned char*)malloc(max_frame_size*channels*sizeof(short)); 598 fbytes = (unsigned char*)malloc(max_frame_size*channels*sizeof(short));
596 data[0] = (unsigned char*)calloc(max_payload_bytes,sizeof(unsigned char)); 599 data[0] = (unsigned char*)calloc(max_payload_bytes,sizeof(unsigned char));
597 if ( use_inbandfec ) { 600 if ( use_inbandfec ) {
598 data[1] = (unsigned char*)calloc(max_payload_bytes,sizeof(unsigned char) ); 601 data[1] = (unsigned char*)calloc(max_payload_bytes,sizeof(unsigned char) );
599 } 602 }
600 if(delayed_decision) 603 if(delayed_decision)
601 { 604 {
602 if (variable_duration!=OPUS_FRAMESIZE_VARIABLE) 605 if (frame_size==sampling_rate/400)
603 { 606 variable_duration = OPUS_FRAMESIZE_2_5_MS;
604 if (frame_size==sampling_rate/400) 607 else if (frame_size==sampling_rate/200)
605 variable_duration = OPUS_FRAMESIZE_2_5_MS; 608 variable_duration = OPUS_FRAMESIZE_5_MS;
606 else if (frame_size==sampling_rate/200) 609 else if (frame_size==sampling_rate/100)
607 variable_duration = OPUS_FRAMESIZE_5_MS; 610 variable_duration = OPUS_FRAMESIZE_10_MS;
608 else if (frame_size==sampling_rate/100) 611 else if (frame_size==sampling_rate/50)
609 variable_duration = OPUS_FRAMESIZE_10_MS; 612 variable_duration = OPUS_FRAMESIZE_20_MS;
610 else if (frame_size==sampling_rate/50) 613 else if (frame_size==sampling_rate/25)
611 variable_duration = OPUS_FRAMESIZE_20_MS; 614 variable_duration = OPUS_FRAMESIZE_40_MS;
612 else if (frame_size==sampling_rate/25) 615 else if (frame_size==3*sampling_rate/50)
613 variable_duration = OPUS_FRAMESIZE_40_MS; 616 variable_duration = OPUS_FRAMESIZE_60_MS;
614 else 617 else if (frame_size==4*sampling_rate/50)
615 variable_duration = OPUS_FRAMESIZE_60_MS; 618 variable_duration = OPUS_FRAMESIZE_80_MS;
616 opus_encoder_ctl(enc, OPUS_SET_EXPERT_FRAME_DURATION(variable_duration )); 619 else if (frame_size==5*sampling_rate/50)
617 } 620 variable_duration = OPUS_FRAMESIZE_100_MS;
621 else
622 variable_duration = OPUS_FRAMESIZE_120_MS;
623 opus_encoder_ctl(enc, OPUS_SET_EXPERT_FRAME_DURATION(variable_duration));
618 frame_size = 2*48000; 624 frame_size = 2*48000;
619 } 625 }
620 while (!stop) 626 while (!stop)
621 { 627 {
622 if (delayed_celt) 628 if (delayed_celt)
623 { 629 {
624 frame_size = newsize; 630 frame_size = newsize;
625 delayed_celt = 0; 631 delayed_celt = 0;
626 } else if (random_framesize && rand()%20==0) 632 } else if (random_framesize && rand()%20==0)
627 { 633 {
(...skipping 17 matching lines...) Expand all
645 frame_size = newsize; 651 frame_size = newsize;
646 } 652 }
647 } 653 }
648 if (random_fec && rand()%30==0) 654 if (random_fec && rand()%30==0)
649 { 655 {
650 opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(rand()%4==0)); 656 opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(rand()%4==0));
651 } 657 }
652 if (decode_only) 658 if (decode_only)
653 { 659 {
654 unsigned char ch[4]; 660 unsigned char ch[4];
655 err = fread(ch, 1, 4, fin); 661 num_read = fread(ch, 1, 4, fin);
656 if (feof(fin)) 662 if (num_read!=4)
657 break; 663 break;
658 len[toggle] = char_to_int(ch); 664 len[toggle] = char_to_int(ch);
659 if (len[toggle]>max_payload_bytes || len[toggle]<0) 665 if (len[toggle]>max_payload_bytes || len[toggle]<0)
660 { 666 {
661 fprintf(stderr, "Invalid payload length: %d\n",len[toggle]); 667 fprintf(stderr, "Invalid payload length: %d\n",len[toggle]);
662 break; 668 break;
663 } 669 }
664 err = fread(ch, 1, 4, fin); 670 num_read = fread(ch, 1, 4, fin);
671 if (num_read!=4)
672 break;
665 enc_final_range[toggle] = char_to_int(ch); 673 enc_final_range[toggle] = char_to_int(ch);
666 err = fread(data[toggle], 1, len[toggle], fin); 674 num_read = fread(data[toggle], 1, len[toggle], fin);
667 if (err<len[toggle]) 675 if (num_read!=(size_t)len[toggle])
668 { 676 {
669 fprintf(stderr, "Ran out of input, " 677 fprintf(stderr, "Ran out of input, "
670 "expecting %d bytes got %d\n", 678 "expecting %d bytes got %d\n",
671 len[toggle],err); 679 len[toggle],(int)num_read);
672 break; 680 break;
673 } 681 }
674 } else { 682 } else {
675 int i; 683 int i;
676 if (mode_list!=NULL) 684 if (mode_list!=NULL)
677 { 685 {
678 opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(mode_list[curr_mode][1] )); 686 opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(mode_list[curr_mode][1] ));
679 opus_encoder_ctl(enc, OPUS_SET_FORCE_MODE(mode_list[curr_mode][0 ])); 687 opus_encoder_ctl(enc, OPUS_SET_FORCE_MODE(mode_list[curr_mode][0 ]));
680 opus_encoder_ctl(enc, OPUS_SET_FORCE_CHANNELS(mode_list[curr_mod e][3])); 688 opus_encoder_ctl(enc, OPUS_SET_FORCE_CHANNELS(mode_list[curr_mod e][3]));
681 frame_size = mode_list[curr_mode][2]; 689 frame_size = mode_list[curr_mode][2];
682 } 690 }
683 err = fread(fbytes, sizeof(short)*channels, frame_size-remaining, fi n); 691 num_read = fread(fbytes, sizeof(short)*channels, frame_size-remainin g, fin);
684 curr_read = err; 692 curr_read = (int)num_read;
685 tot_in += curr_read; 693 tot_in += curr_read;
686 for(i=0;i<curr_read*channels;i++) 694 for(i=0;i<curr_read*channels;i++)
687 { 695 {
688 opus_int32 s; 696 opus_int32 s;
689 s=fbytes[2*i+1]<<8|fbytes[2*i]; 697 s=fbytes[2*i+1]<<8|fbytes[2*i];
690 s=((s&0xFFFF)^0x8000)-0x8000; 698 s=((s&0xFFFF)^0x8000)-0x8000;
691 in[i+remaining*channels]=s; 699 in[i+remaining*channels]=s;
692 } 700 }
693 if (curr_read+remaining < frame_size) 701 if (curr_read+remaining < frame_size)
694 { 702 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 if (fwrite(int_field, 1, 4, fout) != 4) { 765 if (fwrite(int_field, 1, 4, fout) != 4) {
758 fprintf(stderr, "Error writing.\n"); 766 fprintf(stderr, "Error writing.\n");
759 return EXIT_FAILURE; 767 return EXIT_FAILURE;
760 } 768 }
761 if (fwrite(data[toggle], 1, len[toggle], fout) != (unsigned)len[togg le]) { 769 if (fwrite(data[toggle], 1, len[toggle], fout) != (unsigned)len[togg le]) {
762 fprintf(stderr, "Error writing.\n"); 770 fprintf(stderr, "Error writing.\n");
763 return EXIT_FAILURE; 771 return EXIT_FAILURE;
764 } 772 }
765 tot_samples += nb_encoded; 773 tot_samples += nb_encoded;
766 } else { 774 } else {
767 int output_samples; 775 opus_int32 output_samples;
768 lost = len[toggle]==0 || (packet_loss_perc>0 && rand()%100 < packet_ loss_perc); 776 lost = len[toggle]==0 || (packet_loss_perc>0 && rand()%100 < packet_ loss_perc);
769 if (lost) 777 if (lost)
770 opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION(&output_sampl es)); 778 opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION(&output_sampl es));
771 else 779 else
772 output_samples = max_frame_size; 780 output_samples = max_frame_size;
773 if( count >= use_inbandfec ) { 781 if( count >= use_inbandfec ) {
774 /* delay by one packet when using in-band FEC */ 782 /* delay by one packet when using in-band FEC */
775 if( use_inbandfec ) { 783 if( use_inbandfec ) {
776 if( lost_prev ) { 784 if( lost_prev ) {
777 /* attempt to decode with in-band FEC from next packet * / 785 /* attempt to decode with in-band FEC from next packet * /
778 opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION(&out put_samples)); 786 opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION(&out put_samples));
779 output_samples = opus_decode(dec, lost ? NULL : data[tog gle], len[toggle], out, output_samples, 1); 787 output_samples = opus_decode(dec, lost ? NULL : data[tog gle], len[toggle], out, output_samples, 1);
780 } else { 788 } else {
781 /* regular decode */ 789 /* regular decode */
782 output_samples = max_frame_size; 790 output_samples = max_frame_size;
783 output_samples = opus_decode(dec, data[1-toggle], len[1- toggle], out, output_samples, 0); 791 output_samples = opus_decode(dec, data[1-toggle], len[1- toggle], out, output_samples, 0);
784 } 792 }
785 } else { 793 } else {
786 output_samples = opus_decode(dec, lost ? NULL : data[toggle] , len[toggle], out, output_samples, 0); 794 output_samples = opus_decode(dec, lost ? NULL : data[toggle] , len[toggle], out, output_samples, 0);
787 } 795 }
788 if (output_samples>0) 796 if (output_samples>0)
789 { 797 {
790 if (!decode_only && tot_out + output_samples > tot_in) 798 if (!decode_only && tot_out + output_samples > tot_in)
791 { 799 {
792 stop=1; 800 stop=1;
793 output_samples = tot_in-tot_out; 801 output_samples = (opus_int32)(tot_in - tot_out);
794 } 802 }
795 if (output_samples>skip) { 803 if (output_samples>skip) {
796 int i; 804 int i;
797 for(i=0;i<(output_samples-skip)*channels;i++) 805 for(i=0;i<(output_samples-skip)*channels;i++)
798 { 806 {
799 short s; 807 short s;
800 s=out[i+(skip*channels)]; 808 s=out[i+(skip*channels)];
801 fbytes[2*i]=s&0xFF; 809 fbytes[2*i]=s&0xFF;
802 fbytes[2*i+1]=(s>>8)&0xFF; 810 fbytes[2*i+1]=(s>>8)&0xFF;
803 } 811 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 count -= use_inbandfec; 871 count -= use_inbandfec;
864 fprintf (stderr, "average bitrate: %7.3f kb/s\n", 872 fprintf (stderr, "average bitrate: %7.3f kb/s\n",
865 1e-3*bits*sampling_rate/tot_samples); 873 1e-3*bits*sampling_rate/tot_samples);
866 fprintf (stderr, "maximum bitrate: %7.3f kb/s\n", 874 fprintf (stderr, "maximum bitrate: %7.3f kb/s\n",
867 1e-3*bits_max*sampling_rate/frame_size); 875 1e-3*bits_max*sampling_rate/frame_size);
868 if (!decode_only) 876 if (!decode_only)
869 fprintf (stderr, "active bitrate: %7.3f kb/s\n", 877 fprintf (stderr, "active bitrate: %7.3f kb/s\n",
870 1e-3*bits_act*sampling_rate/(1e-15+frame_size*(double)count_act)) ; 878 1e-3*bits_act*sampling_rate/(1e-15+frame_size*(double)count_act)) ;
871 fprintf (stderr, "bitrate standard deviation: %7.3f kb/s\n", 879 fprintf (stderr, "bitrate standard deviation: %7.3f kb/s\n",
872 1e-3*sqrt(bits2/count - bits*bits/(count*(double)count))*sampling_ra te/frame_size); 880 1e-3*sqrt(bits2/count - bits*bits/(count*(double)count))*sampling_ra te/frame_size);
873 /* Close any files to which intermediate results were stored */
874 SILK_DEBUG_STORE_CLOSE_FILES
875 silk_TimerSave("opus_timing.txt"); 881 silk_TimerSave("opus_timing.txt");
876 opus_encoder_destroy(enc); 882 opus_encoder_destroy(enc);
877 opus_decoder_destroy(dec); 883 opus_decoder_destroy(dec);
878 free(data[0]); 884 free(data[0]);
879 if (use_inbandfec) 885 if (use_inbandfec)
880 free(data[1]); 886 free(data[1]);
881 fclose(fin); 887 fclose(fin);
882 fclose(fout); 888 fclose(fout);
883 free(in); 889 free(in);
884 free(out); 890 free(out);
885 free(fbytes); 891 free(fbytes);
886 return EXIT_SUCCESS; 892 return EXIT_SUCCESS;
887 } 893 }
OLDNEW
« no previous file with comments | « third_party/opus/src/src/opus_decoder.c ('k') | third_party/opus/src/src/opus_encoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698