diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-01-16 19:59:31 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-01-16 19:59:31 +0000 |
commit | cbd5caef0e8862dcafd40d80d28f4bca73882f97 (patch) | |
tree | 309ed78a00d4235d5d11318e71b772dc09e332c5 /libvo/csputils.c | |
parent | 68544d15da70e99724f6e7df43ab2d74d4750b66 (diff) | |
download | mpv-cbd5caef0e8862dcafd40d80d28f4bca73882f97.tar.bz2 mpv-cbd5caef0e8862dcafd40d80d28f4bca73882f97.tar.xz |
Add support for adjustable TV <-> PC level conversion.
This could also be done by modifying contrast and brightness, but
this seems a bit more flexible and easier to use.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30335 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/csputils.c')
-rw-r--r-- | libvo/csputils.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libvo/csputils.c b/libvo/csputils.c index e842592b1f..57362f6725 100644 --- a/libvo/csputils.c +++ b/libvo/csputils.c @@ -60,10 +60,15 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) { float uvcos = params->saturation * cos(params->hue); float uvsin = params->saturation * sin(params->hue); int format = params->format; + int levelconv = params->levelconv; int i; const float (*uv_coeffs)[3]; const float *level_adjust; - static const float yuv_pc_level_adjust[4] = {-16 / 255.0, -128 / 255.0, -128 / 255.0, 1.164}; + 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}, + { 0, -128 / 255.0, -128 / 255.0, 1}, + }; 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] = { @@ -101,7 +106,9 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) { if (format < 0 || format >= MP_CSP_COUNT) format = MP_CSP_DEFAULT; uv_coeffs = uv_coeffs_table[format]; - level_adjust = yuv_pc_level_adjust; + if (levelconv < 0 || levelconv >= MP_CSP_LEVELCONV_COUNT) + levelconv = MP_CSP_LEVELCONV_TV_TO_PC; + level_adjust = yuv_level_adjust[levelconv]; if (format == MP_CSP_XYZ) level_adjust = xyz_level_adjust; |