git-svn-id: svn://code.dyne.org/veejay/trunk@105 eb8d1916-c9e9-0310-b8de-cf0c9472ead5

This commit is contained in:
Niels Elburg
2005-01-01 21:21:11 +00:00
parent cbf301d255
commit c41dd53f53
23 changed files with 1051 additions and 24 deletions

View File

@@ -1,3 +1,20 @@
0.7.1
+ fixed color corruption in fib
+ removed veejay.spec from configure.in
+ added render history list
+ fixed bug in Displacement Map
+ added new effect 'Cartoon' (Flatten bitdepth)
+ added new effect 'Nervous'
+ removed obsolete file 'motiondetect' from libvje
+ fixed mode 2 of 'Amplify Low Noise' effect
+ added new effect 'Cartoon'
+ added new effect 'Motion Ghost'
+ added new effect 'Morphology'
+ added new effect 'Nervous'
+ added new effect 'Strobo chroma scope'
- render to history list mismatches frames in clip
(too many)
0.7.0
+ added --version commandline
+ fixed use of implicit declarations and other compiler warnings

View File

@@ -1031,6 +1031,7 @@ Optional Features:
--disable-dependency-tracking Speeds up one-time builds
--enable-dependency-tracking Do not reject slow dependency extractors
--enable-ps2, Disable ZLIB support.
--enable-debug, Turn on debugging options.
--enable-compile-warnings, Turn on compiler warnings.
--enable-warnings_as_errors, Compiler warnings are errors.
--disable-samplerate Disable Samplerate support (default=no)
@@ -4235,6 +4236,11 @@ if test "${enable_ps2+set}" = set; then
enableval="$enable_ps2"
have_ps2=yes
fi;
# Check whether --enable-debug or --disable-debug was given.
if test "${enable_debug+set}" = set; then
enableval="$enable_debug"
fi;
# Check whether --enable-compile-warnings or --disable-compile-warnings was given.
if test "${enable_compile_warnings+set}" = set; then
@@ -6252,7 +6258,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 6255 "configure"' > conftest.$ac_ext
echo '#line 6261 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -6781,7 +6787,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
if { (eval echo configure:6784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
if { (eval echo configure:6790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
@@ -8613,7 +8619,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 8616 "configure"
#line 8622 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8711,7 +8717,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 8714 "configure"
#line 8720 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -21568,6 +21574,7 @@ fi
CFLAGS="$ARCHFLAGS $CFLAGS"
if test "x${GCC}" != "xyes" ; then
enable_compile_warnings=no
enable_debug=no
fi
@@ -21591,6 +21598,13 @@ if test "x$enable_compile_warnings" != "xno" ; then
fi
fi
echo "$as_me:$LINENO: checking whether to pass debugging options to the C compiler" >&5
echo $ECHO_N "checking whether to pass debugging options to the C compiler... $ECHO_C" >&6
debugCFLAGS=
if test "x$enable_debug" != "xno"; then
debugCFLAGS="-g"
fi
echo "$as_me:$LINENO: result: $warnCFLAGS" >&5
echo "${ECHO_T}$warnCFLAGS" >&6
if test "x$cflags_set" != "xyes" ; then
@@ -21598,6 +21612,8 @@ if test "x$cflags_set" != "xyes" ; then
cflags_set=yes
fi
CFLAGS="$CFLAGS $debugCFLAGS"
# Check whether --enable-altivec or --disable-altivec was given.
if test "${enable_altivec+set}" = set; then
enableval="$enable_altivec"
@@ -23430,6 +23446,8 @@ _ACEOF
echo ""
echo " veejay ${VERSION} build configuration :"
echo ""
echo "Compiler flags: $CFLAGS"
echo ""
echo " Build configuration:"
if test x$have_x86cpu = xtrue ; then
echo " x86 Architecture : ${have_x86cpu}"

View File

@@ -55,6 +55,8 @@ dnl **********************************************************************
dnl Options
AC_ARG_ENABLE(ps2,
[ --enable-ps2, Disable ZLIB support.], have_ps2=yes)
AC_ARG_ENABLE(debug,
[ --enable-debug, Turn on debugging options.])
AC_ARG_ENABLE(compile-warnings,
[ --enable-compile-warnings, Turn on compiler warnings.])
@@ -841,6 +843,7 @@ dnl
CFLAGS="$ARCHFLAGS $CFLAGS"
if test "x${GCC}" != "xyes" ; then
enable_compile_warnings=no
enable_debug=no
fi
dnl CFLAGS="$CFLAGS -g -Wall"
@@ -864,12 +867,20 @@ if test "x$enable_compile_warnings" != "xno" ; then
fi
fi
AC_MSG_CHECKING(whether to pass debugging options to the C compiler)
debugCFLAGS=
if test "x$enable_debug" != "xno"; then
debugCFLAGS="-g"
fi
AC_MSG_RESULT($warnCFLAGS)
if test "x$cflags_set" != "xyes" ; then
CFLAGS="$CFLAGS $warnCFLAGS"
cflags_set=yes
fi
CFLAGS="$CFLAGS $debugCFLAGS"
AC_ARG_ENABLE(altivec, AC_HELP_STRING([--enable-altivec], [enable Altivec code portions (yes)]),[case "${enableval}" in
yes) use_altivec=yes ;;
no) use_altivec=no ;;
@@ -941,6 +952,8 @@ dnl
echo ""
echo " veejay ${VERSION} build configuration :"
echo ""
echo "Compiler flags: $CFLAGS"
echo ""
echo " Build configuration:"
if test x$have_x86cpu = xtrue ; then
echo " x86 Architecture : ${have_x86cpu}"

View File

@@ -35,7 +35,7 @@ libvje_la_SOURCES = vj-effect.c vj-effman.c effects/common.c \
effects/isolate.c transitions/vbar.c transitions/3bar.c effects/enhancemask.c effects/noiseadd.c \
effects/contrast.c effects/motionblur.c effects/sinoids.c effects/average.c \
effects/ripple.c effects/water.c effects/noisepencil.c effects/bathroom.c effects/slice.c \
effects/crosspixel.c
effects/crosspixel.c effects/cartonize.c effects/nervous.c effects/morphology.c effects/blob.c effects/ghost.c
libvje_la_LDFLAGS = $(VJE_ALL_LIB_OPTS) \

View File

@@ -0,0 +1,273 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg <nelburg@looze.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
/* Copyright (C) 2002-2003 W.P. van Paassen - peter@paassen.tmfweb.nl
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
blob , originally from the demo effect collection
easily modified to videoblob
p0: radius
p1: number of blobs
p2: speed
p3: shape (rect,circle)
the number of blobs and size of radius determine amount of work for cpu.
*/
#include <config.h>
#include <stdlib.h>
#include <libvjmem/vjmem.h>
#include "common.h"
#include "blob.h"
typedef struct
{
short x;
short y;
} blob_t;
#define DEFAULT_RADIUS 16
#define DEFAULT_NUM 50
#define BLOB_RECT 0
#define BLOB_CIRCLE 1
static blob_t *blobs_;
static uint8_t **blob_;
static uint8_t *blob_image_;
static int blob_ready_ = 0;
static int blob_radius_ = 16;
static int blob_dradius_ = 0;
static int blob_sradius_ = 0;
static int blob_num_ = 50;
static int blob_type_ = 1;
vj_effect *blob_init(int w, int h)
{
vj_effect *ve = (vj_effect *) vj_malloc(sizeof(vj_effect));
ve->num_params = 4;
ve->defaults = (int *) vj_malloc(sizeof(int) * ve->num_params); /* default values */
ve->limits[0] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* min */
ve->limits[1] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* max */
ve->limits[0][0] = 0;
ve->limits[1][0] = 360; // radius
ve->limits[0][1] = 1;
ve->limits[1][1] = 100; // num blobs
ve->limits[0][2] = 1;
ve->limits[1][2] = 100; // speed
ve->limits[0][3] = 0;
ve->limits[1][3] = 1; // shape
ve->defaults[0] = DEFAULT_RADIUS;
ve->defaults[1] = DEFAULT_NUM;
ve->defaults[2] = 50;
ve->defaults[3] = 1;
ve->description = "Video Blobs";
ve->sub_format = 1;
ve->extra_frame = 0;
ve->has_user =0;
return ve;
}
static void blob_init_( blob_t *b , int w , int h)
{
b->x = (w >> 1) - blob_radius_;
b->y = (h >> 1) - blob_radius_;
}
// FIXME private
int blob_malloc(int w, int h)
{
int j,i;
double frac;
int dist_sqrt;
if(blob_radius_ <= 0)
return 0;
blob_dradius_ = blob_radius_ * 2;
blob_sradius_ = blob_radius_ * blob_radius_;
blob_ = (uint8_t**) vj_malloc(sizeof(uint8_t*) * blob_dradius_ );
for(i = 0; i < blob_dradius_ ; i ++ )
{
blob_[i] = (uint8_t*) vj_malloc(sizeof(uint8_t) * blob_dradius_ );
if(!blob_[i]) return 0;
}
blobs_ = (blob_t*) vj_malloc(sizeof(blob_t) * blob_num_ );
if(!blobs_ ) return 0;
blob_image_ = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h );
if(!blob_image_) return 0;
for( i = -blob_radius_ ; i < blob_radius_ ; ++ i )
{
for( j = -blob_radius_ ; j < blob_radius_ ; ++ j )
{
dist_sqrt = i * i + j * j;
if( dist_sqrt < blob_sradius_ )
{
frac = (double) (sqrt(dist_sqrt)) / (double) blob_sradius_;
blob_[i + blob_radius_][j + blob_radius_] = 0xff;
}
else
{
blob_[i + blob_radius_][j + blob_radius_ ] = 0x0; // was 0
}
}
}
for( i = 0; i < blob_num_ ; i ++ )
{
blob_init_( blobs_ + i , w , h );
}
memset( blob_image_ , 0 , w * h );
blob_ready_ = 1;
return 1;
}
void blob_free()
{
int i;
for (i = 0; i < blob_dradius_ ; i ++ )
if( blob_[i] ) free( blob_[i] );
if(blobs_)
free(blobs_);
if(blob_image_)
free(blob_image_);
}
typedef void (*blob_func)(int s, int width);
static void blob_render_circle(int s, int width)
{
int i,j;
for( i = 0; i < blob_dradius_ ; ++ i )
{
for( j = 0; j < blob_dradius_ ; ++ j)
{
if( blob_image_[ s + j ] + blob_[i][j] > 255 )
blob_image_[s + j] = 0xff;
else
blob_image_[s + j] += blob_[i][j];
}
s += width;
}
}
static void blob_render_rect(int s, int width)
{
int i,j;
for( i = 0; i < blob_dradius_ ; ++ i )
{
for( j = 0; j < blob_dradius_ ; ++ j)
{
blob_image_[s + j] = 0xff;
}
s += width;
}
}
blob_func *blob_render(void)
{
if( blob_type_ == BLOB_RECT)
return &blob_render_rect;
return &blob_render_circle;
}
void blob_apply(VJFrame *frame,
int width, int height, int radius, int num, int speed, int shape)
{
const int len = frame->len;
uint8_t *srcY = frame->data[0];
uint8_t *srcCb= frame->data[1];
uint8_t *srcCr= frame->data[2];
int i,j,k;
int s;
int op_a, op_b;
double max = speed / 10.0;
blob_func f = blob_render();
blob_type_ = shape;
if( radius != blob_radius_ || num != blob_num_ )
{ // reinitialize
blob_radius_ = radius;
blob_num_ = num;
blob_free();
blob_malloc(width,height);
}
// move blob
for( i = 0; i < blob_num_; i ++)
{
blobs_[i].x += -2 + (int) ( max * (rand()/(RAND_MAX+1.0)));
blobs_[i].y += -2 + (int) ( max * (rand()/(RAND_MAX+1.0)));
}
// fill blob
for( k = 0; k < blob_num_ ; k ++ )
{
if( (blobs_[k].x > 0) &&
(blobs_[k].x < (width - blob_dradius_)) &&
(blobs_[k].y > 0) &&
(blobs_[k].y < (height - blob_dradius_)) )
{
s = blobs_[k].x + blobs_[k].y * width;
f(s,width);
}
else
{
blob_init_( blobs_ + k,width ,height );
}
}
// project blob onto video frame
for(i = 0; i < len ; i ++ )
{
if( blob_image_[i] == 0x0 )
{
srcY[i] = 16;
srcCb[i] = 128;
srcCr[i] = 128;
}
blob_image_[i] = 0x0;
}
}

View File

@@ -0,0 +1,32 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg <nelburg@looze.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#ifndef BLOB_H
#define BLOB_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *blob_init(int w, int h);
void blob_apply( VJFrame *frame, int width, int height, int p0,int p1, int p2, int p3);
int blob_malloc( int w, int h );
void blob_free(void);
#endif

View File

@@ -0,0 +1,86 @@
/*
* Linux VeeJay
*
* Copyright(C)2004 Niels Elburg <nelburg@looze.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#include <config.h>
#include "cartonize.h"
#include <stdlib.h>
vj_effect *cartonize_init(int w, int h)
{
vj_effect *ve = (vj_effect *) vj_malloc(sizeof(vj_effect));
ve->num_params = 3;
ve->defaults = (int *) vj_malloc(sizeof(int) * ve->num_params); /* default values */
ve->limits[0] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* min */
ve->limits[1] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* max */
ve->limits[0][0] = 1;
ve->limits[1][0] = 255;
ve->limits[0][1] = 1;
ve->limits[1][1] = 255;
ve->limits[0][2] = 1;
ve->limits[1][2] = 255;
ve->defaults[0] = 64;
ve->defaults[1] = 128;
ve->defaults[2] = 196;
ve->description = "Cartoon";
ve->sub_format = 0;
ve->extra_frame = 0;
ve->has_user = 0;
return ve;
}
void cartonize_apply( VJFrame *frame, int width, int height, int b1, int b2, int b3)
{
unsigned int i;
int len = (width * height);
int uv_len = frame->uv_len;
uint8_t tmp;
int p;
uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2];
const int base = (const int) b1;
const int ubase= (const int) b2 - 128;
const int vbase= (const int) b3 - 128;
// ubase/vbase cannot be 0
if(ubase==0) ubase=1;
if(vbase==0) vbase=1;
for( i = 0 ; i < len ; i ++ )
{
tmp = Y[i];
if(tmp < 16 ) tmp = 16; else if(tmp > 235 ) tmp = 235;
Y[i] = (tmp / base) * base; // loose fractional part
}
for( i = 0; i < uv_len; i ++ )
{
p = Cb[i] - 128;
if( p < -127 ) p = -127;
if( p > 127 ) p = 127;
Cb[i] = (p / ubase) * ubase + 128;
p = Cr[i] - 128;
if( p < -127 ) p = -127;
if( p > 127 ) p = 127;
Cr[i] = (p / vbase) * vbase + 128;
}
}

View File

@@ -0,0 +1,29 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg <nelburg@looze.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#ifndef CARTONIZE_H
#define CARTONIZE_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *cartonize_init(int w, int h);
void cartonize_apply( VJFrame *frame, int width, int height, int b1, int b2, int b3);
#endif

View File

@@ -0,0 +1,150 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg <nelburg@looze.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#include <config.h>
#include <stdlib.h>
#include <libvjmem/vjmem.h>
#include "common.h"
#include "ghost.h"
static uint8_t *ghost_buf[3];
static uint8_t *diff_map;
static int diff_period;
vj_effect *ghost_init(int w, int h)
{
vj_effect *ve = (vj_effect *) vj_malloc(sizeof(vj_effect));
ve->num_params = 1;
ve->defaults = (int *) vj_malloc(sizeof(int) * ve->num_params); /* default values */
ve->limits[0] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* min */
ve->limits[1] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* max */
ve->limits[0][0] = 16;
ve->limits[1][0] = 255; // opacity
ve->defaults[0] = 134;
ve->defaults[1] = 55;
ve->description = "Motion Ghost";
ve->sub_format = 1;
ve->extra_frame = 0;
ve->has_user =0;
return ve;
}
// FIXME private
int ghost_malloc(int w, int h)
{
const int len = (w * h );
int i;
for( i = 0; i < 3 ; i ++ )
{
ghost_buf[i] = (uint8_t*) vj_malloc( sizeof(uint8_t) * len);
if(!ghost_buf[i])
return 0;
memset( ghost_buf[i], (i ==0 ? 0: 128), len );
}
diff_map = (uint8_t*) vj_malloc( sizeof(uint8_t) * len);
memset( diff_map , 0, len );
diff_period = 0;
return 1;
}
void ghost_free()
{
int i;
for(i = 0 ; i < 3; i ++ )
{
if(ghost_buf[i])
free(ghost_buf[i]);
ghost_buf[i] = NULL;
}
if( diff_map )
free(diff_map);
}
void ghost_apply(VJFrame *frame,
int width, int height, int opacity)
{
register int q,z=0;
int x,y,i,tmp;
const int len = frame->len;
const unsigned int op_a = opacity;
const unsigned int op_b = 255 - op_a;
uint8_t *srcY = frame->data[0];
uint8_t *srcCb= frame->data[1];
uint8_t *srcCr= frame->data[2];
uint8_t *dY = ghost_buf[0];
uint8_t *dCb = ghost_buf[1];
uint8_t *dCr = ghost_buf[2];
uint8_t *bm = diff_map;
const uint8_t kernel[9] =
{
1,1,1,1,1,1,1,1,1
};
// first time running
if(diff_period == 0)
{
veejay_memcpy( dY, srcY, len );
veejay_memcpy( dCb,srcCb, len );
veejay_memcpy( dCr,srcCr, len );
diff_period = 1;
return;
}
// absolute difference on threshold
for(i = 0; i < len; i ++ )
bm[i] = ( abs(srcY[i] - dY[i]) > 1 ? 0xff: 0x0);
for( y = width; y < len; y += width )
{
for( x = 1; x < width - 1; x ++ )
{
// input matrix
uint8_t mt[9] = {
bm[ x-1+y-width], bm[ x+y-width], bm[x+1+y-width],
bm[ x-1+y ], bm[ x+y ], bm[x+1+y],
bm[ x-1+y+width], bm[ x+y+width ], bm[x+1+y+width]
};
for( q = 0; q < 9; q ++ )
{
if( kernel[q] && mt[q] ) // dilation
{ z ++; break; }
}
if( z > 0 ) // accept
{
// new pixel value back in ghost buf (feedback)
dY[x+y] = ( (op_a * srcY[x+y] ) + (op_b * dY[x+y]) ) >> 8;
dCb[x+y] = ((op_a * srcCb[x+y] ) + (op_b * dCb[x+y])) >> 8;
dCr[x+y] = ((op_a * srcCr[x+y] ) + (op_b * dCr[x+y])) >> 8;
// put result to screen
srcY[x+y] = dY[x+y];
srcCb[x+y]= dCb[x+y];
srcCr[x+y] = dCr[x+y];
}
z = 0;
}
}
}

View File

@@ -0,0 +1,32 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg <nelburg@looze.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#ifndef GHOST_H
#define GHOST_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *ghost_init(int w, int h);
void ghost_apply( VJFrame *frame, int width, int height, int op);
int ghost_malloc( int w, int h );
void ghost_free(void);
#endif

View File

@@ -104,6 +104,7 @@ void lumamask_apply( VJFrame *frame, VJFrame *frame2, int width,
ny = y + dy;
if(nx < 0) nx+=width;
if(nx < 0) nx = 0; else if (nx > width) nx = width;
if(ny < 0) ny+=height;
if(ny < 0) ny = 0; else if (ny >= height) ny = height-1;
// put pixels from local copy
Y[y*width+x] = buf[0][ny * width + x];

View File

@@ -0,0 +1,161 @@
/*
* Linux VeeJay
*
* Copyright(C)2004 Niels Elburg <nelburg@looze.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#include <config.h>
#include "morphology.h"
#include <stdlib.h>
typedef uint8_t (*morph_func)(uint8_t *kernel, uint8_t mt[9] );
vj_effect *morphology_init(int w, int h)
{
vj_effect *ve = (vj_effect *) vj_malloc(sizeof(vj_effect));
ve->num_params = 3;
ve->defaults = (int *) vj_malloc(sizeof(int) * ve->num_params); /* default values */
ve->limits[0] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* min */
ve->limits[1] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* max */
ve->limits[0][0] = 0; // threshold
ve->limits[1][0] = 255;
ve->limits[0][1] = 0; // morpology operator (dilate,erode, ... )
ve->limits[1][1] = 8;
ve->limits[0][2] = 0;
ve->limits[1][2] = 1; // passes
ve->defaults[0] = 140;
ve->defaults[1] = 0;
ve->defaults[2] = 0;
ve->description = "Morphology (experimental)";
ve->sub_format = 0;
ve->extra_frame = 0;
ve->has_user = 0;
return ve;
}
static uint8_t *binary_img;
int morphology_malloc(int w, int h )
{
binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h );
if(!binary_img) return 0;
return 1;
}
void morphology_free(void)
{
if(binary_img)
free(binary_img);
binary_img = NULL;
}
static uint8_t _dilate_kernel3x3( uint8_t *kernel, uint8_t img[9])
{
register int x;
/* consider all background pixels (0) in input image */
for(x = 0; x < 9; x ++ )
if((kernel[x] * img[x]) > 0 )
return 235;
return 16;
}
static uint8_t _erode_kernel3x3( uint8_t *kernel, uint8_t img[9])
{
register int x;
/* consider all background pixels (0) in input image */
for(x = 0; x < 9; x ++ )
if(kernel[x] && img[x] == 0 )
return 16;
return 235;
}
morph_func _morphology_function(int i)
{
if( i == 0 )
return _dilate_kernel3x3;
if( i == 1 )
return _erode_kernel3x3;
}
void morphology_apply( VJFrame *frame, int width, int height, int threshold, int type, int passes )
{
unsigned int i,x,y;
int len = (width * height);
int c = 0,t=0,k=0;
int uv_len = frame->uv_len;
uint8_t pixel;
uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2];
uint8_t kernels[4][9] ={
{ 1,1,1, 1,1,1 ,1,1,1 },//0
{ 0,1,0, 1,1,1, 0,1,0 },//1
{ 0,0,0, 1,1,1, 0,0,0 },//2
{ 0,1,0, 0,1,0, 0,1,0 },//3
{ 0,0,1, 0,1,0, 1,0,0 },//4
{ 1,0,0, 0,1,0, 0,0,1 },
{ 1,1,1, 0,0,0, 0,0,0 },
{ 0,0,0, 0,0,0, 1,1,1 }
};
morph_func p = _morphology_function(passes);
/* threshold image --> binary img
0 = bg
255 = fg
*/
for( i = 0; i < len; i ++ )
{ binary_img[i] = ( Y[i] < threshold ? 0: 235 );t++;}
memset( Cb, 128, uv_len );
memset( Cr, 128, uv_len );
len -= width;
if(type > 7 ) return;
/* compute dilation of binary image with kernel */
for(y = width; y < len; y += width )
{
for(x = 1; x < width-1; x ++)
{
if(binary_img[x+y] == 0)
{
uint8_t mt[9] = {
binary_img[x-1+y-width], binary_img[x+y-width], binary_img[x+1+y-width],
binary_img[x-1+y], binary_img[x+y] , binary_img[x+1+y],
binary_img[x-1+y+width], binary_img[x+y+width], binary_img[x+1+y+width]
};
/*
uint8_t it[9] = {
Y[x-1+y-width], Y[x+y-width], Y[x+1+y-width],
Y[x-1+y], Y[x+y] , Y[x+1+y],
Y[x-1+y+width], Y[x+y+width], Y[x+1+y+width]
};
*/
Y[x+y] = p( kernels[type], mt );
c++;
}
}
}
len -=width;
}

