Merge pull request #126 from d-j-a-y/djay_libvje

libvje / refactor : progress
This commit is contained in:
Niels
2016-07-29 13:20:18 +02:00
committed by GitHub
22 changed files with 147 additions and 187 deletions

View File

@@ -20,8 +20,8 @@
#include <config.h> #include <config.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <libvjmem/vjmem.h>
#include <libvje/vje.h> #include <libvje/vje.h>
#include <libvjmem/vjmem.h>
#include <libsubsample/subsample.h> #include <libsubsample/subsample.h>
#include "common.h" #include "common.h"
#include "bgpush.h" #include "bgpush.h"

View File

@@ -26,10 +26,6 @@
#ifndef PUSH_H #ifndef PUSH_H
#define PUSH_H #define PUSH_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *bgpush_init(int w, int h); vj_effect *bgpush_init(int w, int h);
void bgpush_apply( VJFrame *frame ); void bgpush_apply( VJFrame *frame );
int bgpush_malloc(int w, int h); int bgpush_malloc(int w, int h);

View File

@@ -19,8 +19,10 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include "color.h" #include "color.h"
vj_effect *color_init(int w, int h) vj_effect *color_init(int w, int h)
{ {
vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect));
@@ -48,9 +50,7 @@ vj_effect *color_init(int w, int h)
} }
void color_apply(VJFrame *frame, int width, int height, void color_apply(VJFrame *frame, int opacity_a, int opacity_b, int opacity_c)
int opacity_a, int opacity_b,
int opacity_c)
{ {
unsigned int i; unsigned int i;
const unsigned int op_a0 = 255 - opacity_a; const unsigned int op_a0 = 255 - opacity_a;
@@ -93,7 +93,6 @@ void color_apply(VJFrame *frame, int width, int height,
Cb[i] = q1; Cb[i] = q1;
Cr[i] = q2; Cr[i] = q2;
} }
} }
void color_free(){}

View File

@@ -20,12 +20,6 @@
#ifndef COLORVAL_H #ifndef COLORVAL_H
#define COLORVAL_H #define COLORVAL_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *color_init(); vj_effect *color_init();
void color_apply( VJFrame *frame , int width, int height, int a, int b, int c); void color_apply( VJFrame *frame, int a, int b, int c);
void color_free();
#endif #endif

View File

@@ -23,7 +23,6 @@
#include <math.h> #include <math.h>
#include <libvje/vje.h> #include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <libvje/vje.h>
#include <libavutil/avutil.h> #include <libavutil/avutil.h>
#include <libvjmsg/vj-msg.h> #include <libvjmsg/vj-msg.h>
#include <libyuv/yuvconv.h> #include <libyuv/yuvconv.h>

View File

