[Ffmpeg-devel] [PATCH] ported SGI decoder to the new API
Xiaohui Sun
sunxiaohui
Wed Mar 28 03:52:36 CEST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael Niedermayer wrote:
>> +
>> + count = (row - start) / stride;
>> + while (count > 0) {
>> + i = count > 126 ? 126 : count;
>> + count -= i;
>> +
>> + bytestream_put_byte(buf, i);
>> + length++;
>> +
>> + bytestream_put_byte(buf, repeat);
>> + length++;
>> + };
>> + };
>
> with an input of 1 1
> this loop would produce 0x82 0x01 0x01
> instead of the shorter 0x02 0x01
>
> also its code duplication, the rle encoding code from targaenc.c should be
> used or if your code is faster and works correctly then you should place it
> in rle.c/h and make targaenc.c use it
>
I have read the code in targaenc.c, the rle code is below
[...]
for(pos = start + bpp; count < FFMIN(128, len); pos += bpp, count ++) {
if(same != !memcmp(pos-bpp, pos, bpp)) {
[...]
This may not proper for sgi and here we compare each color in a pixel
instead of the pixel, so the bpp is always set to 1, which leads to a
frequent call to memcmp.
Besides, comparing with 128 each time is not efficient enough, it could
be compared after we get the consecutive pixels number and I think
comparing with zero will be more effective.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGCcpk+BwsLu3sVWwRAi8OAKCoS/F4NGxz9FzrbPTWU4i2y30qmACeI9BV
trUncWnCGc2AywK6odAIr50=
=6e/c
-----END PGP SIGNATURE-----
More information about the ffmpeg-devel
mailing list