AVI Player
   Lagarith Lossless Codec
   VirtualDub Filters

Codec Changes

Version naming is done as follows: 1.x.y. Changes in y denotes bug fixes/features that do not affect compatibility. Changes in x refer to changes that affect compatibility with earlier versions; videos may not decode correctly on versions that have a smaller x value that the version they were encoded with. All versions of the codec are backwards compatible however.

Version 1.3.27 released on 12-08-2011
Fixed a crash that could occur when the source video buffer is not aligned to a multiple of 8 for 32 bit systems. The issue still exists for 64-bit systems, but the fix for them isn't nearly as easy and it is a very rare issue so I am leaving it alone for now. Thanks to Peter Dimov for reporting this and providing a way to reproduce the issue.
Restored a table entry in the Fibonacci coder I accidently deleted; this would cause video corruption or crashes when playing back high-resolution video.
Fixed some pointers being treated as 32-bit integers when instantiating the codec; this could result in the pointer being trucated and the application crashing on 64 bit systems. Thanks to Stuart MacKinnon for reporting this and tracking down the cause.
Added exception handling in the range decoder; I am still getting a few reports of issues with Adobe products, and this will help me determine if there is still a buffer overrun in certain cases.

Version 1.3.26 released on 09-25-2011
Fixed a buffer overrun in the decoder that caused crashes with Adobe products. Thanks to the all the people that reported this bug.
Fixed an error that caused certain solid color frames from 1.3.20 and earlier to be corrupted. Thanks to Luke MacKay-Morris for reporting this and providing a sample video.

Version 1.3.25 released on 05-11-2011
Fixed some bugs introduced in 1.3.21 that broke backwards compatibility with 1.1.x and below.
Codec settings are now stored in the Windows registry rather than in config files, this should reduce issues with settings on Windows Vista and 7.
Added lookup tables to eliminate a conditional in the range encoder, speeding up encoding.
Replaced a division with an approximate reciprocal multiply and reorganized the run detection code in the range decoder to speed up decoding.
Changed the Run Length Encoder to encode with a run trigger of length 3 only, and then encode with a run trigger of 1 only if the result is sufficiently small. This speeds up encoding of typical video.
Added MMX version of the Run Length Encoder to speed up encoding on processors that don't have SSE.
SSE2 routines originally written for x64 are now included for the x86 build, and are used if they perform faster than the MMX versions on the given processor.
Some more tweaks to the SSE2 routines to improve performance.
On test videos, I saw roughly a 20% encoding speed increase, and a 30% decoding speed increase over version 1.3.24.
A more detailed comparison of the performance increases can be found at the Doom 9 forums.

Version 1.3.24 released on 4-10-2011
Fixed a bug in the SSE & MMX median restoration routines for RGB video that caused corrupted video. Thanks to Uwe Jahn for reporting this bug.
Fixed a bug where SSE instructions were used in some MMX median restoration routines, this would cause crashes on processors that did not support SSE.
Overhauled multithreading to use events rather than volatile flags and wait loops. This should improve performance slightly in multithreaded mode, and provide better stability.
Improved the MMX/SSE/SSE2 routines for median restoration, this should speed up decoding slightly.
Added SSE2 routines for downsampling colorspaces. This speeds up encoding when changing the colorspace on machines with SSE2.

Version 1.3.23 released on 3-5-2011
Fixed a buffer overrun that caused crashes on certain resolutions when decoding RGB video. Thanks to Nick Hope for reporting this bug.
Improved the performance of the SSE and SSE2 routines for decoding YUY2 slightly.

Version 1.3.22 released on 2-15-2011
Fixed a bug that caused video corruption when downsampling. Thanks to Karl Pritchett for reporting this bug.
Fixed some race conditions with RGBA and YV12 video in multi-threaded mode that caused video corruption. This was also reported by Karl Pritchett.
Fixed a bug in the 64 bit build that caused crashes when downsampling RGB24 video.

Version 1.3.21 released on 2-13-2011
Fixed a bug that would cause the codec to crash when downsampling certain resolutions. Thanks to Richard Jones for reporting this bug and tracking down the cause.
Several speed improvements:
      - Integrated RLE restoration into range decoder so decoding only takes one pass through the data.
      - Increased range decoder hash table size.
      - Removed RLE level 2, testing indicates that it doesn't offer any real benefit verses levels 1 or 3.
      - RLE compression now encodes all levels in parallel and selects the best one rather than perform an estimation run and then an RLE run.
      - RLE compression now has a faster SSE version for processors that support SSE.
      - Added and improved existing MMX/SSE/SSE2 optimizations for several functions relating to median prediction and image layout.
