[FFmpeg-devel] [PATCH] force dnxhd encoder to be independent of qsort internals
Michael Niedermayer
michaelni
Sun Sep 20 12:28:17 CEST 2009
On Sun, Sep 20, 2009 at 12:25:57PM +0200, Reimar D?ffinger wrote:
> On Sun, Sep 20, 2009 at 12:10:24PM +0200, Michael Niedermayer wrote:
> > On Sun, Sep 20, 2009 at 11:39:26AM +0200, Reimar D?ffinger wrote:
> > > On Sun, Sep 20, 2009 at 11:08:45AM +0200, Reimar D?ffinger wrote:
> > > > On Sat, Sep 19, 2009 at 01:16:51PM +0200, Reimar D?ffinger wrote:
> > > > > this change makes sure there are no equal elements in the data passed to
> > > > > qsort, thus making sure the result is independent of implementation
> > > > > internals.
> > > >
> > > > Very slightly different, swapped the mb comparison so the original order
> > > > is kept by default. Seems nicer and might decreases needed memory
> > > > bandwidth if a lot of values are identical (very unlikely I think).
> > >
> > > qsort itself is nearly 5% slower for the Linux implementation:
> > > 31596660 dezicycles in encode_fast, 1 runs, 0 skips
> > > 30286580 dezicycles in encode_fast, 2 runs, 0 skips
> > > 29324712 dezicycles in encode_fast, 4 runs, 0 skips
> > > 28957121 dezicycles in encode_fast, 8 runs, 0 skips
> > > 28722058 dezicycles in encode_fast, 16 runs, 0 skips
> > > 28665462 dezicycles in encode_fast, 32 runs, 0 skips
> > > 28597622 dezicycles in encode_fast, 64 runs, 0 skips
> > >
> > > 32579940 dezicycles in encode_fast, 1 runs, 0 skips
> > > 31456890 dezicycles in encode_fast, 2 runs, 0 skips
> > > 30567462 dezicycles in encode_fast, 4 runs, 0 skips
> > > 30156817 dezicycles in encode_fast, 8 runs, 0 skips
> > > 30013356 dezicycles in encode_fast, 16 runs, 0 skips
> > > 29935421 dezicycles in encode_fast, 32 runs, 0 skips
> > > 29924871 dezicycles in encode_fast, 64 runs, 0 skips
> > >
> > > But difference for the whole encode_fast function is within the
> > > variance, at most 0.2 % slower I'd say as in this case (again,
> >
> > why dont you just do a radix sort? Should only be a few lines
> > of C, faster and portable
>
> Yes, but I like to have stable make test before changing code.
> As simple as radix sort may be, I am almost certain to mess it up on
> the first try.
for(all elements - 1)
assert(x[i] < x[i+1]);
> Also it takes a bit longer/more effort to code, I'd first like to know
> how much it actually fixes.
perfectly fine of course
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090920/3a45831a/attachment.pgp>
More information about the ffmpeg-devel
mailing list