@@ -28,12 +28,13 @@
*/ */
#include <config.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include "lumamask.h"
#include "common.h" #include "common.h"
#include "lumamask.h"
static uint8_t *buf[4] = { NULL,NULL,NULL,NULL }; static uint8_t *buf[4] = { NULL,NULL,NULL,NULL };
vj_effect *lumamask_init(int width, int height) vj_effect *lumamask_init(int width, int height)
@@ -84,8 +85,8 @@ int lumamask_malloc(int width, int height)
return 1; return 1;
} }
void lumamask_apply( VJFrame *frame, VJFrame *frame2, int width, void lumamask_apply( VJFrame *frame, VJFrame *frame2, int v_scale, int h_scale,
int height, int v_scale, int h_scale, int border, int alpha ) int border, int alpha )
{ {
unsigned int x,y; unsigned int x,y;
int dx,dy,nx,ny; int dx,dy,nx,ny;
@@ -94,6 +95,9 @@ void lumamask_apply( VJFrame *frame, VJFrame *frame2, int width,
int tmp1 = v_scale; int tmp1 = v_scale;
int tmp2 = h_scale; int tmp2 = h_scale;
int motion = 0; int motion = 0;
const unsigned int width = frame->width;
const unsigned int height = frame->height;
const unsigned int len = frame->len;
if( motionmap_active() ) if( motionmap_active() )
{ {
@@ -118,7 +122,7 @@ void lumamask_apply( VJFrame *frame, VJFrame *frame2, int width,
uint8_t *Cr2 = frame2->data[2]; uint8_t *Cr2 = frame2->data[2];
uint8_t *aA = frame->data[3]; uint8_t *aA = frame->data[3];
uint8_t *aB = frame2->data[3]; uint8_t *aB = frame2->data[3];
int strides[4] = { width * height, width * height, width * height ,( alpha ? width * height : 0 )}; int strides[4] = { len, len, len ,( alpha ? len : 0 )};
vj_frame_copy( frame->data, buf, strides ); vj_frame_copy( frame->data, buf, strides );
if( alpha == 0 ) if( alpha == 0 )

View File

@@ -20,11 +20,7 @@
#ifndef LUMAMASK_H #ifndef LUMAMASK_H
#define LUMAMASK_H #define LUMAMASK_H
#include <libvje/vje.h> void lumamask_apply( VJFrame *frame, VJFrame *frame2, int mode, int h_scale, int border, int alpha);
#include <sys/types.h>
#include <stdint.h>
void lumamask_apply( VJFrame *frame, VJFrame *frame2, int width,int height, int mode, int h_scale, int border, int alpha);
vj_effect *lumamask_init(int w, int h); vj_effect *lumamask_init(int w, int h);
int lumamask_malloc(int w, int h); int lumamask_malloc(int w, int h);
void lumamask_free(); void lumamask_free();

View File

@@ -17,14 +17,14 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/ */
#include <config.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <libvje/vje.h>
#include "magicmirror.h" #include <libvjmem/vjmem.h>
#include "common.h" #include "common.h"
#include "motionmap.h" #include "motionmap.h"
#include <libvje/internal.h> #include "magicmirror.h"
// if d or n changes, tables need to be calculated // if d or n changes, tables need to be calculated
static uint8_t *magicmirrorbuf[4] = { NULL,NULL,NULL,NULL }; static uint8_t *magicmirrorbuf[4] = { NULL,NULL,NULL,NULL };
@@ -123,8 +123,11 @@ void magicmirror_free()
funhouse_y = NULL; funhouse_y = NULL;
} }
void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int n, int alpha ) void magicmirror_apply( VJFrame *frame, int vx, int vy, int d, int n, int alpha )
{ {
const unsigned int width = frame->width;
const unsigned int height = frame->height;
const unsigned int len = frame->len;
double c1 = (double)vx; double c1 = (double)vx;
double c2 = (double)vy; double c2 = (double)vy;
int motion = 0; int motion = 0;
@@ -151,10 +154,10 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int
interpolate = 0; interpolate = 0;
double c3 = (double)d * 0.001; double c3 = (double)d * 0.001;
unsigned int dx,dy,x,y,p,q,len=w*h; unsigned int dx,dy,x,y,p,q;
double c4 = (double)n * 0.001; double c4 = (double)n * 0.001;
int changed = 0; int changed = 0;
uint8_t *Y = frame->data[0]; uint8_t *Y = frame->data[0];
uint8_t *Cb= frame->data[1]; uint8_t *Cb= frame->data[1];
uint8_t *Cr= frame->data[2]; uint8_t *Cr= frame->data[2];
uint8_t *A = frame->data[3]; uint8_t *A = frame->data[3];
@@ -176,31 +179,31 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int
if(changed==1) if(changed==1)
{ {
// degrees x or y changed, need new sin // degrees x or y changed, need new sin
for(x=0; x < w ; x++) for(x=0; x < width ; x++)
{ {
double res; double res;
fast_sin(res,(double)(c3*x)); fast_sin(res,(double)(c3*x));
funhouse_x[x] = res; funhouse_x[x] = res;
} }
for(y=0; y < h; y++) for(y=0; y < height; y++)
{ {
double res; double res;
fast_sin(res,(double)(c4*y)); fast_sin(res,(double)(c4*y));
funhouse_y[y] = res; funhouse_y[y] = res;
} }
} }
for(x=0; x < w; x++) for(x=0; x < width; x++)
{ {
dx = x + funhouse_x[x] * c1; dx = x + funhouse_x[x] * c1;
if(dx < 0) dx += w; if(dx < 0) dx += width;
if(dx < 0) dx = 0; else if (dx >= w) dx = w-1; if(dx < 0) dx = 0; else if (dx >= width) dx = width-1;
cache_x[x] = dx; cache_x[x] = dx;
} }
for(y=0; y < h; y++) for(y=0; y < height; y++)
{ {
dy = y + funhouse_y[y] * c2; dy = y + funhouse_y[y] * c2;
if(dy < 0) dy += h; if(dy < 0) dy += height;
if(dy < 0) dy = 0; else if (dy >= h) dy = h-1; if(dy < 0) dy = 0; else if (dy >= height) dy = height-1;
cache_y[y] = dy; cache_y[y] = dy;
} }
@@ -211,12 +214,12 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int
if( alpha ) { if( alpha ) {
veejay_memcpy( magicmirrorbuf[3], frame->data[3], len ); veejay_memcpy( magicmirrorbuf[3], frame->data[3], len );
/* apply on alpha first */ /* apply on alpha first */
for(y=1; y < h-1; y++) for(y=1; y < height-1; y++)
{ {
for(x=1; x < w-1; x++) for(x=1; x < width-1; x++)
{ {
q = y * w + x; q = y * width + x;
p = cache_y[y] * w + cache_x[x]; p = cache_y[y] * width + cache_x[x];
A[q] = magicmirrorbuf[3][p]; A[q] = magicmirrorbuf[3][p];
} }
} }
@@ -225,12 +228,12 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int
switch(alpha) { switch(alpha) {
case 1: case 1:
for(y=1; y < h-1; y++) for(y=1; y < height-1; y++)
{ {
for(x=1; x < w-1; x++) for(x=1; x < width-1; x++)
{ {
q = y * w + x; q = y * width + x;
p = cache_y[y] * w + cache_x[x]; p = cache_y[y] * width + cache_x[x];
if( Am[p] || A[q] ) { if( Am[p] || A[q] ) {
Y[q] = magicmirrorbuf[0][p]; Y[q] = magicmirrorbuf[0][p];
Cb[q] = magicmirrorbuf[1][p]; Cb[q] = magicmirrorbuf[1][p];
@@ -250,12 +253,12 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int
veejay_msg(0,"This mode requires 'Subtract background' FX"); veejay_msg(0,"This mode requires 'Subtract background' FX");
break; break;
} }
for(y=1; y < h-1; y++) for(y=1; y < height-1; y++)
{ {
for(x=1; x < w-1; x++) for(x=1; x < width-1; x++)
{ {
q = y * w + x; q = y * width + x;
p = cache_y[y] * w + cache_x[x]; p = cache_y[y] * width + cache_x[x];
if( A[q] ) { if( A[q] ) {
Y[q] = magicmirrorbuf[0][p]; Y[q] = magicmirrorbuf[0][p];
@@ -266,7 +269,7 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int
Y[q] = bgY[q]; Y[q] = bgY[q];
Cb[q] = bgCb[q]; Cb[q] = bgCb[q];
Cr[q] = bgCr[q]; Cr[q] = bgCr[q];
} }
} }
} }
@@ -275,12 +278,12 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int
} }
} }
else { else {
for(y=1; y < h-1; y++) for(y=1; y < height-1; y++)
{ {
for(x=1; x < w-1; x++) for(x=1; x < width-1; x++)
{ {
q = y * w + x; q = y * width + x;
p = cache_y[y] * w + cache_x[x]; p = cache_y[y] * width + cache_x[x];
Y[q] = magicmirrorbuf[0][p]; Y[q] = magicmirrorbuf[0][p];
Cb[q] = magicmirrorbuf[1][p]; Cb[q] = magicmirrorbuf[1][p];

View File

@@ -20,13 +20,8 @@
#ifndef MAGICMIRROR_H #ifndef MAGICMIRROR_H
#define MAGICMIRROR_H #define MAGICMIRROR_H
#include <libvjmem/vjmem.h>
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *magicmirror_init(int w, int h); vj_effect *magicmirror_init(int w, int h);
int magicmirror_malloc(int w, int h); int magicmirror_malloc(int w, int h);
void magicmirror_apply( VJFrame *frame, int width, int height, int a, int b, int na, int nb, int alpha); void magicmirror_apply( VJFrame *frame, int a, int b, int na, int nb, int alpha);
void magicmirror_free(); void magicmirror_free();
#endif #endif

View File

@@ -19,12 +19,13 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include "pencilsketch.h"
#include "common.h" #include "common.h"
#include "pencilsketch.h"
extern int vj_task_available(); extern int vj_task_available();
vj_effect *pencilsketch_init(int w, int h) vj_effect *pencilsketch_init(int w, int h)
{ {
vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect));
@@ -152,18 +153,12 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b);
} }
void pencilsketch_apply( void pencilsketch_apply(VJFrame *frame, int type, int threshold_min,
VJFrame *frame, int threshold_max, int mode)
int width,
int height,
int type,
int threshold_min,
int threshold_max,
int mode
)
{ {
unsigned int i; unsigned int i;
unsigned int len = frame->len; unsigned int len = frame->len;
const unsigned int width = frame->width;
const unsigned int uv_len = (frame->ssm ?frame->len : frame->uv_len); const unsigned int uv_len = (frame->ssm ?frame->len : frame->uv_len);
int m,d; int m,d;
uint8_t y,yb; uint8_t y,yb;

View File

@@ -20,12 +20,7 @@
#ifndef PENCILSKETCH_EFFECT_H #ifndef PENCILSKETCH_EFFECT_H
#define PENCILSKETCH_EFFECT_H #define PENCILSKETCH_EFFECT_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *pencilsketch_init(); vj_effect *pencilsketch_init();
void pencilsketch_apply(VJFrame *frame, int w, int h, int type, int threshold, int opacity,int mode); void pencilsketch_apply(VJFrame *frame, int type, int threshold, int opacity,int mode);
void pencilsketch_free(); void pencilsketch_free();
#endif #endif

View File

@@ -20,6 +20,7 @@
#include <config.h> #include <config.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include "pixelate.h" #include "pixelate.h"
@@ -58,11 +59,11 @@ vj_effect *pixelate_init(int width, int height)
return ve; return ve;
} }
void pixelate_apply( VJFrame *frame, int w, int h , int vv ) void pixelate_apply( VJFrame *frame, int vv )
{ {
unsigned int i,j ; unsigned int i,j ;
unsigned int len = frame->len; unsigned int len = frame->len;
const unsigned int v = values[vv]; const unsigned int v = values[vv];
const unsigned int uv_len = (frame->ssm ? frame->len : frame->uv_len); const unsigned int uv_len = (frame->ssm ? frame->len : frame->uv_len);
unsigned int u_v = v >> (frame->ssm ? frame->shift_h: 1 ); unsigned int u_v = v >> (frame->ssm ? frame->shift_h: 1 );
if( u_v == 0 ) if( u_v == 0 )
@@ -76,7 +77,7 @@ void pixelate_apply( VJFrame *frame, int w, int h , int vv )
for(j=0; j < v; j++) for(j=0; j < v; j++)
{ {
Y[i+j] = Y[i]; Y[i+j] = Y[i];
} }
} }
for (i = 0; i < uv_len; i+=u_v) { for (i = 0; i < uv_len; i+=u_v) {
@@ -85,6 +86,6 @@ void pixelate_apply( VJFrame *frame, int w, int h , int vv )
Cb[i+j] = Cb[i]; Cb[i+j] = Cb[i];
Cr[i+j] = Cr[i]; Cr[i+j] = Cr[i];
} }
} }
} }

View File

@@ -20,10 +20,6 @@
#ifndef PIXELATE_H #ifndef PIXELATE_H
#define PIXELATE_H #define PIXELATE_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *pixelate_init(int w, int h); vj_effect *pixelate_init(int w, int h);
void pixelate_apply( VJFrame *frame, int width, int height, int val); void pixelate_apply( VJFrame *frame, int val);
#endif #endif

View File

@@ -17,13 +17,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/ */
#include <config.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include "raster.h"
#include "common.h" #include "common.h"
#include <math.h> #include "raster.h"
vj_effect *raster_init(int w, int h) vj_effect *raster_init(int w, int h)
{ {
@@ -51,34 +50,37 @@ vj_effect *raster_init(int w, int h)
return ve; return ve;
} }
void raster_apply(VJFrame *frame, int w, int h, int val, int mode) void raster_apply(VJFrame *frame, int val, int mode)
{ {
int x,y; int x,y;
uint8_t *Y = frame->data[0]; uint8_t *Y = frame->data[0];
uint8_t *Cb= frame->data[1]; uint8_t *Cb= frame->data[1];
uint8_t *Cr= frame->data[2]; uint8_t *Cr= frame->data[2];
const unsigned int width = frame->width;
const unsigned int height = frame->height;
if(val == 0 ) if(val == 0 )
return; return;
uint8_t pixel_color = mode ? pixel_Y_hi_ : pixel_Y_lo_; uint8_t pixel_color = mode ? pixel_Y_hi_ : pixel_Y_lo_;
for(y=0; y < h; y++) for(y=0; y < height; y++)
{ {
for(x=0; x < w; x++) for(x=0; x < width; x++)
{ {
Y[y*w+x] = ((x%val>1)? ((y%val>1) ? Y[y*w+x]: pixel_color):pixel_color); Y[y*width+x] = ((x%val>1)? ((y%val>1) ? Y[y*width+x]: pixel_color):pixel_color);
} }
} }
w= frame->uv_width;
h= frame->uv_height;
for(y=0; y < h; y++) const unsigned int uv_width= frame->uv_width;
const unsigned int uv_height= frame->uv_height;
for(y=0; y < uv_height; y++)
{ {
for(x=0; x < w; x++) for(x=0; x < uv_width; x++)
{ {
Cb[y*w+x] = ((x%val>1)? ((y%val>1) ? Cb[y*w+x]:128):128); Cb[y*uv_width+x] = ((x%val>1)? ((y%val>1) ? Cb[y*uv_width+x]:128):128);
Cr[y*w+x] = ((x%val>1)? ((y%val>1) ? Cr[y*w+x]:128):128); Cr[y*uv_width+x] = ((x%val>1)? ((y%val>1) ? Cr[y*uv_width+x]:128):128);
} }
} }
/* /*

View File

@@ -20,10 +20,6 @@
#ifndef RASTER_H #ifndef RASTER_H
#define RASTER_H #define RASTER_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *raster_init(int w, int h); vj_effect *raster_init(int w, int h);
void raster_apply( VJFrame *frame, int width, int height, int val, int mode); void raster_apply( VJFrame *frame, int val, int mode);
#endif #endif

View File

@@ -17,12 +17,13 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/ */
#include <config.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include "smear.h"
#include "common.h" #include "common.h"
#include "smear.h"
vj_effect *smear_init(int w, int h) vj_effect *smear_init(int w, int h)
{ {
@@ -51,15 +52,17 @@ vj_effect *smear_init(int w, int h)
return ve; return ve;
} }
static void _smear_apply_x(VJFrame *frame, int width, int height, int val) static void _smear_apply_x(VJFrame *frame, int width, int height, int val)
{ {
unsigned int j; unsigned int j;
unsigned int x,y; unsigned int x,y;
uint8_t *Y = frame->data[0]; uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1]; uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2]; uint8_t *Cr = frame->data[2];
for(y=0; y < height-1; y++)
{ for(y=0; y < height-1; y++)
{
for(x=0; x < width; x++) for(x=0; x < width; x++)
{ {
j = Y[y*width+x]; j = Y[y*width+x];
@@ -70,8 +73,9 @@ static void _smear_apply_x(VJFrame *frame, int width, int height, int val)
Cr[y*width+x] = Cr[y*width+x+j]; Cr[y*width+x] = Cr[y*width+x+j];
} }
} }
} }
} }
static void _smear_apply_x_avg(VJFrame *frame, int width, int height, int val) static void _smear_apply_x_avg(VJFrame *frame, int width, int height, int val)
{ {
unsigned int j; unsigned int j;
@@ -93,6 +97,7 @@ static void _smear_apply_x_avg(VJFrame *frame, int width, int height, int val)
} }
} }
} }
static void _smear_apply_y_avg(VJFrame *frame, int width, int height, int val) static void _smear_apply_y_avg(VJFrame *frame, int width, int height, int val)
{ {
unsigned int i,j; unsigned int i,j;
@@ -117,6 +122,7 @@ static void _smear_apply_y_avg(VJFrame *frame, int width, int height, int val)
} }
} }
} }
static void _smear_apply_y(VJFrame *frame, int width, int height, int val) static void _smear_apply_y(VJFrame *frame, int width, int height, int val)
{ {
unsigned int i,j; unsigned int i,j;
@@ -146,44 +152,43 @@ static void _smear_apply_y(VJFrame *frame, int width, int height, int val)
static int n__ = 0; static int n__ = 0;
static int N__ = 0; static int N__ = 0;
void smear_apply( VJFrame *frame, int width, int height,int mode, int val) void smear_apply( VJFrame *frame,int mode, int val)
{ {
int interpolate = 1; int interpolate = 1;
int tmp1 = mode; int tmp1 = mode;
int tmp2 = val; int tmp2 = val;
int motion = 0; int motion = 0;
if(motionmap_active()) const unsigned int width = frame->width;
{ const unsigned int height = frame->height;
motionmap_scale_to( 255, 3, 0, 0, &tmp2, &tmp1, &n__, &N__ );
motion = 1; if(motionmap_active())
} {
motionmap_scale_to( 255, 3, 0, 0, &tmp2, &tmp1, &n__, &N__ );
motion = 1;
}
else else
{ {
N__ = 0; N__ = 0;
n__ = 0; n__ = 0;
} }
if( n__ == N__ || n__ == 0 ) if( n__ == N__ || n__ == 0 )
interpolate = 0; interpolate = 0;
switch(mode) switch(mode)
{ {
case 0: _smear_apply_x(frame,width,height,tmp2); break; case 0: _smear_apply_x(frame,width,height,tmp2); break;
case 1: _smear_apply_x_avg(frame,width,height,tmp2); break; case 1: _smear_apply_x_avg(frame,width,height,tmp2); break;
case 2: _smear_apply_y(frame,width,height,tmp2); break; case 2: _smear_apply_y(frame,width,height,tmp2); break;
case 3: _smear_apply_y_avg(frame,width,height,tmp2); break; case 3: _smear_apply_y_avg(frame,width,height,tmp2); break;
default: break; default: break;
} }
if( interpolate ) if( interpolate )
{ motionmap_interpolate_frame( frame, N__,n__ );
motionmap_interpolate_frame( frame, N__,n__ );
}
if(motion) if(motion)
{ motionmap_store_frame( frame );
motionmap_store_frame( frame );
}
} }

View File

@@ -20,10 +20,6 @@
#ifndef SMEAR_H #ifndef SMEAR_H
#define SMEAR_H #define SMEAR_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *smear_init(int w, int h); vj_effect *smear_init(int w, int h);
void smear_apply(VJFrame *frame, int width, int height,int mode, int val); void smear_apply(VJFrame *frame, int mode, int val);
#endif #endif

View File

@@ -22,20 +22,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/ */
#include <config.h>
#include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <math.h>
#include <libvje/vje.h> #include <libvje/vje.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <stdint.h>
#include "common.h" #include "common.h"
#include "rippletv.h"
#include "softblur.h" #include "softblur.h"
#include "water.h"
typedef struct { typedef struct {
uint8_t *ripple_data[4]; uint8_t *ripple_data[4];
@@ -502,7 +496,8 @@ static void raindrop(water_t *w)
period--; period--;
} }
void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int width, int height, int fresh_rate, int loopnum, int decay, int mode, int threshold ) void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int fresh_rate,
int loopnum, int decay, int mode, int threshold )
{ {
int x, y, i; int x, y, i;
int dx, dy; int dx, dy;
@@ -621,8 +616,8 @@ void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int width, in
vp+=2; vp+=2;
} }
hi = height; hi = frame->height;
wi = width; wi = frame->width;
vp = w->vtable; vp = w->vtable;
for(y=0; y<hi; y+=2) { for(y=0; y<hi; y+=2) {

View File

@@ -18,10 +18,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/ */
#ifndef RIPPLETV_H #ifndef WATERRIPPLE_H
#define RIPPLETV_H #define WATERRIPPLE_H
vj_effect* water_init(int width, int height); vj_effect *water_init(int width, int height);
int water_malloc(void **d,int w, int h); int water_malloc(void **d, int width, int height);
void water_free(void *d); void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int fresh_rate,
void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int width, int height,int fresh, int loopnum, int decay, int mode, int threshold ); int loopnum, int decay, int mode, int threshold );
void water_free(void *ud);
#endif #endif

