[FFmpeg-devel] libavutil: optimize camellia cipher
Michael Niedermayer
michaelni at gmx.at
Mon Feb 9 22:40:08 CET 2015
On Tue, Feb 10, 2015 at 12:44:23AM +0530, supraja reddy wrote:
> Hello,
>
> I have attached a patch to optimize the camellia block cipher.
> I ran crypto_bench on the optimized version. Here are the results of
> runtime using crypto_bench.
>
> Before the changes :
> lavu CAMELLIA size: 1048576 runs: 1024 time: 32.541 +- 0.044
>
> After the changes:
> lavu CAMELLIA size: 1048576 runs: 1024 time: 24.589 +- 0.066
>
> I ran this on a Linux x86_64 OS with Intel Core i5-3210M CPU.
>
> Please let me know if there are any changes you would like.
>
>
> Thanks,
>
> Supraja
> camellia.c | 37 +++++++++++++++++++++++++++----------
> 1 file changed, 27 insertions(+), 10 deletions(-)
> 0aecabcca7c8404e628afc26ff632314d01f2c1c camopt1.patch
> From 9079c80bd5caa122ea1261b47e1fcb0e7d554af5 Mon Sep 17 00:00:00 2001
> From: Supraja Meedinti <supraja0493 at gmail.com>
> Date: Tue, 10 Feb 2015 00:16:55 +0530
> Subject: [PATCH] libavutil: optimize camellia cipher
applied
[...]
> @@ -140,17 +142,11 @@ static void LR128(uint64_t d[2], const uint64_t K[2], int x)
>
> static uint64_t F(uint64_t F_IN, uint64_t KE)
> {
> - uint32_t Zl, Zr;
> + uint8_t y[8];
> KE ^= F_IN;
[...]
> + AV_WB64(y,KE);
> + KE=SP[0][y[0]]^SP[1][y[1]]^SP[2][y[2]]^SP[3][y[3]]^SP[4][y[4]]^SP[5][y[5]]^SP[6][y[6]]^SP[7][y[7]];
> + return KE;
have you tried it without the y[] array ?
storing and loading from memory may (or may not) be slower
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150209/d4b9de39/attachment.asc>
More information about the ffmpeg-devel
mailing list