case 'c':
@@ -766,14 +771,14 @@
if (brate == 0)
brate = bitrate[info->version][10];
- if (info->dab_extention)
+ if (info->dab_extension)
{
/* in 48 kHz */
/* if the bit rate per channel is less then 56
kbit/s, we have 2 scf-crc */
/* else we have 4 scf-crc */
/* in 24 kHz, we have 4 scf-crc, see main loop */
if (brate / (info->mode == MPG_MD_MONO ? 1 : 2) >= 56)
-
info->dab_extention = 4;
+
info->dab_extension = 4;
}
Logged In: NO
diff -u toolame-02i.orig/common.h toolame-02i/common.h
--- toolame-02i.orig/common.h Sat Jul 14 03:22:23 2001
+++ toolame-02i/common.h Fri Apr 26 17:15:14 2002
@@ -158,7 +158,8 @@
int version;
int lay;
int error_protection;
- int dab_extention;
+ int dab_extension;
+ int dab_length;
int bitrate_index;
int sampling_frequency;
int padding;
diff -u toolame-02i.orig/psycho_II.c toolame-02i/psycho_II.c
--- toolame-02i.orig/psycho_II.c Sat Jul 14 03:22:20 2001
+++ toolame-02i/psycho_II.c Thu Dec 13 11:19:17 2001
@@ -130,12 +130,25 @@
phi_prime = 2.0 * phi_sav[chn][old][j] -
phi_sav[chn][oldest][j];
r[chn][new][j] = sqrt ((double) energy[j]);
phi_sav[chn][new][j] = phi[j];
+#if defined __USE_GNU
+{
+// 12% faster
+//#warning "Use __sincos"
+double sphi, cphi, sprime, cprime ;
+
__sincos((double)phi[j], &sphi, &cphi);
+
__sincos((double)phi_prime, &sprime, &cprime);
+
temp1 = r[chn][new][j] * cphi - r_prime * cprime ;
+
temp2 = r[chn][new][j] * sphi - r_prime * sprime ;
+}
+#else
+//#warning "Don't use __sincos"
temp1 =
r[chn][new][j] * cos ((double) phi[j]) -
r_prime * cos ((double) phi_prime);
temp2 =
r[chn][new][j] * sin ((double) phi[j]) -
r_prime * sin ((double) phi_prime);
+#endif
temp3 = r[chn][new][j] + fabs ((double) r_prime);
if (temp3 != 0)
c[j] = sqrt (temp1 * temp1 + temp2 * temp2) / temp3;
@@ -320,12 +333,15 @@
switch (i)
{
case 32000:
+ case 16000:
sfreq_idx = 0;
break;
case 44100:
+ case 22050:
sfreq_idx = 1;
break;
case 48000:
+ case 24000:
sfreq_idx = 2;
break;
default:
diff -u toolame-02i.orig/toolame.c toolame-02i/toolame.c
--- toolame-02i.orig/toolame.c Sat Jul 14 03:22:20 2001
+++ toolame-02i/toolame.c Fri Apr 26 17:31:18 2002
@@ -179,18 +179,20 @@
#endif
adb = available_bits (&info, &glopts);
lg_frame = adb / 8;
- if (info.dab_extention)
+ if (info.dab_extension)
{
/* in 24 kHz we always have 4 bytes */
if (info.sampling_frequency == 1)
-
info.dab_extention = 4;
+
info.dab_extension = 4;
/* You must have one frame in memory if you are in DAB mode
*/
/* in conformity of the norme ETS 300 401
http://www.etsi.org */
/* see bitstream.c */
if (frameNum == 1)
minimum = lg_frame + MINIMUM;
-
adb -= info.dab_extention * 8 + 6 * 8;
+
adb -= info.dab_extension * 8 + info.dab_length * 8 + 16 ;
}
+ if (frameNum == 1)
+
open_bit_stream_w(&bs, encoded_file_name, lg_frame + minimum);
for (i = 0; i < 3; i++)
for (j = 0; j < SCALE_BLOCK; j++)
@@ -279,11 +281,11 @@
sample_encoding (*subband, bit_alloc, &fr_ps, &bs);
for (i = 0; i < adb; i++)
put1bit (&bs, 0);
- if (info.dab_extention)
+ if (info.dab_extension)
{
/* reserved 4 bytes for X-PAD in DAB mode
*/
-
putbits (&bs, 0, 32);
-
for (i = info.dab_extention - 1; i >= 0; i--)
+
putbits (&bs, 0, info.dab_length*8);
+
for (i = info.dab_extension - 1; i >= 0; i--)
{
CRC_calcDAB (&fr_ps, bit_alloc, scfsi, scalar, &crc, i);
/* this crc is for the previous frame in DAB mode
*/
@@ -427,7 +429,7 @@
fprintf (stdout, "\t-o mark as original\n");
fprintf (stdout, "\t-e add error protection\n");
fprintf (stdout, "\t-r force padding bit/frame off\n");
- fprintf (stdout, "\t-D add DAB extentions\n");
+ fprintf (stdout, "\t-D len add DAB extensions with
'len' bytes length\n");
fprintf (stdout, "Files\n");
fprintf (stdout,
"\tinput input sound file. (WAV,AIFF,PCM or use
'/dev/stdin')\n");
@@ -572,7 +574,7 @@
info->copyright = 0;
info->original = 0;
info->error_protection = FALSE;
- info->dab_extention = 0;
+ info->dab_extension = 0;
/* process args */
while (++i < argc && err == 0)
@@ -676,7 +678,10 @@
}
break;
case 'D':
-
info->dab_extention = 2;
+
argUsed = 1;
+
info->dab_length = atoi (arg);
+
info->error_protection = TRUE;
+
info->dab_extension = 2;
glopts.dab = TRUE;
break;
case 'c':
@@ -766,14 +771,14 @@
if (brate == 0)
brate = bitrate[info->version][10];
- if (info->dab_extention)
+ if (info->dab_extension)
{
/* in 48 kHz */
/* if the bit rate per channel is less then 56
kbit/s, we have 2 scf-crc */
/* else we have 4 scf-crc */
/* in 24 kHz, we have 4 scf-crc, see main loop */
if (brate / (info->mode == MPG_MD_MONO ? 1 : 2) >= 56)
-
info->dab_extention = 4;
+
info->dab_extension = 4;
}
@@ -810,10 +815,8 @@
parse_input_file (inPath, info, num_samples);
#endif
- if ((info->bitrate_index = BitrateIndex (brate,
info->version)) < 0)
- err = 1;
-
- open_bit_stream_w (&bs, outPath, BUFFER_SIZE);
+ if( (info->bitrate_index = BitrateIndex(brate,
info->version)) < 0)
+ usage();
}
@@ -839,11 +842,11 @@
IFF_AIFF pcm_aiff_data;
long soundPosition;
- char wave_header_buffer[40];
+ unsigned char wave_header_buffer[40];
int wave_header_read = 0;
int wave_header_stereo = -1;
int wave_header_16bit = -1;
- long samplerate;
+ unsigned long samplerate;
/*************************** STDIN
********************************/
/* check if we're reading from stdin. Assume it's a raw
PCM file. */
@@ -893,15 +896,8 @@
/* 8-11 = "WAVE" */
/* 22 = Stereo / Mono */
/* 01 = mono, 02 = stereo */
- /* 24 = Sampling Frequency */
- /* 17 = 11.025 kHz */
- /* ? 22 = 16.000 kHz */
- /* 34 = 22.050 kHz */
- /* 50 = 32.000 kHz */
- /* 68 = 44.100 kHz */
- /* -128 = 44.800 kHz */
- /* -110 = 5.500 kHz */
- /* 124 = 22.254 kHz */
+ /* 24-27 = Sampling Frequency */
+ /* in _littleEndian */
/* 32 = Data Rate */
/* 01 = x1 (8bit Mono) */
/* 02 = x2 (8bit Stereo or */
@@ -918,39 +914,26 @@
fprintf (stderr, "Parsing Wave File Header\n");
/* Wave File */
wave_header_read = 1;
- switch ((long) wave_header_buffer[24])
-
{
-
case 68:
-
/* 44.1 kHz */
-
samplerate = 44100;
-
fprintf (stderr, ">>> 44.1 Hz sampling freq selected\n");
-
break;
-
case -128:
-
/* 48.0 kHz */
-
samplerate = 48000;
-
fprintf (stderr, ">>> 48.0 Hz sampling freq selected\n");
-
break;
-
case 50:
-
/* 32.0 kHz *//********TO BE CHECKED!!*******/
-
samplerate = 32000;
-
fprintf (stderr, ">>> 32.0 Hz sampling freq selected\n");
-
break;
-
case 34:
-
/* 22.05 kHz */
-
fprintf (stderr, ">>> 22.05 kHz Sampling freq selected\n");
-
samplerate = 22050;
-
break;
-
case 22:
-
/* 16.0 kHz *//*********TO BE CHECKED!!*********/
-
fprintf (stderr, ">>> 16.0 kHz Sampling freq selected\n");
-
samplerate = 16000;
-
break;
-
default:
-
/* Unknown Unsupported Frequency */
-
fprintf (stderr, ">>> Unable to get samp freq from Wave
Header\n");
-
fprintf (stderr, ">>> Default 44.1 kHz samp freq selected\n");
-
samplerate = 44100;
-
}
+ if (NativeByteOrder == order_unknown)
+ {
+ NativeByteOrder = DetermineByteOrder ();
+ if (NativeByteOrder == order_unknown)
+ {
+ fprintf (stderr, "byte order not determined\n");
+ exit (1);
+ }
+ }
+ if (NativeByteOrder == order_littleEndian) {
+
samplerate = *(unsigned long*)(&wave_header_buffer[24]) ;
+ }
+ else {
+
samplerate = wave_header_buffer[27] +
+
(wave_header_buffer[26] << 8) +
+
(wave_header_buffer[25] << 16) +
+
(wave_header_buffer[24] << 24) ;
+ }
+
+ fprintf(stderr, ">>> %ld Hz Sampling freq
selected\n", samplerate);
if ((info->sampling_frequency =
SmpFrqIndex ((long) samplerate, &info->version)) < 0)
{