View File

@@ -421,25 +421,17 @@ extern void perspective_apply( VJFrame *frame, int x1, int y1, int x2, int y2,
extern void deinterlace_apply(VJFrame *frame, int val); extern void deinterlace_apply(VJFrame *frame, int val);
//extern void simplematte_apply(VJFrame *frame, int threshold, int invert); //extern void simplematte_apply(VJFrame *frame, int threshold, int invert);
extern void crosspixel_apply(VJFrame *frame,int type, int val); extern void crosspixel_apply(VJFrame *frame,int type, int val);
extern void color_apply(VJFrame *frame, int a, int b, int c);
extern void color_apply(VJFrame *frame, int w, int h, int a,int b, int c);
//extern void water_apply(VJFrame *frame, int w, int h, int val, int l, int d); //extern void water_apply(VJFrame *frame, int w, int h, int val, int l, int d);
extern void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int width, int height, int fresh,int loopnum, int decay, int mode, int threshold); extern void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2,
int fresh,int loopnum, int decay, int mode, int threshold);
extern void pencilsketch_apply(VJFrame *frame, int w, int h, int type, int threshold, int opacity, int mode); extern void pencilsketch_apply(VJFrame *frame, int type, int threshold, int opacity, int mode);
extern void pixelate_apply(VJFrame *frame, int v );
extern void pixelate_apply(VJFrame *frame, int w, int h, int v );
extern void bgpush_apply( VJFrame *frame ); extern void bgpush_apply( VJFrame *frame );
extern void magicmirror_apply(VJFrame *frame, int x, int y, int d, int n, int alpha );
extern void magicmirror_apply(VJFrame *frame, int w, int h, int x, int y, int d, int n, int alpha ); extern void lumamask_apply(VJFrame *frame,VJFrame *frame2, int n, int m, int border, int alpha);
extern void smear_apply(VJFrame *frame, int n, int m);
extern void lumamask_apply(VJFrame *frame,VJFrame *frame2, int w, int h, int n, int m, int border, int alpha); extern void raster_apply(VJFrame *frame, int v, int mode);
extern void smear_apply(VJFrame *frame, int w, int h, int n, int m);
extern void raster_apply(VJFrame *frame, int w, int h, int v, int mode);
extern void fisheye_apply(VJFrame *frame, int w, int h, int v, int alpha ); extern void fisheye_apply(VJFrame *frame, int w, int h, int v, int alpha );

