[Ffmpeg-devel] [PATCH] Chinese AVS video decoder

Stefan Gehrer stefan.gehrer
Wed Jun 28 10:42:42 CEST 2006

Hi list,

attached is my decoder for the Chinese AVS video standard, adapted for
lavc inclusion.
The current status is:

- It decodes the supplied test streams (http://www.avs.org.cn/fruits, 
  9 clips in left column) without visible artefacts. The decoded frames
  show minor differences to the GPL decoder supplied by the NSCC at
  http://cosoft.org.cn/projects/avsdec/ (or OpenAVS at sourceforge for 
  that matter, the code seems almost identical). Some of these
  differences come from bugs in the NSCC decoder I found, some others
  I am still investigating.
  The test streams are all progressive and I coded no support for
  interlaced yet, I think interlace support is also not complete in the
  NSCC version. Btw, the test streams are 150MB each and actually fun 
  to watch, even without understanding Chinese.

- It is lacking proper system integration. The AVS standard also
  specifies a container format, which is to be as compatible to MPEG
  systems as possible. It is so compatible that I do not know how to
  discern them :). Here is a patch I currently use to test the
  video decoder with ffplay. Of course it is not recommended for general
  use as it destroys MPEG2 video playback:

Index: libavformat/mpeg.c
--- libavformat/mpeg.c  (revision 5536)
+++ libavformat/mpeg.c  (working copy)
@@ -1603,7 +1603,7 @@
     } else if (startcode >= 0x1e0 && startcode <= 0x1ef) {
         type = CODEC_TYPE_VIDEO;
-        codec_id = CODEC_ID_MPEG2VIDEO;
+        codec_id = CODEC_ID_CAVS;
     } else if (startcode >= 0x1c0 && startcode <= 0x1df) {
         type = CODEC_TYPE_AUDIO;
         codec_id = CODEC_ID_MP2;

  After applying this patch, simply "ffplay stream01.avs" should produce
  video and audio.
  Maybe someone with better MPEG system and lavc knowledge than myself
  can find out the proper way to discern AVS video from MPEG2 video in 
  a PS file.

- I have only tested on x86 Linux, gcc 3.3.5. All tests for endianness
  issues and other platforms are welcome.

- I have written the decoder from scratch without access to any
  specifications. I only read the NSCC decoder, tried to understand
  what is going on, and rewrote in a hopefully lavc-compliant way.

Some general remarks: AVS claims to rival H.264 in terms of coding efficiency while maintaining a much lower complexity. I cannot comment 
much on the efficiency, as I had not used any encoder yet, but the 
argument for the lower complexity is certainly true.
Similarities to H.264 are: Spatial intra prediction, in-loop deblocking
filter, low-coefficient integer transform for bit-exact decoding.
Major complexity savers are: No elements smaller than 8 by 8 pixels, no
CABAC and generally less context information, no MBAFF mode. 
A nice technical overview can be found here http://www.ee.cuhk.edu.hk/ispacs2005/tutorial/Yu%20Lu.pdf

So, please test and review.  I am grateful for any comments and suggestions.
And I have been following this list for a long time, so you can flame
right away :)

Stefan Gehrer

Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal f?r Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cavsdiff.gz
Type: application/x-tar
Size: 20802 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060628/c1489e7b/attachment.tar>

More information about the ffmpeg-devel mailing list