RV3/4 decoders present state: stalled again

November 4th, 2008

I’ve been very busy with the things outside FFmpeg yet I’ve managed to do something on RV3/4 decoders too:

  • Found and fixed an old bug with quantisation for DC coefficients.
  • Cleaned a bit RV4 loop filter.
  • Fixed chroma MC bug in RV3 decoder.
  • B-frames motion vectors are now closer to the reality in RV3.

What is missing:

  • RV3 loop filter
  • correct RV3 motion vectors calculation
  • RV4 motion compensation incompatibilities

The main problem is that I don’t quite understand why it’s working in the way it works and (in some parts) how it works. Hopefully it will be clearer next time I’ll look at it.

A RE Puzzle

September 21st, 2008

There is a codec, little is know about it.

Here are some of its features:

  • it codes frame as a three planes
  • it employs motion compensation
  • it employs old-school vector quantization — fill block, fill block with mask, …
  • each value in the stream is coded as the run of values plus actual value coded as several Huffman-coded nibbles (yes, each 4 bits are coded with own Huffman tree) plus sign bit if applicable
  • sometimes it performs DCT to restore block content

Try to guess what’s its name.

Hint: MultimediaWiki contains a description of the codec with the similar bitstream reading techniques, which is a relative of this codec.

And, no, since I’m engaged in AAC encoder, I won’t RE nor write decoder for it (at least in the near future).

A bit of audio news

August 31st, 2008

Looks like I soon will run out of titles, have to switch to something else then.

I’m still working on improving AAC encoder, for now I’m trying to fit trellis-based quantizer selection, then optimal quantizing will follow. In a process FFmpeg may get generic psychoacoustic model interface (there’s new IIR filters interface in SVN, with implementation for lowpass Butterworth filter only though).

In other news – there was a raise of interest to DCA decoder. Of course FFmpeg does not have one (wink wink), but there were some patches to correct tables used by it and improve speed (to nonexistent decoder, that is). Also there’s a person who hasn’t written a DCA encoder, he now reads development mailinglist and submits patches to out nonexistent decoder. Welcome!

Disclaimer. Sorry for political language, but I remember the troubles caused to Videolan because they had developed and hosted DTS decoder.

Also there’s a rise of interest to TrueSpeech, since it is used in some messenger (I’ve never thought it would be popular). I have to update information about it in MultimediaWiki a bit.

AAC: Life goes on

August 25th, 2008

Well, Summer of Code 2008 goes to end. I think I’ve completed my task – creating simple AAC encoder with psychoacoustics
(here are my application link and a rough task description). I’ve written AAC encoder with psychoacoustic model made after 3GPP TS26.403 and it seems to work fine (on multichannel sources too).

Now there’s a small catch – to be included into FFmpeg it should be optimal in the terms of coding. That means minding rate distortion, choosing optimal quantizers and codebooks, etc. Now it’s a bit harder task, so I think final encoder will be in SVN this autumn or later. Any pointers on information how to optimally encode some part of stream are welcome (for miscellaneous stuff like pulses, temporary noise shaping, etc.).

Stay tuned (and use Flac instead 😉 ).

A Round Date

August 14th, 2008

Today is the day when my first contribution to FFmpeg went to CVS.

You know that story – a curious programmer once decided to look how one of video codecs works, found out that was deflated MS RLE data expanded for bitdepths > 8bpp, wrote a decoder for it, adapted for ffmpeg, sent that decoder to one person and guess what that person did? Added necessary ties and committed it to FFmpeg CVS.

Well, since then I contribute to FFmpeg a bit of different stuff time from time. Plans for this year include AAC encoder, finishing RV3/4 decoder, pushing LucasArts SMUSH decoder to SVN, making Mike finish Xan4 decoder and some random stuff I’m not aware of now.

A bit more

August 8th, 2008

With low-pass filter my AAC encoder is more or less feature-complete. Of course there’s still more room for improvements but it’s pretty fine now. I’d like to submit it for review but it depends on some parts of AAC decoder and it’s still under review :-(. So I don’t have much to do until then.

So I switched to last GSoC task and hacked again at RV40 loop filter. Well, filter invoking pattern is almost there and I’ve fixed several bugs in actual filtering code. Bit it’s not there yet. Maybe in a month it will be so if AAC encoder won’t take all my time again.

News + Extra

August 3rd, 2008

AAC front: to compete with other encoders I have to implement low-pass filter. Benjamin suggested Butterworth filter, so I will try it next week. Hopefully that will be the last big feature to do.

RV front: looks like deblocking pattern is generated from comparing motion vectors, if the difference for subblocks is greater than 3, then edge between them is scheduled for loop filtering. Don’t expect working loop filter implementation too soon though, I still have to deal with AAC encoder and it’s more important.

Extra: I’ve finally decided to buy ASUS Eee, it was easy thing to do – there’s only one model (Eee 701 4G with Win XP installed) for about the same price of four hundred bucks (maybe $450 in greedy shops). So the first thing I did with it was installing Linux and tearing down that stupid “Designed for Windows” label (which was surprisingly easy thing to do and left no marks on laptop surface).

Now here are complains about Ubuntu Eee (I don’t have USB DVD drive and Xandros hasn’t worked from USB flash drive for me): it requires some hacking of system configuration to make it work (like shutdown properly) but that I can live with, but the braindead thing is that gcc is installed (why?) without any development header or library, so you can’t compile even “Hello, world!” program. Both of those issues are resolved, so I just need to make this toy more useful to me 🙂

AAC: encoder progress

August 1st, 2008

If there are still people interested in my work on AAC encoder (I doubt though), here is a status report for you.

Tasks completed:

  • Make encoder provide lookahead samples
  • Make psy model use these samples to produce block switching decision
  • M/S case handling (at least I hope so)
  • Multichannel coding (from mono to 5.1, seems to work fine)

So there are only two bits left: tune model to produce better sound and commit that all to FFmpeg SVN.

The problem with current implementation is that it follows given bitrate too closely, so some frames may be coded too badly resulting in audible artifacts. I will add ABR mode and quality-based mode to make it better. Another issue is how to use codec options to turn them on, so Robert Swain can add profiles for them ;).

In related news: AAC decoder is slowly migrating to FFmpeg SVN, so I should be able to submit my encoder for review and inclusion as well.

A bit of AAC news

July 20th, 2008

I’ve not abandoned work on AAC encoder completely.
For example, I think now my psy model calculates and handles bitrate better. Now the only goals I set to myself are:

  • Make encoder provide psy model lookahead samples for block switching
  • Finetune psy model, or more specifically:
    • block switching decision
    • finish M/S case handling (for now it does not update all psy model information and result in artifacts on several test samples)
    • adjust scalefactors to reduce quantisation distortion
    • some other tricks from 3GPP TS26.403?

After that there are several ways to go: improve quality until it beats other encoders (at least libfaac), implement SBR/PS encoding (the latter is easier to do), introduce multichannel coding.

I suspect that at least one person will suggest to do it all.

Turtles All the Way

July 20th, 2008

Just in time I though I’ve fully understood RV4 loop filter. It uses both coded block pattern and some other pattern. I thought it was CBP from the previous frame, but it turned out to be some special deblocking pattern calculated for each block in interframes after decoding that block. That calculation is easy – it just selects a set of subblocks to check, compare some values and if the difference is less than 3 then set a bit in deblock pattern. Now the only thing left is to find out is where those values come from.