summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-03 16:38:38 +0100
committerwm4 <wm4@nowhere>2015-02-03 16:38:38 +0100
commit0f560bbf8a9a10411be2688dba9363621da0437d (patch)
tree14dd9b7f29f088da723fdc8203d34353b7416d38
parent95fd83a269db6e2a04e40fe0c40cc02a051f316d (diff)
downloadmpv-0f560bbf8a9a10411be2688dba9363621da0437d.tar.bz2
mpv-0f560bbf8a9a10411be2688dba9363621da0437d.tar.xz
csputils: remove some unused functions, make some private
mp_gen_gamma_map() and mp_gen_yuv2rgb_map() were used by vo_opengl_old only. The other functions removed from csputils.h are used by csputils.c only.
-rw-r--r--video/csputils.c66
-rw-r--r--video/csputils.h7
2 files changed, 4 insertions, 69 deletions
diff --git a/video/csputils.c b/video/csputils.c
index 922f3ee80f..00e6d32cd2 100644
--- a/video/csputils.c
+++ b/video/csputils.c
@@ -230,25 +230,6 @@ void mp_get_chroma_location(enum mp_chroma_location loc, int *x, int *y)
*x = -1;
}
-void mp_gen_gamma_map(uint8_t *map, int size, float gamma)
-{
- if (gamma == 1.0) {
- for (int i = 0; i < size; i++)
- map[i] = 255 * i / (size - 1);
- return;
- }
- gamma = 1.0 / gamma;
- for (int i = 0; i < size; i++) {
- float tmp = (float)i / (size - 1.0);
- tmp = pow(tmp, gamma);
- if (tmp > 1.0)
- tmp = 1.0;
- if (tmp < 0.0)
- tmp = 0.0;
- map[i] = 255 * tmp;
- }
-}
-
void mp_invert_matrix3x3(float m[3][3])
{
float m00 = m[0][0], m01 = m[0][1], m02 = m[0][2],
@@ -278,7 +259,7 @@ void mp_invert_matrix3x3(float m[3][3])
}
// A := A * B
-void mp_mul_matrix3x3(float a[3][3], float b[3][3])
+static void mp_mul_matrix3x3(float a[3][3], float b[3][3])
{
float a00 = a[0][0], a01 = a[0][1], a02 = a[0][2],
a10 = a[1][0], a11 = a[1][1], a12 = a[1][2],
@@ -343,7 +324,7 @@ struct mp_csp_primaries mp_get_csp_primaries(enum mp_csp_prim spc)
// Compute the RGB/XYZ matrix as described here:
// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
-void mp_get_rgb2xyz_matrix(struct mp_csp_primaries space, float m[3][3])
+static void mp_get_rgb2xyz_matrix(struct mp_csp_primaries space, float m[3][3])
{
float S[3], X[4], Z[4];
@@ -379,8 +360,8 @@ void mp_get_rgb2xyz_matrix(struct mp_csp_primaries space, float m[3][3])
}
// M := M * XYZd<-XYZs
-void mp_apply_chromatic_adaptation(struct mp_csp_col_xy src,
- struct mp_csp_col_xy dest, float m[3][3])
+static void mp_apply_chromatic_adaptation(struct mp_csp_col_xy src,
+ struct mp_csp_col_xy dest, float m[3][3])
{
// If the white points are nearly identical, this is a wasteful identity
// operation.
@@ -633,45 +614,6 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, struct mp_cmat *m)
}
}
-// size of gamma map use to avoid slow exp function in gen_yuv2rgb_map
-#define GMAP_SIZE (1024)
-// generate a 3D YUV -> RGB map
-// map must provide space for (size + 2)^3 elements
-void mp_gen_yuv2rgb_map(struct mp_csp_params *params, unsigned char *map, int size)
-{
- int i, j, k, l;
- float step = 1.0 / size;
- float y, u, v;
- struct mp_cmat yuv2rgb;
- unsigned char gmaps[3][GMAP_SIZE];
- mp_gen_gamma_map(gmaps[0], GMAP_SIZE, params->rgamma);
- mp_gen_gamma_map(gmaps[1], GMAP_SIZE, params->ggamma);
- mp_gen_gamma_map(gmaps[2], GMAP_SIZE, params->bgamma);
- mp_get_yuv2rgb_coeffs(params, &yuv2rgb);
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 3; j++)
- yuv2rgb.m[i][j] *= GMAP_SIZE - 1;
- yuv2rgb.c[i] *= GMAP_SIZE - 1;
- }
- v = 0;
- for (i = -1; i <= size; i++) {
- u = 0;
- for (j = -1; j <= size; j++) {
- y = 0;
- for (k = -1; k <= size; k++) {
- for (l = 0; l < 3; l++) {
- float rgb = yuv2rgb.m[l][0] * y + yuv2rgb.m[l][1] * u +
- yuv2rgb.m[l][2] * v + yuv2rgb.c[l];
- *map++ = gmaps[l][av_clip(rgb, 0, GMAP_SIZE - 1)];
- }
- y += (k == -1 || k == size - 1) ? step / 2 : step;
- }
- u += (j == -1 || j == size - 1) ? step / 2 : step;
- }
- v += (i == -1 || i == size - 1) ? step / 2 : step;
- }
-}
-
// Set colorspace related fields in p from f. Don't touch other fields.
void mp_csp_set_image_params(struct mp_csp_params *params,
const struct mp_image_params *imgparams)
diff --git a/video/csputils.h b/video/csputils.h
index abf319cdcb..4f0a09da6e 100644
--- a/video/csputils.h
+++ b/video/csputils.h
@@ -215,8 +215,6 @@ int mp_chroma_location_to_av(enum mp_chroma_location mploc);
void mp_get_chroma_location(enum mp_chroma_location loc, int *x, int *y);
-void mp_gen_gamma_map(unsigned char *map, int size, float gamma);
-
struct mp_csp_primaries mp_get_csp_primaries(enum mp_csp_prim csp);
/* Color conversion matrix: RGB = m * YUV + c
@@ -237,18 +235,13 @@ struct mp_cmat {
float c[3];
};
-void mp_apply_chromatic_adaptation(struct mp_csp_col_xy src,
- struct mp_csp_col_xy dest, float m[3][3]);
void mp_get_cms_matrix(struct mp_csp_primaries src, struct mp_csp_primaries dest,
enum mp_render_intent intent, float cms_matrix[3][3]);
-void mp_get_rgb2xyz_matrix(struct mp_csp_primaries space, float m[3][3]);
void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params, struct mp_csp_primaries prim,
enum mp_render_intent intent, struct mp_cmat *xyz2rgb);
void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, struct mp_cmat *yuv2rgb);
-void mp_gen_yuv2rgb_map(struct mp_csp_params *params, uint8_t *map, int size);
-void mp_mul_matrix3x3(float a[3][3], float b[3][3]);
void mp_invert_matrix3x3(float m[3][3]);
void mp_invert_yuv2rgb(struct mp_cmat *out, struct mp_cmat *in);
void mp_map_int_color(struct mp_cmat *matrix, int clip_bits, int c[3]);