[Ffmpeg-devel] [patch] move av_xiphlacing in avutil
Michael Niedermayer
michaelni
Wed Nov 23 14:56:08 CET 2005
Hi
On Wed, Nov 23, 2005 at 07:52:29AM +0100, Jindrich Makovicka wrote:
> Michael Niedermayer wrote:
> >hmm, IMHO if the code is small and generic it should be ok (a single crc
> >calculation function for all 8,16 and 32bit, and no hardcoded tables, but
> >tables generated with some init_crc() function)
> >unless there are objections of course ...
>
> This should allow arbitrary 8-32 big & little endian crc. The code is
> currently quite a lot slower than a hardcoded table, about 30% slower
> for 16bit crc, slightly better for 8 and 32 bit.
could you post the generated asm code (gcc -S -O3 -march...) of the slower
code and of the current fast code
[...]
> uint32_t av_crc(AVCRC *ctx, uint32_t start_crc, uint8_t *buffer, size_t length)
> {
> register size_t i;
> start_crc &= ctx->mask;
> if (ctx->bits <= 8) {
> for (i = 0; i < length; i++)
> start_crc = ctx->tab[((uint8_t)start_crc) ^ *buffer++];
> } else if (ctx->le) {
> for (i = 0; i < length; i++)
> start_crc = ctx->tab[((uint8_t)start_crc) ^ *buffer++] ^ (start_crc >> 8);
> } else {
> for (i = 0; i < length; i++)
> start_crc = ctx->tab[(uint8_t)(start_crc>>(ctx->bits-8)) ^ *buffer++] ^ (start_crc << 8);
> }
> return(start_crc & ctx->mask);
> }
hmm, cant the table and start_crc be modified so that the ctx->le case is always useable?
[...]
--
Michael
More information about the ffmpeg-devel
mailing list