From 7591a024f184bd385d35583d19d86c1d5f2531ba Mon Sep 17 00:00:00 2001 From: Tom Schouten Date: Fri, 1 Sep 2006 13:45:31 +0000 Subject: pdp current darcs merge svn path=/trunk/externals/pdp/; revision=5816 --- modules/image_io/pdp_glx.c | 20 ++++++++++++++++++-- modules/image_io/pdp_qt.c | 6 ++++-- modules/image_io/pdp_v4l.c | 24 ++++++++++++++++++++++++ modules/image_io/pdp_xv.c | 1 + 4 files changed, 47 insertions(+), 4 deletions(-) (limited to 'modules/image_io') diff --git a/modules/image_io/pdp_glx.c b/modules/image_io/pdp_glx.c index 1df127f..d454de9 100644 --- a/modules/image_io/pdp_glx.c +++ b/modules/image_io/pdp_glx.c @@ -72,6 +72,7 @@ typedef struct pdp_glx_struct int x_initialized; int x_autocreate; + int x_interpol; } t_pdp_glx; @@ -375,8 +376,17 @@ static void pdp_glx_display_texture(t_pdp_glx *x) glBindTexture(GL_TEXTURE_2D, x->x_texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + + if (x->x_interpol){ + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + } + else { + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); + } + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); /* display texture */ @@ -485,6 +495,9 @@ static void pdp_glx_display(t_pdp_glx *x, t_symbol *s) } } +static void pdp_glx_interpol(t_pdp_glx *x, t_float finterpol){ + x->x_interpol = (int)finterpol; +} static void pdp_glx_free(t_pdp_glx *x) @@ -525,6 +538,8 @@ void *pdp_glx_new(void) x->x_tex_width = 64; x->x_tex_height = 64; + x->x_interpol = 1; + //pdp_glx_create(x); return (void *)x; @@ -563,6 +578,7 @@ void pdp_glx_setup(void) class_addmethod(pdp_glx_class, (t_method)pdp_glx_cursor, gensym("cursor"), A_FLOAT, A_NULL); class_addmethod(pdp_glx_class, (t_method)pdp_glx_fullscreen, gensym("fullscreen"), A_NULL); class_addmethod(pdp_glx_class, (t_method)pdp_glx_moveresize, gensym("posdim"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); + class_addmethod(pdp_glx_class, (t_method)pdp_glx_interpol, gensym("interpol"), A_FLOAT, A_NULL); class_addmethod(pdp_glx_class, (t_method)pdp_glx_tile, gensym("tile"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); diff --git a/modules/image_io/pdp_qt.c b/modules/image_io/pdp_qt.c index 5e1111c..7c8d415 100644 --- a/modules/image_io/pdp_qt.c +++ b/modules/image_io/pdp_qt.c @@ -19,8 +19,10 @@ */ -#include -#include +//#include +//#include +#include +#include #include "pdp.h" #include "pdp_llconv.h" diff --git a/modules/image_io/pdp_v4l.c b/modules/image_io/pdp_v4l.c index 85c34f1..7f16842 100644 --- a/modules/image_io/pdp_v4l.c +++ b/modules/image_io/pdp_v4l.c @@ -184,6 +184,18 @@ static void pdp_v4l_close_error(t_pdp_v4l *x) if(x->x_open_retry) x->x_open_retry--; } +static void pdp_v4l_pwc_agc(t_pdp_v4l *x, float gain){ + gain *= (float)(1<<16); + int g = (int)gain; + if (g < 0) g = -1; // automatic + if (g > 1<<16) g = 1<<16 - 1; // fixed + + //post("pdp_v4l: setting agc to %d", g); + if (ioctl(x->x_tvfd, VIDIOCPWCSAGC, &g)){ + post("pdp_v4l: pwc: VIDIOCPWCSAGC"); + //goto closit; + } +} static void pdp_v4l_pwc_init(t_pdp_v4l *x) { @@ -206,10 +218,21 @@ static void pdp_v4l_pwc_init(t_pdp_v4l *x) post("pdp_v4l: detected pwc"); + if(ioctl(x->x_tvfd, VIDIOCPWCRUSER)){ perror("pdp_v4l: pwc: VIDIOCPWCRUSER"); goto closit; } + + /* this is a workaround: + we disable AGC after restoring user prefs + something is wrong with newer cams (like Qickcam 4000 pro) + */ + + if (1){ + pdp_v4l_pwc_agc(x, 1.0); + } + if (ioctl(x->x_tvfd, VIDIOCGWIN, &x->x_vwin)){ perror("pdp_v4l: pwc: VIDIOCGWIN"); @@ -824,6 +847,7 @@ void pdp_v4l_setup(void) class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_dim, gensym("dim"), A_FLOAT, A_FLOAT, A_NULL); class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_freq, gensym("freq"), A_FLOAT, A_NULL); class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_freqMHz, gensym("freqMHz"), A_FLOAT, A_NULL); + class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_pwc_agc, gensym("gain"), A_FLOAT, A_NULL); class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_format, gensym("captureformat"), A_SYMBOL, A_NULL); diff --git a/modules/image_io/pdp_xv.c b/modules/image_io/pdp_xv.c index 93383fd..2faabd4 100644 --- a/modules/image_io/pdp_xv.c +++ b/modules/image_io/pdp_xv.c @@ -153,6 +153,7 @@ static void pdp_xv_bang_thread(t_pdp_xv *x) static void pdp_xv_bang_callback(t_pdp_xv *x) { + /* receive events + send to outputs */ t_pdp_list *eventlist = pdp_xwindow_get_eventlist(x->x_xwin); t_pdp_atom *a; -- cgit v1.2.1