[FFmpeg-devel] [PATCH] Electronic Arts TQI decoder

Michael Niedermayer michaelni
Mon Jan 26 11:17:57 CET 2009


On Sun, Jan 25, 2009 at 11:06:25PM +1100, Peter Ross wrote:
> Patch enclosed.
> 
> eatqi-demux-r2.diff

ok

[...]

> bitstream-ea32.diff -- yet another bitstream packing technique.

iam in favor of bswap_buf in the decoder

[...]
> 
> Info: http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TQI
> Samples: http://samples.mplayerhq.hu/game-formats/ea-wve/

[...]
> Index: libavcodec/mpeg12.c
> ===================================================================
> --- libavcodec/mpeg12.c	(revision 16768)
> +++ libavcodec/mpeg12.c	(working copy)
> @@ -46,6 +46,9 @@
>  #define MB_PTYPE_VLC_BITS 6
>  #define MB_BTYPE_VLC_BITS 6
>  
> +VLC ff_mpeg12_dc_lum_vlc;
> +VLC ff_mpeg12_dc_chroma_vlc;

i wonder if mpeg12data would be a better place but then maybe not ..
either way this patch is ok as well with whichever place for the
VLC tables you like most

[...]

> +static const uint8_t tqi_coeff_vlc_tab[113][2]={
> +  {0x02, 2},//EOB
> +  {0x01, 6},//escape
> +  {0x03, 2},
> +  {0x03, 3},
> +  {0x04, 4},{0x05, 4},
> +  {0x05, 5},{0x06, 5},{0x07, 5},
> +  {0x04, 6},{0x05, 6},{0x06, 6},{0x07, 6},
> +  {0x04, 7},{0x05, 7},{0x06, 7},{0x07, 7},
> +  {0x20, 8},{0x21, 8},{0x22, 8},{0x23, 8},{0x24, 8},{0x25, 8},{0x26, 8},{0x27, 8},
> +  {0x08,10},{0x09,10},{0x0A,10},{0x0B,10},{0x0C,10},{0x0D,10},{0x0E,10},{0x0F,10},
> +  {0x10,12},{0x11,12},{0x12,12},{0x13,12},{0x14,12},{0x15,12},{0x16,12},{0x17,12},
> +  {0x18,12},{0x19,12},{0x1A,12},{0x1B,12},{0x1C,12},{0x1D,12},{0x1E,12},{0x1F,12},
> +  {0x10,13},{0x11,13},{0x12,13},{0x13,13},{0x14,13},{0x15,13},{0x16,13},{0x17,13},
> +  {0x18,13},{0x19,13},{0x1A,13},{0x1B,13},{0x1C,13},{0x1D,13},{0x1E,13},{0x1F,13},
> +  {0x10,14},{0x11,14},{0x12,14},{0x13,14},{0x14,14},{0x15,14},{0x16,14},{0x17,14},
> +  {0x18,14},{0x19,14},{0x1A,14},{0x1B,14},{0x1C,14},{0x1D,14},{0x1E,14},{0x1F,14},
> +  {0x10,15},{0x11,15},{0x12,15},{0x13,15},{0x14,15},{0x15,15},{0x16,15},{0x17,15},
> +  {0x18,15},{0x19,15},{0x1A,15},{0x1B,15},{0x1C,15},{0x1D,15},{0x1E,15},{0x1F,15},
> +  {0x10,16},{0x11,16},{0x12,16},{0x13,16},{0x14,16},{0x15,16},{0x16,16},{0x17,16},
> +  {0x18,16},{0x19,16},{0x1A,16},{0x1B,16},{0x1C,16},{0x1D,16},{0x1E,16},{0x1F,16},
> +};
> +
> +static const int8_t tqi_coeff_run_tab[113]={
> +   0,//EOB; not used
> +   0,//escape; not used
> +   1,
> +   2,
> +   1, 3,
> +   1, 5, 4,
> +   8, 7, 2, 6,
> +   3,10, 1, 9,
> +  14, 1,13,12, 4, 2, 1,11,
> +  17, 6, 1, 3, 2,16,15, 5,
> +   1, 9, 5, 1, 3, 8,22,21, 1,20,19, 2, 4, 1, 7,18,
> +  11,10, 6, 4, 3, 2, 2, 1, 1, 1, 1,27,26,25,24,23,
> +   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> +   1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
> +   2, 2, 2, 2, 7,17,16,15,14,13,12,32,31,30,29,28,
> +};
> +
> +static const int8_t tqi_coeff_level_tab[113]={
> +   0,//EOB; not used
> +   0,//escape; not used
> +   1,
> +   1,
> +   2, 1,
> +   3, 1, 1,
> +   1, 1, 2, 1,
> +   2, 1, 4, 1,
> +   1, 6, 1, 1, 2, 3, 5, 1,
> +   1, 2, 7, 3, 4, 1, 1, 2,
> +  11, 2, 3,10, 4, 2, 1, 1, 9, 1, 1, 5, 3, 8, 2, 1,
> +   2, 2, 3, 4, 5, 7, 6,15,14,13,12, 1, 1, 1, 1, 1,
> +  31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,
> +  40,39,38,37,36,35,34,33,32,14,13,12,11,10, 9, 8,
> +  18,17,16,15, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
> +};

are these tables different from mpeg1 (mpeg1_vlc/level/run)?
not counting +-1 constant offsets and different ordering of elements


[...]
> +static void tqi_decode_mb(TqiContext *s, GetBitContext *gb, DCTELEM (*block)[64]){
> +    int n;
> +    for (n=0; n<6; n++) {
> +      int component = (n <= 3 ? 0 : n - 4 + 1);
> +      s->last_dc[component] += decode_dc(gb, component);
> +      decode_block(s, gb, block[n], s->last_dc[component]);
> +    }

indention depth is odd

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090126/125c5fd8/attachment.pgp>



More information about the ffmpeg-devel mailing list