[FFmpeg-devel] [PATCH] force dnxhd encoder to be independent of qsort internals
Michael Niedermayer
michaelni
Sun Sep 20 23:29:38 CEST 2009
On Sun, Sep 20, 2009 at 02:13:03PM +0200, Reimar D?ffinger wrote:
[...]
> +static void radix_count(const RCCMPEntry *data, int size, int *buckets, int shift)
> +{
> + int i;
> + int offset;
> + memset(buckets, 0, sizeof(*buckets) * NBUCKETS);
> + for (i = 0; i < size; i++)
> + buckets[get_bucket(data[i].value, shift)]++;
> + offset = size;
maybe the following is faster
for (i = 0; i < size; i++){
unsigned int v= data[i].value;
buckets[0][v&255]++; v>>=8;
buckets[1][v&255]++; v>>=8;
buckets[2][v&255]++; v>>=8;
buckets[3][v ]++;
}
also if buckets[3][0] == size the one pass can be skiped, similarly
the others
> + for (i = NBUCKETS - 1; i >= 0; i--)
> + buckets[i] = offset -= buckets[i];
> + assert(!buckets[0]);
> +}
> +
> +static void radix_sort_pass(RCCMPEntry *dst, const RCCMPEntry *data, int size, int pass)
> +{
> + int i;
> + int shift = pass * av_log2(NBUCKETS);
is this as fast as a compiletime constant?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/c2e0aca3/attachment.pgp>
More information about the ffmpeg-devel
mailing list