Updated German translation. Includes suggestions by "tablerocker" <tablerocker@web...
[LameXP.git] / etc / Patches / OpusTools-v0.1.9-Progress+NoResample.V5.diff
blob83be08370a3fbd0ed6436b6f47951acb487075fa
1 src/opusdec.c | 24 +++++++++++++++++++++---
2 src/opusenc.c | 18 ++++++++----------
3 win32/config.h | 10 +++++++++-
4 win32/genversion.bat | 1 +
5 win32/version.h | 12 +++++++++++-
6 5 files changed, 50 insertions(+), 15 deletions(-)
8 diff --git a/src/opusdec.c b/src/opusdec.c
9 index d085f04..92027fe 100644
10 --- a/src/opusdec.c
11 +++ b/src/opusdec.c
12 @@ -53,6 +53,7 @@
13 # include <io.h>
14 # include <fcntl.h>
15 # define I64FORMAT "I64d"
16 +# define ftello64(_x) _ftelli64((_x))
17 #else
18 # define I64FORMAT "lld"
19 # define fopen_utf8(_x,_y) fopen((_x),(_y))
20 @@ -658,6 +659,7 @@ int main(int argc, char **argv)
21 {"force-wav", no_argument, NULL, 0},
22 {"packet-loss", required_argument, NULL, 0},
23 {"save-range", required_argument, NULL, 0},
24 + {"no-resample", no_argument, NULL, 0},
25 {0, 0, 0, 0}
27 ogg_sync_state oy;
28 @@ -667,6 +669,7 @@ int main(int argc, char **argv)
29 int close_in=0;
30 int eos=0;
31 ogg_int64_t audio_size=0;
32 + ogg_int64_t input_size=0;
33 double last_coded_seconds=0;
34 float loss_percent=-1;
35 float manual_gain=0;
36 @@ -683,6 +686,7 @@ int main(int argc, char **argv)
37 int fp=0;
38 shapestate shapemem;
39 SpeexResamplerState *resampler=NULL;
40 + int no_resample = 0;
41 float gain=1;
42 int streams=0;
43 size_t last_spin=0;
44 @@ -747,7 +751,10 @@ int main(int argc, char **argv)
45 forcewav=1;
46 } else if (strcmp(long_options[option_index].name,"rate")==0)
48 - rate=atoi (optarg);
49 + rate=((no_resample) ? 48000 : atoi(optarg));
50 + } else if (strcmp(long_options[option_index].name,"no-resample")==0)
51 + {
52 + no_resample=1; rate=48000;
53 } else if (strcmp(long_options[option_index].name,"gain")==0)
55 manual_gain=atof (optarg);
56 @@ -833,6 +840,16 @@ int main(int argc, char **argv)
57 close_in=1;
60 + /*detect input size*/
61 + if(fin != stdin)
62 + {
63 + struct _stat64 info;
64 + if(_fstati64(_fileno(fin), &info) == 0)
65 + {
66 + input_size = info.st_size;
67 + }
68 + }
70 /* .opus files use the Ogg container to provide framing and timekeeping.
71 * http://tools.ietf.org/html/draft-terriberry-oggopus
72 * The easiest way to decode the Ogg container is to use libogg, so
73 @@ -1011,10 +1028,11 @@ int main(int argc, char **argv)
74 /*Display a progress spinner while decoding.*/
75 static const char spinner[]="|/-\\";
76 double coded_seconds = (double)audio_size/(channels*rate*(fp?4:2));
77 + double percent = (input_size>0) ? ((double)ftello64(fin))/((double)input_size) : 0.0;
78 if(coded_seconds>=last_coded_seconds+1){
79 - fprintf(stderr,"\r[%c] %02d:%02d:%02d", spinner[last_spin&3],
80 + fprintf(stderr,"\r[%c] %02d:%02d:%02d (%.f%%)", spinner[last_spin&3],
81 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
82 - (int)(coded_seconds)%60);
83 + (int)(coded_seconds)%60, percent*100.0);
84 fflush(stderr);
85 last_spin++;
86 last_coded_seconds=coded_seconds;
87 diff --git a/src/opusenc.c b/src/opusenc.c
88 index 5f89d8a..52a080c 100644
89 --- a/src/opusenc.c
90 +++ b/src/opusenc.c
91 @@ -41,6 +41,7 @@
92 #include <time.h>
93 #endif
94 #include <math.h>
95 +#include <time.h>
97 #ifdef _MSC_VER
98 #define snprintf _snprintf
99 @@ -1031,6 +1032,7 @@ int main(int argc, char **argv)
100 double estbitrate;
101 double coded_seconds=nb_encoded/(double)coding_rate;
102 double wall_time=(stop_time-start_time)+1e-6;
103 + double percent = 0.0;
104 char sbuf[55];
105 static const char spinner[]="|/-\\";
106 if(!with_hard_cbr){
107 @@ -1038,20 +1040,16 @@ int main(int argc, char **argv)
108 estbitrate=(total_bytes*8.0/coded_seconds)*tweight+
109 bitrate*(1.-tweight);
110 }else estbitrate=nbBytes*8*((double)coding_rate/frame_size);
111 + if(inopt.total_samples_per_channel>0){
112 + percent = ((double)nb_encoded) / ((double)inopt.total_samples_per_channel);
114 fprintf(stderr,"\r");
115 for(i=0;i<last_spin_len;i++)fprintf(stderr," ");
116 - if(inopt.total_samples_per_channel>0 && nb_encoded<inopt.total_samples_per_channel){
117 - snprintf(sbuf,54,"\r[%c] %2d%% ",spinner[last_spin&3],
118 - (int)floor(nb_encoded/(double)(inopt.total_samples_per_channel+inopt.skip)*100.));
119 - }else{
120 - snprintf(sbuf,54,"\r[%c] ",spinner[last_spin&3]);
122 - last_spin_len=strlen(sbuf);
123 - snprintf(sbuf+last_spin_len,54-last_spin_len,
124 - "%02d:%02d:%02d.%02d %4.3gx realtime, %5.4gkbit/s",
125 + snprintf(sbuf,54,"\r[%c] %02d:%02d:%02d.%02d (%.f%%) %4.3gx realtime, %5.4gkbit/s",
126 + spinner[last_spin&3],
127 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
128 (int)(coded_seconds)%60,(int)(coded_seconds*100)%100,
129 - coded_seconds/wall_time,
130 + percent*100.0,coded_seconds/wall_time,
131 estbitrate/1000.);
132 fprintf(stderr,"%s",sbuf);
133 fflush(stderr);
134 diff --git a/win32/config.h b/win32/config.h
135 index 5a1e250..1090a9f 100644
136 --- a/win32/config.h
137 +++ b/win32/config.h
138 @@ -10,7 +10,15 @@
139 #define USE_ALLOCA 1
140 #define FLOATING_POINT 1
141 #define SPX_RESAMPLE_EXPORT
142 -#define __SSE__
144 +/* Enable SSE functions, if compiled with SSE/SSE2 (note that AMD64 implies SSE2) */
145 +#if defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))
146 +#define __SSE__ 1
147 +#endif
149 +#if defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
150 +#define __SSE2__ 1
151 +#endif
153 #define RANDOM_PREFIX foo
155 diff --git a/win32/genversion.bat b/win32/genversion.bat
156 index 44ba29c..e94e8ea 100644
157 --- a/win32/genversion.bat
158 +++ b/win32/genversion.bat
159 @@ -1,4 +1,5 @@
160 @echo off
161 +goto:eof
163 for /f %%v in ('git describe --tags --match "v*" --always') do set version=%%v
165 diff --git a/win32/version.h b/win32/version.h
166 index 3c8a521..c05f50f 100644
167 --- a/win32/version.h
168 +++ b/win32/version.h
169 @@ -1 +1,11 @@
170 -#define PACKAGE_VERSION "v0.1.9-dev"
171 +#define __PACKAGE_VERSION "v0.1.9-git"
173 +#if defined(__AVX__) && __AVX__
174 +#define PACKAGE_VERSION __PACKAGE_VERSION " AVX1 [" __DATE__ "]"
175 +#else
176 +#if defined(__SSE__) && __SSE__
177 +#define PACKAGE_VERSION __PACKAGE_VERSION " SSE2 [" __DATE__ "]"
178 +#else
179 +#define PACKAGE_VERSION __PACKAGE_VERSION " IA32 [" __DATE__ "]"
180 +#endif
181 +#endif