diff options
author | NagaChaitanya Vellanki <nagachaitanya.vellanki@gmail.com> | 2016-03-03 10:01:28 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-03-03 21:03:04 +0100 |
commit | df4b5f076e67a537931b0ebea111fc9a15c6378b (patch) | |
tree | b6daf505110c77de9b589e62c3426cff788d4e0d /libavutil/color_utils.c | |
parent | 510046c228cb1232313195c6a9b6a5345dddba0b (diff) | |
download | ffmpeg-df4b5f076e67a537931b0ebea111fc9a15c6378b.tar.gz |
Add test for avpriv_get_trc_function_from_trc function
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/color_utils.c')
-rw-r--r-- | libavutil/color_utils.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libavutil/color_utils.c b/libavutil/color_utils.c index b68b4026eb..0bb7e3d72b 100644 --- a/libavutil/color_utils.c +++ b/libavutil/color_utils.c @@ -21,6 +21,7 @@ #include <stddef.h> #include <math.h> +#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[] = { + -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, 99999.899998 + }; + + 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); + } + } + } + +} + +// LCOV_EXCL_STOP +#endif |