[FFmpeg-devel] libavutil: optimize twofish cipher

Michael Niedermayer michaelni at gmx.at
Wed Feb 18 01:20:42 CET 2015


On Wed, Feb 18, 2015 at 01:26:09AM +0530, supraja reddy wrote:
> Hello,
> 
> I have made changes as suggested. Please let me know if any further changes
> required.
> I will soon send a patch for adding a fate test too.
> 
> Thanks,
> Supraja
> 
> On Mon, Feb 16, 2015 at 5:10 PM, Michael Niedermayer <michaelni at gmx.at>
> wrote:
> 
> > On Mon, Feb 16, 2015 at 03:11:08PM +0530, supraja reddy wrote:
> > > Hello,
> > >
> > > I have attached a patch with optimization for twofish. Please let me know
> > > if any further changes required.
> > >
> > > Following are the results for crypto_bench after optimization.
> > >
> >
> > > lavu       TWOFISH      size: 1048576  runs:   1024  time:   18.799 +-
> > 0.132
> > > gcrypt     TWOFISH      size: 1048576  runs:   1024  time:   25.643 +-
> > 0.096
> > > tomcrypt   TWOFISH      size: 1048576  runs:   1024  time:   18.372 +-
> > 0.082
> >
> > please put these into the commit message, also add a
> > "before" value for lavu       TWOFISH so it can be seen by how much
> > this commit makes the code faster
> >
> > [...]
> > > +static uint32_t MDS[4][256];
> >
> > doesnt thiis depend on the key(size) ?
> > static variables must not change because code could be called from
> > different threads at the same time and the static array would be shared
> > so it could only be correct for one of the 2 threads, the other would
> > produce a wrong result
> >
> > also it seems theres no fate test for twofish yet, such test should
> > be usefull for testing / detecting regressions as its automatically
> > run on many different platforms
> >
> > [...]
> >
> > --
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > No great genius has ever existed without some touch of madness. --
> > Aristotle
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >

>  twofish.c |   52 +++++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 41 insertions(+), 11 deletions(-)
> da7e69a38113776533847faec494db04b0861630  tfopt1.patch
> From aac0be2b1795cf4f06379d3904316f174922cda4 Mon Sep 17 00:00:00 2001
> From: Supraja Meedinti <supraja0493 at gmail.com>
> Date: Wed, 18 Feb 2015 00:48:53 +0530
> Subject: [PATCH] libavutil: optimize twofish cipher
> 
> before:
> lavu       TWOFISH      size: 1048576  runs:   1024  time:   90.052 +- 4.630
> after:
> lavu       TWOFISH      size: 1048576  runs:   1024  time:   18.085 +- 0.241
> gcrypt     TWOFISH      size: 1048576  runs:   1024  time:   25.666 +- 0.307
> tomcrypt   TWOFISH      size: 1048576  runs:   1024  time:   18.428 +- 0.363
> 
> Signed-off-by: Supraja Meedinti <supraja0493 at gmail.com>

patch applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- 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/20150218/731ea728/attachment.asc>


More information about the ffmpeg-devel mailing list