[FFmpeg-devel] [PATCH] force dnxhd encoder to be independent of qsort internals
Reimar Döffinger
Reimar.Doeffinger
Sat Sep 19 13:16:51 CEST 2009
Hello,
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.
Not benchmarked, but compared to the function call overhead the extra
code in the comparison function should not hurt that much.
Regression test references need to be updated, too.
Tested and at least FreeBSD and Linux give the same results.
Index: dnxhdenc.c
===================================================================
--- dnxhdenc.c (revision 19922)
+++ dnxhdenc.c (working copy)
@@ -653,7 +653,10 @@
static int dnxhd_rc_cmp(const void *a, const void *b)
{
- return ((const RCCMPEntry *)b)->value - ((const RCCMPEntry *)a)->value;
+ int delta = ((const RCCMPEntry *)b)->value - ((const RCCMPEntry *)a)->value;
+ if (delta)
+ return delta;
+ return ((const RCCMPEntry *)b)->mb - ((const RCCMPEntry *)a)->mb;
}
static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
Index: tests/vsynth.regression.ref
===================================================================
--- tests/vsynth.regression.ref (revision 19923)
+++ tests/vsynth.regression.ref (working copy)
@@ -162,13 +162,13 @@
14400000 ./tests/data/a-dv50.dv
a2ff093e93ffed10f730fa21df02fc50 *./tests/data/dv50.vsynth.out.yuv
stddev: 1.72 PSNR: 43.37 bytes: 7603200/ 7603200
-8ff3c18dabe28509b4e5b3fdaa7f0856 *./tests/data/a-dnxhd-1080i.mov
+474437fb5a7b4b12d41ae1edb49b1a7e *./tests/data/a-dnxhd-1080i.mov
30311415 ./tests/data/a-dnxhd-1080i.mov
-52f50a8031eebf980a1303e4744a49f8 *./tests/data/dnxhd.vsynth.out.yuv
+426a1325042c65a631efd8436f157be7 *./tests/data/dnxhd.vsynth.out.yuv
stddev: 6.28 PSNR: 32.16 bytes: 7603200/ 7603200
-d206daba40f3c1be8b834de8a41e984c *./tests/data/a-dnxhd-720p.dnxhd
+3f6e753c015ed59ee8067f3d8b7dd29b *./tests/data/a-dnxhd-720p.dnxhd
22937600 ./tests/data/a-dnxhd-720p.dnxhd
-d7f14ee0dd3a4df95f05999677da348b *./tests/data/dnxhd.vsynth.out.yuv
+5e14a3890705c6c62032822b52ea14e6 *./tests/data/dnxhd.vsynth.out.yuv
stddev: 6.39 PSNR: 32.00 bytes: 7603200/ 7603200
c0a42b916489d3c1d0a315974821e28d *./tests/data/a-dnxhd-720p-rd.dnxhd
22937600 ./tests/data/a-dnxhd-720p-rd.dnxhd
More information about the ffmpeg-devel
mailing list