avutil/{color_utils, csp}: merge color_utils into csp and expose API

libavutil/color_utils contains some avpriv_ symbols that map
enum AVTransferCharacteristic values to gamma-curve approximations and
to the actual transfer functions to invert them (i.e. -> linear).

There's two issues with this:
(1) avpriv is evil and should be avoided whenever possible
(2) libavutil/csp.h exposes a public API for handling color that
    already handles primaries and matricies

I don't see any reason this API has to be private, so this commit takes
the functionality from avutil/color_utils and merges it into avutil/csp
with an exposed av_ API rather than the previous avpriv_ API.

Every reference to the previous API has been updated to point to the
new one. color_utils.h has been deleted as well. This should not break
any applications as it only contained avpriv_ symbols in the first
place, so nothing in that header could be referenced by other
applications.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Leo Izen
2023-01-30 11:50:10 -05:00
committed by Anton Khirnov
parent dc1b8135e0
commit 719a93f4e4
11 changed files with 225 additions and 304 deletions

View File

@@ -19,7 +19,7 @@
*/
#include <stdio.h>
#include "libavutil/color_utils.c"
#include "libavutil/csp.h"
#include "libavutil/macros.h"
int main(int argc, char *argv[])
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
};
for(i = 0; i < AVCOL_TRC_NB; i++) {
avpriv_trc_function func = avpriv_get_trc_function_from_trc(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]);