ASUS V1/V2 Codecs

Contents

1  Introduction
2  Terms and definitions
3  Highlevel Description
    3.1  Picture
    3.2  Macroblock
    3.3  Block
    3.4  Coefficient group
    3.5  DC coefficient Dequantization
    3.6  AC coefficient Dequantization
4  Bitstream
    4.1  Fourcc
    4.2  Global (per file) Header
    4.3  Macroblock
    4.4  ASV1 Block
    4.5  ASV2 Block
5  VLC Codes
    5.1  ASV1
        5.1.1  Level
        5.1.2  Coded coefficient pattern
    5.2  ASV2
        5.2.1  First Coded coefficient pattern
        5.2.2  Coded coefficient pattern
        5.2.3  Level
6  Example ASV1 decoder
7  Changelog
8  Copyright

1  Introduction

ASV1/2 are purely intracoded DCT-based codecs, with a per file quantization parameter (QP), use 4:2:0 YCbCr colorspace and operate on macroblocks.
The latest version of this document is available at http://www.mplayerhq.hu/michael/asv1.{lyx,txt,html,ps}
This document assumes familiarity with mathematical and coding concepts such as the discrete cosine transform, quantization, YUV (YCbCr) colorspaces, macroblocks, and variable length codes (VLCs).

2  Terms and definitions

AC
Any DCT coefficient for which the frequency in one or both both dimensions in non-zero.
DC
The DCT coefficient for which the frequency is zero in both dimensions
QP
Quantization Parameter
(I)DCT
(Inverse) Discrete Cosine Transform
VLC
Variable Length Code

3  Highlevel Description

3.1  Picture

The picture is split into macroblocks which are coded left->right, top->bottom, as long as MBs are completely within the width/height area that is divisible by 16. If width is not divisible by 16, the right column is coded after the main body. If height is not divisible by 16, the bottom strip is coded after the right column.
Example: 56x56 sized image
0129
34510
67811
12131415

3.2  Macroblock

16x16 luma + 8x8 chroma as 4 8x8 luma blocks and 2 8x8 chroma blocks
Y:
01
23
Cb:
4
Cr:
5

3.3  Block

Contains 64(=8x8) coefficients in 16(=4x4) coefficient groups with 4(=2x2) coefficients each
0159
23812
471114
6101315
Coefficients in the coefficient groups 10..15 cannot be coded (they must be 0) in ASV1.
The first coefficient (DC coefficient) in the first coefficient group must be coded as 0. Note it is coded seperately in the 8 bits prior to the AC coefficients.

3.4  Coefficient group

01
23

3.5  DC coefficient Dequantization

c00¢=8c00
c00
quantized and coded DC coefficient
c00¢
unquantized DC coefficient

3.6  AC coefficient Dequantization


cxy¢= cxy

16
ê
ë
Dqxy

QP
ú
û

  
QP
Quantization Parameter from the global header
D
64 for ASV1, 128 forASV2
c
quantized and coded coefficient
c'
unquantized coefficient
q
ISO MPEG1 intra quantization matrix

4  Bitstream

The bitstream in ASV1 is stored with byte-swapped 32bit words (24..31, 16..23, 8..15, 0..7, 56..63, 48..55, 40..47, 32..39, ...)
The bitstream in ASV2 is stored with the bits in each byte reversed so (7..0, 15..8, 23..16, 31..24, 39..32, ...)

4.1  Fourcc

ASV1 / ASV2

4.2  Global (per file) Header

Length in bitsValue
8QP
24unkown, 0 for ASV1
8'A'
8'S'
8'U'
8'S'

4.3  Macroblock

Simply the bitstream of the 6 blocks

4.4  ASV1 Block

8-bit
DC coefficient
.
for each coefficient group
2-5bit
Coded coefficient pattern
.
for each coded coefficient
2-11bit
level
5bit
End Of Block

4.5  ASV2 Block

4-bit
coefficient group count
8-bit
DC coefficient
2-4bit
First Coded coefficient pattern
.
for each coded coefficient
2-13bit
level
.
for each coefficient group
2-6bit
Coded coefficient pattern
.
for each coded coefficient
2-13bit
level

5  VLC Codes

5.1  ASV1

5.1.1  Level

0011-3
011-2
11-1
000xxxxxxxxxxxxxxxx
101
0102
00103
xxxxxxxx is a twos complement signed 8 bit nubmer (=int8_t)

5.1.2  Coded coefficient pattern

0000114
0001013
......
011012
011101
01111EOB
100
1115

5.2  ASV2

5.2.1  First Coded coefficient pattern

VLCCCP
000111
010000
1000110
1010100
11000011
11010001
11100101
11110010

5.2.2  Coded coefficient pattern

VLCCCP
000000
0100100
0111000
10001010
10011100
10100010
10111101
11001111
11011110
1110000111
1110010101
1110100011
1110110001
1111000110
1111011001
111111011

5.2.3  Level

0000111111-31
......
001111-7
001011-6
001101-5
001001-4
0111-3
0101-2
11-1
00000xxxxxxxxxxxxxxxx
101
01002
01103
0010004
0011005
0010106
0011107
......
000011111031
xxxxxxxx is a twos complement signed 8 bit nubmer (=int8_t)

6  Example ASV1 decoder

7  Changelog

0.01
2003-05-21
initial version by Michael Niedermayer with some stuff from Mike Melanson
0.02
2003-05-21
spelling, punctuation, example decoder, various minor changes by Mike Melanson
various minor changes by Michael
0.03
2003-09-01
minor fixes and ASV2 by Michael
0.04
2004-08-24
clarify bitstream order by Michael

8  Copyright

Copyright 2003 Michael Niedermayer <michaelni@gmx.at>
This text can be used under the GNU Free Documentation License or GNU General Public License
see http://www.gnu.org/licenses/fdl.txt


File translated from TEX by TTH, version 3.59.
On 24 Aug 2004, 20:11.