[MPlayer-dev-eng] [PATCH] Proper teletext language support

Michael Niedermayer michaelni at gmx.at
Wed Aug 29 14:54:07 CEST 2007


Hi

On Mon, Aug 27, 2007 at 07:37:15PM +0700, Vladimir Voroshilov wrote:
> 2007/8/27, Michael Niedermayer <michaelni at gmx.at>:
> > On Mon, Aug 27, 2007 at 04:16:48PM +0700, Vladimir Voroshilov wrote:
> > > Hi
> > >
> > > 2007/8/27, Michael Niedermayer <michaelni at gmx.at>:
> > > > Hi
> > > >
> > > > /**
> > > >  *
> > > >  * Note, bits must be correctly ordered, that is for 8,4
> > > >  * P1 P2 D1 P3 D2 D3 D4 P4
> > >
> > > Teletext specification (subclauese 8.1, page 21) says that bits order
> > > for 8/4 hammed bytes is P1 D1 P2 D2 P3 D3 P4 D4
> > >
> > > So code can not be used for decoding teletext's 8/4 coded bytes, am i right ?
> >
> > no you are silly, you can reorder the bits, iam not saying you should though
> > it depends what effect on speed this has vs. using the existing table
> >
> > x&0x21 | ((x&0x4A)<<1) | ((x&0x94)>>1)
> >
> > also the hamm24 can be done with tables if its really speed critical but i
> > thought its not and myths solution is alot more complex then needed
> > they needs several kilobytes of tables while it could easily be done with
> > 256 byte
> >
> > just something like
> > syndrom = tab0[cw&63] ^ tab1[(cw>>6)&63] ^ tab2[(cw>>12)&63] ^ tab3[(cw>>18)&63];
> > if(syndrom&31){
> >     if(syndrom<32 || syndrom>24+32)
> >         return -1;
> >     cw^= 1<<((syndrom&31)-1);
> > }
> >
> 
> Is this ok (assuming speed is not critical)?:
> 
> int corrHamm24(unsigned char *data){
>     int cw=data[0] | (data[1]<<8) | (data[2]<<16);
>     int syndrom=0;
> 
>     for(i=0; i<23; i++)
>         syndrom ^= ((cw>>i)&1)*(i+33);
> 
>     syndrom ^=(cw>>18)&32; //P6
> 
>     if(syndrom&31){
>         if (syndrom<32 || syndrom>23+32) //Multiple error
>             return -1;
> 
>         cw^=1<<(syndrom-33);    //Single error
>     }
>     return (cw&4)>>2 |
>            (cw&0xf0)>>3 |
>            (cw&0x3f00)>>4 |
>            (cw&0x3f0000)>>11;
> }

without the bugs in the reordering in the last return, yes


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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- 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/mplayer-dev-eng/attachments/20070829/2c015c17/attachment.pgp>


More information about the MPlayer-dev-eng mailing list