mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-16 03:50:05 +01:00
avutil/tests/color_utils: clean up slightly (cosmetic)
Rewrite this test slightly to fix the formatting, improve the readability of the output, and eliminate some unnecessary branching.
This commit is contained in:
@@ -21,25 +21,27 @@
|
||||
#include <stdio.h>
|
||||
#include "libavutil/csp.h"
|
||||
#include "libavutil/macros.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i, j;
|
||||
static const 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
|
||||
};
|
||||
static const 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++) {
|
||||
av_csp_trc_function func = av_csp_trc_func_from_id(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (enum AVColorTransferCharacteristic trc = 0; trc < AVCOL_TRC_NB; trc++) {
|
||||
av_csp_trc_function func = av_csp_trc_func_from_id(trc);
|
||||
const char *name = av_color_transfer_name(trc);
|
||||
if (!func)
|
||||
continue;
|
||||
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(test_data); i++) {
|
||||
double result = func(test_data[i]);
|
||||
printf("trc=%s calling func(%f) expected=%f\n",
|
||||
name, test_data[i], result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user