1 src/opusdec.c | 24 +++++++++++++++++++++---
2 src/opusenc.c | 18 ++++++++----------
3 win32/config.h | 16 +++++++++++++++-
4 win32/genversion.bat | 1 +
5 4 files changed, 45 insertions(+), 14 deletions(-)
7 diff --git a/src/opusdec.c b/src/opusdec.c
8 index 7e51f7a..cced424 100644
14 # define I64FORMAT "I64d"
15 +# define ftello64(_x) _ftelli64((_x))
17 # define I64FORMAT "lld"
18 # define fopen_utf8(_x,_y) fopen((_x),(_y))
19 @@ -658,6 +659,7 @@ int main(int argc, char **argv)
20 {"force-wav", no_argument, NULL, 0},
21 {"packet-loss", required_argument, NULL, 0},
22 {"save-range", required_argument, NULL, 0},
23 + {"no-resample", no_argument, NULL, 0},
27 @@ -667,6 +669,7 @@ int main(int argc, char **argv)
30 ogg_int64_t audio_size=0;
31 + ogg_int64_t input_size=0;
32 double last_coded_seconds=0;
33 float loss_percent=-1;
35 @@ -683,6 +686,7 @@ int main(int argc, char **argv)
38 SpeexResamplerState *resampler=NULL;
39 + int no_resample = 0;
43 @@ -747,7 +751,10 @@ int main(int argc, char **argv)
45 } else if (strcmp(long_options[option_index].name,"rate")==0)
48 + rate=((no_resample) ? 48000 : atoi(optarg));
49 + } else if (strcmp(long_options[option_index].name,"no-resample")==0)
51 + no_resample=1; rate=48000;
52 } else if (strcmp(long_options[option_index].name,"gain")==0)
54 manual_gain=atof (optarg);
55 @@ -833,6 +840,16 @@ int main(int argc, char **argv)
59 + /*detect input size*/
62 + struct _stat64 info;
63 + if(_fstati64(_fileno(fin), &info) == 0)
65 + input_size = info.st_size;
69 /* .opus files use the Ogg container to provide framing and timekeeping.
70 * http://tools.ietf.org/html/draft-terriberry-oggopus
71 * The easiest way to decode the Ogg container is to use libogg, so
72 @@ -1011,10 +1028,11 @@ int main(int argc, char **argv)
73 /*Display a progress spinner while decoding.*/
74 static const char spinner[]="|/-\\";
75 double coded_seconds = (double)audio_size/(channels*rate*(fp?4:2));
76 + double percent = (input_size>0) ? ((double)ftello64(fin))/((double)input_size) : 0.0;
77 if(coded_seconds>=last_coded_seconds+1){
78 - fprintf(stderr,"\r[%c] %02d:%02d:%02d", spinner[last_spin&3],
79 + fprintf(stderr,"\r[%c] %02d:%02d:%02d (%.f%%)", spinner[last_spin&3],
80 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
81 - (int)(coded_seconds)%60);
82 + (int)(coded_seconds)%60, percent*100.0);
85 last_coded_seconds=coded_seconds;
86 diff --git a/src/opusenc.c b/src/opusenc.c
87 index 129dcdb..43b7273 100644
97 #define snprintf _snprintf
98 @@ -1032,6 +1033,7 @@ int main(int argc, char **argv)
100 double coded_seconds=nb_encoded/(double)coding_rate;
101 double wall_time=(stop_time-start_time)+1e-6;
102 + double percent = 0.0;
104 static const char spinner[]="|/-\\";
106 @@ -1039,20 +1041,16 @@ int main(int argc, char **argv)
107 estbitrate=(total_bytes*8.0/coded_seconds)*tweight+
108 bitrate*(1.-tweight);
109 }else estbitrate=nbBytes*8*((double)coding_rate/frame_size);
110 + if(inopt.total_samples_per_channel>0){
111 + percent = ((double)nb_encoded) / ((double)inopt.total_samples_per_channel);
113 fprintf(stderr,"\r");
114 for(i=0;i<last_spin_len;i++)fprintf(stderr," ");
115 - if(inopt.total_samples_per_channel>0 && nb_encoded<inopt.total_samples_per_channel){
116 - snprintf(sbuf,54,"\r[%c] %2d%% ",spinner[last_spin&3],
117 - (int)floor(nb_encoded/(double)(inopt.total_samples_per_channel+inopt.skip)*100.));
119 - snprintf(sbuf,54,"\r[%c] ",spinner[last_spin&3]);
121 - last_spin_len=strlen(sbuf);
122 - snprintf(sbuf+last_spin_len,54-last_spin_len,
123 - "%02d:%02d:%02d.%02d %4.3gx realtime, %5.4gkbit/s",
124 + snprintf(sbuf,54,"\r[%c] %02d:%02d:%02d.%02d (%.f%%) %4.3gx realtime, %5.4gkbit/s",
125 + spinner[last_spin&3],
126 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
127 (int)(coded_seconds)%60,(int)(coded_seconds*100)%100,
128 - coded_seconds/wall_time,
129 + percent*100.0,coded_seconds/wall_time,
131 fprintf(stderr,"%s",sbuf);
133 diff --git a/win32/config.h b/win32/config.h
134 index 76d34b6..d8f0fa7 100644
139 #define FLOATING_POINT 1
140 #define SPX_RESAMPLE_EXPORT
143 +/* Enable SSE functions, if compiled with SSE/SSE2 (note that AMD64 implies SSE2) */
144 +#if defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))
147 +#if defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
152 +#pragma message( "SSE code is enabled!" )
155 +#pragma message( "SSE2 code is enabled!" )
158 #define RANDOM_PREFIX opustools
160 diff --git a/win32/genversion.bat b/win32/genversion.bat
161 index 1def746..64b0a5e 100644
162 --- a/win32/genversion.bat
163 +++ b/win32/genversion.bat
168 setlocal enableextensions enabledelayedexpansion