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

Peter Ross pross
Tue Oct 7 12:53:49 CEST 2008


On Sat, Oct 04, 2008 at 03:19:50AM +0200, Michael Niedermayer wrote:
> On Fri, Oct 03, 2008 at 09:43:51PM +1000, Peter Ross wrote:
> > On Sat, Sep 27, 2008 at 08:07:05PM +1000, Peter Ross wrote:
> > > On Sat, Sep 27, 2008 at 10:12:34AM +1000, Peter Ross wrote:
> > > > Patches enclosed.
> > > > 
> > > > Info: http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TGQ
> > > > Samples: http://samples.mplayerhq.hu/game-formats/ea-tgq-uv/
> > > 
> > > Thanks for the prompt feedback. Round two enclosed.
> > 
> > Round three. (See earlier posts for inv_aanscales.diff and eatgq-demux-r1.diff.)

Comments below. Round four enclosed.

> > --- libavcodec/dsputil.c	(revision 15532)
> > +++ libavcodec/dsputil.c	(working copy)
> > @@ -4137,6 +4137,64 @@
> >      dest[0] = cm[dest[0] + ((block[0] + 4)>>3)];
> >  }
> >  
> > +/* Electronic Arts TGQ/TQI/MAD IDCT algorithm */
> > +#define A4 1.3065630f
> > +#define A2 0.5411961f
> > +#define A5 0.3826834f
> > +#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\
> 
> I think this should be in a seperate file, dsputil is already rather bloated

Agree! (and at 4000+ lines, it now takes my personal super-computer a whole
second to compile dsputil.o).

> [...]
> > +static void tgq_decode_block(TgqContext *s, DCTELEM block[64], GetBitContext *gb){
> > +    uint8_t *perm = s->scantable.permutated;
> > +    int i,j,value;
> > +    block[0] = get_sbits(gb,8) * s->qtable[0];
> > +    for(i=1; i<64; ) {
> > +        switch(show_bits(gb,3)) {
> > +        case 4:
> > +            block[perm[i++]] = 0;
> > +        case 0:
> > +            block[perm[i++]] = 0;
> > +            skip_bits(gb,3);
> > +            break;
> 
> > +        case 5:
> > +            block[perm[i++]] = 0;
> > +        case 1:
> > +            skip_bits(gb,3);
> > +            value = 2*get_bits(gb,5);
> 
> isnt this the same as
> case 5:
> case 1:
>     skip_bits(gb,2);
>     value = get_bits(gb,6);
> ?

Well spotted!

> [...]
> > +    if (!s->frame.data[0]) {
> > +        s->frame.key_frame = 1;
> > +        s->frame.pict_type = FF_I_TYPE;
> 
> > +        s->frame.reference = 1;
> 
> this is not strictly correct, is there any problem if its removed?

No problems. CRC identical for available samples.

Cheers,

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eatgq-decode-r5a.diff
Type: text/x-diff
Size: 13853 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081007/a0f2bb34/attachment.diff>
-------------- 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/20081007/a0f2bb34/attachment.pgp>



More information about the ffmpeg-devel mailing list