- This file is part of the BladeEnc MP3 Encoder, based on
- ISO's reference code for MPEG Layer 3 compression, and might
- contain smaller or larger sections that are directly taken
- from ISO's reference code.
+ This file is part of the BladeEnc MP3 Encoder, based on
+ ISO's reference code for MPEG Layer 3 compression, and might
+ contain smaller or larger sections that are directly taken
+ from ISO's reference code.
- All changes to the ISO reference code herein are either
- copyrighted by Tord Jansson (tord.jansson@swipnet.se)
- or sublicensed to Tord Jansson by a third party.
+ All changes to the ISO reference code herein are either
+ copyrighted by Tord Jansson (tord.jansson@swipnet.se)
+ or sublicensed to Tord Jansson by a third party.
- BladeEnc is free software; you can redistribute this file
- and/or modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+ BladeEnc is free software; you can redistribute this file
+ and/or modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
- - big fix: module - original dist10 error - l3_sb_sample has to be of type 'L3SBS' not 'SBS'.
- - bug fix: codecInit() - don't reset fInit-huffman_read_flag - read_huffcodetab() is a memory eater!
+ - big fix: module - original dist10 error - l3_sb_sample has to be of type 'L3SBS' not 'SBS'.
+ - bug fix: codecInit() - don't reset fInit-huffman_read_flag - read_huffcodetab() is a memory eater!
-static short buffer[2][1152];
-/* static float snr32[32]; */
-static short sam[2][2048];
+static short buffer[2][1152];
+/* static float snr32[32]; */
+static short sam[2][2048];
- int j;
-
- /* Read psIn */
-
- switch (psIn->frequency)
- {
- case 48000: info.sampling_frequency = 1; break;
- case 44100: info.sampling_frequency = 0; break;
- case 32000: info.sampling_frequency = 2; break;
- default : return FALSE;
- }
-
- switch (psIn->mode)
- {
- case 0: info.mode = MPG_MD_STEREO ; info.mode_ext = 0; break;
- case 2: info.mode = MPG_MD_DUAL_CHANNEL; info.mode_ext = 0; break;
- case 3: info.mode = MPG_MD_MONO ; info.mode_ext = 0; break;
- default: return FALSE;
- }
-
- j = 0;
- while (j < 15 && bitratex[1][j] != psIn->bitrate)
- j++;
- info.bitrate_index = j;
-
- info.version = 1; /* Default: MPEG-1 */
- info.emphasis = psIn->emphasis;
- info.extension = psIn->fPrivate;
- info.copyright = psIn->fCopyright;
- info.original = psIn->fOriginal;
- info.error_protection = psIn->fCRC;
+ int j;
+
+ /* Read psIn */
+
+ switch (psIn->frequency)
+ {
+ case 48000: info.sampling_frequency = 1; break;
+ case 44100: info.sampling_frequency = 0; break;
+ case 32000: info.sampling_frequency = 2; break;
+ default : return FALSE;
+ }
+
+ switch (psIn->mode)
+ {
+ case 0: info.mode = MPG_MD_STEREO ; info.mode_ext = 0; break;
+ case 2: info.mode = MPG_MD_DUAL_CHANNEL; info.mode_ext = 0; break;
+ case 3: info.mode = MPG_MD_MONO ; info.mode_ext = 0; break;
+ default: return FALSE;
+ }
+
+ j = 0;
+ while (j < 15 && bitratex[1][j] != psIn->bitrate)
+ j++;
+ info.bitrate_index = j;
+
+ info.version = 1; /* Default: MPEG-1 */
+ info.emphasis = psIn->emphasis;
+ info.extension = psIn->fPrivate;
+ info.copyright = psIn->fCopyright;
+ info.original = psIn->fOriginal;
+ info.error_protection = psIn->fCRC;
- fInit_iteration_loop = 0;
-/* DON'T DO THAT ALL THE TIME
- fInit_huffman_read_flag = 0;
+ fInit_iteration_loop = 0;
+/* DON'T DO THAT ALL THE TIME
+ fInit_huffman_read_flag = 0;
memset((char *) buffer, 0, sizeof(buffer));
/* memset((char *) snr32, 0, sizeof(snr32));*/
#if ORG_BUFFERS
memset((char *) buffer, 0, sizeof(buffer));
/* memset((char *) snr32, 0, sizeof(snr32));*/
#if ORG_BUFFERS
- fr_ps.stereo = (info.mode == MPG_MD_MONO) ? 1 : 2;
- fr_ps.sblimit = SBLIMIT;
- fr_ps.jsbound = SBLIMIT;
+ fr_ps.stereo = (info.mode == MPG_MD_MONO) ? 1 : 2;
+ fr_ps.sblimit = SBLIMIT;
+ fr_ps.jsbound = SBLIMIT;
- ((double) SAMPLES_PER_FRAME / s_freq[1][info.sampling_frequency]) *
- ((double) bitratex[1][info.bitrate_index] / 8.0);
+ ((double) SAMPLES_PER_FRAME / s_freq[1][info.sampling_frequency]) *
+ ((double) bitratex[1][info.bitrate_index] / 8.0);
- static double xr[2][2][576];
- static double xr_dec[2][2][576];
- static double pe[2][2];
- static int l3_enc[2][2][576];
- static III_psy_ratio ratio;
- static III_scalefac_t scalefac;
- int gr, ch;
- int mean_bits, sideinfo_len;
- int bitsPerFrame;
- int j;
+ static double xr[2][2][576];
+ static double xr_dec[2][2][576];
+ static double pe[2][2];
+ static int l3_enc[2][2][576];
+ static III_psy_ratio ratio;
+ static III_scalefac_t scalefac;
+ int gr, ch;
+ int mean_bits, sideinfo_len;
+ int bitsPerFrame;
+ int j;
- static int fFirst = TRUE;
-
- if (fFirst)
- {
- memset ((char *) &xr , 0, sizeof(xr));
- memset ((char *) &xr_dec , 0, sizeof(xr_dec));
- memset ((char *) &pe , 0, sizeof(pe));
- memset ((char *) &l3_enc , 0, sizeof(l3_enc));
- memset ((char *) &ratio , 0, sizeof(ratio));
- memset ((char *) &l3_side , 0, sizeof(l3_side));
- memset ((char *) &scalefac, 0, sizeof(scalefac));
-
- fFirst = FALSE;
- }
+ static int fFirst = TRUE;
+
+ if (fFirst)
+ {
+ memset ((char *) &xr , 0, sizeof(xr));
+ memset ((char *) &xr_dec , 0, sizeof(xr_dec));
+ memset ((char *) &pe , 0, sizeof(pe));
+ memset ((char *) &l3_enc , 0, sizeof(l3_enc));
+ memset ((char *) &ratio , 0, sizeof(ratio));
+ memset ((char *) &l3_side , 0, sizeof(l3_side));
+ memset ((char *) &scalefac, 0, sizeof(scalefac));
+
+ fFirst = FALSE;
+ }
- rebuffer_audio (buffer, pSamples, nSamples, stereo);
+ rebuffer_audio (buffer, pSamples, nSamples, stereo);
- rebuffer_audio (pSamples, buffer, &buffer_idx, nSamples, stereo);
+ rebuffer_audio (pSamples, buffer, &buffer_idx, nSamples, stereo);
- mdct_sub (&l3_sb_sample, xr, stereo, &l3_side, 2);
+ mdct_sub (&l3_sb_sample, xr, stereo, &l3_side, 2);