[FFmpeg-devel] [PATCH] Add 128 bit murmur3 hash function.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun May 12 00:34:29 CEST 2013


On Sat, May 11, 2013 at 09:21:22PM +0200, Michael Niedermayer wrote:
> On Fri, May 10, 2013 at 08:05:18AM +0200, Reimar Döffinger wrote:
> > On 10.05.2013, at 04:14, Michael Niedermayer <michaelni at gmx.at> wrote:
> > >> +{
> > >> +    uint64_t k = get_k1(src);
> > >> +    k ^= c->h1;
> > >> +    k = ROT(k, 27);
> > >> +    k += c->h2;
> > >> +    k *= 5;
> > >> +    k += 0x52dce729;
> > >> +    c->h1 = k;
> > >> +
> > >> +    k = get_k2(src);
> > >> +    k ^= c->h2;
> > >> +    k = ROT(k, 31);
> > >> +    k += c->h1;
> > >> +    k *= 5;
> > >> +    k += 0x38495ab5;
> > >> +    c->h2 = k;
> > >> +}
> > > 
> > > interleaving the operations a bit might improve performance
> > 
> > How?
> 
> what i had in mind was something like this:
> (note, i dont know at all if its faster)

For me, the variant I sent is a bit faster still.
However the big part was using local variables (20%) this gave about
another 10%.
But note that the final version runs at 5.7 GB/s for me, I think it
is kind of pointless to optimize further.
At least on my computer it would be limited by memory bandwidth
much before if I hadn't reduced the data size to fit into the cache.


More information about the ffmpeg-devel mailing list