View File

@@ -0,0 +1,31 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg <elburg@hio.hen.nl>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#ifndef MORPHOLOGY_H
#define MORPHOLOGY_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *morphology_init(int w, int h);
void morphology_apply( VJFrame *frame, int width, int height, int t, int val, int n);
int morphology_malloc(int w, int h);
void morphology_free(void);
#endif

View File

@@ -100,15 +100,9 @@ void motionblur_apply( VJFrame *frame, int width, int height, int n) {
if(n_motion_frames >= n ) {
n_motion_frames = 0;
#ifdef HAVE_ASM_MMX
memset_ycbcr( previous_frame[0], previous_frame[0], 0, (width*height));
memset_ycbcr( previous_frame[1], previous_frame[1], 0, (width*height)/4);
memset_ycbcr( previous_frame[2], previous_frame[2], 0, (width*height)/4);
#else
memset( previous_frame[0], 0, (width*height));
memset( previous_frame[1], 0, len/4);
memset( previous_frame[2], 0, len/4);
#endif
memset( previous_frame[1], 0, uv_len);
memset( previous_frame[2], 0, uv_len);
}

View File

@@ -0,0 +1,114 @@
/*
* Linux VeeJay
*
* Copyright(C)2004 Niels Elburg <elburg@hio.hen.nl>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
/*
Nervous is loosly based on Kentaro's Nervous effect, found
in EffecTV ( http://effectv.sf.net ).
*/
#include <config.h>
#include "nervous.h"
#include <stdlib.h>
#define N_MAX 25
static uint8_t *nervous_buf[3]; // huge buffer
static int frames_elapsed;
vj_effect *nervous_init(int w, int h)
{
vj_effect *ve = (vj_effect *) vj_malloc(sizeof(vj_effect));
ve->num_params = 1;
ve->defaults = (int *) vj_malloc(sizeof(int) * ve->num_params); /* default values */
ve->limits[0] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* min */
ve->limits[1] = (int *) vj_malloc(sizeof(int) * ve->num_params); /* max */
ve->limits[0][0] = 0;
ve->limits[1][0] = N_MAX;
ve->defaults[0] = N_MAX;
ve->description = "Nervous";
ve->sub_format = 0;
ve->extra_frame = 0;
ve->has_user = 0;
return ve;
}
int nervous_malloc(int w, int h )
{
nervous_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h * N_MAX);
if(!nervous_buf[0]) return 0;
nervous_buf[1] = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h * N_MAX);
if(!nervous_buf[1]) return 0;
nervous_buf[2] = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h * N_MAX);
if(!nervous_buf[2]) return 0;
frames_elapsed = 0;
return 1;
}
void nervous_free(void)
{
if( nervous_buf[0] ) free(nervous_buf[0]);
if( nervous_buf[1] ) free(nervous_buf[1]);
if( nervous_buf[2] ) free(nervous_buf[2]);
nervous_buf[0] = NULL;
nervous_buf[1] = NULL;
nervous_buf[2] = NULL;
}
void nervous_apply( VJFrame *frame, int width, int height, int delay)
{
unsigned int i;
int len = (width * height);
int uv_len = frame->uv_len;
uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2];
uint8_t *NY = nervous_buf[0] + (len * frames_elapsed );
uint8_t *NCb= nervous_buf[1] + (uv_len * frames_elapsed );
uint8_t *NCr= nervous_buf[2] + (uv_len * frames_elapsed );
// copy original into nervous buf
veejay_memcpy( NY, Y, len );
veejay_memcpy( NCb, Cb, uv_len );
veejay_memcpy( NCr, Cr, uv_len );
if(frames_elapsed > 0)
{
// take a random frame
unsigned int index = (unsigned int) ((double)frames_elapsed *
rand() / (RAND_MAX+1.0) );
// setup pointers
uint8_t *sY = nervous_buf[0] + (len * index);
uint8_t *sCb = nervous_buf[1] + (uv_len * index);
uint8_t *sCr = nervous_buf[2] + (uv_len * index);
// copy it to dst
veejay_memcpy( Y, sY, len );
veejay_memcpy( Cb, sCb, uv_len );
veejay_memcpy( Cr, sCr, uv_len );
}
frames_elapsed ++;
if( frames_elapsed == N_MAX )
frames_elapsed = 0;
}