View File

@@ -113,7 +113,7 @@
#include "effects/sinoids.h" #include "effects/sinoids.h"
#include "effects/average.h" #include "effects/average.h"
#include "effects/ripple.h" #include "effects/ripple.h"
#include "effects/rippletv.h" #include "effects/water.h"
#include "effects/waterrippletv.h" #include "effects/waterrippletv.h"
#include "effects/bathroom.h" #include "effects/bathroom.h"
#include "effects/slicer.h" #include "effects/slicer.h"

View File

@@ -126,7 +126,7 @@ static void vj_effman_apply_image_effect(
waterrippletv_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); waterrippletv_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]);
break; break;
case VJ_IMAGE_EFFECT_PENCILSKETCH: case VJ_IMAGE_EFFECT_PENCILSKETCH:
pencilsketch_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3]); pencilsketch_apply(frames[0],arg[0],arg[1],arg[2],arg[3]);
break; break;
case VJ_IMAGE_EFFECT_NOISEPENCIL: case VJ_IMAGE_EFFECT_NOISEPENCIL:
noisepencil_apply(frames[0], arg[0], arg[1], arg[2], arg[3]); noisepencil_apply(frames[0], arg[0], arg[1], arg[2], arg[3]);
@@ -197,10 +197,10 @@ static void vj_effman_apply_image_effect(
mirrors_apply(frames[0], arg[0], arg[1]); mirrors_apply(frames[0], arg[0], arg[1]);
break; break;
case VJ_IMAGE_EFFECT_MAGICMIRROR: case VJ_IMAGE_EFFECT_MAGICMIRROR:
magicmirror_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4]); magicmirror_apply(frames[0],arg[0],arg[1],arg[2],arg[3],arg[4]);
break; break;
case VJ_IMAGE_EFFECT_RASTER: case VJ_IMAGE_EFFECT_RASTER:
raster_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]); raster_apply(frames[0], arg[0], arg[1]);
break; break;
case VJ_IMAGE_EFFECT_SWIRL: case VJ_IMAGE_EFFECT_SWIRL:
swirl_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); swirl_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]);
@@ -212,7 +212,7 @@ static void vj_effman_apply_image_effect(
fisheye_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]); fisheye_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]);
break; break;
case VJ_IMAGE_EFFECT_PIXELSMEAR: case VJ_IMAGE_EFFECT_PIXELSMEAR:
smear_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1]); smear_apply(frames[0], arg[0], arg[1]);
break; break;
case VJ_IMAGE_EFFECT_UVCORRECT: case VJ_IMAGE_EFFECT_UVCORRECT:
uvcorrect_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]); uvcorrect_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]);
@@ -313,7 +313,7 @@ static void vj_effman_apply_image_effect(
dices_apply(vj_effects[entry], frames[0], arg[0]); dices_apply(vj_effects[entry], frames[0], arg[0]);
break; break;
case VJ_IMAGE_EFFECT_COLORTEST: case VJ_IMAGE_EFFECT_COLORTEST:
color_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); color_apply(frames[0], arg[0], arg[1], arg[2]);
break; break;
case VJ_IMAGE_EFFECT_RAWMAN: case VJ_IMAGE_EFFECT_RAWMAN:
rawman_apply(frames[0], arg[0], arg[1]); rawman_apply(frames[0], arg[0], arg[1]);
@@ -415,7 +415,7 @@ static void vj_effman_apply_image_effect(
alphaselect2_apply(frames[0],arg[0],arg[1],arg[2],arg[3],arg[4],arg[5]); alphaselect2_apply(frames[0],arg[0],arg[1],arg[2],arg[3],arg[4],arg[5]);
break; break;
case VJ_IMAGE_EFFECT_PIXELATE: case VJ_IMAGE_EFFECT_PIXELATE:
pixelate_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); pixelate_apply(frames[0],arg[0]);
break; break;
case VJ_IMAGE_EFFECT_ALPHANEGATE: case VJ_IMAGE_EFFECT_ALPHANEGATE:
alphanegate_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); alphanegate_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]);
@@ -487,7 +487,7 @@ static void vj_effman_apply_video_effect( VJFrame **frames, vjp_kf *todo_info,in
simplemask_apply(frames[0], frames[1], arg[0], arg[1]); simplemask_apply(frames[0], frames[1], arg[0], arg[1]);
break; break;
case VJ_VIDEO_EFFECT_LUMAMASK: case VJ_VIDEO_EFFECT_LUMAMASK:
lumamask_apply(frames[0], frames[1], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3]); lumamask_apply(frames[0], frames[1], arg[0],arg[1],arg[2],arg[3]);
break; break;
case VJ_VIDEO_EFFECT_DISSOLVE: case VJ_VIDEO_EFFECT_DISSOLVE:
dissolve_apply(frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0]);break; dissolve_apply(frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0]);break;
@@ -619,7 +619,7 @@ static void vj_effman_apply_video_effect( VJFrame **frames, vjp_kf *todo_info,in
arg[0], arg[1], arg[2], arg[3] ); arg[0], arg[1], arg[2], arg[3] );
break; break;
case VJ_VIDEO_EFFECT_RIPPLETV: case VJ_VIDEO_EFFECT_RIPPLETV:
water_apply( vj_effects[entry]->user_data,frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4] ); water_apply( vj_effects[entry]->user_data,frames[0],frames[1],arg[0],arg[1],arg[2],arg[3],arg[4] );
break; break;
case VJ_VIDEO_EFFECT_RADIOACTIVE: case VJ_VIDEO_EFFECT_RADIOACTIVE: