summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-03-16 18:57:23 +0100
committerwm4 <wm4@mplayer2.org>2012-03-16 19:14:44 +0100
commit6de8120822c2dd9c50ef23b4977421651396f1ae (patch)
tree11a977608cfc9f50cffbce4a879dd8e9b33b029c /libvo
parent0eb21226cbfdd200f2aea5d3a9db2cdbff4773a5 (diff)
parenta8168102668337f3c11619bea7e744fc245adff1 (diff)
downloadmpv-6de8120822c2dd9c50ef23b4977421651396f1ae.tar.bz2
mpv-6de8120822c2dd9c50ef23b4977421651396f1ae.tar.xz
Merge remote-tracking branch 'origin/master' into my_master
Conflicts: command.c mp_core.h mplayer.c screenshot.c
Diffstat (limited to 'libvo')
-rw-r--r--libvo/csputils.c24
-rw-r--r--libvo/csputils.h3
-rw-r--r--libvo/vo_directx.c6
-rw-r--r--libvo/vo_gl.c3
-rw-r--r--libvo/vo_jpeg.c7
-rw-r--r--libvo/vo_pnm.c8
-rw-r--r--libvo/vo_vdpau.c3
-rw-r--r--libvo/w32_common.c14
8 files changed, 31 insertions, 37 deletions
diff --git a/libvo/csputils.c b/libvo/csputils.c
index 6656e5e196..3bd6e48f67 100644
--- a/libvo/csputils.c
+++ b/libvo/csputils.c
@@ -143,10 +143,13 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float m[3][4])
int levels_in = params->colorspace.levels_in;
if (levels_in <= MP_CSP_LEVELS_AUTO || levels_in >= MP_CSP_LEVELS_COUNT)
levels_in = MP_CSP_LEVELS_TV;
+ assert(params->input_bits >= 8);
+ assert(params->texture_bits >= params->input_bits);
+ double s = (1 << params->input_bits-8) / ((1<<params->texture_bits)-1.);
// The values below are written in 0-255 scale
struct yuvlevels { double ymin, ymax, cmin, cmid; }
- yuvlim = { 16, 235, 16, 128 },
- yuvfull = { 0, 255, 1, 128 }, // '1' to make it symmetric around 128
+ yuvlim = { 16*s, 235*s, 16*s, 128*s },
+ yuvfull = { 0*s, 255*s, 1*s, 128*s }, // '1' for symmetry around 128
yuvlev;
switch (levels_in) {
case MP_CSP_LEVELS_TV: yuvlev = yuvlim; break;
@@ -159,8 +162,8 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float m[3][4])
if (levels_out <= MP_CSP_LEVELS_AUTO || levels_out >= MP_CSP_LEVELS_COUNT)
levels_out = MP_CSP_LEVELS_PC;
struct rgblevels { double min, max; }
- rgblim = { 16, 235 },
- rgbfull = { 0, 255 },
+ rgblim = { 16/255., 235/255. },
+ rgbfull = { 0, 1 },
rgblev;
switch (levels_out) {
case MP_CSP_LEVELS_TV: rgblev = rgblim; break;
@@ -176,8 +179,8 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float m[3][4])
m[i][COL_U] *= cmul;
m[i][COL_V] *= cmul;
// Set COL_C so that Y=umin,UV=cmid maps to RGB=min (black to black)
- m[i][COL_C] = (rgblev.min - m[i][COL_Y] * yuvlev.ymin
- -(m[i][COL_U] + m[i][COL_V]) * yuvlev.cmid) / 255;
+ m[i][COL_C] = rgblev.min - m[i][COL_Y] * yuvlev.ymin
+ -(m[i][COL_U] + m[i][COL_V]) * yuvlev.cmid;
}
// Brightness adds a constant to output R,G,B.
@@ -185,15 +188,8 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float m[3][4])
for (int i = 0; i < 3; i++) {
m[i][COL_C] += params->brightness;
m[i][COL_Y] *= params->contrast;
- m[i][COL_C] += (rgblev.max-rgblev.min)/255 * (1 - params->contrast)/2;
+ m[i][COL_C] += (rgblev.max-rgblev.min) * (1 - params->contrast)/2;
}
-
- float depth_multiplier = params->input_shift >= 0 ?
- (1 << params->input_shift) :
- (1.0 / (1 << -params->input_shift));
- for (int i = 0; i < 3; i++)
- for (int j = 0; j < 3; j++)
- m[i][j] *= depth_multiplier;
}
//! size of gamma map use to avoid slow exp function in gen_yuv2rgb_map
diff --git a/libvo/csputils.h b/libvo/csputils.h
index 3a754a8273..434be4a9a1 100644
--- a/libvo/csputils.h
+++ b/libvo/csputils.h
@@ -68,7 +68,8 @@ struct mp_csp_params {
float rgamma;
float ggamma;
float bgamma;
- int input_shift;
+ int texture_bits;
+ int input_bits;
};
enum mp_csp_equalizer_param {
diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c
index 2036ac1803..c937e13618 100644
--- a/libvo/vo_directx.c
+++ b/libvo/vo_directx.c
@@ -276,7 +276,7 @@ static uint32_t Directx_CreateOverlay(uint32_t imgfmt)
case DDERR_OUTOFVIDEOMEMORY:
{mp_msg(MSGT_VO, MSGL_ERR,"not enough video memory\n");break;}
default:
- mp_msg(MSGT_VO, MSGL_ERR,"create surface failed with 0x%x\n",ddrval);
+ mp_msg(MSGT_VO, MSGL_ERR,"create surface failed with 0x%xu\n",(unsigned)ddrval);
}
return 1;
}
@@ -588,7 +588,7 @@ static uint32_t Directx_ManageDisplay(void)
// we should try upping the destination size a bit, or
// perhaps shrinking the source size
mp_msg(MSGT_VO, MSGL_ERR ,"<vo_directx><ERROR>UpdateOverlay failed\n" );
- mp_msg(MSGT_VO, MSGL_ERR ,"<vo_directx><ERROR>Overlay:x1:%i,y1:%i,x2:%i,y2:%i,w:%i,h:%i\n",rd.left,rd.top,rd.right,rd.bottom,rd.right - rd.left,rd.bottom - rd.top );
+ mp_msg(MSGT_VO, MSGL_ERR ,"<vo_directx><ERROR>Overlay:x1:%li,y1:%li,x2:%li,y2:%li,w:%li,h:%li\n",rd.left,rd.top,rd.right,rd.bottom,rd.right - rd.left,rd.bottom - rd.top );
mp_msg(MSGT_VO, MSGL_ERR ,"<vo_directx><ERROR>");
switch (ddrval)
{
@@ -618,7 +618,7 @@ static uint32_t Directx_ManageDisplay(void)
break;
}
default:
- mp_msg(MSGT_VO, MSGL_ERR ," 0x%x\n",ddrval);
+ mp_msg(MSGT_VO, MSGL_ERR ," 0x%xu\n",(unsigned)ddrval);
}
/*ok we can't do anything about it -> hide overlay*/
if(ddrval != DD_OK)
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 1ad893cf52..adb5c55a74 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -221,7 +221,8 @@ static void update_yuvconv(struct vo *vo)
mp_get_chroma_shift(p->image_format, &xs, &ys, &depth);
params.chrom_texw = params.texw >> xs;
params.chrom_texh = params.texh >> ys;
- params.csp_params.input_shift = -depth & 7;
+ params.csp_params.input_bits = depth;
+ params.csp_params.texture_bits = depth+7 & ~7;
glSetupYUVConversion(gl, &params);
if (p->custom_prog) {
FILE *f = fopen(p->custom_prog, "rb");
diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c
index 15f29a293a..efa0381086 100644
--- a/libvo/vo_jpeg.c
+++ b/libvo/vo_jpeg.c
@@ -45,6 +45,7 @@
#include "video_out.h"
#include "video_out_internal.h"
#include "mplayer.h" /* for exit_player_bad() */
+#include "osdep/io.h"
/* ------------------------------------------------------------------------- */
@@ -107,15 +108,11 @@ static int framenum = 0;
static void jpeg_mkdir(const char *buf, int verbose) {
struct stat stat_p;
-#ifndef __MINGW32__
if ( mkdir(buf, 0755) < 0 ) {
-#else
- if ( mkdir(buf) < 0 ) {
-#endif
switch (errno) { /* use switch in case other errors need to be caught
and handled in the future */
case EEXIST:
- if ( stat(buf, &stat_p ) < 0 ) {
+ if ( mp_stat(buf, &stat_p ) < 0 ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
_("This error has occurred"), strerror(errno) );
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c
index 9593860412..5345eaa122 100644
--- a/libvo/vo_pnm.c
+++ b/libvo/vo_pnm.c
@@ -40,6 +40,7 @@
#include "video_out.h"
#include "video_out_internal.h"
#include "mplayer.h" /* for exit_player_bad() */
+#include "osdep/io.h"
/* ------------------------------------------------------------------------- */
@@ -199,16 +200,11 @@ static int preinit(const char *arg)
static void pnm_mkdir(char *buf, int verbose) {
struct stat stat_p;
-/* Silly MING32 bug workaround */
-#ifndef __MINGW32__
if ( mkdir(buf, 0755) < 0 ) {
-#else
- if ( mkdir(buf) < 0 ) {
-#endif
switch (errno) { /* use switch in case other errors need to be caught
and handled in the future */
case EEXIST:
- if ( stat(buf, &stat_p ) < 0 ) {
+ if ( mp_stat(buf, &stat_p ) < 0 ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
_("This error has occurred"), strerror(errno) );
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index 7b2f974ac2..a7a13bc36f 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -581,7 +581,8 @@ static void update_csc_matrix(struct vo *vo)
// both are float[3][4]
VdpCSCMatrix matrix;
- struct mp_csp_params cparams = { .colorspace = vc->colorspace };
+ struct mp_csp_params cparams = {
+ .colorspace = vc->colorspace, .input_bits = 8, .texture_bits = 8 };
mp_csp_copy_equalizer_values(&cparams, &vc->video_eq);
mp_get_yuv2rgb_coeffs(&cparams, matrix);
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index a8a59d02c9..475327ce5c 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -41,6 +41,8 @@
#define MONITOR_DEFAULTTOPRIMARY 1
#endif
+#define WIN_ID_TO_HWND(x) ((HWND)(uint32_t)(x))
+
static const char classname[] = "MPlayer - The Movie Player";
int vo_vm = 0;
@@ -116,7 +118,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
break;
case WM_WINDOWPOSCHANGING:
if (vo_keepaspect && !vo_fs && WinID < 0) {
- WINDOWPOS *wpos = lParam;
+ WINDOWPOS *wpos = (WINDOWPOS*)lParam;
int xborder, yborder;
r.left = r.top = 0;
r.right = wpos->cx;
@@ -232,10 +234,10 @@ int vo_w32_check_events(void) {
vo_dx = p.x; vo_dy = p.y;
event_flags |= VO_EVENT_MOVE;
}
- res = GetClientRect(WinID, &r);
+ res = GetClientRect(WIN_ID_TO_HWND(WinID), &r);
if (res && (r.right != vo_dwidth || r.bottom != vo_dheight))
MoveWindow(vo_window, 0, 0, r.right, r.bottom, FALSE);
- if (!IsWindow(WinID))
+ if (!IsWindow(WIN_ID_TO_HWND(WinID)))
// Window has probably been closed, e.g. due to program crash
mplayer_put_key(KEY_CLOSE_WIN);
}
@@ -514,11 +516,11 @@ int vo_w32_init(void) {
if (WinID >= 0)
{
RECT r;
- GetClientRect(WinID, &r);
+ GetClientRect(WIN_ID_TO_HWND(WinID), &r);
vo_dwidth = r.right; vo_dheight = r.bottom;
vo_window = CreateWindowEx(WS_EX_NOPARENTNOTIFY, classname, classname,
- WS_CHILD | WS_VISIBLE,
- 0, 0, vo_dwidth, vo_dheight, WinID, 0, hInstance, 0);
+ WS_CHILD | WS_VISIBLE, 0, 0, vo_dwidth, vo_dheight,
+ WIN_ID_TO_HWND(WinID), 0, hInstance, 0);
EnableWindow(vo_window, 0);
} else
vo_window = CreateWindowEx(0, classname, classname,