diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/filter_29to23.c transcode-0.6.3/filter/filter_29to23.c --- orig-transcode-0.6.3/filter/filter_29to23.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/filter_29to23.c Sat Feb 1 23:19:18 2003 @@ -22,7 +22,7 @@ */ #define MOD_NAME "filter_29to23.so" -#define MOD_VERSION "v0.1 (2002-09-13)" +#define MOD_VERSION "v0.2 (2003-02-01)" #define MOD_CAP "frame rate conversion filter" #include @@ -116,11 +116,11 @@ case 1: break; case 2: - memcpy (f1, ptr->video_buf, SIZE_RGB_FRAME); + memcpy (f1, ptr->video_buf, ptr->v_width*ptr->v_height*3); ptr->attributes |= TC_FRAME_IS_SKIPPED; break; case 3: - memcpy (f2, ptr->video_buf, SIZE_RGB_FRAME); + memcpy (f2, ptr->video_buf, ptr->v_width*ptr->v_height*3); { int i; int u, v, w; @@ -141,7 +141,7 @@ break; case 4: - memcpy (f1, ptr->video_buf, SIZE_RGB_FRAME); + memcpy (f1, ptr->video_buf, ptr->v_width*ptr->v_height*3); { int i; int u, v, w; diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/filter_32drop.c transcode-0.6.3/filter/filter_32drop.c --- orig-transcode-0.6.3/filter/filter_32drop.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/filter_32drop.c Sat Feb 1 23:24:39 2003 @@ -22,7 +22,7 @@ */ #define MOD_NAME "filter_32drop.so" -#define MOD_VERSION "v0.3 (2002-04-21)" +#define MOD_VERSION "v0.4 (2003-02-01)" #define MOD_CAP "3:2 inverse telecine removal plugin" #include @@ -193,7 +193,7 @@ if ((fnum - lfnum) == 2) { merge_frames(lastiframe, ptr->video_buf, ptr->v_width, ptr->v_height, ((vob->im_v_codec == CODEC_RGB) ? 3:1) ); } else { - memcpy(lastiframe, ptr->video_buf, SIZE_RGB_FRAME); + memcpy(lastiframe, ptr->video_buf, ptr->v_width*ptr->v_height*3); /* The use of the drop counter ensures syncronization even with * video-based sources. */ if (dcnt < 8) { @@ -204,11 +204,12 @@ /* If we'd lose sync by dropping, copy the last frame in. * If there are more than 3 interlaced frames in a row, it's * probably video and we don't want to copy the last frame over */ - if (((fnum - lfnum) < 3) && fnum) memcpy(ptr->video_buf, lastframe, SIZE_RGB_FRAME); + if (((fnum - lfnum) < 3) && fnum) + memcpy(ptr->video_buf, lastframe, ptr->v_width*ptr->v_height*3); } } } else { - memcpy(lastframe, ptr->video_buf, SIZE_RGB_FRAME); + memcpy(lastframe, ptr->video_buf, ptr->v_width*ptr->v_height*3); lfnum = fnum; } /* If we're dealing with a non-interlaced source, or close to it, it won't diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/filter_aclip.c transcode-0.6.3/filter/filter_aclip.c --- orig-transcode-0.6.3/filter/filter_aclip.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/filter_aclip.c Sat Feb 1 19:01:47 2003 @@ -47,7 +47,6 @@ static int min=0, max=0, bytes_per_sec; static uint64_t total=0; static int a_rate, a_bits, chan; -static double fps, fmin, fmax, frames, vol; static int level=10, range=25, range_ctr=0, skip_mode=0; diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/filter_cshift.c transcode-0.6.3/filter/filter_cshift.c --- orig-transcode-0.6.3/filter/filter_cshift.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/filter_cshift.c Sat Feb 1 20:10:59 2003 @@ -227,12 +227,12 @@ if(ptr->tag & TC_PRE_M_PROCESS && ptr->tag & TC_VIDEO) { - memcpy(buffer, ptr->video_buf, SIZE_RGB_FRAME); + memcpy(buffer, ptr->video_buf, ptr->v_width*ptr->v_height*3); if (vob->im_v_codec == CODEC_YUV) crshift_yuv(buffer, vob, loop); if (vob->im_v_codec == CODEC_RGB) crshift_rgb(buffer, vob, loop); - memcpy(ptr->video_buf, buffer, SIZE_RGB_FRAME); + memcpy(ptr->video_buf, buffer, ptr->v_width*ptr->v_height*3); } return(0); diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/filter_smartdeinter.c transcode-0.6.3/filter/filter_smartdeinter.c --- orig-transcode-0.6.3/filter/filter_smartdeinter.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/filter_smartdeinter.c Sun Feb 2 12:20:54 2003 @@ -33,7 +33,7 @@ */ #define MOD_NAME "filter_smartdeinter.so" -#define MOD_VERSION "v2.7b (2003-01-19)" +#define MOD_VERSION "v2.7b (2003-02-01)" #define MOD_CAP "VirtualDub's smart deinterlacer" #define MOD_AUTHOR "Donald Graft" @@ -196,6 +196,8 @@ fprintf(stderr, "No memory!\n"); return (-1); } + memset (mfd, 0, sizeof(MyFilterData)); + width = vob->im_v_width; height = vob->im_v_height; @@ -419,8 +421,9 @@ Pixel32 * dst_buf; Pixel32 * src_buf; - if (mfd->codec == CODEC_YUV) + if (mfd->codec == CODEC_YUV) { tc_yuv2rgb_core(ptr->video_buf); + } convert_rgb2argb (ptr->video_buf, mfd->convertFrameIn, ptr->v_width, ptr->v_height); diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/filter_videocore.c transcode-0.6.3/filter/filter_videocore.c --- orig-transcode-0.6.3/filter/filter_videocore.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/filter_videocore.c Sun Feb 2 00:19:02 2003 @@ -22,7 +22,7 @@ */ #define MOD_NAME "filter_videocore.so" -#define MOD_VERSION "v0.0.2 (2003-01-21)" +#define MOD_VERSION "v0.0.4 (2003-02-01)" #define MOD_CAP "Core video transformations" #define MOD_AUTHOR "Thomas, Tilmann" @@ -61,6 +61,8 @@ int decolor; float dgamma; int antialias; + double aa_weight; + double aa_bias; } MyFilterData; static MyFilterData *mfd = NULL; @@ -97,14 +99,17 @@ if((vob = tc_get_vob())==NULL) return(-1); if((mfd = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); + memset (mfd, 0, sizeof(MyFilterData)); mfd->deinterlace = 0; - mfd->flip = 0; - mfd->mirror = 0; - mfd->rgbswap = 0; - mfd->decolor = 0; - mfd->dgamma = 0.0; - mfd->antialias = 0; + mfd->flip = 0; + mfd->mirror = 0; + mfd->rgbswap = 0; + mfd->decolor = 0; + mfd->dgamma = 0.0; + mfd->antialias = 0; + mfd->aa_weight = TC_DEFAULT_AAWEIGHT; + mfd->aa_bias = TC_DEFAULT_AABIAS; if (options != NULL) { @@ -115,7 +120,8 @@ if (optstr_get (options, "rgbswap", "") >= 0) mfd->rgbswap = !mfd->rgbswap; if (optstr_get (options, "decolor", "") >= 0) mfd->decolor = !mfd->decolor; optstr_get (options, "dgamma", "%f", &mfd->dgamma); - optstr_get (options, "antialias", "%d", &mfd->antialias); + optstr_get (options, "antialias", "%d/%f/%f", + &mfd->antialias, &mfd->aa_weight, &mfd->aa_bias); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); } @@ -136,7 +142,7 @@ if(ptr->tag & TC_FILTER_GET_CONFIG && options) { char buf[255]; - optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYO", "1"); + optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYE", "1"); sprintf (buf, "%d", mfd->deinterlace); optstr_param (options, "deinterlace", "same as -I", "%d", buf, "0", "5"); @@ -150,11 +156,15 @@ sprintf (buf, "%d", mfd->rgbswap); optstr_param (options, "rgbswap", "same as -k", "", buf); + sprintf (buf, "%d", mfd->decolor); + optstr_param (options, "decolor", "same as -K", "", buf); + sprintf (buf, "%f", mfd->dgamma); optstr_param (options, "dgamma", "same as -G", "%f", buf, "0.0", "3.0"); - sprintf (buf, "%d", mfd->antialias); - optstr_param (options, "antialias", "same as -C", "%d", buf, "0", "3"); + sprintf (buf, "%d/%.2f/%.2f", mfd->antialias, mfd->aa_weight, mfd->aa_bias); + optstr_param (options, "antialias", "same as -C/weight/bias", "%d/%f/%f", buf, + "0", "3", "0.0", "1.0", "0.0", "1.0"); return 0; } @@ -187,9 +197,9 @@ // transcodes internal video/audo frame processing routines // or after and determines video/audio context - if((ptr->tag & TC_POST_PROCESS) && (vob->im_v_codec == CODEC_YUV)) { - + if((ptr->tag & TC_PRE_PROCESS) && (vob->im_v_codec == CODEC_YUV)) { if (mfd->deinterlace) { + switch (mfd->deinterlace) { case 1: @@ -206,7 +216,6 @@ case 4: deinterlace_yuv_nozoom(ptr->video_buf, ptr->v_width, ptr->v_height); - ptr->v_height /=2; break; case 5: @@ -217,13 +226,13 @@ } if (mfd->flip) { - yuv_flip(ptr->video_buf, ptr->v_width, ptr->v_height); + yuv_flip(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->mirror) { - yuv_mirror(ptr->video_buf, ptr->v_width, ptr->v_height); + yuv_mirror(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->rgbswap) { - yuv_swap(ptr->video_buf, ptr->v_width, ptr->v_height); + yuv_swap(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->dgamma > 0.0) { @@ -234,11 +243,91 @@ yuv_gamma(ptr->video_buf, ptr->v_width * ptr->v_height); } + if (mfd->decolor) { + yuv_decolor(ptr->video_buf, ptr->v_width * ptr->v_height); + } if (mfd->antialias) { + init_aa_table(vob->aa_weight, vob->aa_bias); + + //UV components unchanged + memcpy(ptr->video_buf_Y[ptr->free]+ptr->v_width*ptr->v_height, + ptr->video_buf + ptr->v_width*ptr->v_height, + ptr->v_width*ptr->v_height/2); + + yuv_antialias(ptr->video_buf, ptr->video_buf_Y[ptr->free], + ptr->v_width, ptr->v_height, mfd->antialias); + + // adjust pointer, zoomed frame in tmp buffer + ptr->video_buf = ptr->video_buf_Y[ptr->free]; + ptr->free = (ptr->free) ? 0:1; + + // no update for frame_list_t *ptr required } - } else if((ptr->tag & TC_POST_PROCESS) && (vob->im_v_codec == CODEC_RGB)) { + + } else if((ptr->tag & TC_PRE_PROCESS) && (vob->im_v_codec == CODEC_RGB)) { + if (mfd->deinterlace) { + + switch (mfd->deinterlace) { + + case 1: + rgb_deinterlace_linear(ptr->video_buf, ptr->v_width, ptr->v_height); + break; + + case 2: + //handled by encoder + break; + + case 3: + deinterlace_rgb_zoom(ptr->video_buf, ptr->v_width, ptr->v_height); + break; + + case 4: + deinterlace_rgb_nozoom(ptr->video_buf, ptr->v_width, ptr->v_height); + break; + + case 5: + rgb_deinterlace_linear_blend(ptr->video_buf, + ptr->video_buf_RGB[ptr->free], ptr->v_width, ptr->v_height); + break; + } + + } + if (mfd->flip) { + rgb_flip(ptr->video_buf, ptr->v_width, ptr->v_height); + } + if (mfd->mirror) { + rgb_mirror(ptr->video_buf, ptr->v_width, ptr->v_height); + } + if (mfd->rgbswap) { + rgb_swap(ptr->video_buf, ptr->v_width * ptr->v_height); + } + if (mfd->dgamma > 0.0) { + + if(!gamma_table_flag) { + init_gamma_table(gamma_table, mfd->dgamma); + gamma_table_flag = 1; + } + + rgb_gamma(ptr->video_buf, ptr->v_width * ptr->v_height * ptr->v_bpp>>3); + } + if (mfd->decolor) { + rgb_decolor(ptr->video_buf, ptr->v_width * ptr->v_height * ptr->v_bpp>>3); + } + if (mfd->antialias) { + + init_aa_table(vob->aa_weight, vob->aa_bias); + + rgb_antialias(ptr->video_buf, ptr->video_buf_RGB[ptr->free], + ptr->v_width, ptr->v_height, vob->antialias); + + // adjust pointer, zoomed frame in tmp buffer + ptr->video_buf = ptr->video_buf_RGB[ptr->free]; + ptr->free = (ptr->free) ? 0:1; + + } + } return(0); diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/ivtc/filter_decimate.c transcode-0.6.3/filter/ivtc/filter_decimate.c --- orig-transcode-0.6.3/filter/ivtc/filter_decimate.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/ivtc/filter_decimate.c Sat Feb 1 23:23:28 2003 @@ -23,7 +23,7 @@ */ #define MOD_NAME "filter_decimate.so" -#define MOD_VERSION "v0.2 (2002-08-12)" +#define MOD_VERSION "v0.3 (2003-02-01)" #define MOD_CAP "NTSC decimation plugin" #include @@ -137,7 +137,7 @@ // After frame processing, the frames must be deinterlaced // To correctly IVTC, you must use filter_ivtc before this filter, // i.e. -J ivtc,decimate - memcpy(lastFrames[frameIn], ptr->video_buf, SIZE_RGB_FRAME); + memcpy(lastFrames[frameIn], ptr->video_buf, ptr->v_width*ptr->v_height*3); if (show_results) fprintf(stderr, "Inserted frame %d into slot %d ", frameCount, frameIn); lastFramesOK[frameIn] = 1; frameIn = (frameIn+1) % FRBUFSIZ; @@ -193,7 +193,7 @@ } if (lastFramesOK[frameOut]) { - memcpy(ptr->video_buf, lastFrames[frameOut], SIZE_RGB_FRAME); + memcpy(ptr->video_buf, lastFrames[frameOut], ptr->v_width*ptr->v_height*3); if (show_results) fprintf(stderr, "giving slot %d\n", frameOut); } else { diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/ivtc/filter_ivtc.c transcode-0.6.3/filter/ivtc/filter_ivtc.c --- orig-transcode-0.6.3/filter/ivtc/filter_ivtc.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/ivtc/filter_ivtc.c Sat Feb 1 23:25:14 2003 @@ -23,7 +23,7 @@ */ #define MOD_NAME "filter_ivtc.so" -#define MOD_VERSION "v0.2 (2002-08-12)" +#define MOD_VERSION "v0.3 (2003-02-01)" #define MOD_CAP "NTSC inverse telecine plugin" #include @@ -45,11 +45,9 @@ #include "transcode.h" #include "framebuffer.h" +#include "optstr.h" // basic parameter -static int color_diff_threshold1 = 50; -static int color_diff_threshold2 = 100; -static double critical_threshold = 0.00005; static int show_results=0; /*------------------------------------------------- @@ -132,7 +130,7 @@ if ((ptr->tag & TC_PRE_PROCESS) && (ptr->tag & TC_VIDEO)) { - memcpy(lastFrames[frameIn], ptr->video_buf, SIZE_RGB_FRAME); + memcpy(lastFrames[frameIn], ptr->video_buf, ptr->v_width*ptr->v_height*3); if (show_results) fprintf(stderr, "Inserted frame %d into slot %d\n", frameCount, frameIn); frameIn = (frameIn+1) % FRBUFSIZ; frameCount++; diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/filter/preview/filter_pv.c transcode-0.6.3/filter/preview/filter_pv.c --- orig-transcode-0.6.3/filter/preview/filter_pv.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/filter/preview/filter_pv.c Sun Feb 2 14:01:43 2003 @@ -21,8 +21,12 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #define MOD_NAME "filter_pv.so" -#define MOD_VERSION "v0.2.0 (2002-01-20)" +#define MOD_VERSION "v0.2.1 (2002-02-01)" #define MOD_CAP "xv only preview plugin" #include @@ -34,6 +38,7 @@ #include "optstr.h" #include "font_xpm.h" #include "filter.h" +#include "video_trans.h" static int cache_num=0; static int cache_ptr=0; @@ -74,6 +79,9 @@ static int preview_skip=0, preview_skip_num=25; static char *undo_buffer = NULL; static char *run_buffer[2] = {NULL, NULL}; +static char *process_buffer[3] = {NULL, NULL, NULL}; + +static int process_ctr_cur=0; vob_t *vob=NULL; @@ -107,6 +115,28 @@ * *-------------------------------------------------*/ +char * preview_alloc_align_buffer(size_t size) +{ +#ifdef HAVE_GETPAGESIZE + int buffer_align=getpagesize(); +#else + int buffer_align=0; +#endif + char *buf = malloc(size + buffer_align); + + int adjust; + + if (buf == NULL) { + fprintf(stderr, "(%s) out of memory", __FILE__); + } + + adjust = buffer_align - ((int) buf) % buffer_align; + + if (adjust == buffer_align) + adjust = 0; + + return (buf + adjust); +} int tc_filter(vframe_list_t *ptr, char *options) { @@ -205,22 +235,19 @@ if (cache_num) { if(preview_cache_init()<0) return(-1); - if ((undo_buffer = (char *) malloc (size)) == NULL) { - fprintf(stderr, "[%s] malloc for undo_buffer failed : %s:%d\n", - MOD_NAME, __FILE__, __LINE__); + if ((undo_buffer = preview_alloc_align_buffer(SIZE_RGB_FRAME)) == NULL) return (-1); - } - - if ((run_buffer[0] = (char *) malloc (SIZE_RGB_FRAME)) == NULL) { - fprintf(stderr, "[%s] malloc for run_buffer[0] failed : %s:%d\n", - MOD_NAME, __FILE__, __LINE__); + if ((run_buffer[0] = preview_alloc_align_buffer (SIZE_RGB_FRAME)) == NULL) return (-1); - } - if ((run_buffer[1] = (char *) malloc (SIZE_RGB_FRAME)) == NULL) { - fprintf(stderr, "[%s] malloc for run_buffer[1] failed : %s:%d\n", - MOD_NAME, __FILE__, __LINE__); + if ((run_buffer[1] = preview_alloc_align_buffer (SIZE_RGB_FRAME)) == NULL) return (-1); - } + if ((process_buffer[0] = preview_alloc_align_buffer (SIZE_RGB_FRAME)) == NULL) + return (-1); + if ((process_buffer[1] = preview_alloc_align_buffer (SIZE_RGB_FRAME)) == NULL) + return (-1); + if ((process_buffer[2] = preview_alloc_align_buffer (SIZE_RGB_FRAME)) == NULL) + return (-1); + } xv_init_ok=1; @@ -266,6 +293,11 @@ pre = (ptr->tag & TC_POST_S_PROCESS)? 1:0; vid = (ptr->tag & TC_VIDEO)? 1:0; + if( (ptr->tag & TC_PRE_PROCESS) && vid) { + process_ctr_cur = (process_ctr_cur+1)%3; + memcpy (process_buffer[process_ctr_cur], ptr->video_buf, ptr->video_size); + return 0; + } if(pre && vid) { if(preview_skip && (ptr->id % preview_skip_num)) return(0); @@ -338,70 +370,101 @@ { int current,i; - int this_filter = plugin_find_id("pv"); + static int this_filter = -1; + static vframe_list_t *ptr = NULL; + vob_t *vob = tc_get_vob(); + + if (ptr == NULL) + ptr = malloc (sizeof (vframe_list_t)); + memset (ptr, 0, sizeof (vframe_list_t)); if (!cache_enabled) return 0; - for (current = frames_needed, i = 1; current > 0; current--, i++){ + if (this_filter == -1); + this_filter = plugin_find_id("pv"); - vframe_list_t ptr; + for (current = frames_needed, i = 1; current > 0; current--, i++){ +#undef NO_PROCESS +#ifdef NO_PROCESS memcpy (run_buffer[0], (char *)vid_buf[cache_ptr-(current-1)], size); memcpy (run_buffer[1], (char *)vid_buf[cache_ptr-(current-1)], size); +#else + memcpy (run_buffer[0], process_buffer[(process_ctr_cur+1)%3], SIZE_RGB_FRAME); + memcpy (run_buffer[1], process_buffer[(process_ctr_cur+1)%3], SIZE_RGB_FRAME); +#endif - if (i == 1) + if (i == 1) { memcpy (undo_buffer, (char *)vid_buf[cache_ptr], size); + } - ptr.bufid = 1; - ptr.next = &ptr; - ptr.tag= TC_VIDEO | TC_POST_M_PROCESS | TC_PRE_M_PROCESS | - TC_POST_S_PROCESS | TC_PRE_S_PROCESS; + ptr->bufid = 1; + ptr->next = ptr; - ptr.filter_id = 0; - ptr.v_codec = CODEC_YUV; - ptr.id = i; // frame - ptr.internal_video_buf_0 = run_buffer[0]; - ptr.internal_video_buf_1 = run_buffer[1]; + ptr->filter_id = 0; + ptr->v_codec = CODEC_YUV; + ptr->id = i; // frame + ptr->internal_video_buf_0 = run_buffer[0]; + ptr->internal_video_buf_1 = run_buffer[1]; // RGB - ptr.video_buf_RGB[0]=ptr.internal_video_buf_0; - ptr.video_buf_RGB[1]=ptr.internal_video_buf_1; + ptr->video_buf_RGB[0]=ptr->internal_video_buf_0; + ptr->video_buf_RGB[1]=ptr->internal_video_buf_1; //YUV - ptr.video_buf_Y[0] = ptr.internal_video_buf_0; - ptr.video_buf_Y[1] = ptr.internal_video_buf_1; + ptr->video_buf_Y[0] = ptr->internal_video_buf_0; + ptr->video_buf_Y[1] = ptr->internal_video_buf_1; - ptr.video_buf_U[0] = ptr.video_buf_Y[0] + ptr->video_buf_U[0] = ptr->video_buf_Y[0] + TC_MAX_V_FRAME_WIDTH * TC_MAX_V_FRAME_HEIGHT; - ptr.video_buf_U[1] = ptr.video_buf_Y[1] + ptr->video_buf_U[1] = ptr->video_buf_Y[1] + TC_MAX_V_FRAME_WIDTH * TC_MAX_V_FRAME_HEIGHT; - ptr.video_buf_V[0] = ptr.video_buf_U[0] + ptr->video_buf_V[0] = ptr->video_buf_U[0] + (TC_MAX_V_FRAME_WIDTH * TC_MAX_V_FRAME_HEIGHT)/4; - ptr.video_buf_V[1] = ptr.video_buf_U[1] + ptr->video_buf_V[1] = ptr->video_buf_U[1] + (TC_MAX_V_FRAME_WIDTH * TC_MAX_V_FRAME_HEIGHT)/4; //default pointer - ptr.video_buf = ptr.internal_video_buf_0; - ptr.video_buf2 = ptr.internal_video_buf_1; - ptr.free = 1; - - ptr.video_size = size; - ptr.v_width = w; - ptr.v_height = h; - + ptr->video_buf = ptr->internal_video_buf_0; + ptr->video_buf2 = ptr->internal_video_buf_1; + ptr->free = 1; + +#ifdef NO_PROCESS + ptr->video_size = size; + ptr->v_width = w; + ptr->v_height = h; +#else + ptr->v_width = vob->im_v_width; + ptr->v_height = vob->im_v_height; + ptr->video_size = vob->im_v_width*vob->im_v_height*3/2; +#endif // we disable this filter (filter_pv), because it does not make sense // to be run in the preview loop plugin_disable_id (this_filter); - process_vid_plugins (&ptr); + + // PRE + ptr->tag= TC_VIDEO | TC_PRE_S_PROCESS | TC_PRE_M_PROCESS; + process_vid_plugins (ptr); + + // CORE + process_vid_frame(vob, ptr); + + // POST + ptr->tag= TC_VIDEO | TC_POST_S_PROCESS | TC_POST_M_PROCESS; + process_vid_plugins (ptr); + plugin_enable_id (this_filter); - memcpy (vid_buf[cache_ptr-current+1], ptr.video_buf, size); + memcpy (vid_buf[cache_ptr-current+1], ptr->video_buf, size); preview_cache_draw(0); + + memcpy ((char *)vid_buf[cache_ptr], undo_buffer, size); } return 0; } +#if 0 void preview_filter(void) { FILE *f; @@ -573,6 +636,8 @@ return; } +#endif + void preview_cache_undo(void) { if (!cache_enabled) return; diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/src/video_rgb.c transcode-0.6.3/src/video_rgb.c --- orig-transcode-0.6.3/src/video_rgb.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/src/video_rgb.c Sun Feb 2 00:32:50 2003 @@ -1142,17 +1142,11 @@ free(tbuf_DI[id].tmpBuffer); } -static void rgb_zoom_init_DI(char *image, int width, int height, int new_width, int new_height) +static void rgb_zoom_init_DI(char *image, int width, int height, int new_width, int new_height, int id) { - int id; - vob_t *vob; - //get thread id: - - id=get_fthread_id(1); - tbuf_DI[id].tmpBuffer = (pixel_t*)malloc(new_width*new_height*3); zoom_setup_image(&tbuf_DI[id].srcImage, width, height, 3, image); @@ -1177,7 +1171,7 @@ if (tbuf_DI[id].zoomer == NULL) - rgb_zoom_init_DI(image, width, height, new_width, new_height); + rgb_zoom_init_DI(image, width, height, new_width, new_height, id); tbuf_DI[id].srcImage.data = image; tbuf_DI[id].dstImage.data = tbuf_DI[id].tmpBuffer; diff -Nur -X dontdiff -x tcmplex orig-transcode-0.6.3/src/video_yuv.c transcode-0.6.3/src/video_yuv.c --- orig-transcode-0.6.3/src/video_yuv.c Sun Feb 2 12:28:59 2003 +++ transcode-0.6.3/src/video_yuv.c Sun Feb 2 00:32:25 2003 @@ -1524,8 +1524,13 @@ id=get_fthread_id(0); - zoom_image_done(tbuf[id].zoomerY); - zoom_image_done(tbuf[id].zoomerUV); + if (tbuf[id].zoomerY) + zoom_image_done(tbuf[id].zoomerY); + tbuf[id].zoomerY = NULL; + + if (tbuf[id].zoomerUV) + zoom_image_done(tbuf[id].zoomerUV); + tbuf[id].zoomerUV = NULL; // free(tbuf[id].tmpBuffer); } @@ -1602,23 +1607,25 @@ id=get_fthread_id(1); - zoom_image_done(tbuf_DI[id].zoomerY); - zoom_image_done(tbuf_DI[id].zoomerUV); - free(tbuf_DI[id].tmpBuffer); + if (tbuf_DI[id].zoomerY) + zoom_image_done(tbuf_DI[id].zoomerY); + tbuf_DI[id].zoomerY = NULL; + + if (tbuf_DI[id].zoomerUV) + zoom_image_done(tbuf_DI[id].zoomerUV); + tbuf_DI[id].zoomerUV = NULL; + + if (tbuf_DI[id].tmpBuffer) + free(tbuf_DI[id].tmpBuffer); + tbuf_DI[id].tmpBuffer = NULL; } -static void yuv_zoom_init_DI(char *image, int width, int height, int new_width, int new_height) +static void yuv_zoom_init_DI(char *image, int width, int height, int new_width, int new_height, int id) { - int id; - vob_t *vob; - //get thread id: - - id=get_fthread_id(1); - tbuf_DI[id].tmpBuffer = (pixel_t*) malloc(new_width*new_height + (new_width*new_height)/2); if(tbuf_DI[id].tmpBuffer==NULL) tc_error("out of memory\n"); @@ -1647,7 +1654,7 @@ id=get_fthread_id(1); if (tbuf_DI[id].zoomerY == NULL) - yuv_zoom_init_DI(image, width, height, new_width, new_height); + yuv_zoom_init_DI(image, width, height, new_width, new_height, id); tbuf_DI[id].srcImageY.data = image; tbuf_DI[id].dstImageY.data = tbuf_DI[id].tmpBuffer;