Re: [FFmpeg-devel] [PATCH 2/2] tests/audiomatch: Refine the code.
On Mon, Dec 18, 2017 at 09:41:08AM +0800, Jun Zhao wrote: > > audiomatch.c | 34 +- > 1 file changed, 17 insertions(+), 17 deletions(-) > 731bb5fb6d343903e65d5f1336b6393527bfa780 > 0002-tests-audiomatch-Refine-the-code.patch > From d2e3ba49180883dc71eb0eb0f5fa228368b4c9d5 Mon Sep 17 00:00:00 2001 > From: Jun Zhao> Date: Mon, 18 Dec 2017 09:16:52 +0800 > Subject: [PATCH 2/2] tests/audiomatch: Refine the code. > > Refine the coding style and change to use sizeof date type. > > Signed-off-by: Jun Zhao > --- > tests/audiomatch.c | 34 +- > 1 file changed, 17 insertions(+), 17 deletions(-) will apply without the data type change, as it would duplicate the type thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] tests/audiomatch: Refine the code.
On 2017/12/18 10:25, Carl Eugen Hoyos wrote: > 2017-12-18 2:41 GMT+01:00 Jun Zhao: > >> tests/audiomatch: Refine the code. > Shouldn't this be: "tests/audiomatch: Cosmetics, fix whitespace"? except fix whitespace, the other change is use date type in sizeof. > > Carl Eugen > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] tests/audiomatch: Refine the code.
2017-12-18 2:41 GMT+01:00 Jun Zhao: > tests/audiomatch: Refine the code. Shouldn't this be: "tests/audiomatch: Cosmetics, fix whitespace"? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] tests/audiomatch: Refine the code.
From d2e3ba49180883dc71eb0eb0f5fa228368b4c9d5 Mon Sep 17 00:00:00 2001 From: Jun ZhaoDate: Mon, 18 Dec 2017 09:16:52 +0800 Subject: [PATCH 2/2] tests/audiomatch: Refine the code. Refine the coding style and change to use sizeof date type. Signed-off-by: Jun Zhao --- tests/audiomatch.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/audiomatch.c b/tests/audiomatch.c index e63e494add..b432b66ec5 100644 --- a/tests/audiomatch.c +++ b/tests/audiomatch.c @@ -25,23 +25,23 @@ #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -static int64_t fsize(FILE *f){ -int64_t end, pos= ftell(f); +static int64_t fsize(FILE *f) { +int64_t end, pos = ftell(f); fseek(f, 0, SEEK_END); end = ftell(f); fseek(f, pos, SEEK_SET); return end; } -int main(int argc, char **argv){ +int main(int argc, char **argv) { FILE *f[2]; int i, pos; int siglen, datlen; int bestpos = 0; -double bestc=0; -double sigamp= 0; +double bestc = 0; +double sigamp = 0; int16_t *signal, *data; -int maxshift= 16384; +int maxshift = 16384; if (argc < 3) { printf("audiomatch \n"); @@ -77,8 +77,8 @@ int main(int argc, char **argv){ datlen = fsize(f[0]) - ftell(f[0]); siglen = fsize(f[1]) - ftell(f[1]); -data = malloc(datlen * sizeof(*data)); -signal = malloc(siglen * sizeof(*signal)); +data = malloc(datlen * sizeof(int16_t)); +signal = malloc(siglen * sizeof(int16_t)); if (fread(data , 1, datlen, f[0]) != datlen) return 1; @@ -87,24 +87,24 @@ int main(int argc, char **argv){ datlen /= 2; siglen /= 2; -for(i=0; i sigamp * 0.94) +if (fabs(c) > sigamp * 0.94) maxshift = FFMIN(maxshift, fabs(pos)+32); -if(fabs(c)>fabs(bestc)){ -bestc= c; +if (fabs(c) > fabs(bestc)) { +bestc = c; bestpos = pos; } } -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel