Updated WavPack decoder binary to v5.1.0 (2017-01-20), compiled with ICL 18.0 and...
[LameXP.git] / etc / Patches / deprecated / OpusTools-Git20130408-Progress+NoResample.diff
blobfdbd19b2ff9c8534c6a6f00bef32963f05a88d6b
1 src/opusdec.c | 24 +++++++++++++++++++++---
2 src/opusenc.c | 17 +++++++----------
3 2 files changed, 28 insertions(+), 13 deletions(-)
5 diff --git a/src/opusdec.c b/src/opusdec.c
6 index b23ae62..bfb2b68 100644
7 --- a/src/opusdec.c
8 +++ b/src/opusdec.c
9 @@ -57,6 +57,7 @@
10 # include <io.h>
11 # include <fcntl.h>
12 # define I64FORMAT "I64d"
13 +# define ftello64(_x) _ftelli64((_x))
14 #else
15 # define I64FORMAT "lld"
16 # define fopen_utf8(_x,_y) fopen((_x),(_y))
17 @@ -658,6 +659,7 @@ int main(int argc, char **argv)
18 {"force-wav", no_argument, NULL, 0},
19 {"packet-loss", required_argument, NULL, 0},
20 {"save-range", required_argument, NULL, 0},
21 + {"no-resample", no_argument, NULL, 0},
22 {0, 0, 0, 0}
24 ogg_sync_state oy;
25 @@ -667,6 +669,7 @@ int main(int argc, char **argv)
26 int close_in=0;
27 int eos=0;
28 ogg_int64_t audio_size=0;
29 + ogg_int64_t input_size=0;
30 double last_coded_seconds=0;
31 float loss_percent=-1;
32 float manual_gain=0;
33 @@ -682,6 +685,7 @@ int main(int argc, char **argv)
34 int dither=1;
35 shapestate shapemem;
36 SpeexResamplerState *resampler=NULL;
37 + int no_resample = 0;
38 float gain=1;
39 int streams=0;
40 size_t last_spin=0;
41 @@ -743,7 +747,10 @@ int main(int argc, char **argv)
42 forcewav=1;
43 } else if (strcmp(long_options[option_index].name,"rate")==0)
45 - rate=atoi (optarg);
46 + rate=((no_resample) ? 48000 : atoi(optarg));
47 + } else if (strcmp(long_options[option_index].name,"no-resample")==0)
48 + {
49 + no_resample=1; rate=48000;
50 } else if (strcmp(long_options[option_index].name,"gain")==0)
52 manual_gain=atof (optarg);
53 @@ -825,6 +832,16 @@ int main(int argc, char **argv)
54 close_in=1;
57 + /*detect input size*/
58 + if(fin != stdin)
59 + {
60 + struct _stat64 info;
61 + if(_fstati64(_fileno(fin), &info) == 0)
62 + {
63 + input_size = info.st_size;
64 + }
65 + }
67 /* .opus files use the Ogg container to provide framing and timekeeping.
68 * http://tools.ietf.org/html/draft-terriberry-oggopus
69 * The easiest way to decode the Ogg container is to use libogg, so
70 @@ -989,10 +1006,11 @@ int main(int argc, char **argv)
71 /*Display a progress spinner while decoding.*/
72 static const char spinner[]="|/-\\";
73 double coded_seconds = (double)audio_size/(channels*rate*sizeof(short));
74 + double percent = (input_size>0) ? ((double)ftello64(fin))/((double)input_size) : 0.0;
75 if(coded_seconds>=last_coded_seconds+1){
76 - fprintf(stderr,"\r[%c] %02d:%02d:%02d", spinner[last_spin&3],
77 + fprintf(stderr,"\r[%c] %02d:%02d:%02d (%.f%%)", spinner[last_spin&3],
78 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
79 - (int)(coded_seconds)%60);
80 + (int)(coded_seconds)%60,percent*100.0);
81 fflush(stderr);
82 last_spin++;
83 last_coded_seconds=coded_seconds;
84 diff --git a/src/opusenc.c b/src/opusenc.c
85 index b24f7c7..147bc07 100644
86 --- a/src/opusenc.c
87 +++ b/src/opusenc.c
88 @@ -968,6 +968,7 @@ int main(int argc, char **argv)
89 double estbitrate;
90 double coded_seconds=nb_encoded/(double)coding_rate;
91 double wall_time=(stop_time-start_time)+1e-6;
92 + double percent = 0.0;
93 char sbuf[55];
94 static const char spinner[]="|/-\\";
95 if(!with_hard_cbr){
96 @@ -975,20 +976,16 @@ int main(int argc, char **argv)
97 estbitrate=(total_bytes*8.0/coded_seconds)*tweight+
98 bitrate*(1.-tweight);
99 }else estbitrate=nbBytes*8*((double)coding_rate/frame_size);
100 + if(inopt.total_samples_per_channel>0){
101 + percent = ((double)nb_encoded) / ((double)inopt.total_samples_per_channel);
103 fprintf(stderr,"\r");
104 for(i=0;i<last_spin_len;i++)fprintf(stderr," ");
105 - if(inopt.total_samples_per_channel>0 && inopt.total_samples_per_channel<nb_encoded){
106 - snprintf(sbuf,54,"\r[%c] %02d%% ",spinner[last_spin&3],
107 - (int)floor(nb_encoded/(double)(inopt.total_samples_per_channel+inopt.skip)*100.));
108 - }else{
109 - snprintf(sbuf,54,"\r[%c] ",spinner[last_spin&3]);
111 - last_spin_len=strlen(sbuf);
112 - snprintf(sbuf+last_spin_len,54-last_spin_len,
113 - "%02d:%02d:%02d.%02d %4.3gx realtime, %5.4gkbit/s",
114 + snprintf(sbuf,54,"\r[%c] %02d:%02d:%02d.%02d (%.f%%) %4.3gx realtime, %5.4gkbit/s",
115 + spinner[last_spin&3],
116 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
117 (int)(coded_seconds)%60,(int)(coded_seconds*100)%100,
118 - coded_seconds/wall_time,
119 + percent*100.0,coded_seconds/wall_time,
120 estbitrate/1000.);
121 fprintf(stderr,"%s",sbuf);
122 fflush(stderr);