Lagarith: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
(enumerate data encodings)
(→‎Data Format: start documenting the various frame encodings)
Line 20: Line 20:
LAGS data is typically transported in [[AVI]] files. If the frame is 0 bytes long then the frame is a NULL frame. Presumably, the frame is unchanged from the previous frame.
LAGS data is typically transported in [[AVI]] files. If the frame is 0 bytes long then the frame is a NULL frame. Presumably, the frame is unchanged from the previous frame.


The first byte of an encoded chunk indicates the type of coding used to decode the remainder of the chunk. The supported types are:
Byte 0 of an encoded chunk indicates the type of coding used to decode the remainder of the chunk. The supported types are:
* 1: Uncompressed
* 1: Uncompressed
* 2: Unaligned RGB24
* 2: Unaligned RGB24
Line 32: Line 32:
* 10: Arithmetic coded YV12
* 10: Arithmetic coded YV12
* 11: Reduced resolution frame
* 11: Reduced resolution frame
Further, bit 6 (byte & 0x40) in this byte indicates interlaced video when set.
All other data numbers are invalid. Further, bit 6 (byte & 0x40) in this byte indicates interlaced video when set.


=== Uncompressed ===
Data encoding 1 is uncompressed data. The entire buffer after the type byte is copied into the output.
=== Unaligned RGB24 ===
=== Arithmetic coded YUY2 ===
=== Arithmetic coded RGB24 ===
=== Solid greyscale color frame ===
Set the entire frame to the same value as found in byte 1 of the encoded chunk.
=== Solid non-greyscale color frame ===
This frame type is deprecated. The official decoder maintains it for backwards compatibility.
Bytes 1, 2, and 3 respectively represent the blue, green, and red components of the pixel to paint the entire frame.
=== RGB keyframe ===
This frame type is deprecated. The official decoder maintains it for backwards compatibility.
=== Arithmetic coded RGBA ===
=== RGBA pixel frame ===
Bytes 1, 2, 3, and 4 respectively represent the blue, green, red, and alpha channel components of the pixel to paint the entire frame.
=== Arithmetic coded YV12 ===
=== Reduced resolution frame ===


[[Category:Video Codecs]]
[[Category:Video Codecs]]
[[Category:Lossless Video Codecs]]
[[Category:Lossless Video Codecs]]

Revision as of 20:49, 21 April 2006

Lagarith is a lossless video codec intended for video editing and archiving. It is also suitable for video capture on high-end systems. It is capable of handling RGB24, RGB32, RGBA, YUY2, and YV12 input video. To facilitate editing, Lagarith only supports keyframes, and optional null frames. Other features that make it suitable for video editing include a simple configuration interface, a good compression to speed ratio, full backwards compatibility with earlier versions of the codec, and a reduced resolution mode that is useful for 'bait-and-switch' editing.

Features

Compression

If the image is RGB(A), the red and blue channels are converted to their difference from the green channel (YUY2 and YV12 cannot be similarly converted). The image then has median prediction applied to it to make it more compressible (similar to Huffyuv's median prediction). Next, each channel is compressed independently. The channels will have a modified run-length coding scheme applied to runs of 0 if it reduces the length of the byte sequence. Runs may be triggered by 1, 2 or 3 sequential 0 values depending on which (if any) reduces the length the most. Run-length coding typically improves both compression and speed. If the modified run-length coding does not reduce the sequence length, the sequence is passed through unchanged. Next, the frequency for the different values in the byte sequence is tabulated and stored using Fibonacci coding. Finally, the byte sequence is compressed using a range coder and the frequency table.

Additionally, in special cases where a frame is a solid color, the frame may be stored as just one uncompressed pixel.

Multithreading

The codec allows the user to specify if multiple threads should be used; this can be used on dual-core systems to significantly improve speed. The threading takes advantage of the fact that the channels are compressed independently & uses a separate thread for each channel. The output data is the same regardless of whether or not multithreading is enabled.

64-Bit Support

A beta version of the codec is available for Windows 64. All features except reduced resolution mode are supported by the 64-bit version, and the 64-bit version is significantly faster than the 32-bit version on a 64-bit AMD processor. The output data is identical for the 32- and 64-bit versions.

Data Format

LAGS data is typically transported in AVI files. If the frame is 0 bytes long then the frame is a NULL frame. Presumably, the frame is unchanged from the previous frame.

Byte 0 of an encoded chunk indicates the type of coding used to decode the remainder of the chunk. The supported types are:

  • 1: Uncompressed
  • 2: Unaligned RGB24
  • 3: Arithmetic coded YUY2
  • 4: Arithmetic coded RGB24
  • 5: Solid greyscale color frame
  • 6: Solid non-greyscale color frame
  • 7: RGB keyframe (deprecated; maintained for backwards compatibility)
  • 8: Arithmetic coded RGBA
  • 9: RGBA pixel frame
  • 10: Arithmetic coded YV12
  • 11: Reduced resolution frame

All other data numbers are invalid. Further, bit 6 (byte & 0x40) in this byte indicates interlaced video when set.

Uncompressed

Data encoding 1 is uncompressed data. The entire buffer after the type byte is copied into the output.

Unaligned RGB24

Arithmetic coded YUY2

Arithmetic coded RGB24

Solid greyscale color frame

Set the entire frame to the same value as found in byte 1 of the encoded chunk.

Solid non-greyscale color frame

This frame type is deprecated. The official decoder maintains it for backwards compatibility.

Bytes 1, 2, and 3 respectively represent the blue, green, and red components of the pixel to paint the entire frame.

RGB keyframe

This frame type is deprecated. The official decoder maintains it for backwards compatibility.

Arithmetic coded RGBA

RGBA pixel frame

Bytes 1, 2, 3, and 4 respectively represent the blue, green, red, and alpha channel components of the pixel to paint the entire frame.

Arithmetic coded YV12

Reduced resolution frame