Add test for avpriv_get_trc_function_from_trc function
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:

committed by
Michael Niedermayer

parent
510046c228
commit
df4b5f076e
@@ -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
|
||||
|
Reference in New Issue
Block a user