Re: [FFmpeg-devel] [PATCH] Add test for avpriv_get_trc_function_from_trc function
On Thu, Mar 03, 2016 at 10:01:28AM -0800, NagaChaitanya Vellanki wrote: > --- > libavutil/Makefile | 1 + > libavutil/color_utils.c| 29 + > tests/fate/libavutil.mak | 4 + > tests/ref/fate/color_utils | 285 > + > 4 files changed, 319 insertions(+) > create mode 100644 tests/ref/fate/color_utils > > diff --git a/libavutil/Makefile b/libavutil/Makefile > index a4d79cd..934564f 100644 > --- a/libavutil/Makefile > +++ b/libavutil/Makefile > @@ -176,6 +176,7 @@ TESTPROGS = adler32 > \ > bprint \ > cast5 \ > camellia\ > +color_utils \ > cpu \ > crc \ > des \ > diff --git a/libavutil/color_utils.c b/libavutil/color_utils.c > index b68b402..0bb7e3d 100644 > --- a/libavutil/color_utils.c > +++ b/libavutil/color_utils.c > @@ -21,6 +21,7 @@ > #include > #include > > +#include "common.h" > #include "libavutil/color_utils.h" > #include "libavutil/pixfmt.h" > > @@ -216,3 +217,31 @@ avpriv_trc_function > avpriv_get_trc_function_from_trc(enum AVColorTransferCharact > } > return func; > } > + > +#ifdef TEST > +// LCOV_EXCL_START > + > +int main(int argc, char *argv[]) > +{ > + int i, j; > + double test_data[] = { should have been static const but ill change that > + -0.1, -0.018053968510807, -0.01, -0.00449, 0.0, 0.00316227760, 0.005, > + 0.009, 0.015, 0.1, 1.0, 52.37, 125.098765, 1999.11123, 6945.443, > + 15123.4567, 19845.88923, 98678.4231, 9.88 > + }; > + > + for(i = 0; i < AVCOL_TRC_NB; i++) { > + avpriv_trc_function func = avpriv_get_trc_function_from_trc(i); > + for(j = 0; j < FF_ARRAY_ELEMS(test_data); j++) { > + if(func != NULL) { > + double result = func(test_data[j]); > + printf("AVColorTransferCharacteristic=%d calling func(%f) > expected=%f\n", > + i, test_data[j], result); > + } > + } > + } tested on mips and arm qemu as well as mingw, seems working everywhere ill apply it if it is later found to fail somewhere (like msvc) reducing the number of digits printed likely should fix it we have thousands of float compares like this in fate already ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add test for avpriv_get_trc_function_from_trc function
Derek, I agree with you, checked this on ubuntu, mac os both x86_32, x86_64. On Thu, Mar 3, 2016 at 10:11 AM, Derek Buitenhuis < derek.buitenh...@gmail.com> wrote: > On 3/3/2016 6:01 PM, NagaChaitanya Vellanki wrote: > > + printf("AVColorTransferCharacteristic=%d calling func(%f) > expected=%f\n", > > + i, test_data[j], result); > > Comparing floats exactly probably isn't a great idea, since > floating point implementations differ between architectures. > > - Derek > ___ > 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] Add test for avpriv_get_trc_function_from_trc function
On Thu, Mar 03, 2016 at 06:11:19PM +, Derek Buitenhuis wrote: > On 3/3/2016 6:01 PM, NagaChaitanya Vellanki wrote: > > + printf("AVColorTransferCharacteristic=%d calling func(%f) > > expected=%f\n", > > + i, test_data[j], result); > > Comparing floats exactly probably isn't a great idea, since > floating point implementations differ between architectures. it should be ok if the number of digits printed after the decimal point are not too many ill try to test if this works on what i have easy access to [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add test for avpriv_get_trc_function_from_trc function
On 3/3/2016 6:01 PM, NagaChaitanya Vellanki wrote: > + printf("AVColorTransferCharacteristic=%d calling func(%f) > expected=%f\n", > + i, test_data[j], result); Comparing floats exactly probably isn't a great idea, since floating point implementations differ between architectures. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add test for avpriv_get_trc_function_from_trc function
On Tue, Mar 01, 2016 at 09:11:21PM +0100, Michael Niedermayer wrote: > On Tue, Mar 01, 2016 at 11:37:37AM -0800, NagaChaitanya Vellanki wrote: > > --- > > libavutil/Makefile | 1 + > > libavutil/color_utils.c | 53 > > + > > 2 files changed, 54 insertions(+) > > to test avpriv_get_trc_function_from_trc(), one could > for each index test the returned function at a few values, print the > values and have "make fate" compare that output against a reference > file also see how other fate tests are done which compare some output to a reference file for example: 28a2107a8d61af7c7a26f9d4af0716ba12c112a7 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add test for avpriv_get_trc_function_from_trc function
On Tue, Mar 01, 2016 at 11:37:37AM -0800, NagaChaitanya Vellanki wrote: > --- > libavutil/Makefile | 1 + > libavutil/color_utils.c | 53 > + > 2 files changed, 54 insertions(+) to test avpriv_get_trc_function_from_trc(), one could for each index test the returned function at a few values, print the values and have "make fate" compare that output against a reference file [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add test for avpriv_get_trc_function_from_trc function
On Tue, Mar 01, 2016 at 10:41:32AM -0800, NagaChaitanya Vellanki wrote: > --- > libavutil/Makefile | 1 + > libavutil/color_utils.c | 52 > + > 2 files changed, 53 insertions(+) > I'm afraid testing the result of a switch with an array has absolutely no value whatsoever. Regards, [...] -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel