Features/Thusnelda

= Thusnelda =

Summary
Update libtheora to the 1.1 release (Thusnelda).

Owner

 * Name: Christopher Montgomery (xiphmont), AdamJackson
 * Email: cmontgom@redhat.com, ajax@redhat.com

Current status

 * Targeted release: Fedora 12
 * Last updated: 2009-09-25
 * Percentage of completion: 100%

Detailed Description
libtheora 1.1 incorporates a substantially improved encoder, codenamed 'Thusnelda'. Compared to libtheora 1.0, the new encoder can produce comparable quality encodings at a lower bitrate, or better quality at the same bitrate.

Over the last year, Monty has produced a series of detailed reports describing the Thusnelda improvements as they have been developed:
 * Improved motion estimation and mode selection
 * Rate-distortion optimization
 * One-pass DCT tokenization
 * Token optimization
 * Lambda unification, lambda/qi mapping
 * Quantization matrix tuning, forward DCT error reduction
 * Two-pass encoding, Frame dropping, Variable frame rate, Adaptive quantization, Chroma sampling, Telemetry

The development of Thusnelda was supported by Red Hat, Wikimedia and Mozilla.

Benefit to Fedora
A lot of positive momentum has been building around open video on the web. With this feature, Fedora becomes more attractive as a platform for producing video content in open formats.

Scope
All video-encoding applications that support theora will transparently benefit from the improvements in Thusnelda, including all applications that use gstreamer to encode video. Good examples in this category are GUI transcoding apps like transmageddon and arista (see http://lwn.net/Articles/333904/).

Applications that use mplayer or ffmpeg for video encoding may not benefit, since these frameworks come with their own implementations of the Theora format. The benefit to ffmpeg and mplayer depends on whether or not the package was built to use the external libtheora.

The new libtheora is a drop-in replacement, however the encoding functionality adds new rate control and tuning features. New features are not available to applications that use the encode functionality of libvorbis and have not been updated to use the extended API.

How To Test
Hardware: Thusnelda is finally making use of extensive SIMD optimization on 32 and 64 bit x86 platforms. Assembly optimized builds should be bit-exact compared to builds with assembly optimizations disabled. Bit-exactness is most easily tested in the video output, as comparing bitstreams would require extracting packet data from the ogg stream (where serial number will cause data differences in the container data).

Encoder/decoder working state must match exactly for all input video. A build that defines OC_DUMP_IMAGES will cause both the encoder and decoder to dump working state images frame by frame as they work. Any mismatch in the output for a given frame signals a bug.

The new Theora 1.1 encoder should produce uniformly superior output for a given bitrate as compared to the 1.0 encoder (note that bitrate for any given constant-quantizer encode has dropped dramatically in 1.1). The dump_psnr tool in examples/ [built in the original source distribution] can be used to test the PSNR of new encodes compared to video produced by the old encoder.

Beyond quality improvements, 1.1 offers new encoding features not present in the old encoder. These new features exercise both the encoder and decoder; the most likely bugs to be exposed by new encoder features will be decode bugs in third-party decoding applications (eg, AQ/3qi currently breaks Google Chrome's playback, which was only tested against older encoders that did not use the feature). New encoder features that also exercise previously unused bitstream features include: Adaptive quantization (two or three quantizer indicies per frame, called 3qi for short), 4:2:2 and 4:4:4 chroma support, and new quantization matricies.

Encoding applications should test the new rate control extensions/improvements, both to gather feedback on the new rate control tuning, but also to verify that newly implemented features (eg, two pass) function properly should the application choose to implement them.

User Experience
Unchanged. Yet improved.

Dependencies
None.

Contingency Plan
If libtheora 1.1 turns out to be a catastrophic failure, revert to libtheora 1.0. If libtheora 1.1 is not finalized in time for F12, but the prereleases don't exhibit stability problems, we can just ship the latest available prerelease, which will still give us considerable quality improvements, due to the incremental nature of the improvements that are outlined above.

Documentation
No specific documentation should be needed, libtheora 1.1 is a transparent replacement for libtheora 1.0.

Release Notes
Fedora 12 comes with libtheora 1.1, including a substantially improved encoder, codenamed 'Thusnelda'.

Comments and Discussion

 * See Talk:Features/Thusnelda