Commit df4b5f07 authored by NagaChaitanya Vellanki's avatar NagaChaitanya Vellanki Committed by Michael Niedermayer

Add test for avpriv_get_trc_function_from_trc function

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 510046c2
......@@ -176,6 +176,7 @@ TESTPROGS = adler32 \
bprint \
cast5 \
camellia \
color_utils \
cpu \
crc \
des \
......
......@@ -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
......@@ -48,6 +48,10 @@ FATE_LIBAVUTIL += fate-crc
fate-crc: libavutil/crc-test$(EXESUF)
fate-crc: CMD = run libavutil/crc-test
FATE_LIBAVUTIL += fate-color_utils
fate-color_utils: libavutil/color_utils-test$(EXESUF)
fate-color_utils: CMD = run libavutil/color_utils-test
FATE_LIBAVUTIL += fate-des
fate-des: libavutil/des-test$(EXESUF)
fate-des: CMD = run libavutil/des-test
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment