mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavfi/colorspace: Add namespace prefix to global functions
This commit is contained in:
parent
07987404a8
commit
46fb150a81
@ -20,7 +20,7 @@
|
||||
#include "colorspace.h"
|
||||
|
||||
|
||||
void invert_matrix3x3(const double in[3][3], double out[3][3])
|
||||
void ff_matrix_invert_3x3(const double in[3][3], double out[3][3])
|
||||
{
|
||||
double m00 = in[0][0], m01 = in[0][1], m02 = in[0][2],
|
||||
m10 = in[1][0], m11 = in[1][1], m12 = in[1][2],
|
||||
@ -47,7 +47,8 @@ void invert_matrix3x3(const double in[3][3], double out[3][3])
|
||||
}
|
||||
}
|
||||
|
||||
void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
|
||||
void ff_matrix_mul_3x3(double dst[3][3],
|
||||
const double src1[3][3], const double src2[3][3])
|
||||
{
|
||||
int m, n;
|
||||
|
||||
@ -60,9 +61,9 @@ void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
|
||||
/*
|
||||
* see e.g. http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
|
||||
*/
|
||||
void fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
|
||||
const struct WhitepointCoefficients *wp,
|
||||
double rgb2xyz[3][3])
|
||||
void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
|
||||
const struct WhitepointCoefficients *wp,
|
||||
double rgb2xyz[3][3])
|
||||
{
|
||||
double i[3][3], sr, sg, sb, zw;
|
||||
|
||||
@ -73,7 +74,7 @@ void fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
|
||||
rgb2xyz[2][0] = (1.0 - coeffs->xr - coeffs->yr) / coeffs->yr;
|
||||
rgb2xyz[2][1] = (1.0 - coeffs->xg - coeffs->yg) / coeffs->yg;
|
||||
rgb2xyz[2][2] = (1.0 - coeffs->xb - coeffs->yb) / coeffs->yb;
|
||||
invert_matrix3x3(rgb2xyz, i);
|
||||
ff_matrix_invert_3x3(rgb2xyz, i);
|
||||
zw = 1.0 - wp->xw - wp->yw;
|
||||
sr = i[0][0] * wp->xw + i[0][1] * wp->yw + i[0][2] * zw;
|
||||
sg = i[1][0] * wp->xw + i[1][1] * wp->yw + i[1][2] * zw;
|
||||
|
@ -34,8 +34,10 @@ struct WhitepointCoefficients {
|
||||
double xw, yw;
|
||||
};
|
||||
|
||||
void invert_matrix3x3(const double in[3][3], double out[3][3]);
|
||||
void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3]);
|
||||
void fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
|
||||
const struct WhitepointCoefficients *wp, double rgb2xyz[3][3]);
|
||||
void ff_matrix_invert_3x3(const double in[3][3], double out[3][3]);
|
||||
void ff_matrix_mul_3x3(double dst[3][3],
|
||||
const double src1[3][3], const double src2[3][3]);
|
||||
void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
|
||||
const struct WhitepointCoefficients *wp,
|
||||
double rgb2xyz[3][3]);
|
||||
#endif
|
||||
|
@ -371,7 +371,7 @@ static void fill_whitepoint_conv_table(double out[3][3], enum WhitepointAdaptati
|
||||
double mai[3][3], fac[3][3], tmp[3][3];
|
||||
double rs, gs, bs, rd, gd, bd;
|
||||
|
||||
invert_matrix3x3(ma, mai);
|
||||
ff_matrix_invert_3x3(ma, mai);
|
||||
rs = ma[0][0] * wp_src->xw + ma[0][1] * wp_src->yw + ma[0][2] * zw_src;
|
||||
gs = ma[1][0] * wp_src->xw + ma[1][1] * wp_src->yw + ma[1][2] * zw_src;
|
||||
bs = ma[2][0] * wp_src->xw + ma[2][1] * wp_src->yw + ma[2][2] * zw_src;
|
||||
@ -382,8 +382,8 @@ static void fill_whitepoint_conv_table(double out[3][3], enum WhitepointAdaptati
|
||||
fac[1][1] = gd / gs;
|
||||
fac[2][2] = bd / bs;
|
||||
fac[0][1] = fac[0][2] = fac[1][0] = fac[1][2] = fac[2][0] = fac[2][1] = 0.0;
|
||||
mul3x3(tmp, ma, fac);
|
||||
mul3x3(out, tmp, mai);
|
||||
ff_matrix_mul_3x3(tmp, ma, fac);
|
||||
ff_matrix_mul_3x3(out, tmp, mai);
|
||||
}
|
||||
|
||||
static void apply_lut(int16_t *buf[3], ptrdiff_t stride,
|
||||
@ -588,19 +588,19 @@ static int create_filtergraph(AVFilterContext *ctx,
|
||||
|
||||
wp_out = &whitepoint_coefficients[s->out_primaries->wp];
|
||||
wp_in = &whitepoint_coefficients[s->in_primaries->wp];
|
||||
fill_rgb2xyz_table(&s->out_primaries->coeff, wp_out, rgb2xyz);
|
||||
invert_matrix3x3(rgb2xyz, xyz2rgb);
|
||||
fill_rgb2xyz_table(&s->in_primaries->coeff, wp_in, rgb2xyz);
|
||||
ff_fill_rgb2xyz_table(&s->out_primaries->coeff, wp_out, rgb2xyz);
|
||||
ff_matrix_invert_3x3(rgb2xyz, xyz2rgb);
|
||||
ff_fill_rgb2xyz_table(&s->in_primaries->coeff, wp_in, rgb2xyz);
|
||||
if (s->out_primaries->wp != s->in_primaries->wp &&
|
||||
s->wp_adapt != WP_ADAPT_IDENTITY) {
|
||||
double wpconv[3][3], tmp[3][3];
|
||||
|
||||
fill_whitepoint_conv_table(wpconv, s->wp_adapt, s->in_primaries->wp,
|
||||
s->out_primaries->wp);
|
||||
mul3x3(tmp, rgb2xyz, wpconv);
|
||||
mul3x3(rgb2rgb, tmp, xyz2rgb);
|
||||
ff_matrix_mul_3x3(tmp, rgb2xyz, wpconv);
|
||||
ff_matrix_mul_3x3(rgb2rgb, tmp, xyz2rgb);
|
||||
} else {
|
||||
mul3x3(rgb2rgb, rgb2xyz, xyz2rgb);
|
||||
ff_matrix_mul_3x3(rgb2rgb, rgb2xyz, xyz2rgb);
|
||||
}
|
||||
for (m = 0; m < 3; m++)
|
||||
for (n = 0; n < 3; n++) {
|
||||
@ -725,7 +725,7 @@ static int create_filtergraph(AVFilterContext *ctx,
|
||||
for (n = 0; n < 8; n++)
|
||||
s->yuv_offset[0][n] = off;
|
||||
fill_rgb2yuv_table(s->in_lumacoef, rgb2yuv);
|
||||
invert_matrix3x3(rgb2yuv, yuv2rgb);
|
||||
ff_matrix_invert_3x3(rgb2yuv, yuv2rgb);
|
||||
bits = 1 << (in_desc->comp[0].depth - 1);
|
||||
for (n = 0; n < 3; n++) {
|
||||
for (in_rng = s->in_y_rng, m = 0; m < 3; m++, in_rng = s->in_uv_rng) {
|
||||
@ -781,7 +781,7 @@ static int create_filtergraph(AVFilterContext *ctx,
|
||||
double yuv2yuv[3][3];
|
||||
int in_rng, out_rng;
|
||||
|
||||
mul3x3(yuv2yuv, yuv2rgb, rgb2yuv);
|
||||
ff_matrix_mul_3x3(yuv2yuv, yuv2rgb, rgb2yuv);
|
||||
for (out_rng = s->out_y_rng, m = 0; m < 3; m++, out_rng = s->out_uv_rng) {
|
||||
for (in_rng = s->in_y_rng, n = 0; n < 3; n++, in_rng = s->in_uv_rng) {
|
||||
s->yuv2yuv_coeffs[m][n][0] =
|
||||
|
@ -124,10 +124,10 @@ static void get_rgb2rgb_matrix(enum AVColorPrimaries in, enum AVColorPrimaries o
|
||||
double rgb2rgb[3][3]) {
|
||||
double rgb2xyz[3][3], xyz2rgb[3][3];
|
||||
|
||||
fill_rgb2xyz_table(&primaries_table[out], &whitepoint_table[out], rgb2xyz);
|
||||
invert_matrix3x3(rgb2xyz, xyz2rgb);
|
||||
fill_rgb2xyz_table(&primaries_table[in], &whitepoint_table[in], rgb2xyz);
|
||||
mul3x3(rgb2rgb, rgb2xyz, xyz2rgb);
|
||||
ff_fill_rgb2xyz_table(&primaries_table[out], &whitepoint_table[out], rgb2xyz);
|
||||
ff_matrix_invert_3x3(rgb2xyz, xyz2rgb);
|
||||
ff_fill_rgb2xyz_table(&primaries_table[in], &whitepoint_table[in], rgb2xyz);
|
||||
ff_matrix_mul_3x3(rgb2rgb, rgb2xyz, xyz2rgb);
|
||||
}
|
||||
|
||||
#define OPENCL_SOURCE_NB 3
|
||||
|
Loading…
Reference in New Issue
Block a user