Overall I typically see about a 10-30% speed improvement.
Tweaked how RLE level is selected to improve compression by about 1%.
Tweaked how the work is distributed in multithreading to reduce wasting CPU time.
Added support for encoding YV16 source video, since it was a trivial change and is slightly faster than YUY2 or UYVY.
Removed Reduced Resolution mode, I don't think it is useful enough to justify maintaining.

Version 1.3.20 released on 7-3-2009
Fixed a bug that would cause the codec to crash when attempting to upsample YUY2 video with a width that was not a multiple of 4. Thanks to Zack Hartmann for reporting this and providing a sample video.
Fixed a bug that prevented the configure dialog from showing up in Sony Vegas. Thanks to Adam S. for reporting this.
Added a configure option to prevent Lagarith from upsampling video when decoding. Checking this option and having the mode set to RGB or RGBA will prevent Lagarith from performing any colorspace conversions. Thanks to Andrew Harrison for suggesting this option.

Version 1.3.19 released on 9-20-2008
Fixed a race condition introduced in 1.3.18 that could cause corrupted RGBA video when using multithreading. Thanks to Jason Hamby and Sander Steenhuis for reporting this.
Fixed a crash that could occur when decoding odd width RGBA with a height greater than 512. Thanks to Sander Steenhuis for reporting this and providing a sample video for debugging.

Version 1.3.18 released on 8-24-2008
Fixed an issue where decoding YUY2 video with multithreading could cause the chroma to be corrupted. Thanks to Vern Dias for reporting this and providing sample video. Tweaked multithreading compression so that the main thread copies the compressed data to the output buffer as soon as one thread finishes rather than wait for both. Changed the install.bat file to change drive letter too if needed when changing directories. Thanks to Jens Diemer for suggesting this.

Version 1.3.17 released on 7-16-2008
There were no code changes in this version, just fixing some build issues that resulted from porting both the two Visual Studio 2005 projects to one 2005 project:
Fixed an issue where some runtime code was being dynamically linked in, causing the codec to not show up for people who didn't have certain Visual Studio packages installed. Thanks to all the people that reported and helped track down the cause. Fixed an issue where the compiler was using the wrong calling convention when calling some assembly-optimized functions, which caused the codec to crash when working with reduced resolution video. Thanks to Andrew Harrison for reporting this bug.

Version 1.3.16 released on 6-21-2008
Fixed a bug that would occasionally corrupt frames in TMPGEnc (and possibly other programs as well). Thanks to Aleksey Gankov for reporting this.
Ported the 64 bit build to Visual Studio 2005.

Version 1.3.15 released on 4-13-2008
Fixed a bug that would cause the top left corner to have chroma errors when encoding to YV12 with a video who's width was not a multiple of 32. Thanks to Marc for reporting this.
Fixed a bug where a solid colored YUY2 frame would decode as black. Thanks to Markus Krapf and Bart Barenbrug for reporting this.
Added more error checking, this should help prevent crashes with corrupted files from Premiere.
Changed to using Visual Studio 2005 to compile the 32bit dll, thanks to gl.tter for helping with porting the project.

Version 1.3.14 released on 7-20-2007
Fixed a bug that would corrupt video when downsampling to YUY2 and the resolution was not a multiple of 32.
Fixed a bug that would cause crashes when downsampling to YV12.
Restored manual installation instructions to the readme for people having problems with the install.bat file.

Version 1.3.13 released on 6-24-2007
Changed the lagarith.inf file so that uninstalling from the control panel now works correctly.
Added an install.bat file to the Windows 64 version that will install both the 32 and 64 builds. Thanks to Wiak and Bja888 for suggesting this and providing example code.
Reduced the memory used by the codec when downsampling the colorspace and when using multithreading.
Improved the RLE code a bit.

Version 1.3.12 released on 11-17-2006
Fixed a bug introduced with 1.3.11 that would cause the codec to crash when multithreading on processors without SSE2. Thanks to Ken Schultz for reporting this bug.
Fixed a memory leak introduced with 1.3.11 when downsampling the colorspace during compression.
Fixed a possible deadlock situation I missed in 1.3.11.
Tracked down and fixed the cause of a bug that would cause frames to occasionally decode incorrectly when multithreading was enabled. I though I fixed this in 1.3.11, but I had only reduced the severity so that it usually only affected one or two pixels.

