### LAME Library Usage Example Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Demonstrates using LAME as a library by setting encoding parameters directly and handling file I/O externally. Examples can be found in main.c, mp3rtp.c, or mp3x.c. ```c // Example of linking with libmp3lame.a // See main.c, mp3rtp.c, mp3x.c for API usage. ``` -------------------------------- ### LAME MP3 Encoding: libsndfile Integration Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Adds support for [LIBSNDFILE](http://www.zip.com.au/%7Eerikd/libsndfile), allowing LAME to encode a wider range of sound formats. This feature was developed by Albert Faber and includes getting libsndfile running under win32. ```c // Code related to libsndfile integration (not provided in text) // Example: Reading audio data using libsndfile ``` -------------------------------- ### Jan Peman's Quantanf_init Speedup Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Implementation of Jan Peman's quantanf_init speedup, which is currently in progress. ```C Putting in Jan Peman's quantanf_init speedup. ``` -------------------------------- ### LAME MP3 Encoder: Default Output Suffix Change Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html When no output filename is explicitly provided, LAME now automatically replaces common file suffixes with `.mp3` or `.wav` based on the input. For example, `lame x.wav` will create `x.mp3`. ```C /* Changed behaviour: LAME replaces common suffixes by MP3/WAV when no output filename was given. For example, a simple lame x.wav will create output file x.mp3 */ ``` -------------------------------- ### LAME Command-Line Options Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Adds the --help option to display usage information to standard output. Also includes the --noath option to disable ATH maskings. ```bash --help --noath ``` -------------------------------- ### LAME 3.93.1: Preset and Link Fixes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This entry details fixes in LAME version 3.93.1, including the addition of the 'medium' preset to the DLL interface and corrections for ABR/CBR presets and the -q0 switch. It also addresses a link problem on systems where socket() resides in libsocket. ```bash # Preset medium added to the dll interface # Fix for abr/cbr presets # Fix -q0 switch # Fix link problem on systems where socket() resides in libsocket (Alexander Leidinger) ``` -------------------------------- ### Code Cleanup and Prototyping Changes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Performs code cleanup, changes K&R prototyping to the 'normal' format, converts C++ style comments to C comments in huffman.c, removes an annoying #warning from psy_data.h, and removes a reference to malloc.h in bitstream.c, replacing it with stdlib.h. ```C m11 * No speedups. Just cleaned up some bits of the code. * Changed K&R prototyping to 'normal' format. Thanks to Steffan Haeuser for his help here. * Changed some C++ style comments to normal C comments in huffman.c * Removed the #warning from psy_data.h (it was getting annoying!) * Removed reference in bitstream.c to malloc.h. Is there a system left where malloc.h hasn't been superceded by stdlib.h? ``` -------------------------------- ### LAME ReplayGain Analysis (Preliminary) Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Preliminary code for ReplayGain analysis has been added to LAME. While not fully functional yet, it indicates future support for audio normalization based on perceived loudness. ```c // Preliminary ReplayGain analysis code // Not functional yet ``` -------------------------------- ### LAME Configuration Script Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This marks the integration of a `./configure` script for LAME, simplifying the build process across different Unix-like systems. This script automates the detection of system features and sets up the build environment. ```Shell # LAME finally has a ./configure script!! # Example usage: # ./configure # make # make install ``` -------------------------------- ### LAME 3.91: Preset and Distribution Fixes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This section details fixes in LAME version 3.91, including a bugfix for '--alt-preset' related to low-volume content and clean vocals, and the addition of '--alt-preset' to the man page. It also mentions the inclusion of missing files in the distribution. ```bash # Bugfix for --alt-preset (for content with low volume, clean vocals), only important for the "fast standard" preset (Darin Morrison) # Add some missing files to the distribution (Alexander Leidinger) # Add --alt-preset to the man page (Alexander Leidinger) ``` -------------------------------- ### LAME Build Fixes and Workarounds Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Includes fixes for FFMPEG bugs, Windows program icon and version info addition (VC9), and resolution of issues related to Microsoft Visual Studio 6, documentation, resampling, Windows API changes, UNICODE definition, ID3v2 tags, padding values, and NASM support. ```C // Workaround for FFMPEG bug, which uses to call lame_encode_flush more than once in a loop. // Windows: program icon and version info added (when building with VC9) // Fix for Bugtracker item _[ 2688413 ] lib name problem in Microsoft Visual Studio 6_ // Fix for Bugtracker item _[ 2723518 ] resampling in 3.98 and 3.99alpha_ // Fix for Bugtracker item _[ 2893101 ] Access Violation in BladeMP3EncDLL if UNICODE was defined._ // Fix for Bugtracker item _[ 2887359 ] Wrong length in ID3v2 tag when num_samples isn't set_ // Fix for Bugtracker item _[ 2807676 ] Error when building Lame with NASM support_ ``` ```Shell // Update the debian packaging for the new release. ``` ```C // Fix for Bugtracker item _[ 2891879 ] Because of Windows API change, there was a problem with the **prority** switch._ // Fix for Bugtracker item _[ 2872590 ] LameTAG: "Music length" missmatch in LAME 3.98_ // Fix for Bugtracker item _[ 2824296 ] wrong enc_padding value in LAME 3.99a and 3.98.3 (from CVS)_ ``` ```C // Patch submitted by Mancuso Raffaele, tracker item _[ 2406420 ] compile lame_enc.dll under cygwin_ ``` -------------------------------- ### LAME 3.16beta: Window Switching and Bit Allocation Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Introduces new tunings for window switching and improved bit allocation based on perceptual entropy (pe). These enhancements benefit audio quality, particularly for test signals like testsignal2.wav and testsignal4.wav. ```c /* New tunings for window switching */ /* Better bit allocation based on pe */ ``` -------------------------------- ### LAME: Fix compilation of frontend mp3rtp.c Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Addresses a compilation issue in the frontend `mp3rtp.c` file, resolving a missing `uint16_t` definition for LAME 3.98. ```c #include // ... other code ... // Example usage of uint16_t uint16_t my_variable = 100; ``` -------------------------------- ### LAME Makefile for Borland C++ Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Instructions and a Makefile were provided for compiling LAME using the free Borland C++ compiler, including support for compiling `lame_enc.dll`, although this was noted as untested. ```Makefile # README and Makefile for (free) Borland C++ compiler. # Example Makefile entry: # all: lame.exe lame_enc.dll # lame.exe: lame.obj $(CC) $(LDFLAGS) lame.obj -o lame.exe lame_enc.dll: lame.obj $(CC) $(LDFLAGS) -shared lame.obj -o lame_enc.dll lame.obj: lame.c $(CC) $(CFLAGS) -c lame.c ``` -------------------------------- ### LAME: Add --pad-id3v2-size switch for ID3v2 padding Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Introduces a new switch, `--pad-id3v2-size "n"`, which allows users to add ID3v2 tags with a specified number of padding bytes. ```shell lame --pad-id3v2-size 100 input.wav output.mp3 ``` -------------------------------- ### LAME Huffman Initialization Bug Fix Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html A bug in the `huffman_init` function was corrected, which could potentially lead to segmentation faults, particularly at lower sample rates. This fix enhances stability. ```C // Fix bug in huffman_init // void huffman_init(HuffmanTable* table) { // // Initialization logic, ensuring no out-of-bounds access // } ``` -------------------------------- ### LAME 3.93: VBR, Presets, and Assembly Switches Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This entry covers VBR fixes, preset merging, and the introduction of a '--noasm' switch in LAME version 3.93. The '--noasm' switch is intended to help users with Cyrix/Via processors. ```bash # Some fixes for VBR (Robert Hegeman) # --noasm switch. Might help Cyrix/Via users (Gabriel Bouvigne) # Presets and alt-presets merged (Gabriel Bouvigne) ``` -------------------------------- ### LAME 3.94 Beta: VBR and Tagging Fixes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This entry covers fixes related to Variable Bit Rate (VBR) headers and tagging in LAME version 3.94 beta. It also mentions the ability to compute ReplayGain and detect clipping on the fly, storing the ReplayGain value in the Lame tag. ```bash # Fixed issues in VBR header (Mark Taylor / Gabriel Bouvigne) # Workaround against some hardware decoder defficiencies (Mark Taylor) # Ability to compute the "Radio" ReplayGain and detect clipping on the fly. The ReplayGain value is stored in the Lame tag. (Aleksander Korzynski) ``` -------------------------------- ### LAME 3.97: Release and Bug Fixes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This entry covers the official release of LAME 3.97, which was previously beta 3. It also includes bug fixes from earlier beta versions related to initialization errors, assertion failures, ATH adjustments, bit reservoir usage, and ReplayGain analysis speed. ```C /* LAME 3.97 beta 3 becomes 3.97 */ /* Gabriel Bouvigne: * Workaround against a short blocks detection issue */ /* Gabriel Bouvigne: * Fixed an initialization error when input is not using a standard sampling frequency * Fixed a possible assertion failure in very low bitrate encoding * Slight change regarding ATH adjustment with V5 * Reinstated bit reservoir for 320kbps CBR * ReplayGain analysis should now be faster when encountering silent parts */ /* Takehiro Tominaga: * Fixed a possible link problem of assembly code */ ``` -------------------------------- ### LAME 3.15beta: Fast Mode Initialization Fix Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Corrects an issue with uninitialized pe[] when using the fast mode, ensuring proper operation and preventing potential errors. ```c /* Fixed uninitialized pe[] when using fast mode */ ``` -------------------------------- ### Cleanup l3psy.c and Optimize Matrix Multiply Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Cleans up bits in l3psy.c and replaces a sparse matrix multiply with a hand-configured unrolling, tagged as PSYD. ```C m2 - Cleaned up a few bits in l3psy.c. Replaced a sparse matrix multiply with a hand configured unrolling [PSYD] ``` -------------------------------- ### LAME MP3 Encoding: Documentation Updates Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Includes updates to HTML documentation and a Unix man page, contributed by Gabriel Bouvigne and William Schelter, respectively. These updates improve user understanding and usability. ```html ``` ```man # Example man page snippet (not provided in text) # LAME(1) "Manual page for the LAME MP3 encoder" ``` -------------------------------- ### LAME 3.98 beta 1: ID3v2 and VBR Enhancements Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This section details updates in LAME 3.98 beta 1, including added support for TLEN and total tracks per album in ID3v2, improvements to the VBR encoding routine, and fixes for memory leaks and array overflows. It also mentions updates to build system files and compiler intrinsics. ```C /* Alexander Leidinger: * Add TLEN (ID3v2) support (Submitted by: Linus Walleij). * Add number of total tracks per album (ID3v2) support (Submitted by: Kyle VanderBeek). * Some seatbelts for overflowing arrays in the ID3v2 support. * Update the RPM spec (Submitted by: Kyle VanderBeek). * Fix some mem-leaks in the error case. * Update to newer autotools versions. * Update to use a recent libsndfile (submitted by libsndfile author). * Intrinsics support enabled for gcc */ /* Robert Hegemann: * The newer VBR code is now LAME's default VBR routine * Fixed: in case of not enough bits the new vbr code incorrectly used old vbr routine * Improved ATH adjustment in low volume cases * Fixed (PSY model): mapping from convolution bands to partition bands was broken since we replaced tables by own calculation several years ago * Fixed (PSY model): loss of fraction in equal loudness weighting * Fixed (PSY model): in NSPSY highpass filter, out of bounds access in fircoef * Known problem samples for the new VBR code: many of them are at an acceptable quality level now; with a big 'Thank You' to Francis Niechcial * Modified VBR strategy to handle out of bits cases * Restricted bitreservoir size for 320 kbps frames to the size used for sideinfo, because of decoding problems with FhG decoders installed on almost every Windows system * LAME aborts on unsupported input files or unrecognized parameter options passed more often now * Bug tracker item: [ 1596306 ] "fatal error during initialization"; an invalid MPEG samplerate was returned by optimum_samplefreq function * Bug tracker item: [ 1585942 ] lame not --silent when TERM not set; in case LAME was build with TERMCAP defined and no TERM environment is defined, now we do not issue an error message and silently fallback to the default behaviour as if LAME was compiled without TERMCAP defined. * Bug tracker item: [ 1711980 ] LAME writes invalid Xing header when ID3 tags exist; LAME was sometimes writing an invalid Xing/Info header * Feature request: [ 1588283 ] Flushing output stream in lame.exe; 'flush' option added * Added FFTSSE and FFT3DNOW assembler code from Lame4 branch * Changes in lame frontend switches: -k removed, add lowpass and highpass switches if you need to change them; --short/noshort/allshort - degraded into DEVELOPER ONLY switches normal users shouldn't use them; -X -Z degraded to DEVELOPER ONLY switches, -X is too tough to communicate to end users and -Z isn't used actualy * Fixed some console printing problems * Windows: ACM code now uses LAME library API only, all references to private include files are removed * Windows: DirectShow code now uses LAME library API only, all references to private include files are removed * Windows: disabled code that resets processor affinity, because this doesn't belong to LAME, but seems to work around some problems the parent process has (in most cases EAC) */ /* John33: * Fixed mp2 and mp3 decoding: For mp3 and mp2 decoding, this now yields the same output as foobar2000 but the error checking remains unchanged */ /* Gabriel Bouvigne: * VC8 project files * Added support for x64 under VC8 * Restricted MPEG 2.5 to 64kbps frames */ /* Takehiro Tominaga: * SSE version of FFT */ ``` -------------------------------- ### LAME: Support WAVE_FORMAT_EXTENSIBLE (PCM) Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Adds support for the `WAVE_FORMAT_EXTENSIBLE` format, specifically for PCM data, improving compatibility with modern audio formats. ```c #define WAVE_FORMAT_EXTENSIBLE 0xFFFE // Structure for WAVEFORMATEX typedef struct { WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; } WAVEFORMATEX; // Structure for WAVEFORMATEXTENSIBLE typedef struct { WAVEFORMATEX Format; union { WORD wValidBitsPerSample; WORD wSamplesPerBlock; }; DWORD dwChannelMask; BYTE SubFormat[16]; } WAVEFORMATEXTENSIBLE; ``` -------------------------------- ### LAME 3.16beta: Audio I/O Overhaul Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html The audio input/output code has been overhauled to provide a uniform interface to libsndfile or LAME's built-in routines. All audio I/O is now localized in get_audio.c. ```c /* Overhauled audio I/O code */ /* Uniform audio I/O interface to libsndfile or LAME routines */ /* All audio I/O code localized to get_audio.c */ ``` -------------------------------- ### LAME: Add resampling hooks and options Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Introduces hooks and options for resampling audio within LAME. The implementation of buffering and resampling routines is pending. ```c /* Resampling hooks and options added. Buffering and resampling routines need to be written. */ ``` -------------------------------- ### LAME MP3 Encoding: Quantization Improvements Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Includes improvements to quantization speed and logic. Specifically, `bin_search_stepsize` is limited to a quantizationStepSize of -210 through 45, and `outer_loop()` can now vary Mid & Side scalefactors independently for potentially better quantizations, albeit slower. ```c // Code related to quantization improvements (not provided in text) // Example: Optimizing quantization algorithms ``` -------------------------------- ### Raw PCM Support and Byte-Ordering Switch Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Restores raw PCM support and adds a byte-ordering switch for raw PCM reading to handle potential endianness issues. ```C m4 - raw pcm support back in ``` ```C m5 - put in a byte-ordering switch for raw PCM reading (just in case) ``` -------------------------------- ### LAME Free Format Bitstream Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Explains how to create free format bitstreams with LAME, allowing for any integer bitrate between 8 and 320 kbps. This is achieved using the --freeformat flag and the -b option. ```bash lame --freeformat -b ``` -------------------------------- ### Advanced Noise Shaping with LAME Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html LAME offers a new noise shaping mode, enabled via the -q0 option, which provides more cutting-edge shaping based on psychoacoustic masking. This can lead to better quality at lower bitrates. ```bash lame -q0 input.wav output.mp3 ``` -------------------------------- ### LAME 3.16beta: Performance Optimizations Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Includes speedups in various functions like window_subband, calc_noise1, calc_noise2, and quantize_xrpow. The quantize_xrpow speedup is expected to be significant on non-GNU/Intel systems. ```c /* Speedups in window_subband, calc_noise1, calc_noise2 */ /* Significant speedup in quantize_xrpow on non-GNU/Intel systems */ ``` -------------------------------- ### LAME ISO Table Data Replaced by Formulas Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html All ISO table data has been replaced by formulas. This change is expected to improve MPEG2.5 results, as the previous table data was incorrect for this standard. ```C // All ISO table data replaced by formulas - should improve MPEG2.5 results // float get_iso_value(int band_index, int mpeg_version) { // // Calculate values using formulas instead of lookup tables // } ``` -------------------------------- ### ASM FFT for m68k Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Adds an assembly FFT for m68k (Amiga only), based on sources from Henryk Richter and Stephane Tavenard. This is part of the m3 optimizations. ```Assembly m3 - (amiga only) Added in the asm FFT for m68k (based on sources from Henryk Richter and Stephane Tavenard) ``` -------------------------------- ### LAME MSVC Compilation Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Instructions for compiling LAME executables and DLLs using MSVC. Requires defining specific preprocessor macros like LAMEPARSE, LAMESNDFILE, and HAVEMPGLIB. ```c // MSVC project file settings: // Define LAMEPARSE, LAMESNDFILE, HAVEMPGLIB, HAVEGTK as needed. ``` -------------------------------- ### LAME Compression Ratio Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Demonstrates how to specify a compression ratio instead of a bitrate when encoding with LAME. The `--comp` argument is used for this purpose, with a default ratio of 11.0. ```bash lame --comp ``` -------------------------------- ### LAME Decoding WAV Output Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Details a fix for LAME's `--decode` option where the output .wav file was written with an incorrect filesize. The issue is now resolved. ```bash lame --decode input.wav output.wav ``` -------------------------------- ### LAME: Accept floating point VBR quality setting Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Allows LAME to accept floating-point values between 0 and 10 for VBR quality settings, offering finer control over compression. ```shell lame -V5.678 input.wav output.mp3 ``` -------------------------------- ### Replacement for filterbank.c Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Introduces a new replacement for the 'filterbank.c' file. While not significantly faster, this new implementation is noted for its simplicity. ```c /* replacement for filterbank.c. Not much faster but amazingly simpler. */ ``` -------------------------------- ### LAME: New VBR psymodel with different spreading function and bug fixes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Updates to the new VBR psymodel, including a different spreading function and fixes for out-of-bounds array access that could cause stack corruption. ```c // Conceptual VBR psy model parameters struct PsyModelParams { float spreading_function_param; // ... other parameters ... }; // Function to calculate VBR data (example) // void calculate_vbr_data(AudioFrame* frame, PsyModelParams* params, VbrData* vbr_data) { // // Ensure array accesses are within bounds // } ``` -------------------------------- ### Compiler Options and pow20() Function Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Reduces encoding time by selecting additional compiler options. Introduces a pow20() function in l3loop.c to slightly speed up calls to pow(2.0, x). ```C m10 - Down to 106 seconds by selecting a few more compiler options. Also added a pow20() function in l3loop.c to speed up (ever so slightly) calls to pow(2.0, x) ``` -------------------------------- ### LAME 3.16beta: WAV Header Parsing Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Enhances WAV header parsing to fix bugs related to clicks in the first frame. This ensures proper handling of WAV files during encoding. ```c /* More detailed WAV header parsing */ /* Fixes bugs involving click in first frame */ ``` -------------------------------- ### LAME Nogap Support Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html LAME includes support for '--nogap', which is designed to prevent gaps between tracks when encoding consecutive audio files. This is particularly useful for creating gapless albums. ```bash lame --nogap input1.wav input2.wav output.mp3 ``` -------------------------------- ### LAME Modularization and Code Cleanup Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Mentions modularization efforts in LAME 3.23beta and 3.22beta. In 3.23beta, the encoding engine could be compiled into libmp3lame, though the interface was noted as awkward. Version 3.22beta included more modularization and code cleanup from Albert Faber and others. ```c /* LAME 3.23beta - More modularization work. The encoding engine can now be compiled into libmp3lame */ // Example of how an encoding engine might be exposed as a library // In libmp3lame.h: // typedef void* LameEncoderHandle; // LameEncoderHandle lame_init(const LameConfig* config); // int lame_encode_frame(LameEncoderHandle handle, AudioData* audio, unsigned char* buffer, int buffer_size); // void lame_close(LameEncoderHandle handle); // In main LAME executable, it would use these library functions. ``` ```c /* LAME 3.22beta - More modularization and code cleanup from Albert Faber and myself. */ // Example of code cleanup: separating concerns into different functions/modules // Before cleanup (hypothetical): // void process_frame(FrameData* fd) { // // encode audio // // calculate psychoacoustics // // manage bitstream // // write output // } // After cleanup (hypothetical): // void encode_audio_data(FrameData* fd) { /* ... */ } // void calculate_psychoacoustics(FrameData* fd) { /* ... */ } // void manage_bitstream(FrameData* fd) { /* ... */ } // void write_output_buffer(FrameData* fd) { /* ... */ } // // void process_frame(FrameData* fd) { // encode_audio_data(fd); // calculate_psychoacoustics(fd); // manage_bitstream(fd); // write_output_buffer(fd); // } ``` -------------------------------- ### LAME: Microsoft nmake makefile Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Includes a Microsoft nmake compatible makefile and other adjustments for use with MSVC. This contribution was made by Mathew Hendry. ```makefile /* Mathew Hendry: Microsoft nmake makefile and a couple other changes for MSVC */ ``` -------------------------------- ### Rework FFT Implementation Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Completely rewrites the fft.c file, resulting in a 10-15% faster FFT. The new C FFT routine is faster than the previous assembly version on an m68k. ```C m6 - reworked the whole fft.c file. fft now 10-15% faster. ``` ```C m7 - totally new fft routine. exploits fact that this is a real->complex fft. About twice as fast as previous fastest fft (in m6). (C fft routine is faster than the asm one on an m68k!) ``` -------------------------------- ### LAME Bug Fixes: FFT Hann Window, get_audio.c, and Uninitialized Variables Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Lists bug fixes in LAME 3.23beta and 3.20beta. Leonid A. Kulakov fixed a bug in the FFT Hann window formula. Miguel Revilla Rodriguez noted issues in get_audio.c compilation, and Nils Faerber fixed uninitialized variables and computations in filter_subband that caused segfaults. ```c /* LAME 3.23beta - Bug fixed in FFT Hann window formula (Leonid A. Kulakov). */ // Function to calculate Hann window values float calculate_hann_window(int n, int N) { // Original potentially buggy formula might have been: // return 0.5 * (1.0 - cos(2.0 * M_PI * n / N)); // Corrected formula (example): return 0.5 * (1.0 - cos(2.0 * M_PI * (float)n / (N - 1))); } ``` ```c /* LAME 3.20beta - Nils Faerber found some uninitialized variables and some wierd extranous computations in filter_subband, now fixed. */ // Hypothetical fix in filter_subband void filter_subband(Subband* subband) { float temp_var; // Ensure initialized temp_var = 0.0; // ... existing filtering logic ... // Fix: Remove extraneous computations or ensure variables are initialized // Example: Ensure 'result' is initialized before use float result = 0.0; // ... calculations using result ... subband->filtered_value = result; } ``` -------------------------------- ### LAME Encoder: Improved User Interface and WAV Header Handling Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Enhances user input/output and implements rudimentary WAV file reading. The encoder now recognizes WAV headers and skips them, assuming a 16-bit stereo 44.1 kHz format. ```c // User input/output has been cleaned up a bit. WAV file reading is there in a very rudimentary sense ie the program will recognize the header and skip it, but not read it. The WAV file is assumed to be 16bit stereo 44.1 kHz. ``` -------------------------------- ### Cleanup Window Subband Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Minor cleanup of the window_subband function, tagged as WINDST2. ```C m2 - minor cleanup of window_subband [WINDST2] ``` -------------------------------- ### LAME: libmp3lame API for separate LAME/Xing and ID3 data retrieval Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html The libmp3lame API is updated to allow frontends to retrieve LAME/Xing and ID3 data separately, improving flexibility for buffered encodes. ```c // Conceptual API functions // GetLameHeaderData(...); // GetId3TagData(...); ``` -------------------------------- ### LAME MP3 Encoder: Fix WFED and PCST Frames for iTunes Tagging Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Enables the addition of WFED and PCST frames, allowing LAME to tag podcasts in a format recognized by iTunes. This also includes support for USER frames and improved handling of COMM frames. ```C /* WFED and PCST frames can now be added, to tag podcasts iTunes recognizes */ /* USER frames are now supported */ /* COMM frames can now have a description, when passed via --tv "COMM=description=full text" */ ``` -------------------------------- ### LAME Decoder Usage Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Demonstrates how to use the LAME executable as a decoder to convert MP3 files to raw PCM output. It specifies the input MP3 file and the output PCM file. ```bash lame --decode input.mp3 output.pcm ``` -------------------------------- ### LAME Encoder: WAV File Reading and Memory Allocation Fixes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Fixes a bug where all PCM files were incorrectly read as WAV files. It also addresses a memory allocation issue under AmigaOS by allocating more memory than needed and explores replacing individual `mem_alloc()` calls with direct `malloc()` where appropriate. The quality switch '-q' is reinstated. ```c // Fixed up bug: all PCM files were being read as WAV. // Played with the mem_alloc routine to fix crash under amigaos (just allocating twice as much memory as needed). Might see if we can totally do without this routine. Individual malloc()s where they are needed instead // Put Jan Peman's quality switch back in. This reduces quality via the '-q ' switch. Fun speedup which is mostly harmless if you're not concerned with quality. ``` -------------------------------- ### Enable resampling from MP3 input files Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Adds functionality to resample audio directly from MP3 input files. However, the lack of a lowpass filter for this process means results may not be optimal. ```c /* Resampling from an MP3 input file now works. But we still dont have a lowpass filter so dont expect good results. */ ``` -------------------------------- ### LAME: New VBR psy model derived from NSPSY with tuning Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Introduces a new psy model for VBR encoding, derived from NSPSY and further tuned for improved audio quality. Thanks to Horst Albrecht and Myles Thaiss. ```c // Conceptual psy model structure struct NspsyModel { // NSPSY parameters and tuning adjustments }; // Function to initialize the psy model // NspsyModel* initialize_nspsy_model(); ``` -------------------------------- ### LAME 3.13: BeOS and OS/2 Patches Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Includes patches for BeOS and Makefile information for OS/2 Warp 4.0, expanding LAME's compatibility with different operating systems. ```c /* Patches for BeOS */ /* Makefile info for OS/2 Warp 4.0 */ ``` -------------------------------- ### LAME: Frontends write final ID3 tags and LAME/Xing header frame Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Frontends are updated to write their own final ID3 tags and the LAME/Xing header frame, streamlining the encoding process. ```c // Conceptual frontend logic // write_id3_tags(output_file, tag_data); // write_lame_xing_header(output_file, header_data); ``` -------------------------------- ### LAME Encoder: Byte Order Swap and Memory Routine Cleanup Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Adds a new command-line switch (-x) to force byte order swapping and cleans up memory routines in `l3psy.c`. Memory allocation and freeing are now consolidated to improve efficiency. A compile-time switch `-DTIMER` is also included for timing information. ```c // Added new command line switch (-x) to force swapping of byte order // Cleaned up memory routines in l3psy.c. All the mem_alloc() and free() routines where changed so that it was only done _once_ and not every single time the routine was called. // Added a compile time switch -DTIMER that includes all timing info. It's a switch for the time being until some other people have tested on their system. Timing code has a tendency to do different things on different platforms. ``` -------------------------------- ### LAME 3.93: Build System and Compiler Fixes Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This section addresses build system updates and compiler-related fixes in LAME version 3.93. It includes updates to autoconf, detection of GCC versions, compilation of shared libraries on BeOS, and specific switches and fixes for various architectures and compilers. ```bash # Update to autoconf 2.53, rewrite some configure tests (Alexander Leidinger) # Determine gcc version even with gcc 3.1 (Akos Maroy) # Compile shared libs on BeOS (and perhaps other arches) (Andrew Bachmann) # Ultrasparc switches for gcc 3.1 # Fixes for SunOS 4.x # Fixes for 64bit arches # CFLAGS fix for IRIX # Don't override CFLAGS if exptopt isn't requested ``` -------------------------------- ### Encode from stdin and Speed/Quality Switch Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Enables encoding from stdin by using '-' as the input filename. Introduces a speed/quality switch ('-q') that increases speed at a slight quality decrease. Encoding time can be significantly reduced at higher quality settings (e.g., '-q 100'). ```C m8 * Now encodes from stdin. Use '-' as the input filename. Thanks to Brad Threatt * Worked out that the 1024point FFT only ever uses the first 6 phi values, and the first 465 energy values. Saves a bunch of calculations. * Added a speed-up/quality switch. Speed is increased but quality is decreased _slightly_. My ears are bad enough not to be able to notice the difference in quality at low settings :). Setting '-q 1' improves speed by about 10%. '-q 100' improves speed by about 26%. Enoding of my test track goes from 111s (at default '-q 0') to 82s (at -q 100). Thanks to Jan Peman for this tip. ``` -------------------------------- ### LAME Strict ISO Enforcement Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Shows how to enforce strict ISO compliance in LAME's bitstream handling, which can be reactivated using the `--strictly-enforce-ISO` option. This is relevant for high bitrate scenarios. ```bash lame --strictly-enforce-ISO ``` -------------------------------- ### LAME 3.94 Beta: Preset and Silence Detection Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This section highlights changes in LAME version 3.94 beta concerning presets and silence detection. Presets are now used by default for CBR/ABR and VBR encoding, and analog silence detection has been implemented in partitionned sfb21. ```bash # Use presets by default for cbr/abr # Use presets by default for vbr # Analog silence detection in partitionned sfb21 # Do not compute noise in upper 0 part of the spectrum # Only compute noise in modified scalefactor bands ``` -------------------------------- ### LAME: Fix --id3v1-only not working in 3.98-final Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Resolves a bug where the `--id3v1-only` switch did not function correctly in the 3.98-final release of LAME. ```shell lame --id3v1-only input.wav output.mp3 ``` -------------------------------- ### LAME MP3 Encoding: Bug Fixes and Stability Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Details various bug fixes, including a segfault in the frame analyzer, a bug in `inner_loop` allowing invalid quantizations, and a `numlines[]` bug. Also mentions Linux segfaulting on floating-point exceptions to prevent releasing unstable binaries. ```c // Code related to bug fixes and stability (not provided in text) // Example: Assertions and error checking ``` -------------------------------- ### LAME 3.12pre8: Sync Delay and MP3x Analyzer Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html A 56-sample delay has been added to sync LAME with the FhG encoder. Additionally, the MP3x frame analyzer can now handle MPEG2 streams. ```c /* Added 56 sample delay to sync LAME with FhG */ /* MP3x (frame analyzer) can now handle MPEG2 streams */ ``` -------------------------------- ### LAME: Assembler quantize_xrpow for Windows Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Includes an assembler implementation of the 'quantize_xrpow' function specifically for Windows. This optimization was contributed by Mathew Hendry. ```assembly /* Mathew Hendry: assembler quantize_xrpow for Windows */ ``` -------------------------------- ### LAME: Enable DirectShow filter to connect to File Writer Filter Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Configures the LAME DirectShow filter to allow connections with the 'File Writer Filter', facilitating integration into DirectShow pipelines. ```cpp // Conceptual DirectShow filter setup // Assume 'pLameFilter' is a pointer to the LAME filter // Assume 'pFileWriterFilter' is a pointer to the File Writer filter // Connect pins (example) // pLameFilter->GetOutputPin(0)->Connect(pFileWriterFilter->GetInputPin(0)); ``` -------------------------------- ### LAME Unified Preset System Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html LAME features a revamped unified preset system (--alt-presets) that offers significantly improved psychoacoustics and quality over default modes. These presets act as quality modes with special code-level tunings. ```bash lame --alt-preset standard input.wav output.mp3 lame --alt-preset extreme input.wav output.mp3 lame --alt-preset help ``` -------------------------------- ### Enable linear resampling with output samplerate option Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Linear resampling is now functional and can be controlled using the `--resample` option to set an output samplerate different from the input. Note that this feature may not work with MP3 input files and lacks a lowpass filter. ```c /* Linear resampling now works. Use --resample to set an output samplerate different from the input samplerate. */ /* (doesn't seem to work with mp3 input files, and there is no lowpass filter, so dont expect good results just yet) */ ``` -------------------------------- ### LAME MP3 Encoder: Fix NASM Support Build Error Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Resolves an error encountered when building LAME with NASM support, as reported in tracker item 2986823. The issue persists. ```C /* Fix for Bugtracker item _[ 2986823 ] Error when building Lame with NASM support -still exists */ ``` -------------------------------- ### LAME 3.94 Beta: Psychoacoustic Model Enhancements Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This section details improvements to LAME's psychoacoustic model in version 3.94 beta. Changes include better block switching, improved Huffman coding, scalefactor storage, and awareness of ATH adjustments for enhanced audio quality, though some optimizations may impact performance. ```bash # Use -q0 to enable best huffman divide in the inner loop for improved quality (painfully slow) # Example: lame -q0 input.wav output.mp3 # Changed -q option mapping: "-q2" until version 3.93 is now "-q3" # Example: lame -q3 input.wav output.mp3 # Use ATH value as short block masking lower limit # Several fixes in psychoacoustic model # Made psychoacoustic model aware of ATH adjustements ``` -------------------------------- ### LAME Old VBR Bug Fixes and Scalefac Scale Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Several bugs in the old VBR implementation were fixed. Additionally, Takehiro's scalefac_scale feature was integrated, although not enabled by default. This addresses limitations on bit allocation per channel. ```C // Fixed bugs in old VBR and added scalefac_scale feature // void encode_old_vbr(FrameData* frame) { // // ... bug fixes ... // // Apply scalefac_scale if enabled // } ``` -------------------------------- ### LAME: Improve ID3v1 genre matching with --tg switch Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Enhances the `--tg` switch for more flexible ID3v1 genre matching, allowing abbreviations and common typos to be recognized. ```shell lame --tg "Alt. Rock" input.wav output.mp3 lame --tg "acapela" input.wav output.mp3 ``` -------------------------------- ### LAME MP3 Encoder: Fix Makefile.mingw32 Build Failure Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Corrects a build failure occurring with `make -f Makefile.mingw32`. This fix addresses tracker item 3125235. ```C /* Fix for Bugtracker item _[ 3125235 ] make -f Makefile.mingw32 fails */ ``` -------------------------------- ### Release all GPL code under modified LGPL Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html By permission of copyright holders, all GPL code within LAME is now released under a modified version of the LGPL. Refer to the README file for specific details. ```c /* By permission of copyright holders of all GPL code in LAME, all GPL code is now released under a modified version of the LGPL (see the README file) */ ``` -------------------------------- ### LAME Psychoacoustics (--nspsytune) Improvements Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Improvements were made to the psychoacoustics tuning options, specifically related to `--nspsytune`. This allows for finer control over the psychoacoustic model parameters. ```C // Improvements to psychoacoustics (--nspsytune) // void tune_psychoacoustics(MP3State* state, int tune_level) { // // Adjust psychoacoustic parameters based on tune_level // } ``` -------------------------------- ### LAME 3.93: Tagging, Mono Encoding, and Optimizations Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This entry details fixes and optimizations in LAME version 3.93, including tag-related fixes for Direct Show filter and ACM codec, a mono encoding bug fix, and general optimizations such as a faster log10 function. ```bash # Some tag related fixes in the direct show filter and in the ACM codec (Mark Taylor) # Fixed a mono encoding bug found by Justin Schoeman (Mark Taylor) # Calc_noise bug fix (Mark Taylor) # Other fixes (Mark Taylor) # Some optimizations and a faster log10 function (Dominique Duvivier) # Some fixes in the DLL (Albert Faber) # Fixes for channel scaling in mono mode (Simon Blandford) ``` -------------------------------- ### LAME 3.93: Bit Allocation and Noise Shaping Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html This section covers improvements in LAME version 3.93 related to bit allocation and noise shaping. Enhancements include improved bit allocation for pre-echo control in single-channel encodings, substep noise shaping, and optimizations through data structure changes. ```bash # Bit allocation for pre-echo control improved for single channel encodings # Substep noise shaping # Optimizations by changing data structure # Noise shaping model 2 fix # Nspsytune FIR filter clean up # Fix small psymodel bugs(DC current estimation, preecho detection of non-VBR mode, and nspsymode initialization) # Portability fixes for Tru64 UNIX ``` -------------------------------- ### LAME 3.12pre8: Big-Endian WAV Header Parsing Source: https://github.com/toyobayashi/mishiro-core/blob/master/deps/lame/doc/html/history.html Adds WAV header parsing for big-endian machines and automatic detection of such systems, improving compatibility with different architectures. ```c /* WAV header parsing for big-endian machines */ /* Automatic detection of big-endian machines */ ```