View File

@@ -0,0 +1,31 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg <elburg@hio.hen.nl>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#ifndef NERVOUS_H
#define NERVOUS_H
#include <libvje/vje.h>
#include <sys/types.h>
#include <stdint.h>
vj_effect *nervous_init(int w, int h);
int nervous_malloc(int w, int h);
void nervous_free(void);
void nervous_apply(VJFrame *Frame, int width, int height,int delay);
#endif

View File

@@ -126,7 +126,7 @@ void noiseneg3x3_maskapply(uint8_t *src[3], int width, int height, int coeef ) {
for (r = width; r < len; r += width) {
for (c = 1; c < width-1; c++) {
Yb_frame[c + r] = (src[0][r - width + c - 1] +
Yb_frame[c + r] = 255 - ((src[0][r - width + c - 1] +
src[0][r - width + c] +
src[0][r - width + c + 1] +
src[0][r + width + c - 1] +
@@ -135,7 +135,7 @@ void noiseneg3x3_maskapply(uint8_t *src[3], int width, int height, int coeef ) {
src[0][r + c] +
src[0][r + c + 1] +
src[0][r + c - 1]
) / 9;
)) / 9;
}
}

View File

@@ -174,11 +174,16 @@ enum {
VJ_IMAGE_EFFECT_CHROMAPALETTE = 158,
VJ_IMAGE_EFFECT_UVCORRECT = 159,
VJ_IMAGE_EFFECT_OVERCLOCK = 160,
VJ_IMAGE_EFFECT_CARTONIZE = 161,
VJ_IMAGE_EFFECT_NERVOUS = 162,
VJ_IMAGE_EFFECT_MORPHOLOGY = 163,
VJ_IMAGE_EFFECT_VIDBLOB = 164,
VJ_IMAGE_EFFECT_GHOST = 165,
VJ_IMAGE_EFFECT_DUMMY = 100,
};
#define VJ_IMAGE_EFFECT_MIN 100
#define VJ_IMAGE_EFFECT_MAX 161
#define VJ_IMAGE_EFFECT_MAX 166
#define VJ_VIDEO_EFFECT_MIN 200
#define VJ_VIDEO_EFFECT_MAX 236
@@ -464,4 +469,12 @@ extern void overclock_apply(VJFrame *frame, int w, int h, int val, int r);
extern void diff_prepare(void *data, uint8_t *map[3], int w, int h);
extern void cartonize_apply( VJFrame *frame, int w, int h, int b1, int b2, int b3 );
extern void morphology_apply( VJFrame *frame, int w, int h, int t, int v, int p);
extern void blob_apply( VJFrame *frame, int w, int h, int p0,int p1, int p2, int p3);
extern void ghost_apply(VJFrame *frame, int w, int h, int o );
#endif

View File

@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
// todo: clean up initialization (use function pointers!)
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
@@ -121,6 +123,11 @@
#include "effects/uvcorrect.h"
#include "effects/dissolve.h"
#include "effects/overclock.h"
#include "effects/cartonize.h"
#include "effects/nervous.h"
#include "effects/morphology.h"
#include "effects/blob.h"
#include "effects/ghost.h"
static struct
{
@@ -156,6 +163,10 @@ static struct
{ radialblur_malloc, radialblur_free, VJ_IMAGE_EFFECT_RADIALBLUR },
{ uvcorrect_malloc, uvcorrect_free, VJ_IMAGE_EFFECT_UVCORRECT },
{ overclock_malloc, overclock_free, VJ_IMAGE_EFFECT_OVERCLOCK },
{ nervous_malloc, nervous_free, VJ_IMAGE_EFFECT_NERVOUS },
{ morphology_malloc, morphology_free, VJ_IMAGE_EFFECT_MORPHOLOGY },
{ blob_malloc, blob_free, VJ_IMAGE_EFFECT_VIDBLOB },
{ ghost_malloc, ghost_free, VJ_IMAGE_EFFECT_GHOST },
{ NULL , NULL ,0 },
};
@@ -429,7 +440,11 @@ void vj_effect_initialize(int width, int height)
vj_effects[i + 58] = chromapalette_init(width,height);
vj_effects[i + 59] = uvcorrect_init(width,height);
vj_effects[i + 60] = overclock_init(width,height);
vj_effects[i + 61] = cartonize_init(width,height);
vj_effects[i + 62] = nervous_init(width,height);
vj_effects[i + 63] = morphology_init(width,height);
vj_effects[i + 64] = blob_init(width,height);
vj_effects[i + 65] = ghost_init(width,height);
max_width = width;
max_height = height;

View File

@@ -155,6 +155,24 @@ void vj_effman_apply_image_effect(
case VJ_IMAGE_EFFECT_CHROMIUM:
chromium_apply( frames[0], frameinfo->width, frameinfo->height, arg[0]);
break;
case VJ_IMAGE_EFFECT_CARTONIZE:
cartonize_apply( frames[0], frameinfo->width,frameinfo->height,
arg[0],arg[1],arg[2] );
break;
case VJ_IMAGE_EFFECT_VIDBLOB:
blob_apply( frames[0],frameinfo->width,frameinfo->height,
arg[0],arg[1],arg[2],arg[3] );
break;
case VJ_IMAGE_EFFECT_GHOST:
ghost_apply( frames[0], frameinfo->width,frameinfo->height,arg[0]);
break;
case VJ_IMAGE_EFFECT_MORPHOLOGY:
morphology_apply( frames[0], frameinfo->width,frameinfo->height,
arg[0],arg[1],arg[2] );
break;
case VJ_IMAGE_EFFECT_NERVOUS:
nervous_apply( frames[0], frameinfo->width, frameinfo->height,
arg[0]); break;
case VJ_IMAGE_EFFECT_OVERCLOCK:
overclock_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1]);
break;

View File

@@ -25,7 +25,7 @@
#include <string.h>
#include <libvjmem/vjmem.h>
#define MAX_EFFECTS 97
#define MAX_EFFECTS 102
// keyframe-able parameter sets

View File

@@ -316,7 +316,6 @@ lav_file_t *lav_open_output_file(char *filename, char format,
AVI_set_video(lav_fd->avi_fd,width,height,fps, "dvsd");
if(asize) AVI_set_audio(lav_fd->avi_fd,achans,arate,asize,WAVE_FORMAT_PCM);
return lav_fd;
}
return NULL;
}
@@ -324,10 +323,10 @@ lav_file_t *lav_open_output_file(char *filename, char format,
int lav_close(lav_file_t *lav_file)
{
int ret = 0;
video_format = lav_file->format; internal_error = 0; /* for error messages */
ret = AVI_close( lav_file->avi_fd );
if(lav_file) free(lav_file);
return 1;
video_format = lav_file->format; internal_error = 0; /* for error messages */
ret = AVI_close( lav_file->avi_fd );
if(lav_file) free(lav_file);
return 1;
}
int lav_write_frame(lav_file_t *lav_file, uint8_t *buff, long size, long count)

View File

@@ -67,7 +67,7 @@ enum {
#define EDIT_COPY 103
#define EDIT_CROP 104
#define EDIT_DEL 105
#define MAX_EFFECTS 97
#define MAX_EFFECTS 102
#define MESSAGE_SIZE 1024 /* enough for my needs */
#define EL_MIN_BUF (65535 * 4)
#define XMLTAG_BUNDLE_FILE "ACTIONFILE"