Version 1.3.11 released on 11-12-2006
A massive and much needed code overhaul (thanks to a tree falling on my leg).
Pixel prediction routines have been rewritten to use intrinsics instead of inline assembly; allowing them to be portable and easier to understand. They were also changed to operate on planar data instead of interleaved data; this speeds up YV12 encoding significantly.
Rewrote and simplified a lot of compression code due to the new prediction routines; this will speed up certain encoding cases such as odd-width video. Additionally, RGB32 and RGBA can now be encoded with an odd width.
Rewrote code for reducing and enlarging 'Reduced Resolution" frames using intrinsics, this should be faster in some instances, and should look a little nicer due to an algorithm tweak.
Multithreading now does pixel prediction and restoration in parallel for RGB and YV12, this should help improve performance on multiprocessor systems.
Merged the 64 bit and 32 bit code bases; this contributed to many of the above changes.
Bug Fixes:
Fixed a threading issue that occasionally caused the codec to freeze when multithreading was enabled. Thanks to Ken Schultz for reporting and helping test fixes for this bug.
Fixed Reduced the severity of a bug that would cause frames to occasionally decode incorrectly when multithreading was enabled.
Changed how Reduced Resolution handles frame edges, this fixes chroma garbage that would show up on the top or bottom of Reduced Resolution frames. Thanks to Andrew Harrison for reporting this.

Version 1.3.10 released on 10-04-2006
Added encoding support for UYVY video, this will allow Lagarith to be used with capture cards that only output UYVY. The video resulting will be decoded as YUY2 however. Thanks to Steven Rhodes for suggesting this feature.
Removed some unused code.

Version 1.3.9 released on 06-22-2006
Fixed a memory leak that occurred with Adobe Premiere. Thanks to Alexey Gankov for reporting this bug and providing a patch.
Fixed a bug that allowed YUY2 and YV12 video to be decoded as RGB16.
Fixed the close button on the settings dialog box. Thanks to Zarxrax for reporting this error.

Version 1.3.8 released on 03-11-2006
Fixed a bug that caused Lagarith to attempt to decode any file encoded with an old version as YV12 when asked to suggest the format (affected AviSynth). Thanks to Zarxrax for reporting this error.
Fixed a bug that could cause video corruption or crashes when encoding certain types of YV12 source video.
Changed threading calls and synchronization methods; this may improve performance slightly when multithreading is used.
Merged various changes from the AMD 64 build back into the base code; hopefully I will be able to merge the builds as the AMD 64 version matures.
Support for non-MMX processors has been ended completely.

Version 1.3.7 released on 11-12-2005
The codec now writes extra information in the format header to indicate which mode the codec used when encoding. This allows the codec to decode to the format used internally even when 'Report Original Colorspace' is used.
Several other minor code changes and small optimizations.

Version 1.3.6 released on 05-26-2005
Decoding RGB24 as RGB32/RGBA now sets the alpha channel to 255 instead of 0; previously, such video would show up as solid black in Vegas because it was perceived as fully transparent (thanks to Stephen Schlueter for reporting this error).
Fixed RGB24 encoding for systems that do not have an MMX capable processor.
Fixed a bug that prevented encoding RGB32 as RGB24 when the "Report original colorspace" option was checked.

Version 1.3.5 released on 05-28-2005
Fixed a bug that caused solid color frames to only decode partially when exporting RGBA.
Added exception handling when freeing memory.

Version 1.3.4 released on 03-20-2005
Added additional checking to make sure memory is being released at codec exit in case the calling program forgets to call the compress/decompress end functions when done (aka Premiere).
Improved decompression speed by changing the symbol lookup from a binary search to a hash and linear search. Thanks to Avery Lee for suggesting this optimization.
Improved decoding speed of reduced resolution frames by implementing the resizing in MMX.

Version 1.3.3 released on 03-07-2005
Fixed a bug that caused the codec to return an error while encoding RGB video with a width not divisible by 4; some other minor code changes.

Version 1.3.3 beta released on 02-12-2005
Added support for down-sampling input colorspace, this will improve compression, but is a little lossy. One known issue is if you are using Lagarith as the project codec in Premiere and you change the color space from RGB, Premiere will lose Lagarith and change to some other codec for compressing the project. This may be an issue for similar programs.

