[FFmpeg-devel] [PATCH] Optimization of original IFF codec
Sebastian Vater
cdgs.basty
Mon Apr 26 01:45:30 CEST 2010
Hi Michael!
I have attached a patch which includes your changes.
It doesn't work with 24 bit decoding, it shows then the graphics with
black vertical lines in between...
I already tried a << (plane & 7) in the lookup table then the image is
smooth but reduced effective image width by 1/3.
Maybe you can take a look on it?
Note that my patch has your optimization for 24bpp disabled, if you want
to enable this for testing, change:
+ const unsigned b32 = (bps <= 8) ? b & ~3 : 0; \
to
+ const unsigned b32 = b & ~3; \
Michael Niedermayer a ?crit :
>>> that loop then can be unrolled by a factor of 4 and its inside for the
>>> uint8_t type case be implemented like:
>>> v= lut[get_bits(&gb, 4)];
>>> AV_WN32A(dst+b, AV_RN32A(dst+b) | v);
>>>
>>>
>> The thing is that type can be both uint8_t and uint32_t. It's a #define
>> macro which gets the type (uint8_t or uint32_t) passed by.
>>
>> So not fixed yet because I'm unsure here, if those two lines can be done
>> with dst being uint32_t also.
>>
I have done some benchmarks, first the old one (also the one from my
latest patch):
basty at cdgs-basty:~/src/ffmpeg/build$ ./ffplay ../patches/Heart.ILBM
FFplay version git-36b1b3c, Copyright (c) 2003-2010 the FFmpeg developers
built on Apr 26 2010 00:00:19 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
configuration:
libavutil 50.14. 0 / 50.14. 0
libavcodec 52.66. 0 / 52.66. 0
libavformat 52.61. 0 / 52.61. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
[IFF @ 0x8b32790]Estimating duration from bitrate, this may be inaccurate
Input #0, IFF, from '../patches/Heart.ILBM':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: iff_ilbm, pal8, 320x200, PAR 10:11 DAR 16:11,
90k tbr, 90k tbn, 90k tbc
29230 dezicycles in decodeplane8, 1 runs, 0 skips
29345 dezicycles in decodeplane8, 2 runs, 0 skips
28802 dezicycles in decodeplane8, 4 runs, 0 skips
43508 dezicycles in decodeplane8, 8 runs, 0 skips
35165 dezicycles in decodeplane8, 16 runs, 0 skips
31050 dezicycles in decodeplane8, 32 runs, 0 skips
28953 dezicycles in decodeplane8, 64 runs, 0 skips
27712 dezicycles in decodeplane8, 127 runs, 1 skips
27151 dezicycles in decodeplane8, 254 runs, 2 skips
26823 dezicycles in decodeplane8, 509 runs, 3 skips
2.15 A-V: 0.000 s:0.0 aq= 0KB vq= 0KB sq= 0B f=0/0 0/0
>
> they can, and it will speed the uint8 case up significantly
>
Now your idea with the lookup table without inline statement:
basty at cdgs-basty:~/src/ffmpeg/build$ ./ffplay ../patches/Heart.ILBM
FFplay version git-36b1b3c, Copyright (c) 2003-2010 the FFmpeg developers
built on Apr 26 2010 00:00:19 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
configuration:
libavutil 50.14. 0 / 50.14. 0
libavcodec 52.66. 0 / 52.66. 0
libavformat 52.61. 0 / 52.61. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
[IFF @ 0x8b32790]Estimating duration from bitrate, this may be inaccurate
Input #0, IFF, from '../patches/Heart.ILBM':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: iff_ilbm, pal8, 320x200, PAR 10:11 DAR 16:11,
90k tbr, 90k tbn, 90k tbc
21930 dezicycles in decodeplane8, 1 runs, 0 skips
17930 dezicycles in decodeplane8, 2 runs, 0 skips
14505 dezicycles in decodeplane8, 4 runs, 0 skips
12200 dezicycles in decodeplane8, 8 runs, 0 skips
10999 dezicycles in decodeplane8, 16 runs, 0 skips
10738 dezicycles in decodeplane8, 32 runs, 0 skips
10276 dezicycles in decodeplane8, 64 runs, 0 skips
10066 dezicycles in decodeplane8, 128 runs, 0 skips
9988 dezicycles in decodeplane8, 256 runs, 0 skips
9929 dezicycles in decodeplane8, 512 runs, 0 skips
3.12 A-V: 0.000 s:0.0 aq= 0KB vq= 0KB sq= 0B f=0/0 0/0
Finally, your idea with lookup table with inline statement:
basty at cdgs-basty:~/src/ffmpeg/build$ ./ffplay ../patches/Heart.ILBM
FFplay version git-36b1b3c, Copyright (c) 2003-2010 the FFmpeg developers
built on Apr 26 2010 00:00:19 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
configuration:
libavutil 50.14. 0 / 50.14. 0
libavcodec 52.66. 0 / 52.66. 0
libavformat 52.61. 0 / 52.61. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
[IFF @ 0x8b32790]Estimating duration from bitrate, this may be inaccurate
Input #0, IFF, from '../patches/Heart.ILBM':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: iff_ilbm, pal8, 320x200, PAR 10:11 DAR 16:11,
90k tbr, 90k tbn, 90k tbc
16250 dezicycles in decodeplane8, 1 runs, 0 skips
14050 dezicycles in decodeplane8, 2 runs, 0 skips
11452 dezicycles in decodeplane8, 4 runs, 0 skips
9405 dezicycles in decodeplane8, 8 runs, 0 skips
8330 dezicycles in decodeplane8, 16 runs, 0 skips
8061 dezicycles in decodeplane8, 32 runs, 0 skips
7855 dezicycles in decodeplane8, 64 runs, 0 skips
7558 dezicycles in decodeplane8, 128 runs, 0 skips
7486 dezicycles in decodeplane8, 256 runs, 0 skips
7416 dezicycles in decodeplane8, 512 runs, 0 skips
1.08 A-V: 0.000 s:0.0 aq= 0KB vq= 0KB sq= 0B f=0/0 0/0
Looks, really nice...
--
Best regards,
:-) Basty/CDGS (-:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iff-optimize-lut.patch
Type: text/x-patch
Size: 2165 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100426/349cd738/attachment.bin>
More information about the ffmpeg-devel
mailing list