[FFmpeg-devel] [PATCH] Optimization of original IFF codec

Sebastian Vater cdgs.basty
Mon Apr 26 19:57:51 CEST 2010


Hi Mans!

M?ns Rullg?rd a ?crit :
> This is inefficient.  You are building the table afresh on each call
> to the function.  Make the table static const, dropping the shift, and
> instead shift the table value inside the loop.
>   
I just benchmarked both, my solution is way faster:

Benchmarking my patch resulted:
FFplay version git-fb63232, Copyright (c) 2003-2010 the FFmpeg developers
  built on Apr 26 2010 19:54:23 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
16650 dezicycles in decodeplane8, 1 runs, 0 skips
13540 dezicycles in decodeplane8, 2 runs, 0 skips
10930 dezicycles in decodeplane8, 4 runs, 0 skips
8897 dezicycles in decodeplane8, 8 runs, 0 skips
7853 dezicycles in decodeplane8, 16 runs, 0 skips
7599 dezicycles in decodeplane8, 32 runs, 0 skips
7227 dezicycles in decodeplane8, 64 runs, 0 skips
7025 dezicycles in decodeplane8, 128 runs, 0 skips
6992 dezicycles in decodeplane8, 256 runs, 0 skips
6950 dezicycles in decodeplane8, 512 runs, 0
skips                             

With your idea, making the lut static const and do the shift in the loop
yields:
basty at cdgs-basty:~/src/ffmpeg/build$ ./ffplay ../patches/Heart.ILBM
FFplay version git-fb63232, Copyright (c) 2003-2010 the FFmpeg developers
  built on Apr 26 2010 19:54:23 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
14530 dezicycles in decodeplane8, 1 runs, 0 skips
13035 dezicycles in decodeplane8, 2 runs, 0 skips
11327 dezicycles in decodeplane8, 4 runs, 0 skips
10231 dezicycles in decodeplane8, 8 runs, 0 skips
9255 dezicycles in decodeplane8, 16 runs, 0 skips
9100 dezicycles in decodeplane8, 32 runs, 0 skips
8725 dezicycles in decodeplane8, 64 runs, 0 skips
8623 dezicycles in decodeplane8, 128 runs, 0 skips
8584 dezicycles in decodeplane8, 256 runs, 0 skips
8501 dezicycles in decodeplane8, 512 runs, 0 skips
   1.19 A-V:  0.000 s:0.0 aq=    0KB vq=    0KB sq=    0B f=0/0   0/

-- 

Best regards,
                   :-) Basty/CDGS (-:




More information about the ffmpeg-devel mailing list