[MPlayer-dev-eng] [PATCH] Proper teletext language support
Vladimir Voroshilov
voroshil at gmail.com
Mon Aug 27 14:37:15 CEST 2007
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;
}
--
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
More information about the MPlayer-dev-eng
mailing list