diff --git a/veejay-current/plugin-packs/lvdasciiart/plugins/lvd_aa.c b/veejay-current/plugin-packs/lvdasciiart/plugins/lvd_aa.c index 9d7d497f..b0ac74fe 100644 --- a/veejay-current/plugin-packs/lvdasciiart/plugins/lvd_aa.c +++ b/veejay-current/plugin-packs/lvdasciiart/plugins/lvd_aa.c @@ -72,7 +72,6 @@ LIVIDO_PLUGIN #include FT_GLYPH_H #include FT_STROKER_H #define NUM_GLYPHS 256 -#define RUP8(num)(((num)+8)&~8) typedef struct Glyph { FT_Glyph *glyph; ///< freetype glyph @@ -600,7 +599,7 @@ int init_instance( livido_port_t *my_instance ) livido_memset(aa,0,sizeof(lvd_aa_t)); - aa->scale.buf[0] = (uint8_t*) livido_malloc( sizeof(uint8_t) * RUP8( w * h) ); + aa->scale.buf[0] = (uint8_t*) livido_malloc( sizeof(uint8_t) * ( w * h) ); if(!aa->scale.buf[0]) { livido_free(aa); return LIVIDO_ERROR_MEMORY_ALLOCATION; @@ -615,7 +614,7 @@ int init_instance( livido_port_t *my_instance ) aa->font = -1; aa->aa_flags = 0; - aa->buf[0] = (uint8_t*) livido_malloc (sizeof(uint8_t) * RUP8(w * h * 3 ) ); + aa->buf[0] = (uint8_t*) livido_malloc (sizeof(uint8_t) * (w * h * 3 ) ); aa->buf[1] = aa->buf[0] + w*h; aa->buf[2] = aa->buf[1] + w*h; @@ -750,8 +749,8 @@ int process_instance( livido_port_t *my_instance, double timecode ) uint8_t *fb[3] = { framebuffer, NULL, NULL }; if( aa->scale.sws == NULL ) { - aa->scale.w = RUP8(w/density); - aa->scale.h = RUP8(h/density); + aa->scale.w = (w/density); + aa->scale.h = (h/density); aa->scale.sws = sws_getContext( w, h, AV_PIX_FMT_YUV444P, aa->scale.w, aa->scale.h, AV_PIX_FMT_GRAY8, aa->scale.flags,NULL,NULL,NULL); if(aa->scale.sws == NULL) return LIVIDO_ERROR_INTERNAL; diff --git a/veejay-current/plugin-packs/lvdcrop/plugins/lvd_crop.c b/veejay-current/plugin-packs/lvdcrop/plugins/lvd_crop.c index 39c227c9..f02df517 100644 --- a/veejay-current/plugin-packs/lvdcrop/plugins/lvd_crop.c +++ b/veejay-current/plugin-packs/lvdcrop/plugins/lvd_crop.c @@ -13,7 +13,6 @@ LIVIDO_PLUGIN #include "utils.h" #include "livido-utils.c" -#define RUP8(num)(((num)+8)&~8) #include @@ -37,7 +36,7 @@ int init_instance( livido_port_t *my_instance ) livido_memset(c,0,sizeof(lvd_crop_t)); - c->buf[0] = (uint8_t*) livido_malloc( sizeof(uint8_t) * RUP8(w * h * 4)); + c->buf[0] = (uint8_t*) livido_malloc( sizeof(uint8_t) * (w * h * 4)); if(!c->buf[0]) { free(c); return LIVIDO_ERROR_MEMORY_ALLOCATION; diff --git a/veejay-current/plugin-packs/lvdcrop/plugins/lvd_cropscale.c b/veejay-current/plugin-packs/lvdcrop/plugins/lvd_cropscale.c index e0d427bb..da49bb10 100644 --- a/veejay-current/plugin-packs/lvdcrop/plugins/lvd_cropscale.c +++ b/veejay-current/plugin-packs/lvdcrop/plugins/lvd_cropscale.c @@ -14,8 +14,6 @@ LIVIDO_PLUGIN #include "utils.h" #include "livido-utils.c" -#define RUP8(num)(((num)+8)&~8) - #include #include #include @@ -40,7 +38,7 @@ int init_instance( livido_port_t *my_instance ) livido_memset(c,0,sizeof(lvd_crop_t)); - c->buf[0] = (uint8_t*) livido_malloc( sizeof(uint8_t) * RUP8(w * h * 4)); + c->buf[0] = (uint8_t*) livido_malloc( sizeof(uint8_t) * (w * h * 4)); if(!c->buf[0]) { free(c); return LIVIDO_ERROR_MEMORY_ALLOCATION;\ diff --git a/veejay-current/plugin-packs/lvdcrop/plugins/lvd_scale0tilt.c b/veejay-current/plugin-packs/lvdcrop/plugins/lvd_scale0tilt.c index 654ec7db..eb6717d0 100644 --- a/veejay-current/plugin-packs/lvdcrop/plugins/lvd_scale0tilt.c +++ b/veejay-current/plugin-packs/lvdcrop/plugins/lvd_scale0tilt.c @@ -47,7 +47,6 @@ LIVIDO_PLUGIN #include "utils.h" #include "livido-utils.c" -#define RUP8(num)(((num)+8)&~8) #include #include diff --git a/veejay-current/veejay-client/share/gveejay.reloaded.glade b/veejay-current/veejay-client/share/gveejay.reloaded.glade index dd300716..302dbc84 100644 --- a/veejay-current/veejay-client/share/gveejay.reloaded.glade +++ b/veejay-current/veejay-client/share/gveejay.reloaded.glade @@ -11052,7 +11052,6 @@ VJ20 (YUV 4:2:0 Planar) VJ22 (YUV 4:2:2 Planar) MJPEG - MJPEGB HUFFYUV DVVIDEO YV16 (YCbCr 4:2:2 Planar) @@ -12882,7 +12881,6 @@ VJ20 (YUV 4:2:0 Planar) VJ22 (YUV 4:2:2 Planar) MJPEG - MJPEGB HUFFYUV DVVIDEO YV16 (YCbCr 4:2:2 Planar) diff --git a/veejay-current/veejay-client/share/gveejay.reloaded.xml b/veejay-current/veejay-client/share/gveejay.reloaded.xml index bc30fbb1..e362dd55 100644 --- a/veejay-current/veejay-client/share/gveejay.reloaded.xml +++ b/veejay-current/veejay-client/share/gveejay.reloaded.xml @@ -6962,7 +6962,6 @@ VJ20 (YUV 4:2:0 Planar) VJ22 (YUV 4:2:2 Planar) MJPEG - MJPEGB HUFFYUV DVVIDEO YV16 (YCbCr 4:2:2 Planar) @@ -8375,7 +8374,6 @@ VJ20 (YUV 4:2:0 Planar) VJ22 (YUV 4:2:2 Planar) MJPEG - MJPEGB HUFFYUV DVVIDEO YV16 (YCbCr 4:2:2 Planar) diff --git a/veejay-current/veejay-client/src/multitrack.c b/veejay-current/veejay-client/src/multitrack.c index 3a767b21..1313af7b 100644 --- a/veejay-current/veejay-client/src/multitrack.c +++ b/veejay-current/veejay-client/src/multitrack.c @@ -44,7 +44,6 @@ #include #include #include -#define RUP8(num)(num/8*8) typedef struct { @@ -165,8 +164,8 @@ void multitrack_get_preview_dimensions( int w , int h, int *dst_w, int *dst_h ) tmp_h = tmp_w / ratio; } - *dst_w = RUP8(tmp_w); - *dst_h = RUP8(tmp_h); + *dst_w = tmp_w; + *dst_h = tmp_h; } static void calculate_img_dimension(int w, int h, int *dst_w, int *dst_h, float *result, int max_w, int max_h, int quality) @@ -194,8 +193,8 @@ static void calculate_img_dimension(int w, int h, int *dst_w, int *dst_h, float tmp_h = tmp_w / ratio; } - *dst_w = RUP8(tmp_w); - *dst_h = RUP8(tmp_h); + *dst_w = tmp_w; + *dst_h = tmp_h; } diff --git a/veejay-current/veejay-client/src/sequence.c b/veejay-current/veejay-client/src/sequence.c index 9a34f8ba..1b70f97a 100644 --- a/veejay-current/veejay-client/src/sequence.c +++ b/veejay-current/veejay-client/src/sequence.c @@ -39,8 +39,6 @@ #include #include "common.h" -#define RUP8(num)(((num)+8)&~8) - extern void reloaded_schedule_restart(); extern void vj_msg(int type, const char format[], ...); extern void multitrack_cleanup_track( void *data, int track ); @@ -595,13 +593,13 @@ int gvr_track_connect( void *preview, char *hostname, int port_num, int *new_tr return 0; } - vt->data_buffer = (uint8_t*) vj_calloc( RUP8( MAX_PREVIEW_WIDTH * MAX_PREVIEW_HEIGHT * 3) ); + vt->data_buffer = (uint8_t*) vj_calloc( MAX_PREVIEW_WIDTH * MAX_PREVIEW_HEIGHT * 3); if(vt->data_buffer == NULL ) { vj_client_free( fd ); return 0; } - vt->tmp_buffer = (uint8_t*) vj_calloc( RUP8( MAX_PREVIEW_WIDTH * MAX_PREVIEW_HEIGHT * 4) ); + vt->tmp_buffer = (uint8_t*) vj_calloc( MAX_PREVIEW_WIDTH * MAX_PREVIEW_HEIGHT * 4); if(vt->tmp_buffer == NULL ) { vj_client_free( fd ); return 0; diff --git a/veejay-current/veejay-client/src/vj-api.c b/veejay-current/veejay-client/src/vj-api.c index 9ec08e1c..7485bb99 100644 --- a/veejay-current/veejay-client/src/vj-api.c +++ b/veejay-current/veejay-client/src/vj-api.c @@ -78,7 +78,7 @@ #ifdef STRICT_CHECKING #include #endif -#define RUP8(num)(((num)+8)&~8) + #ifdef ARCH_X86_64 static gpointer castIntToGpointer( int val ) { @@ -103,6 +103,23 @@ static int faster_ui_ = 0; static GtkWidget *widget_cache[MAX_WIDGET_CACHE]; +//FIXME: declare some symbols here because veejaycore is not correctly structured +int avhelper_decode_video_buffer( void *ptr, uint8_t *data, int len ) { + return -1; +} +void *avhelper_get_mjpeg_decoder(VJFrame *output) { + return NULL; +} + +int avhelper_decode_video( void *ptr, uint8_t *data, int len) { + return -1; +} +void avhelper_close_decoder( void *ptr ) { +} +int avhelper_rescale_video(void *ptr, uint8_t *dst[4]) { + return -1; +} + enum { WIDGET_IMAGEA = 0, WIDGET_NOTEBOOK18 = 1, @@ -2966,7 +2983,7 @@ void update_gui(); int veejay_get_sample_image(int id, int type, int wid, int hei) { multi_vims( VIMS_GET_SAMPLE_IMAGE, "%d %d %d %d", id, type, wid, hei ); - uint8_t *data_buffer = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(wid * hei * 3)); + uint8_t *data_buffer = (uint8_t*) vj_malloc( sizeof(uint8_t) * (wid * hei * 3)); int sample_id = 0; int sample_type =0; int full_range = 0; @@ -3186,7 +3203,7 @@ static gchar *recv_vims_args(int slen, int *bytes_written, int *arg0, int *arg1, unsigned char *result = NULL; if( ret <= 0 || len <= 0 || slen <= 0) return (gchar*)result; - result = (unsigned char*) vj_calloc(sizeof(unsigned char) * RUP8(len + 1 + 16) ); + result = (unsigned char*) vj_calloc(sizeof(unsigned char) * (len + 16) ); *bytes_written = vj_client_read( info->client, V_CMD, result, len ); if( *bytes_written == -1 ) reloaded_schedule_restart(); diff --git a/veejay-current/veejay-core/configure.ac b/veejay-current/veejay-core/configure.ac index cda0a0e3..6f464e05 100644 --- a/veejay-current/veejay-core/configure.ac +++ b/veejay-current/veejay-core/configure.ac @@ -54,6 +54,8 @@ AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[Compile in debugging information])) AC_ARG_ENABLE([profile], AS_HELP_STRING([--enable-profiling],[Compile in profiling information])) +AC_ARG_ENABLE([strict], + AS_HELP_STRING([--enable-strict],[Compile in strict checking])) AC_ARG_ENABLE([compile-warnings], AS_HELP_STRING([--enable-compile-warnings],[Turn on compiler warnings.])) AC_ARG_ENABLE([warnings_as_errors], @@ -183,6 +185,13 @@ if test "x$enable_strict" = "xyes" ; then else AC_MSG_RESULT([no]) fi +AC_MSG_CHECKING(whether to compile in assertion checking) +if test "x$enable_strict" = "xyes" ; then + debugCFLAGS="$debugCFLAGS -DSTRICT_CHECKING" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi if test "x$enable_sanitizer" = "xyes" ; then debugCFLAGS="$debugCFLAGS -fsanitize=address -fno-omit-frame-pointer" AC_MSG_RESULT([yes]) diff --git a/veejay-current/veejay-core/libvjmem/memcpy.c b/veejay-current/veejay-core/libvjmem/memcpy.c index 3aa9145b..1bfdcd6c 100644 --- a/veejay-current/veejay-core/libvjmem/memcpy.c +++ b/veejay-current/veejay-core/libvjmem/memcpy.c @@ -2269,7 +2269,6 @@ void memcpy_report() } void *(* veejay_memcpy)(void *to, const void *from, size_t len) = 0; - void *(* veejay_memset)(void *what, uint8_t val, size_t len ) = 0; static int set_user_selected_memcpy() @@ -2485,8 +2484,14 @@ set_best_memset_method: } void vj_mem_set_defaults() { +#ifdef STRICT_CHECKING + veejay_memset = memset; + veejay_memcpy = memcpy; + veejay_msg(VEEJAY_MSG_WARNING, "Using default memcpy() / memset() functions"); +#else veejay_memset = memset_method[1].function; veejay_memcpy = memcpy_method[1].function; +#endif } static void vj_frame_copy_job( void *arg ) { diff --git a/veejay-current/veejay-core/libvjmem/vj-x86.c b/veejay-current/veejay-core/libvjmem/vj-x86.c index 2e9f3efc..194216d5 100644 --- a/veejay-current/veejay-core/libvjmem/vj-x86.c +++ b/veejay-current/veejay-core/libvjmem/vj-x86.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -162,6 +163,14 @@ void vj_mem_init(void) task_init(); } +void vj_mem_optimize() { +#ifndef STRICT_CHECKING + find_best_memcpy(); + find_best_memset(); +#endif +} + + void vj_mem_destroy() { } @@ -222,7 +231,6 @@ void *vj_malloc_(size_t size) { if( size <= 0 ) return NULL; - void *ptr = NULL; #ifdef HAVE_POSIX_MEMALIGN size_t aligned_size = (size + MEM_ALIGNMENT_SIZE - 1) & ~(MEM_ALIGNMENT_SIZE - 1); @@ -250,13 +258,12 @@ void *vj_malloc_(size_t size) return ptr; } -#define RUP8(num)(((num)+8)&~8) void *vj_calloc_( size_t size ) { void *ptr = vj_malloc_(size); if(ptr) - veejay_memset(ptr,0,size); + memset(ptr,0,size); return ptr; } @@ -272,7 +279,7 @@ void *vj_simple_pool_init( size_t s ) v_simple_pool_t *pool = (v_simple_pool_t*) vj_malloc( sizeof(v_simple_pool_t) ); if(!pool) return NULL; - void *addr = vj_calloc_( RUP8(s) ); + void *addr = vj_calloc_( s + 16 ); if(!addr) { free(pool); return NULL; @@ -291,7 +298,7 @@ void *vj_simple_pool_alloc( void *ptr, size_t s ) } uint8_t *addr = (uint8_t*) pool->addr + (pool->cur); - pool->cur += RUP8(s); + pool->cur += s; return (void*) ( addr + pool->cur ); } diff --git a/veejay-current/veejay-core/libvjmem/vjmem.h b/veejay-current/veejay-core/libvjmem/vjmem.h index e9303b9d..72dc5574 100644 --- a/veejay-current/veejay-core/libvjmem/vjmem.h +++ b/veejay-current/veejay-core/libvjmem/vjmem.h @@ -25,6 +25,7 @@ extern void *(* veejay_memcpy)(void *to, const void *from, size_t len); extern void *(* veejay_memset)(void *to, uint8_t val, size_t len); extern void vj_mem_init(void); +extern void vj_mem_optimize(); extern void vj_mem_set_defaults(); extern int vj_mem_threaded_init(int w, int h); extern void vj_mem_threaded_stop(void); @@ -65,4 +66,8 @@ extern void *vj_simple_pool_init( size_t s ); extern void vj_simple_pool_reset( void *ptr ); extern void vj_mem_destroy(); +#ifdef STRICT_CHECKING +extern void *get_malloc_refs(); +#endif + #endif diff --git a/veejay-current/veejay-core/libvjnet/vj-client.c b/veejay-current/veejay-core/libvjnet/vj-client.c index 93e3ec8b..8c850c15 100644 --- a/veejay-current/veejay-core/libvjnet/vj-client.c +++ b/veejay-current/veejay-core/libvjnet/vj-client.c @@ -47,7 +47,6 @@ #define VJC_NO_MEM 1 #define VJC_SOCKET 2 #define VJC_BAD_HOST 3 -#define RUP8(num)(((num)+8)&~8) extern int get_ffmpeg_pixfmt( int p); @@ -241,7 +240,7 @@ void vj_client_rescale_video( vj_client *v, uint8_t *data[4] ) { int vj_client_read_mcast_data( vj_client *v, int max_len ) { if( v->space == NULL ) { - v->space = vj_calloc( sizeof(uint8_t) * RUP8( max_len )); + v->space = vj_calloc( sizeof(uint8_t) * max_len ); if(v->space == NULL) return 0; } @@ -294,7 +293,7 @@ int vj_client_read_frame_hdr( vj_client *v ) int vj_client_read_frame_data( vj_client *v, int datalen) { if(v->space_len < datalen || v->space == NULL) { - v->space_len = RUP8(datalen); + v->space_len = datalen; v->space = (uint8_t*) realloc( v->space, v->space_len ); if(v->space == NULL) return 0; diff --git a/veejay-current/veejay-core/libvjnet/vj-server.c b/veejay-current/veejay-core/libvjnet/vj-server.c index 8a26ddd0..fa26c655 100644 --- a/veejay-current/veejay-core/libvjnet/vj-server.c +++ b/veejay-current/veejay-core/libvjnet/vj-server.c @@ -42,7 +42,6 @@ #include #include -#define RUP8(num)(((num)+8)&~8) #define __INVALID 0 #define __SENDER 1 @@ -78,7 +77,7 @@ static int default_timeout_sec = 10; /* Message buffer is 4 KB per client per frame tick */ #define VJ_MAX_PENDING_MSG 4096 -#define RECV_SIZE RUP8(4096) +#define RECV_SIZE 4096 #define MSG_POOL_SIZE (VJ_MAX_PENDING_MSG * 1024) static void printbuf( FILE *f, uint8_t *buf , int len ) @@ -378,7 +377,7 @@ vj_server *vj_server_alloc(int port_offset, char *mcast_group_name, int type, si if (!vjs) return NULL; - size_t bl = RUP8(buflen); + size_t bl = buflen; if( bl < RECV_SIZE ) { bl = RECV_SIZE; //@ Ensure that receive buffer is minimally 4kb } diff --git a/veejay-current/veejay-core/thirdparty/liblzo/lzo.c b/veejay-current/veejay-core/thirdparty/liblzo/lzo.c index 86ea6d56..13fb8917 100644 --- a/veejay-current/veejay-core/thirdparty/liblzo/lzo.c +++ b/veejay-current/veejay-core/thirdparty/liblzo/lzo.c @@ -103,11 +103,8 @@ static int lzo_verify_compression(uint8_t *in, int in_len, uint8_t *out , lzo_ui } -#define RUP16(num)(((num)+16)&~16) #define LZO_ALIGN_SIZE(size) \ ( ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ) * sizeof(lzo_align_t) -#define RUP8(num)(((num)+8)&~8) - void *lzo_new( int pixfmt, int width, int height, int is_decoder ) { diff --git a/veejay-current/veejay-core/veejaycore/av.h b/veejay-current/veejay-core/veejaycore/av.h index 673a962e..7451ddec 100755 --- a/veejay-current/veejay-core/veejaycore/av.h +++ b/veejay-current/veejay-core/veejaycore/av.h @@ -33,12 +33,32 @@ extern void avcodec_free_context(AVCodecContext **avctx) __attribute__((weak)); extern void av_frame_unref(AVFrame *ptr) __attribute((weak)); -#if FF_VJE_BACKPORT - -#ifndef CODEC_ID_MJPEGB -#define CODEC_ID_MJPEGB AV_CODEC_ID_MJPEGB +#ifndef CODEC_ID_YUV420 +#define CODEC_ID_YUV420 999 #endif +#ifndef CODEC_ID_YUV422 +#define CODEC_ID_YUV422 998 +#endif + +#ifndef CODEC_ID_YUV422F +#define CODEC_ID_YUV422F 997 +#endif + +#ifndef CODEC_ID_YUV420F +#define CODEC_ID_YUV420F 996 +#endif + +#ifndef CODEC_ID_YUVLZO +#define CODEC_ID_YUVLZO 900 +#endif + +#ifndef CODEC_ID_QOIY +#define CODEC_ID_QOIY 993 +#endif + +#if FF_VJE_BACKPORT + #ifndef CODEC_ID_MPEG4 #define CODEC_ID_MPEG4 AV_CODEC_ID_MPEG4 #endif diff --git a/veejay-current/veejay-core/veejaycore/avhelper.h b/veejay-current/veejay-core/veejaycore/avhelper.h index d5b679fa..5a656270 100644 --- a/veejay-current/veejay-core/veejaycore/avhelper.h +++ b/veejay-current/veejay-core/veejaycore/avhelper.h @@ -21,13 +21,6 @@ #define AVHELPER_H #include -#define CODEC_ID_YUV420 999 -#define CODEC_ID_YUV422 998 -#define CODEC_ID_YUV422F 997 -#define CODEC_ID_YUV420F 996 -#define CODEC_ID_YUVLZO 900 -#define CODEC_ID_QOI 993 - // This is not a library, it is a collection of helper functions for various purposes void *avhelper_alloc_frame(); diff --git a/veejay-current/veejay-server/libel/av.h b/veejay-current/veejay-server/libel/av.h index 94bddde1..d2f2d77b 100755 --- a/veejay-current/veejay-server/libel/av.h +++ b/veejay-current/veejay-server/libel/av.h @@ -35,10 +35,6 @@ extern void av_frame_unref(AVFrame *ptr) __attribute((weak)); #if FF_VJE_BACKPORT -#ifndef CODEC_ID_MJPEGB -#define CODEC_ID_MJPEGB AV_CODEC_ID_MJPEGB -#endif - #ifndef CODEC_ID_MPEG4 #define CODEC_ID_MPEG4 AV_CODEC_ID_MPEG4 #endif diff --git a/veejay-current/veejay-server/libel/avhelper.c b/veejay-current/veejay-server/libel/avhelper.c index 00d236e2..b191e2cf 100644 --- a/veejay-current/veejay-server/libel/avhelper.c +++ b/veejay-current/veejay-server/libel/avhelper.c @@ -48,9 +48,12 @@ static struct { { "vj20", CODEC_ID_YUV420F }, { "vj22", CODEC_ID_YUV422F }, - { "qoiy", CODEC_ID_QOI }, + { "qoiy", CODEC_ID_QOIY }, +#if LIBAVACODEC_VERSION_MAJOR >= 59 + // ffmpeg has support for QOI since 59 + { "qoif" , AV_CODEC_ID_QOI}, +#endif { "mjpg" ,CODEC_ID_MJPEG }, - { "mjpb", CODEC_ID_MJPEGB }, { "i420", CODEC_ID_YUV420 }, { "i422", CODEC_ID_YUV422 }, { "dmb1", CODEC_ID_MJPEG }, @@ -92,7 +95,6 @@ static struct #define ROUND_UP_4(x) ROUND_UP_X (x, 2) #define ROUND_UP_8(x) ROUND_UP_X (x, 3) #define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x)) -#define RUP8(num)(((num)+8)&~8) #define MAX_PACKETS 5 @@ -289,7 +291,7 @@ static int avcodec_decode_video( AVPacket *pkt, AVCodecContext *avctx, AVFrame * int ret = avcodec_send_packet( avctx, pkt ); if( ret < 0 ) { - veejay_msg(0, "Error submitting a packet to the decoder"); + veejay_msg(0, "Error submitting a packet to the decoder: %s", av_err2str(ret)); return ret; } diff --git a/veejay-current/veejay-server/libel/avilib.c b/veejay-current/veejay-server/libel/avilib.c index efbb9d36..6c10dfac 100644 --- a/veejay-current/veejay-server/libel/avilib.c +++ b/veejay-current/veejay-server/libel/avilib.c @@ -33,8 +33,6 @@ #include #include "avilib.h" -#define RUP8(num)(((num)+8)&~8) - #ifndef O_BINARY #define O_BINARY 0 #endif @@ -321,13 +319,13 @@ static int avi_init_super_index(avi_t *AVI, unsigned char *idxtag, avisuperindex veejay_memset (sil->dwReserved, 0, sizeof (sil->dwReserved)); // NR_IXNN_CHUNKS == allow 32 indices which means 32 GB files -- arbitrary - sil->aIndex = vj_calloc( RUP8(sil->wLongsPerEntry * NR_IXNN_CHUNKS) * sizeof (uint32_t)); + sil->aIndex = vj_calloc( (sil->wLongsPerEntry * NR_IXNN_CHUNKS) * sizeof (uint32_t)); if (!sil->aIndex) { AVI_errno = AVI_ERR_NO_MEM; return -1; } - sil->stdindex = vj_calloc(RUP8( NR_IXNN_CHUNKS * sizeof (avistdindex_chunk *))); + sil->stdindex = vj_calloc(( NR_IXNN_CHUNKS * sizeof (avistdindex_chunk *))); if (!sil->stdindex) { AVI_errno = AVI_ERR_NO_MEM; return -1; diff --git a/veejay-current/veejay-server/libel/lav_io.c b/veejay-current/veejay-server/libel/lav_io.c index 1e82898a..838ba0d1 100644 --- a/veejay-current/veejay-server/libel/lav_io.c +++ b/veejay-current/veejay-server/libel/lav_io.c @@ -223,10 +223,6 @@ lav_file_t *lav_open_output_file(char *filename, char format, veejay_msg(VEEJAY_MSG_DEBUG,"\tWriting output file in AVI HFYU"); sprintf(fourcc, "HFYU"); break; - case 'c': - veejay_msg(VEEJAY_MSG_DEBUG, "\tWriting output file in AVI MJPEG-b"); - sprintf(fourcc, "MJPB" ); - break; case 'l': veejay_msg(VEEJAY_MSG_DEBUG, "\tWriting output file in AVI LJPEG"); sprintf(fourcc, "JPGL"); diff --git a/veejay-current/veejay-server/libel/pixbuf.c b/veejay-current/veejay-server/libel/pixbuf.c index 74e9a4bc..19bc6eef 100644 --- a/veejay-current/veejay-server/libel/pixbuf.c +++ b/veejay-current/veejay-server/libel/pixbuf.c @@ -36,7 +36,6 @@ #include #include #include -#define RUP8(num)(((num)+8)&~8) typedef struct { @@ -97,7 +96,7 @@ static VJFrame *open_pixbuf( vj_pixbuf_t *pic, const char *filename, int dst_w, int img_fmt = PIX_FMT_RGB24; if( pic->pixels == NULL ) { - pic->pixels = (uint8_t*) vj_calloc(sizeof(uint8_t) * RUP8(pixbuf_size + dst_w) ); + pic->pixels = (uint8_t*) vj_calloc(sizeof(uint8_t) * (pixbuf_size + dst_w) ); if(!pic->pixels) { g_object_unref(image); return NULL; @@ -261,7 +260,7 @@ void *vj_picture_open( const char *filename, int v_outw, int v_outh, int v_outf break; } - pic->space = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(4 * len)); + pic->space = (uint8_t*) vj_malloc( sizeof(uint8_t) * (4 * len)); if(!pic->space) { free(pic->filename); free(pic); diff --git a/veejay-current/veejay-server/libel/vj-avcodec.c b/veejay-current/veejay-server/libel/vj-avcodec.c index 9480f66d..73cd876f 100644 --- a/veejay-current/veejay-server/libel/vj-avcodec.c +++ b/veejay-current/veejay-server/libel/vj-avcodec.c @@ -53,19 +53,19 @@ #define ROUND_UP_4(x) ROUND_UP_X (x, 2) #define ROUND_UP_8(x) ROUND_UP_X (x, 3) #define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x)) -#define RUP8(num)(((num)+8)&~8) static int out_pixel_format = FMT_422F; - static char* vj_avcodec_get_codec_name(int codec_id ) { char name[64]; switch(codec_id) { case CODEC_ID_MJPEG: snprintf(name,sizeof(name),"MJPEG"); break; +#if LIBAVCODEC_VERSION_MAJOR >= 59 + case AV_CODEC_ID_QOI: snprintf(name, sizeof(name), "QOI (ffmpeg)"); break; +#endif case CODEC_ID_MPEG4: snprintf(name,sizeof(name), "MPEG4"); break; - case CODEC_ID_MJPEGB: snprintf(name,sizeof(name),"MJPEGB");break; case CODEC_ID_MSMPEG4V3: snprintf(name,sizeof(name), "DIVX"); break; case CODEC_ID_DVVIDEO: snprintf(name,sizeof(name), "DVVideo"); break; case CODEC_ID_LJPEG: snprintf(name,sizeof(name), "LJPEG" );break; @@ -77,9 +77,10 @@ static char* vj_avcodec_get_codec_name(int codec_id ) case 996 : snprintf(name,sizeof(name), "RAW YUV 4:2:0 Planar JPEG"); break; case 995 : snprintf(name,sizeof(name), "YUV4MPEG Stream 4:2:2"); break; case 994 : snprintf(name,sizeof(name), "YUV4MPEG Stream 4:2:0"); break; + case 993 : snprintf(name,sizeof(name), "QOI YUV 4:2:2 Planar (experimental)"); break; case 999 : snprintf(name,sizeof(name), "RAW YUV 4:2:0 Planar"); break; case 998 : snprintf(name,sizeof(name), "RAW YUV 4:2:2 Planar"); break; - case 900 : snprintf(name,sizeof(name), "LZO YUV 4:2:2 Planar"); break; + case 900 : snprintf(name,sizeof(name), "LZO YUV 4:2:2 Planar (experimental)"); break; default: snprintf(name,sizeof(name), "Unknown"); break; } @@ -154,7 +155,7 @@ static vj_encoder *vj_avcodec_new_encoder( int id, VJFrame *frame, char *filenam e->in_frame = (VJFrame*) vj_malloc(sizeof(VJFrame)); veejay_memcpy( e->in_frame, frame, sizeof(VJFrame)); - e->data[0] = (uint8_t*) vj_malloc(RUP8(e->out_frame->len * 4)); + e->data[0] = (uint8_t*) vj_malloc((e->out_frame->len * 4)); e->data[1] = e->data[0] + e->out_frame->len; e->data[2] = e->data[1] + e->out_frame->len; e->data[3] = NULL; @@ -436,8 +437,6 @@ int vj_avcodec_find_codec( int encoder ) case ENCODER_DVVIDEO: case ENCODER_QUICKTIME_DV: return CODEC_ID_DVVIDEO; - case ENCODER_MJPEGB: - return CODEC_ID_MJPEGB; case ENCODER_HUFFYUV: return CODEC_ID_HUFFYUV; case ENCODER_LJPEG: @@ -479,8 +478,6 @@ char vj_avcodec_find_lav( int encoder ) return 'd'; case ENCODER_QUICKTIME_DV: return 'Q'; - case ENCODER_MJPEGB: - return 'c'; case ENCODER_LJPEG: return 'l'; case ENCODER_YUV420: @@ -513,7 +510,6 @@ static struct { { "Invalid codec", -1 }, { "DV2", ENCODER_DVVIDEO }, { "MJPEG", ENCODER_MJPEG }, - { "MJPEGB", ENCODER_MJPEGB }, { "HuffYUV", ENCODER_HUFFYUV }, { "YUV 4:2:2 Planar, 0-255 full range", ENCODER_YUV422F }, { "YUV 4:2:0 Planar, 0-255 full range", ENCODER_YUV420F }, @@ -622,16 +618,9 @@ int vj_avcodec_free() static int vj_avcodec_copy_frame( vj_encoder *av, uint8_t *src[4], uint8_t *dst) { - if(!av) - { - veejay_msg(VEEJAY_MSG_ERROR, "The encoder is not initialized"); - return 0; - } - VJFrame *A = av->in_frame; VJFrame *B = av->out_frame; - //setup pointers A->data[0] = src[0]; A->data[1] = src[1]; A->data[2] = src[2]; @@ -643,6 +632,8 @@ static int vj_avcodec_copy_frame( vj_encoder *av, uint8_t *src[4], uint8_t *dst B->data[3] = NULL; yuv_convert_and_scale( av->scaler, A, B); + + veejay_msg(VEEJAY_MSG_DEBUG, "From %s -> %s (%d, %d)", yuv_get_pixfmt_description(A->format), yuv_get_pixfmt_description(B->format), B->len, B->uv_len); return (B->len + B->uv_len + B->uv_len); } @@ -699,18 +690,24 @@ static int vj_avcodec_encode_video( AVPacket *pkt, AVCodecContext *ctx, uint8_t break; } if (ret < 0) { + veejay_msg( VEEJAY_MSG_ERROR, "Encoding failed: %s", av_err2str(ret)); break; } + + } + + if(pkt->size > 0) + ret = pkt->size; av_packet_unref(pkt); -/* if( ret > 0 ) { + if( ret > 0 ) { char name[256]; sprintf(name, "frame-%d.jpg", ret); FILE *f = fopen( name, "wb"); fwrite( buf, ret, 1, f); fclose(f); - } */ + } return ret; @@ -794,9 +791,9 @@ int vj_avcodec_encode_frame(void *encoder, long nframe,int format, uint8_t *src av->frame->data[1] = src[1]; av->frame->data[2] = src[2]; - av->frame->linesize[0] = ROUND_UP_4( av->out_frame->width ); - av->frame->linesize[1] = ROUND_UP_4( av->out_frame->uv_width ); - av->frame->linesize[2] = ROUND_UP_4( av->out_frame->uv_width ); + av->frame->linesize[0] = av->out_frame->width; + av->frame->linesize[1] = av->out_frame->uv_width; + av->frame->linesize[2] = av->out_frame->uv_width; //av->frame->quality = 1; //av->frame->key_frame = 1; @@ -805,6 +802,8 @@ int vj_avcodec_encode_frame(void *encoder, long nframe,int format, uint8_t *src //av->frame->quality = 1; int ret = vj_avcodec_encode_video( av->packet, av->context, buf, buf_len, av->frame ); + veejay_msg(VEEJAY_MSG_DEBUG, "Encoded frame %ld to %d bytes" ,nframe, ret ); + return ret; #endif } diff --git a/veejay-current/veejay-server/libel/vj-avcodec.h b/veejay-current/veejay-server/libel/vj-avcodec.h index e664c492..ceede54a 100644 --- a/veejay-current/veejay-server/libel/vj-avcodec.h +++ b/veejay-current/veejay-server/libel/vj-avcodec.h @@ -32,7 +32,6 @@ #define ENCODER_LZO 8 #define ENCODER_YUV420F 9 #define ENCODER_YUV422F 10 -#define ENCODER_MJPEGB 11 #define ENCODER_LJPEG 12 #define ENCODER_YUV4MPEG 13 #define ENCODER_YUV4MPEG420 14 diff --git a/veejay-current/veejay-server/libel/vj-el.c b/veejay-current/veejay-server/libel/vj-el.c index beec5071..fe4ac383 100644 --- a/veejay-current/veejay-server/libel/vj-el.c +++ b/veejay-current/veejay-server/libel/vj-el.c @@ -61,8 +61,6 @@ #include #endif -#define RUP8(num)(((num)+8)&~8) - #ifdef SUPPORT_READ_DV2 #include "rawdv.h" #include "vj-dv.h" @@ -72,11 +70,9 @@ #define CODEC_ID_YUV422 998 #define CODEC_ID_YUV422F 997 #define CODEC_ID_YUV420F 996 -#define CODEC_ID_QOI 993 +#define CODEC_ID_QOIY 993 #define CODEC_ID_YUVLZO 900 #define DUMMY_FRAMES 2 -#define RUP16(num)(((num)+16)&~16) - static struct { @@ -315,7 +311,7 @@ static vj_decoder *_el_new_decoder( void *ctx, int id , int width, int height, f { d->lzo_decoder = lzo_new( el_pixel_format_, el_width_, el_height_ , 1); } - else if ( id == CODEC_ID_YUV422 || id == CODEC_ID_YUV420 || id == CODEC_ID_YUV420F || id == CODEC_ID_YUV422F || id == CODEC_ID_QOI ) { + else if ( id == CODEC_ID_YUV422 || id == CODEC_ID_YUV420 || id == CODEC_ID_YUV420F || id == CODEC_ID_YUV422F || id == CODEC_ID_QOIY ) { } else if( ctx ) @@ -326,7 +322,7 @@ static vj_decoder *_el_new_decoder( void *ctx, int id , int width, int height, f } - size_t safe_max_frame_size = RUP8( AV_INPUT_BUFFER_PADDING_SIZE + max_frame_size + GREMLIN_GUARDIAN ); + size_t safe_max_frame_size = ( AV_INPUT_BUFFER_PADDING_SIZE + max_frame_size + GREMLIN_GUARDIAN ); veejay_msg(VEEJAY_MSG_DEBUG, "Decoder buffer is %d bytes" , safe_max_frame_size); @@ -655,7 +651,7 @@ int open_video_file(char *filename, editlist * el, int preserve_pathname, int de if( decoder_id < 900 && decoder_id != AV_CODEC_ID_HUFFYUV ) max_frame_size = get_max_frame_size( el->lav_fd[n] ); - max_frame_size = RUP16( max_frame_size ); + max_frame_size = ( max_frame_size ); el->decoders[n] = _el_new_decoder( el->ctx[n], decoder_id, el->video_width, el->video_height, el->video_fps, el->pixfmt[ n ],el_pixel_format_, max_frame_size ); @@ -887,7 +883,7 @@ int vj_el_get_video_frame(editlist *el, long nframe, uint8_t *dst[4]) case CODEC_ID_YUVLZO: return lzo_decompress_el( d->lzo_decoder, data,res, dst, el_width_, el_height_, el_pixel_format_); break; - case CODEC_ID_QOI: + case CODEC_ID_QOIY: { qoi_desc d; d.channels = 1; @@ -993,8 +989,8 @@ int test_video_frame( editlist *el, int n, lav_file_t *lav,int out_pix_fmt) case CODEC_ID_YUV422F: ret = PIX_FMT_YUVJ422P; break; - case CODEC_ID_QOI: - ret = PIX_FMT_GRAY8; + case CODEC_ID_QOIY: + ret = PIX_FMT_YUVJ422P; break; case CODEC_ID_YUV420: ret = PIX_FMT_YUV420P; @@ -1476,7 +1472,7 @@ editlist *vj_el_init_with_args(char **filename, int num_files, int flags, int de n = open_video_file(filename[nf], el, flags, deinterlace,force,norm, av_pixfmt, width, height); if(n >= 0 ) { - el->frame_list = (uint64_t *) realloc(el->frame_list, (RUP8(el->video_frames + el->num_frames[n])) * sizeof(uint64_t)); + el->frame_list = (uint64_t *) realloc(el->frame_list, (el->video_frames + el->num_frames[n]) * sizeof(uint64_t)); if (el->frame_list==NULL) { veejay_msg(VEEJAY_MSG_ERROR, "Insufficient memory to allocate frame_list"); @@ -2023,7 +2019,7 @@ int vj_el_framelist_clone( editlist *src, editlist *dst) if(!src || !dst) return 0; if(dst->frame_list) return 0; - dst->frame_list = (uint64_t*) vj_malloc(sizeof(uint64_t) * RUP8(src->video_frames) ); + dst->frame_list = (uint64_t*) vj_malloc(sizeof(uint64_t) * src->video_frames ); if(!dst->frame_list) return 0; diff --git a/veejay-current/veejay-server/libplugger/frei0r-loader.c b/veejay-current/veejay-server/libplugger/frei0r-loader.c index 23e057d8..1f16e43f 100644 --- a/veejay-current/veejay-server/libplugger/frei0r-loader.c +++ b/veejay-current/veejay-server/libplugger/frei0r-loader.c @@ -45,7 +45,6 @@ #include #include -#define RUP8(num)(((num)+8)&~8) #define _VJ_MAX_PARAMS 32 static int read_plugin_configuration = 0; @@ -929,15 +928,15 @@ void *frei0r_plug_init( void *plugin , int w, int h, int pf, int read_plug_cfg ) fr0_conv_t *fr = (fr0_conv_t*) vj_calloc(sizeof(fr0_conv_t)); int i; - fr->buf = (uint8_t*) vj_malloc((sizeof(uint8_t) * RUP8( w * h * n_planes ) )); + fr->buf = (uint8_t*) vj_malloc((sizeof(uint8_t) * ( w * h * n_planes ) )); uint8_t *bufx = fr->buf; for( i = 0; i < (n_in+1); i ++ ) { //@ extra buffer for rgb output fr->in[i] = yuv_rgb_template(bufx, w,h, frfmt ); - bufx += RUP8(w*h*4); + bufx += (w*h*4); } - fr->out = yuv_yuv_template(bufx, bufx+RUP8(w*h), bufx+RUP8(w*h*2), w,h,pf ); + fr->out = yuv_yuv_template(bufx, bufx+(w*h), bufx+(w*h*2), w,h,pf ); fr->out->data[3] = bufx + (fr->out->len + fr->out->uv_len + fr->out->uv_len); if( out_scaler__ == NULL ) { diff --git a/veejay-current/veejay-server/libstream/v4l2utils.c b/veejay-current/veejay-server/libstream/v4l2utils.c index 43117c0c..b8908edf 100644 --- a/veejay-current/veejay-server/libstream/v4l2utils.c +++ b/veejay-current/veejay-server/libstream/v4l2utils.c @@ -80,8 +80,6 @@ #include #include #include -#define RUP8(num)(((num)+8)&~8) - //#include typedef struct { void *start; @@ -586,9 +584,9 @@ static int v4l2_setup_avcodec_capture( v4l2info *v, int wid, int hei, int codec_ v->picture = avhelper_alloc_frame(); v->picture->width = wid; v->picture->height = hei; - v->picture->data[0] = vj_malloc( sizeof(uint8_t) * RUP8(wid * hei + wid)); - v->picture->data[1] = vj_malloc( sizeof(uint8_t) * RUP8(wid * hei + wid)); - v->picture->data[2] = vj_malloc( sizeof(uint8_t) * RUP8(wid * hei + wid)); + v->picture->data[0] = vj_malloc( sizeof(uint8_t) * (wid * hei + wid)); + v->picture->data[1] = vj_malloc( sizeof(uint8_t) * (wid * hei + wid)); + v->picture->data[2] = vj_malloc( sizeof(uint8_t) * (wid * hei + wid)); #if LIBAVCODEC_VERSION_MAJOR < 60 if( v->codec->capabilities & CODEC_CAP_TRUNCATED) @@ -1192,7 +1190,7 @@ v4l2_rw_fallback: veejay_msg(VEEJAY_MSG_DEBUG,"v4l2: read/write buffer size is %d bytes", v->format.fmt.pix.sizeimage ); v->buffers[0].length = v->sizeimage; - v->buffers[0].start = vj_malloc( RUP8( v->sizeimage * 2 ) ); + v->buffers[0].start = vj_malloc( ( v->sizeimage * 2 ) ); } @@ -2087,7 +2085,7 @@ static void *v4l2_grabber_thread( void *v ) //@ FIXME: VEEJAY_V4L2_NO_THREADING=1 and no framebuffer is allocated ... for( j = 0; j < N_FRAMES; j ++ ) { - uint8_t *ptr = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(planes[0] * 4) ); + uint8_t *ptr = (uint8_t*) vj_malloc( sizeof(uint8_t) * (planes[0] * 4) ); if(!ptr) { i->stop = 1; v4l2_close( v4l2 ); diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index e2e4f126..da3c0317 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -86,9 +86,6 @@ int _vj_tag_new_yuv4mpeg(vj_tag * tag, int stream_nr, int w, int h, float fps); extern int frei0r_get_param_count( void *port); extern void dummy_rgb_apply(VJFrame *frame, int r, int g, int b); - -#define RUP8(num)(((num)+8)&~8) - typedef struct { uint8_t *data; diff --git a/veejay-current/veejay-server/libstream/vj-vloopback.c b/veejay-current/veejay-server/libstream/vj-vloopback.c index 78b74943..f6ca13b1 100644 --- a/veejay-current/veejay-server/libstream/vj-vloopback.c +++ b/veejay-current/veejay-server/libstream/vj-vloopback.c @@ -144,7 +144,7 @@ static int vj_vloopback_set_format( vj_vloopback_t *v, int dst_w, int dst_h, int return 0; } - v->size = RUP8( format.fmt.pix.sizeimage ); + v->size = format.fmt.pix.sizeimage; struct v4l2_streamparm sfps; veejay_memset(&sfps,0,sizeof(sfps)); diff --git a/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c b/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c index eceb3b35..0b69e903 100644 --- a/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c +++ b/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c @@ -47,7 +47,6 @@ static int unlock(vj_yuv *t) return pthread_mutex_unlock( &(t->mutex )); } -#define RUP8(num)(((num)+8)&~8) vj_yuv *vj_yuv4mpeg_alloc(int w, int h, float fps, int out_pixel_format) { vj_yuv *yuv4mpeg = (vj_yuv *) vj_calloc(sizeof(vj_yuv)); @@ -118,7 +117,7 @@ static int vj_yuv_stream_start_read1(vj_yuv * yuv4mpeg, int fd, int width, int h yuv4mpeg->chroma = y4m_si_get_chroma( &(yuv4mpeg->streaminfo) ); - yuv4mpeg->buf[0] = vj_calloc( sizeof(uint8_t) * RUP8( w * h * 4) ); + yuv4mpeg->buf[0] = vj_calloc( sizeof(uint8_t) * ( w * h * 4) ); yuv4mpeg->buf[1] = yuv4mpeg->buf[0] + (w*h); yuv4mpeg->buf[2] = yuv4mpeg->buf[1] + (w*h); yuv4mpeg->buf[3] = yuv4mpeg->buf[2] + (w*h); diff --git a/veejay-current/veejay-server/libsubsample/subsample.c b/veejay-current/veejay-server/libsubsample/subsample.c index 20d97818..34306c23 100644 --- a/veejay-current/veejay-server/libsubsample/subsample.c +++ b/veejay-current/veejay-server/libsubsample/subsample.c @@ -48,9 +48,6 @@ #include #include -#define RUP8(num)(((num)+8)&~8) - - #define BLANK_CRB in0[1] #define BLANK_CRB_2 (in0[1] << 1) @@ -1266,7 +1263,7 @@ void chroma_supersample(subsample_mode_t mode,VJFrame *frame, uint8_t *ycbcr[] ) if( mode == SSM_420_JPEG_TR ) { - _chroma_supersample_data = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8(frame->width * 2) ); + _chroma_supersample_data = (uint8_t*) vj_calloc( sizeof(uint8_t) * (frame->width * 2) ); } switch (mode) { diff --git a/veejay-current/veejay-server/libvje/effects/alphatransition.c b/veejay-current/veejay-server/libvje/effects/alphatransition.c index 94c6c645..d5f415b2 100644 --- a/veejay-current/veejay-server/libvje/effects/alphatransition.c +++ b/veejay-current/veejay-server/libvje/effects/alphatransition.c @@ -101,7 +101,7 @@ static void alpha_blend_transition( uint8_t *Y, uint8_t *Cb, uint8_t *Cr, uint8_ unsigned int time_index, const unsigned int dur, const int direction, const int threshold ) { uint8_t lookup[256]; - uint8_t AA[ RUP8(w+7) ]; + uint8_t AA[ (w+16) ]; const uint8_t *T = (const uint8_t*) lookup; const uint8_t *aA = a0; diff --git a/veejay-current/veejay-server/libvje/effects/autoeq.c b/veejay-current/veejay-server/libvje/effects/autoeq.c index 6092d4a9..44daa227 100644 --- a/veejay-current/veejay-server/libvje/effects/autoeq.c +++ b/veejay-current/veejay-server/libvje/effects/autoeq.c @@ -64,7 +64,7 @@ void *autoeq_malloc(int w, int h) if(!a) { return NULL; } - a->tmp = (uint8_t*) vj_calloc(sizeof(uint8_t) * RUP8(w*h)); + a->tmp = (uint8_t*) vj_calloc(sizeof(uint8_t) * (w*h)); if(!a->tmp) { free(a); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/average.c b/veejay-current/veejay-server/libvje/effects/average.c index d8f63c9e..44bd9925 100644 --- a/veejay-current/veejay-server/libvje/effects/average.c +++ b/veejay-current/veejay-server/libvje/effects/average.c @@ -61,7 +61,7 @@ void *average_malloc(int width, int height) if(!a) { return NULL; } - a->running_sum[0] = (double*) vj_calloc( sizeof(double) * RUP8(width * height * 3 )); + a->running_sum[0] = (double*) vj_calloc( sizeof(double) * (width * height * 3 )); if(!a->running_sum[0]) { free(a); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/baltantv.c b/veejay-current/veejay-server/libvje/effects/baltantv.c index cbdd8f0d..74abd691 100644 --- a/veejay-current/veejay-server/libvje/effects/baltantv.c +++ b/veejay-current/veejay-server/libvje/effects/baltantv.c @@ -72,26 +72,26 @@ void *baltantv_malloc(int w, int h) return NULL; } - b->planetableY_ = (uint8_t*) vj_calloc( sizeof(uint8_t*) * PLANES * RUP8(w * h)); + b->planetableY_ = (uint8_t*) vj_calloc( sizeof(uint8_t*) * PLANES * (w * h)); if(!b->planetableY_) { free(b); return NULL; } - b->planetableU_ = (int8_t*) vj_malloc( sizeof(int8_t*) * PLANES * RUP8(w * h)); + b->planetableU_ = (int8_t*) vj_malloc( sizeof(int8_t*) * PLANES * (w * h)); if(!b->planetableU_) { free(b->planetableY_); free(b); return NULL; } - b->planetableV_ = (int8_t*) vj_malloc( sizeof(int8_t*) * PLANES * RUP8(w * h)); + b->planetableV_ = (int8_t*) vj_malloc( sizeof(int8_t*) * PLANES * (w * h)); if(!b->planetableV_) { free(b->planetableY_); free(b->planetableU_); return NULL; } - veejay_memset( b->planetableU_, 0, PLANES * RUP8(w*h)); - veejay_memset( b->planetableV_, 0, PLANES * RUP8(w*h)); + veejay_memset( b->planetableU_, 0, PLANES * (w*h)); + veejay_memset( b->planetableV_, 0, PLANES * (w*h)); return (void*) b; } diff --git a/veejay-current/veejay-server/libvje/effects/bathroom.c b/veejay-current/veejay-server/libvje/effects/bathroom.c index 14288323..3fb84781 100644 --- a/veejay-current/veejay-server/libvje/effects/bathroom.c +++ b/veejay-current/veejay-server/libvje/effects/bathroom.c @@ -80,7 +80,7 @@ void *bathroom_malloc(int width, int height) return NULL; } - b->bathroom_frame[0] = (uint8_t*)vj_malloc(sizeof(uint8_t) * RUP8(width*height * 4)); + b->bathroom_frame[0] = (uint8_t*)vj_malloc(sizeof(uint8_t) * (width*height * 4)); if(!b->bathroom_frame[0]) { free(b); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/bgpush.c b/veejay-current/veejay-server/libvje/effects/bgpush.c index 8c0c0c6b..a709e491 100644 --- a/veejay-current/veejay-server/libvje/effects/bgpush.c +++ b/veejay-current/veejay-server/libvje/effects/bgpush.c @@ -50,7 +50,7 @@ void *bgpush_malloc(int w, int h) return NULL; } - b->frame_data = (uint8_t*) vj_malloc( RUP8(w*h*4) ); + b->frame_data = (uint8_t*) vj_malloc( (w*h*4) ); b->frame_ptr[0] = b->frame_data; b->frame_ptr[1] = b->frame_ptr[0] + (w*h); b->frame_ptr[2] = b->frame_ptr[1] + (w*h); diff --git a/veejay-current/veejay-server/libvje/effects/bgsubtract.c b/veejay-current/veejay-server/libvje/effects/bgsubtract.c index 2ab51379..2caceb52 100644 --- a/veejay-current/veejay-server/libvje/effects/bgsubtract.c +++ b/veejay-current/veejay-server/libvje/effects/bgsubtract.c @@ -82,7 +82,7 @@ void *bgsubtract_malloc(int width, int height) return NULL; } - b->static_bg__ = (uint8_t*) vj_malloc( RUP8(width + width*height)*4); + b->static_bg__ = (uint8_t*) vj_malloc( (width + width*height)*4); if(!b->static_bg__) { free(b); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/bgsubtractgauss.c b/veejay-current/veejay-server/libvje/effects/bgsubtractgauss.c index 2c931d9b..0de5c72c 100644 --- a/veejay-current/veejay-server/libvje/effects/bgsubtractgauss.c +++ b/veejay-current/veejay-server/libvje/effects/bgsubtractgauss.c @@ -113,7 +113,7 @@ void *bgsubtractgauss_malloc(int width, int height) return NULL; } - b->static_bg__ = (uint8_t*) vj_malloc( RUP8(width*height*4)); + b->static_bg__ = (uint8_t*) vj_malloc( (width*height*4)); if(!b->static_bg__ ) { free(b); return NULL; @@ -127,14 +127,14 @@ void *bgsubtractgauss_malloc(int width, int height) veejay_memset( b->static_bg_frame__[1], 128, (width*height)); veejay_memset( b->static_bg_frame__[2], 128, (width*height)); - b->fg_frame__ = (uint8_t*) vj_calloc( RUP8(width*height*2) ); + b->fg_frame__ = (uint8_t*) vj_calloc( (width*height*2) ); if(!b->fg_frame__ ) { free(b->static_bg__); free(b); return NULL; } - b->morph_frame__ = (uint8_t*) vj_calloc( RUP8(width*height)); + b->morph_frame__ = (uint8_t*) vj_calloc( (width*height)); if(!b->morph_frame__) { free(b->static_bg__); free(b->fg_frame__); @@ -142,7 +142,7 @@ void *bgsubtractgauss_malloc(int width, int height) return NULL; } - b->pMu = (double*) vj_malloc( RUP8(sizeof(double) * width * height )); + b->pMu = (double*) vj_malloc( (sizeof(double) * width * height )); if(!b->pMu ) { free(b->static_bg__); free(b->fg_frame__); @@ -151,7 +151,7 @@ void *bgsubtractgauss_malloc(int width, int height) return NULL; } - b->pVar = (double*) vj_malloc( RUP8(sizeof(double) * width * height )); + b->pVar = (double*) vj_malloc( (sizeof(double) * width * height )); if( !b->pVar ) { free(b->static_bg__); free(b->fg_frame__); @@ -161,7 +161,7 @@ void *bgsubtractgauss_malloc(int width, int height) return NULL; } - b->mean = (uint8_t*) vj_calloc( RUP8(width*height) ); + b->mean = (uint8_t*) vj_calloc( (width*height) ); if( !b->mean ) { free(b->static_bg__); free(b->fg_frame__); diff --git a/veejay-current/veejay-server/libvje/effects/bloom.c b/veejay-current/veejay-server/libvje/effects/bloom.c index d8d94345..dad76863 100644 --- a/veejay-current/veejay-server/libvje/effects/bloom.c +++ b/veejay-current/veejay-server/libvje/effects/bloom.c @@ -63,7 +63,7 @@ void *bloom_malloc(int width, int height) return NULL; } - b->bloom_buf = (uint8_t*) vj_calloc(sizeof(uint8_t) * RUP8(width * height * 8)); + b->bloom_buf = (uint8_t*) vj_calloc(sizeof(uint8_t) * (width * height * 8)); if(!b->bloom_buf) { free(b); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/chameleon.c b/veejay-current/veejay-server/libvje/effects/chameleon.c index eefb494a..76a0a353 100644 --- a/veejay-current/veejay-server/libvje/effects/chameleon.c +++ b/veejay-current/veejay-server/libvje/effects/chameleon.c @@ -96,8 +96,8 @@ void *chameleon_malloc(int w, int h) return NULL; } - const int len = RUP8(w*h); - const int safe_zone = RUP8(w*2); + const int len = (w*h); + const int safe_zone = (w*2); c->bgimage[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * (len + safe_zone) * 3 ); if(!c->bgimage[0]) { free(c); diff --git a/veejay-current/veejay-server/libvje/effects/chameleonblend.c b/veejay-current/veejay-server/libvje/effects/chameleonblend.c index dfcb7874..bca129d9 100644 --- a/veejay-current/veejay-server/libvje/effects/chameleonblend.c +++ b/veejay-current/veejay-server/libvje/effects/chameleonblend.c @@ -95,8 +95,8 @@ void *chameleonblend_malloc(int w, int h) return NULL; } - const int len = RUP8(w*h); - const int safe_zone = RUP8(w*2); + const int len = (w*h); + const int safe_zone = (w*2); c->bgimage[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * (len + safe_zone) * 3 ); if(!c->bgimage[0]) { free(c); diff --git a/veejay-current/veejay-server/libvje/effects/chromascratcher.c b/veejay-current/veejay-server/libvje/effects/chromascratcher.c index d47a627e..33f69bee 100644 --- a/veejay-current/veejay-server/libvje/effects/chromascratcher.c +++ b/veejay-current/veejay-server/libvje/effects/chromascratcher.c @@ -79,7 +79,7 @@ void *chromascratcher_malloc(int w, int h) return NULL; } - c->cframe[0] = (uint8_t *) vj_malloc( RUP8(w * h * 3) * MAX_SCRATCH_FRAMES * sizeof(uint8_t) ); + c->cframe[0] = (uint8_t *) vj_malloc( w * h * 3 * MAX_SCRATCH_FRAMES * sizeof(uint8_t) ); if(!c->cframe[0]) { free(c); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/colmorphology.c b/veejay-current/veejay-server/libvje/effects/colmorphology.c index 1de8905e..f0b1682b 100644 --- a/veejay-current/veejay-server/libvje/effects/colmorphology.c +++ b/veejay-current/veejay-server/libvje/effects/colmorphology.c @@ -63,7 +63,7 @@ void *colmorphology_malloc(int w, int h ) if(!c) { return NULL; } - c->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h) ); + c->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h) ); if(!c->binary_img) { free(c); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/colorhis.c b/veejay-current/veejay-server/libvje/effects/colorhis.c index 3185c233..243b638b 100644 --- a/veejay-current/veejay-server/libvje/effects/colorhis.c +++ b/veejay-current/veejay-server/libvje/effects/colorhis.c @@ -79,7 +79,7 @@ void *colorhis_malloc(int w, int h) return NULL; } - c->rgb_ = vj_malloc(sizeof(uint8_t) * RUP8(w * h * 3) ); + c->rgb_ = vj_malloc(sizeof(uint8_t) * (w * h * 3) ); if(!c->rgb_) { veejay_histogram_del(c->histogram_); free(c); diff --git a/veejay-current/veejay-server/libvje/effects/common.h b/veejay-current/veejay-server/libvje/effects/common.h index 9df6ea01..cbbc2477 100644 --- a/veejay-current/veejay-server/libvje/effects/common.h +++ b/veejay-current/veejay-server/libvje/effects/common.h @@ -49,8 +49,6 @@ #define ALPHA_IN_A_AND_B_STR "Alpha-IN A and B" #define ALPHA_IN_A_AND_B 4 -#define RUP8(num)(((num)+8)&~8) - #define CLAMP_Y( a ) ( a < pixel_Y_lo_ ? pixel_Y_lo_ : (a > pixel_Y_hi_ ? pixel_Y_hi_ : a ) ) #define CLAMP_UV( a )( a < pixel_U_lo_ ? pixel_U_lo_ : (a > pixel_U_hi_ ? pixel_U_hi_ : a ) ) diff --git a/veejay-current/veejay-server/libvje/effects/complexsync.c b/veejay-current/veejay-server/libvje/effects/complexsync.c index 93459315..fdb5d313 100644 --- a/veejay-current/veejay-server/libvje/effects/complexsync.c +++ b/veejay-current/veejay-server/libvje/effects/complexsync.c @@ -67,7 +67,7 @@ void *complexsync_malloc(int width, int height) return NULL; } - c->c_outofsync_buffer[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(width*height*3) ); + c->c_outofsync_buffer[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * (width*height*3) ); if(!c->c_outofsync_buffer[0]) { free(c); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/contourextract.c b/veejay-current/veejay-server/libvje/effects/contourextract.c index ee533f65..a160c6b7 100644 --- a/veejay-current/veejay-server/libvje/effects/contourextract.c +++ b/veejay-current/veejay-server/libvje/effects/contourextract.c @@ -133,13 +133,13 @@ int contourextract_malloc(void **d, int width, int height) dw_ = nearest_div( width / 8 ); dh_ = nearest_div( height / 8 ); - my->current = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8( dw_ * dh_ * 3 )); - my->bitmap = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8( width * height )); + my->current = (uint8_t*) vj_calloc( sizeof(uint8_t) * ( dw_ * dh_ * 3 )); + my->bitmap = (uint8_t*) vj_calloc( sizeof(uint8_t) * ( width * height )); if(static_bg == NULL) - static_bg = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8( (width * height + (width*2)) ) ); + static_bg = (uint8_t*) vj_calloc( sizeof(uint8_t) * ( (width * height + (width*2)) ) ); if(dt_map == NULL ) - dt_map = (uint32_t*) vj_calloc( sizeof(uint32_t) * RUP8( width * height )); + dt_map = (uint32_t*) vj_calloc( sizeof(uint32_t) * ( width * height )); veejay_memset( &template_, 0, sizeof(sws_template) ); veejay_memset( proj_, 0, sizeof(proj_) ); diff --git a/veejay-current/veejay-server/libvje/effects/crosspixel.c b/veejay-current/veejay-server/libvje/effects/crosspixel.c index 71f9355c..08a59141 100644 --- a/veejay-current/veejay-server/libvje/effects/crosspixel.c +++ b/veejay-current/veejay-server/libvje/effects/crosspixel.c @@ -60,8 +60,8 @@ void *crosspixel_malloc(int w, int h) return NULL; } - const int total_len = RUP8( w * h * 3 ); - const int len = RUP8(w * h); + const int total_len = ( w * h * 3 ); + const int len = (w * h); c->cross_pixels[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * total_len ); if(!c->cross_pixels[0]) { diff --git a/veejay-current/veejay-server/libvje/effects/cutstop.c b/veejay-current/veejay-server/libvje/effects/cutstop.c index f10df123..a743bdab 100644 --- a/veejay-current/veejay-server/libvje/effects/cutstop.c +++ b/veejay-current/veejay-server/libvje/effects/cutstop.c @@ -70,7 +70,7 @@ void *cutstop_malloc(int width, int height) return NULL; } - const int len = RUP8(width*height); + const int len = (width*height); const int total_len = 3 * len; c->vvcutstop_buffer[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * total_len); diff --git a/veejay-current/veejay-server/libvje/effects/dices.c b/veejay-current/veejay-server/libvje/effects/dices.c index 46166b32..1dca8992 100644 --- a/veejay-current/veejay-server/libvje/effects/dices.c +++ b/veejay-current/veejay-server/libvje/effects/dices.c @@ -101,7 +101,7 @@ void *dices_malloc(int width, int height) return NULL; } - d->g_dicemap = (uint8_t *) vj_malloc(sizeof(uint8_t) * RUP8(width * height)); + d->g_dicemap = (uint8_t *) vj_malloc(sizeof(uint8_t) * (width * height)); if(!d->g_dicemap) { free(d); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/diff.c b/veejay-current/veejay-server/libvje/effects/diff.c index c3b3874e..6a3134d9 100644 --- a/veejay-current/veejay-server/libvje/effects/diff.c +++ b/veejay-current/veejay-server/libvje/effects/diff.c @@ -75,18 +75,18 @@ void *diff_malloc(int width, int height) return NULL; } - d->data = (uint8_t*) vj_calloc( RUP8(sizeof(uint8_t) * width * height + width) ); + d->data = (uint8_t*) vj_calloc( (sizeof(uint8_t) * width * height + width) ); if(!d->data) { diff_free(d); return NULL; } - d->static_bg = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8( width * height ) + RUP8(width * 2)); + d->static_bg = (uint8_t*) vj_calloc( sizeof(uint8_t) * ( width * height ) + (width * 2)); if(!d->static_bg) { diff_free(d); return NULL; } - d->dt_map = (uint32_t*) vj_calloc( sizeof(uint32_t) * RUP8(width * height) + RUP8(width * 2)); + d->dt_map = (uint32_t*) vj_calloc( sizeof(uint32_t) * (width * height) + (width * 2)); if(!d->dt_map) { diff_free(d); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/diffmap.c b/veejay-current/veejay-server/libvje/effects/diffmap.c index 1fe52a98..09d4715c 100644 --- a/veejay-current/veejay-server/libvje/effects/diffmap.c +++ b/veejay-current/veejay-server/libvje/effects/diffmap.c @@ -60,7 +60,7 @@ void *differencemap_malloc(int w, int h ) return NULL; } - d->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8( (w*h*2) + (w*2)) ); + d->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * ( (w*h*2) + (w*2)) ); if(!d->binary_img) { free(d); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/distort.c b/veejay-current/veejay-server/libvje/effects/distort.c index f830fe66..92c2120d 100644 --- a/veejay-current/veejay-server/libvje/effects/distort.c +++ b/veejay-current/veejay-server/libvje/effects/distort.c @@ -100,13 +100,13 @@ void *distortion_malloc(int w, int h) return NULL; } - d->plasma_map = (int*) vj_calloc( sizeof(int) * RUP8( w * h ) ); + d->plasma_map = (int*) vj_calloc( sizeof(int) * ( w * h ) ); if(!d->plasma_map) { free(d); return NULL; } - d->plasma_buf[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8( w * h * 3 )); + d->plasma_buf[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * ( w * h * 3 )); if(!d->plasma_buf[0]) { free(d->plasma_map); free(d); diff --git a/veejay-current/veejay-server/libvje/effects/dotillism.c b/veejay-current/veejay-server/libvje/effects/dotillism.c index 1db873db..b85c4dde 100644 --- a/veejay-current/veejay-server/libvje/effects/dotillism.c +++ b/veejay-current/veejay-server/libvje/effects/dotillism.c @@ -76,7 +76,7 @@ void *dotillism_malloc(int w, int h) if(!d) { return NULL; } - d->map = (uint8_t*) vj_malloc( RUP8(w*h) ); + d->map = (uint8_t*) vj_malloc( w*h ); if(!d->map) { free(d->map); free(d); diff --git a/veejay-current/veejay-server/libvje/effects/feathermask.c b/veejay-current/veejay-server/libvje/effects/feathermask.c index 0db1542c..9eebfd2c 100644 --- a/veejay-current/veejay-server/libvje/effects/feathermask.c +++ b/veejay-current/veejay-server/libvje/effects/feathermask.c @@ -45,7 +45,7 @@ void *feathermask_malloc(int width, int height) if(!f) { return NULL; } - f->mask = (uint8_t*)vj_malloc(sizeof(uint8_t) * RUP8(width*height)); + f->mask = (uint8_t*)vj_malloc(sizeof(uint8_t) * (width*height)); if(!f->mask) { free(f); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/fisheye.c b/veejay-current/veejay-server/libvje/effects/fisheye.c index a47fd3ac..11bfb1a0 100644 --- a/veejay-current/veejay-server/libvje/effects/fisheye.c +++ b/veejay-current/veejay-server/libvje/effects/fisheye.c @@ -65,7 +65,7 @@ void *fisheye_malloc(int w, int h) return NULL; } - f->buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h * 3 ) ); + f->buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h * 3 ) ); if(!f->buf[0]) { fisheye_free(f); return NULL; @@ -74,19 +74,19 @@ void *fisheye_malloc(int w, int h) f->buf[1] = f->buf[0] + (w*h); f->buf[2] = f->buf[1] + (w*h); - f->polar_map = (double*) vj_calloc(sizeof(double) * RUP8(w* h) ); + f->polar_map = (double*) vj_calloc(sizeof(double) * (w * h) ); if(!f->polar_map) { fisheye_free(f); return NULL; } - f->fish_angle = (double*) vj_calloc(sizeof(double) * RUP8(w* h) ); + f->fish_angle = (double*) vj_calloc(sizeof(double) * (w * h) ); if(!f->fish_angle) { fisheye_free(f); return NULL; } - f->cached_coords = (int*) vj_calloc(sizeof(int) * RUP8( w * h)); + f->cached_coords = (int*) vj_calloc(sizeof(int) * ( w * h)); if(!f->cached_coords) { fisheye_free(f); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/flare.c b/veejay-current/veejay-server/libvje/effects/flare.c index f2fd3938..812800af 100644 --- a/veejay-current/veejay-server/libvje/effects/flare.c +++ b/veejay-current/veejay-server/libvje/effects/flare.c @@ -68,7 +68,7 @@ void *flare_malloc(int w, int h) return NULL; } - const int len = RUP8(w*h); + const int len = w*h; const int total_len = len * 3; f->flare_buf[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * total_len ); diff --git a/veejay-current/veejay-server/libvje/effects/gaussblur.c b/veejay-current/veejay-server/libvje/effects/gaussblur.c index 6fd1fde2..e81c3c98 100644 --- a/veejay-current/veejay-server/libvje/effects/gaussblur.c +++ b/veejay-current/veejay-server/libvje/effects/gaussblur.c @@ -118,7 +118,7 @@ void *gaussblur_malloc(int w, int h) return NULL; } - g->temp = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w*h)); + g->temp = (uint8_t*) vj_malloc( sizeof(uint8_t) * (w*h)); if(!g->temp) { free(g->gaussfilter); free(g); diff --git a/veejay-current/veejay-server/libvje/effects/ghost.c b/veejay-current/veejay-server/libvje/effects/ghost.c index c81d1d80..3d1fe283 100644 --- a/veejay-current/veejay-server/libvje/effects/ghost.c +++ b/veejay-current/veejay-server/libvje/effects/ghost.c @@ -53,8 +53,8 @@ void *ghost_malloc(int w, int h) return NULL; } - const int len = RUP8(w * h); - const int total_len = RUP8(len * 4); + const int len = (w * h); + const int total_len = (len * 4); g->ghost_buf[0] = vj_malloc( sizeof(uint8_t) * total_len); if(!g->ghost_buf[0]) { diff --git a/veejay-current/veejay-server/libvje/effects/lumamask.c b/veejay-current/veejay-server/libvje/effects/lumamask.c index 671e27e2..9184c342 100644 --- a/veejay-current/veejay-server/libvje/effects/lumamask.c +++ b/veejay-current/veejay-server/libvje/effects/lumamask.c @@ -84,7 +84,7 @@ void *lumamask_malloc(int width, int height) return NULL; } - l->buf[0] = (uint8_t*)vj_malloc( sizeof(uint8_t) * RUP8( width * height * 4) ); + l->buf[0] = (uint8_t*)vj_malloc( sizeof(uint8_t) * ( width * height * 4) ); if(!l->buf[0]) { free(l); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/magicmirror.c b/veejay-current/veejay-server/libvje/effects/magicmirror.c index 66c8c147..65960f61 100644 --- a/veejay-current/veejay-server/libvje/effects/magicmirror.c +++ b/veejay-current/veejay-server/libvje/effects/magicmirror.c @@ -85,7 +85,7 @@ void *magicmirror_malloc(int w, int h) return NULL; } - m->magicmirrorbuf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t)*RUP8(w*h*4)); + m->magicmirrorbuf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t)*(w*h*4)); if(!m->magicmirrorbuf[0]) { free(m); return NULL; @@ -95,6 +95,11 @@ void *magicmirror_malloc(int w, int h) m->magicmirrorbuf[2] = m->magicmirrorbuf[1] + (w*h); m->magicmirrorbuf[3] = m->magicmirrorbuf[2] + (w*h); + m->magicmirrorbuf[1][0] = 128; + m->magicmirrorbuf[2][0] = 128; + m->magicmirrorbuf[1][w] = 128; + m->magicmirrorbuf[2][w] = 128; + m->funhouse_x = (double*)vj_calloc(sizeof(double) * w ); if(!m->funhouse_x) { free(m->magicmirrorbuf[0]); diff --git a/veejay-current/veejay-server/libvje/effects/magicscratcher.c b/veejay-current/veejay-server/libvje/effects/magicscratcher.c index fd745b2e..16d198dc 100644 --- a/veejay-current/veejay-server/libvje/effects/magicscratcher.c +++ b/veejay-current/veejay-server/libvje/effects/magicscratcher.c @@ -75,7 +75,7 @@ void *magicscratcher_malloc(int w, int h) return NULL; } - m->mframe = (uint8_t *) vj_calloc( RUP8(w * h) * sizeof(uint8_t) * MAX_SCRATCH_FRAMES); + m->mframe = (uint8_t *) vj_calloc( (w * h) * sizeof(uint8_t) * MAX_SCRATCH_FRAMES); if(!m->mframe) { free(m); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/maskstop.c b/veejay-current/veejay-server/libvje/effects/maskstop.c index 24723a2e..9bafd542 100644 --- a/veejay-current/veejay-server/libvje/effects/maskstop.c +++ b/veejay-current/veejay-server/libvje/effects/maskstop.c @@ -73,7 +73,7 @@ void *maskstop_malloc(int width, int height) } int i; - v->vvmaskstop_buffer[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(width * height) * 6 ); + v->vvmaskstop_buffer[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * width * height * 6); if(!v->vvmaskstop_buffer[0]) { free(v); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/masktransition.c b/veejay-current/veejay-server/libvje/effects/masktransition.c index ef7d570d..f66681c6 100644 --- a/veejay-current/veejay-server/libvje/effects/masktransition.c +++ b/veejay-current/veejay-server/libvje/effects/masktransition.c @@ -89,7 +89,7 @@ static void alpha_blend_transition( uint8_t *Y, uint8_t *Cb, uint8_t *Cr, uint8_ lookup[i] = 0xff * ( (double) (time_index - i ) / dur ); } - uint8_t AA[ RUP8(w) ]; + uint8_t AA[ w + 16 ]; for( i = 0; i < len; i += w ) { diff --git a/veejay-current/veejay-server/libvje/effects/meanfilter.c b/veejay-current/veejay-server/libvje/effects/meanfilter.c index e8042dd8..92c10000 100644 --- a/veejay-current/veejay-server/libvje/effects/meanfilter.c +++ b/veejay-current/veejay-server/libvje/effects/meanfilter.c @@ -39,7 +39,7 @@ vj_effect *meanfilter_init(int w, int h) int meanfilter_malloc(int w, int h) { if( mean == NULL ) { - mean = (uint8_t*) vj_calloc( RUP8(w*h) ); + mean = (uint8_t*) vj_calloc( (w*h) ); if( mean == NULL ) return 0; } diff --git a/veejay-current/veejay-server/libvje/effects/median.c b/veejay-current/veejay-server/libvje/effects/median.c index 73e719e1..6108cfbb 100644 --- a/veejay-current/veejay-server/libvje/effects/median.c +++ b/veejay-current/veejay-server/libvje/effects/median.c @@ -70,7 +70,7 @@ void *medianfilter_malloc(int w, int h) if(!m) { return NULL; } - m->buffer[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w * h * 3)); + m->buffer[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * (w * h * 3)); if(!m->buffer[0]) { free(m); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/morphology.c b/veejay-current/veejay-server/libvje/effects/morphology.c index 53c04bb6..59569907 100644 --- a/veejay-current/veejay-server/libvje/effects/morphology.c +++ b/veejay-current/veejay-server/libvje/effects/morphology.c @@ -98,7 +98,7 @@ void *morphology_malloc(int w, int h ) return NULL; } - m->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8( w * h) ); + m->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * ( w * h) ); if(!m->binary_img) { free(m); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/motionblur.c b/veejay-current/veejay-server/libvje/effects/motionblur.c index 564eccd7..a3024daf 100644 --- a/veejay-current/veejay-server/libvje/effects/motionblur.c +++ b/veejay-current/veejay-server/libvje/effects/motionblur.c @@ -53,7 +53,7 @@ void *motionblur_malloc(int width, int height) if(!m) { return NULL; } - m->previous_frame[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(width * height *3)); + m->previous_frame[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (width * height *3)); if(!m->previous_frame[0]) { free(m); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/motionmap.c b/veejay-current/veejay-server/libvje/effects/motionmap.c index 409606ee..4087db90 100644 --- a/veejay-current/veejay-server/libvje/effects/motionmap.c +++ b/veejay-current/veejay-server/libvje/effects/motionmap.c @@ -111,20 +111,20 @@ void *motionmap_malloc(int w, int h ) return NULL; } - mm->bg_image = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w * h)); + mm->bg_image = (uint8_t*) vj_malloc( sizeof(uint8_t) * (w * h)); if(!mm->bg_image) { free(mm); return NULL; } - mm->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h)); + mm->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h)); if(!mm->binary_img) { free(mm->bg_image); free(mm); return NULL; } - mm->prev_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w*h)); + mm->prev_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w*h)); if(!mm->prev_img) { free(mm->bg_image); free(mm->binary_img); @@ -132,7 +132,7 @@ void *motionmap_malloc(int w, int h ) return NULL; } - mm->interpolate_buf = vj_malloc( sizeof(uint8_t) * RUP8(w*h*3)); + mm->interpolate_buf = vj_malloc( sizeof(uint8_t) * (w*h*3)); if(!mm->interpolate_buf) { free(mm->bg_image); free(mm->binary_img); @@ -140,7 +140,7 @@ void *motionmap_malloc(int w, int h ) free(mm); return NULL; } - mm->diff_img = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w*h*2)); + mm->diff_img = (uint8_t*) vj_malloc( sizeof(uint8_t) * (w*h*2)); if(!mm->diff_img) { free(mm->bg_image); free(mm->binary_img); diff --git a/veejay-current/veejay-server/libvje/effects/mtracer.c b/veejay-current/veejay-server/libvje/effects/mtracer.c index 5f691518..01d18d8f 100644 --- a/veejay-current/veejay-server/libvje/effects/mtracer.c +++ b/veejay-current/veejay-server/libvje/effects/mtracer.c @@ -73,7 +73,7 @@ void *mtracer_malloc(int w, int h) return NULL; } - size_t buflen = RUP8( (w*h+w)) * sizeof(uint8_t); + size_t buflen = ( (w*h+w)) * sizeof(uint8_t); m->mtrace_buffer[0] = (uint8_t*) vj_malloc( buflen ); if(!m->mtrace_buffer[0]) { free(m); diff --git a/veejay-current/veejay-server/libvje/effects/negation.c b/veejay-current/veejay-server/libvje/effects/negation.c index 59fab2a1..f240e7cd 100644 --- a/veejay-current/veejay-server/libvje/effects/negation.c +++ b/veejay-current/veejay-server/libvje/effects/negation.c @@ -37,7 +37,7 @@ vj_effect *negation_init(int w, int h) ve->sub_format = -1; ve->extra_frame = 0; ve->parallel = 1; - ve->has_user = 0; + ve->has_user = 0; ve->param_description = vje_build_param_list( ve->num_params, "Value" ); return ve; } @@ -61,5 +61,5 @@ void negation_apply( void *ptr, VJFrame *frame, int *args ) { for( i = 0; i < uv_len; i ++ ) { Cb[i] = val - Cb[i]; Cr[i] = val - Cr[i]; - } + } } diff --git a/veejay-current/veejay-server/libvje/effects/neighbours.c b/veejay-current/veejay-server/libvje/effects/neighbours.c index 5afb3a12..50e505e7 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours.c @@ -70,7 +70,7 @@ void *neighbours_malloc(int w, int h ) return NULL; } - n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h * 2)); + n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h * 2)); if(!n->tmp_buf[0]) { free(n); return NULL; @@ -78,7 +78,7 @@ void *neighbours_malloc(int w, int h ) n->tmp_buf[1] = n->tmp_buf[0] + (w*h); - n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h *2)); + n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h *2)); if(!n->chromacity[0]) { free(n->tmp_buf[0]); free(n); diff --git a/veejay-current/veejay-server/libvje/effects/neighbours2.c b/veejay-current/veejay-server/libvje/effects/neighbours2.c index 33ac09c0..73a668d7 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours2.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours2.c @@ -68,14 +68,14 @@ void *neighbours2_malloc(int w, int h ) return NULL; } - n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h * 2)); + n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h * 2)); if(!n->tmp_buf[0] ) { free(n); return NULL; } n->tmp_buf[1] = n->tmp_buf[0] + (w*h); - n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h *2)); + n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h *2)); if(!n->chromacity[0]) { free(n->tmp_buf[0]); free(n); diff --git a/veejay-current/veejay-server/libvje/effects/neighbours3.c b/veejay-current/veejay-server/libvje/effects/neighbours3.c index 767fc072..a4eaacf8 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours3.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours3.c @@ -68,7 +68,7 @@ void *neighbours3_malloc(int w, int h ) return NULL; } - n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h * 2)); + n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h * 2)); if(!n->tmp_buf[0] ) { free(n); return NULL; @@ -76,7 +76,7 @@ void *neighbours3_malloc(int w, int h ) n->tmp_buf[1] = n->tmp_buf[0] + (w*h); - n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h *2)); + n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h *2)); if(!n->chromacity[0]) { free(n->tmp_buf[0]); free(n); diff --git a/veejay-current/veejay-server/libvje/effects/neighbours4.c b/veejay-current/veejay-server/libvje/effects/neighbours4.c index 8b5be6ae..8e95377e 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours4.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours4.c @@ -85,7 +85,7 @@ void *neighbours4_malloc(int w, int h ) return NULL; } - n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h * 2)); + n->tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h * 2)); if(!n->tmp_buf[0] ) { free(n); return NULL; @@ -93,7 +93,7 @@ void *neighbours4_malloc(int w, int h ) n->tmp_buf[1] = n->tmp_buf[0] + (w*h); - n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h *2)); + n->chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h *2)); if(!n->chromacity[0]) { free(n->tmp_buf[0]); free(n); diff --git a/veejay-current/veejay-server/libvje/effects/nervous.c b/veejay-current/veejay-server/libvje/effects/nervous.c index fc6240a4..2ba919cf 100644 --- a/veejay-current/veejay-server/libvje/effects/nervous.c +++ b/veejay-current/veejay-server/libvje/effects/nervous.c @@ -62,7 +62,7 @@ void *nervous_malloc(int w, int h ) return NULL; } - size_t total_len = RUP8(w * h * N_MAX * 4); + size_t total_len = (w * h * N_MAX * 4); n->nervous_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * total_len); if(!n->nervous_buf[0]) { free(n); diff --git a/veejay-current/veejay-server/libvje/effects/noiseadd.c b/veejay-current/veejay-server/libvje/effects/noiseadd.c index c66bf437..0c71ef18 100644 --- a/veejay-current/veejay-server/libvje/effects/noiseadd.c +++ b/veejay-current/veejay-server/libvje/effects/noiseadd.c @@ -60,7 +60,7 @@ void *noiseadd_malloc(int width, int height) if(!n) { return NULL; } - n->Yb_frame = (uint8_t *) vj_calloc( sizeof(uint8_t) * RUP8(width * height)); + n->Yb_frame = (uint8_t *) vj_calloc( sizeof(uint8_t) * (width * height)); if(!n->Yb_frame) { free(n); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/noisepencil.c b/veejay-current/veejay-server/libvje/effects/noisepencil.c index 75178685..2f332229 100644 --- a/veejay-current/veejay-server/libvje/effects/noisepencil.c +++ b/veejay-current/veejay-server/libvje/effects/noisepencil.c @@ -68,7 +68,7 @@ void *noisepencil_malloc(int width,int height) return NULL; } - n->Yb_frame = (uint8_t *) vj_calloc( sizeof(uint8_t) * RUP8(width * height)); + n->Yb_frame = (uint8_t *) vj_calloc( sizeof(uint8_t) * (width * height)); if(!n->Yb_frame) { free(n); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/pencilsketch2.c b/veejay-current/veejay-server/libvje/effects/pencilsketch2.c index c61a8eb3..30090e88 100644 --- a/veejay-current/veejay-server/libvje/effects/pencilsketch2.c +++ b/veejay-current/veejay-server/libvje/effects/pencilsketch2.c @@ -92,7 +92,7 @@ void *pencilsketch2_malloc(int w, int h) { return NULL; } - p->pencilbuf = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w*h*3) ); + p->pencilbuf = (uint8_t*) vj_malloc( sizeof(uint8_t) * (w*h*3) ); if(!p->pencilbuf) { free(p); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/perspective.c b/veejay-current/veejay-server/libvje/effects/perspective.c index bdb857e2..4ab0a409 100644 --- a/veejay-current/veejay-server/libvje/effects/perspective.c +++ b/veejay-current/veejay-server/libvje/effects/perspective.c @@ -78,7 +78,7 @@ void *perspective_malloc(int width, int height) return NULL; } - p->perspective_private_[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8((width*height+width)*3)); + p->perspective_private_[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * ((width*height+width)*3)); if(!p->perspective_private_[0]) { free(p); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/picinpic.c b/veejay-current/veejay-server/libvje/effects/picinpic.c index 2ffd2c36..5b61e37a 100644 --- a/veejay-current/veejay-server/libvje/effects/picinpic.c +++ b/veejay-current/veejay-server/libvje/effects/picinpic.c @@ -151,9 +151,9 @@ void picinpic_apply( void *ptr, VJFrame *frame, VJFrame *frame2, int *args ) { if( picture->frame == NULL ) { picture->frame = yuv_yuv_template( NULL,NULL,NULL ,view_width,view_height,pixfmt ); // needs seperately allocated planes - picture->frame->data[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8( view_width * view_height )); - picture->frame->data[1] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8( view_width * view_height )); - picture->frame->data[2] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8( view_width * view_height )); + picture->frame->data[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * ( view_width * view_height )); + picture->frame->data[1] = (uint8_t*) vj_malloc(sizeof(uint8_t) * ( view_width * view_height )); + picture->frame->data[2] = (uint8_t*) vj_malloc(sizeof(uint8_t) * ( view_width * view_height )); } if( picture->scaler == NULL ) { diff --git a/veejay-current/veejay-server/libvje/effects/pixelsort.c b/veejay-current/veejay-server/libvje/effects/pixelsort.c index 3e13bd4b..a40216b9 100644 --- a/veejay-current/veejay-server/libvje/effects/pixelsort.c +++ b/veejay-current/veejay-server/libvje/effects/pixelsort.c @@ -69,7 +69,7 @@ void *pixelsort_malloc(int w, int h){ if(!p) { return NULL; } - p->mask = (uint8_t*) vj_calloc(sizeof(uint8_t) * RUP8(w + w * h) ); + p->mask = (uint8_t*) vj_calloc(sizeof(uint8_t) * (w + w * h) ); if(!p->mask) { free(p); diff --git a/veejay-current/veejay-server/libvje/effects/radcor.c b/veejay-current/veejay-server/libvje/effects/radcor.c index bd619613..298dbf77 100644 --- a/veejay-current/veejay-server/libvje/effects/radcor.c +++ b/veejay-current/veejay-server/libvje/effects/radcor.c @@ -71,8 +71,8 @@ void *radcor_malloc( int w, int h ) return NULL; } - const int len = RUP8(w * h); - const int total_len = RUP8(len * 4); + const int len = (w * h); + const int total_len = (len * 4); r->badbuf = (uint8_t*) vj_malloc( sizeof(uint8_t) * total_len ); if(!r->badbuf) { diff --git a/veejay-current/veejay-server/libvje/effects/radialblur.c b/veejay-current/veejay-server/libvje/effects/radialblur.c index 295f90d4..10179c04 100644 --- a/veejay-current/veejay-server/libvje/effects/radialblur.c +++ b/veejay-current/veejay-server/libvje/effects/radialblur.c @@ -82,7 +82,7 @@ void *radialblur_malloc(int w, int h) return NULL; } - r->radial_src[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w*h*3)); + r->radial_src[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * (w*h*3)); if(!r->radial_src[0]) { free(r); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/radioactive.c b/veejay-current/veejay-server/libvje/effects/radioactive.c index 3928a5f9..1a9ddcef 100644 --- a/veejay-current/veejay-server/libvje/effects/radioactive.c +++ b/veejay-current/veejay-server/libvje/effects/radioactive.c @@ -204,25 +204,25 @@ void *radioactivetv_malloc(int w, int h) r->buf_margin_left = (w - r->buf_width ) >> 1; r->buf_margin_right = (w - r->buf_width - r->buf_margin_left); - r->blurzoombuf = (uint8_t*) vj_calloc( RUP8(r->buf_area * 2 )); + r->blurzoombuf = (uint8_t*) vj_calloc( (r->buf_area * 2 )); if(!r->blurzoombuf) { radioactivetv_free(r); return NULL; } - r->blurzoomx = (int*) vj_calloc( RUP8(r->buf_width * sizeof(int))); + r->blurzoomx = (int*) vj_calloc( (r->buf_width * sizeof(int))); if(!r->blurzoomx) { radioactivetv_free(r); return NULL; } - r->blurzoomy = (int*) vj_calloc( RUP8(r->buf_width * sizeof(int))); + r->blurzoomy = (int*) vj_calloc( (r->buf_width * sizeof(int))); if(!r->blurzoomy) { radioactivetv_free(r); return NULL; } - r->diffbuf = (uint8_t*) vj_calloc( RUP8((4*w) + 2 * w * h * sizeof(uint8_t))); + r->diffbuf = (uint8_t*) vj_calloc( ((4*w) + 2 * w * h * sizeof(uint8_t))); if(!r->diffbuf) { radioactivetv_free(r); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/reflection.c b/veejay-current/veejay-server/libvje/effects/reflection.c index cdab6d21..82fae252 100644 --- a/veejay-current/veejay-server/libvje/effects/reflection.c +++ b/veejay-current/veejay-server/libvje/effects/reflection.c @@ -84,7 +84,7 @@ void *reflection_malloc(int width, int height) return NULL; } - r->reflection_buffer = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(width)); + r->reflection_buffer = (uint8_t*) vj_malloc( sizeof(uint8_t) * (width)); if(!r->reflection_buffer) { free(r); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/ripple.c b/veejay-current/veejay-server/libvje/effects/ripple.c index d88e5bc2..8bfffac1 100644 --- a/veejay-current/veejay-server/libvje/effects/ripple.c +++ b/veejay-current/veejay-server/libvje/effects/ripple.c @@ -78,25 +78,25 @@ void *ripple_malloc(int width, int height) } - r->ripple_table = (double*) vj_malloc(sizeof(double) * (RUP8(width * height) + width) ); + r->ripple_table = (double*) vj_malloc(sizeof(double) * ((width * height) + width) ); if(!r->ripple_table) { free(r); return NULL; } - r->ripple_data[0] = (uint8_t*)vj_malloc( sizeof(uint8_t) * 3 * ( RUP8(width * height) + width) ); + r->ripple_data[0] = (uint8_t*)vj_malloc( sizeof(uint8_t) * 3 * ( (width * height) + width) ); if(!r->ripple_data[0]) { free(r->ripple_table); free(r); return NULL; } - r->ripple_data[1] = r->ripple_data[0] +(RUP8(width*height) + width); - r->ripple_data[2] = r->ripple_data[1] +(RUP8(width*height) + width); + r->ripple_data[1] = r->ripple_data[0] +((width*height) + width); + r->ripple_data[2] = r->ripple_data[1] +((width*height) + width); - veejay_memset( r->ripple_data[1], 128, RUP8(width * height) + width ); - veejay_memset( r->ripple_data[2], 128, RUP8(width * height) + width ); - veejay_memset( r->ripple_data[0], pixel_Y_lo_, RUP8(width*height) + width); + veejay_memset( r->ripple_data[1], 128, (width * height) + width ); + veejay_memset( r->ripple_data[2], 128, (width * height) + width ); + veejay_memset( r->ripple_data[0], pixel_Y_lo_, (width*height) + width); r->ripple_sin = (double*) vj_malloc(sizeof(double) * RIPPLE_DEGREES); if(!r->ripple_sin) { diff --git a/veejay-current/veejay-server/libvje/effects/rotozoom.c b/veejay-current/veejay-server/libvje/effects/rotozoom.c index 894f9c6d..7d45ad29 100644 --- a/veejay-current/veejay-server/libvje/effects/rotozoom.c +++ b/veejay-current/veejay-server/libvje/effects/rotozoom.c @@ -75,7 +75,7 @@ void *rotozoom_malloc(int width, int height) return NULL; } - r->rotobuffer[0] = (uint8_t *) vj_calloc(sizeof(uint8_t) * RUP8(width * height * 3)); + r->rotobuffer[0] = (uint8_t *) vj_calloc(sizeof(uint8_t) * (width * height * 3)); if(!r->rotobuffer[0]) { free(r); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/scratcher.c b/veejay-current/veejay-server/libvje/effects/scratcher.c index e5187cba..eb8f321d 100644 --- a/veejay-current/veejay-server/libvje/effects/scratcher.c +++ b/veejay-current/veejay-server/libvje/effects/scratcher.c @@ -74,7 +74,7 @@ void *scratcher_malloc(int w, int h) s->last_n = 8; /* need memory for bounce mode ... */ - s->frame[0] = (uint8_t *) vj_malloc( RUP8(w * h * 3) * sizeof(uint8_t) * MAX_SCRATCH_FRAMES); + s->frame[0] = (uint8_t *) vj_malloc( (w * h * 3) * sizeof(uint8_t) * MAX_SCRATCH_FRAMES); if(!s->frame[0]) { free(s); return NULL; @@ -83,9 +83,9 @@ void *scratcher_malloc(int w, int h) veejay_memset( s->frame[0], pixel_Y_lo_, w * h * MAX_SCRATCH_FRAMES ); s->frame[1] = - s->frame[0] + ( RUP8(w * h) * MAX_SCRATCH_FRAMES ); + s->frame[0] + ( (w * h) * MAX_SCRATCH_FRAMES ); s->frame[2] = - s->frame[1] + ( RUP8(w * h) * MAX_SCRATCH_FRAMES ); + s->frame[1] + ( (w * h) * MAX_SCRATCH_FRAMES ); veejay_memset( s->frame[1], 128, (w * h * MAX_SCRATCH_FRAMES) ); veejay_memset( s->frame[2], 128, (w * h * MAX_SCRATCH_FRAMES) ); diff --git a/veejay-current/veejay-server/libvje/effects/sinoids.c b/veejay-current/veejay-server/libvje/effects/sinoids.c index 5364d218..d9622206 100644 --- a/veejay-current/veejay-server/libvje/effects/sinoids.c +++ b/veejay-current/veejay-server/libvje/effects/sinoids.c @@ -76,7 +76,7 @@ void *sinoids_malloc(int width, int height) } - s->sinoid_frame[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(width*height*3)); + s->sinoid_frame[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * (width*height*3)); if(!s->sinoid_frame[0]) { free(s->sinoids_X); free(s); diff --git a/veejay-current/veejay-server/libvje/effects/slice.c b/veejay-current/veejay-server/libvje/effects/slice.c index d57cdd22..4e10d024 100644 --- a/veejay-current/veejay-server/libvje/effects/slice.c +++ b/veejay-current/veejay-server/libvje/effects/slice.c @@ -65,7 +65,7 @@ void *slice_malloc(int width, int height) if(!s) { return NULL; } - s->slice_frame[0] = (uint8_t*)vj_malloc( sizeof(uint8_t) * RUP8(width * height * 4)); + s->slice_frame[0] = (uint8_t*)vj_malloc( sizeof(uint8_t) * (width * height * 4)); if(!s->slice_frame[0]) { free(s); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/split.c b/veejay-current/veejay-server/libvje/effects/split.c index 0266c5df..42361c0a 100644 --- a/veejay-current/veejay-server/libvje/effects/split.c +++ b/veejay-current/veejay-server/libvje/effects/split.c @@ -39,8 +39,8 @@ vj_effect *split_init(int width,int height) ve->description = "Splitted Screens"; ve->sub_format = 0; ve->extra_frame = 1; - ve->has_user = 0; - ve->param_description = vje_build_param_list(ve->num_params, "Mode", "Switch"); + ve->has_user = 0; + ve->param_description = vje_build_param_list(ve->num_params, "Mode", "Switch"); return ve; } @@ -55,7 +55,7 @@ void *split_malloc(int width, int height) if(!s) { return NULL; } - s->split_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8( width + (width*height*3) )); + s->split_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * ( width + (width*height*3) )); if(!s->split_buf[0]) { free(s); return NULL; @@ -544,74 +544,4 @@ void split_apply(void *ptr, VJFrame *frame, VJFrame *frame2, int *args ) { int n = args[0]; int swap = args[1]; - - switch (n) { - case 0: - if (swap) - split_push_downscale_uh(ptr, frame2, frame->width, frame->height); - split_h_first_half(frame, frame2, frame->width, frame->height); - break; - case 1: - split_h_second_half(frame, frame2, frame->width, frame->height); - break; - case 2: - /**/ split_h_first_halfs(frame, frame2, frame->width, frame->height); - break; - case 3: - if (swap) - split_push_downscale_uh(ptr, frame2, frame->width, frame->height); - /**/ split_h_second_halfs(frame, frame2, frame->width, frame->height); - break; - case 4: - if (swap) - split_push_vscale_left(ptr,frame2, frame->width, frame->height); - /**/ split_v_first_half(frame, frame2, frame->width, frame->height); - break; - case 5: - if (swap) - split_push_vscale_right(ptr, frame2, frame->width, frame->height); - /**/ split_v_second_half(frame, frame2, frame->width, frame->height); - break; - case 6: - if (swap) - split_push_vscale_left(ptr,frame2, frame->width, frame->height); - /**/ split_v_first_halfs(frame, frame2, frame->width, frame->height); - break; - - case 7: - if (swap) - split_push_vscale_right(ptr, frame2, frame->width, frame->height); - split_v_second_halfs(frame, frame2, frame->width, frame->height); - break; - case 8: - if (swap) - split_fib_downscale(frame2, frame->width, frame->height); - split_corner_framedata_ul(frame, frame2, frame->width, frame->height); - break; - case 9: - if (swap) - split_fib_downscale(frame2, frame->width, frame->height); - split_corner_framedata_ur(frame, frame2, frame->width, frame->height); - break; - case 10: - if (swap) - split_fib_downscaleb(frame2, frame->width, frame->height); - split_corner_framedata_dr(frame, frame2, frame->width, frame->height); - break; - case 11: - if (swap) - split_fib_downscaleb(frame2, frame->width, frame->height); - /**/ split_corner_framedata_dl(frame, frame2, frame->width, frame->height); - break; - case 12: - split_push_vscale_left(ptr, frame2, frame->width, frame->height); - /**/ split_push_vscale_right(ptr, frame, frame->width, frame->height); - split_v_first_half(frame, frame2, frame->width, frame->height); - break; - case 13: - split_push_downscale_uh(ptr, frame2, frame->width, frame->height); - split_h_first_half(frame, frame2, frame->width, frame->height); - break; - } - } diff --git a/veejay-current/veejay-server/libvje/effects/swirl.c b/veejay-current/veejay-server/libvje/effects/swirl.c index 2b368936..409583dc 100644 --- a/veejay-current/veejay-server/libvje/effects/swirl.c +++ b/veejay-current/veejay-server/libvje/effects/swirl.c @@ -61,7 +61,7 @@ void *swirl_malloc(int w, int h) if(!s) { return NULL; } - s->buf[0] = vj_malloc( sizeof(uint8_t) * RUP8(w*h*3)); + s->buf[0] = vj_malloc( sizeof(uint8_t) * (w*h*3)); if(!s->buf[0]) { swirl_free(s); return NULL; @@ -69,19 +69,19 @@ void *swirl_malloc(int w, int h) s->buf[1] = s->buf[0] + (w*h); s->buf[2] = s->buf[1] + (w*h); - s->polar_map = (double*) vj_calloc(sizeof(double) * RUP8(w * h) ); + s->polar_map = (double*) vj_calloc(sizeof(double) * (w * h) ); if(!s->polar_map) { swirl_free(s); return NULL; } - s->fish_angle = (double*) vj_calloc(sizeof(double) * RUP8(w * h) ); + s->fish_angle = (double*) vj_calloc(sizeof(double) * (w * h) ); if(!s->fish_angle) { swirl_free(s); return NULL; } - s->cached_coords = (int*) vj_calloc(sizeof(int) * RUP8(w * h) ); + s->cached_coords = (int*) vj_calloc(sizeof(int) * (w * h) ); if(!s->cached_coords) { swirl_free(s); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/threshold.c b/veejay-current/veejay-server/libvje/effects/threshold.c index 2dccd51d..da1712c3 100644 --- a/veejay-current/veejay-server/libvje/effects/threshold.c +++ b/veejay-current/veejay-server/libvje/effects/threshold.c @@ -59,7 +59,7 @@ void *threshold_malloc(int w, int h ) if(!t) { return NULL; } - t->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h) ); + t->binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * (w * h) ); if(!t->binary_img) { free(t); return NULL; diff --git a/veejay-current/veejay-server/libvje/effects/timedistort.c b/veejay-current/veejay-server/libvje/effects/timedistort.c index 99135eeb..58fe1ad1 100644 --- a/veejay-current/veejay-server/libvje/effects/timedistort.c +++ b/veejay-current/veejay-server/libvje/effects/timedistort.c @@ -78,13 +78,13 @@ void *timedistort_malloc( int w, int h ) return NULL; } - td->nonmap = vj_calloc( (RUP8(2 * w * h + (2 * w))) * sizeof(uint8_t)); + td->nonmap = vj_calloc( ((2 * w * h + (2 * w))) * sizeof(uint8_t)); if(!td->nonmap) { free(td); return NULL; } - td->planes[0] = vj_malloc( RUP8(PLANES * 3 * w * h) * sizeof(uint8_t)); + td->planes[0] = vj_malloc( (PLANES * 3 * w * h) * sizeof(uint8_t)); if(!td->planes[0]) { free(td->nonmap); free(td); @@ -108,14 +108,14 @@ void *timedistort_malloc( int w, int h ) td->planetableV[i] = &(td->planes[2][ (w*h) * i ]); } - td->warptime[0] = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8((w * h)) ); + td->warptime[0] = (uint8_t*) vj_calloc( sizeof(uint8_t) * ((w * h)) ); if(!td->warptime[0]) { free(td->nonmap); free(td->planes[0]); free(td); return NULL; } - td->warptime[1] = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8((w * h)) ); + td->warptime[1] = (uint8_t*) vj_calloc( sizeof(uint8_t) * ((w * h)) ); if(!td->warptime[1]) { free(td->nonmap); free(td->planes[0]); diff --git a/veejay-current/veejay-server/libvje/effects/tracer.c b/veejay-current/veejay-server/libvje/effects/tracer.c index 6b95a779..08f31065 100644 --- a/veejay-current/veejay-server/libvje/effects/tracer.c +++ b/veejay-current/veejay-server/libvje/effects/tracer.c @@ -56,8 +56,8 @@ void *tracer_malloc(int w, int h) if(!t) { return NULL; } - const int len = RUP8(w * h); - const int total_len = RUP8(len * 3); + const int len = (w * h); + const int total_len = (len * 3); t->trace_buffer[0] = (uint8_t *) vj_malloc(sizeof(uint8_t) * total_len ); if(!t->trace_buffer[0]) { diff --git a/veejay-current/veejay-server/libvje/effects/water.c b/veejay-current/veejay-server/libvje/effects/water.c index 84d9f664..c88bf1c5 100644 --- a/veejay-current/veejay-server/libvje/effects/water.c +++ b/veejay-current/veejay-server/libvje/effects/water.c @@ -137,13 +137,13 @@ vj_effect *water_init(int width, int height) void *water_malloc(int width, int height) { water_t *w = (void*) vj_calloc(sizeof(water_t)); - w->ripple_data[0] = (uint8_t*)vj_calloc(sizeof(uint8_t) * RUP8(width * height)); + w->ripple_data[0] = (uint8_t*)vj_calloc(sizeof(uint8_t) * (width * height)); if(!w->ripple_data[0]) { free(w); return NULL; } - w->diff_img = (uint8_t*)vj_calloc(sizeof(uint8_t) * RUP8(width * height * 2)); + w->diff_img = (uint8_t*)vj_calloc(sizeof(uint8_t) * (width * height * 2)); if(!w->diff_img) { free(w->ripple_data[0]); free(w); @@ -153,7 +153,7 @@ void *water_malloc(int width, int height) w->map_h = height / 2 + 1; w->map_w = width / 2 + 1; - w->map = (int*) vj_calloc (sizeof(int) * RUP8( w->map_h * w->map_w * 3)); + w->map = (int*) vj_calloc (sizeof(int) * ( w->map_h * w->map_w * 3)); if(!w->map) { free(w->ripple_data[0]); free(w->diff_img); @@ -161,7 +161,7 @@ void *water_malloc(int width, int height) return NULL; } - w->vtable = (signed char*) vj_calloc( sizeof(signed char) * RUP8(w->map_w * w->map_h * 2)); + w->vtable = (signed char*) vj_calloc( sizeof(signed char) * (w->map_w * w->map_h * 2)); if(!w->vtable) { free(w->ripple_data[0]); free(w->diff_img); diff --git a/veejay-current/veejay-server/libvje/effects/waterrippletv.c b/veejay-current/veejay-server/libvje/effects/waterrippletv.c index 82fa17ac..43db52a6 100644 --- a/veejay-current/veejay-server/libvje/effects/waterrippletv.c +++ b/veejay-current/veejay-server/libvje/effects/waterrippletv.c @@ -101,7 +101,7 @@ void *waterrippletv_malloc(int width, int height) if(!r) { return NULL; } - r->ripple_data[0] = (uint8_t*)vj_malloc(sizeof(uint8_t) * RUP8(width * height)); + r->ripple_data[0] = (uint8_t*)vj_malloc(sizeof(uint8_t) * (width * height)); if(!r->ripple_data[0]) { free(r); return NULL; @@ -111,13 +111,13 @@ void *waterrippletv_malloc(int width, int height) r->map_h = height / 2 + 1; r->map_w = width / 2 + 1; - r->map = (int*) vj_calloc (sizeof(int) * RUP8(r->map_h * r->map_w * 3)); + r->map = (int*) vj_calloc (sizeof(int) * (r->map_h * r->map_w * 3)); if(!r->map) { free(r->ripple_data[0]); free(r); return NULL; } - r->vtable = (signed char*) vj_calloc( sizeof(signed char) * RUP8(r->map_w * r->map_h * 2)); + r->vtable = (signed char*) vj_calloc( sizeof(signed char) * (r->map_w * r->map_h * 2)); if(!r->vtable) { free(r->ripple_data[0]); free(r->map); diff --git a/veejay-current/veejay-server/libvje/effects/zoom.c b/veejay-current/veejay-server/libvje/effects/zoom.c index cae886e1..948a0f52 100644 --- a/veejay-current/veejay-server/libvje/effects/zoom.c +++ b/veejay-current/veejay-server/libvje/effects/zoom.c @@ -78,7 +78,7 @@ void *zoom_malloc(int width, int height) zoom_t *z = (zoom_t*) vj_calloc(sizeof(zoom_t)); if(!z) return NULL; - z->zoom_private_[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8( width * height + width ) * 4 ); + z->zoom_private_[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * ( width * height + width ) * 4 ); z->zoom_private_[1] = z->zoom_private_[0] + (width * height + width); z->zoom_private_[2] = z->zoom_private_[1] + (width * height + width); z->zoom_private_[3] = z->zoom_private_[2] + (width * height + width); diff --git a/veejay-current/veejay-server/libvje/libvje.c b/veejay-current/veejay-server/libvje/libvje.c index 4b8eecd1..4e828565 100644 --- a/veejay-current/veejay-server/libvje/libvje.c +++ b/veejay-current/veejay-server/libvje/libvje.c @@ -286,7 +286,7 @@ void vje_set_bg(VJFrame *bg) veejay_memcpy(vj_fx_bg, bg, sizeof(VJFrame)); - vj_fx_bg->data[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8( bg->len * 3 ) ); // enough space to hold 4:4:4 + vj_fx_bg->data[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * ( bg->len * 3 ) ); // enough space to hold 4:4:4 vj_fx_bg->data[1] = vj_fx_bg->data[0] + bg->len; vj_fx_bg->data[2] = vj_fx_bg->data[1] + bg->len; vj_fx_bg->data[3] = NULL; diff --git a/veejay-current/veejay-server/livido-plugins/lvd_bgsubtract.c b/veejay-current/veejay-server/livido-plugins/lvd_bgsubtract.c index 582c5ec9..6a1e2561 100644 --- a/veejay-current/veejay-server/livido-plugins/lvd_bgsubtract.c +++ b/veejay-current/veejay-server/livido-plugins/lvd_bgsubtract.c @@ -16,8 +16,6 @@ LIVIDO_PLUGIN #include "lvd_common.h" -#define RUP8(num)(((num)+8)&~8) - typedef struct { uint8_t *bg; @@ -33,7 +31,7 @@ int init_instance( livido_port_t *my_instance ) if(!b) { return LIVIDO_ERROR_MEMORY_ALLOCATION; } - b->bg = (uint8_t*) livido_malloc( sizeof(uint8_t) * RUP8(w * h) ); + b->bg = (uint8_t*) livido_malloc( sizeof(uint8_t) * (w * h) ); if(!b->bg) { free(b); return LIVIDO_ERROR_MEMORY_ALLOCATION; diff --git a/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c b/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c index aff38c9d..082ca9aa 100644 --- a/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c +++ b/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c @@ -21,9 +21,6 @@ typedef struct int current; } hold_buffer_t; -#define RUP8(num)(((num)+8)&~8) - - int init_instance( livido_port_t *my_instance ) { int w = 0, h = 0; @@ -33,7 +30,7 @@ int init_instance( livido_port_t *my_instance ) if(!hb) { return LIVIDO_ERROR_MEMORY_ALLOCATION; } - hb->buffer = (uint8_t*) livido_malloc( sizeof(uint8_t) * RUP8( w * h * 3)); + hb->buffer = (uint8_t*) livido_malloc( sizeof(uint8_t) * ( w * h * 3)); if(!hb->buffer) { free(hb); return LIVIDO_ERROR_MEMORY_ALLOCATION; diff --git a/veejay-current/veejay-server/test/OSC/send+dump/dumpOSC.c b/veejay-current/veejay-server/test/OSC/send+dump/dumpOSC.c index fc53fd5d..0b2d7f61 100644 --- a/veejay-current/veejay-server/test/OSC/send+dump/dumpOSC.c +++ b/veejay-current/veejay-server/test/OSC/send+dump/dumpOSC.c @@ -392,7 +392,7 @@ static void PrintTypeTaggedArgs(void *v, int n) { for (thisType = typeTags + 1; *thisType != 0; ++thisType) { switch (*thisType) { - case 'i': case 'r': case 'm': case 'c': + case 'i': case 'r': case 'm': printf("%d ", ntohl(*((int *) p))); p += 4; break; diff --git a/veejay-current/veejay-server/veejay/veejay.c b/veejay-current/veejay-server/veejay/veejay.c index cc45f62e..ccf871e6 100644 --- a/veejay-current/veejay-server/veejay/veejay.c +++ b/veejay-current/veejay-server/veejay/veejay.c @@ -832,6 +832,7 @@ int main(int argc, char **argv) #endif vj_mem_init(); + vj_mem_optimize(); vevo_strict_init(); diff --git a/veejay-current/veejay-server/veejay/vj-composite.c b/veejay-current/veejay-server/veejay/vj-composite.c index 05e58c91..15d3c697 100644 --- a/veejay-current/veejay-server/veejay/vj-composite.c +++ b/veejay-current/veejay-server/veejay/vj-composite.c @@ -70,8 +70,6 @@ typedef struct char tmp_path[1024]; } composite_t; -//@ round to multiple of 8 -#define RUP8(num)(((num)+8)&~8) void *composite_get_vp( void *data ) { @@ -121,7 +119,7 @@ void *composite_init( int pw, int ph, int iw, int ih, char *homedir, int sample_ return NULL; } - c->proj_plane[0] = (uint8_t*) vj_calloc( RUP8( pw * ph * 3) + RUP8(pw * 3) * sizeof(uint8_t)); + c->proj_plane[0] = (uint8_t*) vj_calloc( ( pw * ph * 3) + (pw * 3) * sizeof(uint8_t)); c->proj_plane[1] = c->proj_plane[0] + (pw * ph) + (pw); c->proj_plane[2] = c->proj_plane[1] + (pw * ph) + (pw); viewport_set_marker( c->vp1, 1 ); @@ -152,7 +150,7 @@ void *composite_init( int pw, int ph, int iw, int ih, char *homedir, int sample_ if( strncasecmp( gf_instr, "1", 1 ) == 0 ) { c->has_mirror_plane = 1; - c->mirror_plane[0] = (uint8_t*) vj_calloc( RUP8( iw * ih * 3) + RUP8(iw * 3) * sizeof(uint8_t)); + c->mirror_plane[0] = (uint8_t*) vj_calloc( ( iw * ih * 3) + (iw * 3) * sizeof(uint8_t)); c->mirror_plane[1] = c->mirror_plane[0] + (iw * ih) + (iw); c->mirror_plane[2] = c->mirror_plane[1] + (iw * ih) + (iw); c->mirror_row_start = 0; diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index d3f67ba3..f620f79c 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -160,7 +160,7 @@ static char *get_print_buf(int size) { int s = size; if( s<= 0) s = SEND_BUF; - char *res = (char*) vj_calloc(sizeof(char) * RUP8(s) ); + char *res = (char*) vj_calloc(sizeof(char) * s ); return res; } @@ -7147,8 +7147,6 @@ static struct { #endif { "dvsd", ENCODER_DVVIDEO }, { "mjpeg", ENCODER_MJPEG }, - { "mjpeg-b", ENCODER_MJPEGB }, - { "mjpegb", ENCODER_MJPEGB }, { "ljpeg", ENCODER_LJPEG }, #ifdef HAVE_LIBQUICKTIME { "quicktime-mjpeg", ENCODER_QUICKTIME_MJPEG }, diff --git a/veejay-current/veejay-server/veejay/vj-perform.c b/veejay-current/veejay-server/veejay/vj-perform.c index 660fbbc9..a038c9d7 100644 --- a/veejay-current/veejay-server/veejay/vj-perform.c +++ b/veejay-current/veejay-server/veejay/vj-perform.c @@ -106,8 +106,6 @@ typedef struct { int active; } varcache_t; -#define RUP8(num)(((num)+8)&~8) - extern uint8_t pixel_Y_lo_; #define CACHE_TOP 0 @@ -158,6 +156,7 @@ typedef struct typedef struct { int sample_id; + int entry; ycbcr_frame *frame; } performer_cache_t; @@ -223,7 +222,7 @@ static void vj_perform_reverse_audio_frame(veejay_t * info, int len, uint8_t *bu #endif static void vj_perform_end_transition(veejay_t *info, int mode, int sample); -static void vj_perform_set_444(VJFrame *frame) +static void vj_perform_set_444__(const char *func,const int line, VJFrame *frame) { frame->ssm = 1; frame->shift_h = 0; @@ -236,7 +235,7 @@ static void vj_perform_set_444(VJFrame *frame) frame->format = (frame->range ? PIX_FMT_YUVJ444P : PIX_FMT_YUV444P); } -static void vj_perform_set_422(VJFrame *frame) +static void vj_perform_set_422__( const char *func, const int line, VJFrame *frame) { frame->shift_h = 1; frame->shift_v = 0; @@ -249,28 +248,44 @@ static void vj_perform_set_422(VJFrame *frame) frame->ssm = 0; } -static void vj_perform_supersample(video_playback_setup *settings,performer_t *p, VJFrame *one, VJFrame *two, int sm) +#define vj_perform_set_444(f) vj_perform_set_444__( __FUNCTION__, __LINE__ ,f) +#define vj_perform_set_422(f) vj_perform_set_422__( __FUNCTION__, __LINE__,f) + +static void vj_perform_supersample(video_playback_setup *settings,performer_t *p, VJFrame *one, VJFrame *two, int sm, int chain_entry) { - if(sm == 1) { - if(one != NULL && one->ssm == 0) { - chroma_supersample( settings->sample_mode,one,one->data ); - vj_perform_set_444(one); - } - if(two != NULL && two->ssm == 0) { - chroma_supersample( settings->sample_mode,two,two->data ); - vj_perform_set_444(two); - } - } - else if( sm == 0 ) { - if(one != NULL && one->ssm == 1) { - chroma_subsample( settings->sample_mode,one,one->data); - vj_perform_set_422(one); - } - if(two != NULL && two->ssm == 1) { - chroma_subsample( settings->sample_mode,two,two->data); - vj_perform_set_422(two); + if( one != NULL ) { + int no_matter = (sm == -1 ? 1: 0); + if(!no_matter) { + if( sm == 1 && one->ssm == 0) { + chroma_supersample( settings->sample_mode,one,one->data ); + vj_perform_set_444(one); + p->primary_buffer[0]->ssm = 1; + } + else if ( sm == 0 && one->ssm == 1) { + chroma_subsample( settings->sample_mode,one,one->data); + vj_perform_set_422(one); + p->primary_buffer[0]->ssm = 1; + } } } + + if( two != NULL ) { + int no_matter = (sm == -1 ? 1: 0); + if(!no_matter) { + if( sm == 1 && two->ssm == 0) { + chroma_supersample( settings->sample_mode,two,two->data ); + vj_perform_set_444(two); + p->frame_buffer[ chain_entry ]->ssm = 1; + } + else if ( sm == 0 && two->ssm == 1) { + chroma_subsample( settings->sample_mode,two,two->data); + vj_perform_set_422(two); + p->frame_buffer[ chain_entry ]->ssm = 0; + } + } + } + + } static void vj_perform_copy( ycbcr_frame *src, ycbcr_frame *dst, int Y_len, int UV_len, int alpha_len ) @@ -371,20 +386,22 @@ static ycbcr_frame *vj_perform_sample_is_cached(veejay_t *info,int sample_id) return NULL; } +static void vj_perform_sample_cache_tick(performer_global_t *g) { + if( g->n_cached_sample_frames < CACHE_SIZE-1) + g->n_cached_sample_frames = g->n_cached_sample_frames ++; +} + +static void vj_perform_tag_cache_tick(performer_global_t *g) { + if( g->n_cached_tag_frames < CACHE_SIZE-1) + g->n_cached_tag_frames = g->n_cached_tag_frames ++; +} + + + static void vj_perform_clear_cache(performer_global_t *g) { - int c; - for( c = 0; c < g->n_cached_sample_frames; c ++ ) { - g->cached_sample_frames[c].sample_id = 0; - g->cached_sample_frames[c].frame = NULL; - } - for( c = 0; c < g->n_cached_tag_frames; c ++ ) { - g->cached_tag_frames[c].sample_id = 0; - g->cached_tag_frames[c].frame = NULL; - } + - g->n_cached_tag_frames = 0; - g->n_cached_sample_frames = 0; } static int vj_perform_increase_tag_frame(veejay_t * info, long num) @@ -411,34 +428,6 @@ static int vj_perform_increase_tag_frame(veejay_t * info, long num) vj_perform_try_sequence(info); } -/* - if( info->seq->active ) { - veejay_msg(VEEJAY_MSG_DEBUG, "Play frame %ld", settings->current_frame_num ); - - - if( settings->current_frame_num > settings->max_frame_num ) { - settings->current_frame_num = settings->max_frame_num; - int type = 0; - - veejay_msg(VEEJAY_MSG_DEBUG, "Reach end position %ld (ready=%d,sample=%d)", settings->current_frame_num,settings->transition.ready,info->uc->sample_id ); - - int n = vj_perform_next_sequence( info, &type ); - if( n > 0 ) { - //if(!settings->transition.active) { - veejay_msg(VEEJAY_MSG_INFO, "Sequence play selects %s %d", (type == 0 ? "sample" : "stream" ) , n ); - veejay_change_playback_mode(info,(type == 0 ? VJ_PLAYBACK_MODE_SAMPLE: VJ_PLAYBACK_MODE_TAG),n ); - //} - } - } - } else { - if( settings->current_frame_num > settings->max_frame_num ) { - settings->current_frame_num = settings->min_frame_num; - - } - } - } - */ - return 0; } @@ -462,7 +451,6 @@ static int vj_perform_increase_plain_frame(veejay_t * info, long num) if (settings->current_frame_num > settings->max_frame_num) { if(!info->continuous) { - veejay_msg(VEEJAY_MSG_DEBUG, "Reached end of video - Ending veejay session ... "); veejay_change_state(info, LAVPLAY_STATE_STOP); } settings->current_frame_num = settings->min_frame_num; @@ -584,7 +572,6 @@ int vj_perform_try_sequence( veejay_t *info ) if( at_next_loop == 1 ) { if( vj_perform_seq_setup_transition(info) == 0 ) { - veejay_msg(VEEJAY_MSG_ERROR, "There is no next sample in the sequencer?"); info->seq->active = 0; info->seq->current = 0; veejay_reset_sample_positions( info, -1 ); @@ -750,7 +737,7 @@ static int vj_perform_record_buffer_init(veejay_t *info) veejay_memcpy( g->offline_frame, info->effect_frame1, sizeof(VJFrame) ); - uint8_t *region = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8( g->offline_frame->len * 3 ) ); + uint8_t *region = (uint8_t*) vj_malloc(sizeof(uint8_t) * g->offline_frame->len * 3); if(!region) return 0; g->offline_frame->data[0] = region; @@ -791,14 +778,14 @@ int vj_perform_allocate(veejay_t *info) } global->preview_max_w = info->video_output_width * 2; global->preview_max_h = info->video_output_height * 2; - global->preview_buffer->Y = (uint8_t*) vj_calloc( RUP8(global->preview_max_w * global->preview_max_h * 2) ); + global->preview_buffer->Y = (uint8_t*) vj_calloc( global->preview_max_w * global->preview_max_h * 2 ); if(!global->preview_buffer->Y) { return 1; } const int w = info->video_output_width; const int h = info->video_output_height; - const long frame_len = RUP8( ((w*h)+w+w) ); + const long frame_len = ((w*h)+w+w); size_t buf_len = frame_len * 4 * sizeof(uint8_t); int mlock_success = 1; @@ -826,8 +813,6 @@ int vj_perform_allocate(veejay_t *info) global->feedback_frame.data[2] = global->feedback_buffer[2]; global->feedback_frame.data[3] = global->feedback_buffer[3]; - vj_perform_clear_cache(global); - if(mlock_success != 1) { veejay_msg(VEEJAY_MSG_WARNING, "Unable to lock the performer into RAM (memory may be paged to the swap area)"); } @@ -847,10 +832,10 @@ static performer_t *vj_perform_init_performer(veejay_t *info, int chain_id) { const int w = info->video_output_width; const int h = info->video_output_height; - const long frame_len = RUP8( ((w*h)+w+w) ); + unsigned int c; long total_used = 0; - int performer_frame_size = frame_len * 4; + performer_t *p = (performer_t*) vj_calloc(sizeof(performer_t)); if(!p) { @@ -871,7 +856,11 @@ static performer_t *vj_perform_init_performer(veejay_t *info, int chain_id) return NULL; } - size_t buf_len = performer_frame_size * sizeof(uint8_t); + size_t plane_len = (w*h); + size_t frame_len = 4 * plane_len; + + size_t performer_frame_size = frame_len * 4; + int mlock_success = 1; p->pribuf_len = PRIMARY_FRAMES * performer_frame_size; @@ -892,69 +881,69 @@ static performer_t *vj_perform_init_performer(veejay_t *info, int chain_id) veejay_memset( p->primary_buffer[c]->Cb,128,frame_len); veejay_memset( p->primary_buffer[c]->Cr,128,frame_len); veejay_memset( p->primary_buffer[c]->alpha,0,frame_len); - total_used += buf_len; + total_used += performer_frame_size; } - p->temp_buffer[0] = (uint8_t*) vj_malloc( buf_len ); + p->temp_buffer[0] = (uint8_t*) vj_malloc( frame_len ); if(!p->temp_buffer[0]) { return NULL; } - p->temp_buffer[1] = p->temp_buffer[0] + frame_len; - p->temp_buffer[2] = p->temp_buffer[1] + frame_len; - p->temp_buffer[3] = p->temp_buffer[2] + frame_len; + p->temp_buffer[1] = p->temp_buffer[0] + plane_len; + p->temp_buffer[2] = p->temp_buffer[1] + plane_len; + p->temp_buffer[3] = p->temp_buffer[2] + plane_len; - if(mlock( p->temp_buffer[0], buf_len ) != 0 ) + if(mlock( p->temp_buffer[0], frame_len ) != 0 ) mlock_success = 0; - veejay_memset(p->temp_buffer[2], 128, frame_len); - veejay_memset(p->temp_buffer[1], 128, frame_len); - veejay_memset(p->temp_buffer[3], 0, frame_len); - veejay_memset(p->temp_buffer[0], 0, frame_len); + veejay_memset(p->temp_buffer[2], 128, plane_len); + veejay_memset(p->temp_buffer[1], 128, plane_len); + veejay_memset(p->temp_buffer[3], 0, plane_len); + veejay_memset(p->temp_buffer[0], 0, plane_len); - p->rgba_buffer[0] = (uint8_t*) vj_malloc( buf_len * 2 ); + p->rgba_buffer[0] = (uint8_t*) vj_malloc( frame_len * 2 ); if(!p->rgba_buffer[0] ) { return NULL; } - p->rgba_buffer[1] = p->rgba_buffer[0] + buf_len; + p->rgba_buffer[1] = p->rgba_buffer[0] + frame_len; - if( mlock( p->rgba_buffer[0], buf_len * 2 ) != 0 ) + if( mlock( p->rgba_buffer[0], frame_len * 2 ) != 0 ) mlock_success = 0; - veejay_memset( p->rgba_buffer[0], 0, buf_len * 2 ); + veejay_memset( p->rgba_buffer[0], 0, frame_len * 2 ); - p->subrender_buffer[0] = (uint8_t*) vj_malloc( buf_len * 3 ); //frame, p0, p1 + p->subrender_buffer[0] = (uint8_t*) vj_malloc( frame_len ); //frame, p0, p1 if(!p->subrender_buffer[0]) { return NULL; } - p->subrender_buffer[1] = p->subrender_buffer[0] + frame_len; - p->subrender_buffer[2] = p->subrender_buffer[1] + frame_len; - p->subrender_buffer[3] = p->subrender_buffer[2] + frame_len; + p->subrender_buffer[1] = p->subrender_buffer[0] + plane_len; + p->subrender_buffer[2] = p->subrender_buffer[1] + plane_len; + p->subrender_buffer[3] = p->subrender_buffer[2] + plane_len; - if(mlock( p->subrender_buffer[0], buf_len ) != 0 ) + if(mlock( p->subrender_buffer[0], frame_len ) != 0 ) mlock_success = 0; - veejay_memset( p->subrender_buffer[0], pixel_Y_lo_,frame_len); - veejay_memset( p->subrender_buffer[1],128,frame_len); - veejay_memset( p->subrender_buffer[2],128,frame_len); - veejay_memset( p->subrender_buffer[3],0,frame_len); + veejay_memset( p->subrender_buffer[0], pixel_Y_lo_,plane_len); + veejay_memset( p->subrender_buffer[1],128,plane_len); + veejay_memset( p->subrender_buffer[2],128,plane_len); + veejay_memset( p->subrender_buffer[3],0,plane_len); - total_used += buf_len; //temp_buffer - total_used += (buf_len * 3); //subrender_buffer - total_used += (buf_len * 2); //rgb conversion buffer + total_used += frame_len; //temp_buffer + total_used += frame_len; //subrender_buffer + total_used += (frame_len * 2); //rgb conversion buffer //allocate fx_chain_buffer - size_t tmp1 = buf_len * 4 * sizeof(uint8_t) * SAMPLE_MAX_EFFECTS; - p->fx_chain_buffer = vj_hmalloc( tmp1, "in fx chain buffers" ); + size_t fx_chain_size = (frame_len + frame_len + frame_len) * SAMPLE_MAX_EFFECTS; + p->fx_chain_buffer = vj_hmalloc( fx_chain_size, "in fx chain buffers" ); if(p->fx_chain_buffer == NULL ) { veejay_msg(VEEJAY_MSG_WARNING,"Unable to allocate sufficient memory to keep all FX chain buffers in RAM"); return NULL; } - total_used += tmp1; - p->fx_chain_buflen = tmp1; + total_used += fx_chain_size; + p->fx_chain_buflen = fx_chain_size; /* set up pointers for frame_buffer */ for (c = 0; c < SAMPLE_MAX_EFFECTS; c++) { @@ -963,23 +952,24 @@ static performer_t *vj_perform_init_performer(veejay_t *info, int chain_id) return NULL; } - uint8_t *ptr = p->fx_chain_buffer + (c * frame_len * 4 * 3); // each entry, has 3 frames with 4 planes each + const int space = frame_len * 3; + uint8_t *ptr = p->fx_chain_buffer + (c * space); p->frame_buffer[c]->Y = ptr; - p->frame_buffer[c]->Cb = p->frame_buffer[c]->Y + frame_len; - p->frame_buffer[c]->Cr = p->frame_buffer[c]->Cb + frame_len; - p->frame_buffer[c]->alpha = p->frame_buffer[c]->Cr + frame_len; + p->frame_buffer[c]->Cb = p->frame_buffer[c]->Y + plane_len; + p->frame_buffer[c]->Cr = p->frame_buffer[c]->Cb + plane_len; + p->frame_buffer[c]->alpha = p->frame_buffer[c]->Cr + plane_len; - p->frame_buffer[c]->P0 = ptr + (frame_len * 4); - p->frame_buffer[c]->P1 = p->frame_buffer[c]->P0 + (frame_len*4); + p->frame_buffer[c]->P0 = ptr + frame_len; + p->frame_buffer[c]->P1 = p->frame_buffer[c]->P0 + frame_len; - veejay_memset( p->frame_buffer[c]->Y, pixel_Y_lo_,frame_len); - veejay_memset( p->frame_buffer[c]->Cb,128,frame_len); - veejay_memset( p->frame_buffer[c]->Cr,128,frame_len); - veejay_memset( p->frame_buffer[c]->alpha,0,frame_len); - veejay_memset( p->frame_buffer[c]->P0, pixel_Y_lo_, frame_len ); - veejay_memset( p->frame_buffer[c]->P0 + frame_len, 128, frame_len * 4); - veejay_memset( p->frame_buffer[c]->P1, pixel_Y_lo_, frame_len ); - veejay_memset( p->frame_buffer[c]->P1 + frame_len, 128, frame_len * 4); + veejay_memset( p->frame_buffer[c]->Y, pixel_Y_lo_,plane_len); + veejay_memset( p->frame_buffer[c]->Cb,128,plane_len); + veejay_memset( p->frame_buffer[c]->Cr,128,plane_len); + veejay_memset( p->frame_buffer[c]->alpha,0,plane_len); + veejay_memset( p->frame_buffer[c]->P0, pixel_Y_lo_, plane_len ); + veejay_memset( p->frame_buffer[c]->P0 + plane_len, 128, plane_len * 2); + veejay_memset( p->frame_buffer[c]->P1, pixel_Y_lo_, plane_len ); + veejay_memset( p->frame_buffer[c]->P1 + plane_len, 128, plane_len * 2); } veejay_memset( &(p->pvar_), 0, sizeof( varcache_t)); @@ -1015,9 +1005,11 @@ static performer_t *vj_perform_init_performer(veejay_t *info, int chain_id) ((float)total_used/1048576.0f), p, ( mlock_success ? "is not going to be" : "may be" ), - ((float)tmp1/1048576.0f) + ((float)fx_chain_size/1048576.0f) ); + vj_perform_clear_cache(p); + p->chain_id = chain_id; return p; @@ -1082,12 +1074,12 @@ int vj_perform_init_audio(veejay_t * info) performer_t *p = global->A; p->top_audio_buffer = - (uint8_t *) vj_calloc(sizeof(uint8_t) * 8 * RUP8( PERFORM_AUDIO_SIZE ) ); + (uint8_t *) vj_calloc(sizeof(uint8_t) * 8 * PERFORM_AUDIO_SIZE); if(!p->top_audio_buffer) return 0; p->audio_rec_buffer = - (uint8_t *) vj_calloc(sizeof(uint8_t) * RUP8( PERFORM_AUDIO_SIZE) ); + (uint8_t *) vj_calloc(sizeof(uint8_t) * PERFORM_AUDIO_SIZE ); if(!p->audio_rec_buffer) return 0; @@ -1513,12 +1505,40 @@ static void vj_perform_reverse_audio_frame(veejay_t * info, int len, static int vj_perform_use_cached_frame(ycbcr_frame *cached_frame, VJFrame *dst) { - veejay_memcpy( dst->data[0], cached_frame->Y, dst->stride[0] * dst->height ); - veejay_memcpy( dst->data[1], cached_frame->Cb, dst->stride[1] * dst->height ); - veejay_memcpy( dst->data[2], cached_frame->Cr, dst->stride[2] * dst->height ); + const int cached_in_ssm = cached_frame->ssm; + const int len = (cached_in_ssm ? dst->len : dst->uv_len ); + + // cached frame is a pointer to frame_buffer (previous chain entry) + // possibly, the previous frame_buffer is already supersampled + + veejay_memcpy( dst->data[0], cached_frame->Y, dst->len); + veejay_memcpy( dst->data[1], cached_frame->Cb, len); + veejay_memcpy( dst->data[2], cached_frame->Cr, len ); //veejay_memcpy( dst->data[3], cached_frame->data[3], cached_frame->stride[3] * cached_frame->height ); - return dst->ssm; + return cached_frame->ssm; +} + +static int vj_perform_find_cache_sample_slot(performer_global_t *p, ycbcr_frame *frame, int sample_id, int chain_entry) { + int c; + for( c = 0; c < p->n_cached_sample_frames; c ++ ) { + if( p->cached_sample_frames[c].sample_id == 0 || p->cached_sample_frames[c].sample_id == sample_id ) { + p->cached_sample_frames[c].frame = frame; + p->cached_sample_frames[c].entry = chain_entry; + } + } + return -1; +} + +static int vj_perform_find_cache_tag_slot(performer_global_t *p, ycbcr_frame *frame, int sample_id, int chain_entry) { + int c; + for( c = 0; c < p->n_cached_tag_frames; c ++ ) { + if( p->cached_tag_frames[c].sample_id == 0 || p->cached_tag_frames[c].sample_id == sample_id ) { + p->cached_tag_frames[c].frame = frame; + p->cached_tag_frames[c].entry = chain_entry; + } + } + return -1; } static int vj_perform_get_subframe(veejay_t * info, int this_sample_id, int sub_sample,int chain_entry) @@ -1888,11 +1908,8 @@ static int vj_perform_apply_secundary_tag(veejay_t * info, performer_t *p, int s int res = vj_tag_get_frame(sample_id, dst,p->audio_buffer[chain_entry]); if(res==1) { error = 0; - ssm = dst->ssm; - - global->cached_tag_frames[ global->n_cached_tag_frames ].sample_id = sample_id; - global->cached_tag_frames[ global->n_cached_tag_frames ].frame = p->frame_buffer[ chain_entry ]; - global->n_cached_tag_frames ++; + vj_perform_find_cache_tag_slot(global, p->frame_buffer[ chain_entry ], sample_id, chain_entry); + vj_perform_tag_cache_tick(global); } } else @@ -1916,16 +1933,13 @@ static int vj_perform_apply_secundary_tag(veejay_t * info, performer_t *p, int s len = vj_perform_get_frame_fx( info, sample_id, nframe, src,dst,p0_ref,p1_ref ); if(len > 0 ) { error = 0; - ssm = dst->ssm; -//NEL - global->cached_sample_frames[ global->n_cached_sample_frames ].sample_id = sample_id; - global->cached_sample_frames[ global->n_cached_sample_frames ].frame = p->frame_buffer[ chain_entry ]; - global->n_cached_sample_frames ++; + vj_perform_find_cache_sample_slot(global, p->frame_buffer[ chain_entry] , sample_id, chain_entry ); + vj_perform_sample_cache_tick(global); } } else { - ssm = vj_perform_use_cached_frame(cached_frame, dst); + ssm = vj_perform_use_cached_frame(cached_frame, dst ); error = 0; } @@ -1945,8 +1959,8 @@ static int vj_perform_get_feedback_frame(veejay_t *info, VJFrame *src, VJFrame int max_sfd = (s1 ? sample_get_framedup( s1 ) : info->sfd ); int strides[4] = { src->len, - (src->ssm == 1 ? src->len : src->uv_len ), - (src->ssm == 1 ? src->len : src->uv_len ), + src->uv_len, + src->uv_len, src->stride[3] * src->height }; @@ -1999,7 +2013,7 @@ static int vj_perform_get_frame_( veejay_t *info, int s1, long nframe, VJFrame int cur_sfd = (s1 ? sample_get_framedups(s1 ) : info->settings->simple_frame_dup ); int speed = (s1 ? sample_get_speed(s1) : info->settings->current_playback_speed); - int uv_len = (dst->ssm == 1 ? dst->len : dst->uv_len ); + int uv_len = dst->uv_len; long p0_frame = 0; long p1_frame = 0; @@ -2092,11 +2106,8 @@ static int vj_perform_apply_secundary(veejay_t * info,performer_t *p, int this_s res = vj_tag_get_frame(sample_id, dst,p->audio_buffer[chain_entry]); if(res) { error = 0; - ssm = dst->ssm; - - g->cached_tag_frames[ g->n_cached_tag_frames ].sample_id = sample_id; - g->cached_tag_frames[ g->n_cached_tag_frames ].frame = p->frame_buffer[ chain_entry ]; - g->n_cached_tag_frames ++; + vj_perform_find_cache_tag_slot(g, p->frame_buffer[ chain_entry ], sample_id, chain_entry ); + vj_perform_tag_cache_tick(g); } } else @@ -2108,21 +2119,19 @@ static int vj_perform_apply_secundary(veejay_t * info,performer_t *p, int this_s break; case VJ_TAG_TYPE_NONE: - nframe = vj_perform_get_subframe(info,this_sample_id, sample_id, chain_entry); // get exact frame number to decode - + nframe = vj_perform_get_subframe(info,this_sample_id, sample_id, chain_entry); // get exact frame number to decode sample_set_resume( sample_id, nframe ); if(!subrender) cached_frame = vj_perform_sample_is_cached(info,sample_id); - + if(cached_frame == NULL || subrender) { len = vj_perform_get_frame_fx( info, sample_id, nframe, src, dst, p0_ref, p1_ref ); + if(len > 0 ) { error = 0; - ssm = dst->ssm; - g->cached_sample_frames[ g->n_cached_sample_frames ].sample_id = sample_id; - g->cached_sample_frames[ g->n_cached_sample_frames ].frame = p->frame_buffer[ chain_entry ]; - g->n_cached_sample_frames ++; + vj_perform_find_cache_sample_slot(g, p->frame_buffer[ chain_entry] , sample_id, chain_entry ); + vj_perform_tag_cache_tick(g); } } else @@ -2156,10 +2165,11 @@ static void vj_perform_tag_render_chain_entry(veejay_t *info,performer_t *p,vjp_ int sub_mode = vje_get_subformat(effect_id); int ef = vje_get_extra_frame(effect_id); - vj_perform_supersample(settings,p, frames[0], (ef ? frames[1] : NULL), sub_mode ); + vj_perform_supersample(settings,p, frames[0], (ef ? frames[1] : NULL), sub_mode, chain_entry ); + p->frame_buffer[chain_entry]->ssm = frames[0]->ssm; - + if(ef) { frames[1]->ssm = vj_perform_apply_secundary_tag(info,p,fx_entry->channel,fx_entry->source_type,chain_entry,frames[0],frames[1],p->frame_buffer[chain_entry]->P0, p->frame_buffer[chain_entry]->P1, 0 ); @@ -2168,7 +2178,7 @@ static void vj_perform_tag_render_chain_entry(veejay_t *info,performer_t *p,vjp_ frames[1]->ssm = vj_perform_preprocess_secundary( info,p, fx_entry->channel,fx_entry->source_type,sub_mode,chain_entry, frames, frameinfo ); } - vj_perform_supersample(settings,p, NULL, frames[1], sub_mode); + vj_perform_supersample(settings,p, NULL, frames[1], sub_mode, chain_entry); } if( p->pvar_.fade_entry == chain_entry && p->pvar_.fade_method == 1) { @@ -2249,7 +2259,7 @@ static int vj_perform_preprocess_secundary( veejay_t *info,performer_t *p, int subframes[1]->ssm = vj_perform_apply_secundary(info,p,id,fx_entry->channel,fx_entry->source_type,n,subframes[0],subframes[1],p0_ref, p1_ref, 1); } - vj_perform_supersample( settings,p, subframes[0], subframes[1], sm ); + vj_perform_supersample( settings,p, subframes[0], subframes[1], sm, chain_entry ); vj_perform_apply_first(info,p,&setup,subframes,fx_entry,fx_id,n,(int) settings->current_frame_num,fx_entry->fx_instance, mode ); } @@ -2269,7 +2279,7 @@ static int vj_perform_preprocess_secundary( veejay_t *info,performer_t *p, int subframes[1]->ssm = vj_perform_apply_secundary_tag(info,p,fx_entry->channel,fx_entry->source_type,n,subframes[0],subframes[1],p0_ref,p1_ref,1); } - vj_perform_supersample(settings,p, subframes[0],subframes[1], sm); + vj_perform_supersample(settings,p, subframes[0],subframes[1], sm, chain_entry); vj_perform_apply_first(info,p,&setup,subframes,fx_entry,fx_id,n,(int) settings->current_frame_num,fx_entry->fx_instance, mode ); } @@ -2302,7 +2312,7 @@ static void vj_perform_render_chain_entry(veejay_t *info,performer_t *p, vjp_kf int sub_mode = vje_get_subformat(effect_id); int ef = vje_get_extra_frame(effect_id); - vj_perform_supersample(settings,p, frames[0], NULL, sub_mode); + vj_perform_supersample(settings,p, frames[0], NULL, sub_mode, chain_entry); p->frame_buffer[chain_entry]->ssm = frames[0]->ssm; @@ -2314,7 +2324,8 @@ static void vj_perform_render_chain_entry(veejay_t *info,performer_t *p, vjp_kf frames[1]->ssm = vj_perform_preprocess_secundary(info,p,fx_entry->channel,fx_entry->source_type,sub_mode,chain_entry,frames,frameinfo ); } - vj_perform_supersample(settings,p, NULL, frames[1], sub_mode); + vj_perform_supersample(settings,p, NULL, frames[1], sub_mode, chain_entry); + } if( p->pvar_.fade_entry == chain_entry && p->pvar_.fade_method == 1) { @@ -2327,6 +2338,7 @@ static void vj_perform_render_chain_entry(veejay_t *info,performer_t *p, vjp_kf if( p->pvar_.fade_entry == chain_entry && p->pvar_.fade_method == 2) { vj_perform_pre_chain( p, frames[0] ); } + } static int clear_framebuffer__ = 0; @@ -2363,9 +2375,16 @@ static void vj_perform_sample_complete_buffers(veejay_t * info,performer_t *p, v frames[1]->data[2] = p->frame_buffer[chain_entry]->Cr; frames[1]->data[3] = p->frame_buffer[chain_entry]->alpha; - vj_perform_supersample( info->settings, p, f0, f1, - vje_get_subformat( fx_entry->effect_id ) - ); +/* if( vje_get_extra_frame( fx_entry->effect_id )) { + vj_perform_supersample( info->settings, p, f0, f1, + vje_get_subformat( fx_entry->effect_id ) + ); + } + else { + vj_perform_supersample( info->settings, p, f0, NULL, + vje_get_subformat( fx_entry->effect_id ) + ); + }*/ vj_perform_render_chain_entry(info,p,effect_info,sample_id,pm,fx_entry,chain_entry,frames,(si->subrender? fx_entry->is_rendering: si->subrender)); } @@ -2440,9 +2459,8 @@ static void vj_perform_plain_fill_buffer(veejay_t * info, performer_t *p,VJFrame { vj_perform_get_frame_(info, sample_id, frame_num,&frame,&frame, p0_buffer,p1_buffer,0 ); - g->cached_sample_frames[ g->n_cached_sample_frames ].sample_id = sample_id; - g->cached_sample_frames[ g->n_cached_sample_frames ].frame = p->primary_buffer[0]; - g->n_cached_sample_frames ++; + vj_perform_find_cache_sample_slot(g, p->primary_buffer[ 0] , sample_id, -1 ); + vj_perform_sample_cache_tick(g); } else if ( mode == VJ_PLAYBACK_MODE_PLAIN ) { vj_perform_get_frame_(info, 0, frame_num,&frame,&frame, p0_buffer, p1_buffer,0 ); @@ -2947,9 +2965,8 @@ static void vj_perform_tag_fill_buffer(veejay_t * info, performer_t *p, VJFrame if (vj_tag_get_frame(sample_id, dst,NULL)) { error = 0; - g->cached_tag_frames[ g->n_cached_tag_frames ].sample_id = sample_id; - g->cached_tag_frames[ g->n_cached_tag_frames].frame = p->primary_buffer[0]; - g->n_cached_tag_frames ++; + vj_perform_find_cache_sample_slot(g, p->primary_buffer[0], sample_id, -1); + vj_perform_tag_cache_tick(g); } } @@ -2967,7 +2984,7 @@ static void vj_perform_pre_chain(performer_t *p, VJFrame *frame) veejay_memcpy( &(p->temp_frame), frame, sizeof(VJFrame) ); } -static inline void vj_perform_supersample_chain( performer_t *p, subsample_mode_t sample_mode, VJFrame *frame ) +static inline void vj_perform_supersample_chain( performer_t *p, subsample_mode_t sample_mode, VJFrame *frame ) //FIXME { if( frame->ssm == p->temp_frame.ssm ) { return; // nothing to do @@ -3842,9 +3859,10 @@ int vj_perform_queue_video_frames(veejay_t *info, VJFrame *frame, VJFrame *frame p->tmp2->data[1] = p->frame_buffer[c]->Cb; p->tmp2->data[2] = p->frame_buffer[c]->Cr; p->tmp2->data[3] = p->frame_buffer[c]->alpha; - p->tmp2->ssm = 0; + // p->tmp2->ssm = 0; vj_perform_queue_fx_entry( info, sample_id, c, entry, p, p->tmp1, p->tmp2, is_sample, &alpha_clear ); } + } } @@ -3871,7 +3889,7 @@ void vj_perform_render_video_frames(veejay_t *info, performer_t *p, vjp_kf *effe int safe_fv = p->pvar_.fade_value; veejay_memset( &(p->pvar_), 0, sizeof(varcache_t)); - + p->pvar_.follow_fade = safe_ff; p->pvar_.fade_value = safe_fv; p->pvar_.fade_entry = -1; @@ -3884,7 +3902,7 @@ void vj_perform_render_video_frames(veejay_t *info, performer_t *p, vjp_kf *effe a->timecode = settings->current_frame_num / (double) (settings->max_frame_num - settings->min_frame_num); for( i = 0; i < SAMPLE_MAX_EFFECTS; i ++ ) { - p->frame_buffer[i]->ssm = -1; + p->frame_buffer[i]->ssm = 0; } a->data[0] = p->primary_buffer[0]->Y; @@ -3909,9 +3927,10 @@ void vj_perform_render_video_frames(veejay_t *info, performer_t *p, vjp_kf *effe if( (info->seq->active && info->seq->rec_id) || info->settings->offline_record ) p->pvar_.enc_active = 1; + if(p->pvar_.fx_status ) vj_perform_sample_complete_buffers(info,p, effect_info, &is444, a, b, sample_id, source_type,setup); - + vj_perform_finish_chain( info,p,a,sample_id,source_type ); break; @@ -3970,6 +3989,8 @@ int vj_perform_queue_video_frame(veejay_t *info, const int skip_incr) performer_global_t *g = (performer_global_t*) info->performer; + performer_t *p = g->A; + vj_perform_queue_video_frames( info, info->effect_frame1, info->effect_frame2, g->A, skip_incr, info->uc->sample_id, info->uc->playback_mode, info->settings->current_frame_num); int transition_enabled = info->settings->transition.active; @@ -4033,12 +4054,19 @@ int vj_perform_queue_video_frame(veejay_t *info, const int skip_incr) vj_perform_set_422(info->effect_frame2); vj_perform_set_422(info->effect_frame3); vj_perform_set_422(info->effect_frame4); + + g->A->primary_buffer[0]->ssm = 0; } vj_perform_clear_cache(info->performer); vje_enable_parallel(); + /* for( int c = 0; c < SAMPLE_MAX_EFFECTS; c ++ ) { + + g->A->frame_buffer[c]->ssm = 0; + } */ + return 1; } @@ -4071,10 +4099,6 @@ int vj_perform_queue_frame(veejay_t * info, int skip ) settings->hold_status = 0; long was_at_pos = settings->current_frame_num; veejay_increase_frame(info, settings->hold_resume ); - veejay_msg(VEEJAY_MSG_DEBUG, "Reached hold position, skip from frame %ld to frame %ld", - was_at_pos, - settings->current_frame_num ); - if( speed == 0 ) speed = settings->current_playback_speed; } diff --git a/veejay-current/veejay-server/veejay/vj-sdl.c b/veejay-current/veejay-server/veejay/vj-sdl.c index 99376abd..05d165d3 100644 --- a/veejay-current/veejay-server/veejay/vj-sdl.c +++ b/veejay-current/veejay-server/veejay/vj-sdl.c @@ -40,9 +40,6 @@ #include #include -#define RUP8(num)(((num)+8)&~8) -#define RUP16(num)(((num)+16)&~16) - typedef struct vj_sdl_t { SDL_Window *screen; SDL_Renderer *renderer; @@ -93,7 +90,7 @@ void *vj_sdl_allocate(VJFrame *frame, int use_key, int use_mouse, int show_curso vjsdl->src_frame = (void*) src; vjsdl->dst_frame = (void*) dst; - vjsdl->pixels = (uint8_t*) vj_calloc(sizeof(uint8_t) * RUP16( frame->len * 2 ) ); + vjsdl->pixels = (uint8_t*) vj_calloc(sizeof(uint8_t) * ( frame->len * 2 ) ); return (void*) vjsdl; } diff --git a/veejay-current/veejay-server/veejay/vj-shm.c b/veejay-current/veejay-server/veejay/vj-shm.c index 0fd0e777..fb4c7cc8 100644 --- a/veejay-current/veejay-server/veejay/vj-shm.c +++ b/veejay-current/veejay-server/veejay/vj-shm.c @@ -47,7 +47,6 @@ #define PATH_MAX 1024 #endif -#define RUP8(num)(((num)+8)&~8) typedef struct { int shm_id; void *sms; @@ -350,7 +349,7 @@ void *vj_shm_new_master( const char *homedir, VJFrame *frame) return NULL; } - size_t size = RUP8(HEADER_LENGTH + (frame->width * frame->height * 4)); + size_t size = (HEADER_LENGTH + (frame->width * frame->height * 4)); //@ create v->shm_id = shmget( v->key,size, IPC_CREAT |0666 ); diff --git a/veejay-current/veejay-server/veejay/vj-split.c b/veejay-current/veejay-server/veejay/vj-split.c index 9ad5f15c..c964bdb6 100644 --- a/veejay-current/veejay-server/veejay/vj-split.c +++ b/veejay-current/veejay-server/veejay/vj-split.c @@ -37,7 +37,6 @@ #include #include -#define RUP8(num)(((num)+8)&~8) #define LOCALHOST "127.0.0.1" #define SHM_ADDR_OFFSET 4096 @@ -337,7 +336,7 @@ static int vj_split_allocate_screen( void *ptr, int screen_id, int wid, int hei, return 0; } - box->data = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(dst->len*4)); + box->data = (uint8_t*) vj_malloc( sizeof(uint8_t) * (dst->len*4)); dst->data[0] = box->data; dst->data[1] = box->data + dst->len; diff --git a/veejay-current/veejay-server/veejay/vj-viewport.c b/veejay-current/veejay-server/veejay/vj-viewport.c index 447532b3..01b77b5d 100644 --- a/veejay-current/veejay-server/veejay/vj-viewport.c +++ b/veejay-current/veejay-server/veejay/vj-viewport.c @@ -60,8 +60,6 @@ #define MAX(a,b) ( (a)>(b) ? (a) : (b) ) #endif -#define RUP8(num)(((num)+8)&~8) - #define clamp1(x, y, z) ((x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))) #define distance1(x1,y1,x2,y2) ( sqrt( (x1 - x2) * (x1 - x2) + ( y1 - y2 ) * (y1 -y2 ) ) ) @@ -1798,7 +1796,7 @@ void *viewport_init(int x0, int y0, int w0, int h0, int w, int h, int iw, int ih v->m = NULL; v->grid = NULL; v->ui = vj_calloc( sizeof(ui_t)); - v->ui->buf[0] = vj_calloc(sizeof(uint8_t) * RUP8(w * h) ); + v->ui->buf[0] = vj_calloc(sizeof(uint8_t) * (w * h) ); v->ui->scale = 0.5f; v->ui->scaler = viewport_init_swscaler(v->ui,iw,ih); v->saved_w = w; @@ -1864,7 +1862,7 @@ void *viewport_init(int x0, int y0, int w0, int h0, int w, int h, int iw, int ih } // Allocate memory for map - v->map = (int32_t*) vj_calloc(sizeof(int32_t) * RUP8(v->w * v->h + (v->w*2)) ); + v->map = (int32_t*) vj_calloc(sizeof(int32_t) * (v->w * v->h + (v->w*2)) ); if(!v->map) { free(v->ui->buf[0]); free(v->ui); @@ -1917,7 +1915,7 @@ void *viewport_clone(void *vv, int new_w, int new_h ) q->usermouse[2] = 0.0; q->usermouse[3] = 0.0; q->ui = vj_calloc( sizeof(ui_t)); - q->ui->buf[0] = vj_calloc(sizeof(uint8_t) * RUP8(new_w * new_h) ); + q->ui->buf[0] = vj_calloc(sizeof(uint8_t) * (new_w * new_h) ); q->ui->scale = 1.0f; q->ui->scaler = viewport_init_swscaler(q->ui,new_w,new_h); q->disable = 0; @@ -1945,7 +1943,7 @@ void *viewport_clone(void *vv, int new_w, int new_h ) } // Allocate memory for map - q->map = (int32_t*) vj_malloc(sizeof(int32_t) * RUP8(q->w * q->h + (q->w*2)) ); + q->map = (int32_t*) vj_malloc(sizeof(int32_t) * (q->w * q->h + (q->w*2)) ); const int len = q->w * q->h; const int eln = len + ( q->w * 2 );