From e5ac37a5b84cedd06734d9348c3467729f81bd5d Mon Sep 17 00:00:00 2001 From: niels Date: Sun, 25 Nov 2012 08:29:07 +0100 Subject: [PATCH] fix reloaded build against newer ffmpeg, add large file support (avilib still limited to 4gb), workarround bug in lzo compressor, refactored all memcpy into (multithreaded) frame copy, refactored all memset into (multirheaded) frame clear, multithreaded super and sub sampling (only tested 4:2:2 ), added new mode to pencil sketch, fixed bug in lens correction, multithreaded 36 effects, updated minilzo to newer version, multhreaded yuv functions for format conversion and pixel scaling, multithreaded fx chain fader, multithreaded fx apply in libvje. Fix bug in encoder when recording in high resolution, --- veejay-current/veejay-client/src/sequence.c | 1 + veejay-current/veejay-client/src/vj-api.c | 1 + veejay-current/veejay-server/configure.ac | 5 +- veejay-current/veejay-server/libel/avilib.c | 19 +- veejay-current/veejay-server/libel/lav_io.c | 16 +- .../veejay-server/libel/vj-avcodec.c | 18 +- veejay-current/veejay-server/libel/vj-el.c | 27 +- veejay-current/veejay-server/liblzo/lzo.c | 35 +- veejay-current/veejay-server/liblzo/lzoconf.h | 83 +- veejay-current/veejay-server/liblzo/lzodefs.h | 179 ++- veejay-current/veejay-server/liblzo/minilzo.c | 1205 ++++++++++++----- veejay-current/veejay-server/liblzo/minilzo.h | 7 +- .../veejay-server/libplugger/livido-loader.c | 59 +- .../veejay-server/libsamplerec/samplerecord.c | 2 +- .../veejay-server/libstream/vj-tag.c | 3 - .../veejay-server/libvje/effects/autoeq.c | 6 +- .../veejay-server/libvje/effects/average.c | 1 + .../veejay-server/libvje/effects/bathroom.c | 11 +- .../veejay-server/libvje/effects/bgsubtract.c | 2 - .../libvje/effects/binaryoverlays.c | 1 + .../veejay-server/libvje/effects/bwselect.c | 2 +- .../veejay-server/libvje/effects/chameleon.c | 14 +- .../libvje/effects/chameleonblend.c | 7 +- .../veejay-server/libvje/effects/checker.c | 7 +- .../libvje/effects/chromamagick.c | 2 + .../libvje/effects/chromapalette.c | 4 +- .../veejay-server/libvje/effects/chromium.c | 3 +- .../libvje/effects/complexinvert.c | 2 +- .../libvje/effects/complexopacity.c | 3 +- .../libvje/effects/complexsync.c | 15 +- .../libvje/effects/complexthreshold.c | 4 +- .../libvje/effects/constantblend.c | 1 + .../libvje/effects/contourextract.c | 14 +- .../veejay-server/libvje/effects/contrast.c | 3 +- .../veejay-server/libvje/effects/crosspixel.c | 18 +- .../veejay-server/libvje/effects/dissolve.c | 1 + .../veejay-server/libvje/effects/dupmagic.c | 4 +- .../veejay-server/libvje/effects/flare.c | 7 +- .../veejay-server/libvje/effects/gamma.c | 3 +- .../veejay-server/libvje/effects/greyselect.c | 3 +- .../veejay-server/libvje/effects/isolate.c | 1 + .../veejay-server/libvje/effects/keyselect.c | 3 +- .../veejay-server/libvje/effects/killchroma.c | 2 +- .../veejay-server/libvje/effects/lumablend.c | 38 +- .../veejay-server/libvje/effects/lumamagick.c | 3 +- .../libvje/effects/magicmirror.c | 6 +- .../libvje/effects/magicoverlays.c | 9 +- .../veejay-server/libvje/effects/motionmap.c | 29 +- .../veejay-server/libvje/effects/mtracer.c | 1 + .../libvje/effects/negatechannel.c | 3 +- .../veejay-server/libvje/effects/negation.c | 1 + .../veejay-server/libvje/effects/neighbours.c | 8 +- .../libvje/effects/neighbours2.c | 7 +- .../libvje/effects/neighbours3.c | 7 +- .../libvje/effects/neighbours4.c | 8 +- .../libvje/effects/neighbours5.c | 8 +- .../veejay-server/libvje/effects/nervous.c | 22 +- .../veejay-server/libvje/effects/opacity.c | 67 +- .../veejay-server/libvje/effects/opacity.h | 2 +- .../veejay-server/libvje/effects/opacityadv.c | 3 +- .../libvje/effects/pencilsketch.c | 127 +- .../libvje/effects/pencilsketch.h | 2 +- .../veejay-server/libvje/effects/pixelate.c | 1 + .../veejay-server/libvje/effects/posterize.c | 3 +- .../veejay-server/libvje/effects/radcor.c | 17 +- .../veejay-server/libvje/effects/radialblur.c | 6 +- .../libvje/effects/radioactive.c | 8 +- .../veejay-server/libvje/effects/rawman.c | 1 + .../veejay-server/libvje/effects/rawval.c | 2 +- .../veejay-server/libvje/effects/rgbkey.c | 3 +- .../veejay-server/libvje/effects/rotozoom.c | 9 +- .../veejay-server/libvje/effects/scratcher.c | 72 +- .../veejay-server/libvje/effects/slice.c | 5 +- .../veejay-server/libvje/effects/solarize.c | 1 + .../veejay-server/libvje/effects/split.c | 52 +- .../veejay-server/libvje/effects/swirl.c | 6 +- .../veejay-server/libvje/effects/texmap.c | 8 +- .../libvje/effects/timedistort.c | 10 +- .../libvje/effects/tripplicity.c | 2 +- .../veejay-server/libvje/effects/water.c | 27 +- .../veejay-server/libvje/effects/whiteframe.c | 1 + .../veejay-server/libvje/effects/zoom.c | 5 +- .../veejay-server/libvje/internal.h | 2 +- .../veejay-server/libvje/vj-effect.c | 6 + .../veejay-server/libvje/vj-effman.c | 388 +++--- veejay-current/veejay-server/libvje/vje.h | 12 +- .../veejay-server/libvjmem/memcpy.c | 151 ++- veejay-current/veejay-server/libvjmem/vjmem.h | 6 +- .../veejay-server/libyuv/subsample.c | 403 +++--- veejay-current/veejay-server/libyuv/yuvconv.c | 103 +- veejay-current/veejay-server/libyuv/yuvconv.h | 13 +- .../veejay-server/veejay/liblavplayvj.c | 6 + .../veejay-server/veejay/vj-composite.c | 10 +- veejay-current/veejay-server/veejay/vj-misc.c | 6 +- veejay-current/veejay-server/veejay/vj-misc.h | 5 +- .../veejay-server/veejay/vj-perform.c | 136 +- veejay-current/veejay-server/veejay/vj-shm.c | 4 +- veejay-current/veejay-server/veejay/vj-task.c | 372 +++-- veejay-current/veejay-server/veejay/vj-task.h | 22 +- .../veejay-server/veejay/vj-viewport.c | 7 +- 100 files changed, 2556 insertions(+), 1490 deletions(-) diff --git a/veejay-current/veejay-client/src/sequence.c b/veejay-current/veejay-client/src/sequence.c index 1ea39b89..c395dac9 100644 --- a/veejay-current/veejay-client/src/sequence.c +++ b/veejay-current/veejay-client/src/sequence.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/veejay-current/veejay-client/src/vj-api.c b/veejay-current/veejay-client/src/vj-api.c index 64c9b179..6edb68b5 100644 --- a/veejay-current/veejay-client/src/vj-api.c +++ b/veejay-current/veejay-client/src/vj-api.c @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include diff --git a/veejay-current/veejay-server/configure.ac b/veejay-current/veejay-server/configure.ac index f18d2ea4..5d176d08 100644 --- a/veejay-current/veejay-server/configure.ac +++ b/veejay-current/veejay-server/configure.ac @@ -315,7 +315,7 @@ case $host_cpu in AC_DEFINE(ARCH_X86_64,1, [Compiling for x86-64 architecture CPU]) have_x86cpu=true have_x86_64cpu=true - CFLAGS="$CFLAGS -fPIC -DPIC" + CFLAGS="$CFLAGS -m64 -fPIC -DPIC" ;; powerpc | powerpc64) AC_DEFINE(HAVE_PPCCPU,, [Compiling for PowerPC CPU]) @@ -358,6 +358,9 @@ dnl CFLAGS="$CFLAGS -no-cpp-precomp" ;; esac +CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" + + dnl This flag is used for PROGRAMS not SHARED LIBRARIES. PIC code is required dnl for shared libraries but is slower than non-pic code. Compute bound dnl programs such as yuvdenoise and y4mspatialfilter can use this flag by diff --git a/veejay-current/veejay-server/libel/avilib.c b/veejay-current/veejay-server/libel/avilib.c index 9c77ca7e..82d7943e 100644 --- a/veejay-current/veejay-server/libel/avilib.c +++ b/veejay-current/veejay-server/libel/avilib.c @@ -123,10 +123,21 @@ static ssize_t avi_write (int fd, char *buf, size_t len) #define HEADERBYTES 2048 -/* AVI_MAX_LEN: The maximum length of an AVI file, we stay a bit below - the 2GB limit (Remember: 2*10^9 is smaller than 2 GB) */ +#ifdef _LARGEFILE_SOURCE +uint64_t AVI_MAX_LEN = LONG_MAX - HEADERBYTES; //@ not much larger, but a little. +#else +uint64_t AVI_MAX_LEN = (UINT_MAX-(1<<20)*16-HEADERBYTES); +#endif -#define AVI_MAX_LEN (UINT_MAX-(1<<20)*16-HEADERBYTES) +uint64_t AVI_set_MAX_LEN( uint64_t n ) +{ + AVI_MAX_LEN = n; +} + +uint64_t AVI_get_MAX_LEN() +{ + return AVI_MAX_LEN; +} #define PAD_EVEN(x) ( ((x)+1) & ~1 ) @@ -755,7 +766,7 @@ int AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format) int avi_update_header(avi_t *AVI) { int njunk, sampsize, hasIndex, ms_per_frame, frate, flag; - int movi_len, hdrl_start, strl_start, j; + unsigned long movi_len, hdrl_start, strl_start, j; unsigned char AVI_header[HEADERBYTES]; long nhb; unsigned long xd_size, xd_size_align2; diff --git a/veejay-current/veejay-server/libel/lav_io.c b/veejay-current/veejay-server/libel/lav_io.c index e9499835..8692ed11 100644 --- a/veejay-current/veejay-server/libel/lav_io.c +++ b/veejay-current/veejay-server/libel/lav_io.c @@ -629,10 +629,18 @@ int lav_write_frame(lav_file_t *lav_file, uint8_t *buff, long size, long count) case 'l': case 'd': if(n==0) - res = AVI_write_frame( lav_file->avi_fd, buff, size ); + { + res = AVI_write_frame( lav_file->avi_fd, buff, size ); + if( AVI_bytes_remain( lav_file->avi_fd ) < ( size * 50 ) ) { + veejay_msg(VEEJAY_MSG_WARNING, "Reaching AVI file limit soon! (%d - %d bytes)", + AVI_bytes_remain(lav_file->avi_fd), AVI_get_MAX_LEN() ); + } + } else - res = AVI_dup_frame( lav_file->avi_fd ); - break; + { + res = AVI_dup_frame( lav_file->avi_fd ); + } + break; #ifdef HAVE_LIBQUICKTIME case 'q': @@ -1199,7 +1207,7 @@ lav_file_t *lav_open_input_file(char *filename, int mmap_size) { int n; char *video_comp = NULL; - unsigned char *frame = NULL; /* Make sure un-init segfaults! */ + unsigned char *frame = NULL; long len; int jpg_height, jpg_width, ncomps, hf[3], vf[3]; int ierr; diff --git a/veejay-current/veejay-server/libel/vj-avcodec.c b/veejay-current/veejay-server/libel/vj-avcodec.c index 478e55d7..0f695dea 100644 --- a/veejay-current/veejay-server/libel/vj-avcodec.c +++ b/veejay-current/veejay-server/libel/vj-avcodec.c @@ -531,7 +531,7 @@ static int vj_avcodec_copy_frame( vj_encoder *av, uint8_t *src[3], uint8_t *dst if( av->encoder_id == 999 ) { uint8_t *dest[3] = { dst, dst + (av->len), dst + (av->len + av->len/4) }; - veejay_memcpy( dest[0], src[0], av->len ); + vj_frame_copy1(src[0], dest[0], av->len ); yuv422to420planar( src,dest, av->width,av->height ); if(in_fmt == FMT_422F ) @@ -545,7 +545,7 @@ static int vj_avcodec_copy_frame( vj_encoder *av, uint8_t *src[3], uint8_t *dst if( av->encoder_id == 996 ) { uint8_t *dest[3] = { dst, dst + (av->len), dst + (av->len + av->len/4) }; - veejay_memcpy( dest[0], src[0], av->len ); + vj_frame_copy1( src[0], dest[0], av->len ); yuv422to420planar( src,dest, av->width,av->height ); if(in_fmt == FMT_422 ) @@ -561,10 +561,8 @@ static int vj_avcodec_copy_frame( vj_encoder *av, uint8_t *src[3], uint8_t *dst if( av->encoder_id == 998 ) { uint8_t *dest[3] = { dst, dst + (av->len), dst + (av->len + av->uv_len) }; - - veejay_memcpy( dest[0], src[0],av->len ); - veejay_memcpy( dest[1], src[1],av->uv_len); - veejay_memcpy( dest[2], src[2],av->uv_len ); + int strides[4] = { av->len, av->uv_len, av->uv_len, 0 }; + vj_frame_copy( src, dest, strides ); if(in_fmt == FMT_422F ) { @@ -578,10 +576,8 @@ static int vj_avcodec_copy_frame( vj_encoder *av, uint8_t *src[3], uint8_t *dst if( av->encoder_id == 997 ) { uint8_t *dest[3] = { dst, dst + (av->len), dst + (av->len + av->uv_len) }; - - veejay_memcpy( dest[0], src[0],av->len ); - veejay_memcpy( dest[1], src[1],av->uv_len); - veejay_memcpy( dest[2], src[2],av->uv_len ); + int strides[4] = { av->len, av->uv_len,av->uv_len, 0 }; + vj_frame_copy( src, dest, strides ); if(in_fmt == FMT_422 ) { @@ -651,7 +647,7 @@ int vj_avcodec_encode_frame(void *encoder, int nframe,int format, uint8_t *src[ pict.linesize[2] = stride2; if( YUV420_ONLY_CODEC(av->encoder_id)) { - veejay_memcpy( av->data[0], src[0], av->width * av->height); + vj_frame_copy1(src[0],av->data[0], av->width * av->height); yuv422to420planar(src , av->data, av->width,av->height ); pict.data[0] = av->data[0]; pict.data[1] = av->data[1]; diff --git a/veejay-current/veejay-server/libel/vj-el.c b/veejay-current/veejay-server/libel/vj-el.c index 1edd0df5..867e7e80 100644 --- a/veejay-current/veejay-server/libel/vj-el.c +++ b/veejay-current/veejay-server/libel/vj-el.c @@ -257,7 +257,6 @@ typedef struct VJFrame *img; int fmt; int ref; - void *sampler; #ifdef SUPPORT_READ_DV2 vj_dv_decoder *dv_decoder; #endif @@ -317,9 +316,6 @@ static void _el_free_decoder( vj_decoder *d ) if(d->frame) free(d->frame); - if(d->sampler) - subsample_free(d->sampler); - if(d->img) free(d->img); @@ -472,7 +468,6 @@ vj_decoder *_el_new_decoder( int id , int width, int height, float fps, int pixe if( id == CODEC_ID_YUVLZO ) { d->lzo_decoder = lzo_new(); - d->sampler = subsample_init( width ); } else if( id != CODEC_ID_YUV422 && id != CODEC_ID_YUV420 && id != CODEC_ID_YUV420F && id != CODEC_ID_YUV422F) { d->codec = avcodec_find_decoder( id ); @@ -1142,9 +1137,8 @@ int vj_el_get_video_frame(editlist *el, long nframe, uint8_t *dst[3]) #ifdef STRICT_CHECKING assert( dst[0] != NULL && dst[1] != NULL && dst[2] != NULL ); #endif - veejay_memcpy( dst[0], srci->data[0], el_len_ ); - veejay_memcpy( dst[1], srci->data[1], el_uv_len_ ); - veejay_memcpy( dst[2], srci->data[2], el_uv_len_ ); + int strides[4] = { el_len_, el_uv_len_, el_uv_len_,0 }; + vj_frame_copy( srci->data, dst, strides ); return 1; } @@ -1177,11 +1171,12 @@ int vj_el_get_video_frame(editlist *el, long nframe, uint8_t *dst[3]) int got_picture = 0; int in_uv_len = 0; uint8_t *in[3] = { NULL,NULL,NULL }; - + int strides[4] = { el_len_, el_uv_len_, el_uv_len_ ,0}; + uint8_t *dataplanes[3] = { data , data + el_len_, data + el_len_ + el_uv_len_ }; switch( decoder_id ) { case CODEC_ID_YUV420: - veejay_memcpy( dst[0], data, el_len_); + vj_frame_copy1( data,dst[0], el_len_ ); in[0] = data; in[1] = data+el_len_ ; in[2] = data + el_len_ + (el_len_/4); if( el_pixel_format_ == FMT_422F ) { yuv_scale_pixels_from_ycbcr( in[0],16.0f,235.0f, el_len_ ); @@ -1191,7 +1186,7 @@ int vj_el_get_video_frame(editlist *el, long nframe, uint8_t *dst[3]) return 1; break; case CODEC_ID_YUV420F: - veejay_memcpy( dst[0], data, el_len_); + vj_frame_copy1( data, dst[0], el_len_); in[0] = data; in[1] = data + el_len_; in[2] = data + el_len_+(el_len_/4); if( el_pixel_format_ == FMT_422 ) { yuv_scale_pixels_from_y( dst[0], el_len_ ); @@ -1203,9 +1198,7 @@ int vj_el_get_video_frame(editlist *el, long nframe, uint8_t *dst[3]) return 1; break; case CODEC_ID_YUV422: - veejay_memcpy( dst[0], data, el_len_); - veejay_memcpy( dst[1], data+el_len_,el_uv_len_); - veejay_memcpy( dst[2], data+el_len_+el_uv_len_, el_uv_len_); + vj_frame_copy( dataplanes,dst,strides ); if( el_pixel_format_ == FMT_422F ) { yuv_scale_pixels_from_ycbcr( dst[0],16.0f,235.0f, el_len_ ); yuv_scale_pixels_from_ycbcr( dst[1],16.0f,240.0f, el_len_/2); @@ -1213,9 +1206,7 @@ int vj_el_get_video_frame(editlist *el, long nframe, uint8_t *dst[3]) return 1; break; case CODEC_ID_YUV422F: - veejay_memcpy( dst[0], data, el_len_); - veejay_memcpy( dst[1], data+el_len_,el_uv_len_); - veejay_memcpy( dst[2], data+el_len_+el_uv_len_, el_uv_len_); + vj_frame_copy( dataplanes, dst, strides ); if( el_pixel_format_ == FMT_422 ) { yuv_scale_pixels_from_y( dst[0], el_len_ ); yuv_scale_pixels_from_uv( dst[1], el_len_/2); @@ -2549,7 +2540,7 @@ int vj_el_framelist_clone( editlist *src, editlist *dst) dst->frame_list = (uint64_t*) vj_malloc(sizeof(uint64_t) * src->video_frames ); if(!dst->frame_list) return 0; - + veejay_memcpy( dst->frame_list, src->frame_list, diff --git a/veejay-current/veejay-server/liblzo/lzo.c b/veejay-current/veejay-server/liblzo/lzo.c index c6de22e3..4b27152a 100644 --- a/veejay-current/veejay-server/liblzo/lzo.c +++ b/veejay-current/veejay-server/liblzo/lzo.c @@ -97,8 +97,15 @@ int lzo_compress( void *lzo, uint8_t *src, uint8_t *plane, unsigned int *size, int r = lzo1x_1_compress( src, len, dst, dst_len, wrkmem ); if( r != LZO_E_OK ) return 0; + + if( dst[0] == 2 && src[1] == dst[1] && src[2] == dst[2] && src[3] == dst[3] && r == 0 ) { + veejay_msg(0 , "compression failed. Reported at http://bugs.dyne.org #353 "); + return 0; + } + return (*size); } + long lzo_decompress_el( void *lzo, uint8_t *linbuf, int linbuf_len, uint8_t *dst[3], int uv_len) { unsigned int i; @@ -113,6 +120,11 @@ long lzo_decompress_el( void *lzo, uint8_t *linbuf, int linbuf_len, uint8_t *ds len[2] = str2ulong( linbuf+8 ); mode = str2ulong( linbuf+12 ); + if(len[0] == 0 && len[1] == 0 ) { + veejay_msg(VEEJAY_MSG_DEBUG, "%s", linbuf ); + return -1; + } + if(len[1] ==0 && len[2] == 0 ) mode = 1; @@ -120,8 +132,8 @@ long lzo_decompress_el( void *lzo, uint8_t *linbuf, int linbuf_len, uint8_t *ds { if( len[i] <= 0 ) continue; - const lzo_bytep src = (lzo_bytep) (linbuf+offset); + veejay_msg(0, "decompressing plane %d, size %d to %p... (%d,%d,%d) off=%d", i, len[i], linbuf+offset,len[0],len[1],len[2],offset ); int r = lzo1x_decompress( src, len[i], dst[i], &result_len, l->wrkmem ); if( r != LZO_E_OK ) return 0; @@ -132,8 +144,8 @@ long lzo_decompress_el( void *lzo, uint8_t *linbuf, int linbuf_len, uint8_t *ds } if(mode == 1) { - veejay_memset( dst[1],128, uv_len ); - veejay_memset( dst[2],128, uv_len ); + vj_frame_clear1( dst[1],128, uv_len ); + vj_frame_clear1( dst[2],128, uv_len ); } return (long)sum; @@ -183,8 +195,8 @@ long lzo_decompress( void *lzo, uint8_t *linbuf, int linbuf_len, uint8_t *dst[3 } if(mode == 1) { - veejay_memset( dst[1],128, uv_len ); - veejay_memset( dst[2],128, uv_len ); + vj_frame_clear1( dst[1],128, uv_len ); + vj_frame_clear1( dst[2],128, uv_len ); } return (long)sum; @@ -246,10 +258,10 @@ long lzo_decompress422into420( void *lzo, uint8_t *linbuf, int linbuf_len, uint offset += len[i]; } - veejay_memcpy( dst[0], l->tmp[0], w*h); + vj_frame_copy1( l->tmp[0], dst[0], w*h); if( mode == 1 ) { - veejay_memset(dst[1],128,( (w>>1)*h)); - veejay_memset(dst[2],128,( (w>>1)*h)); + vj_frame_clear1(dst[1],128,( (w>>1)*h)); + vj_frame_clear1(dst[2],128,( (w>>1)*h)); } else { yuv422to420planar( l->tmp, dst, w, h ); } @@ -287,10 +299,11 @@ long lzo_decompress420into422( void *lzo, uint8_t *linbuf, int linbuf_len, uint sum += result_len; offset += len[i]; } - veejay_memcpy( dst[0], l->tmp[0], w*h); + + vj_frame_copy1( l->tmp[0], dst[0], w*h); if(mode == 1) { - veejay_memset(dst[1],128,( (w>>1)*h)); - veejay_memset(dst[2],128,( (w>>1)*h)); + vj_frame_clear1(dst[1],128,( (w>>1)*h)); + vj_frame_clear1(dst[2],128,( (w>>1)*h)); } else { yuv420to422planar( l->tmp, dst, w, h ); diff --git a/veejay-current/veejay-server/liblzo/lzoconf.h b/veejay-current/veejay-server/liblzo/lzoconf.h index 614efa1f..23c6ca93 100644 --- a/veejay-current/veejay-server/liblzo/lzoconf.h +++ b/veejay-current/veejay-server/liblzo/lzoconf.h @@ -1,7 +1,10 @@ -/* lzoconf.h -- configuration for the LZO real-time data compression library +/* lzoconf.h -- configuration of the LZO data compression library This file is part of the LZO real-time data compression library. + Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer @@ -39,14 +42,16 @@ #ifndef __LZOCONF_H_INCLUDED -#define __LZOCONF_H_INCLUDED +#define __LZOCONF_H_INCLUDED 1 -#define LZO_VERSION 0x2030 -#define LZO_VERSION_STRING "2.03" -#define LZO_VERSION_DATE "Apr 30 2008" +#define LZO_VERSION 0x2060 +#define LZO_VERSION_STRING "2.06" +#define LZO_VERSION_DATE "Aug 12 2011" /* internal Autoconf configuration file - only used when building LZO */ -#include +#if defined(LZO_HAVE_CONFIG_H) +# include +#endif #include #include @@ -155,6 +160,27 @@ extern "C" { # endif #endif +/* Integral types with exactly 64 bits. */ +#if !defined(LZO_UINT64_MAX) +# if (LZO_UINT_MAX >= LZO_0xffffffffL) +# if ((((LZO_UINT_MAX) >> 31) >> 31) == 3) +# define lzo_uint64 lzo_uint +# define lzo_int64 lzo_int +# define LZO_UINT64_MAX LZO_UINT_MAX +# define LZO_INT64_MAX LZO_INT_MAX +# define LZO_INT64_MIN LZO_INT_MIN +# endif +# elif (ULONG_MAX >= LZO_0xffffffffL) +# if ((((ULONG_MAX) >> 31) >> 31) == 3) + typedef unsigned long lzo_uint64; + typedef long lzo_int64; +# define LZO_UINT64_MAX ULONG_MAX +# define LZO_INT64_MAX LONG_MAX +# define LZO_INT64_MIN LONG_MIN +# endif +# endif +#endif + /* The larger type of lzo_uint and lzo_uint32. */ #if (LZO_UINT_MAX >= LZO_UINT32_MAX) # define lzo_xint lzo_uint @@ -165,12 +191,12 @@ extern "C" { /* Memory model that allows to access memory at offsets of lzo_uint. */ #if !defined(__LZO_MMODEL) # if (LZO_UINT_MAX <= UINT_MAX) -# define __LZO_MMODEL +# define __LZO_MMODEL /*empty*/ # elif defined(LZO_HAVE_MM_HUGE_PTR) # define __LZO_MMODEL_HUGE 1 # define __LZO_MMODEL __huge # else -# define __LZO_MMODEL +# define __LZO_MMODEL /*empty*/ # endif #endif @@ -182,12 +208,16 @@ extern "C" { #define lzo_ushortp unsigned short __LZO_MMODEL * #define lzo_uint32p lzo_uint32 __LZO_MMODEL * #define lzo_int32p lzo_int32 __LZO_MMODEL * +#if defined(LZO_UINT64_MAX) +#define lzo_uint64p lzo_uint64 __LZO_MMODEL * +#define lzo_int64p lzo_int64 __LZO_MMODEL * +#endif #define lzo_uintp lzo_uint __LZO_MMODEL * #define lzo_intp lzo_int __LZO_MMODEL * #define lzo_xintp lzo_xint __LZO_MMODEL * #define lzo_voidpp lzo_voidp __LZO_MMODEL * #define lzo_bytepp lzo_bytep __LZO_MMODEL * -/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */ +/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */ #define lzo_byte unsigned char __LZO_MMODEL typedef int lzo_bool; @@ -213,10 +243,10 @@ typedef int lzo_bool; /* DLL export information */ #if !defined(__LZO_EXPORT1) -# define __LZO_EXPORT1 +# define __LZO_EXPORT1 /*empty*/ #endif #if !defined(__LZO_EXPORT2) -# define __LZO_EXPORT2 +# define __LZO_EXPORT2 /*empty*/ #endif /* __cdecl calling convention for public C and assembly functions */ @@ -304,7 +334,7 @@ struct lzo_callback_t */ #define LZO_E_OK 0 #define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */ +#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */ #define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ #define LZO_E_INPUT_OVERRUN (-4) #define LZO_E_OUTPUT_OVERRUN (-5) @@ -312,6 +342,7 @@ struct lzo_callback_t #define LZO_E_EOF_NOT_FOUND (-7) #define LZO_E_INPUT_NOT_CONSUMED (-8) #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ +#define LZO_E_INVALID_ARGUMENT (-10) #ifndef lzo_sizeof_dict_t @@ -339,32 +370,32 @@ LZO_EXTERN(const lzo_charp) _lzo_version_date(void); /* string functions */ LZO_EXTERN(int) -lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len); + lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len); LZO_EXTERN(lzo_voidp) -lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); + lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len); LZO_EXTERN(lzo_voidp) -lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); + lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len); LZO_EXTERN(lzo_voidp) -lzo_memset(lzo_voidp _s, int _c, lzo_uint _len); + lzo_memset(lzo_voidp buf, int c, lzo_uint len); /* checksum functions */ LZO_EXTERN(lzo_uint32) -lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len); + lzo_adler32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len); LZO_EXTERN(lzo_uint32) -lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len); + lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len); LZO_EXTERN(const lzo_uint32p) -lzo_get_crc32_table(void); + lzo_get_crc32_table(void); /* misc. */ LZO_EXTERN(int) _lzo_config_check(void); typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; -typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t; +typedef union { void *vp; lzo_bytep bp; lzo_uint u; lzo_uint32 u32; unsigned long l; } lzo_align_t; -/* align a char pointer on a boundary that is a multiple of `size' */ -LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); -#define LZO_PTR_ALIGN_UP(_ptr,_size) \ - ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) +/* align a char pointer on a boundary that is a multiple of 'size' */ +LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size); +#define LZO_PTR_ALIGN_UP(p,size) \ + ((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size))) /*********************************************************************** @@ -393,8 +424,8 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); # define __LZO_WIN 1 #endif -#define __LZO_CMODEL -#define __LZO_DMODEL +#define __LZO_CMODEL /*empty*/ +#define __LZO_DMODEL /*empty*/ #define __LZO_ENTRY __LZO_CDECL #define LZO_EXTERN_CDECL LZO_EXTERN #define LZO_ALIGN LZO_PTR_ALIGN_UP diff --git a/veejay-current/veejay-server/liblzo/lzodefs.h b/veejay-current/veejay-server/liblzo/lzodefs.h index 18056372..0e40e332 100644 --- a/veejay-current/veejay-server/liblzo/lzodefs.h +++ b/veejay-current/veejay-server/liblzo/lzodefs.h @@ -2,6 +2,9 @@ This file is part of the LZO real-time data compression library. + Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer @@ -121,7 +124,7 @@ #endif #if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) # define ptrdiff_t long -# define _PTRDIFF_T_DEFINED +# define _PTRDIFF_T_DEFINED 1 #endif #if (UINT_MAX == LZO_0xffffL) # undef __LZO_RENAME_A @@ -265,9 +268,9 @@ # define LZO_EXTERN_C extern #endif #if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) +#if (LZO_OS_FREESTANDING) # define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) +#elif (LZO_OS_EMBEDDED) # define LZO_INFO_OS "embedded" #elif 1 && defined(__IAR_SYSTEMS_ICC__) # define LZO_OS_EMBEDDED 1 @@ -476,12 +479,27 @@ # define LZO_CC_PELLESC 1 # define LZO_INFO_CC "Pelles C" # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) +#elif defined(__clang__) && defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# if defined(__GNUC_PATCHLEVEL__) +# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) # else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) +# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) # endif +# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) +# define LZO_CC_CLANG_CLANG (__clang_major__ * 0x10000L + __clang_minor__ * 0x100 + __clang_patchlevel__) +# else +# define LZO_CC_CLANG_CLANG 0x010000L +# endif +# define LZO_CC_CLANG LZO_CC_CLANG_GNUC +# define LZO_INFO_CC "clang" +# define LZO_INFO_CCVER __VERSION__ +#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# if defined(__GNUC_PATCHLEVEL__) +# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) +# else +# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) +# endif +# define LZO_CC_LLVM LZO_CC_LLVM_GNUC # define LZO_INFO_CC "llvm-gcc" # define LZO_INFO_CCVER __VERSION__ #elif defined(__GNUC__) && defined(__VERSION__) @@ -502,6 +520,10 @@ # define LZO_CC_AZTECC 1 # define LZO_INFO_CC "Aztec C" # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) +#elif defined(__CODEGEARC__) +# define LZO_CC_CODEGEARC 1 +# define LZO_INFO_CC "CodeGear C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CODEGEARC__) #elif defined(__BORLANDC__) # define LZO_CC_BORLANDC 1 # define LZO_INFO_CC "Borland C" @@ -632,7 +654,7 @@ #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) # error "LZO_CC_MSC: _MSC_FULL_VER is not defined" #endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) +#if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY) # if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) # if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) # define LZO_ARCH_CRAY_MPP 1 @@ -642,7 +664,7 @@ # endif #endif #if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) +#if (LZO_ARCH_GENERIC) # define LZO_INFO_ARCH "generic" #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) # define LZO_ARCH_I086 1 @@ -677,6 +699,9 @@ #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) # define LZO_ARCH_AVR 1 # define LZO_INFO_ARCH "avr" +#elif defined(__avr32__) || defined(__AVR32__) +# define LZO_ARCH_AVR32 1 +# define LZO_INFO_ARCH "avr32" #elif defined(__bfin__) # define LZO_ARCH_BLACKFIN 1 # define LZO_INFO_ARCH "blackfin" @@ -799,10 +824,10 @@ # define LZO_ARCH_I086PM 1 # define LZO_ARCH_IA16PM 1 #endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) +#if (LZO_ARCH_ARM_THUMB) && !(LZO_ARCH_ARM) # error "this should not happen" #endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) +#if (LZO_ARCH_I086PM) && !(LZO_ARCH_I086) # error "this should not happen" #endif #if (LZO_ARCH_I086) @@ -875,7 +900,7 @@ #elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) # undef LZO_HAVE_MM_HUGE_ARRAY #endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) +#if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) # if (LZO_OS_DOS16) # error "this should not happen" # elif (LZO_CC_ZORTECHC) @@ -1091,7 +1116,7 @@ extern "C" { #if (LZO_ARCH_I086 && LZO_CC_DMC) #elif (LZO_CC_CILLY) && defined(__GNUC__) # define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define LZO_SIZEOF_LONG_LONG 8 #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) # define LZO_SIZEOF_LONG_LONG 8 @@ -1125,12 +1150,12 @@ extern "C" { #endif #endif #endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) +#if defined(__cplusplus) && (LZO_CC_GNUC) # if (LZO_CC_GNUC < 0x020800ul) # undef LZO_SIZEOF_LONG_LONG # endif #endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) +#if (LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) # undef LZO_SIZEOF_LONG_LONG #endif #if !defined(LZO_SIZEOF_VOID_P) @@ -1229,15 +1254,17 @@ extern "C" { # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T #endif #endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) +#if (LZO_ABI_NEUTRAL_ENDIAN) # undef LZO_ABI_BIG_ENDIAN # undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) +#elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN) #if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) # define LZO_ABI_BIG_ENDIAN 1 +#elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64) +# define LZO_ABI_LITTLE_ENDIAN 1 #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) # define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) +#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390) # define LZO_ABI_BIG_ENDIAN 1 #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) # if (__LITTLE_ENDIAN__ == 1) @@ -1259,14 +1286,14 @@ extern "C" { # define LZO_ABI_LITTLE_ENDIAN 1 #endif #endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) +#if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) # error "this should not happen" #endif -#if defined(LZO_ABI_BIG_ENDIAN) +#if (LZO_ABI_BIG_ENDIAN) # define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) +#elif (LZO_ABI_LITTLE_ENDIAN) # define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) +#elif (LZO_ABI_NEUTRAL_ENDIAN) # define LZO_INFO_ABI_ENDIAN "neutral" #endif #if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) @@ -1292,15 +1319,15 @@ extern "C" { # define LZO_INFO_ABI_PM "ip32l64" #endif #if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) +#if (LZO_LIBC_NAKED) # define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) +#elif (LZO_LIBC_FREESTANDING) # define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) +#elif (LZO_LIBC_MOSTLY_FREESTANDING) # define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) +#elif (LZO_LIBC_ISOC90) # define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) +#elif (LZO_LIBC_ISOC99) # define LZO_INFO_LIBC "isoc99" #elif defined(__dietlibc__) # define LZO_LIBC_DIETLIBC 1 @@ -1332,22 +1359,24 @@ extern "C" { #if !defined(__lzo_gnuc_extension__) #if (LZO_CC_GNUC >= 0x020800ul) # define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_gnuc_extension__ __extension__ #else -# define __lzo_gnuc_extension__ +# define __lzo_gnuc_extension__ /*empty*/ #endif #endif #if !defined(__lzo_ua_volatile) # define __lzo_ua_volatile volatile #endif #if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +#if (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) # define __lzo_alignof(e) __alignof__(e) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) # define __lzo_alignof(e) __alignof__(e) #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) # define __lzo_alignof(e) __alignof(e) +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_alignof(e) __alignof__(e) #endif #endif #if defined(__lzo_alignof) @@ -1358,7 +1387,7 @@ extern "C" { # define __lzo_constructor __attribute__((__constructor__,__used__)) #elif (LZO_CC_GNUC >= 0x020700ul) # define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_constructor __attribute__((__constructor__)) #endif #endif @@ -1370,14 +1399,14 @@ extern "C" { # define __lzo_destructor __attribute__((__destructor__,__used__)) #elif (LZO_CC_GNUC >= 0x020700ul) # define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_destructor __attribute__((__destructor__)) #endif #endif #if defined(__lzo_destructor) # define __lzo_HAVE_destructor 1 #endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) +#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) # error "this should not happen" #endif #if !defined(__lzo_inline) @@ -1386,7 +1415,7 @@ extern "C" { # define __lzo_inline inline #elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) # define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) # define __lzo_inline __inline__ #elif (LZO_CC_DMC) # define __lzo_inline __inline @@ -1396,6 +1425,8 @@ extern "C" { # define __lzo_inline __inline #elif (LZO_CC_MSC && (_MSC_VER >= 900)) # define __lzo_inline __inline +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_inline __inline__ #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) # define __lzo_inline inline #endif @@ -1403,7 +1434,7 @@ extern "C" { #if defined(__lzo_inline) # define __lzo_HAVE_inline 1 #else -# define __lzo_inline +# define __lzo_inline /*empty*/ #endif #if !defined(__lzo_forceinline) #if (LZO_CC_GNUC >= 0x030200ul) @@ -1412,16 +1443,18 @@ extern "C" { # define __lzo_forceinline __forceinline #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) # define __lzo_forceinline __forceinline +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) #endif #endif #if defined(__lzo_forceinline) # define __lzo_HAVE_forceinline 1 #else -# define __lzo_forceinline +# define __lzo_forceinline /*empty*/ #endif #if !defined(__lzo_noinline) #if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) @@ -1432,7 +1465,7 @@ extern "C" { # define __lzo_noinline __declspec(noinline) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) # define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_noinline __attribute__((__noinline__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) # define __lzo_noinline __declspec(noinline) @@ -1441,14 +1474,16 @@ extern "C" { # else # define __lzo_noinline __declspec(noinline) # endif +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_noinline __attribute__((__noinline__)) #endif #endif #if defined(__lzo_noinline) # define __lzo_HAVE_noinline 1 #else -# define __lzo_noinline +# define __lzo_noinline /*empty*/ #endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) +#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) # error "this should not happen" #endif #if !defined(__lzo_noreturn) @@ -1458,7 +1493,7 @@ extern "C" { # define __lzo_noreturn __declspec(noreturn) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) # define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_noreturn __attribute__((__noreturn__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) # define __lzo_noreturn __declspec(noreturn) @@ -1467,16 +1502,16 @@ extern "C" { #if defined(__lzo_noreturn) # define __lzo_HAVE_noreturn 1 #else -# define __lzo_noreturn +# define __lzo_noreturn /*empty*/ #endif #if !defined(__lzo_nothrow) #if (LZO_CC_GNUC >= 0x030300ul) # define __lzo_nothrow __attribute__((__nothrow__)) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) # define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) +#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 900) && LZO_CC_SYNTAX_GNUC) # define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_nothrow __attribute__((__nothrow__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) # define __lzo_nothrow __declspec(nothrow) @@ -1485,14 +1520,14 @@ extern "C" { #if defined(__lzo_nothrow) # define __lzo_HAVE_nothrow 1 #else -# define __lzo_nothrow +# define __lzo_nothrow /*empty*/ #endif #if !defined(__lzo_restrict) #if (LZO_CC_GNUC >= 0x030400ul) # define __lzo_restrict __restrict__ #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) # define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) +#elif (LZO_CC_CLANG || LZO_CC_LLVM) # define __lzo_restrict __restrict__ #elif (LZO_CC_MSC && (_MSC_VER >= 1400)) # define __lzo_restrict __restrict @@ -1501,7 +1536,7 @@ extern "C" { #if defined(__lzo_restrict) # define __lzo_HAVE_restrict 1 #else -# define __lzo_restrict +# define __lzo_restrict /*empty*/ #endif #if !defined(__lzo_likely) && !defined(__lzo_unlikely) #if (LZO_CC_GNUC >= 0x030200ul) @@ -1510,7 +1545,7 @@ extern "C" { #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) # define __lzo_likely(e) (__builtin_expect(!!(e),1)) # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_likely(e) (__builtin_expect(!!(e),1)) # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) #endif @@ -1530,7 +1565,7 @@ extern "C" { # define LZO_UNUSED(var) ((void) &var) # elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) # define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define LZO_UNUSED(var) ((void) var) # elif (LZO_CC_MSC && (_MSC_VER < 900)) # define LZO_UNUSED(var) if (&var) ; else @@ -1549,7 +1584,7 @@ extern "C" { # define LZO_UNUSED_FUNC(func) ((void) func) # elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) # define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) +# elif (LZO_CC_CLANG || LZO_CC_LLVM) # define LZO_UNUSED_FUNC(func) ((void) &func) # elif (LZO_CC_MSC && (_MSC_VER < 900)) # define LZO_UNUSED_FUNC(func) if (func) ; else @@ -1564,7 +1599,7 @@ extern "C" { #if !defined(LZO_UNUSED_LABEL) # if (LZO_CC_WATCOMC) && defined(__cplusplus) # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) +# elif (LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) # define LZO_UNUSED_LABEL(l) if (0) goto l # else # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l @@ -1579,6 +1614,15 @@ extern "C" { # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init # endif #endif +#if !defined(LZO_UNCONST_CAST) +# if 0 && defined(__cplusplus) +# define LZO_UNCONST_CAST(t,e) (const_cast (e)) +# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((lzo_uintptr_t) ((const void *) (e)))))) +# else +# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((const void *) (e))))) +# endif +#endif #if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) # if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; @@ -1607,7 +1651,7 @@ extern "C" { # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) # elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) # define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit +# define __lzo_cdecl_atexit /*empty*/ # define __lzo_cdecl_main __cdecl # if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) # define __lzo_cdecl_qsort __pascal @@ -1648,24 +1692,24 @@ extern "C" { # define __lzo_cdecl cdecl #endif #if !defined(__lzo_cdecl) -# define __lzo_cdecl +# define __lzo_cdecl /*empty*/ #endif #if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit +# define __lzo_cdecl_atexit /*empty*/ #endif #if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main +# define __lzo_cdecl_main /*empty*/ #endif #if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort +# define __lzo_cdecl_qsort /*empty*/ #endif #if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler +# define __lzo_cdecl_sighandler /*empty*/ #endif #if !defined(__lzo_cdecl_va) # define __lzo_cdecl_va __lzo_cdecl #endif -#if !defined(LZO_CFG_NO_WINDOWS_H) +#if !(LZO_CFG_NO_WINDOWS_H) #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) # if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) # elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) @@ -1711,7 +1755,7 @@ extern "C" { #elif (LZO_ARCH_POWERPC) # define LZO_OPT_PREFER_PREINC 1 # define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) +# if (LZO_ABI_BIG_ENDIAN) # define LZO_OPT_UNALIGNED16 1 # define LZO_OPT_UNALIGNED32 1 # endif @@ -1725,28 +1769,29 @@ extern "C" { # define LZO_OPT_PREFER_POSTINC 1 # define LZO_OPT_PREFER_PREDEC 1 #endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) +#ifndef LZO_CFG_NO_INLINE_ASM +#if (LZO_CC_LLVM) # define LZO_CFG_NO_INLINE_ASM 1 #endif #endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) +#ifndef LZO_CFG_NO_UNALIGNED +#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) # define LZO_CFG_NO_UNALIGNED 1 #endif #endif -#if defined(LZO_CFG_NO_UNALIGNED) +#if (LZO_CFG_NO_UNALIGNED) # undef LZO_OPT_UNALIGNED16 # undef LZO_OPT_UNALIGNED32 # undef LZO_OPT_UNALIGNED64 #endif -#if defined(LZO_CFG_NO_INLINE_ASM) +#if (LZO_CFG_NO_INLINE_ASM) #elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) # define LZO_ASM_SYNTAX_MSC 1 #elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) +#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) +#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) # define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) +#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) # define LZO_ASM_SYNTAX_GNUC 1 #endif #if (LZO_ASM_SYNTAX_GNUC) diff --git a/veejay-current/veejay-server/liblzo/minilzo.c b/veejay-current/veejay-server/liblzo/minilzo.c index 6a62b31b..34ce0f09 100644 --- a/veejay-current/veejay-server/liblzo/minilzo.c +++ b/veejay-current/veejay-server/liblzo/minilzo.c @@ -2,6 +2,9 @@ This file is part of the LZO real-time data compression library. + Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer @@ -43,8 +46,7 @@ * http://www.oberhumer.com/opensource/lzo/ */ -#define __LZO_IN_MINILZO -#define LZO_BUILD +#define __LZO_IN_MINILZO 1 #if defined(LZO_CFG_FREESTANDING) # undef MINILZO_HAVE_CONFIG_H @@ -142,7 +144,7 @@ #endif #if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) # define ptrdiff_t long -# define _PTRDIFF_T_DEFINED +# define _PTRDIFF_T_DEFINED 1 #endif #if (UINT_MAX == LZO_0xffffL) # undef __LZO_RENAME_A @@ -286,9 +288,9 @@ # define LZO_EXTERN_C extern #endif #if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) +#if (LZO_OS_FREESTANDING) # define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) +#elif (LZO_OS_EMBEDDED) # define LZO_INFO_OS "embedded" #elif 1 && defined(__IAR_SYSTEMS_ICC__) # define LZO_OS_EMBEDDED 1 @@ -497,12 +499,27 @@ # define LZO_CC_PELLESC 1 # define LZO_INFO_CC "Pelles C" # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) +#elif defined(__clang__) && defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# if defined(__GNUC_PATCHLEVEL__) +# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) # else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) +# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) # endif +# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) +# define LZO_CC_CLANG_CLANG (__clang_major__ * 0x10000L + __clang_minor__ * 0x100 + __clang_patchlevel__) +# else +# define LZO_CC_CLANG_CLANG 0x010000L +# endif +# define LZO_CC_CLANG LZO_CC_CLANG_GNUC +# define LZO_INFO_CC "clang" +# define LZO_INFO_CCVER __VERSION__ +#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# if defined(__GNUC_PATCHLEVEL__) +# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) +# else +# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) +# endif +# define LZO_CC_LLVM LZO_CC_LLVM_GNUC # define LZO_INFO_CC "llvm-gcc" # define LZO_INFO_CCVER __VERSION__ #elif defined(__GNUC__) && defined(__VERSION__) @@ -523,6 +540,10 @@ # define LZO_CC_AZTECC 1 # define LZO_INFO_CC "Aztec C" # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) +#elif defined(__CODEGEARC__) +# define LZO_CC_CODEGEARC 1 +# define LZO_INFO_CC "CodeGear C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CODEGEARC__) #elif defined(__BORLANDC__) # define LZO_CC_BORLANDC 1 # define LZO_INFO_CC "Borland C" @@ -653,7 +674,7 @@ #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) # error "LZO_CC_MSC: _MSC_FULL_VER is not defined" #endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) +#if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY) # if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) # if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) # define LZO_ARCH_CRAY_MPP 1 @@ -663,7 +684,7 @@ # endif #endif #if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) +#if (LZO_ARCH_GENERIC) # define LZO_INFO_ARCH "generic" #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) # define LZO_ARCH_I086 1 @@ -698,6 +719,9 @@ #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) # define LZO_ARCH_AVR 1 # define LZO_INFO_ARCH "avr" +#elif defined(__avr32__) || defined(__AVR32__) +# define LZO_ARCH_AVR32 1 +# define LZO_INFO_ARCH "avr32" #elif defined(__bfin__) # define LZO_ARCH_BLACKFIN 1 # define LZO_INFO_ARCH "blackfin" @@ -820,10 +844,10 @@ # define LZO_ARCH_I086PM 1 # define LZO_ARCH_IA16PM 1 #endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) +#if (LZO_ARCH_ARM_THUMB) && !(LZO_ARCH_ARM) # error "this should not happen" #endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) +#if (LZO_ARCH_I086PM) && !(LZO_ARCH_I086) # error "this should not happen" #endif #if (LZO_ARCH_I086) @@ -896,7 +920,7 @@ #elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) # undef LZO_HAVE_MM_HUGE_ARRAY #endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) +#if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) # if (LZO_OS_DOS16) # error "this should not happen" # elif (LZO_CC_ZORTECHC) @@ -1112,7 +1136,7 @@ extern "C" { #if (LZO_ARCH_I086 && LZO_CC_DMC) #elif (LZO_CC_CILLY) && defined(__GNUC__) # define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define LZO_SIZEOF_LONG_LONG 8 #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) # define LZO_SIZEOF_LONG_LONG 8 @@ -1146,12 +1170,12 @@ extern "C" { #endif #endif #endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) +#if defined(__cplusplus) && (LZO_CC_GNUC) # if (LZO_CC_GNUC < 0x020800ul) # undef LZO_SIZEOF_LONG_LONG # endif #endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) +#if (LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) # undef LZO_SIZEOF_LONG_LONG #endif #if !defined(LZO_SIZEOF_VOID_P) @@ -1250,15 +1274,17 @@ extern "C" { # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T #endif #endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) +#if (LZO_ABI_NEUTRAL_ENDIAN) # undef LZO_ABI_BIG_ENDIAN # undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) +#elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN) #if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) # define LZO_ABI_BIG_ENDIAN 1 +#elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64) +# define LZO_ABI_LITTLE_ENDIAN 1 #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) # define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) +#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390) # define LZO_ABI_BIG_ENDIAN 1 #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) # if (__LITTLE_ENDIAN__ == 1) @@ -1280,14 +1306,14 @@ extern "C" { # define LZO_ABI_LITTLE_ENDIAN 1 #endif #endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) +#if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) # error "this should not happen" #endif -#if defined(LZO_ABI_BIG_ENDIAN) +#if (LZO_ABI_BIG_ENDIAN) # define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) +#elif (LZO_ABI_LITTLE_ENDIAN) # define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) +#elif (LZO_ABI_NEUTRAL_ENDIAN) # define LZO_INFO_ABI_ENDIAN "neutral" #endif #if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) @@ -1313,15 +1339,15 @@ extern "C" { # define LZO_INFO_ABI_PM "ip32l64" #endif #if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) +#if (LZO_LIBC_NAKED) # define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) +#elif (LZO_LIBC_FREESTANDING) # define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) +#elif (LZO_LIBC_MOSTLY_FREESTANDING) # define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) +#elif (LZO_LIBC_ISOC90) # define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) +#elif (LZO_LIBC_ISOC99) # define LZO_INFO_LIBC "isoc99" #elif defined(__dietlibc__) # define LZO_LIBC_DIETLIBC 1 @@ -1353,22 +1379,24 @@ extern "C" { #if !defined(__lzo_gnuc_extension__) #if (LZO_CC_GNUC >= 0x020800ul) # define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_gnuc_extension__ __extension__ #else -# define __lzo_gnuc_extension__ +# define __lzo_gnuc_extension__ /*empty*/ #endif #endif #if !defined(__lzo_ua_volatile) # define __lzo_ua_volatile volatile #endif #if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +#if (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) # define __lzo_alignof(e) __alignof__(e) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) # define __lzo_alignof(e) __alignof__(e) #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) # define __lzo_alignof(e) __alignof(e) +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_alignof(e) __alignof__(e) #endif #endif #if defined(__lzo_alignof) @@ -1379,7 +1407,7 @@ extern "C" { # define __lzo_constructor __attribute__((__constructor__,__used__)) #elif (LZO_CC_GNUC >= 0x020700ul) # define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_constructor __attribute__((__constructor__)) #endif #endif @@ -1391,14 +1419,14 @@ extern "C" { # define __lzo_destructor __attribute__((__destructor__,__used__)) #elif (LZO_CC_GNUC >= 0x020700ul) # define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_destructor __attribute__((__destructor__)) #endif #endif #if defined(__lzo_destructor) # define __lzo_HAVE_destructor 1 #endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) +#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) # error "this should not happen" #endif #if !defined(__lzo_inline) @@ -1407,7 +1435,7 @@ extern "C" { # define __lzo_inline inline #elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) # define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) # define __lzo_inline __inline__ #elif (LZO_CC_DMC) # define __lzo_inline __inline @@ -1417,6 +1445,8 @@ extern "C" { # define __lzo_inline __inline #elif (LZO_CC_MSC && (_MSC_VER >= 900)) # define __lzo_inline __inline +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_inline __inline__ #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) # define __lzo_inline inline #endif @@ -1424,7 +1454,7 @@ extern "C" { #if defined(__lzo_inline) # define __lzo_HAVE_inline 1 #else -# define __lzo_inline +# define __lzo_inline /*empty*/ #endif #if !defined(__lzo_forceinline) #if (LZO_CC_GNUC >= 0x030200ul) @@ -1433,16 +1463,18 @@ extern "C" { # define __lzo_forceinline __forceinline #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) # define __lzo_forceinline __forceinline +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) #endif #endif #if defined(__lzo_forceinline) # define __lzo_HAVE_forceinline 1 #else -# define __lzo_forceinline +# define __lzo_forceinline /*empty*/ #endif #if !defined(__lzo_noinline) #if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) @@ -1453,7 +1485,7 @@ extern "C" { # define __lzo_noinline __declspec(noinline) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) # define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_noinline __attribute__((__noinline__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) # define __lzo_noinline __declspec(noinline) @@ -1462,14 +1494,16 @@ extern "C" { # else # define __lzo_noinline __declspec(noinline) # endif +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_noinline __attribute__((__noinline__)) #endif #endif #if defined(__lzo_noinline) # define __lzo_HAVE_noinline 1 #else -# define __lzo_noinline +# define __lzo_noinline /*empty*/ #endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) +#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) # error "this should not happen" #endif #if !defined(__lzo_noreturn) @@ -1479,7 +1513,7 @@ extern "C" { # define __lzo_noreturn __declspec(noreturn) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) # define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_noreturn __attribute__((__noreturn__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) # define __lzo_noreturn __declspec(noreturn) @@ -1488,16 +1522,16 @@ extern "C" { #if defined(__lzo_noreturn) # define __lzo_HAVE_noreturn 1 #else -# define __lzo_noreturn +# define __lzo_noreturn /*empty*/ #endif #if !defined(__lzo_nothrow) #if (LZO_CC_GNUC >= 0x030300ul) # define __lzo_nothrow __attribute__((__nothrow__)) #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) # define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) +#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 900) && LZO_CC_SYNTAX_GNUC) # define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_nothrow __attribute__((__nothrow__)) #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) # define __lzo_nothrow __declspec(nothrow) @@ -1506,14 +1540,14 @@ extern "C" { #if defined(__lzo_nothrow) # define __lzo_HAVE_nothrow 1 #else -# define __lzo_nothrow +# define __lzo_nothrow /*empty*/ #endif #if !defined(__lzo_restrict) #if (LZO_CC_GNUC >= 0x030400ul) # define __lzo_restrict __restrict__ #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) # define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) +#elif (LZO_CC_CLANG || LZO_CC_LLVM) # define __lzo_restrict __restrict__ #elif (LZO_CC_MSC && (_MSC_VER >= 1400)) # define __lzo_restrict __restrict @@ -1522,7 +1556,7 @@ extern "C" { #if defined(__lzo_restrict) # define __lzo_HAVE_restrict 1 #else -# define __lzo_restrict +# define __lzo_restrict /*empty*/ #endif #if !defined(__lzo_likely) && !defined(__lzo_unlikely) #if (LZO_CC_GNUC >= 0x030200ul) @@ -1531,7 +1565,7 @@ extern "C" { #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) # define __lzo_likely(e) (__builtin_expect(!!(e),1)) # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) +#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define __lzo_likely(e) (__builtin_expect(!!(e),1)) # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) #endif @@ -1551,7 +1585,7 @@ extern "C" { # define LZO_UNUSED(var) ((void) &var) # elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) # define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) # define LZO_UNUSED(var) ((void) var) # elif (LZO_CC_MSC && (_MSC_VER < 900)) # define LZO_UNUSED(var) if (&var) ; else @@ -1570,7 +1604,7 @@ extern "C" { # define LZO_UNUSED_FUNC(func) ((void) func) # elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) # define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) +# elif (LZO_CC_CLANG || LZO_CC_LLVM) # define LZO_UNUSED_FUNC(func) ((void) &func) # elif (LZO_CC_MSC && (_MSC_VER < 900)) # define LZO_UNUSED_FUNC(func) if (func) ; else @@ -1585,7 +1619,7 @@ extern "C" { #if !defined(LZO_UNUSED_LABEL) # if (LZO_CC_WATCOMC) && defined(__cplusplus) # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) +# elif (LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) # define LZO_UNUSED_LABEL(l) if (0) goto l # else # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l @@ -1600,6 +1634,15 @@ extern "C" { # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init # endif #endif +#if !defined(LZO_UNCONST_CAST) +# if 0 && defined(__cplusplus) +# define LZO_UNCONST_CAST(t,e) (const_cast (e)) +# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((lzo_uintptr_t) ((const void *) (e)))))) +# else +# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((const void *) (e))))) +# endif +#endif #if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) # if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; @@ -1628,7 +1671,7 @@ extern "C" { # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) # elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) # define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit +# define __lzo_cdecl_atexit /*empty*/ # define __lzo_cdecl_main __cdecl # if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) # define __lzo_cdecl_qsort __pascal @@ -1669,24 +1712,24 @@ extern "C" { # define __lzo_cdecl cdecl #endif #if !defined(__lzo_cdecl) -# define __lzo_cdecl +# define __lzo_cdecl /*empty*/ #endif #if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit +# define __lzo_cdecl_atexit /*empty*/ #endif #if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main +# define __lzo_cdecl_main /*empty*/ #endif #if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort +# define __lzo_cdecl_qsort /*empty*/ #endif #if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler +# define __lzo_cdecl_sighandler /*empty*/ #endif #if !defined(__lzo_cdecl_va) # define __lzo_cdecl_va __lzo_cdecl #endif -#if !defined(LZO_CFG_NO_WINDOWS_H) +#if !(LZO_CFG_NO_WINDOWS_H) #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) # if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) # elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) @@ -1732,7 +1775,7 @@ extern "C" { #elif (LZO_ARCH_POWERPC) # define LZO_OPT_PREFER_PREINC 1 # define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) +# if (LZO_ABI_BIG_ENDIAN) # define LZO_OPT_UNALIGNED16 1 # define LZO_OPT_UNALIGNED32 1 # endif @@ -1746,28 +1789,29 @@ extern "C" { # define LZO_OPT_PREFER_POSTINC 1 # define LZO_OPT_PREFER_PREDEC 1 #endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) +#ifndef LZO_CFG_NO_INLINE_ASM +#if (LZO_CC_LLVM) # define LZO_CFG_NO_INLINE_ASM 1 #endif #endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) +#ifndef LZO_CFG_NO_UNALIGNED +#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) # define LZO_CFG_NO_UNALIGNED 1 #endif #endif -#if defined(LZO_CFG_NO_UNALIGNED) +#if (LZO_CFG_NO_UNALIGNED) # undef LZO_OPT_UNALIGNED16 # undef LZO_OPT_UNALIGNED32 # undef LZO_OPT_UNALIGNED64 #endif -#if defined(LZO_CFG_NO_INLINE_ASM) +#if (LZO_CFG_NO_INLINE_ASM) #elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) # define LZO_ASM_SYNTAX_MSC 1 #elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) +#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) +#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) # define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) +#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) # define LZO_ASM_SYNTAX_GNUC 1 #endif #if (LZO_ASM_SYNTAX_GNUC) @@ -1830,34 +1874,34 @@ extern "C" { #undef LZO_HAVE_CONFIG_H #include "minilzo.h" -#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2030) +#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2060) # error "version mismatch in miniLZO source files" #endif #ifdef MINILZO_HAVE_CONFIG_H -# define LZO_HAVE_CONFIG_H +# define LZO_HAVE_CONFIG_H 1 #endif #ifndef __LZO_CONF_H -#define __LZO_CONF_H +#define __LZO_CONF_H 1 #if !defined(__LZO_IN_MINILZO) -#if defined(LZO_CFG_FREESTANDING) +#if (LZO_CFG_FREESTANDING) # define LZO_LIBC_FREESTANDING 1 # define LZO_OS_FREESTANDING 1 # define ACC_LIBC_FREESTANDING 1 # define ACC_OS_FREESTANDING 1 #endif -#if defined(LZO_CFG_NO_UNALIGNED) +#if (LZO_CFG_NO_UNALIGNED) # define ACC_CFG_NO_UNALIGNED 1 #endif -#if defined(LZO_ARCH_GENERIC) +#if (LZO_ARCH_GENERIC) # define ACC_ARCH_GENERIC 1 #endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) +#if (LZO_ABI_NEUTRAL_ENDIAN) # define ACC_ABI_NEUTRAL_ENDIAN 1 #endif -#if defined(LZO_HAVE_CONFIG_H) +#if (LZO_HAVE_CONFIG_H) # define ACC_CONFIG_NO_HEADER 1 #endif #if defined(LZO_CFG_EXTRA_CONFIG_HEADER) @@ -1886,11 +1930,14 @@ extern "C" { #endif #if (LZO_CC_SUNPROC) +#if !defined(__cplusplus) # pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED) # pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP) +# pragma error_messages(off,E_STATEMENT_NOT_REACHED) +#endif #endif -#if defined(__LZO_MMODEL_HUGE) && (!LZO_HAVE_MM_HUGE_PTR) +#if (__LZO_MMODEL_HUGE) && !(LZO_HAVE_MM_HUGE_PTR) # error "this should not happen - check defines for __huge" #endif @@ -1955,40 +2002,44 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) #include #endif -#if defined(LZO_CFG_FREESTANDING) +#if (LZO_CFG_FREESTANDING) # undef HAVE_MEMCMP # undef HAVE_MEMCPY # undef HAVE_MEMMOVE # undef HAVE_MEMSET #endif -#if !defined(HAVE_MEMCMP) +#if !(HAVE_MEMCMP) # undef memcmp # define memcmp(a,b,c) lzo_memcmp(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) +#elif !(__LZO_MMODEL_HUGE) +# undef lzo_memcmp # define lzo_memcmp(a,b,c) memcmp(a,b,c) #endif -#if !defined(HAVE_MEMCPY) +#if !(HAVE_MEMCPY) # undef memcpy # define memcpy(a,b,c) lzo_memcpy(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) +#elif !(__LZO_MMODEL_HUGE) +# undef lzo_memcpy # define lzo_memcpy(a,b,c) memcpy(a,b,c) #endif -#if !defined(HAVE_MEMMOVE) +#if !(HAVE_MEMMOVE) # undef memmove # define memmove(a,b,c) lzo_memmove(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) +#elif !(__LZO_MMODEL_HUGE) +# undef lzo_memmove # define lzo_memmove(a,b,c) memmove(a,b,c) #endif -#if !defined(HAVE_MEMSET) +#if !(HAVE_MEMSET) # undef memset # define memset(a,b,c) lzo_memset(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) +#elif !(__LZO_MMODEL_HUGE) +# undef lzo_memset # define lzo_memset(a,b,c) memset(a,b,c) #endif #undef NDEBUG -#if defined(LZO_CFG_FREESTANDING) +#if (LZO_CFG_FREESTANDING) # undef LZO_DEBUG # define NDEBUG 1 # undef assert @@ -2008,13 +2059,24 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) #endif #if !defined(__lzo_inline) -# define __lzo_inline +# define __lzo_inline /*empty*/ #endif #if !defined(__lzo_forceinline) -# define __lzo_forceinline +# define __lzo_forceinline /*empty*/ #endif #if !defined(__lzo_noinline) -# define __lzo_noinline +# define __lzo_noinline /*empty*/ +#endif + +#if (LZO_CFG_PGO) +# undef __acc_likely +# undef __acc_unlikely +# undef __lzo_likely +# undef __lzo_unlikely +# define __acc_likely(e) (e) +# define __acc_unlikely(e) (e) +# define __lzo_likely(e) (e) +# define __lzo_unlikely(e) (e) #endif #if 1 @@ -2050,24 +2112,69 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) #endif #endif -#if 1 && !defined(LZO_CFG_NO_UNALIGNED) -#if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386) +#if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386 || LZO_ARCH_POWERPC) # if (LZO_SIZEOF_SHORT == 2) -# define LZO_UNALIGNED_OK_2 +# define LZO_UNALIGNED_OK_2 1 # endif # if (LZO_SIZEOF_INT == 4) -# define LZO_UNALIGNED_OK_4 +# define LZO_UNALIGNED_OK_4 1 # endif #endif +#if 1 && (LZO_ARCH_AMD64) +# if defined(LZO_UINT64_MAX) +# define LZO_UNALIGNED_OK_8 1 +# endif +#endif +#if (LZO_CFG_NO_UNALIGNED) +# undef LZO_UNALIGNED_OK_2 +# undef LZO_UNALIGNED_OK_4 +# undef LZO_UNALIGNED_OK_8 #endif +#undef UA_GET16 +#undef UA_SET16 +#undef UA_COPY16 +#undef UA_GET32 +#undef UA_SET32 +#undef UA_COPY32 +#undef UA_GET64 +#undef UA_SET64 +#undef UA_COPY64 #if defined(LZO_UNALIGNED_OK_2) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(unsigned short) == 2) +# if 1 && defined(ACC_UA_COPY16) +# define UA_GET16 ACC_UA_GET16 +# define UA_SET16 ACC_UA_SET16 +# define UA_COPY16 ACC_UA_COPY16 +# else +# define UA_GET16(p) (* (__lzo_ua_volatile const lzo_ushortp) (__lzo_ua_volatile const lzo_voidp) (p)) +# define UA_SET16(p,v) ((* (__lzo_ua_volatile lzo_ushortp) (__lzo_ua_volatile lzo_voidp) (p)) = (unsigned short) (v)) +# define UA_COPY16(d,s) UA_SET16(d, UA_GET16(s)) +# endif #endif -#if defined(LZO_UNALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) -#elif defined(LZO_ALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) +#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) +# if 1 && defined(ACC_UA_COPY32) +# define UA_GET32 ACC_UA_GET32 +# define UA_SET32 ACC_UA_SET32 +# define UA_COPY32 ACC_UA_COPY32 +# else +# define UA_GET32(p) (* (__lzo_ua_volatile const lzo_uint32p) (__lzo_ua_volatile const lzo_voidp) (p)) +# define UA_SET32(p,v) ((* (__lzo_ua_volatile lzo_uint32p) (__lzo_ua_volatile lzo_voidp) (p)) = (lzo_uint32) (v)) +# define UA_COPY32(d,s) UA_SET32(d, UA_GET32(s)) +# endif +#endif +#if defined(LZO_UNALIGNED_OK_8) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64) == 8) +# if 1 && defined(ACC_UA_COPY64) +# define UA_GET64 ACC_UA_GET64 +# define UA_SET64 ACC_UA_SET64 +# define UA_COPY64 ACC_UA_COPY64 +# else +# define UA_GET64(p) (* (__lzo_ua_volatile const lzo_uint64p) (__lzo_ua_volatile const lzo_voidp) (p)) +# define UA_SET64(p,v) ((* (__lzo_ua_volatile lzo_uint64p) (__lzo_ua_volatile lzo_voidp) (p)) = (lzo_uint64) (v)) +# define UA_COPY64(d,s) UA_SET64(d, UA_GET64(s)) +# endif #endif #define MEMCPY8_DS(dest,src,len) \ @@ -2079,19 +2186,17 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) #define MEMCPY_DS(dest,src,len) \ do *dest++ = *src++; while (--len > 0) -__LZO_EXTERN_C int __lzo_init_done; -__LZO_EXTERN_C const char __lzo_copyright[]; LZO_EXTERN(const lzo_bytep) lzo_copyright(void); #ifndef __LZO_PTR_H -#define __LZO_PTR_H +#define __LZO_PTR_H 1 #ifdef __cplusplus extern "C" { #endif #if !defined(lzo_uintptr_t) -# if defined(__LZO_MMODEL_HUGE) +# if (__LZO_MMODEL_HUGE) # define lzo_uintptr_t unsigned long # else # define lzo_uintptr_t acc_uintptr_t @@ -2140,6 +2245,10 @@ typedef union lzo_uint a_lzo_uint; lzo_int32 a_lzo_int32; lzo_uint32 a_lzo_uint32; +#if defined(LZO_UINT64_MAX) + lzo_int64 a_lzo_int64; + lzo_uint64 a_lzo_uint64; +#endif ptrdiff_t a_ptrdiff_t; lzo_uintptr_t a_lzo_uintptr_t; lzo_voidp a_lzo_voidp; @@ -2161,14 +2270,19 @@ lzo_full_align_t; #endif -#define LZO_DETERMINISTIC - -#define LZO_DICT_USE_PTR -#if 0 && (LZO_ARCH_I086) -# undef LZO_DICT_USE_PTR +#ifndef LZO_DETERMINISTIC +#define LZO_DETERMINISTIC 1 #endif -#if defined(LZO_DICT_USE_PTR) +#ifndef LZO_DICT_USE_PTR +#define LZO_DICT_USE_PTR 1 +#if 0 && (LZO_ARCH_I086) +# undef LZO_DICT_USE_PTR +# define LZO_DICT_USE_PTR 0 +#endif +#endif + +#if (LZO_DICT_USE_PTR) # define lzo_dict_t const lzo_bytep # define lzo_dict_p lzo_dict_t __LZO_MMODEL * #else @@ -2216,22 +2330,22 @@ __lzo_align_gap(const lzo_voidp ptr, lzo_uint size) } #endif +#if !defined(MINILZO_CFG_SKIP_LZO_UTIL) /* If you use the LZO library in a product, I would appreciate that you * keep this copyright string in the executable of your product. */ -const char __lzo_copyright[] = +static const char __lzo_copyright[] = #if !defined(__LZO_IN_MINLZO) LZO_VERSION_STRING; #else "\r\n\n" "LZO data compression library.\n" - "$Copyright: LZO (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Markus Franz Xaver Johannes Oberhumer\n" + "$Copyright: LZO Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\n" "\n" "http://www.oberhumer.com $\n\n" "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n" - "$Built: " __DATE__ " " __TIME__ " $\n" "$Info: " LZO_INFO_STRING " $\n"; #endif @@ -2321,6 +2435,7 @@ lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) #undef LZO_DO8 #undef LZO_DO16 +#endif #if !defined(MINILZO_CFG_SKIP_LZO_STRING) #undef lzo_memcmp #undef lzo_memcpy @@ -2343,7 +2458,7 @@ lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) #endif LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) { -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCMP) +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCMP) const lzo_hbyte_p p1 = (const lzo_hbyte_p) s1; const lzo_hbyte_p p2 = (const lzo_hbyte_p) s2; if __lzo_likely(len > 0) do @@ -2360,7 +2475,7 @@ LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo } LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) { -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCPY) +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCPY) lzo_hbyte_p p1 = (lzo_hbyte_p) dest; const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; if (!(len > 0) || p1 == p2) @@ -2375,7 +2490,7 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src } LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) { -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMMOVE) +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMMOVE) lzo_hbyte_p p1 = (lzo_hbyte_p) dest; const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; if (!(len > 0) || p1 == p2) @@ -2401,7 +2516,7 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p sr } LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) { -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMSET) +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMSET) lzo_hbyte_p p = (lzo_hbyte_p) s; if __lzo_likely(len > 0) do *p++ = (unsigned char) c; @@ -2413,6 +2528,7 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) } #undef LZOLIB_PUBLIC #endif +#if !defined(MINILZO_CFG_SKIP_LZO_INIT) #if !defined(__LZO_IN_MINILZO) @@ -2426,6 +2542,11 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32) ACCCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) ACCCHK_ASSERT(sizeof(lzo_uint32) >= 4) +#if defined(LZO_UINT64_MAX) + ACCCHK_ASSERT(sizeof(lzo_uint64) == 8) + ACCCHK_ASSERT_IS_SIGNED_T(lzo_int64) + ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint64) +#endif #if !defined(__LZO_UINTPTR_T_IS_POINTER) ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) @@ -2440,40 +2561,158 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) #endif #undef ACCCHK_ASSERT +#define WANT_lzo_bitops_clz32 1 +#define WANT_lzo_bitops_clz64 1 +#define WANT_lzo_bitops_ctz32 1 +#define WANT_lzo_bitops_ctz64 1 + +#if (defined(_WIN32) || defined(_WIN64)) && ((LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_MSC && (_MSC_VER >= 1400))) +#include +#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) && 0 +#pragma intrinsic(_BitScanReverse) +static __lzo_inline unsigned lzo_bitops_clz32(lzo_uint32 v) +{ + unsigned long r; + (void) _BitScanReverse(&r, v); + return (unsigned) r; +} +#define lzo_bitops_clz32 lzo_bitops_clz32 +#endif +#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) && 0 +#pragma intrinsic(_BitScanReverse64) +static __lzo_inline unsigned lzo_bitops_clz64(lzo_uint64 v) +{ + unsigned long r; + (void) _BitScanReverse64(&r, v); + return (unsigned) r; +} +#define lzo_bitops_clz64 lzo_bitops_clz64 +#endif +#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) +#pragma intrinsic(_BitScanForward) +static __lzo_inline unsigned lzo_bitops_ctz32(lzo_uint32 v) +{ + unsigned long r; + (void) _BitScanForward(&r, v); + return (unsigned) r; +} +#define lzo_bitops_ctz32 lzo_bitops_ctz32 +#endif +#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) +#pragma intrinsic(_BitScanForward64) +static __lzo_inline unsigned lzo_bitops_ctz64(lzo_uint64 v) +{ + unsigned long r; + (void) _BitScanForward64(&r, v); + return (unsigned) r; +} +#define lzo_bitops_ctz64 lzo_bitops_ctz64 +#endif + +#elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_LLVM && (!defined(__llvm_tools_version__) || (__llvm_tools_version__+0 >= 0x010500ul)))) +#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) +#define lzo_bitops_clz32(v) ((unsigned) __builtin_clz(v)) +#endif +#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) +#define lzo_bitops_clz64(v) ((unsigned) __builtin_clzll(v)) +#endif +#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) +#define lzo_bitops_ctz32(v) ((unsigned) __builtin_ctz(v)) +#endif +#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) +#define lzo_bitops_ctz64(v) ((unsigned) __builtin_ctzll(v)) +#endif +#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount32) +#define lzo_bitops_popcount32(v) ((unsigned) __builtin_popcount(v)) +#endif +#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount64) && defined(LZO_UINT64_MAX) +#define lzo_bitops_popcount64(v) ((unsigned) __builtin_popcountll(v)) +#endif +#endif + +#if 0 +#define u2p(ptr,off) ((lzo_voidp) (((lzo_bytep)(lzo_voidp)(ptr)) + (off))) +#else +static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off) +{ + return (lzo_voidp) ((lzo_bytep) ptr + off); +} +#endif + LZO_PUBLIC(int) _lzo_config_check(void) { lzo_bool r = 1; - union { unsigned char c[2*sizeof(lzo_xint)]; lzo_xint l[2]; } u; - lzo_uintptr_t p; + union { + lzo_xint a[2]; unsigned char b[2*LZO_MAX(8,sizeof(lzo_xint))]; +#if defined(LZO_UNALIGNED_OK_8) + lzo_uint64 c[2]; +#endif + unsigned short x[2]; lzo_uint32 y[2]; lzo_uint z[2]; + } u; + lzo_voidp p; + u.a[0] = u.a[1] = 0; + p = u2p(&u, 0); + r &= ((* (lzo_bytep) p) == 0); #if !defined(LZO_CFG_NO_CONFIG_CHECK) #if defined(LZO_ABI_BIG_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[sizeof(lzo_xint) - 1] = 128; - r &= (u.l[0] == 128); + u.a[0] = u.a[1] = 0; u.b[sizeof(lzo_uint) - 1] = 128; + p = u2p(&u, 0); + r &= ((* (lzo_uintp) p) == 128); #endif #if defined(LZO_ABI_LITTLE_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[0] = 128; - r &= (u.l[0] == 128); + u.a[0] = u.a[1] = 0; u.b[0] = 128; + p = u2p(&u, 0); + r &= ((* (lzo_uintp) p) == 128); #endif #if defined(LZO_UNALIGNED_OK_2) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_ushortp) (p+1)) == 0); + u.a[0] = u.a[1] = 0; + u.b[0] = 1; u.b[sizeof(unsigned short) + 1] = 2; + p = u2p(&u, 1); + r &= ((* (lzo_ushortp) p) == 0); #endif #if defined(LZO_UNALIGNED_OK_4) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_uint32p) (p+1)) == 0); + u.a[0] = u.a[1] = 0; + u.b[0] = 3; u.b[sizeof(lzo_uint32) + 1] = 4; + p = u2p(&u, 1); + r &= ((* (lzo_uint32p) p) == 0); +#endif +#if defined(LZO_UNALIGNED_OK_8) + u.c[0] = u.c[1] = 0; + u.b[0] = 5; u.b[sizeof(lzo_uint64) + 1] = 6; + p = u2p(&u, 1); + r &= ((* (lzo_uint64p) p) == 0); +#endif +#if defined(lzo_bitops_clz32) + { unsigned i; lzo_uint32 v = 1; + for (i = 0; i < 32; i++, v <<= 1) + r &= lzo_bitops_clz32(v) == 31 - i; + } +#endif +#if defined(lzo_bitops_clz64) + { unsigned i; lzo_uint64 v = 1; + for (i = 0; i < 64; i++, v <<= 1) + r &= lzo_bitops_clz64(v) == 63 - i; + } +#endif +#if defined(lzo_bitops_ctz32) + { unsigned i; lzo_uint32 v = 1; + for (i = 0; i < 32; i++, v <<= 1) + r &= lzo_bitops_ctz32(v) == i; + } +#endif +#if defined(lzo_bitops_ctz64) + { unsigned i; lzo_uint64 v = 1; + for (i = 0; i < 64; i++, v <<= 1) + r &= lzo_bitops_ctz64(v) == i; + } #endif #endif - LZO_UNUSED(u); LZO_UNUSED(p); return r == 1 ? LZO_E_OK : LZO_E_ERROR; } -int __lzo_init_done = 0; - LZO_PUBLIC(int) __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, int s6, int s7, int s8, int s9) @@ -2489,8 +2728,6 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, #endif #undef ACCCHK_ASSERT - __lzo_init_done = 1; - if (v == 0) return LZO_E_ERROR; @@ -2532,27 +2769,47 @@ int __far __pascal LibMain ( int a, short b, short c, long d ) #endif -#define do_compress _lzo1x_1_do_compress +#endif + +#define LZO1X 1 +#define LZO_EOF_CODE 1 +#define M2_MAX_OFFSET 0x0800 #if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS) -#define LZO_NEED_DICT_H +#if 1 && defined(UA_GET32) +#undef LZO_DICT_USE_PTR +#define LZO_DICT_USE_PTR 0 +#undef lzo_dict_t +#define lzo_dict_t unsigned short +#endif + +#define LZO_NEED_DICT_H 1 +#ifndef D_BITS #define D_BITS 14 +#endif #define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5) #define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) +#if 1 +#define DINDEX(dv,p) DM(((DMUL(0x1824429d,dv)) >> (32-D_BITS))) +#else +#define DINDEX(dv,p) DM((dv) + ((dv) >> (32-D_BITS))) +#endif #ifndef __LZO_CONFIG1X_H -#define __LZO_CONFIG1X_H +#define __LZO_CONFIG1X_H 1 #if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) -# define LZO1X +# define LZO1X 1 #endif #if !defined(__LZO_IN_MINILZO) #include "lzo/lzo1x.h" #endif -#define LZO_EOF_CODE +#ifndef LZO_EOF_CODE +#define LZO_EOF_CODE 1 +#endif #undef LZO_DETERMINISTIC #define M1_MAX_OFFSET 0x0400 @@ -2592,7 +2849,7 @@ int __far __pascal LibMain ( int a, short b, short c, long d ) #define DL_MIN_LEN M2_MIN_LEN #ifndef __LZO_DICT_H -#define __LZO_DICT_H +#define __LZO_DICT_H 1 #ifdef __cplusplus extern "C" { @@ -2633,10 +2890,10 @@ extern "C" { #if (D_BITS != DL_BITS + DD_BITS) # error "D_BITS does not match" #endif -#if (D_BITS < 8 || D_BITS > 18) +#if (D_BITS < 6 || D_BITS > 18) # error "invalid D_BITS" #endif -#if (DL_BITS < 8 || DL_BITS > 20) +#if (DL_BITS < 6 || DL_BITS > 20) # error "invalid DL_BITS" #endif #if (DD_BITS < 0 || DD_BITS > 6) @@ -2695,14 +2952,14 @@ extern "C" { # define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT)) #elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL) -# define __LZO_HASH_INCREMENTAL +# define __LZO_HASH_INCREMENTAL 1 # define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT) # define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2]) # define _DINDEX(dv,p) (dv) # define DVAL_LOOKAHEAD DL_MIN_LEN #elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A) -# define __LZO_HASH_INCREMENTAL +# define __LZO_HASH_INCREMENTAL 1 # define DVAL_FIRST(dv,p) dv = _DV_A((p),5) # define DVAL_NEXT(dv,p) \ dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) @@ -2710,7 +2967,7 @@ extern "C" { # define DVAL_LOOKAHEAD DL_MIN_LEN #elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) -# define __LZO_HASH_INCREMENTAL +# define __LZO_HASH_INCREMENTAL 1 # define DVAL_FIRST(dv,p) dv = _DV_B((p),5) # define DVAL_NEXT(dv,p) \ dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5))) @@ -2739,7 +2996,12 @@ extern "C" { #if !defined(DVAL_ASSERT) #if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) -static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) +#if (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_LLVM) +static void __attribute__((__unused__)) +#else +static void +#endif +DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) { lzo_xint df; DVAL_FIRST(df,(p)); @@ -2750,11 +3012,11 @@ static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) #endif #endif -#if defined(LZO_DICT_USE_PTR) +#if (LZO_DICT_USE_PTR) # define DENTRY(p,in) (p) # define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] #else -# define DENTRY(p,in) ((lzo_uint) ((p)-(in))) +# define DENTRY(p,in) ((lzo_dict_t) pd(p, in)) # define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex] #endif @@ -2775,7 +3037,7 @@ static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) #endif -#if defined(LZO_DICT_USE_PTR) +#if (LZO_DICT_USE_PTR) #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset) @@ -2784,7 +3046,7 @@ static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) (BOUNDS_CHECKING_OFF_IN_EXPR(( \ m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \ PTR_LT(m_pos,in) || \ - (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) <= 0 || \ + (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) == 0 || \ m_off > max_offset ))) #else @@ -2801,7 +3063,7 @@ static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) #endif -#if defined(LZO_DETERMINISTIC) +#if (LZO_DETERMINISTIC) # define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET #else # define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET @@ -2817,17 +3079,99 @@ static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) #endif +#define LZO_DETERMINISTIC !(LZO_DICT_USE_PTR) + +#ifndef DO_COMPRESS #define DO_COMPRESS lzo1x_1_compress +#endif + +#if 1 && defined(DO_COMPRESS) && !defined(do_compress) +# define do_compress LZO_CPP_ECONCAT2(DO_COMPRESS,_core) +#endif + +#if defined(UA_GET64) && (LZO_ABI_BIG_ENDIAN) +# define WANT_lzo_bitops_clz64 1 +#elif defined(UA_GET64) && (LZO_ABI_LITTLE_ENDIAN) +# define WANT_lzo_bitops_ctz64 1 +#elif defined(UA_GET32) && (LZO_ABI_BIG_ENDIAN) +# define WANT_lzo_bitops_clz32 1 +#elif defined(UA_GET32) && (LZO_ABI_LITTLE_ENDIAN) +# define WANT_lzo_bitops_ctz32 1 +#endif + +#if (defined(_WIN32) || defined(_WIN64)) && ((LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_MSC && (_MSC_VER >= 1400))) +#include +#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) && 0 +#pragma intrinsic(_BitScanReverse) +static __lzo_inline unsigned lzo_bitops_clz32(lzo_uint32 v) +{ + unsigned long r; + (void) _BitScanReverse(&r, v); + return (unsigned) r; +} +#define lzo_bitops_clz32 lzo_bitops_clz32 +#endif +#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) && 0 +#pragma intrinsic(_BitScanReverse64) +static __lzo_inline unsigned lzo_bitops_clz64(lzo_uint64 v) +{ + unsigned long r; + (void) _BitScanReverse64(&r, v); + return (unsigned) r; +} +#define lzo_bitops_clz64 lzo_bitops_clz64 +#endif +#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) +#pragma intrinsic(_BitScanForward) +static __lzo_inline unsigned lzo_bitops_ctz32(lzo_uint32 v) +{ + unsigned long r; + (void) _BitScanForward(&r, v); + return (unsigned) r; +} +#define lzo_bitops_ctz32 lzo_bitops_ctz32 +#endif +#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) +#pragma intrinsic(_BitScanForward64) +static __lzo_inline unsigned lzo_bitops_ctz64(lzo_uint64 v) +{ + unsigned long r; + (void) _BitScanForward64(&r, v); + return (unsigned) r; +} +#define lzo_bitops_ctz64 lzo_bitops_ctz64 +#endif + +#elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_LLVM && (!defined(__llvm_tools_version__) || (__llvm_tools_version__+0 >= 0x010500ul)))) +#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) +#define lzo_bitops_clz32(v) ((unsigned) __builtin_clz(v)) +#endif +#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) +#define lzo_bitops_clz64(v) ((unsigned) __builtin_clzll(v)) +#endif +#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) +#define lzo_bitops_ctz32(v) ((unsigned) __builtin_ctz(v)) +#endif +#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) +#define lzo_bitops_ctz64(v) ((unsigned) __builtin_ctzll(v)) +#endif +#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount32) +#define lzo_bitops_popcount32(v) ((unsigned) __builtin_popcount(v)) +#endif +#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount64) && defined(LZO_UINT64_MAX) +#define lzo_bitops_popcount64(v) ((unsigned) __builtin_popcountll(v)) +#endif +#endif static __lzo_noinline lzo_uint do_compress ( const lzo_bytep in , lzo_uint in_len, lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) + lzo_uint ti, lzo_voidp wrkmem) { register const lzo_bytep ip; lzo_bytep op; const lzo_bytep const in_end = in + in_len; - const lzo_bytep const ip_end = in + in_len - M2_MAX_LEN - 5; + const lzo_bytep const ip_end = in + in_len - 20; const lzo_bytep ii; lzo_dict_p const dict = (lzo_dict_p) wrkmem; @@ -2835,14 +3179,17 @@ do_compress ( const lzo_bytep in , lzo_uint in_len, ip = in; ii = ip; - ip += 4; + ip += ti < 4 ? 4 - ti : 0; for (;;) { - register const lzo_bytep m_pos; - lzo_uint m_off; + const lzo_bytep m_pos; +#if !(LZO_DETERMINISTIC) + LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); lzo_uint m_len; lzo_uint dindex; - +next: + if __lzo_unlikely(ip >= ip_end) + break; DINDEX1(dindex,ip); GINDEX(m_pos,m_off,dict,dindex,in); if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) @@ -2860,200 +3207,245 @@ do_compress ( const lzo_bytep in , lzo_uint in_len, goto literal; try_match: -#if 1 && defined(LZO_UNALIGNED_OK_2) - if (* (const lzo_ushortp) m_pos != * (const lzo_ushortp) ip) +#if defined(UA_GET32) + if (UA_GET32(m_pos) != UA_GET32(ip)) #else - if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) + if (m_pos[0] != ip[0] || m_pos[1] != ip[1] || m_pos[2] != ip[2] || m_pos[3] != ip[3]) #endif { - } - else - { - if __lzo_likely(m_pos[2] == ip[2]) - { -#if 0 - if (m_off <= M2_MAX_OFFSET) - goto match; - if (lit <= 3) - goto match; - if (lit == 3) - { - assert(op - 2 > out); op[-2] |= LZO_BYTE(3); - *op++ = *ii++; *op++ = *ii++; *op++ = *ii++; - goto code_match; - } - if (m_pos[3] == ip[3]) -#endif - goto match; - } - else - { -#if 0 -#if 0 - if (m_off <= M1_MAX_OFFSET && lit > 0 && lit <= 3) -#else - if (m_off <= M1_MAX_OFFSET && lit == 3) -#endif - { - register lzo_uint t; - - t = lit; - assert(op - 2 > out); op[-2] |= LZO_BYTE(t); - do *op++ = *ii++; while (--t > 0); - assert(ii == ip); - m_off -= 1; - *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); - ip += 2; - goto match_done; - } -#endif - } - } - literal: + UPDATE_I(dict,0,dindex,ip,in); + ip += 1 + ((ip - ii) >> 5); + continue; + } UPDATE_I(dict,0,dindex,ip,in); - ++ip; +#else + lzo_uint m_off; + lzo_uint m_len; + { + lzo_uint32 dv; + lzo_uint dindex; +literal: + ip += 1 + ((ip - ii) >> 5); +next: if __lzo_unlikely(ip >= ip_end) break; - continue; - -match: + dv = UA_GET32(ip); + dindex = DINDEX(dv,ip); + GINDEX(m_off,m_pos,in+dict,dindex,in); UPDATE_I(dict,0,dindex,ip,in); - if (pd(ip,ii) > 0) - { - register lzo_uint t = pd(ip,ii); + if __lzo_unlikely(dv != UA_GET32(m_pos)) + goto literal; + } +#endif + ii -= ti; ti = 0; + { + register lzo_uint t = pd(ip,ii); + if (t != 0) + { if (t <= 3) { - assert(op - 2 > out); op[-2] |= LZO_BYTE(t); +#if defined(UA_COPY32) + UA_COPY32(op, ii); + op += t; +#else + { do *op++ = *ii++; while (--t > 0); } +#endif } - else if (t <= 18) +#if defined(UA_COPY32) || defined(UA_COPY64) + else if (t <= 16) + { *op++ = LZO_BYTE(t - 3); +#if defined(UA_COPY64) + UA_COPY64(op, ii); + UA_COPY64(op+8, ii+8); +#else + UA_COPY32(op, ii); + UA_COPY32(op+4, ii+4); + UA_COPY32(op+8, ii+8); + UA_COPY32(op+12, ii+12); +#endif + op += t; + } +#endif else { - register lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) + if (t <= 18) + *op++ = LZO_BYTE(t - 3); + else { - tt -= 255; + register lzo_uint tt = t - 18; *op++ = 0; + while __lzo_unlikely(tt > 255) + { + tt -= 255; +#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) + * (volatile unsigned char *) op++ = 0; +#else + *op++ = 0; +#endif + } + assert(tt > 0); + *op++ = LZO_BYTE(tt); } - assert(tt > 0); - *op++ = LZO_BYTE(tt); +#if defined(UA_COPY32) || defined(UA_COPY64) + do { +#if defined(UA_COPY64) + UA_COPY64(op, ii); + UA_COPY64(op+8, ii+8); +#else + UA_COPY32(op, ii); + UA_COPY32(op+4, ii+4); + UA_COPY32(op+8, ii+8); + UA_COPY32(op+12, ii+12); +#endif + op += 16; ii += 16; t -= 16; + } while (t >= 16); if (t > 0) +#endif + { do *op++ = *ii++; while (--t > 0); } } - do *op++ = *ii++; while (--t > 0); } - - assert(ii == ip); - ip += 3; - if (m_pos[3] != *ip++ || m_pos[4] != *ip++ || m_pos[5] != *ip++ || - m_pos[6] != *ip++ || m_pos[7] != *ip++ || m_pos[8] != *ip++ -#ifdef LZO1Y - || m_pos[ 9] != *ip++ || m_pos[10] != *ip++ || m_pos[11] != *ip++ - || m_pos[12] != *ip++ || m_pos[13] != *ip++ || m_pos[14] != *ip++ -#endif - ) + } + m_len = 4; { - --ip; - m_len = pd(ip, ii); - assert(m_len >= 3); assert(m_len <= M2_MAX_LEN); - - if (m_off <= M2_MAX_OFFSET) - { - m_off -= 1; -#if defined(LZO1X) - *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); - *op++ = LZO_BYTE(m_off >> 3); -#elif defined(LZO1Y) - *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); +#if defined(UA_GET64) + lzo_uint64 v; + v = UA_GET64(ip + m_len) ^ UA_GET64(m_pos + m_len); + if __lzo_unlikely(v == 0) { + do { + m_len += 8; + v = UA_GET64(ip + m_len) ^ UA_GET64(m_pos + m_len); + if __lzo_unlikely(ip + m_len >= ip_end) + goto m_len_done; + } while (v == 0); + } +#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_clz64) + m_len += lzo_bitops_clz64(v) / CHAR_BIT; +#elif (LZO_ABI_BIG_ENDIAN) + if ((v >> (64 - CHAR_BIT)) == 0) do { + v <<= CHAR_BIT; + m_len += 1; + } while ((v >> (64 - CHAR_BIT)) == 0); +#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_ctz64) + m_len += lzo_bitops_ctz64(v) / CHAR_BIT; +#elif (LZO_ABI_LITTLE_ENDIAN) + if ((v & UCHAR_MAX) == 0) do { + v >>= CHAR_BIT; + m_len += 1; + } while ((v & UCHAR_MAX) == 0); +#else + if (ip[m_len] == m_pos[m_len]) do { + m_len += 1; + } while (ip[m_len] == m_pos[m_len]); #endif - } - else if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; +#elif defined(UA_GET32) + lzo_uint32 v; + v = UA_GET32(ip + m_len) ^ UA_GET32(m_pos + m_len); + if __lzo_unlikely(v == 0) { + do { + m_len += 4; + v = UA_GET32(ip + m_len) ^ UA_GET32(m_pos + m_len); + if __lzo_unlikely(ip + m_len >= ip_end) + goto m_len_done; + } while (v == 0); + } +#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_clz32) + m_len += lzo_bitops_clz32(v) / CHAR_BIT; +#elif (LZO_ABI_BIG_ENDIAN) + if ((v >> (32 - CHAR_BIT)) == 0) do { + v <<= CHAR_BIT; + m_len += 1; + } while ((v >> (32 - CHAR_BIT)) == 0); +#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_ctz32) + m_len += lzo_bitops_ctz32(v) / CHAR_BIT; +#elif (LZO_ABI_LITTLE_ENDIAN) + if ((v & UCHAR_MAX) == 0) do { + v >>= CHAR_BIT; + m_len += 1; + } while ((v & UCHAR_MAX) == 0); +#else + if (ip[m_len] == m_pos[m_len]) do { + m_len += 1; + } while (ip[m_len] == m_pos[m_len]); +#endif +#else + if __lzo_unlikely(ip[m_len] == m_pos[m_len]) { + do { + m_len += 1; + if __lzo_unlikely(ip + m_len >= ip_end) + goto m_len_done; + } while (ip[m_len] == m_pos[m_len]); + } +#endif + } +m_len_done: + m_off = pd(ip,m_pos); + ip += m_len; + ii = ip; + if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) + { + m_off -= 1; +#if defined(LZO1X) + *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); + *op++ = LZO_BYTE(m_off >> 3); +#elif defined(LZO1Y) + *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); + *op++ = LZO_BYTE(m_off >> 2); +#endif + } + else if (m_off <= M3_MAX_OFFSET) + { + m_off -= 1; + if (m_len <= M3_MAX_LEN) *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - goto m3_m4_offset; - } else -#if defined(LZO1X) { - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - goto m3_m4_offset; - } -#elif defined(LZO1Y) - goto m4_match; + m_len -= M3_MAX_LEN; + *op++ = M3_MARKER | 0; + while __lzo_unlikely(m_len > 255) + { + m_len -= 255; +#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) + * (volatile unsigned char *) op++ = 0; +#else + *op++ = 0; #endif + } + *op++ = LZO_BYTE(m_len); + } + *op++ = LZO_BYTE(m_off << 2); + *op++ = LZO_BYTE(m_off >> 6); } else { - { - const lzo_bytep end = in_end; - const lzo_bytep m = m_pos + M2_MAX_LEN + 1; - while (ip < end && *m == *ip) - m++, ip++; - m_len = pd(ip, ii); - } - assert(m_len > M2_MAX_LEN); - - if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - if (m_len <= 33) - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - else - { - m_len -= 33; - *op++ = M3_MARKER | 0; - goto m3_m4_len; - } - } + m_off -= 0x4000; + if (m_len <= M4_MAX_LEN) + *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8) | (m_len - 2)); else { -#if defined(LZO1Y) -m4_match: -#endif - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - if (m_len <= M4_MAX_LEN) - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - else + m_len -= M4_MAX_LEN; + *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8)); + while __lzo_unlikely(m_len > 255) { - m_len -= M4_MAX_LEN; - *op++ = LZO_BYTE(M4_MARKER | ((m_off & 0x4000) >> 11)); -m3_m4_len: - while (m_len > 255) - { - m_len -= 255; - *op++ = 0; - } - assert(m_len > 0); - *op++ = LZO_BYTE(m_len); + m_len -= 255; +#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) + * (volatile unsigned char *) op++ = 0; +#else + *op++ = 0; +#endif } + *op++ = LZO_BYTE(m_len); } - -m3_m4_offset: - *op++ = LZO_BYTE((m_off & 63) << 2); + *op++ = LZO_BYTE(m_off << 2); *op++ = LZO_BYTE(m_off >> 6); } - -#if 0 -match_done: -#endif - ii = ip; - if __lzo_unlikely(ip >= ip_end) - break; + goto next; } *out_len = pd(op, out); - return pd(in_end,ii); + return pd(in_end,ii-ti); } LZO_PUBLIC(int) @@ -3061,16 +3453,30 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, lzo_bytep out, lzo_uintp out_len, lzo_voidp wrkmem ) { + const lzo_bytep ip = in; lzo_bytep op = out; - lzo_uint t; + lzo_uint l = in_len; + lzo_uint t = 0; - if __lzo_unlikely(in_len <= M2_MAX_LEN + 5) - t = in_len; - else + while (l > 20) { - t = do_compress(in,in_len,op,out_len,wrkmem); + lzo_uint ll = l; + lzo_uintptr_t ll_end; +#if 0 || (LZO_DETERMINISTIC) + ll = LZO_MIN(ll, 49152); +#endif + ll_end = (lzo_uintptr_t)ip + ll; + if ((ll_end + ((t + ll) >> 5)) <= ll_end || (const lzo_bytep)(ll_end + ((t + ll) >> 5)) <= ip + ll) + break; +#if (LZO_DETERMINISTIC) + lzo_memset(wrkmem, 0, ((lzo_uint)1 << D_BITS) * sizeof(lzo_dict_t)); +#endif + t = do_compress(ip,ll,op,out_len,t,wrkmem); + ip += ll; op += *out_len; + l -= ll; } + t += l; if (t > 0) { @@ -3090,7 +3496,12 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, while (tt > 255) { tt -= 255; +#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) + + * (volatile unsigned char *) op++ = 0; +#else *op++ = 0; +#endif } assert(tt > 0); *op++ = LZO_BYTE(tt); @@ -3126,7 +3537,7 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, # define LZO_TEST_OVERRUN_OUTPUT 2 # endif # if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND +# define LZO_TEST_OVERRUN_LOOKBEHIND 1 # endif #endif @@ -3177,42 +3588,32 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, #endif #if defined(TEST_IP) -# define HAVE_TEST_IP +# define HAVE_TEST_IP 1 #else # define TEST_IP 1 #endif #if defined(TEST_OP) -# define HAVE_TEST_OP +# define HAVE_TEST_OP 1 #else # define TEST_OP 1 #endif #if defined(NEED_IP) -# define HAVE_NEED_IP +# define HAVE_NEED_IP 1 #else # define NEED_IP(x) ((void) 0) #endif #if defined(NEED_OP) -# define HAVE_NEED_OP +# define HAVE_NEED_OP 1 #else # define NEED_OP(x) ((void) 0) #endif #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP +# define HAVE_ANY_IP 1 #endif #if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) +# define HAVE_ANY_OP 1 #endif #if defined(DO_DECOMPRESS) @@ -3291,19 +3692,36 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, t += 15 + *ip++; } assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) + t += 3; + if (t >= 8) do + { + UA_COPY64(op,ip); + op += 8; ip += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY32(op,ip); + op += 4; ip += 4; t -= 4; + } + if (t > 0) + { + *op++ = *ip++; + if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } + } +#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) #if !defined(LZO_UNALIGNED_OK_4) if (PTR_ALIGNED2_4(op,ip)) { #endif - COPY4(op,ip); + UA_COPY32(op,ip); op += 4; ip += 4; if (--t > 0) { if (t >= 4) { do { - COPY4(op,ip); + UA_COPY32(op,ip); op += 4; ip += 4; t -= 4; } while (t >= 4); if (t > 0) do *op++ = *ip++; while (--t > 0); @@ -3316,7 +3734,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, else #endif #endif -#if !defined(LZO_UNALIGNED_OK_4) +#if !defined(LZO_UNALIGNED_OK_4) && !defined(LZO_UNALIGNED_OK_8) { *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; do *op++ = *ip++; while (--t > 0); @@ -3437,7 +3855,7 @@ match: } #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; + m_pos -= UA_GET16(ip) >> 2; #else m_pos = op - 1; m_pos -= (ip[0] >> 2) + (ip[1] << 6); @@ -3482,7 +3900,7 @@ match: #if defined(LZO1Z) m_pos -= (ip[0] << 6) + (ip[1] >> 2); #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; + m_pos -= UA_GET16(ip) >> 2; #else m_pos -= (ip[0] >> 2) + (ip[1] << 6); #endif @@ -3530,7 +3948,28 @@ match: #else TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) + if (op - m_pos >= 8) + { + t += (3 - 1); + if (t >= 8) do + { + UA_COPY64(op,m_pos); + op += 8; m_pos += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY32(op,m_pos); + op += 4; m_pos += 4; t -= 4; + } + if (t > 0) + { + *op++ = m_pos[0]; + if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } + } + } + else +#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) #if !defined(LZO_UNALIGNED_OK_4) if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) { @@ -3539,10 +3978,10 @@ match: if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) { #endif - COPY4(op,m_pos); + UA_COPY32(op,m_pos); op += 4; m_pos += 4; t -= 4 - (3 - 1); do { - COPY4(op,m_pos); + UA_COPY32(op,m_pos); op += 4; m_pos += 4; t -= 4; } while (t >= 4); if (t > 0) do *op++ = *m_pos++; while (--t > 0); @@ -3610,7 +4049,7 @@ lookbehind_overrun: #endif -#define LZO_TEST_OVERRUN +#define LZO_TEST_OVERRUN 1 #undef DO_DECOMPRESS #define DO_DECOMPRESS lzo1x_decompress_safe @@ -3624,7 +4063,7 @@ lookbehind_overrun: # define LZO_TEST_OVERRUN_OUTPUT 2 # endif # if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND +# define LZO_TEST_OVERRUN_LOOKBEHIND 1 # endif #endif @@ -3675,42 +4114,32 @@ lookbehind_overrun: #endif #if defined(TEST_IP) -# define HAVE_TEST_IP +# define HAVE_TEST_IP 1 #else # define TEST_IP 1 #endif #if defined(TEST_OP) -# define HAVE_TEST_OP +# define HAVE_TEST_OP 1 #else # define TEST_OP 1 #endif #if defined(NEED_IP) -# define HAVE_NEED_IP +# define HAVE_NEED_IP 1 #else # define NEED_IP(x) ((void) 0) #endif #if defined(NEED_OP) -# define HAVE_NEED_OP +# define HAVE_NEED_OP 1 #else # define NEED_OP(x) ((void) 0) #endif #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP +# define HAVE_ANY_IP 1 #endif #if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) +# define HAVE_ANY_OP 1 #endif #if defined(DO_DECOMPRESS) @@ -3789,19 +4218,36 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, t += 15 + *ip++; } assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) + t += 3; + if (t >= 8) do + { + UA_COPY64(op,ip); + op += 8; ip += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY32(op,ip); + op += 4; ip += 4; t -= 4; + } + if (t > 0) + { + *op++ = *ip++; + if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } + } +#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) #if !defined(LZO_UNALIGNED_OK_4) if (PTR_ALIGNED2_4(op,ip)) { #endif - COPY4(op,ip); + UA_COPY32(op,ip); op += 4; ip += 4; if (--t > 0) { if (t >= 4) { do { - COPY4(op,ip); + UA_COPY32(op,ip); op += 4; ip += 4; t -= 4; } while (t >= 4); if (t > 0) do *op++ = *ip++; while (--t > 0); @@ -3814,7 +4260,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, else #endif #endif -#if !defined(LZO_UNALIGNED_OK_4) +#if !defined(LZO_UNALIGNED_OK_4) && !defined(LZO_UNALIGNED_OK_8) { *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; do *op++ = *ip++; while (--t > 0); @@ -3935,7 +4381,7 @@ match: } #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; + m_pos -= UA_GET16(ip) >> 2; #else m_pos = op - 1; m_pos -= (ip[0] >> 2) + (ip[1] << 6); @@ -3980,7 +4426,7 @@ match: #if defined(LZO1Z) m_pos -= (ip[0] << 6) + (ip[1] >> 2); #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; + m_pos -= UA_GET16(ip) >> 2; #else m_pos -= (ip[0] >> 2) + (ip[1] << 6); #endif @@ -4028,7 +4474,28 @@ match: #else TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) + if (op - m_pos >= 8) + { + t += (3 - 1); + if (t >= 8) do + { + UA_COPY64(op,m_pos); + op += 8; m_pos += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY32(op,m_pos); + op += 4; m_pos += 4; t -= 4; + } + if (t > 0) + { + *op++ = m_pos[0]; + if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } + } + } + else +#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) #if !defined(LZO_UNALIGNED_OK_4) if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) { @@ -4037,10 +4504,10 @@ match: if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) { #endif - COPY4(op,m_pos); + UA_COPY32(op,m_pos); op += 4; m_pos += 4; t -= 4 - (3 - 1); do { - COPY4(op,m_pos); + UA_COPY32(op,m_pos); op += 4; m_pos += 4; t -= 4; } while (t >= 4); if (t > 0) do *op++ = *m_pos++; while (--t > 0); diff --git a/veejay-current/veejay-server/liblzo/minilzo.h b/veejay-current/veejay-server/liblzo/minilzo.h index 0aff50e4..4c7b2378 100644 --- a/veejay-current/veejay-server/liblzo/minilzo.h +++ b/veejay-current/veejay-server/liblzo/minilzo.h @@ -2,6 +2,9 @@ This file is part of the LZO real-time data compression library. + Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer @@ -45,9 +48,9 @@ #ifndef __MINILZO_H -#define __MINILZO_H +#define __MINILZO_H 1 -#define MINILZO_VERSION 0x2030 +#define MINILZO_VERSION 0x2060 #ifdef __LZOCONF_H # error "you cannot use both LZO and miniLZO" diff --git a/veejay-current/veejay-server/libplugger/livido-loader.c b/veejay-current/veejay-server/libplugger/livido-loader.c index 2e9559eb..4a114e99 100644 --- a/veejay-current/veejay-server/libplugger/livido-loader.c +++ b/veejay-current/veejay-server/libplugger/livido-loader.c @@ -150,18 +150,6 @@ static int configure_channel( void *instance, const char *name, int channel_id, #ifdef STRICT_CHECKING assert( error == LIVIDO_NO_ERROR ); #endif - - int hsampling = 0; - if( vevo_property_get( channel, "HOST_sampling", 0, &hsampling ) == LIVIDO_NO_ERROR && name[0] == 'i') - { - void *sampler = NULL; - error = vevo_property_get(channel, "HOST_sampler", 0, &sampler ); -#ifdef STRICT_CHECKING - assert( error == LIVIDO_NO_ERROR ); -#endif - chroma_supersample( hsampling, sampler, pd, frame->width, - frame->height ); - } return 1; } @@ -646,19 +634,12 @@ static int find_cheap_palette(livido_port_t *c, livido_port_t *ptr , int w) int palette = LIVIDO_PALETTE_YUV444P; if( match_palette(ptr,palette )) { - void *sampler = subsample_init(w); - int mode = (pref_palette_ == LIVIDO_PALETTE_YUV422P ? SSM_422_444 : SSM_420_JPEG_BOX); - - vevo_property_set( c, "HOST_sampler", LIVIDO_ATOM_TYPE_VOIDPTR, - 1,&sampler); - vevo_property_set( c, "HOST_sampling", LIVIDO_ATOM_TYPE_INT, - 1, &mode ); vevo_property_set( c, "current_palette", LIVIDO_ATOM_TYPE_INT, 1, &palette ); return 1; } else { - veejay_msg(0, "Support me :%s",__FUNCTION__); + veejay_msg(0, "Oops, can handle palette %x :%s",palette,__FUNCTION__); } return 0; } @@ -1111,25 +1092,6 @@ void livido_plug_process( void *instance, double time_code ) error = vevo_property_get( instance, "out_channels", 0, &channel ); - if( error == LIVIDO_NO_ERROR && vevo_property_get( channel, "HOST_sampling",0,&hsampling ) == - LIVIDO_NO_ERROR ) - { - void *sampler = NULL; - error = vevo_property_get( channel, "HOST_sampler",0,&sampler); -#ifdef STRICT_CHECKING - assert( error == LIVIDO_NO_ERROR ); -#endif - uint8_t *pd[4]; - int n = 0; - int w = 0; - int h = 0; - for( n = 0; n < 4; n ++ ) - vevo_property_get( channel, "pixel_data",n,&pd[n]); - vevo_property_get( channel, "width", 0, &w ); - vevo_property_get( channel, "height", 0, &h ); - - chroma_subsample( hsampling,sampler,pd,w,h ); - } } void livido_plug_deinit( void *instance ) @@ -1171,31 +1133,12 @@ void livido_plug_deinit( void *instance ) #ifdef STRICT_CHECKING assert( error == LIVIDO_NO_ERROR ); #endif - if( vevo_property_get( ic, "HOST_sampling",0,&hs ) == LIVIDO_NO_ERROR ) - { - void *sampler = NULL; - error = vevo_property_get( ic, "HOST_sampler", 0, &sampler ); -#ifdef STRICT_CHECKING - assert( error == LIVIDO_NO_ERROR ); -#endif - subsample_free(sampler); - } - } void *channel = NULL; int hsampling = 0; error = vevo_property_get( instance, "out_channels", 0, &channel ); - if( (error == VEVO_NO_ERROR) && vevo_property_get( channel, "HOST_sampling",0,&hsampling ) == - LIVIDO_NO_ERROR ) - { - void *sampler = NULL; - error = vevo_property_get(channel, "HOST_sampler",0,&sampler ); - if(error == VEVO_NO_ERROR ) - subsample_free(sampler); - } - livido_port_recursive_free( instance ); instance = NULL; diff --git a/veejay-current/veejay-server/libsamplerec/samplerecord.c b/veejay-current/veejay-server/libsamplerec/samplerecord.c index 66ceba00..6fb25789 100644 --- a/veejay-current/veejay-server/libsamplerec/samplerecord.c +++ b/veejay-current/veejay-server/libsamplerec/samplerecord.c @@ -176,7 +176,7 @@ static int sample_start_encoder(sample_info *si, editlist *el, int format, long case ENCODER_LZO: si->encoder_max_size = (tmp * 3 ); break; default: - si->encoder_max_size = ( 16 * 65535 ); + si->encoder_max_size = 8 * ( 16 * 65535 ); break; } diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index cc77e5f3..8bd943dd 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -1901,14 +1901,11 @@ int vj_tag_continue_record( int t1 ) return 1; } - // 2 GB barrier if (si->rec_total_bytes >= VEEJAY_FILE_LIMIT) { veejay_msg(VEEJAY_MSG_INFO, "Auto splitting files (reached internal 2GB barrier)"); si->sequence_num ++; si->rec_total_bytes = 0; - // si->encoder_duration - // reset some variables printf(" %d %ld %d (%ld)%ld \n", (int)si->sequence_num, diff --git a/veejay-current/veejay-server/libvje/effects/autoeq.c b/veejay-current/veejay-server/libvje/effects/autoeq.c index c7c192e8..bcf11094 100644 --- a/veejay-current/veejay-server/libvje/effects/autoeq.c +++ b/veejay-current/veejay-server/libvje/effects/autoeq.c @@ -76,12 +76,12 @@ void autoeq_apply( VJFrame *frame, int width, int height, int val, int intensity VJFrame tmp; veejay_memcpy( &tmp, frame, sizeof(VJFrame)); tmp.data[0] = (uint8_t*) vj_malloc( sizeof(uint8_t) * frame->len ); - veejay_memcpy( tmp.data[0], frame->data[0], frame->len ); + vj_frame_copy1( frame->data[0], tmp.data[0], frame->len ); veejay_histogram_draw( histogram_,&tmp, frame, intensity, strength ); - veejay_memset( frame->data[1], 128, frame->uv_len ); - veejay_memset( frame->data[2], 128, frame->uv_len ); + vj_frame_clear1( frame->data[1], 128, frame->uv_len ); + vj_frame_clear1( frame->data[2], 128, frame->uv_len ); free(tmp.data[0]); } diff --git a/veejay-current/veejay-server/libvje/effects/average.c b/veejay-current/veejay-server/libvje/effects/average.c index 9872c859..1c6745ca 100644 --- a/veejay-current/veejay-server/libvje/effects/average.c +++ b/veejay-current/veejay-server/libvje/effects/average.c @@ -34,6 +34,7 @@ vj_effect *average_init(int w, int h) ve->limits[0][0] = 1; ve->limits[1][0] = 100; ve->defaults[0] = 1; + ve->parallel = 1; ve->description = "Average"; ve->sub_format = 0; ve->extra_frame = 0; diff --git a/veejay-current/veejay-server/libvje/effects/bathroom.c b/veejay-current/veejay-server/libvje/effects/bathroom.c index 67238d26..d1b81802 100644 --- a/veejay-current/veejay-server/libvje/effects/bathroom.c +++ b/veejay-current/veejay-server/libvje/effects/bathroom.c @@ -88,10 +88,8 @@ void bathroom_verti_apply(VJFrame *frame, int width, int height, int val) uint8_t *Y = frame->data[0]; uint8_t *Cb = frame->data[1]; uint8_t *Cr = frame->data[2]; - - veejay_memcpy( bathroom_frame[0], Y, len); - veejay_memcpy( bathroom_frame[1], Cb, len); - veejay_memcpy( bathroom_frame[2], Cr, len); + int strides[4] = { len, len, len, 0 }; + vj_frame_copy( frame->data, bathroom_frame, strides ); if( y_val <= 0 ) y_val = 1; @@ -121,9 +119,8 @@ void bathroom_hori_apply(VJFrame *frame, int width, int height, int val) uint8_t *Cr = frame->data[2]; unsigned int x,y; - veejay_memcpy( bathroom_frame[0], Y, len); - veejay_memcpy( bathroom_frame[1], Cb, len); - veejay_memcpy( bathroom_frame[2], Cr, len); + int strides[4] = { len, len, len, 0 }; + vj_frame_copy( frame->data, bathroom_frame, strides ); for(y=0; y < height;y++) { for(x=0; x limits[1][0] = 255; ve->limits[0][1] = 0; /* mode */ ve->limits[1][1] = 1; - ve->defaults[0] = 45; ve->defaults[1] = 0; - ve->description = "Substract background (static, requires bg mask)"; ve->extra_frame = 0; ve->sub_format = 0; diff --git a/veejay-current/veejay-server/libvje/effects/binaryoverlays.c b/veejay-current/veejay-server/libvje/effects/binaryoverlays.c index b1fbce98..99cf4daf 100644 --- a/veejay-current/veejay-server/libvje/effects/binaryoverlays.c +++ b/veejay-current/veejay-server/libvje/effects/binaryoverlays.c @@ -35,6 +35,7 @@ vj_effect *binaryoverlay_init(int w, int h) ve->description = "Binary Overlays"; ve->limits[0][0] = 0; ve->limits[1][0] = 10; + ve->parallel = 1; ve->extra_frame = 1; ve->sub_format = 0; ve->has_user = 0; diff --git a/veejay-current/veejay-server/libvje/effects/bwselect.c b/veejay-current/veejay-server/libvje/effects/bwselect.c index 695bb99e..e4b7091f 100644 --- a/veejay-current/veejay-server/libvje/effects/bwselect.c +++ b/veejay-current/veejay-server/libvje/effects/bwselect.c @@ -32,7 +32,7 @@ vj_effect *bwselect_init(int w, int h) ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */ ve->defaults[0] = 16; ve->defaults[1] = 235; - + ve->parallel = 1; ve->limits[0][0] = 0; ve->limits[1][0] = 255; ve->limits[0][1] = 0; diff --git a/veejay-current/veejay-server/libvje/effects/chameleon.c b/veejay-current/veejay-server/libvje/effects/chameleon.c index 0987388b..b577468f 100644 --- a/veejay-current/veejay-server/libvje/effects/chameleon.c +++ b/veejay-current/veejay-server/libvje/effects/chameleon.c @@ -67,10 +67,10 @@ int chameleon_prepare( uint8_t *map[3], int width, int height ) if(!bgimage[0]) return 0; - //@ copy the iamge - veejay_memcpy( bgimage[0], map[0], (width*height)); - veejay_memcpy( bgimage[1], map[1], (width*height)); - veejay_memcpy( bgimage[2], map[2], (width*height)); + + //@ copy the iamge + int strides[4] = { width * height, width * height, width * height, 0 }; + vj_frame_copy( map, bgimage, strides ); VJFrame tmp; veejay_memset( &tmp, 0, sizeof(VJFrame)); @@ -239,9 +239,9 @@ void chameleon_apply( VJFrame *frame, int width, int height, int mode) unsigned int i; const int len = (width * height); VJFrame source; - veejay_memcpy( tmpimage[0], frame->data[0], len ); - veejay_memcpy( tmpimage[1], frame->data[1], len ); - veejay_memcpy( tmpimage[2], frame->data[2], len ); + int strides[4] = { len, len, len, 0 }; + vj_frame_copy1( frame->data, tmpimage, strides ); + veejay_memcpy( &source, frame, sizeof(VJFrame)); source.data[0] = tmpimage[0]; source.data[1] = tmpimage[1]; diff --git a/veejay-current/veejay-server/libvje/effects/chameleonblend.c b/veejay-current/veejay-server/libvje/effects/chameleonblend.c index 707f1fb9..5f9125d7 100644 --- a/veejay-current/veejay-server/libvje/effects/chameleonblend.c +++ b/veejay-current/veejay-server/libvje/effects/chameleonblend.c @@ -66,11 +66,8 @@ int chameleonblend_prepare( uint8_t *map[3], int width, int height ) { if(!bgimage[0]) return 0; - - //@ copy the iamge - veejay_memcpy( bgimage[0], map[0], (width*height)); - veejay_memcpy( bgimage[1], map[1], (width*height)); - veejay_memcpy( bgimage[2], map[2], (width*height)); + int strides[4] = { width*height,width*height,width*height, 0 }; + vj_frame_copy( map, bgimage, strides ); VJFrame tmp; veejay_memset( &tmp, 0, sizeof(VJFrame)); diff --git a/veejay-current/veejay-server/libvje/effects/checker.c b/veejay-current/veejay-server/libvje/effects/checker.c index ddd0e3f9..9c8b9790 100644 --- a/veejay-current/veejay-server/libvje/effects/checker.c +++ b/veejay-current/veejay-server/libvje/effects/checker.c @@ -83,8 +83,7 @@ int motionmap_prepare( uint8_t *map[3], int w, int h ) { if(!previous_img) return 0; - - veejay_memcpy( previous_img, map[0], w * h ); + vj_frame_copy( map, previous_img, w*h ); have_bg = 1; nframe_ = 0; running = 0; @@ -180,12 +179,12 @@ void motionmap_apply( VJFrame *frame, int width, int height, int threshold, int int w = frame->width; int h = frame->height; - veejay_memcpy( original_img, frame->data[0], len ); + vj_frame_copy1( frame->data[0], original_img, len ); // softblur_apply( frame, width,height,0 ); if(!have_bg) { - veejay_memcpy( previous_img, frame->data[0], len ); + vj_frame_copy1( frame->data[0], previous_img, len ); have_bg = 1; nframe_ = 0; running = 0; diff --git a/veejay-current/veejay-server/libvje/effects/chromamagick.c b/veejay-current/veejay-server/libvje/effects/chromamagick.c index dd90aaea..c7f4dd58 100644 --- a/veejay-current/veejay-server/libvje/effects/chromamagick.c +++ b/veejay-current/veejay-server/libvje/effects/chromamagick.c @@ -40,11 +40,13 @@ vj_effect *chromamagick_init(int w, int h) ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */ ve->defaults[0] = 7; ve->defaults[1] = 150; + ve->parallel = 1; ve->description = "Chroma Magic"; ve->limits[0][0] = 0; ve->limits[1][0] = 25; ve->limits[0][1] = 0; ve->limits[1][1] = 255; + ve->parallel = 1; ve->extra_frame = 1; ve->sub_format = 1; ve->has_user = 0; diff --git a/veejay-current/veejay-server/libvje/effects/chromapalette.c b/veejay-current/veejay-server/libvje/effects/chromapalette.c index b9140ac3..65fcda25 100644 --- a/veejay-current/veejay-server/libvje/effects/chromapalette.c +++ b/veejay-current/veejay-server/libvje/effects/chromapalette.c @@ -56,7 +56,9 @@ vj_effect *chromapalette_init(int w, int h) ve->defaults[3] = 0; //b ve->defaults[4] = 200; //cb default ve->defaults[5] = 20; //cr default - ve->description = "Chrominance Palette (rgb key) "; + ve->parallel = 1; + + ve->description = "Chrominance Palette (rgb key) "; ve->sub_format = 1; ve->extra_frame = 0; ve->has_help = 1; diff --git a/veejay-current/veejay-server/libvje/effects/chromium.c b/veejay-current/veejay-server/libvje/effects/chromium.c index e6272d09..9431fe9f 100644 --- a/veejay-current/veejay-server/libvje/effects/chromium.c +++ b/veejay-current/veejay-server/libvje/effects/chromium.c @@ -37,7 +37,8 @@ vj_effect *chromium_init(int w, int h) ve->limits[1][0] = 3; ve->defaults[0] = 0; ve->description = "Chromium"; - ve->sub_format = 0; + ve->parallel = 1; + ve->sub_format = 0; ve->extra_frame = 0; ve->has_user = 0; ve->param_description = vje_build_param_list( ve->num_params, "Mode" ); diff --git a/veejay-current/veejay-server/libvje/effects/complexinvert.c b/veejay-current/veejay-server/libvje/effects/complexinvert.c index 6edd3059..612b026c 100644 --- a/veejay-current/veejay-server/libvje/effects/complexinvert.c +++ b/veejay-current/veejay-server/libvje/effects/complexinvert.c @@ -41,7 +41,7 @@ vj_effect *complexinvert_init(int w, int h) ve->defaults[4] = 2400; /* noise suppression*/ ve->limits[0][0] = 5; ve->limits[1][0] = 900; - + ve->parallel = 1; ve->limits[0][1] = 0; ve->limits[1][1] = 255; diff --git a/veejay-current/veejay-server/libvje/effects/complexopacity.c b/veejay-current/veejay-server/libvje/effects/complexopacity.c index 42f8a517..5c70500f 100644 --- a/veejay-current/veejay-server/libvje/effects/complexopacity.c +++ b/veejay-current/veejay-server/libvje/effects/complexopacity.c @@ -56,7 +56,8 @@ vj_effect *complexopacity_init(int w, int h) ve->limits[0][4] = 0; ve->limits[1][4] = 255; ve->has_user = 0; - ve->description = "Complex Overlay"; + ve->parallel = 1; + ve->description = "Complex Overlay"; ve->extra_frame = 1; ve->sub_format = 1; ve->rgb_conv = 1; diff --git a/veejay-current/veejay-server/libvje/effects/complexsync.c b/veejay-current/veejay-server/libvje/effects/complexsync.c index 00b5211c..b148ae69 100644 --- a/veejay-current/veejay-server/libvje/effects/complexsync.c +++ b/veejay-current/veejay-server/libvje/effects/complexsync.c @@ -77,19 +77,14 @@ void complexsync_apply(VJFrame *frame, VJFrame *frame2, int width, int height, i uint8_t *Cr2 = frame2->data[2]; const unsigned int region = width * val; + int strides[4] = { region, region, region, 0 }; + vj_frame_copy( frame->data, c_outofsync_buffer, strides ); - veejay_memcpy( c_outofsync_buffer[0], Y, region ); - veejay_memcpy( c_outofsync_buffer[1], Cb, region ); - veejay_memcpy( c_outofsync_buffer[2], Cr, region ); - - veejay_memcpy( Y, Y2, region ); - veejay_memcpy( Cb, Cb2, region ); - veejay_memcpy( Cr, Cr2, region ); + vj_frame_copy( frame2->data, frame->data, strides ); if( (len - region) > 0) { - veejay_memcpy( Y + region, c_outofsync_buffer[0], (len-region) ); - veejay_memcpy( Cb + region, c_outofsync_buffer[1], (len - region) ); - veejay_memcpy( Cr + region, c_outofsync_buffer[2], (len - region) ); + uint8_t *dest[3] = { Y + region, Cb + region, Cr + region }; + vj_frame_copy( c_outofsync_buffer, dest, strides ); } } diff --git a/veejay-current/veejay-server/libvje/effects/complexthreshold.c b/veejay-current/veejay-server/libvje/effects/complexthreshold.c index 5da2914e..5a1e8c2b 100644 --- a/veejay-current/veejay-server/libvje/effects/complexthreshold.c +++ b/veejay-current/veejay-server/libvje/effects/complexthreshold.c @@ -57,7 +57,9 @@ vj_effect *complexthreshold_init(int w, int h) ve->limits[1][5] = 255; ve->limits[0][4] = 0; ve->limits[1][4] = 4; - ve->description = "Complex Threshold (fixme)"; + + ve->parallel = 1; + ve->description = "Complex Threshold"; ve->extra_frame = 1; ve->sub_format = 1; ve->has_user = 0; diff --git a/veejay-current/veejay-server/libvje/effects/constantblend.c b/veejay-current/veejay-server/libvje/effects/constantblend.c index 9e26fcfc..f6e11356 100644 --- a/veejay-current/veejay-server/libvje/effects/constantblend.c +++ b/veejay-current/veejay-server/libvje/effects/constantblend.c @@ -49,6 +49,7 @@ vj_effect *constantblend_init(int w, int h) ve->defaults[1] = 110; // scale before blend ve->defaults[2] = 16; // constant Y ve->description = "Constant Luminance Blend"; + ve->parallel = 1; ve->sub_format = 0; ve->extra_frame = 0; ve->has_user = 0; diff --git a/veejay-current/veejay-server/libvje/effects/contourextract.c b/veejay-current/veejay-server/libvje/effects/contourextract.c index ee55f6ff..013e4fe5 100644 --- a/veejay-current/veejay-server/libvje/effects/contourextract.c +++ b/veejay-current/veejay-server/libvje/effects/contourextract.c @@ -194,8 +194,8 @@ int contourextract_prepare(uint8_t *map[3], int width, int height) { return 0; } - - veejay_memcpy( static_bg, map[0], (width*height)); + + vj_frame_copy1( map[0], static_bg, (width*height)); VJFrame tmp; veejay_memset( &tmp, 0, sizeof(VJFrame)); @@ -271,8 +271,8 @@ void contourextract_apply(void *ed, VJFrame *frame,int width, int height, contourextract_data *ud = (contourextract_data*) ed; if( take_bg != take_bg_ ) - { - veejay_memcpy( static_bg, frame->data[0], frame->len ); + { + vj_frame_copy1( frame->data[0], static_bg, frame->len ); take_bg_ = take_bg; bg_frame_ ++; return; @@ -298,9 +298,9 @@ void contourextract_apply(void *ed, VJFrame *frame,int width, int height, if(mode==1) { //@ show difference image in grayscale - veejay_memcpy( Y, ud->bitmap, len ); - veejay_memset( Cb, 128, uv_len ); - veejay_memset( Cr, 128, uv_len ); + vj_frame_copy1( ud->bitmap, Y, len ); + vj_frame_clear1( Cb, 128, uv_len ); + vj_frame_clear1( Cr, 128, uv_len ); return; } diff --git a/veejay-current/veejay-server/libvje/effects/contrast.c b/veejay-current/veejay-server/libvje/effects/contrast.c index 2fec1312..b68096cd 100644 --- a/veejay-current/veejay-server/libvje/effects/contrast.c +++ b/veejay-current/veejay-server/libvje/effects/contrast.c @@ -39,7 +39,8 @@ vj_effect *contrast_init(int w, int h) ve->limits[1][1] = 255; ve->limits[0][2] = 0; ve->limits[1][2] = 255; - ve->description = "Contrast"; + ve->parallel = 1; + ve->description = "Contrast"; ve->has_user = 0; ve->extra_frame = 0; ve->sub_format = 0; diff --git a/veejay-current/veejay-server/libvje/effects/crosspixel.c b/veejay-current/veejay-server/libvje/effects/crosspixel.c index 40491633..5dc44f51 100644 --- a/veejay-current/veejay-server/libvje/effects/crosspixel.c +++ b/veejay-current/veejay-server/libvje/effects/crosspixel.c @@ -79,21 +79,19 @@ void crosspixel_apply(VJFrame *frame, int w, int h, int t,int v) { const int uv_height = frame->uv_height; unsigned int p = 0; - - veejay_memcpy( cross_pixels[0], Y, len); - veejay_memcpy( cross_pixels[1], Cb, uv_len); - veejay_memcpy( cross_pixels[2], Cr, uv_len); + int strides[4] = { len, uv_len, uv_len ,0}; + vj_frame_copy( frame->data, cross_pixels, strides ); if(t==0) { - veejay_memset(Y, pixel_Y_lo_, len); - veejay_memset(Cb, 128, uv_len); - veejay_memset(Cr, 128, uv_len); + vj_frame_clear1(Y, pixel_Y_lo_, len); + vj_frame_clear1(Cb, 128, uv_len); + vj_frame_clear1(Cr, 128, uv_len); } else { - veejay_memset(Y, 235, len); - veejay_memset(Cb, 128, uv_len); - veejay_memset(Cr, 128, uv_len); + vj_frame_clear1(Y, 235, len); + vj_frame_clear1(Cb, 128, uv_len); + vj_frame_clear1(Cr, 128, uv_len); } for(y=0; y < (h>>1); y++) { diff --git a/veejay-current/veejay-server/libvje/effects/dissolve.c b/veejay-current/veejay-server/libvje/effects/dissolve.c index e87ca6af..16551b4c 100644 --- a/veejay-current/veejay-server/libvje/effects/dissolve.c +++ b/veejay-current/veejay-server/libvje/effects/dissolve.c @@ -34,6 +34,7 @@ vj_effect *dissolve_init(int w, int h) ve->limits[0][0] = 0; ve->limits[1][0] = 255; ve->defaults[0] = 150; + ve->parallel = 1; ve->description = "Dissolve Overlay"; ve->sub_format = 1; ve->extra_frame = 1; diff --git a/veejay-current/veejay-server/libvje/effects/dupmagic.c b/veejay-current/veejay-server/libvje/effects/dupmagic.c index 6460266d..1d4ccc4c 100644 --- a/veejay-current/veejay-server/libvje/effects/dupmagic.c +++ b/veejay-current/veejay-server/libvje/effects/dupmagic.c @@ -35,8 +35,10 @@ vj_effect *dupmagic_init(int w, int h) ve->limits[0][0] = 1; ve->limits[1][0] = 13; ve->extra_frame = 1; - ve->sub_format = 0; + ve->parallel = 1; + ve->sub_format = 0; ve->has_user = 0; + ve->parallel = 1; ve->param_description = vje_build_param_list( ve->num_params, "Mode" ); return ve; } diff --git a/veejay-current/veejay-server/libvje/effects/flare.c b/veejay-current/veejay-server/libvje/effects/flare.c index adcf2b84..b9491a73 100644 --- a/veejay-current/veejay-server/libvje/effects/flare.c +++ b/veejay-current/veejay-server/libvje/effects/flare.c @@ -269,11 +269,8 @@ void flare_apply(VJFrame *A, B.data[0] = flare_buf[0]; B.data[1] = flare_buf[1]; B.data[2] = flare_buf[2]; - - /* copy image data */ - veejay_memcpy( B.data[0], A->data[0], A->len ); - veejay_memcpy( B.data[1], A->data[1], A->len ); - veejay_memcpy( B.data[2], A->data[2], A->len ); + int strides[4] = { A->len, A->len, A->len, 0 }; + vj_frame_copy( A->data, B.data,strides ); /* apply blur on Image, horizontal and vertical (blur2 is from xine, see radial blur */ diff --git a/veejay-current/veejay-server/libvje/effects/gamma.c b/veejay-current/veejay-server/libvje/effects/gamma.c index cc03e9ac..f2c97fbf 100644 --- a/veejay-current/veejay-server/libvje/effects/gamma.c +++ b/veejay-current/veejay-server/libvje/effects/gamma.c @@ -41,7 +41,8 @@ vj_effect *gamma_init(int w, int h) ve->sub_format = 0; ve->has_user = 0; ve->param_description = vje_build_param_list(ve->num_params, "Gamma"); - return ve; + ve->parallel = 1; + return ve; } // FIXME private diff --git a/veejay-current/veejay-server/libvje/effects/greyselect.c b/veejay-current/veejay-server/libvje/effects/greyselect.c index b464627a..b36d220c 100644 --- a/veejay-current/veejay-server/libvje/effects/greyselect.c +++ b/veejay-current/veejay-server/libvje/effects/greyselect.c @@ -48,7 +48,8 @@ vj_effect *greyselect_init(int w, int h) ve->limits[0][3] = 0; ve->limits[1][3] = 255; ve->has_user = 0; - ve->description = "Grayscale by Color Key"; + ve->parallel = 1; + ve->description = "Grayscale by Color Key"; ve->extra_frame = 0; ve->sub_format = 1; ve->rgb_conv = 1; diff --git a/veejay-current/veejay-server/libvje/effects/isolate.c b/veejay-current/veejay-server/libvje/effects/isolate.c index 87c437d7..94573196 100644 --- a/veejay-current/veejay-server/libvje/effects/isolate.c +++ b/veejay-current/veejay-server/libvje/effects/isolate.c @@ -52,6 +52,7 @@ vj_effect *isolate_init(int w, int h) ve->limits[0][4] = 0; ve->limits[1][4] = 255; ve->has_user = 0; + ve->parallel = 1; ve->description = "Isolate Color"; ve->extra_frame = 0; ve->sub_format = 1; diff --git a/veejay-current/veejay-server/libvje/effects/keyselect.c b/veejay-current/veejay-server/libvje/effects/keyselect.c index 86329dcd..1e23665a 100644 --- a/veejay-current/veejay-server/libvje/effects/keyselect.c +++ b/veejay-current/veejay-server/libvje/effects/keyselect.c @@ -56,7 +56,8 @@ vj_effect *keyselect_init(int w, int h) ve->limits[0][5] = 0; ve->limits[1][5] = 3500; ve->has_user = 0; - ve->description = "Blend by Color Key"; + ve->parallel = 1; + ve->description = "Blend by Color Key"; ve->extra_frame = 1; ve->sub_format = 1; ve->rgb_conv = 1; diff --git a/veejay-current/veejay-server/libvje/effects/killchroma.c b/veejay-current/veejay-server/libvje/effects/killchroma.c index d650d628..d57858cc 100644 --- a/veejay-current/veejay-server/libvje/effects/killchroma.c +++ b/veejay-current/veejay-server/libvje/effects/killchroma.c @@ -42,7 +42,7 @@ vj_effect *killchroma_init(int w, int h) ve->description = "Filter out chroma channels"; ve->extra_frame = 0; ve->param_description = vje_build_param_list(ve->num_params, "Mode" ); - + ve->parallel = 1; return ve; } diff --git a/veejay-current/veejay-server/libvje/effects/lumablend.c b/veejay-current/veejay-server/libvje/effects/lumablend.c index 6f4840cd..13363e6b 100644 --- a/veejay-current/veejay-server/libvje/effects/lumablend.c +++ b/veejay-current/veejay-server/libvje/effects/lumablend.c @@ -22,6 +22,7 @@ #include #include #include "lumablend.h" +#include vj_effect *lumablend_init(int w, int h) { @@ -32,6 +33,8 @@ vj_effect *lumablend_init(int w, int h) ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */ ve->limits[0][0] = 0; /* type */ ve->limits[1][0] = 2; + if(vj_task_available() ) + ve->limits[1][0] = 1; /* no blur */ ve->limits[0][1] = 0; /* threshold 1 */ ve->limits[1][1] = 255; ve->limits[0][2] = 0; /* threshold 2 */ @@ -44,7 +47,9 @@ vj_effect *lumablend_init(int w, int h) ve->defaults[3] = 150; ve->description = "Opacity by Threshold"; ve->extra_frame = 1; + ve->parallel = 0; ve->sub_format = 1; + ve->parallel = 1; ve->has_user = 0; ve->param_description = vje_build_param_list(ve->num_params, "Mode", "Threshold A", "Threshold B", "Opacity" ); @@ -119,8 +124,23 @@ void opacity_by_threshold_blur(uint8_t * yuv1[3], uint8_t * yuv2[3], unsigned int op0, op1; op1 = (opacity > 255) ? 255 : opacity; op0 = 255 - op1; - /* incomplete */ + for( y = 0; y < width; y+= width ) { + for( x = 0; x < width; x ++ ) { + + yuv1[0][x + y] = (op0 * a1 + op1 * a2) >> 8; + yuv1[1][x + y] = + (op0 * yuv1[1][x + y] + op1 * yuv2[1][x + y]) >> 8; + yuv1[2][x + y] = + (op0 * yuv1[2][x + y] + op1 * yuv2[2][x + y]) >> 8; + } + } for (y = width; y < len; y += width) { + yuv1[0][y] = (op0 * a1 + op1 * a2) >> 8; + yuv1[1][y] = + (op0 * yuv1[1][y] + op1 * yuv2[1][y]) >> 8; + yuv1[2][y] = + (op0 * yuv1[2][y] + op1 * yuv2[2][y]) >> 8; + for (x = 1; x < width-1; x++) { a1 = yuv1[0][x + y]; a2 = yuv2[0][x + y]; @@ -154,7 +174,23 @@ void opacity_by_threshold_blur(uint8_t * yuv1[3], uint8_t * yuv2[3], (op0 * yuv1[2][x + y] + op1 * yuv2[2][x + y]) >> 8; } } + + yuv1[0][width + y] = (op0 * a1 + op1 * a2) >> 8; + yuv1[1][width + y] = + (op0 * yuv1[1][width + y] + op1 * yuv2[1][width + y]) >> 8; + yuv1[2][width + y] = + (op0 * yuv1[2][width + y] + op1 * yuv2[2][width + y]) >> 8; + } + for( x = 0; x < width; x ++ ) { + + yuv1[0][x + y] = (op0 * a1 + op1 * a2) >> 8; + yuv1[1][x + y] = + (op0 * yuv1[1][x + y] + op1 * yuv2[1][x + y]) >> 8; + yuv1[2][x + y] = + (op0 * yuv1[2][x + y] + op1 * yuv2[2][x + y]) >> 8; + } + } void lumablend_apply(VJFrame *frame, VJFrame *frame2, int width, diff --git a/veejay-current/veejay-server/libvje/effects/lumamagick.c b/veejay-current/veejay-server/libvje/effects/lumamagick.c index e284e3ae..8b0b47ed 100644 --- a/veejay-current/veejay-server/libvje/effects/lumamagick.c +++ b/veejay-current/veejay-server/libvje/effects/lumamagick.c @@ -39,7 +39,8 @@ vj_effect *lumamagick_init(int width, int height) ve->defaults[0] = 1; ve->defaults[1] = 100; ve->defaults[2] = 100; - ve->description = "Luma Magick"; + ve->parallel = 1; + ve->description = "Luma Magick"; ve->limits[0][0] = 1; ve->limits[1][0] = 39; ve->limits[0][1] = 0; diff --git a/veejay-current/veejay-server/libvje/effects/magicmirror.c b/veejay-current/veejay-server/libvje/effects/magicmirror.c index 96371c0b..a93c4965 100644 --- a/veejay-current/veejay-server/libvje/effects/magicmirror.c +++ b/veejay-current/veejay-server/libvje/effects/magicmirror.c @@ -167,10 +167,8 @@ void magicmirror_apply( VJFrame *frame, int w, int h, int vx, int vy, int d, int } } - veejay_memcpy( magicmirrorbuf[0], Y, len ); - veejay_memcpy( magicmirrorbuf[1], Cb, len ); - veejay_memcpy( magicmirrorbuf[2], Cr, len ); - + int strides[4] = { len,len,len, 0 }; + vj_frame_copy( frame->data, magicmirrorbuf, strides ); for(x=0; x < w; x++) { diff --git a/veejay-current/veejay-server/libvje/effects/magicoverlays.c b/veejay-current/veejay-server/libvje/effects/magicoverlays.c index 241bd1ee..75465f40 100644 --- a/veejay-current/veejay-server/libvje/effects/magicoverlays.c +++ b/veejay-current/veejay-server/libvje/effects/magicoverlays.c @@ -23,8 +23,8 @@ #include #include "magicoverlays.h" #include - -#include "common.h" +#include "common.h" +#include vj_effect *overlaymagic_init(int w, int h) { vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); @@ -42,7 +42,8 @@ vj_effect *overlaymagic_init(int w, int h) ve->extra_frame = 1; ve->sub_format = 0; ve->has_user = 0; - ve->param_description = vje_build_param_list( ve->num_params, "Mode", "Keep or clear color" ); + ve->parallel = 1; + ve->param_description = vje_build_param_list( ve->num_params, "Mode", "Keep or clear color" ); return ve; } @@ -791,4 +792,6 @@ void overlaymagic_apply(VJFrame *frame, VJFrame *frame2, int width, veejay_memset( frame->data[2], 128, frame->uv_len ); } } + + void overlaymagic_free(){} diff --git a/veejay-current/veejay-server/libvje/effects/motionmap.c b/veejay-current/veejay-server/libvje/effects/motionmap.c index 89d92721..0a1a6490 100644 --- a/veejay-current/veejay-server/libvje/effects/motionmap.c +++ b/veejay-current/veejay-server/libvje/effects/motionmap.c @@ -247,9 +247,10 @@ void motionmap_lerp_frame( VJFrame *cur, VJFrame *prev, int N, int n ) void motionmap_store_frame( VJFrame *fx ) { - veejay_memcpy( interpolate_buf, fx->data[0], fx->len ); - veejay_memcpy( interpolate_buf+fx->len,fx->data[1],fx->len); - veejay_memcpy( interpolate_buf+fx->len+fx->len,fx->data[2],fx->len); + uint8_t *dest[3] = { + interpolate_buf, interpolate_buf + fx->len, interpolate_buf + fx->len + fx->len }; + int strides[4] = { fx->len, fx->len, fx->len, 0 }; + vj_frame_copy( fx->data, dest, strides ); } void motionmap_interpolate_frame( VJFrame *fx, int N, int n ) @@ -270,8 +271,7 @@ int motionmap_prepare( uint8_t *map[3], int width, int height ) { if(!previous_img) return 0; - - veejay_memcpy( previous_img ,map[0], width *height ); + vj_frame_copy1( map[0], previous_img, width * height ); have_bg = 1; nframe_ = 0; running = 0; @@ -293,7 +293,7 @@ void motionmap_apply( VJFrame *frame, int width, int height, int threshold, int return; } - veejay_memcpy( original_img, frame->data[0], len ); + vj_frame_copy1( frame->data[0], original_img, len ); softblur_apply( frame, width,height,0 ); update_bgmask( binary_img, previous_img, frame->data[0], len , threshold); @@ -335,9 +335,9 @@ void motionmap_apply( VJFrame *frame, int width, int height, int threshold, int if( draw ) { - veejay_memset( Cb, 128, len ); - veejay_memset( Cr, 128, len ); - veejay_memcpy( frame->data[0], binary_img, len ); + vj_frame_clear1( Cb, 128, len ); + vj_frame_clear1( Cr, 128, len ); + vj_frame_copy1( binary_img, frame->data[0], len ); nframe_++; return; } @@ -381,10 +381,9 @@ void motionmap_apply( VJFrame *frame, int width, int height, int threshold, int uint8_t *dst[3]; dst[0] = large_buf + ( n_captured * (len*3) ); dst[1] = dst[0] + len; - dst[2] = dst[1] + len; - veejay_memcpy( dst[0], frame->data[0], len ); - veejay_memcpy( dst[1], frame->data[1], len ); - veejay_memcpy( dst[2], frame->data[2], len ); + dst[2] = dst[1] + len; + int strides[4] = { len, len, len, 0 }; + vj_frame_copy( frame->data, dst, strides ); n_captured ++; if( n_captured >= MAXCAPBUF ) { @@ -405,7 +404,7 @@ void motionmap_apply( VJFrame *frame, int width, int height, int threshold, int VJFrame b; veejay_memcpy(&b, frame, sizeof(VJFrame)); b.data[0] = src[0]; b.data[1] = src[1]; b.data[2] = src[2]; - opacity_apply( frame, &b, frame->width,frame->height, capbuf ); + opacity_applyN( frame, &b, frame->width,frame->height, capbuf ); n_played ++; @@ -417,7 +416,7 @@ void motionmap_apply( VJFrame *frame, int width, int height, int threshold, int nframe_++; return; } - veejay_memcpy( frame->data[0], original_img, len ); + vj_frame_copy1( original_img, frame->data[0], len ); nframe_ ++; running = 1; } diff --git a/veejay-current/veejay-server/libvje/effects/mtracer.c b/veejay-current/veejay-server/libvje/effects/mtracer.c index 0fcc5971..db812512 100644 --- a/veejay-current/veejay-server/libvje/effects/mtracer.c +++ b/veejay-current/veejay-server/libvje/effects/mtracer.c @@ -73,6 +73,7 @@ void mtracer_apply( VJFrame *frame, VJFrame *frame2, uint8_t *Y = frame->data[0]; uint8_t *Cb= frame->data[1]; uint8_t *Cr= frame->data[2]; + int strides[4] = { len, uv_len, uv_len, 0 }; if (mtrace_counter == 0) { overlaymagic_apply(frame, frame2, width, height, mode,0); diff --git a/veejay-current/veejay-server/libvje/effects/negatechannel.c b/veejay-current/veejay-server/libvje/effects/negatechannel.c index bb056e50..4c18a3ba 100644 --- a/veejay-current/veejay-server/libvje/effects/negatechannel.c +++ b/veejay-current/veejay-server/libvje/effects/negatechannel.c @@ -38,7 +38,8 @@ vj_effect *negatechannel_init(int w, int h) ve->defaults[0] = 0; ve->defaults[1] = 0xff; ve->description = "Negate a channel"; - ve->sub_format = 0; + ve->parallel = 1; + ve->sub_format = 0; ve->extra_frame = 0; ve->has_user = 0; ve->param_description = vje_build_param_list( ve->num_params, "Y=0, Cb=1, Cr=2", "Value" ); diff --git a/veejay-current/veejay-server/libvje/effects/negation.c b/veejay-current/veejay-server/libvje/effects/negation.c index 7a34a325..d2c5e35f 100644 --- a/veejay-current/veejay-server/libvje/effects/negation.c +++ b/veejay-current/veejay-server/libvje/effects/negation.c @@ -37,6 +37,7 @@ vj_effect *negation_init(int w, int h) ve->description = "Negation"; ve->sub_format = 0; ve->extra_frame = 0; + ve->parallel = 1; ve->has_user = 0; ve->param_description = vje_build_param_list( ve->num_params, "Value" ); return ve; diff --git a/veejay-current/veejay-server/libvje/effects/neighbours.c b/veejay-current/veejay-server/libvje/effects/neighbours.c index e1e5d697..3f8e65c8 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours.c @@ -227,12 +227,12 @@ void neighbours_apply( VJFrame *frame, int width, int height, int brush_size, in uint8_t *dstCb = frame->data[1]; uint8_t *dstCr = frame->data[2]; // keep luma - veejay_memcpy( Y2, frame->data[0], frame->len ); - + vj_frame_copy1( frame->data[0],Y2,frame->len ); if(mode) { - veejay_memcpy( chromacity[0], frame->data[1], frame->len ); - veejay_memcpy( chromacity[1], frame->data[2], frame->len ); + int strides[4] = { 0,frame->len, frame->len }; + uint8_t *dest[3] = { NULL, chromacity[0], chromacity[1] }; + vj_frame_copy( frame->data, dest, strides ); } // premultiply intensity map diff --git a/veejay-current/veejay-server/libvje/effects/neighbours2.c b/veejay-current/veejay-server/libvje/effects/neighbours2.c index ce9061ff..21daa5ae 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours2.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours2.c @@ -228,12 +228,13 @@ void neighbours2_apply( VJFrame *frame, int width, int height, int brush_size, i uint8_t *dstCb = frame->data[1]; uint8_t *dstCr = frame->data[2]; // keep luma - veejay_memcpy( Y2, frame->data[0], frame->len ); + vj_frame_copy1( frame->data[0],Y2, frame->len ); if(mode) { - veejay_memcpy( chromacity[0], frame->data[1], frame->len ); - veejay_memcpy( chromacity[1], frame->data[2], frame->len ); + int strides[4] = { 0, frame->len, frame->len,0 }; + uint8_t *dest[3] = { NULL, chromacity[0],chromacity[1] }; + vj_frame_copy( frame->data, dest, strides ); } // premultiply intensity map diff --git a/veejay-current/veejay-server/libvje/effects/neighbours3.c b/veejay-current/veejay-server/libvje/effects/neighbours3.c index ba294acd..4c003f20 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours3.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours3.c @@ -231,12 +231,13 @@ void neighbours3_apply( VJFrame *frame, int width, int height, int brush_size, i uint8_t *dstCb = frame->data[1]; uint8_t *dstCr = frame->data[2]; // keep luma - veejay_memcpy( Y2, frame->data[0], frame->len ); + vj_frame_copy1( frame->data[0],Y2, frame->len ); if(mode) { - veejay_memcpy( chromacity[0], frame->data[1], frame->len ); - veejay_memcpy( chromacity[1], frame->data[2], frame->len ); + int strides[4] = { 0, frame->len, frame->len, 0 }; + uint8_t *dest[3] = { NULL, chromacity[0], chromacity[1] }; + vj_frame_copy( frame->data, dest, strides ); } // premultiply intensity map diff --git a/veejay-current/veejay-server/libvje/effects/neighbours4.c b/veejay-current/veejay-server/libvje/effects/neighbours4.c index edbbcf41..e660e0fb 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours4.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours4.c @@ -270,16 +270,16 @@ void neighbours4_apply( VJFrame *frame, int width, int height, int radius, int b uint8_t *dstCr = frame->data[2]; double r = (double)radius; // keep luma - veejay_memcpy( Y2, frame->data[0], frame->len ); - + vj_frame_copy1( frame->data[0], Y2, frame->len ); create_circle( r, brush_size,width ); relpoint_t *p_points = &points[0]; if(mode) { - veejay_memcpy( chromacity[0], frame->data[1], frame->len ); - veejay_memcpy( chromacity[1], frame->data[2], frame->len ); + int strides[4] = { 0,frame->len, frame->len }; + uint8_t *dest[3] = { NULL, chromacity[0], chromacity[1] }; + vj_frame_copy( frame->data, dest, strides ); } diff --git a/veejay-current/veejay-server/libvje/effects/neighbours5.c b/veejay-current/veejay-server/libvje/effects/neighbours5.c index da708550..b5ec8476 100644 --- a/veejay-current/veejay-server/libvje/effects/neighbours5.c +++ b/veejay-current/veejay-server/libvje/effects/neighbours5.c @@ -231,12 +231,14 @@ void neighbours5_apply( VJFrame *frame, int width, int height, int brush_size, i uint8_t *dstCb = frame->data[1]; uint8_t *dstCr = frame->data[2]; // keep luma - veejay_memcpy( Y2, frame->data[0], frame->len ); + + vj_frame_copy1( frame->data[0], Y2, frame->len ); if(mode) { - veejay_memcpy( chromacity[0], frame->data[1], frame->len ); - veejay_memcpy( chromacity[1], frame->data[2], frame->len ); + int strides[4] = { 0,frame->len, frame->len }; + uint8_t *dest[3] = { NULL, chromacity[0], chromacity[1] }; + vj_frame_copy( frame->data, dest, strides ); } // premultiply intensity map diff --git a/veejay-current/veejay-server/libvje/effects/nervous.c b/veejay-current/veejay-server/libvje/effects/nervous.c index 41596775..61abf0ae 100644 --- a/veejay-current/veejay-server/libvje/effects/nervous.c +++ b/veejay-current/veejay-server/libvje/effects/nervous.c @@ -64,9 +64,9 @@ int nervous_malloc(int w, int h ) nervous_buf[2] = nervous_buf[1] + (w*h*N_MAX); frames_elapsed = 0; - veejay_memset( nervous_buf[0], 0, (w*h) * N_MAX ); - veejay_memset( nervous_buf[1], 128, (w*h) * N_MAX ); - veejay_memset( nervous_buf[2], 128, (w*h) * N_MAX ); + vj_frame_clear1( nervous_buf[0], 0, (w*h) * N_MAX ); + vj_frame_clear1( nervous_buf[1], 128, (w*h) * N_MAX ); + vj_frame_clear1( nervous_buf[2], 128, (w*h) * N_MAX ); return 1; } @@ -92,10 +92,10 @@ void nervous_apply( VJFrame *frame, int width, int height, int delay) uint8_t *NCb= nervous_buf[1] + (uv_len * frames_elapsed ); uint8_t *NCr= nervous_buf[2] + (uv_len * frames_elapsed ); - // copy original into nervous buf - veejay_memcpy( NY, Y, len ); - veejay_memcpy( NCb, Cb, uv_len ); - veejay_memcpy( NCr, Cr, uv_len ); + uint8_t *dest[3] = { NY, NCb, NCr }; + int strides[4] = { len, uv_len,uv_len, 0 }; + // copy original into nervous buf + vj_frame_copy1( frame->data, dest, strides ); if(frames_elapsed > 0) { @@ -107,9 +107,11 @@ void nervous_apply( VJFrame *frame, int width, int height, int delay) uint8_t *sCb = nervous_buf[1] + (uv_len * index); uint8_t *sCr = nervous_buf[2] + (uv_len * index); // copy it to dst - veejay_memcpy( Y, sY, len ); - veejay_memcpy( Cb, sCb, uv_len ); - veejay_memcpy( Cr, sCr, uv_len ); + dest[0] = sY; + dest[1] = sCb; + dest[2] = sCr; + + vj_frame_copy1( dest, frame->data, strides ); } frames_elapsed ++; diff --git a/veejay-current/veejay-server/libvje/effects/opacity.c b/veejay-current/veejay-server/libvje/effects/opacity.c index 71b62aa0..62ec7aef 100644 --- a/veejay-current/veejay-server/libvje/effects/opacity.c +++ b/veejay-current/veejay-server/libvje/effects/opacity.c @@ -40,7 +40,7 @@ #include #include "opacity.h" #undef _EMMS - +#include #ifdef HAVE_K6_2PLUS /* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */ #define _EMMS "femms" @@ -63,6 +63,7 @@ vj_effect *opacity_init(int w, int h) ve->description = "Normal Overlay"; ve->sub_format = 0; ve->extra_frame = 1; + ve->parallel = 1; ve->has_user = 0; ve->param_description = vje_build_param_list( ve->num_params, "Opacity"); return ve; @@ -119,7 +120,7 @@ static inline int blend_plane( uint8_t *dst, uint8_t *A, uint8_t *B, int size, i #endif -void opacity_apply( VJFrame *frame, VJFrame *frame2, int width, +static void opacity_apply1( VJFrame *frame, VJFrame *frame2, int width, int height, int opacity) { int y = blend_plane( frame->data[0], frame->data[0], frame2->data[0], frame->len, opacity ); @@ -139,7 +140,54 @@ void opacity_apply( VJFrame *frame, VJFrame *frame2, int width, } -void opacity_blend_apply( uint8_t *src1[3], uint8_t *src2[3], int len, int uv_len, int opacity ) +static void opacity_apply_job( void *arg ) +{ + vj_task_arg_t *t = (vj_task_arg_t*) arg; + //@ output holds secondunary source here, this in inplace. + int y = blend_plane( t->input[0], t->input[0], t->output[0], t->strides[0], t->iparam ); + int u = blend_plane( t->input[1], t->input[1], t->output[1], t->strides[1], t->iparam ); + int v = blend_plane( t->input[2], t->input[2], t->output[2], t->strides[2], t->iparam ); +#ifdef HAVE_ASM_MMX + do_emms; +#endif + if( y>0) while (y--) + t->input[0][y] = ((t->iparam * (t->input[0][y] - t->output[0][y])) >> 8 ) + t->input[0][y]; + + if( u>0) while( u-- ) + t->input[1][u] = ((t->iparam * (t->input[1][u] - t->output[1][u])) >> 8 ) + t->input[1][u]; + + if(v>0) while( v-- ) + t->input[2][v] = ((t->iparam * (t->input[2][v] - t->output[2][v])) >> 8 ) + t->input[2][v]; + +} + +void opacity_apply( VJFrame *frame, VJFrame *frame2, int width, + int height, int opacity) +{ +/* if( vj_task_available() ) { + vj_task_set_from_frame( frame ); + vj_task_set_int( opacity ); + vj_task_run( frame->data, frame2->data, NULL, NULL, 3, &opacity_apply_job ); + } else { +*/ + opacity_apply1( frame,frame2,width,height,opacity ); +// } +} + +void opacity_applyN( VJFrame *frame, VJFrame *frame2, int width, + int height, int opacity) +{ + if( vj_task_available() ) { + vj_task_set_from_frame( frame ); + vj_task_set_int( opacity ); + vj_task_run( frame->data, frame2->data, NULL, NULL, 3, &opacity_apply_job ); + } else { + opacity_apply1( frame,frame2,width,height,opacity ); + } +} + +//@ used in performer +static void opacity_blend_apply1( uint8_t *src1[3], uint8_t *src2[3], int len, int uv_len, int opacity ) { int y = blend_plane( src1[0], src1[0], src2[0], len, opacity ); int u = blend_plane( src1[1], src1[1], src2[1], uv_len,opacity); @@ -154,11 +202,18 @@ void opacity_blend_apply( uint8_t *src1[3], uint8_t *src2[3], int len, int uv_le src1[1][u] = ((opacity * (src1[1][u] - src2[1][u])) >> 8) + src1[1][u]; while( v-- ) src1[2][v] = ((opacity * (src1[2][v] - src2[2][v])) >> 8) + src1[2][v]; - - } - +void opacity_blend_apply( uint8_t *src1[3], uint8_t *src2[3], int len, int uv_len, int opacity ) +{ + if( vj_task_available() ) { + vj_task_set_from_args( len,uv_len ); + vj_task_set_int( opacity ); + vj_task_run( src1, src2, NULL, NULL, 3, &opacity_apply_job ); + } else { + opacity_blend_apply1( src1,src2,len,uv_len,opacity ); + } +} void opacity_blend_luma_apply( uint8_t *A, uint8_t *B, int len,int opacity ) { int y = blend_plane( A,A,B, len, opacity ); diff --git a/veejay-current/veejay-server/libvje/effects/opacity.h b/veejay-current/veejay-server/libvje/effects/opacity.h index 82ea0d65..f32170a1 100644 --- a/veejay-current/veejay-server/libvje/effects/opacity.h +++ b/veejay-current/veejay-server/libvje/effects/opacity.h @@ -30,6 +30,6 @@ void opacity_apply( VJFrame *frame, VJFrame *frame2, int width, void opacity_blend_luma_apply( uint8_t *src, uint8_t *dst, int len, int opacity ); void opacity_blend_apply( uint8_t *src[3], uint8_t *dst[3], int len, int uv_len, int opacity ); - +void opacity_applyN( VJFrame *frame, VJFrame *frame2, int width, int height, int opacity); void opacity_free(); #endif diff --git a/veejay-current/veejay-server/libvje/effects/opacityadv.c b/veejay-current/veejay-server/libvje/effects/opacityadv.c index b847ee8c..fca82db7 100644 --- a/veejay-current/veejay-server/libvje/effects/opacityadv.c +++ b/veejay-current/veejay-server/libvje/effects/opacityadv.c @@ -39,7 +39,8 @@ vj_effect *opacityadv_init(int w, int h) ve->defaults[0] = 150; ve->defaults[1] = 40; ve->defaults[2] = 176; - ve->description = "Overlay by Threshold Range"; + ve->parallel = 1; + ve->description = "Overlay by Threshold Range"; ve->sub_format = 1; ve->extra_frame = 1; ve->has_user =0; diff --git a/veejay-current/veejay-server/libvje/effects/pencilsketch.c b/veejay-current/veejay-server/libvje/effects/pencilsketch.c index 31ae7efd..aa715b61 100644 --- a/veejay-current/veejay-server/libvje/effects/pencilsketch.c +++ b/veejay-current/veejay-server/libvje/effects/pencilsketch.c @@ -26,25 +26,29 @@ vj_effect *pencilsketch_init(int w, int h) { vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); - ve->num_params = 3; + ve->num_params = 4; ve->limits[0] = (int *) vj_calloc(sizeof(int) * ve->num_params); ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); ve->defaults = (int *) vj_calloc(sizeof(int) * ve->num_params); ve->defaults[0] = 0;/* type */ ve->defaults[1] = pixel_Y_lo_; /* min */ ve->defaults[2] = pixel_Y_hi_; /* max */ + ve->defaults[3] = 0; /* sharpen, 1=negate */ ve->limits[0][0] = 0; ve->limits[1][0] = 8; ve->limits[0][1] = 0; - ve->limits[1][1] = 255; - ve->limits[1][2] = 255; + ve->limits[1][1] = 0xff; + ve->limits[1][2] = 0xff; ve->limits[0][2] = 0; - ve->param_description = vje_build_param_list(ve->num_params, "Mode", "Min Threshold", "Max Treshold" ); + ve->limits[0][3] = 0; + ve->limits[1][3] = 1; + ve->param_description = vje_build_param_list(ve->num_params, "Blend Mode", "Min Threshold", "Max Treshold", "Mask" ); ve->description = "Pencil Sketch (8)"; ve->extra_frame = 0; ve->sub_format = 0; ve->has_user = 0; - return ve; + ve->parallel = 2; + return ve; } /* PenCil sketch pixel Function @@ -58,7 +62,7 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b); static uint8_t _pcf_dneg(uint8_t a, uint8_t b, int t_max) { uint8_t p = - 255 - ( abs ( (255 - abs((255-a)-a)) - (255-abs((255-b)-b))) ); + 0xff - ( abs ( (0xff - abs((0xff-a)-a)) - (0xff-abs((0xff-b)-b))) ); p = (abs(abs(p-b) - b)); return p; } @@ -70,14 +74,14 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b); static uint8_t _pcf_dneg2(uint8_t a,uint8_t b, int t_max) { - uint8_t p = ( 255 - abs ( (255-a)- b ) ); + uint8_t p = ( 0xff - abs ( (0xff-a)- b ) ); return p; } static uint8_t _pcf_min(uint8_t a, uint8_t b, int t_max) { uint8_t p = ( (b < a) ? b : a); - p = ( 255 - abs( (255-p) - b ) ); + p = ( 0xff - abs( (0xff-p) - b ) ); return p; } @@ -86,7 +90,7 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b); int p = ( (b > a) ? b : a); p = CLAMP_Y(p); if( p == 0 ) p = 1; - p = ( 255 - ((256 - b) * (256 - b)) / p); + p = ( 0xff - ((0xff - b) * (0xff - b)) / p); return (uint8_t)p; } @@ -95,16 +99,16 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b); a = CLAMP_Y(a); b = CLAMP_Y(b); if( a == 0 ) a = 1; else if ( b == 0 ) b = 1; - int p = 255 - ((256-a) * (256-a)) / a; - int q = 255 - ((256-b) * (256-b)) / b; - p = ( 255 - ((256-p) * (256 - a)) / q); + int p = 0xff - ((0xff-a) * (0xff-a)) / a; + int q = 0xff - ((0xff-b) * (0xff-b)) / b; + p = ( 0xff - ((0xff-p) * (0xff - a)) / q); return (uint8_t)p; } static uint8_t _pcf_color(uint8_t a, uint8_t b, int t_max) { uint8_t p = - 255 - ( abs ( (255 - abs((255-a)-a)) - (255-abs((255-b)-b))) ); + 0xff - ( abs ( (0xff - abs((0xff-a)-a)) - (0xff-abs((0xff-b)-b))) ); p = (abs(abs(p-b) - b)); p = p + b - (( p * b ) >> 8); return p; @@ -148,7 +152,8 @@ void pencilsketch_apply( int height, int type, int threshold_min, - int threshold_max + int threshold_max, + int mode ) { unsigned int i; @@ -160,38 +165,86 @@ void pencilsketch_apply( uint8_t *Cb= frame->data[1]; uint8_t *Cr= frame->data[2]; - /* get a pointer to a pixel blend function */ _pcf _pff = (_pcf) _get_pf(type); _pcbcr _pcbcrff = &_pcbcr_color; - len = len - width - 1 ; + if(mode == 1 ) { - for(i=0; i < len; i++) - { - y = Y[i]; - yb = y; + for(i=0; i < len; i++) + { + y = Y[i]; + yb = y; - /* substract user defined mask from image */ - if(y >= threshold_min && y <= threshold_max) - { - /* sharpen the pixels */ - m = (Y[i+1] + Y[i+width] + Y[i+width+1]+2) >> 2; - d = Y[i] - m; - d *= 500; - d /= 100; - m = m + d; - /* a magical forumula to combine the pixel with the original*/ - y = ((((y << 1) - (255 - m))>>1) + Y[i])>>1; - /* apply blend operation on masked pixel */ - Y[i] = _pff(y,yb,threshold_max); - } - else - { - Y[i] = pixel_Y_hi_; + if(y >= threshold_min && y <= threshold_max) + Y[i] = _pff(y,0xff-yb,threshold_max); + else + Y[i] = pixel_Y_hi_; } } + else + { + len = len - width - 1; + for(i=0; i < len; i++) + { + y = Y[i]; + yb = y; + + /* substract user defined mask from image */ + if(y >= threshold_min && y <= threshold_max) + { + /* sharpen the pixels */ + m = (Y[i] + Y[i+1] + Y[i+width] + Y[i+width-1]+2) >> 2; + d = Y[i] - m; + d *= 500; + d /= 100; + m = m + d; + y = ((((y << 1) - (0xff - m))>>1) + Y[i])>>1; + /* apply blend operation on masked pixel */ + Y[i] = _pff(y,yb,threshold_max); + } + else + { + Y[i] = pixel_Y_hi_; + } + } + + len = frame->len - width; + + if( vj_task_available() ) + { + int j = 0; + uint8_t *oV = frame->data[3]; + + for(i=len; i < (len+width); i++, j++) + { + y = Y[i]; + yb = y; + + if(y >= threshold_min && y <= threshold_max) + { + m =( Y[i] + Y[i+1] + oV[j] + oV[j-1] + 2 ) >> 2; + d = Y[i] - m; + d *= 500; + d /= 100; + m = ( m + d ); + y = ((((y << 1) - (0xff - m))>>1) + Y[i])>>1; + //Y[i] = 0xff; + //Y[i] = _pff(y,yb,threshold_max); + //@ this introduces lines into the image, + //@ one for each task . FIXME + //@ for now, just silently copy upper row + Y[i] = Y[i-width]; + } + else + { + Y[i] = pixel_Y_hi_; + } + } + } + + } /* data in I420 or YV12 */ if(type != 7) /* all b/w sketches */ diff --git a/veejay-current/veejay-server/libvje/effects/pencilsketch.h b/veejay-current/veejay-server/libvje/effects/pencilsketch.h index 6fdbf54b..abb6317b 100644 --- a/veejay-current/veejay-server/libvje/effects/pencilsketch.h +++ b/veejay-current/veejay-server/libvje/effects/pencilsketch.h @@ -25,7 +25,7 @@ #include vj_effect *pencilsketch_init(); -void pencilsketch_apply(VJFrame *frame, int w, int h, int type, int threshold, int opacity); +void pencilsketch_apply(VJFrame *frame, int w, int h, int type, int threshold, int opacity,int mode); void pencilsketch_free(); #endif diff --git a/veejay-current/veejay-server/libvje/effects/pixelate.c b/veejay-current/veejay-server/libvje/effects/pixelate.c index 4e42798e..b47b2a6e 100644 --- a/veejay-current/veejay-server/libvje/effects/pixelate.c +++ b/veejay-current/veejay-server/libvje/effects/pixelate.c @@ -50,6 +50,7 @@ vj_effect *pixelate_init(int width, int height) ve->description = "Pixelate"; ve->sub_format = 0; ve->extra_frame = 0; + ve->has_user =0; ve->param_description = vje_build_param_list( ve->num_params, "Pixels"); return ve; diff --git a/veejay-current/veejay-server/libvje/effects/posterize.c b/veejay-current/veejay-server/libvje/effects/posterize.c index 5d9836a1..ad65feb6 100644 --- a/veejay-current/veejay-server/libvje/effects/posterize.c +++ b/veejay-current/veejay-server/libvje/effects/posterize.c @@ -31,7 +31,7 @@ vj_effect *posterize_init(int w, int h) ve->defaults[0] = 4; ve->defaults[1] = 16; ve->defaults[2] = 235; - + ve->limits[0][0] = 1; ve->limits[1][0] = 256; ve->limits[0][1] = 0; @@ -39,6 +39,7 @@ vj_effect *posterize_init(int w, int h) ve->limits[0][2] = 0; ve->limits[1][2] = 256; + ve->parallel = 1; ve->description = "Posterize (Threshold Range)"; ve->sub_format = 0; ve->extra_frame = 0; diff --git a/veejay-current/veejay-server/libvje/effects/radcor.c b/veejay-current/veejay-server/libvje/effects/radcor.c index 415d6599..e00ecd3f 100644 --- a/veejay-current/veejay-server/libvje/effects/radcor.c +++ b/veejay-current/veejay-server/libvje/effects/radcor.c @@ -27,6 +27,7 @@ #include #include #include "radcor.h" +#define RUP8(num)(((num)+8)&~8) vj_effect *radcor_init(int w, int h) { @@ -59,10 +60,10 @@ static int map_upd[3] = {0,0,0}; int radcor_malloc( int width, int height ) { - badbuf = (uint8_t*) vj_malloc( width * height * 3 * sizeof(uint8_t)); + badbuf = (uint8_t*) vj_malloc( RUP8( width * height * 3 * sizeof(uint8_t))); if(!badbuf) return 0; - Map = (uint32_t*) vj_malloc( width * height * sizeof(uint32_t)); + Map = (uint32_t*) vj_malloc( RUP8(width * height * sizeof(uint32_t))); if(!Map) return 0; return 1; @@ -101,9 +102,9 @@ void radcor_apply( VJFrame *frame, int width, int height, int alpaX, int alpaY, int nyout = ny; //@ copy source image to internal buffer - veejay_memcpy( badbuf, Y, width * height ); - veejay_memcpy( badbuf + len, Cb, len ); - veejay_memcpy( badbuf + len + len, Cr, len ); + uint8_t *dest[3] = { badbuf, badbuf + len, badbuf + len + len }; + int strides[4] = { len, len, len, 0 }; + vj_frame_copy( frame->data, dest, strides ); uint8_t *Yi = badbuf; uint8_t *Cbi = badbuf + len; @@ -118,9 +119,9 @@ void radcor_apply( VJFrame *frame, int width, int height, int alpaX, int alpaY, alphay *= -1.0; } - veejay_memset( Y, 0, len ); - veejay_memset( Cb, 128, len ); - veejay_memset( Cr, 128, len ); + vj_frame_clear1( Y, 0, len ); + vj_frame_clear1( Cb, 128, len ); + vj_frame_clear1( Cr, 128, len ); int update_map = 0; diff --git a/veejay-current/veejay-server/libvje/effects/radialblur.c b/veejay-current/veejay-server/libvje/effects/radialblur.c index e818959a..1a13ae09 100644 --- a/veejay-current/veejay-server/libvje/effects/radialblur.c +++ b/veejay-current/veejay-server/libvje/effects/radialblur.c @@ -114,10 +114,8 @@ void radialblur_apply(VJFrame *frame, int width, int height, int radius, int pow if(radius == 0) return; // inplace - - veejay_memcpy( radial_src[0] , Y, len); - veejay_memcpy( radial_src[1] , Cb, uv_len); - veejay_memcpy( radial_src[2] , Cr, uv_len); + int strides[4] = { len, uv_len, uv_len, 0 }; + vj_frame_copy( frame->data, radial_src, strides ); switch(direction) { diff --git a/veejay-current/veejay-server/libvje/effects/radioactive.c b/veejay-current/veejay-server/libvje/effects/radioactive.c index 15ffbda7..11c6073e 100644 --- a/veejay-current/veejay-server/libvje/effects/radioactive.c +++ b/veejay-current/veejay-server/libvje/effects/radioactive.c @@ -251,7 +251,7 @@ void radioactivetv_apply( VJFrame *frame, VJFrame *blue, int width, int height, if( !first_frame ) { //@ take current - veejay_memcpy( prev, lum , len ); + vj_frame_copy1( lum, prev, len ); softblur_apply( &smooth, width,height,0); first_frame++; return; @@ -352,9 +352,9 @@ void radioactivetv_apply( VJFrame *frame, VJFrame *blue, int width, int height, if(mode >= 3 ) { - veejay_memset( dstU,128,len); - veejay_memset( dstV,128,len); - veejay_memcpy( dstY, blurzoombuf, len ); + vj_frame_clear1( dstU,128,len); + vj_frame_clear1( dstV,128,len); + vj_frame_copy1( blurzoombuf, dstY, len ); return; } diff --git a/veejay-current/veejay-server/libvje/effects/rawman.c b/veejay-current/veejay-server/libvje/effects/rawman.c index b4717fa0..1b78dcef 100644 --- a/veejay-current/veejay-server/libvje/effects/rawman.c +++ b/veejay-current/veejay-server/libvje/effects/rawman.c @@ -38,6 +38,7 @@ vj_effect *rawman_init(int w,int h) ve->limits[1][1] = 255; ve->sub_format = 0; ve->description = "Raw Data Manipulation"; + ve->parallel = 1; ve->has_user = 0; ve->extra_frame = 0; ve->param_description = vje_build_param_list( ve->num_params, "Mode", "Value"); diff --git a/veejay-current/veejay-server/libvje/effects/rawval.c b/veejay-current/veejay-server/libvje/effects/rawval.c index f000fd69..abb9ebc4 100644 --- a/veejay-current/veejay-server/libvje/effects/rawval.c +++ b/veejay-current/veejay-server/libvje/effects/rawval.c @@ -43,7 +43,7 @@ vj_effect *rawval_init(int w,int h) ve->limits[1][2] = 255; ve->limits[0][3] = 0; ve->limits[1][3] = 255; - + ve->parallel = 1; ve->sub_format = 0; ve->description = "Raw Chroma Pixel Replacement"; ve->has_user = 0; diff --git a/veejay-current/veejay-server/libvje/effects/rgbkey.c b/veejay-current/veejay-server/libvje/effects/rgbkey.c index c4c96f5a..deb3a45a 100644 --- a/veejay-current/veejay-server/libvje/effects/rgbkey.c +++ b/veejay-current/veejay-server/libvje/effects/rgbkey.c @@ -82,7 +82,8 @@ vj_effect *rgbkey_init(int w,int h) ve->extra_frame = 1; ve->sub_format = 1; ve->rgb_conv = 1; - return ve; + ve->parallel = 1; + return ve; } /* void rgbkey_scan_fg(uint8_t * src2[3], int *r, int *g, int *b) diff --git a/veejay-current/veejay-server/libvje/effects/rotozoom.c b/veejay-current/veejay-server/libvje/effects/rotozoom.c index d0f683e7..01b35a31 100644 --- a/veejay-current/veejay-server/libvje/effects/rotozoom.c +++ b/veejay-current/veejay-server/libvje/effects/rotozoom.c @@ -221,18 +221,15 @@ void rotozoom1_apply(VJFrame *frame, uint8_t *data[3], int w, int h, void rotozoom_apply( VJFrame *frame, int width, int height, int mode, int rotate, int zoom, int autom) { + int strides[4] = { width*height,width*height,width*height,0}; switch (autom) { /* alas must do memcpy */ case 0: - veejay_memcpy(rotobuffer[0], frame->data[0], (width * height)); - veejay_memcpy(rotobuffer[1], frame->data[1], (width * height)); - veejay_memcpy(rotobuffer[2], frame->data[2], (width * height)); + vj_frame_copy1( frame->data, rotobuffer, strides ); rotozoom2_apply(frame, rotobuffer, width, height, mode, rotate, zoom); break; case 1: - veejay_memcpy(rotobuffer[0], frame->data[0], (width * height)); - veejay_memcpy(rotobuffer[1], frame->data[1], (width * height)); - veejay_memcpy(rotobuffer[2], frame->data[2], (width * height)); + vj_frame_copy1( frame->data,rotobuffer, strides ); rotozoom1_apply(frame, rotobuffer, width, height, mode, rotate, zoom); break; diff --git a/veejay-current/veejay-server/libvje/effects/scratcher.c b/veejay-current/veejay-server/libvje/effects/scratcher.c index 4433bfc5..b9402b76 100644 --- a/veejay-current/veejay-server/libvje/effects/scratcher.c +++ b/veejay-current/veejay-server/libvje/effects/scratcher.c @@ -86,44 +86,42 @@ int scratcher_malloc(int w, int h) void store_frame(VJFrame *src, int w, int h, int n, int no_reverse) { - int uv_len = src->uv_len; + int uv_len = src->uv_len; + int strides[4] = { (w * h), uv_len, uv_len , 0 }; uint8_t *Y = src->data[0]; uint8_t *Cb= src->data[1]; uint8_t *Cr= src->data[2]; + uint8_t *dest[3] = { + frame[0] + (w*h*nframe), + frame[1] + (uv_len*nframe), + frame[2] + (uv_len*nframe) }; - if (!nreverse) { - //printf("copy from buffer at pos %d to display", (w*h*nframe)); - veejay_memcpy(frame[0] + (w * h * nframe), Y, (w * h)); - veejay_memcpy(frame[1] + (uv_len * nframe), Cb, uv_len); - veejay_memcpy(frame[2] + (uv_len * nframe), Cr, uv_len); - } else { - //printf("copy frame to buffer at pos %d", (w*h*nframe)); - veejay_memcpy(Y, frame[0] + (w * h * nframe), (w * h)); - veejay_memcpy(Cb, frame[1] + (uv_len * nframe), uv_len); - veejay_memcpy(Cr, frame[2] + (uv_len * nframe), uv_len); - } + if (!nreverse) { + vj_frame_copy( src->data, dest, strides ); + } else { + vj_frame_copy( dest, src, strides ); + } - if (nreverse) - nframe--; - else - nframe++; + if (nreverse) + nframe--; + else + nframe++; - if (nframe >= n) { - if (no_reverse == 0) { - nreverse = 1; - nframe = n - 1; - } else { - nframe = 0; - } - } + if (nframe >= n) { + if (no_reverse == 0) { + nreverse = 1; + nframe = n - 1; + } else { + nframe = 0; + } + } - if (nframe == 0) - nreverse = 0; + if (nframe == 0) + nreverse = 0; - // printf("nframe=%d, n=%d, nreverse=%d. no_reverse=%d\n", nframe,n,nreverse,no_reverse); } @@ -144,13 +142,18 @@ void scratcher_apply(VJFrame *src, VJFrame copy; if (nframe== 0) { - veejay_memcpy(frame[0] + (len * nframe), Y, len); - veejay_memcpy(frame[1] + (uv_len * nframe), Cb, uv_len); - veejay_memcpy(frame[2] + (uv_len * nframe), Cr, uv_len); + int strides[4] = { len, uv_len, uv_len, 0 }; + vj_frame_copy( src->data, frame, strides ); return; } - - for (x = 0; x < len; x++) { + + VJFrame srcB; + veejay_memcpy( &srcB, src, sizeof(VJFrame) ); + srcB.data[0] = frame[0] + offset; + srcB.data[1] = frame[1] + uv_offset; + srcB.data[2] = frame[2] + uv_offset; + opacity_applyN( src, &srcB, src->width,src->height, opacity ); +/* for (x = 0; x < len; x++) { Y[x] = ((op0 * Y[x]) + (op1 * frame[0][offset + x])) >> 8; } @@ -162,11 +165,12 @@ void scratcher_apply(VJFrame *src, Cb[x] = ((op0 * Cb[x]) + (op1 * frame[1][uv_offset + x])) >> 8; } - +*/ copy.uv_len = src->uv_len; copy.data[0] = frame[0]; copy.data[1] = frame[1]; copy.data[2] = frame[2]; - store_frame( ©, width, height, n, no_reverse); + + store_frame( ©, width, height, n, no_reverse); } diff --git a/veejay-current/veejay-server/libvje/effects/slice.c b/veejay-current/veejay-server/libvje/effects/slice.c index 688f14b0..140aa019 100644 --- a/veejay-current/veejay-server/libvje/effects/slice.c +++ b/veejay-current/veejay-server/libvje/effects/slice.c @@ -149,9 +149,8 @@ void slice_apply(VJFrame *frame, int width, int height, int val, int re_init) { if(tmp2==1) slice_recalc(width,height,tmp1); - veejay_memcpy( slice_frame[0], Y, len); - veejay_memcpy( slice_frame[1], Cb, len); - veejay_memcpy( slice_frame[2], Cr, len); + int strides[4] = { len, len, len, 0 }; + vj_frame_copy1( Y, slice_frame, strides ); for(y=0; y < height; y++){ for(x=0; x < width; x++) { diff --git a/veejay-current/veejay-server/libvje/effects/solarize.c b/veejay-current/veejay-server/libvje/effects/solarize.c index 67bc1ddb..7cbe77cd 100644 --- a/veejay-current/veejay-server/libvje/effects/solarize.c +++ b/veejay-current/veejay-server/libvje/effects/solarize.c @@ -35,6 +35,7 @@ vj_effect *solarize_init(int w,int h) ve->limits[1][0] = 255; // negation by threshold ve->description = "Solarize"; + ve->parallel = 1; ve->sub_format = 1; ve->extra_frame = 0; ve->has_user = 0; diff --git a/veejay-current/veejay-server/libvje/effects/split.c b/veejay-current/veejay-server/libvje/effects/split.c index 9d9c60c4..57381ca0 100644 --- a/veejay-current/veejay-server/libvje/effects/split.c +++ b/veejay-current/veejay-server/libvje/effects/split.c @@ -108,9 +108,14 @@ void split_fib_downscaleb(VJFrame *frame, int width, int height) uint8_t *Cr = frame->data[2]; split_fib_downscale(frame, width, height); - veejay_memcpy( Y+len, Y , len ); - veejay_memcpy( Cb+uv_len, Cb, uv_len); - veejay_memcpy( Cr+uv_len, Cr, uv_len); + + int strides[4] = { len, uv_len, uv_len, 0 }; + uint8_t *output[3] = { + Y + len, + Cb + uv_len, + Cr + uv_len }; + + vj_frame_copy( frame->data, output, strides ); } void dosquarefib(VJFrame *frame, int width, int height) @@ -201,9 +206,8 @@ void split_push_downscale_uh(VJFrame *frame, int width, int height) uint8_t *Cb= frame->data[1]; uint8_t *Cr= frame->data[2]; - veejay_memcpy( split_fixme[0], Y, len); - veejay_memcpy( split_fixme[1], Cb, len); - veejay_memcpy( split_fixme[2], Cr, len); + int strides[4] = { len,len,len ,0}; + vj_frame_copy( frame->data, split_fixme,strides ); } void split_push_downscale_lh(VJFrame *frame, int width, int height) @@ -240,9 +244,9 @@ void split_push_downscale_lh(VJFrame *frame, int width, int height) } } - veejay_memcpy( Y+hlen, split_fixme[0] , hlen ); - veejay_memcpy( Cb+uv_hlen, split_fixme[1], uv_hlen); - veejay_memcpy( Cr+uv_hlen, split_fixme[2], uv_hlen); + int strides[4] = { hlen, uv_hlen, uv_hlen,0 }; + uint8_t *input[3] = { Y + hlen, Cb + uv_hlen, Cr + uv_hlen }; + vj_frame_copy( split_fixme, input, strides ); } void split_push_vscale_left(VJFrame *frame, int width, int height) @@ -642,10 +646,9 @@ void split_h_first_half(VJFrame *frame, VJFrame *frame2, int width, uint8_t *Cb2= frame2->data[1]; uint8_t *Cr2= frame2->data[2]; - veejay_memcpy(Y, Y2, len); - veejay_memcpy(Cb, Cb2, uv_len); - veejay_memcpy(Cr, Cr2, uv_len); + int strides[4] = { len,uv_len,uv_len, 0 }; + vj_frame_copy( frame2->data, frame->data, strides ); } void split_h_second_half(VJFrame *frame, VJFrame *frame2, int width, int height) @@ -655,13 +658,11 @@ void split_h_second_half(VJFrame *frame, VJFrame *frame2, int width, uint8_t *Y = frame->data[0]; uint8_t *Cb= frame->data[1]; uint8_t *Cr= frame->data[2]; - uint8_t *Y2 = frame2->data[0]; + uint8_t *Y2 = frame2->data[0]; uint8_t *Cb2= frame2->data[1]; uint8_t *Cr2= frame2->data[2]; - - veejay_memcpy( Y, Y2+len, len ); - veejay_memcpy( Cb, Cb2+uv_len, uv_len ); - veejay_memcpy( Cr, Cr2+uv_len, uv_len ); + int strides[4] = { len, uv_len, uv_len, 0 }; + vj_frame_copy( frame2->data,frame->data, strides ); } void split_h_first_halfs(VJFrame *frame, VJFrame *frame2, int width, int height) @@ -671,14 +672,13 @@ void split_h_first_halfs(VJFrame *frame, VJFrame *frame2, int width, uint8_t *Y = frame->data[0]; uint8_t *Cb= frame->data[1]; uint8_t *Cr= frame->data[2]; - uint8_t *Y2 = frame2->data[0]; + uint8_t *Y2 = frame2->data[0]; uint8_t *Cb2= frame2->data[1]; uint8_t *Cr2= frame2->data[2]; - - veejay_memcpy( Y, Y2, len ); - veejay_memcpy( Cb, Cb2, uv_len); - veejay_memcpy( Cr, Cr2, uv_len); + int strides[4] = { len,uv_len,uv_len, 0 }; + vj_frame_copy( frame2->data, frame->data, strides ); } + void split_h_second_halfs(VJFrame *frame, VJFrame *frame2, int width, int height) { @@ -687,13 +687,11 @@ void split_h_second_halfs(VJFrame *frame, VJFrame *frame2, int width, uint8_t *Y = frame->data[0]; uint8_t *Cb= frame->data[1]; uint8_t *Cr= frame->data[2]; - uint8_t *Y2 = frame2->data[0]; + uint8_t *Y2 = frame2->data[0]; uint8_t *Cb2= frame2->data[1]; uint8_t *Cr2= frame2->data[2]; - - veejay_memcpy( Y+len, Y2, len ); - veejay_memcpy( Cb+uv_len, Cb2, uv_len); - veejay_memcpy( Cr+uv_len, Cr2, uv_len); + int strides[4] = { len, uv_len, uv_len, 0 }; + vj_frame_copy( frame2->data, frame->data, strides ); } void split_apply(VJFrame *frame, VJFrame *frame2, int width, diff --git a/veejay-current/veejay-server/libvje/effects/swirl.c b/veejay-current/veejay-server/libvje/effects/swirl.c index d20392eb..761c9449 100644 --- a/veejay-current/veejay-server/libvje/effects/swirl.c +++ b/veejay-current/veejay-server/libvje/effects/swirl.c @@ -160,9 +160,9 @@ void swirl_apply(VJFrame *frame, int w, int h, int v) _v = v; } - veejay_memcpy(buf[0], Y,len); - veejay_memcpy(buf[1], Cb,len); - veejay_memcpy(buf[2], Cr,len); + + int strides[4] = { len, len, len , 0 }; + vj_frame_copy( frame->data, buf, strides ); for(i=0; i < len; i++) { diff --git a/veejay-current/veejay-server/libvje/effects/texmap.c b/veejay-current/veejay-server/libvje/effects/texmap.c index 589a4e00..dc10a2c0 100644 --- a/veejay-current/veejay-server/libvje/effects/texmap.c +++ b/veejay-current/veejay-server/libvje/effects/texmap.c @@ -196,7 +196,7 @@ int texmap_prepare(uint8_t *map[3], int width, int height) return 0; } - veejay_memcpy( static_bg, map[0], (width*height)); + vj_frame_copy1( map[0], static_bg, (width*height)); VJFrame tmp; veejay_memset( &tmp, 0, sizeof(VJFrame)); @@ -297,9 +297,9 @@ void texmap_apply(void *ed, VJFrame *frame, if(mode==1) { //@ show difference image in grayscale - veejay_memcpy( Y, ud->bitmap, len ); - veejay_memset( Cb, 128, len ); - veejay_memset( Cr, 128, len ); + vj_frame_copy1( ud->bitmap, Y, len ); + vj_frame_clear1( Cb, 128, len ); + vj_frame_clear1( Cr, 128, len ); return; } diff --git a/veejay-current/veejay-server/libvje/effects/timedistort.c b/veejay-current/veejay-server/libvje/effects/timedistort.c index 246f2ef1..8eebf2b7 100644 --- a/veejay-current/veejay-server/libvje/effects/timedistort.c +++ b/veejay-current/veejay-server/libvje/effects/timedistort.c @@ -159,7 +159,7 @@ void timedistort_apply( VJFrame *frame, int width, int height, int val) if(!have_bg) { - veejay_memcpy( prev, Y, len ); + vj_frame_copy1( Y, prev, len ); VJFrame smooth; veejay_memcpy(&smooth,frame, sizeof(VJFrame)); smooth.data[0] = prev; @@ -174,7 +174,7 @@ void timedistort_apply( VJFrame *frame, int width, int height, int val) { diff[i] = (abs(prev[i] - Y[i])> val ? 0xff: 0 ); } - veejay_memcpy( prev, Y, len ); + vj_frame_copy1( Y, prev, len ); VJFrame smooth; veejay_memcpy(&smooth,frame, sizeof(VJFrame)); smooth.data[0] = prev; @@ -190,9 +190,9 @@ void timedistort_apply( VJFrame *frame, int width, int height, int val) #endif //@ process - veejay_memcpy( planetableY[plane], Y, len ); - veejay_memcpy( planetableU[plane], Cb, len ); - veejay_memcpy( planetableV[plane], Cr, len ); + uint8_t *planeTables[3] = { planetableY[plane], planetableU[plane], planetableV[plane] }; + int strides[4] = { len, len, len, 0 }; + vj_frame_copy( frame->data, planeTables, strides ); uint8_t *p = warptime[ warptimeFrame ] + width + 1; uint8_t *q = warptime[ warptimeFrame ^ 1] + width + 1; diff --git a/veejay-current/veejay-server/libvje/effects/tripplicity.c b/veejay-current/veejay-server/libvje/effects/tripplicity.c index 86d7246d..038bf864 100644 --- a/veejay-current/veejay-server/libvje/effects/tripplicity.c +++ b/veejay-current/veejay-server/libvje/effects/tripplicity.c @@ -48,7 +48,7 @@ vj_effect *tripplicity_init(int w, int h) ve->sub_format = 0; ve->extra_frame = 1; ve->has_user = 0; - + ve->parallel = 1; ve->param_description = vje_build_param_list( ve->num_params, "Opacity Y", "Opacity Cb", "Opacity Cr" ); return ve; diff --git a/veejay-current/veejay-server/libvje/effects/water.c b/veejay-current/veejay-server/libvje/effects/water.c index 92ec48b6..a058771b 100644 --- a/veejay-current/veejay-server/libvje/effects/water.c +++ b/veejay-current/veejay-server/libvje/effects/water.c @@ -210,9 +210,11 @@ static inline void drop(water_t *w,int power) static void drawmotionframe( VJFrame *f , water_t *w ) { - veejay_memset( f->data[1], 128, f->uv_len ); - veejay_memset( f->data[2], 128, f->uv_len ); - veejay_memcpy( f->data[0], w->diff_img, f->width * f->height ); + int strides[4] = { 0, f->uv_len,f->uv_len, 0 }; + vj_frame_clear( f->data, strides, 128 ); + vj_frame_clear( f->data, strides, 128 ); + vj_frame_copy1( w->diff_img, f->data[0], f->width * f->height ); +// veejay_memcpy( f->data[0], w->diff_img, f->width * f->height ); } static int globalactivity(VJFrame *f2, water_t *w, int in) @@ -274,8 +276,9 @@ static void motiondetect(VJFrame *f, VJFrame *f2, int threshold, water_t *w) if(!w->have_img) { //softblur_apply( f2,f->width,f->height,0); - veejay_memcpy(bg, f2->data[0], f->width * f->height ); - w->have_img = 1; + //veejay_memcpy(bg, f2->data[0], f->width * f->height ); + vj_frame_copy1( f2->data[0],bg, f->width * f->height ); + w->have_img = 1; return; } @@ -321,7 +324,8 @@ static void motiondetect2(VJFrame *f, VJFrame *f2, int threshold, water_t *w) if(!w->have_img) { softblur_apply( f2,f->width,f->height,0); - veejay_memcpy(bg, f2->data[0], f->width * f->height ); + // veejay_memcpy(bg, f2->data[0], f->width * f->height ); + vj_frame_copy1( f2->data[0], bg, f->width * f->height ); w->have_img = 1; return; } @@ -368,7 +372,8 @@ static void motiondetect3(VJFrame *f, VJFrame *f2, int threshold, water_t *w) if(!w->have_img) { softblur_apply( f2,f->width,f->height,0); - veejay_memcpy(bg, f2->data[0], f->width * f->height ); + // veejay_memcpy(bg, f2->data[0], f->width * f->height ); + vj_frame_copy1( f2->data[0], bg, f->width * f->height ); w->have_img = 1; return; } @@ -499,20 +504,20 @@ void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int width, in if(w->last_fresh_rate != fresh_rate) { w->last_fresh_rate = fresh_rate; - veejay_memset( w->map, 0, (w->map_h*w->map_w*2*sizeof(int))); + vj_frame_clear1( w->map, 0,(w->map_h*w->map_w*2*sizeof(int))); + //veejay_memset( w->map, 0, (w->map_h*w->map_w*2*sizeof(int))); } if(w->lastmode != mode ) { - veejay_memset( w->map, 0, (w->map_h*w->map_w*2*sizeof(int))); + vj_frame_clear1( w->map, 0, (w->map_h*w->map_w*2*sizeof(int))); w->have_img = 0; w->lastmode = mode; } - veejay_memcpy ( w->ripple_data[0],frame->data[0],len); + vj_frame_copy1( frame->data[0], w->ripple_data[0],len); dest = frame->data[0]; src = w->ripple_data[0]; - w->loopnum = loopnum; switch(mode) { diff --git a/veejay-current/veejay-server/libvje/effects/whiteframe.c b/veejay-current/veejay-server/libvje/effects/whiteframe.c index b356ee1f..2a9a9611 100644 --- a/veejay-current/veejay-server/libvje/effects/whiteframe.c +++ b/veejay-current/veejay-server/libvje/effects/whiteframe.c @@ -33,6 +33,7 @@ vj_effect *whiteframe_init(int w,int h) ve->extra_frame = 1; ve->sub_format = 0; ve->has_user = 0; + ve->parallel = 1; ve->param_description = NULL; return ve; } diff --git a/veejay-current/veejay-server/libvje/effects/zoom.c b/veejay-current/veejay-server/libvje/effects/zoom.c index b7c2da66..cf8a4915 100644 --- a/veejay-current/veejay-server/libvje/effects/zoom.c +++ b/veejay-current/veejay-server/libvje/effects/zoom.c @@ -90,9 +90,8 @@ void zoom_apply( VJFrame *frame, int width, int height, int x, int y, int factor zoom_[0] = x; zoom_[1] = y; zoom_[2] = factor; zoom_[3] = dir; } - veejay_memcpy( zoom_private_[0], frame->data[0], (width*height)); - veejay_memcpy( zoom_private_[1], frame->data[1], (width*height)); - veejay_memcpy( zoom_private_[2], frame->data[2], (width*height)); + int strides[4] = { (width*height),(width*height),(width*height), 0 }; + vj_frame_copy( frame->data, zoom_private_, strides ); viewport_process_dynamic( zoom_vp_, zoom_private_, frame->data ); diff --git a/veejay-current/veejay-server/libvje/internal.h b/veejay-current/veejay-server/libvje/internal.h index a4dcc869..0ffb284c 100644 --- a/veejay-current/veejay-server/libvje/internal.h +++ b/veejay-current/veejay-server/libvje/internal.h @@ -492,7 +492,7 @@ extern void color_apply(VJFrame *frame, int w, int h, int a,int b, int c); //extern void water_apply(VJFrame *frame, int w, int h, int val, int l, int d); extern void water_apply(void *user_data, VJFrame *frame, VJFrame *frame2, int width, int height, int fresh,int loopnum, int decay, int mode, int threshold); -extern void pencilsketch_apply(VJFrame *frame, int w, int h, int type, int threshold, int opacity); +extern void pencilsketch_apply(VJFrame *frame, int w, int h, int type, int threshold, int opacity, int mode); extern void pixelate_apply(VJFrame *frame, int w, int h, int v ); diff --git a/veejay-current/veejay-server/libvje/vj-effect.c b/veejay-current/veejay-server/libvje/vj-effect.c index a664bde9..ef8bc4c1 100644 --- a/veejay-current/veejay-server/libvje/vj-effect.c +++ b/veejay-current/veejay-server/libvje/vj-effect.c @@ -376,6 +376,12 @@ static void *vj_effect_activate_ext( int fx_id, int *result ) return NULL; } + +int vj_effect_is_parallel(int effect_id) +{ + int seq = vj_effect_real_to_sequence(effect_id); + return vj_effects[seq]->parallel; +} void *vj_effect_activate(int effect_id, int *result) { int seq = vj_effect_real_to_sequence(effect_id); diff --git a/veejay-current/veejay-server/libvje/vj-effman.c b/veejay-current/veejay-server/libvje/vj-effman.c index 96b437d2..5696a6d3 100644 --- a/veejay-current/veejay-server/libvje/vj-effman.c +++ b/veejay-current/veejay-server/libvje/vj-effman.c @@ -29,7 +29,7 @@ #ifdef STRICT_CHECKING #include #endif - +#include extern vj_effect *vj_effects[]; #define VEVO_PLUG_LIVIDO 0xffaa @@ -74,7 +74,6 @@ void vj_effman_apply_plug_effect( void vj_effman_apply_image_effect( VJFrame **frames, - VJFrameInfo *frameinfo, vjp_kf *todo_info, int *arg, int entry, @@ -86,320 +85,320 @@ void vj_effman_apply_image_effect( switch (e) { case VJ_IMAGE_EFFECT_CONSTANTBLEND: - constantblend_apply( frames[0], frameinfo->width, - frameinfo->height, arg[0], arg[1], arg[2]); + constantblend_apply( frames[0], frames[0]->width, + frames[0]->height, arg[0], arg[1], arg[2]); break; case VJ_IMAGE_EFFECT_FLARE: - flare_apply( frames[0], frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2] ); + flare_apply( frames[0], frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2] ); break; case VJ_IMAGE_EFFECT_PHOTOPLAY: - photoplay_apply(frames[0],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2]); + photoplay_apply(frames[0],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_MASKSTOP: - maskstop_apply(frames[0],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + maskstop_apply(frames[0],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_CUTSTOP: - cutstop_apply(frames[0],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + cutstop_apply(frames[0],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_NEIGHBOUR4: - neighbours4_apply(frames[0],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + neighbours4_apply(frames[0],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_NEIGHBOUR5: - neighbours5_apply(frames[0],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2]); + neighbours5_apply(frames[0],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_NEIGHBOUR2: - neighbours2_apply(frames[0],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2]); + neighbours2_apply(frames[0],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_NEIGHBOUR: - neighbours_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + neighbours_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_NEIGHBOUR3: - neighbours3_apply(frames[0],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2]); + neighbours3_apply(frames[0],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_RIPPLETV: - waterrippletv_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + waterrippletv_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_PENCILSKETCH: - pencilsketch_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + pencilsketch_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_NOISEPENCIL: - noisepencil_apply(frames[0],frameinfo->width,frameinfo->height, + noisepencil_apply(frames[0],frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_CALI: - cali_apply( vj_effects[entry]->user_data,frames[0], frameinfo->width,frameinfo->height,arg[0], arg[1] ); + cali_apply( vj_effects[entry]->user_data,frames[0], frames[0]->width,frames[0]->height,arg[0], arg[1] ); break; case VJ_IMAGE_EFFECT_DIFF: diffimg_apply(frames[0], - frameinfo->width, frameinfo->height, arg[0], arg[1], + frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2]); break; case VJ_IMAGE_EFFECT_COMPLEXINVERT: - complexinvert_apply(frames[0], frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4]); + complexinvert_apply(frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4]); break; case VJ_IMAGE_EFFECT_COMPLEXSATURATE: - complexsaturation_apply(frames[0], frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]); + complexsaturation_apply(frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]); break; case VJ_IMAGE_EFFECT_REFLECTION: - reflection_apply(frames[0], frameinfo->width, frameinfo->height, + reflection_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2]); break; case VJ_IMAGE_EFFECT_FIBDOWNSCALE: for (j = 0; j < arg[1]; j++) { - fibdownscale_apply(frames[0], frames[0], frameinfo->width, - frameinfo->height, arg[0]); + fibdownscale_apply(frames[0], frames[0], frames[0]->width, + frames[0]->height, arg[0]); } break; case VJ_IMAGE_EFFECT_NOISEADD: - noiseadd_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1]); + noiseadd_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_CONTRAST: - contrast_apply(frames[0], frameinfo->width, frameinfo->height,arg); + contrast_apply(frames[0], frames[0]->width, frames[0]->height,arg); break; case VJ_IMAGE_EFFECT_ENHANCEMASK: - enhancemask_apply(frames[0],frameinfo->width,frameinfo->height,arg); + enhancemask_apply(frames[0],frames[0]->width,frames[0]->height,arg); break; case VJ_IMAGE_EFFECT_SOLARIZE: - solarize_apply(frames[0], frameinfo->width, frameinfo->height, arg[0]); + solarize_apply(frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_DISTORTION: - distortion_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + distortion_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_IMAGE_EFFECT_GAMMA: gamma_apply( - frames[0], frameinfo->width, frameinfo->height, arg[0]); + frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_COLORADJUST: - coloradjust_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + coloradjust_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_IMAGE_EFFECT_MOTIONBLUR: - motionblur_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + motionblur_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_MAGICSCRATCHER: - magicscratcher_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + magicscratcher_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2]); break; case VJ_IMAGE_EFFECT_CHROMASCRATCHER: - chromascratcher_apply(frames[0], frameinfo->width, frameinfo->height, + chromascratcher_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2], arg[3]); break; case VJ_IMAGE_EFFECT_SCRATCHER: - scratcher_apply(frames[0], frameinfo->width, frameinfo->height, + scratcher_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2]); break; case VJ_IMAGE_EFFECT_KILLCHROMA: - killchroma_apply(frames[0], frameinfo->width, frameinfo->height, arg[0] + killchroma_apply(frames[0], frames[0]->width, frames[0]->height, arg[0] ); break; case VJ_IMAGE_EFFECT_MIRROR: - mirrors2_apply(frames[0], frameinfo->width, frameinfo->height, arg[0]); + mirrors2_apply(frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_MIRRORS: - mirrors_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + mirrors_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_IMAGE_EFFECT_MAGICMIRROR: - magicmirror_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + magicmirror_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_RASTER: - raster_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + raster_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_SWIRL: - swirl_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + swirl_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_RADIALBLUR: - radialblur_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1],arg[2]); + radialblur_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_FISHEYE: - fisheye_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + fisheye_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_PIXELSMEAR: - smear_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1]); + smear_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_UVCORRECT: - uvcorrect_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]); + uvcorrect_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]); break; case VJ_IMAGE_EFFECT_CHROMAPALETTE: - chromapalette_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5]); + chromapalette_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5]); break; case VJ_IMAGE_EFFECT_CHROMIUM: - chromium_apply( frames[0], frameinfo->width, frameinfo->height, arg[0]); + chromium_apply( frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_CARTONIZE: - cartonize_apply( frames[0], frameinfo->width,frameinfo->height, + cartonize_apply( frames[0], frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2] ); break; case VJ_IMAGE_EFFECT_VIDBLOB: - blob_apply( frames[0],frameinfo->width,frameinfo->height, + blob_apply( frames[0],frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2],arg[3] ); break; case VJ_IMAGE_EFFECT_VIDBOIDS: - boids_apply( frames[0],frameinfo->width,frameinfo->height, + boids_apply( frames[0],frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],arg[7] ); break; case VJ_IMAGE_EFFECT_GHOST: - ghost_apply( frames[0], frameinfo->width,frameinfo->height,arg[0]); + ghost_apply( frames[0], frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_MORPHOLOGY: - morphology_apply( frames[0], frameinfo->width,frameinfo->height, + morphology_apply( frames[0], frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2] ); break; case VJ_IMAGE_EFFECT_COLMORPH: - colmorphology_apply( frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1],arg[2]); + colmorphology_apply( frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_NERVOUS: - nervous_apply( frames[0], frameinfo->width, frameinfo->height, + nervous_apply( frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_OVERCLOCK: - overclock_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1]); + overclock_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_COLORHIS: - colorhis_apply( frames[0], frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3] ); + colorhis_apply( frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3] ); break; case VJ_IMAGE_EFFECT_AUTOEQ: - autoeq_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + autoeq_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_BALTANTV: - baltantv_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1]); + baltantv_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_CHAMELEON: - chameleon_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + chameleon_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_TIMEDISTORT: - timedistort_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + timedistort_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_LENSCORRECTION: - radcor_apply( frames[0], frameinfo->width,frameinfo->height, arg[0],arg[1] ,arg[2]); + radcor_apply( frames[0], frames[0]->width,frames[0]->height, arg[0],arg[1] ,arg[2]); break; case VJ_IMAGE_EFFECT_NEGATION: - negation_apply(frames[0], frameinfo->width, frameinfo->height, arg[0]); + negation_apply(frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_MEDIANFILTER: - medianfilter_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + medianfilter_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_NEGATECHANNEL: - negatechannel_apply(frames[0], frameinfo->width, frameinfo->height, arg[0],arg[1]); + negatechannel_apply(frames[0], frames[0]->width, frames[0]->height, arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_COLFLASH: - colflash_apply(frames[0], frameinfo->width,frameinfo->height,arg[0], + colflash_apply(frames[0], frames[0]->width,frames[0]->height,arg[0], arg[1],arg[2],arg[3],arg[4] ); break; case VJ_IMAGE_EFFECT_COLORMAP: - colormap_apply(frames[0], frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + colormap_apply(frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_POSTERIZE: - posterize_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + posterize_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_DITHER: - dither_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + dither_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_IMAGE_EFFECT_EMBOSS: - emboss_apply(frames[0], frameinfo->width, frameinfo->height, arg[0]); + emboss_apply(frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_FLIP: - flip_apply(frames[0], frameinfo->width, frameinfo->height, arg[0]); + flip_apply(frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_REVTV: - revtv_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + revtv_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2], arg[3]); break; case VJ_IMAGE_EFFECT_COLORSHIFT: - colorshift_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + colorshift_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_IMAGE_EFFECT_SOFTBLUR: - softblur_apply(frames[0], frameinfo->width, frameinfo->height, arg[0]); + softblur_apply(frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_WIDTHMIRROR: - widthmirror_apply(frames[0], frameinfo->width, frameinfo->height, arg[0]); + widthmirror_apply(frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_DICES: - dices_apply(vj_effects[entry], frames[0], frameinfo->width, - frameinfo->height, arg[0]); + dices_apply(vj_effects[entry], frames[0], frames[0]->width, + frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_COLORTEST: - color_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + color_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_RAWMAN: - rawman_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + rawman_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_IMAGE_EFFECT_RAWVAL: - rawval_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], arg[1], + rawval_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2], arg[3]); break; case VJ_IMAGE_EFFECT_SMUCK: - smuck_apply(frames[0], frames[0], frameinfo->width, frameinfo->height, + smuck_apply(frames[0], frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_TRANSFORM: - transform_apply(frames[0], frames[0], frameinfo->width, frameinfo->height, + transform_apply(frames[0], frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_BWSELECT: - bwselect_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], arg[1]); + bwselect_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_IMAGE_EFFECT_GREYSELECT: - greyselect_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + greyselect_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_ISOLATE: - isolate_apply(frames[0],frameinfo->width,frameinfo->height, + isolate_apply(frames[0],frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2],arg[3],arg[4]); break; case VJ_IMAGE_EFFECT_ROTOZOOM: rotozoom_apply(frames[0], - frameinfo->width, - frameinfo->height, arg[0], arg[1], arg[2], arg[3]); + frames[0]->width, + frames[0]->height, arg[0], arg[1], arg[2], arg[3]); break; case VJ_IMAGE_EFFECT_SINOIDS: - sinoids_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1]); + sinoids_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_AVERAGE: - average_apply(frames[0],frameinfo->width,frameinfo->height,arg[0]); + average_apply(frames[0],frames[0]->width,frames[0]->height,arg[0]); break; case VJ_IMAGE_EFFECT_RIPPLE: - ripple_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + ripple_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_BGSUBTRACT: - bgsubtract_apply( frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1]); + bgsubtract_apply( frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_BATHROOM: - bathroom_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1]); + bathroom_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_RGBCHANNEL: - rgbchannel_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + rgbchannel_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_IMAGE_EFFECT_ZOOM: - zoom_apply(frames[0], frameinfo->width, frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + zoom_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_IMAGE_EFFECT_CROSSPIXEL: - crosspixel_apply(frames[0],frameinfo->width,frameinfo->height,arg[0],arg[1]); + crosspixel_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]); break; case VJ_IMAGE_EFFECT_DEINTERLACE: - deinterlace_apply( frames[0], frameinfo->width, frameinfo->height, arg[0]); + deinterlace_apply( frames[0], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_IMAGE_EFFECT_MOTIONMAP: - motionmap_apply( frames[0], frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4]); + motionmap_apply( frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4]); break; case VJ_IMAGE_EFFECT_CONTOUR: contourextract_apply( vj_effects[entry]->user_data, frames[0], - frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4] ); + frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4] ); break; case VJ_IMAGE_EFFECT_SLICE: if(arg[2] > 0) { @@ -409,140 +408,140 @@ void vj_effman_apply_image_effect( todo_info->tmp[1] = arg[1]; } - slice_apply(frames[0],frameinfo->width,frameinfo->height,arg[0], todo_info->tmp[1]); + slice_apply(frames[0],frames[0]->width,frames[0]->height,arg[0], todo_info->tmp[1]); todo_info->tmp[1] = 0; break; } } -void vj_effman_apply_video_effect( VJFrame **frames, VJFrameInfo *frameinfo ,vjp_kf *todo_info,int *arg, int entry, int e) { +void vj_effman_apply_video_effect( VJFrame **frames, vjp_kf *todo_info,int *arg, int entry, int e) { switch(e) { case VJ_VIDEO_EFFECT_CHAMBLEND: - chameleonblend_apply(frames[0],frames[1], frameinfo->width,frameinfo->height,arg[0]); + chameleonblend_apply(frames[0],frames[1], frames[0]->width,frames[0]->height,arg[0]); break; case VJ_VIDEO_EFFECT_EXTDIFF: - differencemap_apply( frames[0],frames[1],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + differencemap_apply( frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_VIDEO_EFFECT_EXTTHRESHOLD: - threshold_apply( frames[0],frames[1],frameinfo->width,frameinfo->height,arg[0],arg[1]); + threshold_apply( frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1]); break; case VJ_VIDEO_EFFECT_VIDEOWALL: - videowall_apply(frames[0],frames[1],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + videowall_apply(frames[0],frames[1],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; case VJ_VIDEO_EFFECT_VIDEOPLAY: - videoplay_apply(frames[0],frames[1],frameinfo->width, - frameinfo->height,arg[0],arg[1],arg[2]); + videoplay_apply(frames[0],frames[1],frames[0]->width, + frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_VIDEO_EFFECT_TRIPPLICITY: tripplicity_apply(frames[0],frames[1], - frameinfo->width,frameinfo->height, arg[0],arg[1],arg[2]); + frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2]); break; case VJ_VIDEO_EFFECT_COMPLEXTHRESHOLD: - complexthreshold_apply(frames[0],frames[1],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3], + complexthreshold_apply(frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3], arg[4], arg[5]); break; case VJ_VIDEO_EFFECT_DUPMAGIC: - dupmagic_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + dupmagic_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_VIDEO_EFFECT_LUMAMAGICK: - lumamagic_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + lumamagic_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1],arg[2]); break; case VJ_VIDEO_EFFECT_BINARYOVERLAY: - binaryoverlay_apply(frames[0], frames[1],frameinfo->width,frameinfo->height,arg[0] ); break; + binaryoverlay_apply(frames[0], frames[1],frames[0]->width,frames[0]->height,arg[0] ); break; case VJ_VIDEO_EFFECT_OVERLAYMAGIC: - overlaymagic_apply(frames[0], frames[1], frameinfo->width,frameinfo->height, arg[0],arg[1]); + overlaymagic_apply(frames[0], frames[1], frames[0]->width,frames[0]->height, arg[0],arg[1]); break; case VJ_VIDEO_EFFECT_SLICER: - slicer_apply(frames[0],frames[1], frameinfo->width, frameinfo->height, arg[0],arg[1] ); + slicer_apply(frames[0],frames[1], frames[0]->width, frames[0]->height, arg[0],arg[1] ); break; case VJ_VIDEO_EFFECT_MASK: - simplemask_apply(frames[0],frames[1], frameinfo->width,frameinfo->height,arg[0], arg[1]); + simplemask_apply(frames[0],frames[1], frames[0]->width,frames[0]->height,arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_LUMAMASK: - lumamask_apply(frames[0], frames[1], frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2]); + lumamask_apply(frames[0], frames[1], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2]); break; case VJ_VIDEO_EFFECT_DISSOLVE: - dissolve_apply(frames[0],frames[1],frameinfo->width,frameinfo->height,arg[0]);break; + dissolve_apply(frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0]);break; case VJ_VIDEO_EFFECT_OPACITY: - opacity_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, arg[0]); + opacity_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, arg[0]); break; case VJ_VIDEO_EFFECT_IRIS: - iris_apply( frames[0],frames[1], frameinfo->width,frameinfo->height,arg[0],arg[1]); + iris_apply( frames[0],frames[1], frames[0]->width,frames[0]->height,arg[0],arg[1]); break; case VJ_VIDEO_EFFECT_THRESHOLDSMOOTH: - opacitythreshold_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, arg[0], arg[1],arg[2]); + opacitythreshold_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, arg[0], arg[1],arg[2]); break; case VJ_VIDEO_EFFECT_THRESHOLD: - opacityadv_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, arg[0], arg[1], arg[2]); + opacityadv_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, arg[0], arg[1], arg[2]); break; case VJ_VIDEO_EFFECT_RGBKEY: - rgbkey_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + rgbkey_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]); break; case VJ_VIDEO_EFFECT_KEYSELECT: - keyselect_apply(frames[0],frames[1],frameinfo->width,frameinfo->height, + keyselect_apply(frames[0],frames[1],frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2],arg[3],arg[4],arg[5]); break; case VJ_VIDEO_EFFECT_CHROMAMAGICK: - chromamagick_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, arg[0], arg[1]); + chromamagick_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_LUMABLEND: - lumablend_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + lumablend_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2], arg[3]); break; case VJ_VIDEO_EFFECT_LUMAKEY: - lumakey_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + lumakey_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[4], arg[1], arg[2], arg[0], arg[3]); break; case VJ_VIDEO_EFFECT_DIFF: diff_apply( vj_effects[entry]->user_data, frames[0], frames[1], - frameinfo->width, frameinfo->height, arg[0], arg[1],arg[2],arg[3]); + frames[0]->width, frames[0]->height, arg[0], arg[1],arg[2],arg[3]); break; case VJ_VIDEO_EFFECT_TEXMAP: texmap_apply( vj_effects[entry]->user_data, frames[0],frames[1], - frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4] ); + frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4] ); break; case VJ_VIDEO_EFFECT_WHITEFRAME: - whiteframe_apply(frames[0], frames[1], frameinfo->width, frameinfo->height); + whiteframe_apply(frames[0], frames[1], frames[0]->width, frames[0]->height); break; case VJ_VIDEO_EFFECT_MTRACER: - mtracer_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + mtracer_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_TRACER: - tracer_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, arg[0], arg[1]); + tracer_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_CAROT: - transcarot_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + transcarot_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[2], arg[3], arg[4], arg[5], arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_LINE: - transline_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + transline_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[2], arg[1], arg[0], arg[3]); break; case VJ_VIDEO_EFFECT_TRANSOP: transop_apply(frames[0], frames[1], arg[1], arg[2], arg[3], - arg[4], arg[5], arg[6], frameinfo->width, frameinfo->height, + arg[4], arg[5], arg[6], frames[0]->width, frames[0]->height, arg[0]); break; case VJ_VIDEO_EFFECT_COMPLEXSYNC: if(arg[1] == 1) { /* auto increment as option in effect*/ if(arg[2]==0) arg[2]=1; todo_info->tmp[0] += (arg[0]/arg[2] )+1; /* val / max frames */ - if(todo_info->tmp[0] > frameinfo->height-2) todo_info->tmp[0] = 1; + if(todo_info->tmp[0] > frames[0]->height-2) todo_info->tmp[0] = 1; } else { /* arg1 = off , copy arg*/ todo_info->tmp[0] = arg[0]; } - complexsync_apply(frames[0], frames[1],frameinfo->width, frameinfo->height, + complexsync_apply(frames[0], frames[1],frames[0]->width, frames[0]->height, todo_info->tmp[0]); break; case VJ_VIDEO_EFFECT_FADECOLORRGB: @@ -557,7 +556,7 @@ void vj_effman_apply_video_effect( VJFrame **frames, VJFrameInfo *frameinfo ,vjp todo_info->tmp[0] -= (arg[0] / arg[5]); } - colorfadergb_apply(frames[0], frameinfo->width, frameinfo->height, + colorfadergb_apply(frames[0], frames[0]->width, frames[0]->height, todo_info->tmp[0], arg[1], arg[2], arg[3]); break; case VJ_VIDEO_EFFECT_FADECOLOR: @@ -572,63 +571,63 @@ void vj_effman_apply_video_effect( VJFrame **frames, VJFrameInfo *frameinfo ,vjp } - colorfade_apply(frames[0], frameinfo->width, frameinfo->height, + colorfade_apply(frames[0], frames[0]->width, frames[0]->height, todo_info->tmp[0], arg[1]); break; case VJ_VIDEO_EFFECT_VBAR: - vbar_apply(frames[0],frames[1],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4]); + vbar_apply(frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4]); break; case VJ_VIDEO_EFFECT_3BAR: - bar_apply(frames[0],frames[1],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4]); + bar_apply(frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4]); break; case VJ_VIDEO_EFFECT_SLIDINGDOOR: if(arg[1] == 1) { /* auto increment as option in effect*/ todo_info->tmp[0] ++; /* val / max frames */ - if(todo_info->tmp[0] >= (frameinfo->height/16)) + if(todo_info->tmp[0] >= (frames[0]->height/16)) todo_info->tmp[0] = 1; } else { /* arg1 = off , copy arg*/ todo_info->tmp[0] = arg[0]; } - slidingdoor_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, todo_info->tmp[0] ); + slidingdoor_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, todo_info->tmp[0] ); break; case VJ_VIDEO_EFFECT_WIPE: - wipe_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + wipe_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_RGBKEYSMOOTH: - rgbkeysmooth_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, arg[0], arg[1], arg[2], arg[3], + rgbkeysmooth_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, arg[0], arg[1], arg[2], arg[3], arg[4],arg[5]); break; case VJ_VIDEO_EFFECT_SPLIT: - split_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + split_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_BORDERS: - borders_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], + borders_apply(frames[0], frames[0]->width, frames[0]->height, arg[0], arg[1]); break; case VJ_VIDEO_EFFECT_FRAMEBORDER: - frameborder_apply(frames[0], frames[1], frameinfo->width, - frameinfo->height, arg[0]); + frameborder_apply(frames[0], frames[1], frames[0]->width, + frames[0]->height, arg[0]); break; case VJ_VIDEO_EFFECT_TRANSBLEND: - transblend_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, + transblend_apply(frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6]); break; case VJ_VIDEO_EFFECT_PICINPIC: - picinpic_apply( vj_effects[entry]->user_data,frames[0], frames[1], frameinfo->width, frameinfo->height, + picinpic_apply( vj_effects[entry]->user_data,frames[0], frames[1], frames[0]->width, frames[0]->height, arg[0], arg[1], arg[2], arg[3] ); break; case VJ_VIDEO_EFFECT_RIPPLETV: - water_apply( vj_effects[entry]->user_data,frames[0],frames[1],frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3],arg[4] ); + water_apply( vj_effects[entry]->user_data,frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4] ); break; case VJ_VIDEO_EFFECT_RADIOACTIVE: - radioactivetv_apply( frames[0],frames[1], frameinfo->width,frameinfo->height,arg[0],arg[1],arg[2],arg[3]); + radioactivetv_apply( frames[0],frames[1], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3]); break; default: @@ -696,7 +695,38 @@ int vj_effect_prepare( VJFrame *frame, int selector) } return 0; } +static void vj_effman_apply_job( void *arg ) +{ + vj_task_arg_t *v = (vj_task_arg_t*) arg; + int entry = v->iparams[11]; + int selector = v->iparam; + vjp_kf *kf = v->ptr; + VJFrame frame; + VJFrame frame2; + + vj_task_set_to_frame( &frame, 0, v->jobnum ); + + VJFrame *frames[2]; + + frames[0] = &frame; + frames[1] = &frame2; + + if( v->overlap ) { + frame.data[3] = v->overlaprow; + } + + if( selector > 200 ) + { + vj_task_set_to_frame( &frame2, 1, v->jobnum); + vj_effman_apply_video_effect(frames,kf, v->iparams, entry,selector); + } + else + { + vj_effman_apply_image_effect( frames,kf,v->iparams,entry, selector); + } + +} int vj_effect_apply( VJFrame **frames, VJFrameInfo *frameinfo, vjp_kf *kf, int selector, int *arguments, void *ptr ) { @@ -716,11 +746,29 @@ int vj_effect_apply( VJFrame **frames, VJFrameInfo *frameinfo, vjp_kf *kf, int s vj_effman_apply_plug_effect( frames, frameinfo, kf, arguments,n_a, entry, selector, ptr ); } else - { - if( selector > 200 ) - vj_effman_apply_video_effect(frames,frameinfo,kf,arguments, entry,selector); - else - vj_effman_apply_image_effect( frames, frameinfo, kf, arguments,entry, selector); + { + int isP = vj_effect_is_parallel(selector); + if( vj_task_available() && isP > 0 ) { + vj_task_set_from_frame( frames[0] ); + vj_task_set_int( selector ); + vj_task_set_param( entry, 11 ); + vj_task_set_ptr( (void*) kf ); + int i; + for ( i = 0; i < n_a; i ++ ) + vj_task_set_param( arguments[i], i ); + if( isP > 1 ) + vj_task_set_overlap( frames[0]->width ); + + vj_task_run( frames[0]->data,frames[1]->data, NULL, NULL, 3, &vj_effman_apply_job ); + } + else { + + if( selector > 200 ) + vj_effman_apply_video_effect(frames,kf,arguments, entry,selector); + else + vj_effman_apply_image_effect( frames,kf, arguments,entry, selector); + + } } return VJE_SUCCESS; } diff --git a/veejay-current/veejay-server/libvje/vje.h b/veejay-current/veejay-server/libvje/vje.h index 20004038..999046f8 100644 --- a/veejay-current/veejay-server/libvje/vje.h +++ b/veejay-current/veejay-server/libvje/vje.h @@ -88,11 +88,21 @@ typedef struct vj_effect_t { int has_help; int rgb_conv; int n_out; - int instance;//crap + int instance; void *user_data; char padding[4]; + int parallel; } vj_effect; +typedef struct vj_effect_instance_t { + uint8_t *buffer[4]; + int len; + int iparams[16]; + float fparams[8]; + int *iarr; + float *farr; +} vj_fx_instance; + extern int get_pixel_range_min_Y(); extern int get_pixel_range_min_UV(); extern void vj_effect_initialize(int width, int height, int range); diff --git a/veejay-current/veejay-server/libvjmem/memcpy.c b/veejay-current/veejay-server/libvjmem/memcpy.c index c810bda9..beaa4159 100644 --- a/veejay-current/veejay-server/libvjmem/memcpy.c +++ b/veejay-current/veejay-server/libvjmem/memcpy.c @@ -136,7 +136,9 @@ #include #include #include +#include #include + #ifdef STRICT_CHECKING #include #endif @@ -224,9 +226,12 @@ char *veejay_strncat( char *s1, char *s2, size_t n ) return strncat( s1,s2, n); } -void yuyv_plane_clear( size_t len, void *to ) + +static void yuyv_plane_clear_job( void *arg ) { - uint8_t *t = (uint8_t*) to; + vj_task_arg_t *v = (vj_task_arg_t*) arg; + int len = v->strides[0]; + uint8_t *t = v->input[0]; unsigned int i; i = len; for( ; i > 0 ; i -- ) @@ -238,6 +243,30 @@ void yuyv_plane_clear( size_t len, void *to ) t += 4; } } + + +void yuyv_plane_clear( size_t len, void *to ) +{ + if( vj_task_available() ) { + uint8_t * t = (uint8_t*) to; + uint8_t *in[4] = { t, NULL,NULL,NULL }; + int strides[4] = { len, 0,0,0 }; + vj_task_run( in, in, NULL, NULL, 1, &yuyv_plane_clear_job ); + } + else { + uint8_t *t = (uint8_t*) to; + unsigned int i; + i = len; + for( ; i > 0 ; i -- ) + { + t[0] = 0; + t[1] = 128; + t[2] = 0; + t[3] = 128; + t += 4; + } + } +} static inline unsigned long long int rdtsc() { struct timeval tv; @@ -386,11 +415,101 @@ void yuyv_plane_init() } +static void yuyv_plane_clear_job( void *arg ) +{ + vj_task_arg_t *v = (vj_task_arg_t*) arg; + int len = v->strides[0]; + uint8_t *t = v->input[0]; + unsigned int i; + +#ifdef HAVE_ASM_MMX2 + __asm __volatile( + "movq (%0), %%mm0\n" + :: "r" (yuyv_mmreg_) : "memory" ); + + i = len >> 7; + len = len % 128; + + for(; i > 0 ; i -- ) + { + __asm __volatile( + PREFETCH" 320(%0)\n" + MOVNTQ" %%mm0, (%0)\n" + MOVNTQ" %%mm0, 8(%0)\n" + MOVNTQ" %%mm0, 16(%0)\n" + MOVNTQ" %%mm0, 24(%0)\n" + MOVNTQ" %%mm0, 32(%0)\n" + MOVNTQ" %%mm0, 40(%0)\n" + MOVNTQ" %%mm0, 48(%0)\n" + MOVNTQ" %%mm0, 56(%0)\n" + MOVNTQ" %%mm0, 64(%0)\n" + MOVNTQ" %%mm0, 72(%0)\n" + MOVNTQ" %%mm0, 80(%0)\n" + MOVNTQ" %%mm0, 88(%0)\n" + MOVNTQ" %%mm0, 96(%0)\n" + MOVNTQ" %%mm0, 104(%0)\n" + MOVNTQ" %%mm0, 112(%0)\n" + MOVNTQ" %%mm0, 120(%0)\n" + :: "r" (t) : "memory" ); + t += 128; + } +#else +#ifdef HAVE_ASM_MMX + __asm __volatile( + "movq (%0), %%mm0\n\t" + :: "r" (yuyv_mmreg_): "memory"); + i = len >> 6; + len = len % 64; + + for(; i > 0 ; i -- ) + { + __asm__ __volatile__ ( + "movq %%mm0, (%0)\n" + "movq %%mm0, 8(%0)\n" + "movq %%mm0, 16(%0)\n" + "movq %%mm0, 24(%0)\n" + "movq %%mm0, 32(%0)\n" + "movq %%mm0, 40(%0)\n" + "movq %%mm0, 48(%0)\n" + "movq %%mm0, 56(%0)\n" + :: "r" (t) : "memory"); + t += 64; + } +#endif +#endif +#ifdef HAVE_ASM_MMX + i = len >> 3; + len = i % 8; + for( ; i > 0; i -- ) + { + __asm__ __volatile__ ( + "movq %%mm0, (%0)\n" + :: "r" (t) : "memory" ); + t += 8; + } +#endif + i = len; + for( ; i > 0 ; i -- ) + { + t[0] = 0; + t[1] = 128; + t[2] = 0; + t[3] = 128; + t += 4; + } +} + + void yuyv_plane_clear( size_t len, void *to ) { uint8_t *t = (uint8_t*) to; unsigned int i; - + if( vj_task_available() ) { + int strides[4] = { len, 0,0, 0 }; + uint8_t *in[4] = { t, NULL,NULL,NULL}; + vj_task_run( in,in, NULL,strides, 1,(performer_job_routine) &yuyv_plane_clear_job ); + return; + } #ifdef HAVE_ASM_MMX2 __asm __volatile( "movq (%0), %%mm0\n" @@ -1087,14 +1206,15 @@ static void vj_frame_clear_job( void *arg ) { } } -static void vj_frame_copyN( uint8_t **input, uint8_t **output, int *strides, int planes ) +static void vj_frame_copyN( uint8_t **input, uint8_t **output, int *strides ) { - vj_task_run( input, output, NULL, strides,planes, (performer_job_routine) &vj_frame_copy_job ); + vj_task_run( input, output, NULL, strides,4,(performer_job_routine) &vj_frame_copy_job ); } -static void vj_frame_clearN( uint8_t **input, uint8_t **output, int *strides, int planes ) +static void vj_frame_clearN( uint8_t **input, int *strides, unsigned int val ) { - vj_task_run( input, output, NULL, strides,planes, (performer_job_routine) &vj_frame_clear_job ); + vj_task_set_int( val ); + vj_task_run( input, input, NULL, strides,3, (performer_job_routine) &vj_frame_clear_job ); } @@ -1171,16 +1291,23 @@ void vj_frame_simple_copy( uint8_t **input, uint8_t **output, int *strides, int veejay_memcpy( output[i],input[i], strides[i] ); } -void *(* vj_frame_copy)( uint8_t **input, uint8_t **output, int *strides, int n_planes ) = 0; +void *(* vj_frame_copy)( uint8_t **input, uint8_t **output, int *strides ) = 0; -void *(* vj_frame_clear)( uint8_t **input, int *strides, int val ) = 0; +void *(* vj_frame_clear)( uint8_t **input, int *strides, unsigned int val ) = 0; void vj_frame_copy1( uint8_t *input, uint8_t *output, int size ) { uint8_t *in[4] = { input, NULL,NULL,NULL }; uint8_t *ou[4] = { output,NULL,NULL,NULL }; int strides[4] = { size,0,0,0 }; - vj_frame_copy( in, ou, strides, 1 ); + vj_frame_copy( in, ou, strides ); +} + +void vj_frame_clear1( uint8_t *input, unsigned int val, int size ) +{ + uint8_t *in[4] = { input, NULL,NULL,NULL }; + int strides[4] = { size,0,0,0 }; + vj_frame_clear( in, strides, val ); } int find_best_threaded_memcpy(int w, int h) @@ -1225,7 +1352,7 @@ int find_best_threaded_memcpy(int w, int h) num_tasks = atoi( str2 ); if( num_tasks >= MAX_WORKERS ) { - veejay_msg(0, "Built-in limit is %d tasks. Change it in libvjmem/vjmem.h ", MAX_WORKERS); + veejay_msg(0, "Maximum number of tasks is %d tasks.", MAX_WORKERS); return -1; } @@ -1240,7 +1367,7 @@ int find_best_threaded_memcpy(int w, int h) for( k = 0; k < c; k ++ ) { unsigned long long t = rdtsc(); - vj_frame_copyN( source,dest,planes,4 ); + vj_frame_copyN( source,dest,planes ); t = rdtsc() - t; stats[k] = t; } diff --git a/veejay-current/veejay-server/libvjmem/vjmem.h b/veejay-current/veejay-server/libvjmem/vjmem.h index 30d3f71c..cafc6f5e 100644 --- a/veejay-current/veejay-server/libvjmem/vjmem.h +++ b/veejay-current/veejay-server/libvjmem/vjmem.h @@ -20,7 +20,7 @@ #ifndef VJ_X86_H #define VJ_X86_H -#define MAX_WORKERS 32 +#define MAX_WORKERS 256 extern void *(* veejay_memcpy)(void *to, const void *from, size_t len); extern void *(* veejay_memset)(void *to, uint8_t val, size_t len); @@ -48,8 +48,10 @@ extern char *veejay_strncpy( char *s1, const char *s2, size_t n ); extern void yuyv_plane_init(); extern void yuyv_plane_clear( size_t len, void *to ); extern char **vje_build_param_list( int num, ... ); -extern void *(*vj_frame_copy)( uint8_t **input, uint8_t **output, int *strides, int planes ); +extern void *(*vj_frame_copy)( uint8_t **input, uint8_t **output, int *strides ); +extern void *(*vj_frame_clear)( uint8_t **input, int *strides, unsigned int val ); extern void vj_frame_copy1( uint8_t *input, uint8_t *output, int size ); +extern void vj_frame_clear1( uint8_t *input, unsigned int value, int size ); extern int num_threaded_tasks(); //@ FIXME: Design change extern void vj_frame_slow_threaded( uint8_t **p0_buffer, uint8_t **p1_buffer, uint8_t **img, int len, int uv_len,const float frac ); diff --git a/veejay-current/veejay-server/libyuv/subsample.c b/veejay-current/veejay-server/libyuv/subsample.c index a3a5e13a..d53baa19 100644 --- a/veejay-current/veejay-server/libyuv/subsample.c +++ b/veejay-current/veejay-server/libyuv/subsample.c @@ -67,29 +67,6 @@ const char *ssm_description[SSM_COUNT] = { // forward decl void ss_420_to_422(uint8_t *buffer, int width, int height); void ss_422_to_420(uint8_t *buffer, int width, int height); -/* -typedef struct -{ - uint8_t *buf; -} yuv_sampler_t; -*/ -void *subsample_init(int len) -{ -// yuv_sampler_t *s = (yuv_sampler_t*) vj_malloc(sizeof(yuv_sampler_t) ); -// if(!s) -// return NULL; - void *s = (void*) vj_malloc(sizeof(uint8_t) * RUP8(len*2) ); - if(!s) - return NULL; - - return s; -} - -void subsample_free(void *data) -{ - if( data ) free(data); - data = NULL; -} /************************************************************************* * Chroma Subsampling @@ -239,13 +216,13 @@ static void ss_444_to_420jpeg_cp(uint8_t *buffer,uint8_t *dest, int width, int h #define BLANK_CRB in0[1] #define BLANK_CRB_2 (in0[1] << 1) -static void tr_420jpeg_to_444(void *data, uint8_t *buffer, int width, int height) +static void tr_420jpeg_to_444(uint8_t *data, uint8_t *buffer, int width, int height) { uint8_t *inm, *in0, *inp, *out0, *out1; uint8_t cmm, cm0, cmp, c0m, c00, c0p, cpm, cp0, cpp; int x, y; - uint8_t *saveme = (uint8_t*) data; + uint8_t *saveme = data; veejay_memcpy(saveme, buffer, width); @@ -540,7 +517,8 @@ static inline void down_sample16to8( uint8_t *out, uint8_t *in ) ); } #endif -static void ss_444_to_422_cp(void *data, uint8_t *buffer, uint8_t *dest, int width, int height) + +static void ss_444_to_422_cp(uint8_t *data, uint8_t *buffer, uint8_t *dest, int width, int height) { const int dst_stride = width >> 1; int x,y; @@ -560,6 +538,7 @@ static void ss_444_to_422_cp(void *data, uint8_t *buffer, uint8_t *dest, int wid dst = dest + (y*dst_stride); #if defined (HAVE_ASM_MMX) || defined (HAVE_ASM_MMX2) + copy_width( src, buffer + (y*width), width ); for( x= 0; x < mmxdst_stride; x++ ) { @@ -583,8 +562,8 @@ static void ss_444_to_422_cp(void *data, uint8_t *buffer, uint8_t *dest, int wid } } - -static void ss_444_to_422(void *data, uint8_t *buffer, int width, int height) +//@ data = input, buffer = output +static void ss_444_to_422(uint8_t *data, uint8_t *buffer, int width, int height) { const int dst_stride = width >> 1; int x,y; @@ -593,6 +572,7 @@ static void ss_444_to_422(void *data, uint8_t *buffer, int width, int height) int left = dst_stride % 8; #endif uint8_t *src = (uint8_t*) data; +// uint8_t *src = buffer; uint8_t *dst; #ifdef HAVE_ASM_MMX @@ -651,11 +631,13 @@ static inline void super_sample8to16( uint8_t *in, uint8_t *out ) } #endif -static void tr_422_to_444(void *data, uint8_t *buffer, int width, int height) +static void tr_422_to_444(uint8_t *data, uint8_t *buffer, int width, int height) { int x,y; const int stride = width >> 1; + veejay_msg(0,"%s: w=%d,h=%d, buffer=%p, temp=%p",__FUNCTION__, width,height, buffer,data ); + #ifndef HAVE_ASM_MMX for( y = height-1; y > 0 ; y -- ) { @@ -693,8 +675,46 @@ static void tr_422_to_444(void *data, uint8_t *buffer, int width, int height) #endif } +static void tr_422_to_444t(uint8_t *dst, uint8_t *src, int width, int height) +{ + int x,y; + const int stride = width >> 1; +#ifndef HAVE_ASM_MMX + for( y = height; y > 0 ; y -- ) + { + uint8_t *d = dst + (y * width); + uint8_t *s = src + (y * stride); + for(x=0; x < stride; x++) // for 1 row + { + d[0] = s[x]; //put to dst + d[1] = s[x]; + d+=2; // increment dst + } + } +#else + const int mmx_stride = stride >> 3; + int left = (mmx_stride % 8)-1; + if( left < 0 ) left = 0; + for( y = height; y > 0 ; y -- ) + { + uint8_t *s = src + (y * stride); + uint8_t *d = dst + (y * width); + for(x=0; x < mmx_stride; x++) // for 1 row + { + super_sample8to16(s,d); + s += 8; + d += 16; + } + for(x=0; x < left; x++) + { + d[0] = src[x]; //put to dst + d[1] = src[x]; + dst+=2; // increment dst + } + } +#endif - +} /* vertical intersitial siting; horizontal cositing * @@ -744,59 +764,37 @@ static void ss_444_to_420mpeg2(uint8_t *buffer, int width, int height) } } -static void chroma_subsample_cp_task( void *ptr ) -{ - vj_task_arg_t *f = (vj_task_arg_t*) ptr; - - switch (f->iparam) { - case SSM_420_JPEG_BOX: - case SSM_420_JPEG_TR: - ss_444_to_420jpeg_cp(f->input[1],f->output[1], f->width, f->height); - ss_444_to_420jpeg_cp(f->input[2],f->output[2], f->width, f->height); - break; - case SSM_420_MPEG2: - break; - case SSM_422_444: - ss_444_to_422_cp(f->priv,f->input[1],f->output[1],f->width,f->height); - ss_444_to_422_cp(f->priv,f->input[2],f->output[2],f->width,f->height); -#ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); -#endif - break; - - } -} - static void chroma_subsample_task( void *ptr ) { vj_task_arg_t *f = (vj_task_arg_t*) ptr; switch (f->iparam) { - case SSM_420_JPEG_BOX: - case SSM_420_JPEG_TR: - ss_444_to_420jpeg(f->input[1], f->width, f->height); - ss_444_to_420jpeg(f->input[2], f->width, f->height); + case SSM_420_JPEG_BOX: + case SSM_420_JPEG_TR: + ss_444_to_420jpeg(f->input[1], f->width, f->subhei); + ss_444_to_420jpeg(f->input[2], f->width, f->subhei); #ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif - break; - case SSM_420_MPEG2: - ss_444_to_420mpeg2(f->input[1], f->width, f->height); - ss_444_to_420mpeg2(f->input[2], f->width, f->height); - break; - case SSM_422_444: - ss_444_to_422(f->priv,f->input[1],f->width,f->height); - ss_444_to_422(f->priv,f->input[2],f->width,f->height); + break; + case SSM_420_MPEG2: + ss_444_to_420mpeg2(f->input[1], f->width, f->subhei); + ss_444_to_420mpeg2(f->input[2], f->width, f->subhei); + break; + case SSM_422_444: + //@ src, dst + ss_444_to_422_cp(f->temp[1],f->output[1],f->input[1],f->width,f->subhei); + ss_444_to_422_cp(f->temp[1],f->output[2],f->input[2],f->width,f->subhei); #ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif - break; - case SSM_420_422: - ss_422_to_420(f->input[1],f->width,f->height); - ss_422_to_420(f->input[2],f->width,f->height); + break; + case SSM_420_422: + ss_422_to_420(f->input[1],f->width,f->subhei); + ss_422_to_420(f->input[2],f->width,f->subhei); break; default: - break; + break; } } @@ -806,30 +804,26 @@ static void chroma_supersample_task( void *ptr ) switch (f->iparam) { case SSM_420_JPEG_BOX: - ss_420jpeg_to_444(f->input[1], f->width, f->height); - ss_420jpeg_to_444(f->input[2], f->width, f->height); + ss_420jpeg_to_444(f->input[1], f->width, f->subhei); + ss_420jpeg_to_444(f->input[2], f->width, f->subhei); #ifdef HAVE_ASM_MMX __asm__ __volatile__ ( _EMMS:::"memory"); #endif break; case SSM_420_JPEG_TR: - tr_420jpeg_to_444(f->priv,f->input[1], f->width, f->height); - tr_420jpeg_to_444(f->priv,f->input[2], f->width, f->height); + tr_420jpeg_to_444(f->priv,f->input[1], f->width, f->subhei); + tr_420jpeg_to_444(f->priv,f->input[2], f->width, f->subhei); break; case SSM_422_444: - tr_422_to_444(f->priv,f->input[1],f->width,f->height); - tr_422_to_444(f->priv,f->input[2],f->width,f->height); + tr_422_to_444t(f->input[1],f->output[1],f->width,f->subhei); + tr_422_to_444t(f->input[2],f->output[2],f->width,f->subhei); #ifdef HAVE_ASM_MMX __asm__ __volatile__ ( _EMMS:::"memory"); #endif break; case SSM_420_422: - ss_420_to_422( f->input[1], f->width, f->height ); - ss_420_to_422( f->input[2], f->width, f->height ); - break; - case SSM_420_MPEG2: - // ss_420mpeg2_to_444(ycbcr[1], width, height); - // ss_420mpeg2_to_444(ycbcr[2], width, height); + ss_420_to_422( f->input[1], f->width, f->subhei ); + ss_420_to_422( f->input[2], f->width, f->subhei ); break; default: break; @@ -837,143 +831,160 @@ static void chroma_supersample_task( void *ptr ) } -void chroma_subsample_cp(subsample_mode_t mode, void *data, uint8_t *ycbcr[], uint8_t *dcbcr[], - int width, int height) +void chroma_subsample_cp(subsample_mode_t mode,VJFrame *frame, uint8_t *ycbcr[], uint8_t *dcbcr[]) { - /*if( vj_task_available() ) { //@ FIXME: - vj_task_set_wid( width ); - vj_task_set_hei( height ); - vj_task_set_int( mode ); - vj_task_alloc_internal_buf( width * 2); - vj_task_run( ycbcr, dcbcr, NULL, NULL,3, (performer_job_routine) &chroma_subsample_cp_task ); - return; - }*/ - - switch (mode) { - case SSM_420_JPEG_BOX: - case SSM_420_JPEG_TR: - ss_444_to_420jpeg_cp(ycbcr[1],dcbcr[1], width, height); - ss_444_to_420jpeg_cp(ycbcr[2],dcbcr[2], width, height); - break; - case SSM_420_MPEG2: - break; - case SSM_422_444: - ss_444_to_422_cp(data,ycbcr[1],dcbcr[1],width,height); - ss_444_to_422_cp(data,ycbcr[2],dcbcr[2],width,height); -#ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); -#endif - break; - case SSM_420_422: - break; - default: - break; - } -} - -void chroma_subsample(subsample_mode_t mode, void *data, uint8_t *ycbcr[], - int width, int height) -{ -/* if( vj_task_available() ) { - - vj_task_set_shift(0,0); - vj_task_set_wid( width ); - vj_task_set_hei( height ); + if( vj_task_available() ) { + void *data = vj_task_alloc_internal_buf( frame->len * 2 + (frame->width*2) ); + uint8_t *plane = (uint8_t*) data; + uint8_t *vplane = plane + frame->len; + uint8_t *buffer = vplane + frame->len; + uint8_t *planes[3] = { NULL, plane,vplane }; + uint8_t *temp[3] = { NULL, buffer, NULL }; + int strides[4] = { 0, frame->len, frame->len, 0 }; + vj_frame_copy( ycbcr, planes,strides ); + vj_task_set_from_frame( frame ); vj_task_set_int( mode ); - vj_task_alloc_internal_buf( width * 2); //@ FIXME, redundant malloc of *data (unused in multithreaded context) - - vj_task_run( ycbcr, ycbcr, NULL, NULL, 3, (performer_job_routine ) &chroma_subsample_task ); + vj_task_set_sampling( 1 ); + vj_task_run( ycbcr, planes, temp, NULL, 3, (performer_job_routine ) &chroma_subsample_task ); + + vj_task_free_internal_buf(); + vj_task_set_sampling(0); return; } -*/ - switch (mode) { - case SSM_420_JPEG_BOX: - case SSM_420_JPEG_TR: - ss_444_to_420jpeg(ycbcr[1], width, height); - ss_444_to_420jpeg(ycbcr[2], width, height); + + uint8_t *data = (uint8_t*) vj_malloc(sizeof(uint8_t) * frame->width * 2 ); + + switch (mode) { + case SSM_420_JPEG_BOX: + case SSM_420_JPEG_TR: + ss_444_to_420jpeg_cp(ycbcr[1],dcbcr[1], frame->width, frame->height); + ss_444_to_420jpeg_cp(ycbcr[2],dcbcr[2], frame->width, frame->height); + break; + case SSM_420_MPEG2: + break; + case SSM_422_444: +// ss_444_to_422_cp(data,ycbcr[1],dcbcr[1],frame->width,frame->height); +// ss_444_to_422_cp(data,ycbcr[2],dcbcr[2],frame->width,frame->height); #ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif - break; - case SSM_420_MPEG2: - ss_444_to_420mpeg2(ycbcr[1], width, height); - ss_444_to_420mpeg2(ycbcr[2], width, height); - break; - case SSM_422_444: - ss_444_to_422(data,ycbcr[1],width,height); - ss_444_to_422(data,ycbcr[2],width,height); + break; + default: + break; + } + + free(data); +} + +void chroma_subsample(subsample_mode_t mode, VJFrame *frame, uint8_t *ycbcr[] ) +{ + if( vj_task_available() ) { + void *data = vj_task_alloc_internal_buf( frame->len * 2 + (frame->width*2) ); + uint8_t *plane = (uint8_t*) data; + uint8_t *vplane = plane + frame->len; + uint8_t *buffer = vplane + frame->len; + uint8_t *planes[3] = { NULL, plane,vplane }; + uint8_t *temp[3] = { NULL, buffer, NULL }; + int strides[4] = { 0, frame->len, frame->len, 0 }; + vj_frame_copy( ycbcr, planes,strides ); + vj_task_set_from_frame( frame ); + vj_task_set_int( mode ); + vj_task_set_sampling( 1 ); + + vj_task_run( ycbcr, planes, temp, NULL, 3, (performer_job_routine ) &chroma_subsample_task ); + + vj_task_free_internal_buf(); + vj_task_set_sampling(0); + return; + } + + uint8_t *data = (uint8_t*) vj_malloc( sizeof(uint8_t) * frame->width * 2 ); + + switch (mode) { + case SSM_420_JPEG_BOX: + case SSM_420_JPEG_TR: + ss_444_to_420jpeg(ycbcr[1], frame->width, frame->height); + ss_444_to_420jpeg(ycbcr[2], frame->width, frame->height); #ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); + __asm__ __volatile__ ( _EMMS:::"memory"); #endif - break; - case SSM_420_422: - ss_422_to_420(ycbcr[1],width,height); - ss_422_to_420(ycbcr[2],width,height); - break; - default: - break; - } + break; + case SSM_420_MPEG2: + ss_444_to_420mpeg2(ycbcr[1], frame->width, frame->height); + ss_444_to_420mpeg2(ycbcr[2], frame->width, frame->height); + break; + case SSM_422_444: + ss_444_to_422(data,ycbcr[1],frame->width,frame->height); + ss_444_to_422(data,ycbcr[2],frame->width,frame->height); +#ifdef HAVE_ASM_MMX + __asm__ __volatile__ ( _EMMS:::"memory"); +#endif + break; + case SSM_420_422: + ss_422_to_420(ycbcr[1],frame->width,frame->height); + ss_422_to_420(ycbcr[2],frame->width,frame->height); + break; + default: + break; + } + free(data); } -void chroma_supersample(subsample_mode_t mode,void *data, uint8_t *ycbcr[], - int width, int height) +void chroma_supersample(subsample_mode_t mode,VJFrame *frame, uint8_t *ycbcr[] ) { - /*if( vj_task_available() ) { - switch( mode ) { - case SSM_420_JPEG_BOX: - case SSM_420_JPEG_TR: - vj_task_set_shift(1,1); - break; - case SSM_422_444: - vj_task_set_shift(0,1); - break; - default: - vj_task_set_shift(0,0 ); - break; - } - vj_task_set_wid( width ); - vj_task_set_hei( height ); - vj_task_set_int( mode ); - vj_task_alloc_internal_buf( width * 2 ); + if( vj_task_available() ) { + void *data = vj_task_alloc_internal_buf( frame->uv_len * 2 ); - vj_task_run( ycbcr, ycbcr, NULL, NULL,3, (performer_job_routine) &chroma_supersample_task ); + uint8_t *plane = (uint8_t*) data; + uint8_t *vplane = plane + frame->uv_len; + uint8_t *planes[3] = { NULL, plane,vplane }; + int strides[4] = { 0, frame->uv_len, frame->uv_len, 0 }; + vj_task_set_sampling( 0 ); + vj_frame_copy( ycbcr, planes,strides); + vj_task_set_from_frame( frame ); + vj_task_set_int( mode ); + vj_task_set_sampling( 1 ); - return; - }*/ + vj_task_run( frame->data,planes, NULL, NULL,3, (performer_job_routine) &chroma_supersample_task ); + + vj_task_free_internal_buf(); + vj_task_set_sampling(0); + return; + } + + uint8_t *data = (uint8_t*) vj_malloc( sizeof(uint8_t) * frame->width * 2 ); switch (mode) { - case SSM_420_JPEG_BOX: - ss_420jpeg_to_444(ycbcr[1], width, height); - ss_420jpeg_to_444(ycbcr[2], width, height); + case SSM_420_JPEG_BOX: + ss_420jpeg_to_444(ycbcr[1], frame->width, frame->height); + ss_420jpeg_to_444(ycbcr[2], frame->width, frame->height); #ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); + __asm__ __volatile__ ( _EMMS:::"memory"); +#endif + break; + case SSM_420_JPEG_TR: + tr_420jpeg_to_444(data,ycbcr[1], frame->width, frame->height); + tr_420jpeg_to_444(data,ycbcr[2], frame->width, frame->height); + break; + case SSM_422_444: + tr_422_to_444(data,ycbcr[1],frame->width,frame->height); + tr_422_to_444(data,ycbcr[2],frame->width,frame->height); +#ifdef HAVE_ASM_MMX + __asm__ __volatile__ ( _EMMS:::"memory"); #endif break; - case SSM_420_JPEG_TR: - tr_420jpeg_to_444(data,ycbcr[1], width, height); - tr_420jpeg_to_444(data,ycbcr[2], width, height); - break; - case SSM_422_444: - tr_422_to_444(data,ycbcr[1],width,height); - tr_422_to_444(data,ycbcr[2],width,height); -#ifdef HAVE_ASM_MMX - __asm__ __volatile__ ( _EMMS:::"memory"); -#endif - break; - case SSM_420_422: - ss_420_to_422( ycbcr[1], width, height ); - ss_420_to_422( ycbcr[2], width, height ); - break; - case SSM_420_MPEG2: - // ss_420mpeg2_to_444(ycbcr[1], width, height); - // ss_420mpeg2_to_444(ycbcr[2], width, height); + case SSM_420_422: + ss_420_to_422( ycbcr[1], frame->width, frame->height ); + ss_420_to_422( ycbcr[2], frame->width, frame->height ); break; default: break; } + free( data ); + } diff --git a/veejay-current/veejay-server/libyuv/yuvconv.c b/veejay-current/veejay-server/libyuv/yuvconv.c index dff7032b..e10dee70 100644 --- a/veejay-current/veejay-server/libyuv/yuvconv.c +++ b/veejay-current/veejay-server/libyuv/yuvconv.c @@ -29,6 +29,7 @@ #include #include #include +#include /* this routine is the same as frame_YUV422_to_YUV420P , unpack * libdv's 4:2:2-packed into 4:2:0 planar * See http://mjpeg.sourceforge.net/ (MJPEG Tools) (lav-common.c) @@ -1439,11 +1440,15 @@ void yuv420to422planar( uint8_t *src[3], uint8_t *dst[3], int w, int h ) } #endif -void yuy2_scale_pixels_from_yuv( uint8_t *plane, int len ) +static void yuy2_scale_pixels_from_yuv_job( void *arg ) { - unsigned int rlen = 2 * len ; + vj_task_arg_t *v = (vj_task_arg_t*) arg; + uint8_t *plane = v->input[0]; + int len = v->strides[0]; + +// unsigned int rlen = 2 * len ; unsigned int i; - for( i = 0; i < rlen; i += 4 ) { + for( i = 0; i < len; i += 4 ) { plane[i+0] = jpeg_to_CCIR_tableY[ plane[i+0] ]; plane[i+1] = jpeg_to_CCIR_tableUV[plane[i+1] ]; plane[i+2] = jpeg_to_CCIR_tableY[ plane[i+2] ]; @@ -1451,11 +1456,32 @@ void yuy2_scale_pixels_from_yuv( uint8_t *plane, int len ) } } -void yuy2_scale_pixels_from_ycbcr( uint8_t *plane, int len ) +void yuy2_scale_pixels_from_yuv( uint8_t *plane, int len ) { - unsigned int rlen = 2 * len ; + if(vj_task_available() ) { + uint8_t *in[4] = { plane,NULL,NULL,NULL }; + int strides[4] = { len * 2, 0, 0, 0 }; + vj_task_run( in,in,NULL, strides, 1, &yuy2_scale_pixels_from_yuv_job ); + } + else { + unsigned int rlen = 2 * len ; + unsigned int i; + for( i = 0; i < rlen; i += 4 ) { + plane[i+0] = jpeg_to_CCIR_tableY[ plane[i+0] ]; + plane[i+1] = jpeg_to_CCIR_tableUV[plane[i+1] ]; + plane[i+2] = jpeg_to_CCIR_tableY[ plane[i+2] ]; + plane[i+3] = jpeg_to_CCIR_tableUV[ plane[i+3] ]; + } + } +} + +static void yuy2_scale_pixels_from_ycbcr_job( void *arg ) +{ + vj_task_arg_t *v = (vj_task_arg_t*) arg; + uint8_t *plane = v->input[0]; + int len = v->strides[0]; unsigned int i; - for( i = 0; i < rlen; i += 4 ) { + for( i = 0; i < len; i += 4 ) { plane[i+0] = CCIR_to_jpeg_tableY[ plane[i+0] ]; plane[i+1] = CCIR_to_jpeg_tableUV[plane[i+1] ]; plane[i+2] = CCIR_to_jpeg_tableY[ plane[i+2] ]; @@ -1463,25 +1489,70 @@ void yuy2_scale_pixels_from_ycbcr( uint8_t *plane, int len ) } } -void yuv_scale_pixels_from_yuv( uint8_t *src[3], uint8_t *dst[3], int len ) +void yuy2_scale_pixels_from_ycbcr( uint8_t *plane, int len ) { + if(vj_task_available() ) { + uint8_t *in[4] = { plane,NULL,NULL,NULL }; + int strides[4] = { len * 2, 0, 0, 0 }; + vj_task_run( in,in,NULL, strides, 1, &yuy2_scale_pixels_from_ycbcr_job ); + } + else { + unsigned int rlen = 2 * len ; + unsigned int i; + for( i = 0; i < rlen; i += 4 ) { + plane[i+0] = CCIR_to_jpeg_tableY[ plane[i+0] ]; + plane[i+1] = CCIR_to_jpeg_tableUV[plane[i+1] ]; + plane[i+2] = CCIR_to_jpeg_tableY[ plane[i+2] ]; + plane[i+3] = CCIR_to_jpeg_tableUV[ plane[i+3] ]; + } + } +} + +static void yuy_scale_pixels_from_yuv_job( void *arg) +{ + vj_task_arg_t *t = (vj_task_arg_t*) arg; + unsigned int i; - uint8_t *y = src[0]; - uint8_t *u = src[1]; - uint8_t *v = src[2]; - uint8_t *dY = dst[0]; - uint8_t *dU = dst[1]; - uint8_t *dV = dst[2]; - for( i = 0; i < len ; i ++ ) { + uint8_t *y = t->input[0]; + uint8_t *u = t->input[1]; + uint8_t *v = t->input[2]; + uint8_t *dY = t->output[0]; + uint8_t *dU = t->output[1]; + uint8_t *dV = t->output[2]; + + for( i = 0; i < t->strides[0] ; i ++ ) { dY[i] = jpeg_to_CCIR_tableY[ y[i] ]; } - len = len / 2; - for( i = 0; i < len ; i ++ ) { + for( i = 0; i < t->strides[1] ; i ++ ) { dU[i] = jpeg_to_CCIR_tableUV[ u[i] ]; dV[i] = jpeg_to_CCIR_tableUV[ v[i] ]; } } +void yuv_scale_pixels_from_yuv( uint8_t *src[3], uint8_t *dst[3], int len ) +{ + if(vj_task_available() ) { + int strides[4] = { len, len/2,len/2, 0 }; + vj_task_run( src,dst,NULL, strides, 3, (performer_job_routine) &yuy_scale_pixels_from_yuv_job ); + } + else { + unsigned int i; + uint8_t *y = src[0]; + uint8_t *u = src[1]; + uint8_t *v = src[2]; + uint8_t *dY = dst[0]; + uint8_t *dU = dst[1]; + uint8_t *dV = dst[2]; + for( i = 0; i < len ; i ++ ) { + dY[i] = jpeg_to_CCIR_tableY[ y[i] ]; + } + len = len / 2; + for( i = 0; i < len ; i ++ ) { + dU[i] = jpeg_to_CCIR_tableUV[ u[i] ]; + dV[i] = jpeg_to_CCIR_tableUV[ v[i] ]; + } + } +} void yuv_scale_pixels_from_y( uint8_t *plane, int len ) { unsigned int i; diff --git a/veejay-current/veejay-server/libyuv/yuvconv.h b/veejay-current/veejay-server/libyuv/yuvconv.h index 037615c5..b47a4d67 100644 --- a/veejay-current/veejay-server/libyuv/yuvconv.h +++ b/veejay-current/veejay-server/libyuv/yuvconv.h @@ -36,16 +36,9 @@ typedef enum subsample_mode { extern const char *ssm_id[SSM_COUNT]; extern const char *ssm_description[SSM_COUNT]; -void *subsample_init(int buf_len); -void subsample_free(void *sampler); - -void chroma_subsample(subsample_mode_t mode, void *sampler, uint8_t * ycbcr[], - int width, int height); -void chroma_subsample_cp(subsample_mode_t mode, void *data, uint8_t *ycbcr[], uint8_t *dcbcr[], - int width, int height); - -void chroma_supersample(subsample_mode_t mode, void *sampler, uint8_t * ycbcr[], - int width, int height); +void chroma_subsample(subsample_mode_t mode, VJFrame *frame, uint8_t * ycbcr[] ); +void chroma_subsample_cp(subsample_mode_t mode, VJFrame *frame, uint8_t *ycbcr[], uint8_t *dcbcr[] ); +void chroma_supersample(subsample_mode_t mode, VJFrame *frame, uint8_t * ycbcr[] ); // yuv 4:2:2 packed to yuv 4:2:0 planar void vj_yuy2toyv12( uint8_t *y, uint8_t *u, uint8_t *v, uint8_t *in, int w, int h); diff --git a/veejay-current/veejay-server/veejay/liblavplayvj.c b/veejay-current/veejay-server/veejay/liblavplayvj.c index b70c9e06..cd1b93a8 100644 --- a/veejay-current/veejay-server/veejay/liblavplayvj.c +++ b/veejay-current/veejay-server/veejay/liblavplayvj.c @@ -2131,6 +2131,12 @@ int veejay_init(veejay_t * info, int x, int y,char *arg, int def_tags, int gen_t info->effect_frame1->width,info->effect_frame1->height, info->effect_frame1->ssm, info->effect_frame1->format ); + veejay_msg(VEEJAY_MSG_DEBUG, " %d x %d (h=%d,v=%d)", + info->effect_frame1->uv_width,info->effect_frame1->uv_height, + info->effect_frame1->shift_v, info->effect_frame1->shift_h ); + veejay_msg(VEEJAY_MSG_DEBUG, " Y=%d bytes, UV=%d bytes", + info->effect_frame1->len, + info->effect_frame1->uv_len ); if(!vj_perform_init(info)) { diff --git a/veejay-current/veejay-server/veejay/vj-composite.c b/veejay-current/veejay-server/veejay/vj-composite.c index 313380d7..e230bee7 100644 --- a/veejay-current/veejay-server/veejay/vj-composite.c +++ b/veejay-current/veejay-server/veejay/vj-composite.c @@ -53,7 +53,6 @@ typedef struct uint8_t *mirror_plane[3]; void *vp1; void *back1; - void *sampler; void *scaler; void *back_scaler; VJFrame *frame1; @@ -129,7 +128,6 @@ void *composite_init( int pw, int ph, int iw, int ih, const char *homedir, int s c->proj_plane[2] = c->proj_plane[1] + RUP8(pw * ph) + RUP8(pw); viewport_set_marker( c->vp1, 1 ); - c->sampler = subsample_init( pw ); sws_template sws_templ; veejay_memset(&sws_templ,0,sizeof(sws_template)); @@ -213,7 +211,6 @@ void composite_destroy( void *compiz ) if(c->frame2) free(c->frame2); if(c->frame3) free(c->frame3); if(c->frame4) free(c->frame4); - if(c->sampler) subsample_free(c->sampler); free(c); } c = NULL; @@ -492,9 +489,8 @@ int composite_process(void *compiz, VJFrame *output, VJFrame *input, int which_v if( c->has_mirror_plane ) { if(c->mirror_row_start == 0 && (c->mirror_row_end == input->height || c->mirror_row_end == 0) ) { - veejay_memcpy( c->mirror_plane[0], input->data[0], input->len ); - veejay_memcpy( c->mirror_plane[1], input->data[1], input->uv_len ); - veejay_memcpy( c->mirror_plane[2], input->data[2], input->uv_len ); + int strides[4] = { input->len, input->uv_len, input->uv_len, 0 }; + vj_frame_copy( input->data, c->mirror_plane, strides ); } else { unsigned int i,j = 0; @@ -559,7 +555,7 @@ int composite_processX( void *compiz, void *back1, uint8_t *out_data[3], VJFram if(!input->ssm) /* supersample to YUV 4:4:4 */ { - chroma_supersample( c->sample_mode, c->sampler, input->data, input->width, input->height ); + chroma_supersample( c->sample_mode, input, input->data); input->ssm = 1; } #ifdef STRICT_CHECKING diff --git a/veejay-current/veejay-server/veejay/vj-misc.c b/veejay-current/veejay-server/veejay/vj-misc.c index fa4d0e42..9069eeda 100644 --- a/veejay-current/veejay-server/veejay/vj-misc.c +++ b/veejay-current/veejay-server/veejay/vj-misc.c @@ -228,7 +228,6 @@ filelist_t *find_media_files( veejay_t *info ) int vj_perform_take_bg(veejay_t *info, VJFrame *frame, int pass) { int n = 0; - static void *bg_sampler = NULL; if( pass == 0 ) { if(frame->ssm = 1 ) { n += vj_effect_prepare( frame, VJ_VIDEO_EFFECT_CHAMBLEND ); @@ -245,10 +244,7 @@ int vj_perform_take_bg(veejay_t *info, VJFrame *frame, int pass) if( frame->ssm == 0 ) { - //@ supersample - if(!bg_sampler) - bg_sampler = subsample_init( frame->width ); - chroma_supersample( info->settings->sample_mode,bg_sampler,frame->data,frame->width,frame->height); + chroma_supersample( info->settings->sample_mode,frame,frame->data ); n += vj_effect_prepare( frame, VJ_VIDEO_EFFECT_CHAMBLEND ); n += vj_effect_prepare( frame, VJ_IMAGE_EFFECT_CHAMELEON ); frame->ssm = 1; diff --git a/veejay-current/veejay-server/veejay/vj-misc.h b/veejay-current/veejay-server/veejay/vj-misc.h index 7fa5fc33..37e75ca2 100644 --- a/veejay-current/veejay-server/veejay/vj-misc.h +++ b/veejay-current/veejay-server/veejay/vj-misc.h @@ -30,8 +30,11 @@ typedef struct int max_files; } filelist_t; - +#ifndef _LARGEFILE_SOURCE #define VEEJAY_FILE_LIMIT (1048576 * 2000) +#else +#define VEEJAY_FILE_LIMIT LLONG_MAX +#endif int available_diskspace(void); int vj_perform_screenshot2(veejay_t * info, uint8_t ** src); diff --git a/veejay-current/veejay-server/veejay/vj-perform.c b/veejay-current/veejay-server/veejay/vj-perform.c index efe11cce..8e154347 100644 --- a/veejay-current/veejay-server/veejay/vj-perform.c +++ b/veejay-current/veejay-server/veejay/vj-perform.c @@ -159,24 +159,24 @@ static int vj_perform_get_subframe_tag(veejay_t * info, int sub_sample, int chai static void vj_perform_reverse_audio_frame(veejay_t * info, int len, uint8_t *buf ); -//@ FIXME: DROP THESE METHODS + static void vj_perform_copy( ycbcr_frame *src, ycbcr_frame *dst, int Y_len, int UV_len ) { uint8_t *input[4] = { src->Y, src->Cb, src->Cr,NULL }; uint8_t *output[4] = { dst->Y, dst->Cb, dst->Cr,NULL }; int strides[4] = { Y_len, UV_len, UV_len,0 }; - vj_frame_copy(input,output,strides,3); + vj_frame_copy(input,output,strides); } static void vj_perform_copy2( ycbcr_frame *src, uint8_t **output, int Y_len, int UV_len ) { uint8_t *input[4] = { src->Y, src->Cb, src->Cr,NULL }; int strides[4] = { Y_len, UV_len, UV_len,0 }; - vj_frame_copy(input,output,strides,3); + vj_frame_copy(input,output,strides); } static void vj_perform_copy3( uint8_t **input, uint8_t **output, int Y_len, int UV_len ) { int strides[4] = { Y_len, UV_len, UV_len,0 }; - vj_frame_copy(input,output,strides,3); + vj_frame_copy(input,output,strides); } @@ -717,8 +717,6 @@ int vj_perform_init(veejay_t * info) // vj_perform_record_buffer_init(); - effect_sampler = subsample_init( w ); - lzo_ = lzo_new(); int vp = 0; int frontback = 0; @@ -883,11 +881,6 @@ void vj_perform_free(veejay_t * info) if(crop_frame->data[1]) free(crop_frame->data[1]); if(crop_frame->data[2]) free(crop_frame->data[2]); } - if(crop_sampler) - subsample_free(crop_sampler); - if(effect_sampler) - subsample_free(effect_sampler); - // if( info->viewport ) // viewport_destroy( info->viewport ); @@ -1015,9 +1008,9 @@ int vj_perform_get_cropped_frame( veejay_t *info, uint8_t **frame, int crop ) src.data[2] = primary_buffer[0]->Cr; // yuv crop needs supersampled data - chroma_supersample( info->settings->sample_mode,effect_sampler, src.data, src.width,src.height ); + chroma_supersample( info->settings->sample_mode,&src, src.data); yuv_crop( &src, crop_frame, &(info->settings->viewport)); - chroma_subsample( info->settings->sample_mode,crop_sampler, crop_frame->data, crop_frame->width, crop_frame->height ); + chroma_subsample( info->settings->sample_mode,crop_frame, crop_frame->data); } frame[0] = crop_frame->data[0]; @@ -1039,8 +1032,6 @@ int vj_perform_init_cropped_output_frame(veejay_t *info, VJFrame *src, int *dw, *dw = crop_frame->width; *dh = crop_frame->height; - crop_sampler = subsample_init( *dw ); - /* enough space to supersample*/ int i; for( i = 0; i < 3; i ++ ) @@ -2176,10 +2167,8 @@ static int vj_perform_tag_render_chain_entry(veejay_t *info, int chain_entry) { chroma_supersample( settings->sample_mode, - effect_sampler, - frames[1]->data, - frameinfo->width, - frameinfo->height ); + frames[1], + frames[1]->data ); frames[1]->ssm = 1; frame_buffer[chain_entry]->ssm = 1; } @@ -2187,10 +2176,8 @@ static int vj_perform_tag_render_chain_entry(veejay_t *info, int chain_entry) { chroma_subsample( settings->sample_mode, - effect_sampler, - frames[1]->data, - frameinfo->width, - frameinfo->height + frames[1], + frames[1]->data ); frames[1]->ssm = 0; frame_buffer[chain_entry]->ssm = 0; @@ -2210,19 +2197,16 @@ static int vj_perform_tag_render_chain_entry(veejay_t *info, int chain_entry) { chroma_supersample( settings->sample_mode, - effect_sampler, - frames[0]->data, - frameinfo->width, - frameinfo->height ); + frames[0], + frames[0]->data ); frames[0]->ssm = 1; } else if(!sub_mode && frames[0]->ssm == 1) { chroma_subsample( settings->sample_mode, - effect_sampler, - frames[0]->data,frameinfo->width, - frameinfo->height + frames[0], + frames[0]->data ); frames[0]->ssm = 0; } @@ -2306,13 +2290,13 @@ static int vj_perform_preprocess_secundary( veejay_t *info, int id, int mode,int if( ef ) continue; if( sm ) { if( !ssm ) { - chroma_supersample( settings->sample_mode,effect_sampler,F[0]->data,i->width,i->height ); + chroma_supersample( settings->sample_mode,F[0],F[0]->data ); F[0]->ssm = 1; frame_buffer[chain_entry]->ssm = 1; ssm = 1; } } else if ( ssm ) { - chroma_subsample( settings->sample_mode, effect_sampler,F[0]->data,i->width,i->height); + chroma_subsample( settings->sample_mode,F[0],F[0]->data); F[0]->ssm = 0; frame_buffer[chain_entry]->ssm = 1; ssm = 0; @@ -2351,13 +2335,13 @@ static int vj_perform_preprocess_secundary( veejay_t *info, int id, int mode,int if( ef ) continue; if( sm ) { if( !ssm ) { - chroma_supersample( settings->sample_mode,effect_sampler,F[0]->data,i->width,i->height ); + chroma_supersample( settings->sample_mode,F[0],F[0]->data ); F[0]->ssm = 1; frame_buffer[chain_entry]->ssm = 1; ssm = 1; } } else if ( ssm ) { - chroma_subsample( settings->sample_mode, effect_sampler,F[0]->data,i->width,i->height); + chroma_subsample( settings->sample_mode,F[0],F[0]->data); F[0]->ssm = 0; frame_buffer[chain_entry]->ssm = 1; ssm = 0; @@ -2392,14 +2376,15 @@ static int vj_perform_render_chain_entry(veejay_t *info, int chain_entry) VJFrame *frames[2]; VJFrameInfo *frameinfo; video_playback_setup *settings = info->settings; + frames[0] = info->effect_frame1; frames[1] = info->effect_frame2; -// frames[1]->format = info->pixel_format; - frameinfo = info->effect_frame_info; - frames[0]->data[0] = primary_buffer[0]->Y; + + frameinfo = info->effect_frame_info; + + frames[0]->data[0] = primary_buffer[0]->Y; frames[0]->data[1] = primary_buffer[0]->Cb; frames[0]->data[2] = primary_buffer[0]->Cr; -// frames[0]->format = info->pixel_format; vjp_kf *setup; setup = info->effect_info; @@ -2444,11 +2429,9 @@ static int vj_perform_render_chain_entry(veejay_t *info, int chain_entry) { chroma_supersample( settings->sample_mode, - effect_sampler, - frames[1]->data, - frameinfo->width, - frameinfo->height ); - frames[1]->ssm = 1; // HUH FIXME was 0 + frames[1], + frames[1]->data ); + frames[1]->ssm = 1; frame_buffer[chain_entry]->ssm = 1; } else if(frames[1]->ssm == 1 && !sub_mode ) @@ -2457,11 +2440,8 @@ static int vj_perform_render_chain_entry(veejay_t *info, int chain_entry) frame_buffer[chain_entry]->ssm = 0; chroma_subsample( settings->sample_mode, - effect_sampler, - frames[1]->data, - frameinfo->width, - frameinfo->height - ); + frames[1], + frames[1]->data ); } if(!done && do_ssm >= 0) { @@ -2476,10 +2456,8 @@ static int vj_perform_render_chain_entry(veejay_t *info, int chain_entry) { chroma_supersample( settings->sample_mode, - effect_sampler, - frames[0]->data, - frameinfo->width, - frameinfo->height ); + frames[0], + frames[0]->data ); frames[0]->ssm = 1; } @@ -2487,11 +2465,8 @@ static int vj_perform_render_chain_entry(veejay_t *info, int chain_entry) { chroma_subsample( settings->sample_mode, - effect_sampler, - frames[0]->data, - frameinfo->width, - frameinfo->height - ); + frames[0], + frames[0]->data ); frames[0]->ssm = 0; } @@ -2944,11 +2919,8 @@ static inline void vj_perform_supersample_chain( veejay_t *info, VJFrame *frame { chroma_supersample( info->settings->sample_mode, - effect_sampler, - temp_buffer, - frame->width, - frame->height - ); + frame, + temp_buffer ); frame->ssm = 1; } @@ -3300,11 +3272,8 @@ static void vj_perform_render_osd( veejay_t *info, video_playback_setup *setting { chroma_supersample( settings->sample_mode, - effect_sampler, - frame->data, - frame->width, - frame->height - ); + frame, + frame->data ); frame->ssm = 1; } @@ -3444,11 +3413,8 @@ static void vj_perform_finish_render( veejay_t *info, video_playback_setup *sett if(!frame->ssm) { chroma_supersample( settings->sample_mode, - effect_sampler, - pri, - frame->width, - frame->height - ); + frame, + pri ); frame->ssm = 1; } if( viewport_active(vp) ) @@ -3484,12 +3450,9 @@ static void vj_perform_finish_render( veejay_t *info, video_playback_setup *sett if( frame->ssm == 1 ) { chroma_subsample( - settings->sample_mode, - effect_sampler, - pri, - frame->width, - frame->height - ); + settings->sample_mode, + frame, + pri); frame->ssm = 0; } @@ -3536,11 +3499,8 @@ static void vj_perform_render_font( veejay_t *info, video_playback_setup *settin { chroma_supersample( settings->sample_mode, - effect_sampler, - frame->data, - frame->width, - frame->height - ); + frame, + frame->data ); frame->ssm = 1; } @@ -3561,8 +3521,7 @@ static void vj_perform_record_frame( veejay_t *info ) video_playback_setup *settings = info->settings; uint8_t *dst[3] = { NULL, primary_buffer[3]->Cb, primary_buffer[3]->Cr }; - chroma_subsample_cp( settings->sample_mode, effect_sampler, - frame->data,dst, frame->width,frame->height ); + chroma_subsample_cp( settings->sample_mode, frame, frame->data,dst ); uint8_t *chroma[2] = { primary_buffer[0]->Cb, primary_buffer[0]->Cr }; primary_buffer[0]->Cb = dst[1]; primary_buffer[0]->Cr = dst[2]; @@ -3598,11 +3557,8 @@ static int vj_perform_render_magic( veejay_t *info, video_playback_setup *settin { chroma_subsample( settings->sample_mode, - effect_sampler, - pri, - frame->width, - frame->height - ); + frame, + pri ); frame->ssm = 0; } diff --git a/veejay-current/veejay-server/veejay/vj-shm.c b/veejay-current/veejay-server/veejay/vj-shm.c index d32c61e3..5efa178f 100644 --- a/veejay-current/veejay-server/veejay/vj-shm.c +++ b/veejay-current/veejay-server/veejay/vj-shm.c @@ -168,7 +168,7 @@ int vj_shm_read( void *vv , uint8_t *dst[3] ) uint8_t *in[4] = { ptr, ptr + len, ptr + len + uv_len,NULL }; int strides[4] = { len, uv_len, uv_len,0 }; - vj_frame_copy( in, dst, strides,3 ); + vj_frame_copy( in, dst, strides ); // veejay_memcpy( dst[0], ptr, len ); // veejay_memcpy( dst[1], ptr + len, uv_len ); @@ -205,7 +205,7 @@ int vj_shm_write( void *vv, uint8_t *frame[3], int plane_sizes[4] ) uint8_t *dst[4] = { ptr, ptr + plane_sizes[0], ptr + plane_sizes[0] + plane_sizes[1], NULL }; plane_sizes[3] = 0; - vj_frame_copy( frame, dst, plane_sizes,3 ); + vj_frame_copy( frame, dst, plane_sizes ); // veejay_memcpy( ptr , frame[0], plane_sizes[0] ); diff --git a/veejay-current/veejay-server/veejay/vj-task.c b/veejay-current/veejay-server/veejay/vj-task.c index f8bac16a..707109ab 100644 --- a/veejay-current/veejay-server/veejay/vj-task.c +++ b/veejay-current/veejay-server/veejay/vj-task.c @@ -1,3 +1,33 @@ +/* + * Linux VeeJay + * + * Copyright(C)2002-2012 Niels Elburg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License , or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. + */ + +/* + Thread pool for blob processing. + + This module will start (N_CPU * 2) threads to divide the workload. + + The run method will assign work to the various threads and signal them to start processing. + The run method will wait until all tasks are done. + +*/ + #include #include #include @@ -17,26 +47,30 @@ #include #include #include - +#include #ifdef STRICT_CHECKING #include #endif - + +//@ job description static vj_task_arg_t *vj_task_args[MAX_WORKERS]; +//@ task struct task { - int task_id; + int task_id; void *data; void *(*handler)(void *arg); struct task *next; }; +//@ job structure typedef struct { performer_job_routine job; void *arg; } pjob_t; +//@ no dynamic, static allocation here. static int total_tasks_ = 0; static int tasks_done[MAX_WORKERS]; static int tasks_todo = 0; @@ -48,7 +82,6 @@ static pthread_cond_t current_task; static int numThreads = 0; struct task *tasks_ = NULL; struct task *tail_task_ = NULL; - static pthread_t p_threads[MAX_WORKERS]; static pthread_attr_t p_attr[MAX_WORKERS]; static int p_tasks[MAX_WORKERS]; @@ -69,9 +102,6 @@ void *task_add(int task_no, void *(fp)(void *data), void *data) return NULL; } - -// int err = pthread_mutex_lock( &queue_mutex ); - enqueue_task->task_id = task_no; enqueue_task->handler = fp; enqueue_task->data = data; @@ -88,9 +118,7 @@ void *task_add(int task_no, void *(fp)(void *data), void *data) total_tasks_ ++; - int err = pthread_cond_signal( ¤t_task ); -// err = pthread_mutex_unlock( &queue_mutex ); - + int err = pthread_cond_signal( ¤t_task ); } @@ -121,10 +149,9 @@ void task_run( struct task *task, void *data, int id) (*task->handler)(data); pthread_mutex_lock(&queue_mutex); - tasks_done[id] ++; //@ inc, it is possible same thread tasks both tasks + tasks_done[id] ++; pthread_cond_signal( &tasks_completed ); pthread_mutex_unlock( &queue_mutex ); - } } @@ -201,13 +228,13 @@ int task_start(int max_workers) } exitFlag = 0; - /*int max_p = sched_get_priority_max( SCHED_FIFO ); - int min_p = sched_get_priority_min( SCHED_FIFO ); + int max_p = sched_get_priority_max( SCHED_FIFO ); + int min_p = sched_get_priority_min( SCHED_FIFO ); - max_p = (int) ( ((float) max_p) * 0.8f ); - if( max_p < min_p ) + max_p = (int) ( ((float) max_p) * 0.75f ); + if( max_p < min_p ) max_p = min_p; - */ + struct sched_param param; cpu_set_t cpuset; @@ -218,12 +245,9 @@ int task_start(int max_workers) for( i = 0 ; i < max_workers; i ++ ) { thr_id[i] = i; pthread_attr_init( &p_attr[i] ); -// pthread_attr_setstacksize( &p_attr[i], 4096 ); - -// pthread_attr_setschedpolicy( &p_attr[i], SCHED_FIFO ); - // pthread_attr_setschedparam( &p_attr[i], ¶m ); - - + pthread_attr_setstacksize( &p_attr[i], 128 * 1024 ); + pthread_attr_setschedpolicy( &p_attr[i], SCHED_FIFO ); + pthread_attr_setschedparam( &p_attr[i], ¶m ); if( n_cpu > 1 ) { CPU_ZERO(&cpuset); @@ -280,9 +304,6 @@ void performer_job( int n ) int i; pthread_mutex_lock(&queue_mutex); -// taskLock = 1; -// pthread_mutex_unlock(&queue_mutex); - tasks_todo = n; veejay_memset( tasks_done, 0, sizeof(tasks_done)); @@ -291,21 +312,11 @@ void performer_job( int n ) task_add( i, slot->job, slot->arg ); } - //task_ready(n); - pthread_mutex_unlock( &queue_mutex ); -/* for( i = 0; i < n; i ++ ) { - void *exit_code = NULL; - pjob_t *slot = &(arr[i]); - pthread_join( slot->thread, NULL ); - if( exit_code != 0 ) { - - } - } */ - int stop = 0; int c = 0; + while(!stop) { pthread_mutex_lock( &queue_mutex ); int done = 0; @@ -334,25 +345,51 @@ void performer_job( int n ) void vj_task_set_float( float f ){ int i; - for( i = 0; i < MAX_WORKERS; i ++ ) + int n = task_get_workers(); + for( i = 0; i < n; i ++ ) vj_task_args[i]->fparam = f; } void vj_task_set_int( int val ){ int i; - for( i = 0; i < MAX_WORKERS; i ++ ) + int n = task_get_workers(); + + for( i = 0; i < n; i ++ ) vj_task_args[i]->iparam = val; } +void vj_task_set_param( int val , int idx ){ + int i; + int n = task_get_workers(); + + for( i = 0; i < n; i ++ ) + vj_task_args[i]->iparams[idx] = val; +} + +void vj_task_set_overlap( int val ){ + int i; + int n = task_get_workers(); + + for( i = 0; i < n; i ++ ) + vj_task_args[i]->overlap = val; +} void vj_task_set_wid( int w ) { int i; - for( i = 0; i < MAX_WORKERS; i ++ ) + int n = task_get_workers(); + + for( i = 0; i < n; i ++ ) { + vj_task_args[i]->subwid = w; vj_task_args[i]->width = w; + } } void vj_task_set_hei( int h ) { int i; - for( i = 0; i < MAX_WORKERS; i ++ ) + int n = task_get_workers(); + + for( i = 0; i < n; i ++ ) { vj_task_args[i]->height = h; + vj_task_args[i]->subhei = h; + } } int vj_task_available() @@ -363,20 +400,121 @@ int vj_task_available() void vj_task_set_shift( int v, int h ) { int i; - for( i = 0; i < MAX_WORKERS; i ++ ) { + int n = task_get_workers(); + + for( i = 0; i < n; i ++ ) { vj_task_args[i]->shifth = h; vj_task_args[i]->shiftv = v; } } -void vj_task_alloc_internal_buf( int w ) +void *vj_task_alloc_internal_buf( unsigned int size ) { int i; - for( i = 0; i < MAX_WORKERS; i ++ ) { - vj_task_args[i]->priv = (void*) vj_malloc( RUP8( w ) ); + int n = task_get_workers(); + uint8_t *buffer = (uint8_t*) vj_malloc( size ); + unsigned int offset = ( size / n ); + + for( i = 0; i < n; i ++ ) { + vj_task_args[i]->priv = (void*) (buffer + ( size * i )); + } + return (void*) buffer; +} + +void vj_task_set_ptr( void *ptr ) +{ + int i; + int n = task_get_workers(); + + for( i = 0; i < n; i ++ ) { + vj_task_args[i]->ptr = ptr; } } +void vj_task_set_from_args( int len, int uv_len ) +{ + int n = task_get_workers(); + int i; + + for( i = 0; i < n; i ++ ) { + vj_task_arg_t *v = vj_task_args[i]; + v->strides[0] = len / n; + v->strides[1] = uv_len / n; + v->strides[2] = uv_len / n; + v->strides[3] = 0; + } + +} + +void vj_task_set_to_frame( VJFrame *in, int i, int job ) +{ + vj_task_arg_t *first = vj_task_args[job]; + in->width = first->width; + in->height= first->height; + in->ssm = first->ssm; + in->uv_width = first->uv_width; + in->uv_height= first->uv_height; + in->shift_v = first->shiftv; + in->shift_h = first->shifth; + in->len = in->width * in->height; + in->uv_len = in->uv_width * in->uv_height; + + switch( i ) { + case 0: + in->data[0]=first->input[0]; + in->data[1]=first->input[1]; + in->data[2]=first->input[2]; + break; + case 1: + in->data[0]=first->output[0]; + in->data[1]=first->output[1]; + in->data[2]=first->output[2]; + break; + case 2: + in->data[0]=first->temp[0]; + in->data[1]=first->temp[1]; + in->data[2]=first->temp[2]; + break; + } +} + +void vj_task_set_from_frame( VJFrame *in ) +{ + int n = task_get_workers(); + int i; + + for( i = 0; i < n; i ++ ) { + vj_task_arg_t *v= vj_task_args[i]; + veejay_memset( v, 0, sizeof( vj_task_arg_t ) ); + + v->width = in->width; + v->height = in->height / n; + v->subwid = in->width / n; + v->subhei = in->height / n; + v->uv_width = in->uv_width; + v->uv_height = in->uv_height /n; + v->strides[0] = (v->width * v->height); + v->strides[1] = (v->uv_width * v->uv_height); + v->strides[2] = v->strides[1]; + v->strides[3] = 0; + v->shiftv = in->shift_v; + v->shifth = in->shift_h; + v->ssm = in->ssm; + } +} + +void vj_task_set_sampling( int s ) +{ + int n = task_get_workers(); + int i; + + for( i = 0; i < n; i ++ ) { + vj_task_arg_t *v = vj_task_args[i]; + v->sampling = s; + } +} + +extern int pixel_Y_lo_; int vj_task_run(uint8_t **buf1, uint8_t **buf2, uint8_t **buf3, int *strides,int n_planes, performer_job_routine func ) { @@ -386,94 +524,108 @@ int vj_task_run(uint8_t **buf1, uint8_t **buf2, uint8_t **buf3, int *strides,int vj_task_arg_t **f = (vj_task_arg_t**) vj_task_args; int i,j; - + + for ( i = 0; i < n_planes; i ++ ) { + if( f[0]->sampling && i == 0 ){ + f[0]->input[i] = NULL; + f[0]->output[i] = NULL; + f[0]->temp[i] = NULL; + } else { + f[0]->input[i] = buf1[i]; + f[0]->output[i]= buf2[i]; + if( buf3 != NULL ) + f[0]->temp[i] = buf3[i]; + } + } + + f[0]->jobnum = 0; + if( strides != NULL ) { for( j = 0; j < n; j ++ ) { for( i = 0; i < n_planes; i ++ ) { f[j]->strides[i] = strides[i] / n; } } + } - for ( i = 0; i < n_planes; i ++ ) { - if( f[0]->strides[i] == 0 ) - continue; - - f[0]->input[i] = buf1[i]; - f[0]->output[i]= buf2[i]; + for( j = 1; j < n; j ++ ) { + if( f[j]->sampling ) { + //@ for sampling, must be present: + //@ UV planes, width, height, inplace + unsigned int start = j * f[j]->strides[1]; + unsigned int out = j * f[j]->strides[0];//@ upsampled plane - if( buf3 != NULL ) - f[0]->temp[i] = buf3[i]; + if( f[j]->ssm == 1 ) { + f[j]->input[1] = f[0]->input[1] + start; + f[j]->input[2] = f[0]->input[2] + start; + f[j]->output[1]= f[0]->output[1] + out; + f[j]->output[2]= f[0]->output[2] + out; + } else { + f[j]->input[1] = f[0]->input[1] + out; + f[j]->input[2] = f[0]->input[2] + out; + f[j]->output[1]= f[0]->output[1] + start; + f[j]->output[2]= f[0]->output[2] + start; + } + f[j]->temp[1] = NULL; + f[j]->temp[2] = NULL; } - - for( j = 1; j < n; j ++ ) { + else { for( i = 0; i < n_planes; i ++ ) { - if( strides[i] == 0 ) + if( f[j]->strides[i] == 0 ) continue; - f[j]->input[i] = buf1[i] + (f[0]->strides[i] * j); - f[j]->output[i] = buf2[i] + (f[0]->strides[i] * j); + f[j]->input[i] = buf1[i] + (f[j]->strides[i] * j); + f[j]->output[i] = buf2[i] + (f[j]->strides[i] * j); if( buf3 != NULL ) - f[j]->temp[i] = buf3[i] + (f[0]->strides[i]* j); - } - } - } else if( f[0]->width > 0 && f[0]->height > 0 ) { - int w = f[0]->width; - int h = f[0]->height; + f[j]->temp[i] = buf3[i] + (f[j]->strides[i]* j); + f[j]->jobnum = j; + + } + } + } - for( j = 0; j < n; j ++ ) { - f[j]->height = h / n; - } - - int uv_width = w >> f[0]->shiftv; - int uv_height= h >> f[0]->shifth; - - int wid = w; - int uwid = uv_width; - - int hei = h / n; - int uhei = uv_height / n; - - for( j = 0; j < n; j ++ ) { - f[j]->input[0] = buf1[0] + ( j * wid * hei ); - f[j]->input[1] = buf1[1] + ( j * uwid * uhei ); - f[j]->input[2] = buf1[2] + ( j * uwid * uhei ); - f[j]->input[3] = NULL; - f[j]->output[0]= buf2[0] + ( j * wid * uhei ); - f[j]->output[1]= buf2[1] + ( j * uwid * uhei ); - f[j]->output[2]= buf2[2] + ( j * uwid * uhei ); - f[j]->output[3] = NULL; - if( buf3 != NULL ) { - f[j]->temp[0] = buf3[0] + ( j * wid * hei ); - f[j]->temp[1] = buf3[1] + ( j * uwid * uhei ); - f[j]->temp[2] = buf3[2] + ( j * uwid * uhei ); - f[j]->temp[3] = NULL; - } - for ( i = 0; i < 4; i ++ ) - f[j]->strides[i] = 0; - } - - } - else { - veejay_msg(0, "%s: Invalid arguments.",__FUNCTION__); -#ifdef STRICT_CHECKING - assert( 0 ); -#endif - return 0; - } - - for( i = 0; i < n; i ++ ) { job_list[i]->job = func; job_list[i]->arg = f[i]; } + for( j = 0; j < n; j ++ ) { + if( f[j]->overlap > 0 ) { + f[j]->overlaprow = (uint8_t*) vj_malloc( sizeof(uint8_t) * f[j]->overlap ); + int offset = (f[j]->strides[0] * j) + (f[j]->strides[0] - f[j]->overlap); + if( (offset+f[j]->overlap) > (f[j]->width * f[j]->height * n) ) { + veejay_memset( f[j]->overlaprow, pixel_Y_lo_, f[j]->overlap ); + } else { + veejay_memcpy( + f[j]->overlaprow, + f[j]->input[0] + offset, + f[j]->overlap ); + } + } + } + performer_job( n ); - for( i = 0; i < n; i ++ ) { - if( f[i]->priv ) - free( f[i]->priv ); + for( j = 0; j < n; j ++ ) { + if( f[j]->overlaprow ) { + free(f[j]->overlaprow); + f[j]->overlaprow = NULL; + } } return 1; } +void vj_task_free_internal_buf() +{ + if(vj_task_args[0]->priv ) + free(vj_task_args[0]->priv); + + int n = task_get_workers(); + int i; + + for( i = 0; i < n; i ++ ) { + vj_task_arg_t *v = vj_task_args[i]; + v->priv = NULL; + } +} diff --git a/veejay-current/veejay-server/veejay/vj-task.h b/veejay-current/veejay-server/veejay/vj-task.h index e87ef874..debd942b 100644 --- a/veejay-current/veejay-server/veejay/vj-task.h +++ b/veejay-current/veejay-server/veejay/vj-task.h @@ -28,13 +28,24 @@ typedef struct uint8_t *output[4]; int strides[4]; uint8_t *temp[4]; + int iparams[12]; float fparam; int iparam; void *priv; + void *ptr; int width; int height; + int subwid; + int subhei; int shiftv; int shifth; + int sampling; + int ssm; + int uv_width; + int uv_height; + int jobnum; + int overlap; + uint8_t *overlaprow; } vj_task_arg_t; void vj_task_init(); @@ -42,14 +53,19 @@ void vj_task_init(); int vj_task_run(uint8_t **buf1, uint8_t **buf2, uint8_t **buf3, int *strides,int n_planes, performer_job_routine func ); -void vj_task_alloc_internal_buf( int w ); +void *vj_task_alloc_internal_buf( unsigned int w ); void vj_task_set_float( float f ); void vj_task_set_int( int i ); void vj_task_set_wid( int w ); void vj_task_set_hei( int h ); void vj_task_set_shift( int h, int v ); - - +void vj_task_set_ptr( void *ptr ); +void vj_task_set_to_frame( VJFrame *frame, int pos, int job ); +void vj_task_set_from_frame( VJFrame *frame ); +void vj_task_set_from_args( int len, int uv_len ); +void vj_task_set_param( int v, int idx ); +void vj_task_free_internal_buf(); +void *vj_task_get_internal_buf(); int task_start(int max_workers); void task_stop(int max_workers); void task_init(); diff --git a/veejay-current/veejay-server/veejay/vj-viewport.c b/veejay-current/veejay-server/veejay/vj-viewport.c index 67aa8150..e07a5209 100644 --- a/veejay-current/veejay-server/veejay/vj-viewport.c +++ b/veejay-current/veejay-server/veejay/vj-viewport.c @@ -3081,9 +3081,10 @@ void viewport_produce_full_img( void *vdata, uint8_t *img[3], uint8_t *out_img[3 int x,y; y = ty1 * w; - veejay_memset( outY,0,len); - veejay_memset( outU,128,len); - veejay_memset( outV,128,len); + + vj_frame_clear1( outY,0,len); + vj_frame_clear1( outU,128,len); + vj_frame_clear1( outV,128,len); for( y = ty1; y < ty2; y ++ ) {