mirror of https://github.com/mpv-player/mpv
cosmetics: csputils.[ch]: reindent
This commit is contained in:
parent
506ab685d4
commit
1478f658f3
|
@ -36,32 +36,36 @@
|
|||
* \param size size of buffer
|
||||
* \param gamma gamma value
|
||||
*/
|
||||
void mp_gen_gamma_map(uint8_t *map, int size, float gamma) {
|
||||
int i;
|
||||
void mp_gen_gamma_map(uint8_t *map, int size, float gamma)
|
||||
{
|
||||
if (gamma == 1.0) {
|
||||
for (i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
map[i] = 255 * i / (size - 1);
|
||||
return;
|
||||
}
|
||||
gamma = 1.0 / gamma;
|
||||
for (i = 0; i < size; i++) {
|
||||
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;
|
||||
if (tmp > 1.0)
|
||||
tmp = 1.0;
|
||||
if (tmp < 0.0)
|
||||
tmp = 0.0;
|
||||
map[i] = 255 * tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get the coefficients of the yuv -> rgb conversion matrix
|
||||
* \param params struct specifying the properties of the conversion like brightness, ...
|
||||
* \param params struct specifying the properties of the conversion like
|
||||
* brightness, ...
|
||||
* \param yuv2rgb array to store coefficients into
|
||||
*
|
||||
* Note: contrast, hue and saturation will only work as expected with YUV formats,
|
||||
* not with e.g. MP_CSP_XYZ
|
||||
* Note: contrast, hue and saturation will only work as expected with YUV
|
||||
* formats, not with e.g. MP_CSP_XYZ
|
||||
*/
|
||||
void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) {
|
||||
void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4])
|
||||
{
|
||||
float depth_multiplier = params->input_shift >= 0 ?
|
||||
(1 << params->input_shift) :
|
||||
(1.0 / (1 << -params->input_shift));
|
||||
|
@ -74,10 +78,12 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) {
|
|||
const float *level_adjust;
|
||||
static const float yuv_level_adjust[MP_CSP_LEVELCONV_COUNT][4] = {
|
||||
{-16 / 255.0, -128 / 255.0, -128 / 255.0, 1.164},
|
||||
{ 16 / 255.0 * 1.164, -128 / 255.0, -128 / 255.0, 1.0/1.164},
|
||||
{ 16 / 255.0 * 1.164, -128 / 255.0, -128 / 255.0, 1.0 / 1.164},
|
||||
{ 0, -128 / 255.0, -128 / 255.0, 1},
|
||||
};
|
||||
static const float xyz_level_adjust[4] = {0, 0, 0, 0};
|
||||
static const float xyz_level_adjust[4] = {
|
||||
0, 0, 0, 0
|
||||
};
|
||||
static const float uv_coeffs_table[MP_CSP_COUNT][3][3] = {
|
||||
[MP_CSP_DEFAULT] = {
|
||||
{1, 0.000, 1.596},
|
||||
|
@ -145,7 +151,8 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) {
|
|||
* \param map where to store map. Must provide space for (size + 2)^3 elements
|
||||
* \param size size of the map, excluding border
|
||||
*/
|
||||
void mp_gen_yuv2rgb_map(struct mp_csp_params *params, unsigned char *map, int size) {
|
||||
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;
|
||||
|
@ -165,7 +172,8 @@ void mp_gen_yuv2rgb_map(struct mp_csp_params *params, unsigned char *map, int si
|
|||
y = 0;
|
||||
for (k = -1; k <= size; k++) {
|
||||
for (l = 0; l < 3; l++) {
|
||||
float rgb = yuv2rgb[l][COL_Y] * y + yuv2rgb[l][COL_U] * u + yuv2rgb[l][COL_V] * v + yuv2rgb[l][COL_C];
|
||||
float rgb = yuv2rgb[l][COL_Y] * y + yuv2rgb[l][COL_U] * u +
|
||||
yuv2rgb[l][COL_V] * v + yuv2rgb[l][COL_C];
|
||||
*map++ = gmaps[l][av_clip(rgb, 0, GMAP_SIZE - 1)];
|
||||
}
|
||||
y += (k == -1 || k == size - 1) ? step / 2 : step;
|
||||
|
|
Loading…
Reference in New Issue