Version 1.3.2 released on 01-15-2005
Fixed a bug introduced in 1.3.0 where frames compressed without modified RLE would not set the value reflecting this, causing the decoder to attempt to decode these frames incorrectly and usually crash. If you have a video file that is affected by this bug that you need to recover, install this version of the codec. Once recovery has been performed, install the latest version of Lagarith.

Version 1.3.1 released on 01-08-2005
Fixed a bug that would cause certain RGB frames to be saved as solid color. Thanks to Alexey Gankov for reporting this. Fixed a bug that could cause Lagarith to attempt to encode frames that require MMX on processors that lack the feature. Some minor code cleanup and tweaks for how RGB frames are compressed.

Version 1.3.0 released on 01-06-2005
Added support for multiple processors; this should result in a significant speed increase for those with such systems. Check the "Use Multithreading" box to enable.
Added an option to save a reduced resolution version of the video (and reduced colorspace - YV12); this is VERY lossy and intended for video editors that use 'bait-and-switch'.

Version 1.2.5 released on 12-05-2004
Bug fixes: Released version did not maintain a copy of the previous frame for YV12/YUY2, resulting in null frames not working for those color spaces.

Version 1.2.4 released on 12-04-2004
Bug fixes: Fixed an array overrun in the MMX prediction algorithm for RGB video, causing the codec to crash when encoding wide frames... This is the same bug that affected the SSE2 algorithm, I forgot to copy the changes... Thanks to Loren Merritt for reporting this bug.

Improvements: Null frame support was added for YV12 and YUY2 video. This change is compatible with all 1.2.x versions.

Version 1.2.3 released on 11-30-2004
Switched to using the Intel 8.1 compiler, this should result in a general speed increase. I saw about a 5% improvement on my system (1.7Ghz Pentium 4); and hopefully gains will be greater for those with older processors.

Version 1.2.2 released on 10-16-2004
Bug fixes: Fixed an error for RGBA video where the codec would decide a frame was a solid color without checking the top 25% of the frame. Thanks to Zarxrax for reporting this bug.

Version 1.2.1 released on 10-02-2004
Bug fixes: Fixed an array overrun in the SSE2 prediction algorithm for RGB video. The algorithm was doing an extra row, and could cause crashes when operating on very wide frames.

Version 1.2.0 released on 09-11-2004
Bug fixes: Fixed an error with RGB24 video that had a width which was not divisible by 4; the codec would cut off part of the top-most row of the video and compress poorly. This resulted from the fact that the video must have each row start on a memory address that was a multiple of 4, and padding would be added if need be; the codec did not account for the padding. New frames will encode/decode correctly, old frames will be decoded and the part that was cut off will be replaced with the pixel values immediately below it.
Fixed an error that allowed RGB24 video that had an odd width to be decoded to RGB32; RGB32 decoding only supports even widths.

Version 1.1.2 released on 09-01-2004
Bug fixes: Replaced all global variables with member variables in the codec object. This should fix problems that happen when there are two or more instances of the codec in use at a time. The use of globals caused values to be shared between the instances, resulting in corrupted video and crashes.

Version 1.1.1 released on 08-25-2004
Bug fixes: Fixed an buffer overrun when decoding to YV12 video.
Updated posted source code.

Version 1.1.0 released on 08-10-2004
Posted beta version with support for RGB32, RGBA, YUY2 and YV12 colorspaces.
Modified the method used to compress frames slightly; this results in a very slight compression gain. This was done because the original algorithm, while functional, wasn't exactly what I intended. The codec is backwards compatible with frames encoded with an older version. The colorspace conversion routines for YUY2 and YV12 were taken from AviSynth.

Version 1.0.2 released on 06-29-2004
Bug fixes: Fixed a bug that allowed the codec to accept non-RGB24 video to compress.

Improvements: Added MMX versions of the pixel prediction algorithm; this will improve encode speed for processors without SSE2, and for those that have a SSE2 processor, video who's width is a multiple of 2 but not of 4 will encode faster.
Some other minor speed improvements; code cleanup.

Version 1.0.1 released on 04-20-2004
Bug fixes: Fixed an array overrun in decoding on processors with SSE2. This should stop the codec from crashing Windows preview and other players.
Improved encoder flushing; prior to this the last one or two pixels might not decode correctly for all frames.
Fixed a bug in detecting processor support for SSE2.

Improvements: Rewrote pixel prediction algorithm for SSE2 capable processors, this should provide a slight encoding speed increase over the previous version. Additionally, this version works with video who's width is a multiple of 4 while the previous required a multiple of 16.

Version 1.0.0 released on 04-10-2004
Initial release.