diff --git a/veejay-current/veejay-server/libvje/effects/smuck.c b/veejay-current/veejay-server/libvje/effects/smuck.c index 72acf571..5de66138 100644 --- a/veejay-current/veejay-server/libvje/effects/smuck.c +++ b/veejay-current/veejay-server/libvje/effects/smuck.c @@ -25,19 +25,24 @@ vj_effect *smuck_init(int w,int h) { vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); - ve->num_params = 1; + ve->num_params = 2; ve->defaults = (int *) vj_calloc(sizeof(int) * ve->num_params); /* default values */ ve->limits[0] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* min */ ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */ ve->defaults[0] = 1; + ve->defaults[1] = 0; + ve->limits[0][0] = 0; ve->limits[1][0] = 18; + ve->limits[0][1] = 0; + ve->limits[1][1] = 1; + ve->description = "SmuckTV (EffectTV)"; - ve->sub_format = -1; + ve->sub_format = 1; ve->extra_frame = 0; ve->has_user = 0; - ve->param_description = vje_build_param_list( ve->num_params, "Smuck"); + ve->param_description = vje_build_param_list( ve->num_params, "Smuck", "Mode"); return ve; } @@ -69,6 +74,7 @@ void smuck_apply( void *ptr, VJFrame *frame, int *args) unsigned int yd, xd, x, y; smuck_t *s = (smuck_t*) ptr; int n = args[0]; + int mode = args[1]; VJFrame *frame2 = frame; @@ -77,15 +83,34 @@ void smuck_apply( void *ptr, VJFrame *frame, int *args) { 12, 21, 30, 60, 58, 59, 57, 56, 55, 54, 53, 89, 90, 88, 87, 86, 85, 114 }; uint8_t *Y = frame->data[0]; uint8_t *Y2 = frame2->data[0]; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - yd = y + (smuck_fastrand(s) >> smuck[n]) - 2; - xd = x + (smuck_fastrand(s) >> smuck[n]) - 2; - if (xd > width) - xd = width-1; - if (yd > height) - yd = height; - Y[x + y * width] = Y2[xd + yd * width]; - } - } + + if( mode == 0 ) { + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + yd = (y + (smuck_fastrand(s) >> smuck[n]) - 2) % height; + xd = (x + (smuck_fastrand(s) >> smuck[n]) - 2) % width; + + Y[x + y * width] = Y2[xd + yd * width]; + } + } + + } else { + uint8_t *U = frame->data[1]; + uint8_t *V = frame->data[2]; + uint8_t *U2 = frame->data[1]; + uint8_t *V2 = frame->data[2]; + + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + yd = (y + (smuck_fastrand(s) >> smuck[n]) - 2) % height; + xd = (x + (smuck_fastrand(s) >> smuck[n]) - 2) % width; + + Y[x + y * width] = Y2[xd + yd * width]; + U[x + y * width] = U2[xd + yd * width]; + V[x + y * width] = V2[xd + yd * width]; + } + } + + + } }