[FFmpeg-cvslog] avfilter/vf_deshake: use a void * comparator for consistency
Ganesh Ajjanagadde
git at videolan.org
Sun Oct 25 02:37:47 CEST 2015
ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Sat Oct 24 17:49:57 2015 -0400| [2ee51ef259e65e881b36aba7e6f9402b525a5ce0] | committer: Ganesh Ajjanagadde
avfilter/vf_deshake: use a void * comparator for consistency
For generality, qsort uses a comparator whose elements are void *. This
makes the comparator have such a form, and thus makes the void * cast of
the comparator pointer useless. Furthermore, this makes the code more
consistent with other usages of qsort across the codebase.
Reviewed-by: Henrik Gramner <henrik at gramner.com>
Reviewed-by: wm4 <nfxjfg at googlemail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ee51ef259e65e881b36aba7e6f9402b525a5ce0
---
libavfilter/vf_deshake.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index ac13ecd..885569a 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -91,9 +91,10 @@ static const AVOption deshake_options[] = {
AVFILTER_DEFINE_CLASS(deshake);
-static int cmp(const double *a, const double *b)
+static int cmp(const void *a, const void *b)
{
- return *a < *b ? -1 : ( *a > *b ? 1 : 0 );
+ const double va = *(const double *)a, vb = *(const double *)b;
+ return va < vb ? -1 : ( va > vb ? 1 : 0 );
}
/**
@@ -105,7 +106,7 @@ static double clean_mean(double *values, int count)
int cut = count / 5;
int x;
- qsort(values, count, sizeof(double), (void*)cmp);
+ qsort(values, count, sizeof(double), cmp);
for (x = cut; x < count - cut; x++) {
mean += values[x];
More information about the ffmpeg-cvslog
mailing list