[FFmpeg-devel] [PATCH] avcodec/motion_est_template: replace qsort with AV_QSORT
Ganesh Ajjanagadde
gajjanagadde at gmail.com
Wed Oct 28 03:51:29 CET 2015
This code is in a performance critical section. AV_QSORT is
substantially faster due to the inlining of the comparison callback.
Thus, the increase in performance is worth the increase in binary size.
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
-------------------------------------------------------------------------------
Benchmarks not provided, since FATE does not seem to exercise this.
Left to the maintainer/any interested.
---
libavcodec/motion_est_template.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c
index 37ff110..327a24b 100644
--- a/libavcodec/motion_est_template.c
+++ b/libavcodec/motion_est_template.c
@@ -24,6 +24,7 @@
* Motion estimation template.
*/
+#include "libavutil/qsort.h"
#include "mpegvideo.h"
//Let us hope gcc will remove the unused vars ...(gcc 3.2.2 seems to do it ...)
@@ -723,7 +724,7 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
j++;
}
- qsort(minima, j, sizeof(Minima), minima_cmp);
+ AV_QSORT(minima, j, Minima, minima_cmp);
for(; j<minima_count; j++){
minima[j].height=256*256*256*64;
--
2.6.2
More information about the ffmpeg-devel
mailing list