BladeEnc Sourcecode

BladeEnc is distributed under the terms of the GNU Lesser General Public License (LGPL), so you are welcome to download and use the sourcecode for anything you want as long as you follow the license agreement.

Please click on "License" in the left frame to view the license agreement before downloading the sourcecode.
 
 
 

Stable and Development versions

The sourcecode for BladeEnc is available in two versions: Stable and Development.

The stable version is the latest released version, which is the recommended sourcecode to download if you want to compile BladeEnc for a platform not supported. As long as you set the right defines in system.h and manage to compile together a binary it should work nicely.

The development version is always the latest thing, provided for people who wants to help developing BladeEnc. It might not work correctly if we are in the middle of some major changes. It also might contain serious bugs or decreased sound quality if we are experimenting with some new algorithms. I don't recommend you to download this for anything except helping out with the development. As soon as we have a development version which we considers to be trustworthy for everyday use, we'll release it as the next stable version.

From time to time there might just be a stable version if I've recently released a new stable version and haven't made any changes since then.

Click here to go to the source archive
 
 

Committing back changes

People who have downloaded the sourcecode and made improvements are encouraged to send back their modified sourcecode. This is done by attaching the sourcecode to an e-mail and sending it to tord.jansson@swipnet.se. Please also write something about what you have changed and why since that will make it easier for me.
 
 

WARNING 1 - Audio Quality

Old versions of BladeEnc were very sensitive for compiler optimisations. Even well known compilers as Visual C++ and GNU C generated mutated versions of BladeEnc, producing lower quality output, when optimisations were enabled.

However, the cause of this problem has later been identified and solved (it was a compiler error, but it could easily and safely be avoided by marking a certain variable as 'volatile') and is no longer of any greater concern.

All compilers we know of generates correctly working BladeEnc binaries even when using the highest optimization level, but just to be sure we recommend you the following test:

First compile a non-optimized version of BladeEnc and encode an mp3 file (doesn't have to be so long, 20 seconds should be more than enough). Then compile a fully optimized BladeEnc and use it to encode the same file, then compare the outputs. They should be binary identical and not differ by a single byte. If they differ, something has happened and I recommend you to not trust the optimized binary.
 
 

WARNING 2 - MPEG Layer 3 Patents

Although the sourcecode for BladeEnc is distributed under the LGPL, it includes algorithms and solutions that some of the creators of the MPEG Layer 3 standard claims to have patents on.

This makes portions of the BladeEnc sourcecode quite unsuitable for inclusion into other software projects. It might even be a breach of the GPL / LGPL license of another product if you add patent covered parts of BladeEnc to its sourcecode.
 
 

Contributing BladeEnc binaries

In order to port BladeEnc to a currently unsupported platform, please follow these simple steps:
 

  1. Download the latest STABLE BladeEnc sourcecode as well as this package (which contains all the other files, like the manual, that shall be included with your port).
  2. BladeEnc 0.92.0 needs the SYSTEM-define in system.h to reflect your system. Later version's normally don't need any changes to system.h, unless you compile for a currently unsupported system. If your system isn't supported yet and differs from the normal UNIX systems you might need to add some code to bladesys.c as well. It is very unlikely that you will have to do any changes to any other files than system.h and bladesys.c. Please send a patch to tord.jansson@swipnet.se containing any changes.
  3. Compile the sourcecode and see if you get a working binary. Play around with the binary to see if it seems to work as it should.
  4. Play around with compiler optimizations to get it as fast as possible.
  5. When you are satisfied with the speed, encode the same input file (a 20 sec sample is enough) using both the optimized and unoptimized binary. Make sure that the output from both of them are 100% identical. Use a tool that can compare two binary files for this (like md5sum), don't trust your ears. If it fails, please mail me with information about compiler, compiler settings,  operating system etc and we'll try to help you to find out what is wrong.
  6. Make sure to strip your binary from debug information in order to keep down the file size.
  7. Put together a package of the complementary files you downloaded and your binary. Use the most popular archiving utility on your platform unless there are some clear disadvantages of that (except a few kb in size, which doesn't matter too much).
  8. Make sure no file in the package contains any kind of virus!
  9. Attach this package to an e-mail and send it to the maintainers of the binary distribution points. Please confirm in the mail that you have tested the output and that it has proven to be 100% identical to that generated by an unoptimized binary.
  10. Wait for the binary to appear online. :)


Compiling the DLL

To compile the Windows DLL, please follow these steps:
 

  1. Download the latest STABLE BladeEnc sourcecode as well as the files dllmain.c and dllmain.h (all available from the source archive).
  2. Create a new Visual C++ DLL-project  and add all the .c and .h files except arglink.c, arglink.h ,  main.c, main.h, samplein.c, samplein.h and strupr.c.
  3. In BladeEnc 0.92.0 you need to change the SYSTEM-define in system.h to WIN32_INTEL, in later versions this is done automatically.
  4. In dllmain.c: Change ENCODER_MAJOR_VERSION and ENCODER_MINOR_VERSION to reflect those of the sourcecode you downloaded (yes I know, those are just the two upper version numbers, the interface was designed before we changed the version numbering to three numbers).
  5. Follow the same procedure as above to make sure that the quality is ok and make your binary.


Getting Started with the BladeEnc Sourcecode

Here follows some information that might help you to get started with the BladeEnc sourcecode:
 

A short description of some of the files:
 
system.h Contains platform specific defines. In 0.92.0 or older you need to change here for switching between platforms.
bladesys.c Contains all platform specific code 
samplein.c Mini-library for reading sample files and providing some basic sample conversion (8/16-bit, mono/stereo, big/little-endian etc).
main.c The main code for reading commandlines, handling the batch, producing screen output and handling errors. Doesn't contain any of the MP3 encoding routines.
codec.c The main interface for the MP3-encoding routines. If you just want to look at the MP3 engine you should start here.
bladetab.c Just a damn big table, this has been removed in the latest version.
tables.c Some tables that were loaded as separate files in the ISO distribution.
formatbitstream2.c Replacement for formatbitstream.c in the ISO distribution which seemed to be copyrighted. Provides the same functionality with about 1/3 of the code. :)

  l>