[Ffmpeg-devel] [PATCH] support S302M streams in MPEG TS

Baptiste Coudurier baptiste.coudurier
Wed Dec 13 10:43:58 CET 2006


Hi

Reimar D?ffinger wrote:
> Hello,
> On Fri, Dec 01, 2006 at 11:58:21AM +0100, Baptiste Coudurier wrote:
>> +static void s302m_subframe_20bit(S302MContext *s, const uint8_t *buf)
>> +{
>> +    /* reverse sample to suit big endian */
>> +    s->outbuf_ptr[0] = ff_reverse[((buf[1] & 0x0f) << 4) | ((buf[2] & 0xf0) >> 4)];
>> +    s->outbuf_ptr[1] = ff_reverse[((buf[0] & 0x0f) << 4) | ((buf[1] & 0xf0) >> 4)];
>> +    s->outbuf_ptr[2] = ff_reverse[buf[0] & 0xf0];
>> +    s->outbuf_ptr[3] = ff_reverse[((buf[4] & 0x0f) << 4) | ((buf[5] & 0xf0) >> 4)];
>> +    s->outbuf_ptr[4] = ff_reverse[((buf[3] & 0x0f) << 4) | ((buf[4] & 0xf0) >> 4)];
>> +    s->outbuf_ptr[5] = ff_reverse[buf[3] & 0xf0];
>> +    s->outbuf_ptr += 6;
>> +}
> 
> Simplification example:
> uint32_t tmp = BE_32(buf);
> tmp >>= 12;
> s->outbuf_ptr[0] = ff_reverse[tmp & 0xff];
> tmp >>= 8;
> s->outbuf_ptr[1] = ff_reverse[tmp & 0xff];
> s->outbuf_ptr[2] = ff_reverse[tmp >> 8];
> tmp = BE_32(&buf[3]);
> ...
> 
> Or even just doing ff_reverse before all the bit shifting should help.
> Also, though not important, the bits in e.g. buf[2] & 0x0f seem to
> contain some data, too (synchronization info or some such).
> 

It is slower here.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list