[FFmpeg-devel] [PATCH/RFC] ALT_BITSTREAMREADER optimizations for the platforms with strict alignment

Siarhei Siamashka siarhei.siamashka
Mon Dec 8 11:12:41 CET 2008


Hello,

The attached patch improves performance for ALT_BITSTREAMREADER on the
platforms with strictly aligned or slow unaligned memory accesses. Current
implementation results in the generation of 4 memory accesses reading data
byte after byte for such platforms, which is a bit excessive (only reads
for 3 bytes are needed to ensure availability of 17 bits in bitstreamreader
cache). Legacy ARM cores (which do not support unaligned memory accesses)
can benefit from it.

Unfortunately FFmpeg contains some code which violates MIN_CACHE_BITS == 17
requirement. One of such examples is 'svq1_dec.c'. Patch to fix it is also
attached, but it probably makes sense to add a new function which would accept
1-25 range ('get_bits_medium'?) and not to lose performance on the platforms
where ALT_BITSTREAM_READER actually can provide 25 bits. Some tweaks in this
area are possible.

Regression test still fails, so there are some other bugs to find and fix.

-- 
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alt_bitstreamreader_legacy_arm_optimization.diff
Type: text/x-diff
Size: 1047 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081208/c7bebf9f/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svq1dec_bitstreamreader_fix.diff
Type: text/x-diff
Size: 827 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081208/c7bebf9f/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081208/c7bebf9f/attachment.pgp>



More information about the ffmpeg-devel mailing list