Apple Intermediate Codec: Difference between revisions
(band coding is still undiscovered) |
(→Band coding: Updated a bit) |
||
Line 40: | Line 40: | ||
* Rice code - unary prefix and <code>N</code> bits of residue. | * Rice code - unary prefix and <code>N</code> bits of residue. | ||
* code2 - signed codes with unary prefix: <code>k = get_unary(); value = get_bits(k*2) - (1 << N); </code> | * code2 - signed codes with unary prefix: <code>k = get_unary(); value = get_bits(k*2) - (1 << N); </code> | ||
First 5 bits re used to select coding method: | First 5 bits re used to select coding method: | ||
A = 1 bit | A = 1 bit | ||
B = 1 bit | B = 1 bit (looks like when it's zero, Rice code is used for reading pixel, when it's set - code2 is used) | ||
C = 3 bits (number of bits in code residue) | C = 3 bits (number of bits in code residue) | ||
if <code>A = 0, B = 0</code> then it's simple Rice codes with parameter <code>C</code> | if <code>A = 0, B = 0</code> then it's simple Rice codes with parameter <code>C</code> | ||
if <code>A = 0, B = 1</code> then it's simple code2 with parameter <code>C</code> | if <code>A = 0, B = 1</code> then it's simple code2 with parameter <code>C</code> | ||
otherwise, | otherwise, read two additional variables | ||
D = 1 bit (if zero, use simple skip/pixel scheme, if set - use something more complicated) | |||
E = 3 bits (number of bits in skip residue) | |||
if <code>A = 1, B = 0, D = 0</code> then zero all line before decoding and then apply this simple scheme: | |||
x = 0; | |||
do{ | |||
t = get_rice(E); | |||
x += t; | |||
if (x < width) | |||
pixels[x++] = get_rice(C); | |||
}while(x < width); | |||
if <code>A = 1, B = 1, D = 0</code> then scheme is almost the same, but with <code>pixels[x] = get_code2(C);</code> | |||
'''TODO''' | |||
[[Category:Video Codecs]] | [[Category:Video Codecs]] | ||
[[Category:Undiscovered Video Codecs]] | [[Category:Undiscovered Video Codecs]] | ||
[[Category:Formats missing in MPlayer]] | [[Category:Formats missing in MPlayer]] |
Revision as of 02:43, 2 December 2009
- FOURCCs: icod
- Company: Apple
- Samples: http://samples.mplayerhq.hu/V-codecs/icod/
- Decoder: http://www.apple.com/support/downloads/appleintermediatecodec101.html
- Description: http://support.apple.com/kb/HT2704
Lossy codec used in Final Cut Express HD and iLife ’05
Apple Lists its Features as:
- Intra Only
- 4:2:0 color
- 8-bits per sample
More technical details
Each frame starts with 24-byte header:
6- 7 frame width 8- 9 frame height 10-11 frame width (or maybe tile width) 12-13 frame height(or maybe tile height)
16 high nibble is ?, low nibble is ? 18 high nibble is ?, low nibble is ? 19 high 2 bits are ?, next 2 bits are ?, low 3 bits are ?
It is followed by some tables consisting of 16-bit little-endian entries (Huffman weights?).
There are 4 versions of coded data which differ by coded colourspaces (the same YUV420 but 8/16 bits per component and linear/non-linear?).
Each tile has data coded as 4 bands (probably in YYUV order) and DCT is employed. Bits are coded MSB in big-endian words.
Band coding
Each band is an array of 16-bit entries.
Used codes:
- unary code -
00...01
- Rice code - unary prefix and
N
bits of residue. - code2 - signed codes with unary prefix:
k = get_unary(); value = get_bits(k*2) - (1 << N);
First 5 bits re used to select coding method:
A = 1 bit B = 1 bit (looks like when it's zero, Rice code is used for reading pixel, when it's set - code2 is used) C = 3 bits (number of bits in code residue)
if A = 0, B = 0
then it's simple Rice codes with parameter C
if A = 0, B = 1
then it's simple code2 with parameter C
otherwise, read two additional variables
D = 1 bit (if zero, use simple skip/pixel scheme, if set - use something more complicated) E = 3 bits (number of bits in skip residue)
if A = 1, B = 0, D = 0
then zero all line before decoding and then apply this simple scheme:
x = 0; do{ t = get_rice(E); x += t; if (x < width) pixels[x++] = get_rice(C); }while(x < width);
if A = 1, B = 1, D = 0
then scheme is almost the same, but with pixels[x] = get_code2(C);
TODO