diff options
Diffstat (limited to 'src/post')
44 files changed, 935 insertions, 935 deletions
diff --git a/src/post/audio/audio_filters.c b/src/post/audio/audio_filters.c index 448353b52..78f495ca6 100644 --- a/src/post/audio/audio_filters.c +++ b/src/post/audio/audio_filters.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -38,7 +38,7 @@ static const post_info_t volnorm_special_info = { XINE_POST_TYPE_AUDIO_FILTER const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 10, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, { PLUGIN_POST, 10, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, { PLUGIN_POST, 10, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, diff --git a/src/post/audio/audio_filters.h b/src/post/audio/audio_filters.h index 8a0202751..144e85836 100644 --- a/src/post/audio/audio_filters.h +++ b/src/post/audio/audio_filters.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/post/audio/dsp.h b/src/post/audio/dsp.h index 237640283..8dabe4f36 100644 --- a/src/post/audio/dsp.h +++ b/src/post/audio/dsp.h @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -9,7 +9,7 @@ */ #ifndef _DSP_H -#define _DSP_H 1 +#define _DSP_H 1 /* Implementation of routines used for DSP */ diff --git a/src/post/audio/filter.c b/src/post/audio/filter.c index 55d75e1e4..f41d880fc 100644 --- a/src/post/audio/filter.c +++ b/src/post/audio/filter.c @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -25,12 +25,12 @@ * * n number of filter taps, where mod(n,4)==0 * w filter taps - * x input signal must be a circular buffer which is indexed backwards + * x input signal must be a circular buffer which is indexed backwards */ inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x) { register _ftype_t y; /* Output */ - y = 0.0; + y = 0.0; do{ n--; y+=w[n]*x[n]; @@ -44,7 +44,7 @@ inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x) * d number of filters * xi current index in xq * w filter taps k by n big - * x input signal must be a circular buffers which are indexed backwards + * x input signal must be a circular buffers which are indexed backwards * y output buffer * s output buffer stride */ @@ -67,11 +67,11 @@ inline _ftype_t* pfir(unsigned int n, unsigned int d, unsigned int xi, _ftype_t* at the new samples, xi current index in xq and n the length of the filter. xq must be n*2 by k big, s is the index for in. */ -inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s) +inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s) { register _ftype_t* txq = *xq + xi; register int nt = n*2; - + while(d-- >0){ *txq= *(txq+n) = *in; txq+=nt; @@ -88,26 +88,26 @@ inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** n filter length must be odd for HP and BS filters w buffer for the filter taps (must be n long) - fc cutoff frequencies (1 for LP and HP, 2 for BP and BS) + fc cutoff frequencies (1 for LP and HP, 2 for BP and BS) 0 < fc < 1 where 1 <=> Fs/2 flags window and filter type as defined in filter.h - variables are ored together: i.e. LP|HAMMING will give a - low pass filter designed using a hamming window + variables are ored together: i.e. LP|HAMMING will give a + low pass filter designed using a hamming window opt beta constant used only when designing using kaiser windows - + returns 0 if OK, -1 if fail */ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt) { - unsigned int o = n & 1; /* Indicator for odd filter length */ + unsigned int o = n & 1; /* Indicator for odd filter length */ unsigned int end = ((n + 1) >> 1) - o; /* Loop end */ unsigned int i; /* Loop index */ _ftype_t k1 = 2 * M_PI; /* 2*pi*fc1 */ _ftype_t k2 = 0.5 * (_ftype_t)(1 - o);/* Constant used if the filter has even length */ _ftype_t k3; /* 2*pi*fc2 Constant used in BP and BS design */ - _ftype_t g = 0.0; /* Gain */ - _ftype_t t1,t2,t3; /* Temporary variables */ + _ftype_t g = 0.0; /* Gain */ + _ftype_t t1,t2,t3; /* Temporary variables */ _ftype_t fc1,fc2; /* Cutoff frequencies */ /* Sanity check */ @@ -130,10 +130,10 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f case(KAISER): kaiser(n,w,opt); break; default: - return -1; + return -1; } - if(flags & (LP | HP)){ + if(flags & (LP | HP)){ fc1=*fc; /* Cutoff frequency must be < 0.5 where 0.5 <=> Fs/2 */ fc1 = ((fc1 <= 1.0) && (fc1 > 0.0)) ? fc1/2 : 0.25; @@ -143,7 +143,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f /* * If the filter length is odd, there is one point which is exactly - * in the middle. The value at this point is 2*fCutoff*sin(x)/x, + * in the middle. The value at this point is 2*fCutoff*sin(x)/x, * where x is zero. To make sure nothing strange happens, we set this * value separately. */ @@ -196,9 +196,9 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f t2 = sin(k3 * t1)/(M_PI * t1); /* Sinc fc2 */ t3 = sin(k1 * t1)/(M_PI * t1); /* Sinc fc1 */ g += w[end-i-1] * (t3 + t2); /* Total gain in filter */ - w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); + w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); } - } + } else{ /* Band stop */ if (!o) /* Band stop filters must have odd length */ return -1; @@ -210,7 +210,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f t1 = (_ftype_t)(i+1); t2 = sin(k1 * t1)/(M_PI * t1); /* Sinc fc1 */ t3 = sin(k3 * t1)/(M_PI * t1); /* Sinc fc2 */ - w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); + w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); g += 2*w[end-i-1]; /* Total gain in filter */ } } @@ -218,9 +218,9 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f /* Normalize gain */ g=1/g; - for (i=0; i<n; i++) + for (i=0; i<n; i++) w[i] *= g; - + return 0; } @@ -229,7 +229,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f * n length of prototype filter * k number of polyphase components * w prototype filter taps - * pw Parallel FIR filter + * pw Parallel FIR filter * g Filter gain * flags FWD forward indexing * REW reverse indexing @@ -240,10 +240,10 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags) { int l = (int)n/k; /* Length of individual FIR filters */ - int i; /* Counters */ + int i; /* Counters */ int j; _ftype_t t; /* g * w[i] */ - + /* Sanity check */ if(l<1 || k<1 || !w || !pw) return -1; @@ -276,7 +276,7 @@ int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _fty /* Pre-warp the coefficients of a numerator or denominator. * Note that a0 is assumed to be 1, so there is no wrapping - * of it. + * of it. */ void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs) { @@ -303,12 +303,12 @@ void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs) * Arguments: * a - s-domain numerator coefficients * b - s-domain denominator coefficients - * k - filter gain factor. Initially set to 1 and modified by each + * k - filter gain factor. Initially set to 1 and modified by each * biquad section in such a way, as to make it the * coefficient by which to multiply the overall filter gain * in order to achieve a desired overall filter gain, - * specified in initial value of k. - * fs - sampling rate (Hz) + * specified in initial value of k. + * fs - sampling rate (Hz) * coef - array of z-domain coefficients to be filled in. * * Return: On return, set coef z-domain coefficients and k to the gain @@ -342,7 +342,7 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef * create a filter fill in a, b, Q and fs and make space for coef and k. * * - * Example Butterworth design: + * Example Butterworth design: * * Below are Butterworth polynomials, arranged as a series of 2nd * order sections: @@ -398,12 +398,12 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef * a - s-domain numerator coefficients, a[1] is always assumed to be 1.0 * b - s-domain denominator coefficients * Q - Q value for the filter - * k - filter gain factor. Initially set to 1 and modified by each + * k - filter gain factor. Initially set to 1 and modified by each * biquad section in such a way, as to make it the * coefficient by which to multiply the overall filter gain * in order to achieve a desired overall filter gain, - * specified in initial value of k. - * fs - sampling rate (Hz) + * specified in initial value of k. + * fs - sampling rate (Hz) * coef - array of z-domain coefficients to be filled in. * * Note: Upon return from each call, the k argument will be set to a @@ -419,7 +419,7 @@ int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftyp _ftype_t at[3]; _ftype_t bt[3]; - if(!a || !b || !k || !coef || (Q>1000.0 || Q< 1.0)) + if(!a || !b || !k || !coef || (Q>1000.0 || Q< 1.0)) return -1; memcpy(at,a,3*sizeof(_ftype_t)); diff --git a/src/post/audio/filter.h b/src/post/audio/filter.h index 0e08aa2b9..4d756a618 100644 --- a/src/post/audio/filter.h +++ b/src/post/audio/filter.h @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -37,7 +37,7 @@ #define WINDOW_MASK 0x0000001F /* Parallel filter design */ -#define FWD 0x00000001 /* Forward indexing of polyphase filter */ +#define FWD 0x00000001 /* Forward indexing of polyphase filter */ #define REW 0x00000002 /* Reverse indexing of polyphase filter */ #define ODD 0x00000010 /* Make filter HP */ @@ -60,7 +60,7 @@ extern int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc /* Add new data to circular queue designed to be used with a FIR * filter. xq is the circular queue, in pointing at the new sample, xi * current index for xq and n the length of the filter. xq must be n*2 - * long. + * long. */ #define updateq(n,xi,xq,in)\ xq[xi]=(xq)[(xi)+(n)]=*(in);\ diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c index 36ac18dd6..7397844b4 100644 --- a/src/post/audio/stretch.c +++ b/src/post/audio/stretch.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -70,19 +70,19 @@ static void stretchscr_set_pivot (stretchscr_t *this) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; xine_monotonic_clock(&tv, NULL); pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; -/* This next part introduces a one off inaccuracy - * to the scr due to rounding tv to pts. +/* This next part introduces a one off inaccuracy + * to the scr due to rounding tv to pts. */ this->cur_time.tv_sec=tv.tv_sec; this->cur_time.tv_usec=tv.tv_usec; - this->cur_pts=pts; + this->cur_pts=pts; return ; } @@ -94,7 +94,7 @@ static int stretchscr_set_speed (scr_plugin_t *scr, int speed) { stretchscr_set_pivot( this ); this->xine_speed = speed; - this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL / + this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL / (*this->stretch_factor); pthread_mutex_unlock (&this->lock); @@ -125,7 +125,7 @@ static void stretchscr_start (scr_plugin_t *scr, int64_t start_vpts) { this->cur_pts = start_vpts; pthread_mutex_unlock (&this->lock); - + stretchscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL); } @@ -134,16 +134,16 @@ static int64_t stretchscr_get_current (scr_plugin_t *scr) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; pthread_mutex_lock (&this->lock); xine_monotonic_clock(&tv, NULL); - + pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; - + pthread_mutex_unlock (&this->lock); return pts; @@ -168,9 +168,9 @@ static stretchscr_t *XINE_MALLOC stretchscr_init (double *stretch_factor) { this->scr.start = stretchscr_start; this->scr.get_current = stretchscr_get_current; this->scr.exit = stretchscr_exit; - + pthread_mutex_init (&this->lock, NULL); - + this->stretch_factor = stretch_factor; stretchscr_set_speed (&this->scr, XINE_SPEED_PAUSE); @@ -202,21 +202,21 @@ typedef struct stretch_parameters_s { START_PARAM_DESCR( stretch_parameters_t ) PARAM_ITEM( POST_PARAM_TYPE_BOOL, preserve_pitch, NULL, 0, 1, 0, "Preserve pitch" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, factor, NULL, 0.5, 1.5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, factor, NULL, 0.5, 1.5, 0, "Time stretch factor (<1.0 shorten duration)" ) END_PARAM_DESCR( param_descr ) /* plugin structure */ struct post_plugin_stretch_s { post_plugin_t post; - + stretchscr_t* scr; /* private data */ stretch_parameters_t params; xine_post_in_t params_input; int params_changed; - + int channels; int bytes_per_frame; @@ -228,9 +228,9 @@ struct post_plugin_stretch_s { int num_frames; /* current # of frames on audiofrag */ int16_t last_sample[RESAMPLE_MAX_CHANNELS]; - + int64_t pts; /* pts for audiofrag */ - + pthread_mutex_t lock; }; @@ -290,16 +290,16 @@ static int stretch_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post; int64_t time; - + _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - - /* register our own scr provider */ + + /* register our own scr provider */ time = port->stream->xine->clock->get_current_time(port->stream->xine->clock); this->scr = stretchscr_init(&this->params.factor); this->scr->scr.start(&this->scr->scr, time); @@ -307,7 +307,7 @@ static int stretch_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, /* force updating on stretch_port_put_buffer */ this->params_changed = 1; - + return (port->original_port->open) (port->original_port, stream, bits, rate, mode); } @@ -320,34 +320,34 @@ static void stretch_port_close(xine_audio_port_t *port_gen, xine_stream_t *strea port->stream->xine->clock->unregister_scr(port->stream->xine->clock, &this->scr->scr); this->scr->scr.exit(&this->scr->scr); } - + if(this->audiofrag) { free(this->audiofrag); this->audiofrag = NULL; } - + if(this->outfrag) { free(this->outfrag); this->outfrag = NULL; } - + if(this->w) { free(this->w); this->w = NULL; } - + port->stream = NULL; port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void stretch_process_fragment( post_audio_port_t *port, +static void stretch_process_fragment( post_audio_port_t *port, xine_stream_t *stream, extra_info_t *extra_info ) { post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post; - + audio_buffer_t *outbuf; int16_t *data_out = this->outfrag; int num_frames_in = this->num_frames; @@ -374,52 +374,52 @@ static void stretch_process_fragment( post_audio_port_t *port, * input chunk has two halves, A and B. * output chunk is composed as follow: * - some frames copied directly from A - * - some frames copied from A merged with frames from B + * - some frames copied from A merged with frames from B * weighted by an increasing factor (0 -> 1.0) * - frames from A weighted by a decreasing factor (1.0 -> 0) * merged with frames copied from B * - some frames copied directly from B */ - + int merge_frames = num_frames_in - num_frames_out; int copy_frames; int16_t *src = this->audiofrag; int16_t *dst = this->outfrag; int i, j; - + if( merge_frames > num_frames_out ) merge_frames = num_frames_out; copy_frames = num_frames_out - merge_frames; - + memcpy(dst, src, copy_frames/2 * this->bytes_per_frame); dst += copy_frames/2 * this->channels; src += copy_frames/2 * this->channels; - + for( i = 0; i < merge_frames/2; i++ ) { for( j = 0; j < this->channels; j++, src++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) src[0] + src[merge_frames * this->channels] * this->w[i]); *dst = CLIP_INT16(s); } } - + for( ; i < merge_frames; i++ ) { for( j = 0; j < this->channels; j++, src++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) src[0] * this->w[i] + src[merge_frames * this->channels]); *dst = CLIP_INT16(s); } } - + src += merge_frames * this->channels; - + memcpy(dst, src, (copy_frames - copy_frames/2) * this->bytes_per_frame); - + } else { /* * time expansion strategy @@ -427,13 +427,13 @@ static void stretch_process_fragment( post_audio_port_t *port, * output chunk is composed of two versions of the * input chunk: * - first part copied directly from input, and then - * merged with the second (delayed) part using a + * merged with the second (delayed) part using a * decreasing factor (1.0 -> 0) * - the delayed version of the input is merged with - * an increasing factor (0 -> 1.0) and then (when - * factor reaches 1.0) just copied until the end. + * an increasing factor (0 -> 1.0) and then (when + * factor reaches 1.0) just copied until the end. */ - + int merge_frames = num_frames_out - num_frames_in; int copy_frames = num_frames_out - merge_frames; int16_t *src1 = this->audiofrag; @@ -449,67 +449,67 @@ static void stretch_process_fragment( post_audio_port_t *port, for( i = 0; i < merge_frames/2; i++ ) { for( j = 0; j < this->channels; j++, src1++, src2++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) *src1 + *src2 * this->w[i]); *dst = CLIP_INT16(s); } } - + for( ; i < merge_frames; i++ ) { for( j = 0; j < this->channels; j++, src1++, src2++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) *src1 * this->w[i] + *src2); *dst = CLIP_INT16(s); } } - + memcpy(dst, src2, (copy_frames - copy_frames/2) * this->bytes_per_frame); } } - + /* copy processed fragment into multiple audio buffers, if needed */ while( num_frames_out ) { - outbuf = port->original_port->get_buffer(port->original_port); - + outbuf = port->original_port->get_buffer(port->original_port); + outbuf->num_frames = outbuf->mem_size / this->bytes_per_frame; if( outbuf->num_frames > num_frames_out ) outbuf->num_frames = num_frames_out; - - memcpy( outbuf->mem, data_out, + + memcpy( outbuf->mem, data_out, outbuf->num_frames * this->bytes_per_frame ); num_frames_out -= outbuf->num_frames; data_out = (uint16_t *)((uint8_t *)data_out + outbuf->num_frames * this->bytes_per_frame); - + outbuf->vpts = this->pts; this->pts = 0; outbuf->stream = stream; outbuf->format.bits = port->bits; outbuf->format.rate = port->rate; outbuf->format.mode = port->mode; - + _x_extra_info_merge( outbuf->extra_info, extra_info ); - - port->original_port->put_buffer(port->original_port, outbuf, stream ); + + port->original_port->put_buffer(port->original_port, outbuf, stream ); } - + this->num_frames = 0; } -static void stretch_port_put_buffer (xine_audio_port_t *port_gen, +static void stretch_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post; int16_t *data_in; - + pthread_mutex_lock (&this->lock); - + if( this->params_changed ) { int64_t audio_step; @@ -517,40 +517,40 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen, /* output whatever we have before changing parameters */ stretch_process_fragment( port, stream, buf->extra_info ); } - + this->channels = _x_ao_mode2channels(port->mode); this->bytes_per_frame = port->bits / 8 * this->channels; - + audio_step = ((int64_t)90000 * (int64_t)32768) / (int64_t)port->rate; audio_step = (int64_t) ((double)audio_step / this->params.factor); stream->metronom->set_audio_rate(stream->metronom, audio_step); stretchscr_set_speed(&this->scr->scr, this->scr->xine_speed); - + if(this->audiofrag) { free(this->audiofrag); this->audiofrag = NULL; } - + if(this->outfrag) { free(this->outfrag); this->outfrag = NULL; } - + if(this->w) { free(this->w); this->w = NULL; } - + this->frames_per_frag = port->rate * AUDIO_FRAGMENT; this->frames_per_outfrag = (int) ((double)this->params.factor * this->frames_per_frag); if( this->frames_per_frag != this->frames_per_outfrag ) { int wsize; - - this->audiofrag = malloc( this->frames_per_frag * this->bytes_per_frame ); - this->outfrag = malloc( this->frames_per_outfrag * this->bytes_per_frame ); - + + this->audiofrag = malloc( this->frames_per_frag * this->bytes_per_frame ); + this->outfrag = malloc( this->frames_per_outfrag * this->bytes_per_frame ); + if( this->frames_per_frag > this->frames_per_outfrag ) wsize = this->frames_per_frag - this->frames_per_outfrag; else @@ -559,41 +559,41 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen, this->w = (_ftype_t*) malloc( wsize * sizeof(_ftype_t) ); triang(wsize, this->w); } - + this->num_frames = 0; this->pts = 0; - + this->params_changed = 0; } - + pthread_mutex_unlock (&this->lock); /* just pass data through if we have nothing to do */ if( this->frames_per_frag == this->frames_per_outfrag || /* FIXME: we only handle 1 or 2 channels, 16 bits for now */ - (this->channels != 1 && this->channels != 2) || + (this->channels != 1 && this->channels != 2) || port->bits != 16 ) { - - port->original_port->put_buffer(port->original_port, buf, stream ); - + + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } - + /* update pts for our current audio fragment */ if( buf->vpts ) this->pts = buf->vpts - (this->num_frames * 90000 / port->rate); - + data_in = buf->mem; while( buf->num_frames ) { int frames_to_copy = this->frames_per_frag - this->num_frames; - + if( frames_to_copy > buf->num_frames ) frames_to_copy = buf->num_frames; /* copy up to one fragment from input buf to our buffer */ memcpy( (uint8_t *)this->audiofrag + this->num_frames * this->bytes_per_frame, data_in, frames_to_copy * this->bytes_per_frame ); - + data_in = (uint16_t *)((uint8_t *)data_in + frames_to_copy * this->bytes_per_frame); this->num_frames += frames_to_copy; buf->num_frames -= frames_to_copy; @@ -603,10 +603,10 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen, stretch_process_fragment( port, stream, buf->extra_info ); } } - + buf->num_frames=0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } @@ -630,21 +630,21 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_audio_port_t *port; stretch_parameters_t init_params; - + if (!this || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); init_params.preserve_pitch = 1; init_params.factor = 0.80; - + pthread_mutex_init (&this->lock, NULL); set_parameters ((xine_post_t *)&this->post, &init_params); - + port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = stretch_port_open; port->new_port.close = stretch_port_close; @@ -667,16 +667,16 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs, void *stretch_init_plugin(xine_t *xine, void *data) { post_class_stretch_t *class = (post_class_stretch_t *)xine_xmalloc(sizeof(post_class_stretch_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = stretch_open_plugin; class->post_class.identifier = "stretch"; class->post_class.description = N_("Time stretch by a given factor, optionally preserving pitch"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c index 24df657d0..c8f7c0121 100644 --- a/src/post/audio/upmix.c +++ b/src/post/audio/upmix.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -167,13 +167,13 @@ static int upmix_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; capabilities = port->original_port->get_capabilities(port->original_port); - + this->channels = _x_ao_mode2channels(mode); /* FIXME: Handle all desired output formats */ if ((capabilities & AO_CAP_MODE_5_1CHANNEL) && (capabilities & AO_CAP_FLOAT32)) { @@ -232,7 +232,7 @@ static int upmix_frames_2to51_any_to_float( uint8_t *dst8, uint8_t *src8, int nu float right; float sum; int frame; - int src_units_per_sample=1; + int src_units_per_sample=1; if (step_channel_in == 3) src_units_per_sample=step_channel_in; /* Special handling for 24 bit 3byte input */ for (frame=0;frame < num_frames; frame++) { @@ -297,9 +297,9 @@ static int upmix_frames_2to51_any_to_float( uint8_t *dst8, uint8_t *src8, int nu return frame; } -static void upmix_port_put_buffer (xine_audio_port_t *port_gen, +static void upmix_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_upmix_t *this = (post_plugin_upmix_t *)port->post; int src_step_frame; @@ -315,7 +315,7 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen, if ((this->channels==2) && (this->channels_out==6)) { while (num_frames_processed < buf->num_frames) { - this->buf = port->original_port->get_buffer(port->original_port); + this->buf = port->original_port->get_buffer(port->original_port); /* this->buf->num_frames is handled after the upmix */ this->buf->vpts = buf->vpts; if (num_frames_processed != 0) this->buf->vpts = 0; @@ -327,7 +327,7 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen, this->buf->format.bits = 32; /* Upmix to floats */ this->buf->format.rate = port->rate; this->buf->format.mode = AO_CAP_MODE_5_1CHANNEL; - _x_extra_info_merge( this->buf->extra_info, buf->extra_info); + _x_extra_info_merge( this->buf->extra_info, buf->extra_info); step_channel_in = port->bits>>3; step_channel_out = this->buf->format.bits>>3; dst_step_frame = this->channels_out*step_channel_out; @@ -353,18 +353,18 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen, } } pthread_mutex_unlock (&this->lock); - + num_frames_done = upmix_frames_2to51_any_to_float(data8dst, data8src, num_frames, step_channel_in, this->sub); this->buf->num_frames = num_frames_done; num_frames_processed+= num_frames_done; /* pass data to original port */ - port->original_port->put_buffer(port->original_port, this->buf, stream ); + port->original_port->put_buffer(port->original_port, this->buf, stream ); } /* free data from origial buffer */ buf->num_frames=0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ } - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } @@ -388,16 +388,16 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; xine_post_in_t *input_api; post_audio_port_t *port; - + if (!this || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); this->params.cut_off_freq = 100; - + port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = upmix_port_open; #if 0 @@ -422,16 +422,16 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs, void *upmix_init_plugin(xine_t *xine, void *data) { post_class_upmix_t *class = (post_class_upmix_t *)xine_xmalloc(sizeof(post_class_upmix_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = upmix_open_plugin; class->post_class.identifier = "upmix"; class->post_class.description = N_("upmix"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c index c59638be4..499856e69 100644 --- a/src/post/audio/upmix_mono.c +++ b/src/post/audio/upmix_mono.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -68,11 +68,11 @@ struct post_plugin_upmix_mono_s { /* private data */ int channels; - + upmix_mono_parameters_t params; xine_post_in_t params_input; int params_changed; - + pthread_mutex_t lock; }; @@ -134,7 +134,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; @@ -142,7 +142,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre this->channels = _x_ao_mode2channels(mode); capabilities = port->original_port->get_capabilities(port->original_port); - + if (this->channels == 1 && (capabilities & AO_CAP_MODE_STEREO)) { xprintf(stream->xine, XINE_VERBOSITY_LOG, _(LOG_MODULE ": upmixing Mono to Stereo.\n")); @@ -151,7 +151,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre if ( this->channels != 1) xprintf(stream->xine, XINE_VERBOSITY_LOG, ngettext(LOG_MODULE ": upmixing a single channel from original %d channel stream.\n", - LOG_MODULE ": upmixing a single channel from original %d channels stream.\n", + LOG_MODULE ": upmixing a single channel from original %d channels stream.\n", this->channels), this->channels); else { xprintf(stream->xine, XINE_VERBOSITY_LOG, @@ -163,15 +163,15 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre return (port->original_port->open) (port->original_port, stream, bits, rate, mode); } -static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, +static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_upmix_mono_t *this = (post_plugin_upmix_mono_t *)port->post; - + pthread_mutex_lock (&this->lock); - if (this->channels == 1) + if (this->channels == 1) { audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port); audio_buffer_t *buf1 = port->original_port->get_buffer(port->original_port); @@ -232,7 +232,7 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, /* free data from origial buffer */ buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ } - else if (this->channels && this->params.channel >= 0) + else if (this->channels && this->params.channel >= 0) { audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port); buf0->num_frames = buf->num_frames; @@ -253,12 +253,12 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, uint8_t *dst0 = (uint8_t *)buf0->mem; int cur_channel = this->params.channel; int i, j; - + if( cur_channel >= this->channels ) cur_channel = this->channels-1; src += cur_channel * step; - + for (i = 0; i < buf->num_frames; i++) { for (j = 0; j < this->channels; j++ ) @@ -276,11 +276,11 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, /* free data from origial buffer */ buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ } - + pthread_mutex_unlock (&this->lock); - + port->original_port->put_buffer(port->original_port, buf, stream); - + return; } @@ -303,24 +303,24 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs xine_post_in_t *input_api; post_audio_port_t *port; upmix_mono_parameters_t init_params; - + if (!this || !audio_target || !audio_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); init_params.channel = -1; - + pthread_mutex_init (&this->lock, NULL); set_parameters ((xine_post_t *)&this->post, &init_params); - + port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = upmix_mono_port_open; port->new_port.put_buffer = upmix_mono_port_put_buffer; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -337,17 +337,17 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs void *upmix_mono_init_plugin(xine_t *xine, void *data) { post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)xine_xmalloc(sizeof(post_class_upmix_mono_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = upmix_mono_open_plugin; class->post_class.identifier = "upmix_mono"; class->post_class.description = N_("converts Mono into Stereo"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c index e473d6a09..dda38fa5f 100644 --- a/src/post/audio/volnorm.c +++ b/src/post/audio/volnorm.c @@ -1,24 +1,24 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Volume normalization audio filter for xine. Ported by Jason Tackaberry - * from MPlayer's af_volnorm, which is copyright 2004 by Alex Beregszaszi + * from MPlayer's af_volnorm, which is copyright 2004 by Alex Beregszaszi * & Pierre Lombard. */ @@ -117,7 +117,7 @@ struct post_plugin_volnorm_s { /************************************************************************** * volnorm parameters functions *************************************************************************/ -static int set_parameters (xine_post_t *this_gen, void *param_gen) +static int set_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)this_gen; volnorm_parameters_t *param = (volnorm_parameters_t *)param_gen; @@ -129,7 +129,7 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) return 1; } -static int get_parameters (xine_post_t *this_gen, void *param_gen) +static int get_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)this_gen; volnorm_parameters_t *param = (volnorm_parameters_t *)param_gen; @@ -141,12 +141,12 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) return 1; } -static xine_post_api_descr_t * get_param_descr (void) +static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } -static char * get_help (void) +static char * get_help (void) { return _("Normalizes audio by maximizing the volume without distorting " "the sound.\n" @@ -172,14 +172,14 @@ static xine_post_api_t post_api = { *************************************************************************/ static int volnorm_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, - uint32_t bits, uint32_t rate, int mode) + uint32_t bits, uint32_t rate, int mode) { post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)port->post; _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; @@ -373,10 +373,10 @@ static void method2_float(post_plugin_volnorm_t *this, audio_buffer_t *buf) } -static void volnorm_port_put_buffer (xine_audio_port_t *port_gen, - audio_buffer_t *buf, xine_stream_t *stream) +static void volnorm_port_put_buffer (xine_audio_port_t *port_gen, + audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)port->post; @@ -391,8 +391,8 @@ static void volnorm_port_put_buffer (xine_audio_port_t *port_gen, else if (buf->format.bits == 32) method2_float(this, buf); } - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } @@ -416,12 +416,12 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; xine_post_in_t *input_api; post_audio_port_t *port; - + if (!this || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); pthread_mutex_init (&this->lock, NULL); @@ -453,16 +453,16 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs, void *volnorm_init_plugin(xine_t *xine, void *data) { post_class_volnorm_t *class = (post_class_volnorm_t *)xine_xmalloc(sizeof(post_class_volnorm_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = volnorm_open_plugin; class->post_class.identifier = "volnorm"; class->post_class.description = N_("Normalize volume"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/window.c b/src/post/audio/window.c index fdea90590..ca58152d5 100644 --- a/src/post/audio/window.c +++ b/src/post/audio/window.c @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -39,7 +39,7 @@ void boxcar(int n, _ftype_t* w) /* * Triang a.k.a Bartlett * - * | (N-1)| + * | (N-1)| * 2 * |k - -----| * | 2 | * w = 1.0 - --------------- @@ -53,7 +53,7 @@ void triang(int n, _ftype_t* w) _ftype_t k2 = 1/((_ftype_t)n + k1); int end = (n + 1) >> 1; int i; - + /* Calculate window coefficients */ for (i=0 ; i<end ; i++) w[i] = w[n-i-1] = (2.0*((_ftype_t)(i+1))-(1.0-k1))*k2; @@ -72,7 +72,7 @@ void hanning(int n, _ftype_t* w) { int i; _ftype_t k = 2*M_PI/((_ftype_t)(n+1)); /* 2*pi/(N+1) */ - + /* Calculate window coefficients */ for (i=0; i<n; i++) *w++ = 0.5*(1.0 - cos(k*(_ftype_t)(i+1))); @@ -131,22 +131,22 @@ void flattop(int n,_ftype_t* w) int i; _ftype_t k1 = 2*M_PI/((_ftype_t)(n-1)); /* 2*pi/(N-1) */ _ftype_t k2 = 2*k1; /* 4*pi/(N-1) */ - + /* Calculate window coefficients */ for (i=0; i<n; i++) *w++ = 0.2810638602 - 0.5208971735*cos(k1*(_ftype_t)i) + 0.1980389663*cos(k2*(_ftype_t)i); } -/* Computes the 0th order modified Bessel function of the first kind. - * (Needed to compute Kaiser window) - * +/* Computes the 0th order modified Bessel function of the first kind. + * (Needed to compute Kaiser window) + * * y = sum( (x/(2*n))^2 ) * n */ #define BIZ_EPSILON 1E-21 /* Max error acceptable */ static _ftype_t besselizero(_ftype_t x) -{ +{ _ftype_t temp; _ftype_t sum = 1.0; _ftype_t u = 1.0; @@ -175,10 +175,10 @@ static _ftype_t besselizero(_ftype_t x) * Gold (Theory and Application of DSP) under Kaiser windows for more * about Beta. The following table from Rabiner and Gold gives some * feel for the effect of Beta: - * + * * All ripples in dB, width of transition band = D*N where N = window * length - * + * * BETA D PB RIP SB RIP * 2.120 1.50 +-0.27 -30 * 3.384 2.23 0.0864 -40 @@ -195,8 +195,8 @@ void kaiser(int n, _ftype_t* w, _ftype_t b) _ftype_t k1 = 1.0/besselizero(b); int k2 = 1 - (n & 1); int end = (n + 1) >> 1; - int i; - + int i; + /* Calculate window coefficients */ for (i=0 ; i<end ; i++){ tmp = (_ftype_t)(2*i + k2) / ((_ftype_t)n - 1.0); diff --git a/src/post/audio/window.h b/src/post/audio/window.h index d0a7446eb..638707809 100644 --- a/src/post/audio/window.h +++ b/src/post/audio/window.h @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * diff --git a/src/post/deinterlace/Makefile.am b/src/post/deinterlace/Makefile.am index 54ab83572..fa2ad85fd 100644 --- a/src/post/deinterlace/Makefile.am +++ b/src/post/deinterlace/Makefile.am @@ -9,7 +9,7 @@ SUBDIRS = plugins xinepost_LTLIBRARIES = xineplug_post_tvtime.la xineplug_post_tvtime_la_SOURCES = xine_plugin.c \ - deinterlace.c pulldown.c speedy.c tvtime.c + deinterlace.c pulldown.c speedy.c tvtime.c xineplug_post_tvtime_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(PTHREAD_LIBS) \ $(top_builddir)/src/post/deinterlace/plugins/libdeinterlaceplugins.la diff --git a/src/post/deinterlace/plugins/Makefile.am b/src/post/deinterlace/plugins/Makefile.am index 7e3548643..cf6981881 100644 --- a/src/post/deinterlace/plugins/Makefile.am +++ b/src/post/deinterlace/plugins/Makefile.am @@ -37,9 +37,9 @@ noinst_HEADERS = plugins.h greedyhmacros.h if DEBUG_BUILD debug_sources = greedy2frame.c -nodebug_sources = +nodebug_sources = else -debug_sources = +debug_sources = nodebug_sources = greedy2frame.c endif diff --git a/src/post/deinterlace/plugins/greedy.c b/src/post/deinterlace/plugins/greedy.c index 1742f7515..ee401dba6 100644 --- a/src/post/deinterlace/plugins/greedy.c +++ b/src/post/deinterlace/plugins/greedy.c @@ -49,7 +49,7 @@ // upon which give the smaller comb factor, and then clip to avoid large damage // when wrong. // -// I'd intended this to be part of a larger more elaborate method added to +// I'd intended this to be part of a larger more elaborate method added to // Blended Clip but this give too good results for the CPU to ignore here. static void copy_scanline( uint8_t *output, @@ -135,7 +135,7 @@ static void deinterlace_greedy_packed422_scanline_mmxext( uint8_t *output, paddusb_r2r( mm3, mm2 ); // now = Max(L1,L3) pcmpeqb_r2r( mm7, mm7 ); // all ffffffff - psubusb_r2r( mm1, mm7 ); // - L1 + psubusb_r2r( mm1, mm7 ); // - L1 paddusb_r2r( mm7, mm3 ); // add, may sat at fff.. psubusb_r2r( mm7, mm3 ); // now = Min(L1,L3) @@ -147,7 +147,7 @@ static void deinterlace_greedy_packed422_scanline_mmxext( uint8_t *output, paddusb_r2r( mm3, mm4 ); // now = Max(best,Min(L1,L3) pcmpeqb_r2r( mm7, mm7 ); // all ffffffff - psubusb_r2r( mm4, mm7 ); // - Max(best,Min(best,L3) + psubusb_r2r( mm4, mm7 ); // - Max(best,Min(best,L3) paddusb_r2r( mm7, mm2 ); // add may sat at FFF.. psubusb_r2r( mm7, mm2 ); // now = Min( Max(best, Min(L1,L3), L2 )=L2 clipped diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c index 0d9ab6769..1f4df9161 100644 --- a/src/post/deinterlace/plugins/greedy2frame_template.c +++ b/src/post/deinterlace/plugins/greedy2frame_template.c @@ -79,9 +79,9 @@ /**************************************************************************** ** Field 1 | Field 2 | Field 3 | Field 4 | -** T0 | | T1 | | -** | M0 | | M1 | -** B0 | | B1 | | +** T0 | | T1 | | +** | M0 | | M1 | +** B0 | | B1 | | */ @@ -95,13 +95,13 @@ #define MASKS_DEFINED static const int64_t __attribute__((__used__)) YMask = 0x00ff00ff00ff00ffll; static const int64_t __attribute__((__used__)) Mask = 0x7f7f7f7f7f7f7f7fll; - static const int64_t __attribute__((__used__)) DwordOne = 0x0000000100000001ll; - static const int64_t __attribute__((__used__)) DwordTwo = 0x0000000200000002ll; + static const int64_t __attribute__((__used__)) DwordOne = 0x0000000100000001ll; + static const int64_t __attribute__((__used__)) DwordTwo = 0x0000000200000002ll; static int64_t qwGreedyTwoFrameThreshold; #endif #if defined(IS_SSE) -static void DeinterlaceGreedy2Frame_SSE(uint8_t *output, int outstride, +static void DeinterlaceGreedy2Frame_SSE(uint8_t *output, int outstride, deinterlace_frame_data_t *data, int bottom_field, int second_field, int width, int height ) #elif defined(IS_3DNOW) @@ -133,7 +133,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, qwGreedyTwoFrameThreshold = GreedyTwoFrameThreshold; qwGreedyTwoFrameThreshold += (GreedyTwoFrameThreshold2 << 8); qwGreedyTwoFrameThreshold += (qwGreedyTwoFrameThreshold << 48) + - (qwGreedyTwoFrameThreshold << 32) + + (qwGreedyTwoFrameThreshold << 32) + (qwGreedyTwoFrameThreshold << 16); @@ -148,7 +148,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, M0 = data->f1; T0 = data->f2; } - + if( bottom_field ) { M1 += stride; T1 += 0; @@ -192,9 +192,9 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "movq %2, %%mm3 \n\t" // B1 "movq %3, %%mm2 \n\t" // M0 : /* no output */ - : "m" (*T1), "m" (*M1), + : "m" (*T1), "m" (*M1), "m" (*B1), "m" (*M0), "m" (Mask) ); - + asm volatile( /* Figure out what to do with the scanline above the one we just copied. @@ -269,7 +269,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "pcmpgtb %3, %%mm5 \n\t" "pand %%mm6, %%mm5 \n\t" /* get rid of sign bit */ - "pcmpgtd %5, %%mm5 \n\t" + "pcmpgtd %5, %%mm5 \n\t" "pandn %5, %%mm5 \n\t" "paddd %%mm5, %%mm4 \n\t" @@ -305,9 +305,9 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "movq %%mm4, %%mm5 \n\t" /* mm4 now is 1 where we want to weave and 0 where we want to bob */ - "pand %%mm0, %%mm4 \n\t" - "pandn %%mm7, %%mm5 \n\t" - "por %%mm5, %%mm4 \n\t" + "pand %%mm0, %%mm4 \n\t" + "pandn %%mm7, %%mm5 \n\t" + "por %%mm5, %%mm4 \n\t" #ifdef IS_SSE "movntq %%mm4, %0 \n\t" #else @@ -351,9 +351,9 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, } else { - xine_fast_memcpy(Dest, T1, stride); + xine_fast_memcpy(Dest, T1, stride); } - + /* clear out the MMX registers ready for doing floating point again */ asm("emms\n\t"); #endif diff --git a/src/post/deinterlace/plugins/greedyhmacros.h b/src/post/deinterlace/plugins/greedyhmacros.h index 5f65959c3..fd1eb2068 100644 --- a/src/post/deinterlace/plugins/greedyhmacros.h +++ b/src/post/deinterlace/plugins/greedyhmacros.h @@ -15,7 +15,7 @@ // ///////////////////////////////////////////////////////////////////////////// -// Define a few macros for CPU dependent instructions. +// Define a few macros for CPU dependent instructions. // I suspect I don't really understand how the C macro preprocessor works but // this seems to get the job done. // TRB 7/01 @@ -35,9 +35,9 @@ "paddusb "mmrw", "mmr1"\n\t" #define V_PAVGB_SSE(mmr1, mmr2, mmrw, smask) "pavgb "mmr2", "mmr1"\n\t" #define V_PAVGB_3DNOW(mmr1, mmr2, mmrw, smask) "pavgusb "mmr2", "mmr1"\n\t" -#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) -#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) -#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) +#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) +#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) +#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) // some macros for pmaxub instruction #define V_PMAXUB_MMX(mmr1, mmr2) \ @@ -45,9 +45,9 @@ "paddusb "mmr2", "mmr1"\n\t" #define V_PMAXUB_SSE(mmr1, mmr2) "pmaxub "mmr2", "mmr1"\n\t" #define V_PMAXUB_3DNOW(mmr1, mmr2) V_PMAXUB_MMX(mmr1, mmr2) // use MMX version -#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) -#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) -#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) +#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) +#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) +#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) // some macros for pminub instruction // V_PMINUB(mmr1, mmr2, mmr work register) mmr2 may NOT = mmrw @@ -58,17 +58,17 @@ "psubusb "mmrw", "mmr1"\n\t" #define V_PMINUB_SSE(mmr1, mmr2, mmrw) "pminub "mmr2", "mmr1"\n\t" #define V_PMINUB_3DNOW(mmr1, mmr2, mmrw) V_PMINUB_MMX(mmr1, mmr2, mmrw) // use MMX version -#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) -#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) -#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) +#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) +#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) +#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) // some macros for movntq instruction -// V_MOVNTQ(mmr1, mmr2) +// V_MOVNTQ(mmr1, mmr2) #define V_MOVNTQ_MMX(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_3DNOW(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_SSE(mmr1, mmr2) "movntq "mmr2", "mmr1"\n\t" -#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) -#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) +#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) +#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) #define V_MOVNTQ3(mmr1, mmr2, ssetyp) V_MOVNTQ_##ssetyp(mmr1, mmr2) // end of macros diff --git a/src/post/deinterlace/plugins/linearblend.c b/src/post/deinterlace/plugins/linearblend.c index 2c60f112f..fe230685b 100644 --- a/src/post/deinterlace/plugins/linearblend.c +++ b/src/post/deinterlace/plugins/linearblend.c @@ -255,7 +255,7 @@ static void deinterlace_scanline_linear_blend2_mmxext( uint8_t *output, uint8_t *b1 = data->b1; int i; - + READ_PREFETCH_2048( t1 ); READ_PREFETCH_2048( b1 ); READ_PREFETCH_2048( m0 ); diff --git a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h index a0136fd44..875ed7055 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h +++ b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h @@ -8,7 +8,7 @@ #define MyMemCopy xine_fast_memcpy -// Define a few macros for CPU dependent instructions. +// Define a few macros for CPU dependent instructions. // I suspect I don't really understand how the C macro preprocessor works but // this seems to get the job done. // TRB 7/01 @@ -28,9 +28,9 @@ "paddusb "mmrw", "mmr1"\n\t" #define V_PAVGB_SSE(mmr1, mmr2, mmrw, smask) "pavgb "mmr2", "mmr1"\n\t" #define V_PAVGB_3DNOW(mmr1, mmr2, mmrw, smask) "pavgusb "mmr2", "mmr1"\n\t" -#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) -#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) -#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) +#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) +#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) +#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) // some macros for pmaxub instruction #define V_PMAXUB_MMX(mmr1, mmr2) \ @@ -38,9 +38,9 @@ "paddusb "mmr2", "mmr1"\n\t" #define V_PMAXUB_SSE(mmr1, mmr2) "pmaxub "mmr2", "mmr1"\n\t" #define V_PMAXUB_3DNOW(mmr1, mmr2) V_PMAXUB_MMX(mmr1, mmr2) // use MMX version -#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) -#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) -#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) +#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) +#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) +#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) // some macros for pminub instruction // V_PMINUB(mmr1, mmr2, mmr work register) mmr2 may NOT = mmrw @@ -51,17 +51,17 @@ "psubusb "mmrw", "mmr1"\n\t" #define V_PMINUB_SSE(mmr1, mmr2, mmrw) "pminub "mmr2", "mmr1"\n\t" #define V_PMINUB_3DNOW(mmr1, mmr2, mmrw) V_PMINUB_MMX(mmr1, mmr2, mmrw) // use MMX version -#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) -#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) -#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) +#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) +#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) +#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) // some macros for movntq instruction -// V_MOVNTQ(mmr1, mmr2) +// V_MOVNTQ(mmr1, mmr2) #define V_MOVNTQ_MMX(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_3DNOW(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_SSE(mmr1, mmr2) "movntq "mmr2", "mmr1"\n\t" -#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) -#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) +#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) +#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) #define V_MOVNTQ3(mmr1, mmr2, ssetyp) V_MOVNTQ_##ssetyp(mmr1, mmr2) // end of macros diff --git a/src/post/deinterlace/pulldown.c b/src/post/deinterlace/pulldown.c index 4f6247444..2218855f0 100644 --- a/src/post/deinterlace/pulldown.c +++ b/src/post/deinterlace/pulldown.c @@ -47,7 +47,7 @@ * Bot 2 : Drop * Top 3 : Merge * Bot 3 : Drop - * Top 4 : Show + * Top 4 : Show * Bot 4 : Drop * Top 5 : Drop * Bot 5 : Show @@ -69,15 +69,15 @@ * * [ ] * [ * *] | 0 top BC - * [* * ] | 1 BC bottom BC + * [* * ] | 1 BC bottom BC * * [ ] * [ * *] | 0 top CC - * [ * *] | 0 CC bottom CC + * [ * *] | 0 CC bottom CC * * [ ] * [* * ] | 1 top DD - * [ * *] | 0 DD bottom DD + * [ * *] | 0 DD bottom DD * * * [* * ] | 1 top AA @@ -608,7 +608,7 @@ int pulldown_drop( int action, int bottom_field ) if( action == PULLDOWN_SEQ_CC && !bottom_field ) ret = 0; if( action == PULLDOWN_SEQ_DD && bottom_field ) - ret = 0; + ret = 0; return ret; } diff --git a/src/post/deinterlace/speedy.c b/src/post/deinterlace/speedy.c index 5dc564b26..6af2c3b88 100644 --- a/src/post/deinterlace/speedy.c +++ b/src/post/deinterlace/speedy.c @@ -117,11 +117,11 @@ void (*composite_bars_packed4444_scanline)( uint8_t *output, uint8_t *background, int width, int a, int luma, int cb, int cr, int percentage ); -void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, +void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, uint8_t *input, int width, int alpha ); void (*aspect_adjust_packed4444_scanline)( uint8_t *output, - uint8_t *input, + uint8_t *input, int width, double pixel_aspect ); void (*packed444_to_packed422_scanline)( uint8_t *output, @@ -623,7 +623,7 @@ static void vfilter_chroma_121_packed422_scanline_mmx( uint8_t *output, int widt paddw_r2r( mm1, mm2 ); psllw_i2r( 6, mm2 ); - pand_r2r( mm6, mm2 ); + pand_r2r( mm6, mm2 ); por_r2r ( mm3, mm2 ); @@ -638,7 +638,7 @@ static void vfilter_chroma_121_packed422_scanline_mmx( uint8_t *output, int widt *output = (*t + *b + (*m << 1)) >> 2; output+=2; t+=2; b+=2; m+=2; } - + emms(); } #endif @@ -662,7 +662,7 @@ static void vfilter_chroma_332_packed422_scanline_mmx( uint8_t *output, int widt const mmx_t cmask = { 0xff00ff00ff00ff00ULL }; // Get width in bytes. - width *= 2; + width *= 2; i = width / 8; width -= i * 8; @@ -1940,7 +1940,7 @@ static int conv_YR_inited = 0; static int myround(double n) { - if (n >= 0) + if (n >= 0) return (int)(n + 0.5); else return (int)(n - 0.5); @@ -1957,7 +1957,7 @@ static void init_RGB_to_YCbCr_tables(void) * to one of each, add the following: * + (fixed-point-factor / 2) --- for rounding later * + (Q-offset * fixed-point-factor) --- to add the offset - * + * */ for (i = 0; i < 256; i++) { Y_R[i] = myround(0.299 * (double)i * 219.0 / 255.0 * (double)(1<<FP_BITS)); @@ -1989,7 +1989,7 @@ static void init_YCbCr_to_RGB_tables(void) * to one of each, add the following: * + (fixed-point-factor / 2) --- for rounding later * + (Q-offset * fixed-point-factor) --- to add the offset - * + * */ /* clip Y values under 16 */ @@ -2006,7 +2006,7 @@ static void init_YCbCr_to_RGB_tables(void) RGB_Y[i] = myround((1.0 * (double)(235) * 255.0 / 219.0 * (double)(1<<FP_BITS)) + (double)(1<<(FP_BITS-1))); } - + /* clip Cb/Cr values below 16 */ for (i = 0; i < 16; i++) { R_Cr[i] = myround(1.402 * (double)(-112) * 255.0 / 224.0 * (double)(1<<FP_BITS)); @@ -2056,7 +2056,7 @@ static void rgba32_to_packed4444_rec601_scanline_c( uint8_t *output, uint8_t *in int g = input[ 1 ]; int b = input[ 2 ]; int a = input[ 3 ]; - + output[ 0 ] = a; output[ 1 ] = (Y_R[ r ] + Y_G[ g ] + Y_B[ b ]) >> FP_BITS; output[ 2 ] = (Cb_R[ r ] + Cb_G[ g ] + Cb_B[ b ]) >> FP_BITS; @@ -2129,7 +2129,7 @@ static void packed444_to_rgb24_rec601_reference_scanline( uint8_t *output, uint8 } */ -static void packed444_to_nonpremultiplied_packed4444_scanline_c( uint8_t *output, +static void packed444_to_nonpremultiplied_packed4444_scanline_c( uint8_t *output, uint8_t *input, int width, int alpha ) { @@ -2147,7 +2147,7 @@ static void packed444_to_nonpremultiplied_packed4444_scanline_c( uint8_t *output } static void aspect_adjust_packed4444_scanline_c( uint8_t *output, - uint8_t *input, + uint8_t *input, int width, double pixel_aspect ) { @@ -2260,7 +2260,7 @@ static void chroma_422_to_444_mpeg2_plane_c( uint8_t *dst, uint8_t *src, int wid /* odd samples (21 -52 159 159 -52 21) */ dst[ i2 + 1 ] = clip255( ( 21*(src[im2]+src[ip3]) - - 52*(src[im1]+src[ip2]) + - 52*(src[im1]+src[ip2]) + 159*(src[i]+src[ip1]) + 128 ) >> 8 ); } src += w; diff --git a/src/post/deinterlace/speedy.h b/src/post/deinterlace/speedy.h index b4ad56393..55a2a1d5b 100644 --- a/src/post/deinterlace/speedy.h +++ b/src/post/deinterlace/speedy.h @@ -237,7 +237,7 @@ extern void (*subpix_blit_vertical_packed422_scanline)( uint8_t *output, uint8_t * Simple function to convert a 4:4:4 scanline to a 4:4:4:4 scanline by * adding an alpha channel. Result is non-premultiplied. */ -extern void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, +extern void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, uint8_t *input, int width, int alpha ); @@ -248,7 +248,7 @@ extern void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *outpu * aspect ratio. */ extern void (*aspect_adjust_packed4444_scanline)( uint8_t *output, - uint8_t *input, + uint8_t *input, int width, double pixel_aspect ); diff --git a/src/post/deinterlace/tvtime.h b/src/post/deinterlace/tvtime.h index 2253f264e..22d863a56 100644 --- a/src/post/deinterlace/tvtime.h +++ b/src/post/deinterlace/tvtime.h @@ -98,4 +98,4 @@ tvtime_t *tvtime_new_context(void); void tvtime_reset_context( tvtime_t *this ); -#endif +#endif diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index 9dffb255d..5615e4ba1 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -50,7 +50,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *); static const post_info_t deinterlace_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 10, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -66,7 +66,7 @@ static const char *const enum_framerate[] = { "full", "half_top", "half_bottom", static void *help_string; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct deinterlace_parameters_s { @@ -86,15 +86,15 @@ typedef struct deinterlace_parameters_s { * description of params struct */ START_PARAM_DESCR( deinterlace_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, method, enum_methods, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, method, enum_methods, 0, 0, 0, "deinterlace method" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL, enabled, NULL, 0, 1, 0, "enable/disable" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown, enum_pulldown, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown, enum_pulldown, 0, 0, 0, "pulldown algorithm" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown_error_wait, NULL, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown_error_wait, NULL, 0, 0, 0, "number of frames of telecine pattern sync required before mode change" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, framerate_mode, enum_framerate, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, framerate_mode, enum_framerate, 0, 0, 0, "framerate output mode" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL, judder_correction, NULL, 0, 1, 0, "make frames evenly spaced for film mode (24 fps)" ) @@ -129,7 +129,7 @@ struct post_plugin_deinterlace_s { int tvtime_changed; int tvtime_last_filmmode; int vo_deinterlace_enabled; - + int framecounter; uint8_t rff_pattern; @@ -144,10 +144,10 @@ typedef struct post_class_deinterlace_s { deinterlace_parameters_t init_param; } post_class_deinterlace_t; -static void _flush_frames(post_plugin_deinterlace_t *this) +static void _flush_frames(post_plugin_deinterlace_t *this) { int i; - + for( i = 0; i < NUM_RECENT_FRAMES; i++ ) { if( this->recent_frame[i] ) { this->recent_frame[i]->free(this->recent_frame[i]); @@ -189,7 +189,7 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) { static int get_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)this_gen; deinterlace_parameters_t *param = (deinterlace_parameters_t *)param_gen; - + param->method = this->cur_method; param->enabled = this->enabled; param->pulldown = this->pulldown; @@ -202,7 +202,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -307,7 +307,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->class.open_plugin = deinterlace_open_plugin; class->class.identifier = "tvtime"; class->class.description = N_("advanced deinterlacer plugin with pulldown detection"); @@ -329,7 +329,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) filter_deinterlace_methods( config_flags, 5 /*fieldsavailable*/ ); if( !get_num_deinterlace_methods() ) { - xprintf(xine, XINE_VERBOSITY_LOG, + xprintf(xine, XINE_VERBOSITY_LOG, _("tvtime: No deinterlacing methods available, exiting.\n")); return NULL; } @@ -342,7 +342,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) deinterlace_method_t *method; method = get_deinterlace_method(i); - + enum_methods[i+1] = method->short_name; xine_buffer_strcat( help_string, "[" ); xine_buffer_strcat( help_string, method->short_name ); @@ -354,7 +354,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) xine_buffer_strcat( help_string, "\n---\n" ); } enum_methods[i+1] = NULL; - + /* Some default values */ class->init_param.method = 1; /* First (plugin) method available */ @@ -362,7 +362,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) class->init_param.pulldown = 1; /* vektor */ class->init_param.pulldown_error_wait = 60; /* about one second */ class->init_param.framerate_mode = 0; /* full */ - class->init_param.judder_correction = 1; + class->init_param.judder_correction = 1; class->init_param.use_progressive_frame_flag = 1; class->init_param.chroma_filter = 0; class->init_param.cheap_mode = 0; @@ -381,12 +381,12 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input post_out_t *output; post_class_deinterlace_t *class = (post_class_deinterlace_t *)class_gen; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); this->tvtime = tvtime_new_context(); @@ -396,7 +396,7 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input pthread_mutex_init (&this->lock, NULL); set_parameters ((xine_post_t *)&this->post, &class->init_param); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); /* replace with our own get_frame function */ port->new_port.open = deinterlace_open; @@ -406,7 +406,7 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input port->new_port.flush = deinterlace_flush; port->intercept_frame = deinterlace_intercept_frame; port->new_frame->draw = deinterlace_draw; - + input_api = &this->parameter_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -415,11 +415,11 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input input->xine_in.name = "video"; output->xine_out.name = "deinterlaced video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = deinterlace_dispose; - + return &this->post; } @@ -465,9 +465,9 @@ static int deinterlace_set_property(xine_video_port_t *port_gen, int property, i pthread_mutex_unlock (&this->lock); this->vo_deinterlace_enabled = this->enabled && (!this->cur_method); - - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, this->vo_deinterlace_enabled); return this->enabled; @@ -488,14 +488,14 @@ static void deinterlace_open(xine_video_port_t *port_gen, xine_stream_t *stream) { post_video_port_t *port = (post_video_port_t *)port_gen; post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post; - + _x_post_rewire(&this->post); _x_post_inc_usage(port); port->stream = stream; (port->original_port->open) (port->original_port, stream); this->vo_deinterlace_enabled = !this->cur_method; - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, this->vo_deinterlace_enabled); } @@ -506,8 +506,8 @@ static void deinterlace_close(xine_video_port_t *port_gen, xine_stream_t *stream port->stream = NULL; _flush_frames(this); - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, 0); port->original_port->close(port->original_port, stream); _x_post_dec_usage(port); @@ -518,21 +518,21 @@ static int deinterlace_intercept_frame(post_video_port_t *port, vo_frame_t *fram { post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post; int vo_deinterlace_enabled = 0; - + vo_deinterlace_enabled = ( frame->format != XINE_IMGFMT_YV12 && frame->format != XINE_IMGFMT_YUY2 && this->enabled ); - + if( this->cur_method && this->vo_deinterlace_enabled != vo_deinterlace_enabled ) { this->vo_deinterlace_enabled = vo_deinterlace_enabled; - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, this->vo_deinterlace_enabled); } - + return (this->enabled && this->cur_method && - (frame->flags & VO_INTERLACED_FLAG) && + (frame->flags & VO_INTERLACED_FLAG) && (frame->format == XINE_IMGFMT_YV12 || frame->format == XINE_IMGFMT_YUY2) ); } @@ -547,7 +547,7 @@ static void apply_chroma_filter( uint8_t *data, int stride, int width, int heigh */ for( i = 0; i < height; i++, data += stride ) { vfilter_chroma_332_packed422_scanline( data, width, - data, + data, (i) ? (data - stride) : data, (i < height-1) ? (data + stride) : data ); } @@ -555,7 +555,7 @@ static void apply_chroma_filter( uint8_t *data, int stride, int width, int heigh /* Build the output frame from the specified field. */ static int deinterlace_build_output_field( - post_plugin_deinterlace_t *this, post_video_port_t *port, + post_plugin_deinterlace_t *this, post_video_port_t *port, xine_stream_t *stream, vo_frame_t *frame, vo_frame_t *yuy2_frame, int bottom_field, int second_field, @@ -564,14 +564,14 @@ static int deinterlace_build_output_field( vo_frame_t *deinterlaced_frame; int scaler = 1; int force24fps; - + force24fps = this->judder_correction && !this->cheap_mode && ( this->pulldown == PULLDOWN_VEKTOR && this->tvtime->filmmode ); - + if( this->tvtime->curmethod->doscalerbob ) { scaler = 2; } - + pthread_mutex_unlock (&this->lock); deinterlaced_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height / scaler, frame->ratio, yuy2_frame->format, @@ -584,7 +584,7 @@ static int deinterlace_build_output_field( deinterlaced_frame->crop_bottom = frame->crop_bottom; _x_extra_info_merge(deinterlaced_frame->extra_info, frame->extra_info); - + if( skip > 0 && !this->pulldown ) { deinterlaced_frame->bad_frame = 1; } else { @@ -593,60 +593,60 @@ static int deinterlace_build_output_field( deinterlaced_frame->bad_frame = !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[0], yuy2_frame->base[0], bottom_field, - frame->width, frame->height, + frame->width, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0] ); } else { deinterlaced_frame->bad_frame = !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[0], yuy2_frame->base[0], bottom_field, - frame->width/2, frame->height, + frame->width/2, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0] ); deinterlaced_frame->bad_frame += !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[1], yuy2_frame->base[1], bottom_field, - frame->width/4, frame->height/2, + frame->width/4, frame->height/2, yuy2_frame->pitches[1], deinterlaced_frame->pitches[1] ); deinterlaced_frame->bad_frame += !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[2], yuy2_frame->base[2], bottom_field, - frame->width/4, frame->height/2, + frame->width/4, frame->height/2, yuy2_frame->pitches[2], deinterlaced_frame->pitches[2] ); } } else { if( yuy2_frame->format == XINE_IMGFMT_YUY2 ) { deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[0], - yuy2_frame->base[0], - (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], + yuy2_frame->base[0], + (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], (this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0], - bottom_field, second_field, frame->width, frame->height, + bottom_field, second_field, frame->width, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]); } else { deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[0], - yuy2_frame->base[0], - (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], + yuy2_frame->base[0], + (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], (this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0], - bottom_field, second_field, frame->width/2, frame->height, + bottom_field, second_field, frame->width/2, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]); deinterlaced_frame->bad_frame += !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[1], - yuy2_frame->base[1], - (this->recent_frame[0])?this->recent_frame[0]->base[1]:yuy2_frame->base[1], + yuy2_frame->base[1], + (this->recent_frame[0])?this->recent_frame[0]->base[1]:yuy2_frame->base[1], (this->recent_frame[1])?this->recent_frame[1]->base[1]:yuy2_frame->base[1], bottom_field, second_field, frame->width/4, frame->height/2, yuy2_frame->pitches[1], deinterlaced_frame->pitches[1]); deinterlaced_frame->bad_frame += !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[2], - yuy2_frame->base[2], - (this->recent_frame[0])?this->recent_frame[0]->base[2]:yuy2_frame->base[2], + yuy2_frame->base[2], + (this->recent_frame[0])?this->recent_frame[0]->base[2]:yuy2_frame->base[2], (this->recent_frame[1])?this->recent_frame[1]->base[2]:yuy2_frame->base[2], - bottom_field, second_field, frame->width/4, frame->height/2, + bottom_field, second_field, frame->width/4, frame->height/2, yuy2_frame->pitches[2], deinterlaced_frame->pitches[2]); } } } - + pthread_mutex_unlock (&this->lock); if( force24fps ) { if( !deinterlaced_frame->bad_frame ) { @@ -658,7 +658,7 @@ static int deinterlace_build_output_field( deinterlaced_frame->pts = 0; deinterlaced_frame->duration = FPS_24_DURATION; if( this->chroma_filter && !this->cheap_mode ) - apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], + apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], frame->width, frame->height / scaler ); skip = deinterlaced_frame->draw(deinterlaced_frame, stream); } else { @@ -668,15 +668,15 @@ static int deinterlace_build_output_field( deinterlaced_frame->pts = pts; deinterlaced_frame->duration = duration; if( this->chroma_filter && !this->cheap_mode && !deinterlaced_frame->bad_frame ) - apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], + apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], frame->width, frame->height / scaler ); skip = deinterlaced_frame->draw(deinterlaced_frame, stream); } - + /* _x_post_frame_copy_up(frame, deinterlaced_frame); */ deinterlaced_frame->free(deinterlaced_frame); pthread_mutex_lock (&this->lock); - + return skip; } @@ -693,7 +693,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) orig_frame = frame; _x_post_frame_copy_down(frame, frame->next); frame = frame->next; - + /* update tvtime context and method */ pthread_mutex_lock (&this->lock); if( this->tvtime_changed ) { @@ -704,8 +704,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) else this->tvtime->curmethod = NULL; - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, !this->cur_method); this->tvtime_changed = 0; @@ -724,11 +724,11 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) lprintf("frame flags pf: %d rff: %d tff: %d duration: %d\n", frame->progressive_frame, frame->repeat_first_field, frame->top_field_first, frame->duration); - + /* detect special rff patterns */ this->rff_pattern = this->rff_pattern << 1; this->rff_pattern |= !!frame->repeat_first_field; - + if( ((this->rff_pattern & 0xff) == 0xaa || (this->rff_pattern & 0xff) == 0x55) ) { /* @@ -740,7 +740,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) /* using frame->progressive_frame may help displaying still menus. * however, it is known that some rare material set it wrong. - * + * * we also assume that repeat_first_field is progressive (it doesn't * make much sense to display interlaced fields out of order) */ @@ -748,8 +748,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) (frame->repeat_first_field || frame->progressive_frame) ) { progressive = 1; } - - if( !frame->bad_frame && + + if( !frame->bad_frame && (frame->flags & VO_INTERLACED_FLAG) && this->tvtime->curmethod ) { @@ -761,17 +761,17 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) yuy2_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YUY2, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, yuy2_frame); - + /* the logic for deciding upsampling to use comes from: * http://www.hometheaterhifi.com/volume_8_2/dvd-benchmark-special-report-chroma-bug-4-2001.html */ - yv12_to_yuy2(frame->base[0], frame->pitches[0], - frame->base[1], frame->pitches[1], - frame->base[2], frame->pitches[2], + yv12_to_yuy2(frame->base[0], frame->pitches[0], + frame->base[1], frame->pitches[1], + frame->base[2], frame->pitches[2], yuy2_frame->base[0], yuy2_frame->pitches[0], - frame->width, frame->height, + frame->width, frame->height, frame->progressive_frame || progressive ); - + } else { yuy2_frame = frame; yuy2_frame->lock(yuy2_frame); @@ -781,10 +781,10 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_lock (&this->lock); /* check if frame format changed */ for(i = 0; i < NUM_RECENT_FRAMES; i++ ) { - if( this->recent_frame[i] && - (this->recent_frame[i]->width != frame->width || - this->recent_frame[i]->height != frame->height || - this->recent_frame[i]->format != yuy2_frame->format ) ) { + if( this->recent_frame[i] && + (this->recent_frame[i]->width != frame->width || + this->recent_frame[i]->height != frame->height || + this->recent_frame[i]->format != yuy2_frame->format ) ) { this->recent_frame[i]->free(this->recent_frame[i]); this->recent_frame[i] = NULL; } @@ -797,10 +797,10 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) framerate_mode = FRAMERATE_HALF_TFF; this->tvtime->pulldown_alg = PULLDOWN_NONE; } - + if( framerate_mode == FRAMERATE_FULL ) { int top_field_first = frame->top_field_first; - + /* if i understood mpeg2 specs correctly, top_field_first * shall be zero for field pictures and the output order * is the same that the fields are decoded. @@ -812,7 +812,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) if ( (frame->flags & VO_BOTH_FIELDS) != VO_BOTH_FIELDS ) { top_field_first = (frame->flags & VO_TOP_FIELD) ? 1 : 0; } - + if ( top_field_first ) { fields[0] = 0; fields[1] = 1; @@ -825,8 +825,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) } else if ( framerate_mode == FRAMERATE_HALF_BFF ) { fields[0] = 1; } - - + + if( progressive ) { /* If the previous field was interlaced and this one is progressive @@ -838,10 +838,10 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) * duration is used in the calculation because the generated frame * represents the second half of the previous frame. */ - if (this->recent_frame[0] && !this->recent_frame[0]->progressive_frame && + if (this->recent_frame[0] && !this->recent_frame[0]->progressive_frame && this->tvtime->curmethod->delaysfield) { - skip = deinterlace_build_output_field( + skip = deinterlace_build_output_field( this, port, stream, frame, yuy2_frame, fields[0], 0, @@ -867,19 +867,19 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) /* Build the output from the first field. */ if ( !(this->recent_frame[0] && this->recent_frame[0]->progressive_frame && this->tvtime->curmethod->delaysfield) ) { - skip = deinterlace_build_output_field( + skip = deinterlace_build_output_field( this, port, stream, frame, yuy2_frame, fields[0], 0, frame->pts, (framerate_mode == FRAMERATE_FULL) ? frame->duration/2 : frame->duration, 0); - } + } if( framerate_mode == FRAMERATE_FULL ) { - + /* Build the output from the second field. */ - skip = deinterlace_build_output_field( + skip = deinterlace_build_output_field( this, port, stream, frame, yuy2_frame, fields[1], 1, @@ -889,7 +889,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) } } - /* don't drop frames when pulldown mode is enabled. otherwise + /* don't drop frames when pulldown mode is enabled. otherwise * pulldown detection fails (yo-yo effect has also been seen) */ if( this->pulldown ) @@ -897,7 +897,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) /* store back progressive flag for frame history */ yuy2_frame->progressive_frame = progressive; - + /* keep track of recent frames */ i = NUM_RECENT_FRAMES-1; if( this->recent_frame[i] ) @@ -918,8 +918,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) } else { skip = frame->draw(frame, stream); } - + _x_post_frame_copy_up(orig_frame, frame); - + return skip; } diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index 03a5a3c07..7cf1a9325 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -71,19 +71,19 @@ struct post_plugin_goom_s { /* private data */ xine_video_port_t *vo_port; post_out_t video_output; - + post_class_goom_t *class; - + /* private metronom for syncing the video */ metronom_t *metronom; - + /* goom context */ PluginInfo *goom; - - int data_idx; + + int data_idx; gint16 data [2][NUMSAMPLES]; audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */ - + int channels; int sample_rate; int samples_per_frame; @@ -99,7 +99,7 @@ struct post_plugin_goom_s { yuv_planes_t yuv; - + /* frame skipping */ int skip_frame; }; @@ -110,12 +110,12 @@ static void *goom_init_plugin(xine_t *xine, void *); /* plugin catalog information */ -static const post_info_t goom_special_info = { +static const post_info_t goom_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZATION }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 10, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -142,7 +142,7 @@ static void goom_port_put_buffer (xine_audio_port_t *this, audio_buffer_t *buf, static void fps_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; @@ -158,7 +158,7 @@ static void fps_changed_cb(void *data, xine_cfg_entry_t *cfg) { static void width_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; this->width = cfg->num_value; @@ -167,7 +167,7 @@ static void width_changed_cb(void *data, xine_cfg_entry_t *cfg) { static void height_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; this->height = cfg->num_value; @@ -176,7 +176,7 @@ static void height_changed_cb(void *data, xine_cfg_entry_t *cfg) { static void csc_method_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; this->csc_method = cfg->num_value; @@ -190,14 +190,14 @@ static void *goom_init_plugin(xine_t *xine, void *data) if (!this) return NULL; - + this->class.open_plugin = goom_open_plugin; this->class.identifier = "goom"; this->class.description = N_("What a GOOM"); this->class.dispose = goom_class_dispose; this->ip = NULL; this->xine = xine; - + cfg = xine->config; cfg->register_num (cfg, "effects.goom.fps", FPS, @@ -210,12 +210,12 @@ static void *goom_init_plugin(xine_t *xine, void *data) _("goom image width"), _("The width in pixels of the image to be generated."), 10, width_changed_cb, this); - + cfg->register_num (cfg, "effects.goom.height", GOOM_HEIGHT, _("goom image height"), _("The height in pixels of the image to be generated."), 10, height_changed_cb, this); - + cfg->register_enum (cfg, "effects.goom.csc_method", 0, goom_csc_methods, @@ -244,34 +244,34 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); - + /* * Lookup config entries. */ this->class = class; class->ip = this; this->vo_port = video_target[0]; - + this->metronom = _x_metronom_init(1, 0, class->xine); lprintf("goom_open_plugin\n"); if(xine_config_lookup_entry(class->xine, "effects.goom.fps", - &fps_entry)) + &fps_entry)) fps_changed_cb(class, &fps_entry); if(xine_config_lookup_entry(class->xine, "effects.goom.width", - &width_entry)) + &width_entry)) width_changed_cb(class, &width_entry); if(xine_config_lookup_entry(class->xine, "effects.goom.height", - &height_entry)) + &height_entry)) height_changed_cb(class, &height_entry); if(xine_config_lookup_entry(class->xine, "effects.goom.csc_method", - &csc_method_entry)) + &csc_method_entry)) csc_method_changed_cb(class, &csc_method_entry); this->width_back = this->width; @@ -283,13 +283,13 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, this->ratio = (double)this->width_back/(double)this->height_back; this->buf.mem = NULL; - this->buf.mem_size = 0; + this->buf.mem_size = 0; port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = goom_port_open; port->new_port.close = goom_port_close; port->new_port.put_buffer = goom_port_put_buffer; - + outputv = &this->video_output; outputv->xine_out.name = "generated video"; outputv->xine_out.type = XINE_POST_DATA_VIDEO; @@ -297,7 +297,7 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, outputv->xine_out.rewire = goom_rewire_video; outputv->post = &this->post; xine_list_push_back(this->post.output, outputv); - + this->post.xine_post.audio_input[0] = &port->new_port; this->post.dispose = goom_dispose; @@ -310,13 +310,13 @@ static void goom_class_dispose(post_class_t *class_gen) post_class_goom_t *this = (post_class_goom_t*) class_gen; this->xine->config->unregister_callback(this->xine->config, - "effects.goom.fps"); + "effects.goom.fps"); this->xine->config->unregister_callback(this->xine->config, - "effects.goom.width"); + "effects.goom.width"); this->xine->config->unregister_callback(this->xine->config, - "effects.goom.height"); + "effects.goom.height"); this->xine->config->unregister_callback(this->xine->config, - "effects.goom.csc_method"); + "effects.goom.csc_method"); free(class_gen); } @@ -346,7 +346,7 @@ static int goom_rewire_video(xine_post_out_t *output_gen, void *data) xine_video_port_t *old_port = *(xine_video_port_t **)output_gen->data; xine_video_port_t *new_port = (xine_video_port_t *)data; post_plugin_goom_t *this = (post_plugin_goom_t *)output->post; - + if (!data) return 0; /* register our stream at the new output port */ @@ -365,12 +365,12 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->channels = _x_ao_mode2channels(mode); this->sample_rate = rate; this->samples_per_frame = rate / this->fps; @@ -380,7 +380,7 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, this->do_samples_skip = 0; this->left_to_read = NUMSAMPLES; - + (this->vo_port->open) (this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, stream->metronom); @@ -395,18 +395,18 @@ static void goom_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream ) free_yuv_planes(&this->yuv); port->stream = NULL; - + this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void goom_port_put_buffer (xine_audio_port_t *port_gen, +static void goom_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_goom_t *this = (post_plugin_goom_t *)port->post; vo_frame_t *frame; @@ -419,28 +419,28 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, int width, height; int current_sample = 0; - + /* make a copy of buf data for private use */ if( this->buf.mem_size < buf->mem_size ) { this->buf.mem = realloc(this->buf.mem, buf->mem_size); this->buf.mem_size = buf->mem_size; } - memcpy(this->buf.mem, buf->mem, + memcpy(this->buf.mem, buf->mem, buf->num_frames*this->channels*((port->bits == 8)?1:2)); this->buf.num_frames = buf->num_frames; - + /* pass data to original port */ - port->original_port->put_buffer(port->original_port, buf, stream); - + port->original_port->put_buffer(port->original_port, buf, stream); + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ - buf = &this->buf; + buf = &this->buf; j = (this->channels >= 2) ? 1 : 0; while (current_sample < buf->num_frames) { - + if (this->do_samples_skip) { if (current_sample + this->left_to_read > buf->num_frames) { this->left_to_read -= (buf->num_frames-current_sample); @@ -449,14 +449,14 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, current_sample+=this->left_to_read; this->left_to_read = NUMSAMPLES; this->do_samples_skip = 0; - + } } else { if( port->bits == 8 ) { data8 = (int8_t *)buf->mem; data8 += current_sample * this->channels; - + /* scale 8 bit data to 16 bits and convert to signed as well */ for ( i=current_sample ; this->data_idx < NUMSAMPLES && i < buf->num_frames; i++, this->data_idx++,data8 += this->channels) { @@ -495,13 +495,13 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, frame = this->vo_port->get_frame (this->vo_port, this->width_back, this->height_back, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); - + frame->extra_info->invalid = 1; - + frame->duration = 90000 * this->samples_per_frame / this->sample_rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + if (!this->skip_frame) { /* Try to be fast */ goom_frame = (uint8_t *)goom_update (this->goom, this->data, 0, 0, NULL, NULL); @@ -509,13 +509,13 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, dest_ptr = frame -> base[0]; goom_frame_end = goom_frame + 4 * (this->width_back * this->height_back); - if ((this->csc_method == 1) && + if ((this->csc_method == 1) && (xine_mm_accel() & MM_ACCEL_X86_MMX)) { int plane_ptr = 0; while (goom_frame < goom_frame_end) { uint8_t r, g, b; - + /* don't take endianness into account since MMX is only available * on Intel processors */ b = *goom_frame; goom_frame++; @@ -551,7 +551,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, g2 = *goom_frame; goom_frame++; r2 = *goom_frame; goom_frame += 2; #endif - + *dest_ptr = COMPUTE_Y(r1, g1, b1); dest_ptr++; *dest_ptr = COMPUTE_U(r1, g1, b1); @@ -573,7 +573,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, } frame->free(frame); - + width = this->width; height = this->height; if ((width != this->width_back) || (height != this->height_back)) { diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c index b009f13fe..842588c01 100644 --- a/src/post/mosaico/mosaico.c +++ b/src/post/mosaico/mosaico.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* * simple video mosaico plugin */ @@ -44,7 +44,7 @@ static void *mosaico_init_plugin(xine_t *xine, void *); static const post_info_t mosaico_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 10, "mosaico", XINE_VERSION_CODE, &mosaico_special_info, &mosaico_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -84,9 +84,9 @@ struct mosaico_pip_s { }; struct post_mosaico_s { - post_plugin_t post; + post_plugin_t post; xine_post_in_t parameter_input; - + mosaico_pip_t *pip; int64_t vpts_limit; pthread_cond_t vpts_limit_changed; @@ -127,7 +127,7 @@ static void *mosaico_init_plugin(xine_t *xine, void *data) if (!this) return NULL; - + this->class.open_plugin = mosaico_open_plugin; this->class.identifier = "mosaico"; this->class.description = N_("Mosaico is a picture in picture (pip) post plugin"); @@ -146,17 +146,17 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - static xine_post_api_t post_api = + static xine_post_api_t post_api = { mosaico_set_parameters, mosaico_get_parameters, mosaico_get_param_descr, mosaico_get_help }; int i; - + lprintf("mosaico open\n"); if (inputs < 2 || !this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, inputs); this->pip = (mosaico_pip_t *)calloc((inputs - 1), sizeof(mosaico_pip_t)); @@ -164,7 +164,7 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, pthread_cond_init(&this->vpts_limit_changed, NULL); pthread_mutex_init(&this->mutex, NULL); - + /* the port for the background video */ port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = mosaico_intercept_frame; @@ -180,7 +180,7 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, this->pip[i].w = 150; this->pip[i].h = 150; asprintf(&(this->pip[i].input_name), "video in %d", i+1); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, NULL); port->new_port.close = mosaico_close; port->intercept_frame = mosaico_intercept_frame; @@ -205,7 +205,7 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, static void mosaico_dispose(post_plugin_t *this_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; - + if (_x_post_dispose(this_gen)) { int i; for (i = 0; i < this->pip_count; i++) @@ -227,7 +227,7 @@ static int mosaico_set_parameters(xine_post_t *this_gen, void *param_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; mosaico_parameters_t *param = (mosaico_parameters_t *)param_gen; - + if (param->pip_num > this->pip_count) return 0; this->pip[param->pip_num - 1].x = param->x; this->pip[param->pip_num - 1].y = param->y; @@ -240,7 +240,7 @@ static int mosaico_get_parameters(xine_post_t *this_gen, void *param_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; mosaico_parameters_t *param = (mosaico_parameters_t *)param_gen; - + if (param->pip_num > this->pip_count || param->pip_num < 1) param->pip_num = 1; param->x = this->pip[param->pip_num - 1].x; @@ -272,7 +272,7 @@ static void mosaico_close(xine_video_port_t *port_gen, xine_stream_t *stream) for (pip_num = 0; pip_num < this->pip_count; pip_num++) if (this->post.xine_post.video_input[pip_num+1] == port_gen) break; - + pthread_mutex_lock(&this->mutex); free_frame = this->pip[pip_num].frame; this->pip[pip_num].frame = NULL; @@ -301,11 +301,11 @@ static void frame_copy_content(vo_frame_t *to, vo_frame_t *from) case XINE_IMGFMT_YUY2: /* TODO: implement conversion to YV12 or implement support to paste * frames of different types together */ - break; - + break; + case XINE_IMGFMT_YV12: /* Y */ - size = to->pitches[0] * to->height; + size = to->pitches[0] * to->height; xine_fast_memcpy(to->base[0], from->base[0], size); /* U */ @@ -330,7 +330,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu unsigned long i, j; if (!this->pip[pip_num].frame) return; - + target_width = this->pip[pip_num].w; target_height = this->pip[pip_num].h; background_width = background->width; @@ -345,8 +345,8 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu switch (this->pip[pip_num].frame->format) { case XINE_IMGFMT_YUY2: /* TODO: implement YUY2 */ - break; - + break; + case XINE_IMGFMT_YV12: /* Y */ target_offset = 0; @@ -363,7 +363,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu pos = pos_y * background_width + pos_x; target_width = (target_width + 1) / 2; target_height = (target_height + 1) / 2; - + /* U */ target_offset = 0; for (j = 0; j < target_height; j++, target_offset += (background_width - target_width)) @@ -371,7 +371,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu source_offset = ((i * scale_x) >> shift_x) + (((j * scale_y) >> shift_y) * source_width); background->base[1][pos + target_offset] = this->pip[pip_num].frame->base[1][source_offset]; } - + /* V */ target_offset = 0; for (j = 0; j < target_height; j++, target_offset += (background_width - target_width)) @@ -379,7 +379,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu source_offset = ((i * scale_x) >> shift_x) + (((j * scale_y) >> shift_y) * source_width); background->base[2][pos + target_offset] = this->pip[pip_num].frame->base[2][source_offset]; } - + break; } } @@ -392,47 +392,47 @@ static int mosaico_draw_background(vo_frame_t *frame, xine_stream_t *stream) int pip_num, skip; pthread_mutex_lock(&this->mutex); - + if (frame->bad_frame) { _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); _x_post_frame_copy_up(frame, frame->next); - + this->vpts_limit = frame->vpts + frame->duration; if (skip) { this->skip = skip; this->skip_vpts = frame->vpts; } else this->skip = 0; - + pthread_mutex_unlock(&this->mutex); pthread_cond_broadcast(&this->vpts_limit_changed); - + return skip; } - + background = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, frame->format, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, background); frame_copy_content(background, frame); - + for (pip_num = 0; pip_num < this->pip_count; pip_num++) frame_paste(this, background, pip_num); - + skip = background->draw(background, stream); _x_post_frame_copy_up(frame, background); this->vpts_limit = background->vpts + background->duration; background->free(background); - + if (skip) { this->skip = skip; this->skip_vpts = frame->vpts; } else this->skip = 0; - + pthread_mutex_unlock(&this->mutex); pthread_cond_broadcast(&this->vpts_limit_changed); - + return skip; } @@ -446,11 +446,11 @@ static int mosaico_draw(vo_frame_t *frame, xine_stream_t *stream) for (pip_num = 0; pip_num < this->pip_count; pip_num++) if (this->post.xine_post.video_input[pip_num+1] == frame->port) break; _x_assert(pip_num < this->pip_count); - + frame->lock(frame); - + pthread_mutex_lock(&this->mutex); - + /* the original output will never see this frame again */ _x_post_frame_u_turn(frame, stream); while (frame->vpts > this->vpts_limit || !this->vpts_limit) @@ -459,12 +459,12 @@ static int mosaico_draw(vo_frame_t *frame, xine_stream_t *stream) free_frame = this->pip[pip_num].frame; if (port->stream) this->pip[pip_num].frame = frame; - + if (this->skip && frame->vpts <= this->skip_vpts) skip = this->skip; else skip = 0; - + pthread_mutex_unlock(&this->mutex); if (free_frame) @@ -473,6 +473,6 @@ static int mosaico_draw(vo_frame_t *frame, xine_stream_t *stream) /* do not keep this frame when no stream is connected to us, * otherwise, this frame might never get freed */ frame->free(frame); - + return skip; } diff --git a/src/post/mosaico/switch.c b/src/post/mosaico/switch.c index 90dbf2690..1bc9058ae 100644 --- a/src/post/mosaico/switch.c +++ b/src/post/mosaico/switch.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* * simple switch video post plugin */ @@ -40,7 +40,7 @@ static void *switch_init_plugin(xine_t *xine, void *); static const post_info_t switch_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 10, "switch", XINE_VERSION_CODE, &switch_special_info, &switch_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -67,7 +67,7 @@ struct post_class_switch_s { struct post_switch_s { post_plugin_t post; xine_post_in_t parameter_input; - + int64_t vpts_limit; pthread_cond_t display_condition_changed; int64_t skip_vpts; @@ -102,7 +102,7 @@ static void *switch_init_plugin(xine_t *xine, void *data) if (!this) return NULL; - + this->class.open_plugin = switch_open_plugin; this->class.identifier = "switch"; this->class.description = N_("Switch is a post plugin able to switch at any time between different streams"); @@ -124,28 +124,28 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, static xine_post_api_t post_api = { switch_set_parameters, switch_get_parameters, switch_get_param_descr, switch_get_help }; int i; - + lprintf("switch open\n"); if (inputs < 2 || !this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, inputs); this->source_count = inputs; this->selected_source = 1; - + pthread_cond_init(&this->display_condition_changed, NULL); pthread_mutex_init(&this->mutex, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_frame->draw = switch_draw; port->port_lock = &this->mutex; port->frame_lock = &this->mutex; this->post.xine_post.video_input[0] = &port->new_port; - + for (i = 1; i < inputs; i++) { port = _x_post_intercept_video_port(&this->post, video_target[0], &input, NULL); port->new_frame->draw = switch_draw; @@ -153,7 +153,7 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, port->frame_lock = &this->mutex; this->post.xine_post.video_input[i] = &port->new_port; } - + input_api = &this->parameter_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -168,7 +168,7 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, static void switch_dispose(post_plugin_t *this_gen) { post_switch_t *this = (post_switch_t *)this_gen; - + if (_x_post_dispose(this_gen)) { pthread_cond_destroy(&this->display_condition_changed); pthread_mutex_destroy(&this->mutex); @@ -186,7 +186,7 @@ static int switch_set_parameters(xine_post_t *this_gen, void *param_gen) { post_switch_t *this = (post_switch_t *)this_gen; switch_parameter_t *param = (switch_parameter_t *)param_gen; - + if (param->select > this->source_count) return 0; pthread_mutex_lock(&this->mutex); this->selected_source = param->select; @@ -199,7 +199,7 @@ static int switch_get_parameters(xine_post_t *this_gen, void *param_gen) { post_switch_t *this = (post_switch_t *)this_gen; switch_parameter_t *param = (switch_parameter_t *)param_gen; - + param->select = this->selected_source; return 1; } @@ -222,7 +222,7 @@ static int switch_draw(vo_frame_t *frame, xine_stream_t *stream) for (source_num = 1; source_num <= this->source_count; source_num++) if (this->post.xine_post.video_input[source_num-1] == frame->port) break; _x_assert(source_num <= this->source_count); - + pthread_mutex_lock(&this->mutex); /* the original output will probably never see this frame again */ _x_post_frame_u_turn(frame, stream); @@ -249,6 +249,6 @@ static int switch_draw(vo_frame_t *frame, xine_stream_t *stream) skip = 0; pthread_mutex_unlock(&this->mutex); } - + return skip; } diff --git a/src/post/planar/Makefile.am b/src/post/planar/Makefile.am index f706e4a7b..039da4fc4 100644 --- a/src/post/planar/Makefile.am +++ b/src/post/planar/Makefile.am @@ -2,8 +2,8 @@ include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common AM_CFLAGS = $(VISIBILITY_FLAG) -AM_CPPFLAGS = -AM_LDFLAGS = +AM_CPPFLAGS = +AM_LDFLAGS = noinst_LTLIBRARIES = libpost_planar_asm.la libpost_planar_asm_la_SOURCES = eq.c eq2.c noise.c diff --git a/src/post/planar/boxblur.c b/src/post/planar/boxblur.c index 182d088c4..ea3085ffd 100644 --- a/src/post/planar/boxblur.c +++ b/src/post/planar/boxblur.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -36,7 +36,7 @@ void *boxblur_init_plugin(xine_t *xine, void *); typedef struct post_plugin_boxblur_s post_plugin_boxblur_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct boxblur_parameters_s { @@ -51,13 +51,13 @@ typedef struct boxblur_parameters_s { * description of params struct */ START_PARAM_DESCR( boxblur_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_radius, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_radius, NULL, 0, 10, 0, "radius of luma blur" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_power, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_power, NULL, 0, 10, 0, "power of luma blur" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_radius, NULL, -1, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_radius, NULL, -1, 10, 0, "radius of chroma blur (-1 = same as luma)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_power, NULL, -1, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_power, NULL, -1, 10, 0, "power of chroma blur (-1 = same as luma)" ) END_PARAM_DESCR( param_descr ) @@ -96,7 +96,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -141,7 +141,7 @@ void *boxblur_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = boxblur_open_plugin; class->identifier = "boxblur"; class->description = N_("box blur filter from mplayer"); @@ -160,14 +160,14 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); - + this->params.luma_radius = 2; this->params.luma_power = 1; this->params.chroma_radius = -1; @@ -178,7 +178,7 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = boxblur_intercept_frame; port->new_frame->draw = boxblur_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -187,18 +187,18 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "boxblured video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = boxblur_dispose; - + return &this->post; } static void boxblur_dispose(post_plugin_t *this_gen) { post_plugin_boxblur_t *this = (post_plugin_boxblur_t *)this_gen; - + if (_x_post_dispose(this_gen)) { pthread_mutex_destroy(&this->lock); free(this); @@ -243,7 +243,7 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int radius, int dstSt static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int power, int dstStep, int srcStep){ uint8_t temp[2][4096]; uint8_t *a= temp[0], *b=temp[1]; - + if(radius){ blur(a, src, w, radius, 1, srcStep); for(; power>2; power--){ @@ -267,9 +267,9 @@ static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int powe static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){ int y; - + if(radius==0 && dst==src) return; - + for(y=0; y<h; y++){ blur2(dst + y*dstStride, src + y*srcStride, w, radius, power, 1, 1); } @@ -277,7 +277,7 @@ static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int s static void vBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){ int x; - + if(radius==0 && dst==src) return; for(x=0; x<w; x++){ @@ -326,25 +326,25 @@ static int boxblur_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_lock (&this->lock); - chroma_radius = (this->params.chroma_radius != -1) ? this->params.chroma_radius : + chroma_radius = (this->params.chroma_radius != -1) ? this->params.chroma_radius : this->params.luma_radius; - chroma_power = (this->params.chroma_power != -1) ? this->params.chroma_power : + chroma_power = (this->params.chroma_power != -1) ? this->params.chroma_power : this->params.luma_power; cw = yv12_frame->width/2; ch = yv12_frame->height/2; - hBlur(out_frame->base[0], yv12_frame->base[0], yv12_frame->width, yv12_frame->height, + hBlur(out_frame->base[0], yv12_frame->base[0], yv12_frame->width, yv12_frame->height, out_frame->pitches[0], yv12_frame->pitches[0], this->params.luma_radius, this->params.luma_power); - hBlur(out_frame->base[1], yv12_frame->base[1], cw,ch, + hBlur(out_frame->base[1], yv12_frame->base[1], cw,ch, out_frame->pitches[1], yv12_frame->pitches[1], chroma_radius, chroma_power); - hBlur(out_frame->base[2], yv12_frame->base[2], cw,ch, + hBlur(out_frame->base[2], yv12_frame->base[2], cw,ch, out_frame->pitches[2], yv12_frame->pitches[2], chroma_radius, chroma_power); - vBlur(out_frame->base[0], out_frame->base[0], yv12_frame->width, yv12_frame->height, + vBlur(out_frame->base[0], out_frame->base[0], yv12_frame->width, yv12_frame->height, out_frame->pitches[0], out_frame->pitches[0], this->params.luma_radius, this->params.luma_power); - vBlur(out_frame->base[1], out_frame->base[1], cw,ch, + vBlur(out_frame->base[1], out_frame->base[1], cw,ch, out_frame->pitches[1], out_frame->pitches[1], chroma_radius, chroma_power); - vBlur(out_frame->base[2], out_frame->base[2], cw,ch, + vBlur(out_frame->base[2], out_frame->base[2], cw,ch, out_frame->pitches[2], out_frame->pitches[2], chroma_radius, chroma_power); pthread_mutex_unlock (&this->lock); diff --git a/src/post/planar/denoise3d.c b/src/post/planar/denoise3d.c index c87f5f078..793a377c7 100644 --- a/src/post/planar/denoise3d.c +++ b/src/post/planar/denoise3d.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -44,7 +44,7 @@ typedef struct post_plugin_denoise3d_s post_plugin_denoise3d_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct denoise3d_parameters_s { @@ -58,11 +58,11 @@ typedef struct denoise3d_parameters_s { * description of params struct */ START_PARAM_DESCR( denoise3d_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma, NULL, 0, 10, 0, "spatial luma strength" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma, NULL, 0, 10, 0, "spatial chroma strength" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, time, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, time, NULL, 0, 10, 0, "temporal strength" ) END_PARAM_DESCR( param_descr ) @@ -129,7 +129,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -181,7 +181,7 @@ void *denoise3d_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = denoise3d_open_plugin; class->identifier = "denoise3d"; class->description = N_("3D Denoiser (variable lowpass filter)"); @@ -200,14 +200,14 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } _x_post_init(&this->post, 0, 1); - + this->params.luma = PARAM1_DEFAULT; this->params.chroma = PARAM2_DEFAULT; this->params.time = PARAM3_DEFAULT; @@ -219,7 +219,7 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, port->new_port.close = denoise3d_close; port->intercept_frame = denoise3d_intercept_frame; port->new_frame->draw = denoise3d_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -228,20 +228,20 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "denoise3d video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = denoise3d_dispose; set_parameters ((xine_post_t *)this, &this->params); - + return &this->post; } static void denoise3d_dispose(post_plugin_t *this_gen) { post_plugin_denoise3d_t *this = (post_plugin_denoise3d_t *)this_gen; - + if (_x_post_dispose(this_gen)) { pthread_mutex_destroy(&this->lock); free(this); @@ -273,10 +273,10 @@ static int denoise3d_intercept_frame(post_video_port_t *port, vo_frame_t *frame) #define LowPass(Prev, Curr, Coef) (((Prev)*Coef[Prev - Curr] + (Curr)*(65536-(Coef[Prev - Curr]))) / 65536) -static void deNoise(unsigned char *Frame, - unsigned char *FramePrev, - unsigned char *FrameDest, - unsigned char *LineAnt, +static void deNoise(unsigned char *Frame, + unsigned char *FramePrev, + unsigned char *FrameDest, + unsigned char *LineAnt, int W, int H, int sStride, int pStride, int dStride, int *Horizontal, int *Vertical, int *Temporal) { @@ -334,15 +334,15 @@ static int denoise3d_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -382,7 +382,7 @@ static int denoise3d_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c index 4e2460bb8..dcf9b47fb 100644 --- a/src/post/planar/eq.c +++ b/src/post/planar/eq.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -47,7 +47,7 @@ static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, in brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness; contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast; - + while (h--) { asm volatile ( "movq (%5), %%mm3 \n\t" @@ -125,7 +125,7 @@ void *eq_init_plugin(xine_t *xine, void *); typedef struct post_plugin_eq_s post_plugin_eq_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct eq_parameters_s { @@ -138,9 +138,9 @@ typedef struct eq_parameters_s { * description of params struct */ START_PARAM_DESCR( eq_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, brightness, NULL, -100, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, brightness, NULL, -100, 100, 0, "brightness" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, contrast, NULL, -100, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, contrast, NULL, -100, 100, 0, "contrast" ) END_PARAM_DESCR( param_descr ) @@ -179,7 +179,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -233,7 +233,7 @@ void *eq_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = eq_open_plugin; class->identifier = "eq"; class->description = N_("soft video equalizer"); @@ -252,7 +252,7 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; @@ -260,7 +260,7 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, process = process_C; #if defined(ARCH_X86) || defined(ARCH_X86_64) - if( xine_mm_accel() & MM_ACCEL_X86_MMX ) + if( xine_mm_accel() & MM_ACCEL_X86_MMX ) process = process_MMX; #endif @@ -270,14 +270,14 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, this->params.contrast = 0; pthread_mutex_init (&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_port.get_property = eq_get_property; port->new_port.set_property = eq_set_property; port->intercept_frame = eq_intercept_frame; port->new_frame->draw = eq_draw; - input_api = &this->params_input; + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; input_api->data = &post_api; @@ -285,11 +285,11 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "eqd video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = eq_dispose; - + return &this->post; } @@ -355,15 +355,15 @@ static int eq_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -389,7 +389,7 @@ static int eq_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index aeffcd4ae..a3e1acac1 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -114,7 +114,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src, int pel; short brvec[4]; short contvec[4]; - + contrast = (int) (par->c * 256 * 16); brightness = ((int) (100.0 * par->b + 100.0) * 511) / 200 - 128 - contrast / 32; @@ -269,7 +269,7 @@ void *eq2_init_plugin(xine_t *xine, void *); typedef struct post_plugin_eq2_s post_plugin_eq2_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct eq2_parameters_s { @@ -288,19 +288,19 @@ typedef struct eq2_parameters_s { * description of params struct */ START_PARAM_DESCR( eq2_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, gamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, gamma, NULL, 0, 5, 0, "gamma" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, brightness, NULL, -1, 1, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, brightness, NULL, -1, 1, 0, "brightness" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, contrast, NULL, 0, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, contrast, NULL, 0, 2, 0, "contrast" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, saturation, NULL, 0, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, saturation, NULL, 0, 2, 0, "saturation" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, rgamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, rgamma, NULL, 0, 5, 0, "rgamma" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, ggamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, ggamma, NULL, 0, 5, 0, "ggamma" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, bgamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, bgamma, NULL, 0, 5, 0, "bgamma" ) END_PARAM_DESCR( param_descr ) @@ -312,7 +312,7 @@ struct post_plugin_eq2_s { /* private data */ eq2_parameters_t params; xine_post_in_t params_input; - + vf_eq2_t eq2; pthread_mutex_t lock; @@ -352,7 +352,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -414,7 +414,7 @@ void *eq2_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = eq2_open_plugin; class->identifier = "eq2"; class->description = N_("Software video equalizer"); @@ -433,12 +433,12 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); memset(&this->eq2, 0, sizeof(this->eq2)); @@ -452,13 +452,13 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, this->eq2.bgamma = this->params.bgamma = 1.0; pthread_mutex_init(&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_port.get_property = eq2_get_property; port->new_port.set_property = eq2_set_property; port->intercept_frame = eq2_intercept_frame; port->new_frame->draw = eq2_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -467,13 +467,13 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "eqd video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = eq2_dispose; set_parameters ((xine_post_t *)this, &this->params); - + return &this->post; } @@ -547,15 +547,15 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -585,7 +585,7 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c index 3cecaf47d..513def84f 100644 --- a/src/post/planar/expand.c +++ b/src/post/planar/expand.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * $Id: + * $Id: * * expand video filter by James Stembridge 24/05/2003 * improved by Michael Roitzsch @@ -58,7 +58,7 @@ * bars to the left and right of the image and will then set up cropping * to efficiently remove the black border around the 4:3 image, which the * plugin would produce otherwise for this case. - */ + */ /* plugin class initialization function */ @@ -85,9 +85,9 @@ END_PARAM_DESCR(expand_param_descr) typedef struct post_expand_s { post_plugin_t post; - + xine_post_in_t parameter_input; - + int enable_automatic_shift; int overlay_y_offset; double aspect; @@ -111,8 +111,8 @@ static int expand_get_parameters(xine_post_t *this_gen, void *param_g static char *expand_get_help (void); /* replaced video port functions */ -static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, double ratio, +static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, + uint32_t height, double ratio, int format, int flags); /* replaced vo_frame functions */ @@ -128,15 +128,15 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen void *expand_init_plugin(xine_t *xine, void *data) { post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); - + if (!class) return NULL; - + class->open_plugin = expand_open_plugin; class->identifier = "expand"; class->description = N_("add black borders to top and bottom of video to expand it to 4:3 aspect ratio"); class->dispose = default_post_class_dispose; - + return class; } @@ -152,46 +152,46 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, post_video_port_t *port; static xine_post_api_t post_api = { expand_set_parameters, expand_get_parameters, expand_get_param_descr, expand_get_help }; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); - + this->enable_automatic_shift = 0; this->overlay_y_offset = 0; this->aspect = 4.0 / 3.0; this->centre_cut_out_mode = 0; this->cropping_active = 0; - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_port.get_frame = expand_get_frame; port->new_frame->draw = expand_draw; port->intercept_ovl = expand_intercept_ovl; port->new_manager->add_event = expand_overlay_add_event; - + input_param = &this->parameter_input; input_param->name = "parameters"; input_param->type = XINE_POST_DATA_PARAMETERS; input_param->data = &post_api; xine_list_push_back(this->post.input, input_param); - + input->xine_in.name = "video"; output->xine_out.name = "expanded video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = expand_dispose; - + return &this->post; } static void expand_dispose(post_plugin_t *this_gen) { post_expand_t *this = (post_expand_t *)this_gen; - + if (_x_post_dispose(this_gen)) free(this); } @@ -219,12 +219,12 @@ static int expand_get_parameters(xine_post_t *this_gen, void *param_gen) { post_expand_t *this = (post_expand_t *)this_gen; expand_parameters_t *param = (expand_parameters_t *)param_gen; - + param->enable_automatic_shift = this->enable_automatic_shift; param->overlay_y_offset = this->overlay_y_offset; param->aspect = this->aspect; param->centre_cut_out_mode = this->centre_cut_out_mode; - + return 1; } @@ -252,7 +252,7 @@ static int is_pixel_black(vo_frame_t *frame, int x, int y) if (x >= frame->width) x = frame->width - 1; if (y < 0) y = 0; if (y >= frame->height) y = frame->height - 1; - + switch (frame->format) { case XINE_IMGFMT_YV12: @@ -260,7 +260,7 @@ static int is_pixel_black(vo_frame_t *frame, int x, int y) Cr = *(frame->base[ 1 ] + frame->pitches[ 1 ] * y / 2 + x / 2); Cb = *(frame->base[ 2 ] + frame->pitches[ 2 ] * y / 2 + x / 2); break; - + case XINE_IMGFMT_YUY2: Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 0); x &= ~1; @@ -321,8 +321,8 @@ static int expand_draw(vo_frame_t *frame, xine_stream_t *stream) } -static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, double ratio, +static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; @@ -330,27 +330,27 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, vo_frame_t *frame; uint32_t new_height, top_bar_height; int i, end; - + _x_post_rewire(&this->post); - + if (ratio <= 0.0) ratio = (double)width / (double)height; - + /* Calculate height of expanded frame */ new_height = (double)height * ratio / this->aspect; new_height = (new_height + 1) & ~1; top_bar_height = (new_height - height) / 2; top_bar_height = (top_bar_height + 1) & ~1; - + this->top_bar_height = top_bar_height; if (new_height > height && (format == XINE_IMGFMT_YV12 || format == XINE_IMGFMT_YUY2)) { frame = port->original_port->get_frame(port->original_port, width, new_height, this->aspect, format, flags); - + _x_post_inc_usage(port); frame = _x_post_intercept_video_frame(frame, port); - + /* paint black bars in the top and bottom of the frame and hide these * from the decoders by modifying the pointers to and * the size of the drawing area */ @@ -395,7 +395,7 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, width, height, ratio, format, flags); /* no need to intercept this one, we are not going to do anything with it */ } - + return frame; } @@ -405,7 +405,7 @@ static int expand_intercept_ovl(post_video_port_t *port) post_expand_t *this = (post_expand_t *)port->post; if (this->centre_cut_out_mode && this->cropping_active) return 0; - + /* we always intercept overlay manager */ return 1; } @@ -416,7 +416,7 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen, void video_overlay_event_t *event = (video_overlay_event_t *)event_gen; post_video_port_t *port = _x_post_ovl_manager_to_port(this_gen); post_expand_t *this = (post_expand_t *)port->post; - + if (event->event_type == OVERLAY_EVENT_SHOW) { switch (event->object.object_type) { case 0: @@ -431,6 +431,6 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen, void event->object.overlay->y += this->top_bar_height; } } - + return port->original_manager->add_event(port->original_manager, event_gen); } diff --git a/src/post/planar/fill.c b/src/post/planar/fill.c index 5aacfd679..c79033a72 100644 --- a/src/post/planar/fill.c +++ b/src/post/planar/fill.c @@ -12,7 +12,7 @@ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,15 +46,15 @@ static int fill_draw(vo_frame_t *frame, xine_stream_t *stream); void *fill_init_plugin(xine_t *xine, void *data) { post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); - + if (!class) return NULL; - + class->open_plugin = fill_open_plugin; class->identifier = "fill"; class->description = N_("crops left and right of video to fill 4:3 aspect ratio"); class->dispose = default_post_class_dispose; - + return class; } @@ -67,25 +67,25 @@ static post_plugin_t *fill_open_plugin(post_class_t *class_gen, int inputs, post_in_t *input; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(this, 0, 1); - + port = _x_post_intercept_video_port(this, video_target[0], &input, &output); port->new_port.get_frame = fill_get_frame; port->new_frame->draw = fill_draw; - + input->xine_in.name = "video"; output->xine_out.name = "cropped video"; - + this->xine_post.video_input[0] = &port->new_port; - + this->dispose = fill_dispose; - + return this; } @@ -96,33 +96,33 @@ static void fill_dispose(post_plugin_t *this) } -static vo_frame_t *fill_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, double ratio, +static vo_frame_t *fill_get_frame(xine_video_port_t *port_gen, uint32_t width, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; post_plugin_t *this = port->post; vo_frame_t *frame; - + _x_post_rewire(this); - + if (ratio <= 0.0) ratio = (double)width / (double)height; - + if ((ratio > 4.0/3.0) && (format == XINE_IMGFMT_YV12 || format == XINE_IMGFMT_YUY2)) { frame = port->original_port->get_frame(port->original_port, width, height, 4.0/3.0, format, flags); - + _x_post_inc_usage(port); frame = _x_post_intercept_video_frame(frame, port); - + frame->ratio = ratio; } else { frame = port->original_port->get_frame(port->original_port, width, height, ratio, format, flags); /* no need to intercept this one, we are not going to do anything with it */ } - + return frame; } @@ -130,13 +130,13 @@ static vo_frame_t *fill_get_frame(xine_video_port_t *port_gen, uint32_t width, static int fill_draw(vo_frame_t *frame, xine_stream_t *stream) { int skip, new_width; - + new_width = (4.0*frame->width) / (3.0*frame->ratio); - + frame->crop_left += (frame->width - new_width) / 2; frame->crop_right += (frame->width + 1 - new_width) / 2; frame->ratio = 4.0/3.0; - + _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); _x_post_frame_copy_up(frame, frame->next); diff --git a/src/post/planar/invert.c b/src/post/planar/invert.c index 17f237fd7..462b8fa7b 100644 --- a/src/post/planar/invert.c +++ b/src/post/planar/invert.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* * simple video inverter plugin */ @@ -47,15 +47,15 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream); void *invert_init_plugin(xine_t *xine, void *data) { post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); - + if (!class) return NULL; - + class->open_plugin = invert_open_plugin; class->identifier = "invert"; class->description = N_("inverts the colours of every video frame"); class->dispose = default_post_class_dispose; - + return class; } @@ -68,23 +68,23 @@ static post_plugin_t *invert_open_plugin(post_class_t *class_gen, int inputs, post_in_t *input; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(this, 0, 1); - + port = _x_post_intercept_video_port(this, video_target[0], &input, &output); port->intercept_frame = invert_intercept_frame; port->new_frame->draw = invert_draw; input->xine_in.name = "video"; output->xine_out.name = "inverted video"; this->xine_post.video_input[0] = &port->new_port; - + this->dispose = invert_dispose; - + return this; } @@ -106,18 +106,18 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream) post_video_port_t *port = (post_video_port_t *)frame->port; vo_frame_t *inverted_frame; int size, i, skip; - + if (frame->bad_frame) { _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); _x_post_frame_copy_up(frame, frame->next); return skip; } - + inverted_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, frame->format, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, inverted_frame); - + switch (inverted_frame->format) { case XINE_IMGFMT_YUY2: size = inverted_frame->pitches[0] * inverted_frame->height; @@ -138,10 +138,10 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream) for (i = 0; i < size; i++) inverted_frame->base[2][i] = 0xff - frame->base[2][i]; break; - } + } skip = inverted_frame->draw(inverted_frame, stream); _x_post_frame_copy_up(frame, inverted_frame); inverted_frame->free(inverted_frame); - + return skip; } diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index 3c6fd70dd..015925138 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -317,7 +317,7 @@ void *noise_init_plugin(xine_t *xine, void *); typedef struct post_plugin_noise_s post_plugin_noise_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct noise_parameters_s { int luma_strength, chroma_strength, @@ -331,15 +331,15 @@ static const char *const enum_quality[] = {"fixed", "temporal", "averaged tempor * description of params struct */ START_PARAM_DESCR( noise_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_strength, NULL, 0, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_strength, NULL, 0, 100, 0, "Amount of noise to add to luma channel" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_strength, NULL, 0, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_strength, NULL, 0, 100, 0, "Amount of noise to add to chroma channel" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, quality, enum_quality, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, quality, enum_quality, 0, 0, 0, "Quality level of noise" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, type, enum_types, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, type, enum_types, 0, 0, 0, "Type of noise" ) -PARAM_ITEM( POST_PARAM_TYPE_BOOL, pattern, NULL, 0, 1, 0, +PARAM_ITEM( POST_PARAM_TYPE_BOOL, pattern, NULL, 0, 1, 0, "Mix random noise with a (semi)regular pattern" ) END_PARAM_DESCR( param_descr ) @@ -356,7 +356,7 @@ struct post_plugin_noise_s { }; -static int set_parameters (xine_post_t *this_gen, void *param_gen) +static int set_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_noise_t *this = (post_plugin_noise_t *)this_gen; noise_parameters_t *param = (noise_parameters_t *)param_gen; @@ -378,7 +378,7 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) return 1; } -static int get_parameters (xine_post_t *this_gen, void *param_gen) +static int get_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_noise_t *this = (post_plugin_noise_t *)this_gen; noise_parameters_t *param = (noise_parameters_t *)param_gen; @@ -397,7 +397,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) pthread_mutex_unlock (&this->lock); return 1; } - + static xine_post_api_descr_t *get_param_descr (void) { return ¶m_descr; } @@ -452,7 +452,7 @@ void *noise_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = noise_open_plugin; class->identifier = "noise"; class->description = N_("Adds noise"); @@ -480,12 +480,12 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_video_port_t *port; noise_parameters_t params; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); memset(¶ms, 0, sizeof(noise_parameters_t)); @@ -495,11 +495,11 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, params.quality = 2; pthread_mutex_init(&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = noise_intercept_frame; port->new_frame->draw = noise_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -508,13 +508,13 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "filtered video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = noise_dispose; set_parameters ((xine_post_t *)this, ¶ms); - + return &this->post; } @@ -544,7 +544,7 @@ static int noise_draw(vo_frame_t *frame, xine_stream_t *stream) vo_frame_t *out_frame; int skip; - if (frame->bad_frame || + if (frame->bad_frame || (this->params[0].strength == 0 && this->params[1].strength == 0)) { _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); @@ -554,26 +554,26 @@ static int noise_draw(vo_frame_t *frame, xine_stream_t *stream) frame->lock(frame); out_frame = port->original_port->get_frame(port->original_port, - frame->width, frame->height, frame->ratio, frame->format, + frame->width, frame->height, frame->ratio, frame->format, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, out_frame); pthread_mutex_lock (&this->lock); if (frame->format == XINE_IMGFMT_YV12) { - noise(out_frame->base[0], frame->base[0], - out_frame->pitches[0], frame->pitches[0], + noise(out_frame->base[0], frame->base[0], + out_frame->pitches[0], frame->pitches[0], frame->width, frame->height, &this->params[0]); - noise(out_frame->base[1], frame->base[1], - out_frame->pitches[1], frame->pitches[1], + noise(out_frame->base[1], frame->base[1], + out_frame->pitches[1], frame->pitches[1], frame->width/2, frame->height/2, &this->params[1]); - noise(out_frame->base[2], frame->base[2], - out_frame->pitches[2], frame->pitches[2], + noise(out_frame->base[2], frame->base[2], + out_frame->pitches[2], frame->pitches[2], frame->width/2, frame->height/2, &this->params[1]); } else { // Chroma strength is ignored for YUY2. - noise(out_frame->base[0], frame->base[0], - out_frame->pitches[0], frame->pitches[0], + noise(out_frame->base[0], frame->base[0], + out_frame->pitches[0], frame->pitches[0], frame->width * 2, frame->height, &this->params[0]); } diff --git a/src/post/planar/planar.c b/src/post/planar/planar.c index 35177230a..e2bd65846 100644 --- a/src/post/planar/planar.c +++ b/src/post/planar/planar.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -59,7 +59,7 @@ extern void *noise_init_plugin(xine_t *xine, void *); static const post_info_t noise_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 10, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, { PLUGIN_POST, 10, "fill", XINE_VERSION_CODE, &fill_special_info, &fill_init_plugin }, { PLUGIN_POST, 10, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index 64ebadfe9..b985b47aa 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -44,7 +44,7 @@ void *pp_init_plugin(xine_t *xine, void *); typedef struct post_plugin_pp_s post_plugin_pp_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct pp_parameters_s { @@ -57,9 +57,9 @@ typedef struct pp_parameters_s { * description of params struct */ START_PARAM_DESCR( pp_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, quality, NULL, 0, PP_QUALITY_MAX, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, quality, NULL, 0, PP_QUALITY_MAX, 0, "postprocessing quality" ) -PARAM_ITEM( POST_PARAM_TYPE_CHAR, mode, NULL, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_CHAR, mode, NULL, 0, 0, 0, "mode string (overwrites all other options except quality)" ) END_PARAM_DESCR( param_descr ) @@ -106,7 +106,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -157,7 +157,7 @@ void *pp_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = pp_open_plugin; class->identifier = "pp"; class->description = N_("plugin for ffmpeg libpostprocess"); @@ -177,14 +177,14 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_video_port_t *port; uint32_t cpu_caps; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } _x_post_init(&this->post, 0, 1); - + this->params.quality = 3; strcpy(this->params.mode, "de"); @@ -195,18 +195,18 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, this->pp_flags |= PP_CPU_CAPS_MMX; if(cpu_caps & MM_ACCEL_X86_MMXEXT) this->pp_flags |= PP_CPU_CAPS_MMX2; - if(cpu_caps & MM_ACCEL_X86_3DNOW) + if(cpu_caps & MM_ACCEL_X86_3DNOW) this->pp_flags |= PP_CPU_CAPS_3DNOW; this->pp_mode = NULL; this->pp_context = NULL; pthread_mutex_init (&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = pp_intercept_frame; port->new_frame->draw = pp_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -215,11 +215,11 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "pped video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = pp_dispose; - + return &this->post; } @@ -263,9 +263,9 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], @@ -279,12 +279,12 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) out_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, out_frame); pthread_mutex_lock (&this->lock); - if( !this->pp_context || + if( !this->pp_context || this->frame_width != yv12_frame->width || this->frame_height != yv12_frame->height ) { @@ -304,15 +304,15 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) } if(!this->pp_mode) - this->pp_mode = pp_get_mode_by_name_and_quality(this->params.mode, + this->pp_mode = pp_get_mode_by_name_and_quality(this->params.mode, this->params.quality); if(this->pp_mode) - pp_postprocess(yv12_frame->base, yv12_frame->pitches, - out_frame->base, out_frame->pitches, + pp_postprocess(yv12_frame->base, yv12_frame->pitches, + out_frame->base, out_frame->pitches, (frame->width+7)&(~7), frame->height, NULL, 0, - this->pp_mode, this->pp_context, + this->pp_mode, this->pp_context, 0 /*this->av_frame->pict_type*/); pthread_mutex_unlock (&this->lock); diff --git a/src/post/planar/unsharp.c b/src/post/planar/unsharp.c index 506f19f4c..ffa6a39df 100644 --- a/src/post/planar/unsharp.c +++ b/src/post/planar/unsharp.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -64,7 +64,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i uint32_t **SC = fp->SC; uint32_t SR[MAX_MATRIX_SIZE-1], Tmp1, Tmp2; - uint8_t* src2 = src; + uint8_t* src2 = src; int32_t res; int x, y, z; @@ -77,7 +77,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i if( !fp->amount ) { if( src == dst ) return; - if( dstStride == srcStride ) + if( dstStride == srcStride ) xine_fast_memcpy( dst, src, srcStride*height ); else for( y=0; y<height; y++, dst+=dstStride, src+=srcStride ) @@ -104,7 +104,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i if( x>=stepsX && y>=stepsY ) { uint8_t* srx = src - stepsY*srcStride + x - stepsX; uint8_t* dsx = dst - stepsY*dstStride + x - stepsX; - + res = (int32_t)*srx + ( ( ( (int32_t)*srx - (int32_t)((Tmp1+halfscale) >> scalebits) ) * amount ) >> 16 ); *dsx = res>255 ? 255 : res<0 ? 0 : (uint8_t)res; } @@ -123,7 +123,7 @@ void *unsharp_init_plugin(xine_t *xine, void *); typedef struct post_plugin_unsharp_s post_plugin_unsharp_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct unsharp_parameters_s { @@ -141,17 +141,17 @@ typedef struct unsharp_parameters_s { * description of params struct */ START_PARAM_DESCR( unsharp_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_width, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_width, NULL, 3, 11, 0, "width of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_height, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_height, NULL, 3, 11, 0, "height of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma_amount, NULL, -2, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma_amount, NULL, -2, 2, 0, "relative amount of sharpness/blur (=0 disable, <0 blur, >0 sharpen)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_width, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_width, NULL, 3, 11, 0, "width of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_height, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_height, NULL, 3, 11, 0, "height of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma_amount, NULL, -2, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma_amount, NULL, -2, 2, 0, "relative amount of sharpness/blur (=0 disable, <0 blur, >0 sharpen)" ) END_PARAM_DESCR( param_descr ) @@ -205,7 +205,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -267,7 +267,7 @@ void *unsharp_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = unsharp_open_plugin; class->identifier = "unsharp"; class->description = N_("unsharp mask & gaussian blur"); @@ -286,14 +286,14 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } _x_post_init(&this->post, 0, 1); - + this->params.luma_matrix_width = 5; this->params.luma_matrix_height = 5; this->params.luma_amount = 0.0; @@ -303,11 +303,11 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, this->params.chroma_amount = 0.0; pthread_mutex_init (&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = unsharp_intercept_frame; port->new_frame->draw = unsharp_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -316,13 +316,13 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "unsharped video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + set_parameters ((xine_post_t *)this, &this->params); - + this->post.dispose = unsharp_dispose; - + return &this->post; } @@ -381,15 +381,15 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -417,7 +417,7 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream) stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) fp->SC[z] = malloc( sizeof(*(fp->SC[z])) * (frame->width+2*stepsX) ); - + fp = &this->priv.chromaParam; stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; @@ -432,7 +432,7 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/visualizations/fft.c b/src/post/visualizations/fft.c index 01044987b..8e9364400 100644 --- a/src/post/visualizations/fft.c +++ b/src/post/visualizations/fft.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/post/visualizations/fft.h b/src/post/visualizations/fft.h index 1600430bc..358cec33c 100644 --- a/src/post/visualizations/fft.h +++ b/src/post/visualizations/fft.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c index 1f38d3478..2d13c4084 100644 --- a/src/post/visualizations/fftgraph.c +++ b/src/post/visualizations/fftgraph.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -66,7 +66,7 @@ struct post_plugin_fftgraph_s { /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; @@ -92,21 +92,21 @@ static void fade(int r1, int g1, int b1, int r2, int g2, int b2, uint32_t *yuy2_colors, int steps) { int i, r, g, b, y, u, v; - + for (i = 0; i < steps; i++) { r = r1 + (r2 - r1) * i / steps; g = g1 + (g2 - g1) * i / steps; b = b1 + (b2 - b1) * i / steps; - + y = COMPUTE_Y(r, g, b); u = COMPUTE_U(r, g, b); v = COMPUTE_V(r, g, b); - + *(yuy2_colors + i) = be2me_32((y << 24) | (u << 16) | (y << 8) | v); - + } } @@ -212,19 +212,19 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream int i,j; uint32_t *color_ptr; uint32_t last_color, yuy2_black; - + /* printf("fftgraph_port_open, port_gen=%p, stream=%p, this=%p\n", port_gen, stream, this); */ _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)FFTGRAPH_WIDTH / (double)FFTGRAPH_HEIGHT; - + this->channels = _x_ao_mode2channels(mode); if( this->channels > MAXCHANNELS ) this->channels = MAXCHANNELS; @@ -239,7 +239,7 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream this->fft = fft_new(FFT_BITS); this->cur_line = 0; - + /* compute colors */ color_ptr = this->yuy2_colors; /* black -> red */ @@ -253,7 +253,7 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream 40, 0, 160, color_ptr, 256); color_ptr += 256; - + /* blue -> green */ fade(40, 0, 160, 40, 160, 70, @@ -294,15 +294,15 @@ static void fftgraph_port_close(xine_audio_port_t *port_gen, xine_stream_t *stre post_plugin_fftgraph_t *this = (post_plugin_fftgraph_t *)port->post; port->stream = NULL; - + fft_dispose(this->fft); this->fft = NULL; this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } @@ -329,7 +329,7 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, /* pass data to original port */ port->original_port->put_buffer(port->original_port, buf, stream ); - + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ @@ -372,8 +372,8 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -385,10 +385,10 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; - if( this->fft ) + if( this->fft ) draw_fftgraph(this, frame); else frame->bad_frame = 1; @@ -431,7 +431,7 @@ static post_plugin_t *fftgraph_open_plugin(post_class_t *class_gen, int inputs, } _x_post_init(&this->post, 1, 0); - + this->metronom = _x_metronom_init(1, 0, class->xine); this->vo_port = video_target[0]; @@ -460,16 +460,16 @@ static post_plugin_t *fftgraph_open_plugin(post_class_t *class_gen, int inputs, void *fftgraph_init_plugin(xine_t *xine, void *data) { post_class_fftgraph_t *class = (post_class_fftgraph_t *)xine_xmalloc(sizeof(post_class_fftgraph_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = fftgraph_open_plugin; class->post_class.identifier = "fftgraph"; class->post_class.description = N_("fftgraph Visualization Post Plugin"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c index b6af2fc6c..3ec72fba8 100644 --- a/src/post/visualizations/fftscope.c +++ b/src/post/visualizations/fftscope.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -53,7 +53,7 @@ typedef struct post_class_fftscope_s post_class_fftscope_t; struct post_class_fftscope_s { post_class_t post_class; - + xine_t *xine; }; @@ -63,10 +63,10 @@ struct post_plugin_fftscope_s { /* private data */ xine_video_port_t *vo_port; post_out_t video_output; - + /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; @@ -277,12 +277,12 @@ static int fftscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)FFT_WIDTH/(double)FFT_HEIGHT; this->channels = _x_ao_mode2channels(mode); @@ -315,15 +315,15 @@ static void fftscope_port_close(xine_audio_port_t *port_gen, xine_stream_t *stre post_plugin_fftscope_t *this = (post_plugin_fftscope_t *)port->post; port->stream = NULL; - + fft_dispose(this->fft); this->fft = NULL; this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } @@ -393,8 +393,8 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -406,10 +406,10 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; - if( this->fft ) + if( this->fft ) draw_fftscope(this, frame); else frame->bad_frame = 1; @@ -423,7 +423,7 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, static void fftscope_dispose(post_plugin_t *this_gen) { post_plugin_fftscope_t *this = (post_plugin_fftscope_t *)this_gen; - + if (_x_post_dispose(this_gen)) { this->metronom->exit(this->metronom); @@ -450,7 +450,7 @@ static post_plugin_t *fftscope_open_plugin(post_class_t *class_gen, int inputs, free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); this->metronom = _x_metronom_init(1, 0, class->xine); @@ -481,16 +481,16 @@ static post_plugin_t *fftscope_open_plugin(post_class_t *class_gen, int inputs, void *fftscope_init_plugin(xine_t *xine, void *data) { post_class_fftscope_t *class = (post_class_fftscope_t *)xine_xmalloc(sizeof(post_class_fftscope_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = fftscope_open_plugin; class->post_class.identifier = "FFT Scope"; class->post_class.description = N_("FFT Scope"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return &class->post_class; } diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c index 751cb9bac..9c8a9c1fa 100644 --- a/src/post/visualizations/fooviz.c +++ b/src/post/visualizations/fooviz.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -60,7 +60,7 @@ struct post_plugin_fooviz_s { /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; @@ -90,7 +90,7 @@ static int fooviz_rewire_video(xine_post_out_t *output_gen, void *data) xine_video_port_t *old_port = *(xine_video_port_t **)output_gen->data; xine_video_port_t *new_port = (xine_video_port_t *)data; post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)output->post; - + if (!data) return 0; /* register our stream at the new output port */ @@ -109,12 +109,12 @@ static int fooviz_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)FOO_WIDTH/(double)FOO_HEIGHT; this->channels = _x_ao_mode2channels(mode); this->samples_per_frame = rate / FPS; @@ -133,18 +133,18 @@ static void fooviz_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)port->post; port->stream = NULL; - + this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, +static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)port->post; vo_frame_t *frame; @@ -153,34 +153,34 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, int samples_used = 0; int64_t pts = buf->vpts; int i, j; - + /* make a copy of buf data for private use */ if( this->buf.mem_size < buf->mem_size ) { this->buf.mem = realloc(this->buf.mem, buf->mem_size); this->buf.mem_size = buf->mem_size; } - memcpy(this->buf.mem, buf->mem, + memcpy(this->buf.mem, buf->mem, buf->num_frames*this->channels*((port->bits == 8)?1:2)); this->buf.num_frames = buf->num_frames; - + /* pass data to original port */ - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ - buf = &this->buf; + buf = &this->buf; this->sample_counter += buf->num_frames; - + j = (this->channels >= 2) ? 1 : 0; do { - + if( port->bits == 8 ) { data8 = (int8_t *)buf->mem; data8 += samples_used * this->channels; - + /* scale 8 bit data to 16 bits and convert to signed as well */ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) { @@ -190,24 +190,24 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, } else { data = buf->mem; data += samples_used * this->channels; - + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) { this->data[0][this->data_idx] = data[0]; this->data[1][this->data_idx] = data[j]; } } - + if( this->sample_counter >= this->samples_per_frame ) { - + samples_used += this->samples_per_frame; - + frame = this->vo_port->get_frame (this->vo_port, FOO_WIDTH, FOO_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -219,7 +219,7 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; memset(frame->base[0], this->current_yuv_byte, FOO_WIDTH * FOO_HEIGHT * 2); @@ -256,14 +256,14 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_out_t *outputv; post_audio_port_t *port; - + if (!this || !video_target || !video_target[0] || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); - + this->metronom = _x_metronom_init(1, 0, class->xine); this->vo_port = video_target[0]; @@ -272,7 +272,7 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, port->new_port.open = fooviz_port_open; port->new_port.close = fooviz_port_close; port->new_port.put_buffer = fooviz_port_put_buffer; - + outputv = &this->video_output; outputv->xine_out.name = "generated video"; outputv->xine_out.type = XINE_POST_DATA_VIDEO; @@ -280,9 +280,9 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, outputv->xine_out.rewire = fooviz_rewire_video; outputv->post = &this->post; xine_list_push_back(this->post.output, outputv); - + this->post.xine_post.audio_input[0] = &port->new_port; - + this->post.dispose = fooviz_dispose; return &this->post; @@ -292,17 +292,17 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, static void *fooviz_init_plugin(xine_t *xine, void *data) { post_class_fooviz_t *class = (post_class_fooviz_t *)xine_xmalloc(sizeof(post_class_fooviz_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = fooviz_open_plugin; class->post_class.identifier = "fooviz"; class->post_class.description = N_("fooviz"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return class; } @@ -310,7 +310,7 @@ static void *fooviz_init_plugin(xine_t *xine, void *data) static const post_info_t fooviz_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZATION }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 10, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c index c6861406e..ffd6f0842 100644 --- a/src/post/visualizations/oscope.c +++ b/src/post/visualizations/oscope.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -59,13 +59,13 @@ struct post_plugin_oscope_s { /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; short data [MAXCHANNELS][NUMSAMPLES]; audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */ - + int channels; int sample_counter; int samples_per_frame; @@ -130,7 +130,7 @@ static void draw_oscope_dots(post_plugin_oscope_t *this) { /* draw channel scope */ for (i = 0; i < NUMSAMPLES; i++) { - pixel_ptr = + pixel_ptr = ((OSCOPE_HEIGHT * (c * 2 + 1) / (2*this->channels) ) + (this->data[c][i] >> 9)) * OSCOPE_WIDTH + i; this->yuv.y[pixel_ptr] = 0xFF; this->yuv.u[pixel_ptr] = this->u_current; @@ -161,7 +161,7 @@ static int oscope_rewire_video(xine_post_out_t *output_gen, void *data) xine_video_port_t *old_port = *(xine_video_port_t **)output_gen->data; xine_video_port_t *new_port = (xine_video_port_t *)data; post_plugin_oscope_t *this = (post_plugin_oscope_t *)output->post; - + if (!data) return 0; old_port->close(old_port, XINE_ANON_STREAM); @@ -179,12 +179,12 @@ static int oscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)OSCOPE_WIDTH/(double)OSCOPE_HEIGHT; this->channels = _x_ao_mode2channels(mode); @@ -210,15 +210,15 @@ static void oscope_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void oscope_port_put_buffer (xine_audio_port_t *port_gen, +static void oscope_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_oscope_t *this = (post_plugin_oscope_t *)port->post; vo_frame_t *frame; @@ -227,32 +227,32 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, int samples_used = 0; int64_t pts = buf->vpts; int i, c; - + /* make a copy of buf data for private use */ if( this->buf.mem_size < buf->mem_size ) { this->buf.mem = realloc(this->buf.mem, buf->mem_size); this->buf.mem_size = buf->mem_size; } - memcpy(this->buf.mem, buf->mem, + memcpy(this->buf.mem, buf->mem, buf->num_frames*this->channels*((port->bits == 8)?1:2)); this->buf.num_frames = buf->num_frames; - + /* pass data to original port */ - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ - buf = &this->buf; - + buf = &this->buf; + this->sample_counter += buf->num_frames; - + do { - + if( port->bits == 8 ) { data8 = (int8_t *)buf->mem; data8 += samples_used * this->channels; - + /* scale 8 bit data to 16 bits and convert to signed as well */ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) @@ -261,23 +261,23 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, } else { data = buf->mem; data += samples_used * this->channels; - + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) for( c = 0; c < this->channels; c++) this->data[c][this->data_idx] = data[c]; } - + if( this->sample_counter >= this->samples_per_frame ) { - + samples_used += this->samples_per_frame; - + frame = this->vo_port->get_frame (this->vo_port, OSCOPE_WIDTH, OSCOPE_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -289,12 +289,12 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; - + draw_oscope_dots(this); yuv444_to_yuy2(&this->yuv, frame->base[0], frame->pitches[0]); - + frame->draw(frame, XINE_ANON_STREAM); frame->free(frame); @@ -307,7 +307,7 @@ static void oscope_dispose(post_plugin_t *this_gen) post_plugin_oscope_t *this = (post_plugin_oscope_t *)this_gen; if (_x_post_dispose(this_gen)) { - + this->metronom->exit(this->metronom); if(this->buf.mem) @@ -327,14 +327,14 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_out_t *outputv; post_audio_port_t *port; - + if (!this || !video_target || !video_target[0] || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); - + this->metronom = _x_metronom_init(1, 0, class->xine); this->vo_port = video_target[0]; @@ -343,7 +343,7 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, port->new_port.open = oscope_port_open; port->new_port.close = oscope_port_close; port->new_port.put_buffer = oscope_port_put_buffer; - + outputv = &this->video_output; outputv->xine_out.name = "generated video"; outputv->xine_out.type = XINE_POST_DATA_VIDEO; @@ -351,9 +351,9 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, outputv->xine_out.rewire = oscope_rewire_video; outputv->post = &this->post; xine_list_push_back(this->post.output, outputv); - + this->post.xine_post.audio_input[0] = &port->new_port; - + this->post.dispose = oscope_dispose; return &this->post; @@ -363,16 +363,16 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, void *oscope_init_plugin(xine_t *xine, void *data) { post_class_oscope_t *class = (post_class_oscope_t *)xine_xmalloc(sizeof(post_class_oscope_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = oscope_open_plugin; class->post_class.identifier = "Oscilloscope"; class->post_class.description = N_("Oscilloscope"); class->post_class.dispose = default_post_class_dispose; - + class->xine = xine; - + return &class->post_class; } |