[FFmpeg-devel] [PATCH 1/5] lavfi/colorspace: Add namespace prefix to global functions
Mark Thompson
sw at jkqxz.net
Sun Jun 24 21:25:35 EEST 2018
---
libavfilter/colorspace.c | 13 +++++++------
libavfilter/colorspace.h | 10 ++++++----
libavfilter/vf_colorspace.c | 22 +++++++++++-----------
libavfilter/vf_tonemap_opencl.c | 8 ++++----
4 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/libavfilter/colorspace.c b/libavfilter/colorspace.c
index 7fd7bdf0d9..9a61318e8a 100644
--- a/libavfilter/colorspace.c
+++ b/libavfilter/colorspace.c
@@ -20,7 +20,7 @@
#include "colorspace.h"
-void invert_matrix3x3(const double in[3][3], double out[3][3])
+void ff_invert_matrix3x3(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_mul3x3(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_invert_matrix3x3(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;
diff --git a/libavfilter/colorspace.h b/libavfilter/colorspace.h
index d330917bd3..065c90fc52 100644
--- a/libavfilter/colorspace.h
+++ b/libavfilter/colorspace.h
@@ -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_invert_matrix3x3(const double in[3][3], double out[3][3]);
+void ff_mul3x3(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
diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index b593215daa..b81db96b0d 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -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_invert_matrix3x3(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_mul3x3(tmp, ma, fac);
+ ff_mul3x3(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_invert_matrix3x3(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_mul3x3(tmp, rgb2xyz, wpconv);
+ ff_mul3x3(rgb2rgb, tmp, xyz2rgb);
} else {
- mul3x3(rgb2rgb, rgb2xyz, xyz2rgb);
+ ff_mul3x3(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_invert_matrix3x3(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_mul3x3(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] =
diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c
index 6b8bbeea7b..b4ef7f269b 100644
--- a/libavfilter/vf_tonemap_opencl.c
+++ b/libavfilter/vf_tonemap_opencl.c
@@ -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_invert_matrix3x3(rgb2xyz, xyz2rgb);
+ ff_fill_rgb2xyz_table(&primaries_table[in], &whitepoint_table[in], rgb2xyz);
+ ff_mul3x3(rgb2rgb, rgb2xyz, xyz2rgb);
}
#define OPENCL_SOURCE_NB 3
--
2.17.1
More information about the ffmpeg-devel
mailing list