aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvektor <devnull@localhost>2005-02-08 02:51:28 (GMT)
committervektor <devnull@localhost>2005-02-08 02:51:28 (GMT)
commit4b3a0fdab077b4729abe1dc7204ab2a18a1f4e27 (patch)
tree679eefd8331f8bf464c0ce437b2bf4b6512672a2
parent66c90d84cd6e53ff0cc0ee907a834cecf23dd1d6 (diff)
* plugins/double.c: Remove unused deinterlacers.
* plugins/gamedither.c: Remove unused deinterlacers. * plugins/greedy2frame.c: Remove unused deinterlacers. * plugins/simplemo.c: Remove unused deinterlacers. * plugins/twoframe.c: Remove unused deinterlacers. * plugins/videobob.c: Remove unused deinterlacers.
-rw-r--r--plugins/double.c69
-rw-r--r--plugins/gamedither.c63
-rw-r--r--plugins/greedy2frame.c203
-rw-r--r--plugins/simplemo.c226
-rw-r--r--plugins/twoframe.c269
-rw-r--r--plugins/videobob.c186
6 files changed, 0 insertions, 1016 deletions
diff --git a/plugins/double.c b/plugins/double.c
deleted file mode 100644
index 44ab0d4..0000000
--- a/plugins/double.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Line doubler deinterlacing plugin.
- *
- * Copyright (C) 2002 Billy Biggs <vektor@dumbterm.net>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#if defined (__SVR4) && defined (__sun)
-# include <sys/int_types.h>
-#else
-# include <stdint.h>
-#endif
-#include "speedy.h"
-#include "deinterlace.h"
-
-static void deinterlace_scanline_double( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- blit_packed422_scanline( output, data->t0, width );
-}
-
-static void copy_scanline( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- blit_packed422_scanline( output, data->m0, width );
-}
-
-
-static deinterlace_method_t doublemethod =
-{
- DEINTERLACE_PLUGIN_API_VERSION,
- "Line Doubler",
- "LineDoubler",
- 1,
- 0,
- 0,
- 0,
- 0,
- 1,
- deinterlace_scanline_double,
- copy_scanline,
- 0
-};
-
-#ifdef BUILD_TVTIME_PLUGINS
-void deinterlace_plugin_init( void )
-#else
-void double_plugin_init( void )
-#endif
-{
- register_deinterlace_method( &doublemethod );
-}
-
diff --git a/plugins/gamedither.c b/plugins/gamedither.c
deleted file mode 100644
index bb7bc83..0000000
--- a/plugins/gamedither.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (C) 2003 Billy Biggs <vektor@dumbterm.net>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include "speedy.h"
-#include "deinterlace.h"
-
-static void deinterlace_scanline_past_linear_interp( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- interpolate_packed422_scanline( output, data->t0, data->m1, width );
-}
-
-static void deinterlace_scanline_past_linear_copy( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- interpolate_packed422_scanline( output, data->t1, data->m0, width );
-}
-
-
-static deinterlace_method_t gamedithermethod =
-{
- DEINTERLACE_PLUGIN_API_VERSION,
- "Video game dither",
- "Past linear",
- 1,
- 0,
- 0,
- 0,
- 0,
- 1,
- deinterlace_scanline_past_linear_interp,
- deinterlace_scanline_past_linear_copy,
- 0
-};
-
-#ifdef BUILD_TVTIME_PLUGINS
-void deinterlace_plugin_init( void )
-#else
-void gamedither_plugin_init( void )
-#endif
-{
- register_deinterlace_method( &gamedithermethod );
-}
-
diff --git a/plugins/greedy2frame.c b/plugins/greedy2frame.c
deleted file mode 100644
index 659604a..0000000
--- a/plugins/greedy2frame.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- * Copyright (c) 2000 John Adcock, Tom Barry, Steve Grimm All rights reserved.
- * mmx.h port copyright (c) 2002 Billy Biggs <vektor@dumbterm.net>.
- *
- * This code is ported from DScaler: http://deinterlace.sf.net/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#if defined (__SVR4) && defined (__sun)
-# include <sys/int_types.h>
-#else
-# include <stdint.h>
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "attributes.h"
-#include "mmx.h"
-#include "mm_accel.h"
-#include "deinterlace.h"
-#include "speedtools.h"
-#include "speedy.h"
-
-static int GreedyTwoFrameThreshold = 4;
-static int GreedyTwoFrameThreshold2 = 8;
-
-static void deinterlace_greedytwoframe_packed422_scanline_mmxext( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
-#ifdef ARCH_X86
- const mmx_t Mask = { 0x7f7f7f7f7f7f7f7fULL };
- const mmx_t DwordOne = { 0x0000000100000001ULL };
- const mmx_t DwordTwo = { 0x0000000200000002ULL };
- mmx_t qwGreedyTwoFrameThreshold;
- uint8_t *m0 = data->m0;
- uint8_t *t1 = data->t1;
- uint8_t *b1 = data->b1;
- uint8_t *m2 = data->m2;
- uint8_t *t3 = data->t1;
- uint8_t *b3 = data->b1;
-
- qwGreedyTwoFrameThreshold.b[ 0 ] = GreedyTwoFrameThreshold;
- qwGreedyTwoFrameThreshold.b[ 1 ] = GreedyTwoFrameThreshold2;
- qwGreedyTwoFrameThreshold.b[ 2 ] = GreedyTwoFrameThreshold;
- qwGreedyTwoFrameThreshold.b[ 4 ] = GreedyTwoFrameThreshold;
- qwGreedyTwoFrameThreshold.b[ 6 ] = GreedyTwoFrameThreshold;
-
- width /= 4;
- while( width-- ) {
- movq_m2r( *m0, mm0 );
- movq_m2r( *t1, mm1 );
- movq_m2r( *b1, mm3 );
- movq_m2r( *m2, mm2 );
-
- // Average T1 and B1 so we can do interpolated bobbing if we bob onto T1.
- movq_r2r( mm3, mm7 ); // mm7 = B1
- pavgb_r2r( mm1, mm7 );
-
- // calculate |M1-M0| put result in mm4 need to keep mm0 intact
- // if we have a good processor then make mm0 the average of M1 and M0
- // which should make weave look better when there is small amounts of
- // movement
- movq_r2r( mm0, mm4 );
- movq_r2r( mm2, mm5 );
- psubusb_r2r( mm2, mm4 );
- psubusb_r2r( mm0, mm5 );
- por_r2r( mm5, mm4 );
- psrlw_i2r( 1, mm4 );
- pavgb_r2r( mm2, mm0 );
- pand_r2r( mm6, mm4 );
-
- // if |M1-M0| > Threshold we want dword worth of twos
- pcmpgtb_m2r( qwGreedyTwoFrameThreshold, mm4 );
- pand_m2r( Mask, mm4 ); // get rid of any sign bit
- pcmpgtd_m2r( DwordOne, mm4 ); // do we want to bob
- pandn_m2r( DwordTwo, mm4 );
-
- movq_m2r( *t3, mm2 ); // mm2 = T0
-
- // calculate |T1-T0| put result in mm5
- movq_r2r( mm2, mm5 );
- psubusb_r2r( mm1, mm5 );
- psubusb_r2r( mm2, mm1 );
- por_r2r( mm1, mm5 );
- psrlw_i2r( 1, mm5 );
- pand_r2r( mm6, mm5 );
-
- // if |T1-T0| > Threshold we want dword worth of ones
- pcmpgtb_m2r( qwGreedyTwoFrameThreshold, mm5 );
- pand_r2r( mm6, mm5 ); // get rid of any sign bit
- pcmpgtd_m2r( DwordOne, mm5 );
- pandn_m2r( DwordOne, mm5 );
- paddd_r2r( mm5, mm4 );
-
- movq_m2r( *b3, mm2 ); // B0
-
- // calculate |B1-B0| put result in mm5
- movq_r2r( mm2, mm5 );
- psubusb_r2r( mm3, mm5 );
- psubusb_r2r( mm2, mm3 );
- por_r2r( mm3, mm5 );
- psrlw_i2r( 1, mm5 );
- pand_r2r( mm6, mm5 );
-
- // if |B1-B0| > Threshold we want dword worth of ones
- pcmpgtb_m2r( qwGreedyTwoFrameThreshold, mm5 );
- pand_r2r( mm6, mm5 ); // get rid of any sign bit
- pcmpgtd_m2r( DwordOne, mm5 );
- pandn_m2r( DwordOne, mm5 );
- paddd_r2r( mm5, mm4 );
-
- pcmpgtd_m2r( DwordTwo, mm4 );
-
- movq_r2r( mm4, mm5 );
- // mm4 now is 1 where we want to weave and 0 where we want to bob
- pand_r2r( mm0, mm4 );
- pandn_r2r( mm7, mm5 );
- por_r2r( mm5, mm4 );
-
- movq_r2m( mm4, *output );
-
- // Advance to the next set of pixels.
- output += 8;
- m0 += 8;
- t1 += 8;
- b1 += 8;
- m2 += 8;
- t3 += 8;
- b3 += 8;
- }
- sfence();
- emms();
-#endif
-}
-
-static void copy_scanline( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- blit_packed422_scanline( output, data->m1, width );
-}
-
-
-static deinterlace_setting_t settings[] =
-{
- {
- "Greedy 2 Frame Luma Threshold",
- SETTING_SLIDER,
- &GreedyTwoFrameThreshold,
- 4, 0, 128, 1,
- 0
- },
- {
- "Greedy 2 Frame Chroma Threshold",
- SETTING_SLIDER,
- &GreedyTwoFrameThreshold2,
- 8, 0, 128, 1,
- 0
- }
-};
-
-static deinterlace_method_t greedymethod =
-{
- DEINTERLACE_PLUGIN_API_VERSION,
- "Greedy - 2-frame (DScaler)",
- "Greedy2Frame",
- 4,
- MM_ACCEL_X86_MMXEXT,
- 0,
- 2,
- settings,
- 1,
- copy_scanline,
- deinterlace_greedytwoframe_packed422_scanline_mmxext,
- 0
-};
-
-#ifdef BUILD_TVTIME_PLUGINS
-void deinterlace_plugin_init( void )
-#else
-void greedy2frame_plugin_init( void )
-#endif
-{
- register_deinterlace_method( &greedymethod );
-}
-
diff --git a/plugins/simplemo.c b/plugins/simplemo.c
deleted file mode 100644
index 730b94f..0000000
--- a/plugins/simplemo.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/**
- * Copyright (C) 2002 Billy Biggs <vektor@dumbterm.net>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/**
- * I just got Poynton's new book and this is just me playing around
- * with some of his filters.
- */
-
-#include <stdio.h>
-#include <stdint.h>
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "attributes.h"
-#include "mmx.h"
-#include "mm_accel.h"
-#include "speedy.h"
-#include "speedtools.h"
-#include "deinterlace.h"
-
-const int weight[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, // 128
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, // 96
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, // 64
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, // 32
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, // 128
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, // 96
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, // 64
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, // 32
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 4,
-
-// ---------------------
-
- 4, 4, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 32
-
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 64
-
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 96
-
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 128
-
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 32
-
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 64
-
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 96
-
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, // 128
-};
-
-static void deinterlace_scanline_slow( uint8_t *output,
- uint8_t *t1, uint8_t *m1,
- uint8_t *b1,
- uint8_t *t0, uint8_t *m0,
- uint8_t *b0, int width )
-{
- int drop = 2;
- int i;
-
- t1 += (drop - 2)*2;
- b1 += (drop - 2)*2;
- t0 += (drop - 2)*2;
- b0 += (drop - 2)*2;
- m1 += (drop - 2)*2;
- output += (drop - 2)*2;
-
- for( i = drop; i < width - drop; i++ ) {
-
-/* Best ?
- unsigned int curfield = t1[ 0 ] + b1[ 0 ] + t1[ 8 ] + b1[ 8 ] +
- ((t1[ 2 ] + t1[ 6 ] + b1[ 2 ] + b1[ 6 ])<<2) +
- ((t1[ 4 ] + b1[ 4 ])*6);
- unsigned int both = (curfield + ((m1[ 0 ] + m1[ 8 ] +
- ((m1[ 2 ] + m1[ 6 ])<<2) +
- (m1[ 4 ]*6))<<1))>>6;
-*/
-/*
- unsigned int curfield = t1[ 4 ] + b1[ 4 ];
- unsigned int both = (curfield + (m1[ 4 ]<<1))>>2;
-*/
-
-/* Medium?
-*/
-/*
- unsigned int curfield = t1[ 2 ] + t1[ 4 ] + b1[ 2 ] + b1[ 4 ];
- unsigned int both = (curfield + ((m1[ 2 ] + m1[ 4 ])<<1))>>3;
-*/
- unsigned int curfield = (t1[ 0 ] + t1[ 2 ] + t1[ 4 ] + t1[ 8 ] + b1[ 0 ] + b1[ 4 ] + b1[ 2 ] + b1[ 8 ])>>3;
- unsigned int both = (t0[ 0 ] + t0[ 2 ] + t0[ 4 ] + t0[ 8 ] + b0[ 0 ] + b0[ 2 ] + b0[ 4 ] + b0[ 8 ])>>3;
- unsigned int w;
- int diff;
-
- //curfield = (curfield)>>5;
- //curfield = curfield>>2;
-
- diff = both - curfield + 256;
- w = weight[ diff ];
-
- curfield = (t1[ 4 ] + b1[ 4 ])>>1;
-
- //if( i % 500 == 499 ) fprintf( stderr, "%d: %d\n", diff, w );
-
- if( w ) {
- output[ 4 ] = ((8 - w)*curfield + (w*m1[ 4 ])) >> 3;
- } else {
- output[ 4 ] = curfield;
- }
-
- /* Always average chroma for now. */
- output[ 5 ] = t1[ 5 ]; //(t1[ 5 ] + b1[ 5 ])>>1;
- output += 2;
- t1 += 2;
- b1 += 2;
- t0 += 2;
- b0 += 2;
- m1 += 2;
- }
- sfence();
- emms();
-}
-
-static void copy_scanline( uint8_t *output, uint8_t *m2,
- uint8_t *t1, uint8_t *m1,
- uint8_t *b1, uint8_t *t0,
- uint8_t *b0, int width )
-{
- blit_packed422_scanline( output, m2, width );
-}
-
-
-static deinterlace_method_t simplemo =
-{
- DEINTERLACE_PLUGIN_API_VERSION,
- "Simple Motion-Adaptive",
- "SimpleMo",
- 2,
- MM_ACCEL_X86_MMXEXT,
- 0,
- 0,
- 0,
- 1,
- deinterlace_scanline_slow,
- copy_scanline,
- 0
-};
-
-#ifdef BUILD_TVTIME_PLUGINS
-void deinterlace_plugin_init( void )
-#else
-void simplemo_plugin_init( void )
-#endif
-{
- register_deinterlace_method( &simplemo );
-}
-
diff --git a/plugins/twoframe.c b/plugins/twoframe.c
deleted file mode 100644
index 3e82552..0000000
--- a/plugins/twoframe.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/**
- * Copyright (c) 2000 Steven Grimm. All rights reserved.
- * mmx.h port copyright (c) 2002 Billy Biggs <vektor@dumbterm.net>.
- *
- * This code is ported from DScaler: http://deinterlace.sf.net/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <stdint.h>
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "attributes.h"
-#include "mmx.h"
-#include "mm_accel.h"
-#include "deinterlace.h"
-#include "speedy.h"
-
-/**
- * Deinterlace the latest field, attempting to weave wherever it won't cause
- * visible artifacts.
- *
- * The data from the most recently captured field is always copied to the overlay
- * verbatim. For the data from the previous field, the following algorithm is
- * applied to each pixel.
- *
- * We use the following notation for the top, middle, and bottom pixels
- * of concern:
- *
- * Field 1 | Field 2 | Field 3 | Field 4 |
- * | T0 | | T1 | scanline we copied in last iteration
- * M0 | | M1 | | intermediate scanline from alternate field
- * | B0 | | B1 | scanline we just copied
- *
- * We will weave M1 into the image if any of the following is true:
- * - M1 is similar to either B1 or T1. This indicates that no weave
- * artifacts would be visible. The SpatialTolerance setting controls
- * how far apart the luminances can be before pixels are considered
- * non-similar.
- * - T1 and B1 and M1 are old. In that case any weave artifact that
- * appears isn't due to fast motion, since it was there in the previous
- * frame too. By "old" I mean similar to their counterparts in the
- * previous frame; TemporalTolerance controls the maximum squared
- * luminance difference above which a pixel is considered "new".
- *
- * Pixels are processed 4 at a time using MMX instructions.
- *
- * SQUARING NOTE:
- * We square luminance differences to amplify the effects of large
- * differences and to avoid dealing with negative differences. Unfortunately,
- * we can't compare the square of difference directly against a threshold,
- * thanks to the lack of an MMX unsigned compare instruction. The
- * problem is that if we had two pixels with luminance 0 and 255,
- * the difference squared would be 65025, which is a negative
- * 16-bit signed value and would thus compare less than a threshold.
- * We get around this by dividing all the luminance values by two before
- * squaring them; this results in an effective maximum luminance
- * difference of 127, whose square (16129) is safely comparable.
- */
-
-static int TwoFrameTemporalTolerance = 300;
-static int TwoFrameSpatialTolerance = 600;
-
-static void deinterlace_twoframe_packed422_scanline_mmxext( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- const mmx_t YMask = { 0x00ff00ff00ff00ffULL };
- const mmx_t qwAllOnes = { 0xffffffffffffffffULL };
- mmx_t qwBobbedPixels;
- mmx_t qwSpatialTolerance;
- mmx_t qwTemporalTolerance;
-
- // divide by 4 because of squaring behavior.
- qwSpatialTolerance.w[ 0 ] = TwoFrameSpatialTolerance / 4;
- qwSpatialTolerance.w[ 1 ] = TwoFrameSpatialTolerance / 4;
- qwSpatialTolerance.w[ 2 ] = TwoFrameSpatialTolerance / 4;
- qwSpatialTolerance.w[ 3 ] = TwoFrameSpatialTolerance / 4;
-
- qwTemporalTolerance.w[ 0 ] = TwoFrameTemporalTolerance / 4;
- qwTemporalTolerance.w[ 1 ] = TwoFrameTemporalTolerance / 4;
- qwTemporalTolerance.w[ 2 ] = TwoFrameTemporalTolerance / 4;
- qwTemporalTolerance.w[ 3 ] = TwoFrameTemporalTolerance / 4;
-
- // TODO: Just bob any extra pixels.
-
- width /= 4;
- while( width-- ) {
- movq_m2r( *t1, mm0 ); // mm0 = T1
- movq_m2r( *b1, mm1 ); // mm1 = B1
- movq_m2r( *m1, mm2 ); // mm2 = M1
-
- // Average T1 and B1 so we can do interpolated bobbing if we bob onto T1.
- movq_r2r( mm1, mm7 ); // mm7 = B1
- pavgb_r2r( mm0, mm7 ); // mm7 = (T1+B1/2)
-
- movq_r2m( mm7, qwBobbedPixels );
-
- // Now that we've averaged them, we no longer care about the chroma
- // values of T1 and B1 (all our comparisons are luminance-only).
- pand_m2r( YMask, mm0 ); // mm0 = luminance(T1)
- pand_m2r( YMask, mm1 ); // mm1 = luminance(B1)
-
- // Find out whether M1 is new. "New" means the square of the
- // luminance difference between M1 and M0 is less than the temporal
- // tolerance.
- //
- movq_r2r( mm2, mm7 ); // mm7 = M1
- movq_m2r( *m0, mm4 ); // mm4 = M0
- pand_m2r( YMask, mm7 ); // mm7 = luminance(M1)
- movq_r2r( mm7, mm6 ); // mm6 = luminance(M1) used below
- pand_m2r( YMask, mm4 ); // mm4 = luminance(M0)
- psubsw_r2r( mm4, mm7 ); // mm7 = M1 - M0
- psraw_i2r( 1, mm7 ); // mm7 = M1 - M0 (see SQUARING NOTE above)
- pmullw_r2r( mm7, mm7 ); // mm7 = (M1 - M0) ^ 2
- pcmpgtw_m2r( qwTemporalTolerance, mm7 );
- // mm7 = 0xffff where (M1 - M0) ^ 2 > threshold, 0x0000 otherwise
-
-
- // Find out how different T1 and M1 are.
- movq_r2r( mm0, mm3 ); // mm3 = T1
- psubsw_r2r( mm6, mm3 ); // mm3 = T1 - M1
- psraw_i2r( 1, mm3 ); // mm3 = T1 - M1 (see SQUARING NOTE above)
- pmullw_r2r( mm3, mm3 ); // mm3 = (T1 - M1) ^ 2
- pcmpgtw_m2r( qwSpatialTolerance, mm3 );
- // mm3 = 0xffff where (T1 - M1) ^ 2 > threshold, 0x0000 otherwise
-
-
- // Find out how different B1 and M1 are.
- movq_r2r( mm1, mm4 ); // mm4 = B1
- psubsw_r2r( mm6, mm4 ); // mm4 = B1 - M1
- psraw_i2r( 1, mm4 ); // mm4 = B1 - M1 (see SQUARING NOTE above)
- pmullw_r2r( mm4, mm4 ); // mm4 = (B1 - M1) ^ 2
- pcmpgtw_m2r( qwSpatialTolerance, mm4 );
- // mm4 = 0xffff where (B1 - M1) ^ 2 > threshold, 0x0000 otherwise
-
-
- // We care about cases where M1 is different from both T1 and B1.
- pand_r2r( mm4, mm3 ); // mm3 = 0xffff where M1 is different from T1 and B1, 0x0000 otherwise
-
- // Find out whether T1 is new.
- movq_r2r( mm0, mm4 ); // mm4 = T1
- movq_m2r( *t0, mm5 ); // mm5 = T0
- pand_m2r( YMask, mm5 ); // mm5 = luminance(T0)
- psubsw_r2r( mm5, mm4 ); // mm4 = T1 - T0
- psraw_i2r( 1, mm4 ); // mm4 = T1 - T0 (see SQUARING NOTE above)
- pmullw_r2r( mm4, mm4 ); // mm4 = (T1 - T0) ^ 2 / 4
- pcmpgtw_m2r( qwTemporalTolerance, mm4 );
- // mm4 = 0xffff where (T1 - T0) ^ 2 > threshold, 0x0000 otherwise
-
- // Find out whether B1 is new.
- movq_r2r( mm1, mm5 ); // mm5 = B1
- movq_m2r( *b0, mm6 ); // mm6 = B0
- pand_m2r( YMask, mm6 ); // mm6 = luminance(B0)
- psubsw_r2r( mm6, mm5 ); // mm5 = B1 - B0
- psraw_i2r( 1, mm5 ); // mm5 = B1 - B0 (see SQUARING NOTE above)
- pmullw_r2r( mm5, mm5 ); // mm5 = (B1 - B0) ^ 2
- pcmpgtw_m2r( qwTemporalTolerance, mm5 );
- // mm5 = 0xffff where (B1 - B0) ^ 2 > threshold, 0x0000 otherwise
-
- // We care about cases where M1 is old and either T1 or B1 is old.
- por_r2r( mm5, mm4 ); // mm4 = 0xffff where T1 or B1 is new
- por_r2r( mm7, mm4 ); // mm4 = 0xffff where T1 or B1 or M1 is new
- movq_m2r( qwAllOnes, mm6 ); // mm6 = 0xffffffffffffffff
- pxor_r2r( mm6, mm4 ); // mm4 = 0xffff where T1 and B1 and M1 are old
-
- // Pick up the interpolated (T1+B1)/2 pixels.
- movq_m2r( qwBobbedPixels, mm1 );// mm1 = (T1 + B1) / 2
-
- // At this point:
- // mm1 = (T1+B1)/2
- // mm2 = M1
- // mm3 = mask, 0xffff where M1 is different from both T1 and B1
- // mm4 = mask, 0xffff where T1 and B1 and M1 are old
- // mm6 = 0xffffffffffffffff
- //
- // Now figure out where we're going to weave and where we're going to bob.
- // We'll weave if all pixels are old or M1 isn't different from both its
- // neighbors.
- pxor_r2r( mm6, mm3 ); // mm3 = 0xffff where M1 is the same as either T1 or B1
- por_r2r( mm4, mm3 ); // mm3 = 0xffff where M1 and T1 and B1 are old or M1 = T1 or B1
- pand_r2r( mm3, mm2 ); // mm2 = woven data where T1 or B1 isn't new or they're different
- pandn_r2r( mm1, mm3 ); // mm3 = bobbed data where T1 or B1 is new and they're similar
- por_r2r( mm2, mm3 ); // mm3 = finished pixels
-
- // Put the pixels in place.
- movq_r2m( mm3, *output );
-
- // Advance to the next set of pixels.
- output += 8;
- t0 += 8;
- m0 += 8;
- b0 += 8;
- t1 += 8;
- m1 += 8;
- b1 += 8;
- }
- sfence();
- emms();
-}
-
-static void copy_scanline( uint8_t *output, uint8_t *m2,
- uint8_t *t1, uint8_t *m1,
- uint8_t *b1, uint8_t *t0,
- uint8_t *b0, int width )
-{
- blit_packed422_scanline( output, m2, width );
-}
-
-
-static deinterlace_setting_t settings[] =
-{
- {
- "2 Frame Spatial Tolerance",
- SETTING_SLIDER,
- &TwoFrameSpatialTolerance,
- 600, 0, 5000, 10,
- 0
- },
- {
- "2 Frame Temporal Tolerance",
- SETTING_SLIDER,
- &TwoFrameTemporalTolerance,
- 300, 0, 5000, 10,
- 0
- }
-};
-
-static deinterlace_method_t twoframe =
-{
- DEINTERLACE_PLUGIN_API_VERSION,
- "TwoFrame (DScaler)",
- "2-Frame",
- 4,
- MM_ACCEL_X86_MMXEXT,
- 0,
- 2,
- settings,
- 1,
- deinterlace_twoframe_packed422_scanline_mmxext,
- copy_scanline,
- 0
-};
-
-#ifdef BUILD_TVTIME_PLUGINS
-void deinterlace_plugin_init( void )
-#else
-void twoframe_plugin_init( void )
-#endif
-{
- register_deinterlace_method( &twoframe );
-}
-
diff --git a/plugins/videobob.c b/plugins/videobob.c
deleted file mode 100644
index b401772..0000000
--- a/plugins/videobob.c
+++ /dev/null
@@ -1,186 +0,0 @@
-
-/**
- * Copyright (c) 2000 John Adcock. All rights reserved.
- * Based on code from Virtual Dub Plug-in by Gunnar Thalin
- * mmx.h port copyright (c) 2002 Billy Biggs <vektor@dumbterm.net>.
- *
- * This code is ported from DScaler: http://deinterlace.sf.net/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <stdint.h>
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "attributes.h"
-#include "mmx.h"
-#include "mm_accel.h"
-#include "deinterlace.h"
-#include "speedtools.h"
-#include "speedy.h"
-
-static int EdgeDetect = 625;
-static int JaggieThreshold = 73;
-
-/**
- * DeinterlaceFieldBob
- *
- * Deinterlaces a field with a tendency to bob rather than weave. Best for
- * high-motion scenes like sports.
- *
- * The algorithm for this was taken from the
- * Deinterlace - area based Vitual Dub Plug-in by
- * Gunnar Thalin
- */
-static void deinterlace_videobob_packed422_scanline_mmxext( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- const mmx_t YMask = { 0x00ff00ff00ff00ffULL };
- mmx_t qwEdgeDetect;
- mmx_t qwThreshold;
-
- qwEdgeDetect.w[ 0 ] = EdgeDetect;
- qwEdgeDetect.w[ 1 ] = EdgeDetect;
- qwEdgeDetect.w[ 2 ] = EdgeDetect;
- qwEdgeDetect.w[ 3 ] = EdgeDetect;
-
- qwThreshold.w[ 0 ] = JaggieThreshold;
- qwThreshold.w[ 1 ] = JaggieThreshold;
- qwThreshold.w[ 2 ] = JaggieThreshold;
- qwThreshold.w[ 3 ] = JaggieThreshold;
-
- READ_PREFETCH_2048( data->t1 );
- READ_PREFETCH_2048( data->m1 );
- READ_PREFETCH_2048( data->b1 );
-
- width /= 4;
- while( width-- ) {
- movq_m2r( *data->t1, mm0 );
- movq_m2r( *data->m1, mm1 );
- movq_m2r( *data->b1, mm2 );
-
- // get intensities in mm3 - 4
- movq_r2r( mm0, mm3 );
- movq_r2r( mm1, mm4 );
- movq_r2r( mm2, mm5 );
-
- pand_m2r( YMask, mm3 );
- pand_m2r( YMask, mm4 );
- pand_m2r( YMask, mm5 );
-
- // get average in mm0
- pavgb_r2r( mm2, mm0 );
-
-
- // work out (O1 - E) * (O2 - E) / 2 - EdgeDetect * (O1 - O2) ^ 2 >> 12
- // result will be in mm6
- psrlw_i2r( 1, mm3 );
- psrlw_i2r( 1, mm4 );
- psrlw_i2r( 1, mm5 );
-
- movq_r2r( mm3, mm6 );
- psubw_r2r( mm4, mm6 ); // mm6 = O1 - E
-
- movq_r2r( mm5, mm7 );
- psubw_r2r( mm4, mm7 ); // mm7 = O2 - E
-
- pmullw_r2r( mm7, mm6 ); // mm0 = (O1 - E) * (O2 - E)
-
- movq_r2r( mm3, mm7 );
- psubw_r2r( mm5, mm7 ); // mm7 = (O1 - O2)
- pmullw_r2r( mm7, mm7 ); // mm7 = (O1 - O2) ^ 2
- psrlw_i2r( 12, mm7 ); // mm7 = (O1 - O2) ^ 2 >> 12
- pmullw_m2r( qwEdgeDetect, mm7 );
- // mm7 = EdgeDetect * (O1 - O2) ^ 2 >> 12
-
- psubw_r2r( mm7, mm6 ); // mm6 is what we want
-
- pcmpgtw_m2r( qwThreshold, mm6 );
- movq_r2r( mm6, mm7 );
- pand_r2r( mm6, mm0 );
- pandn_r2r( mm1, mm7 );
- por_r2r( mm0, mm7 );
-
- movntq_r2m( mm7, *output );
-
- // Advance to the next set of pixels.
- output += 8;
- data->t0 += 8;
- data->m0 += 8;
- data->b0 += 8;
- data->t1 += 8;
- data->m1 += 8;
- data->b1 += 8;
- }
- sfence();
- emms();
-}
-
-static void copy_scanline( uint8_t *output,
- deinterlace_scanline_data_t *data,
- int width )
-{
- blit_packed422_scanline( output, data->m2, width );
-}
-
-
-static deinterlace_setting_t settings[] =
-{
- {
- "Weave edge detect",
- SETTING_SLIDER,
- &EdgeDetect,
- 625, 0, 10000, 5,
- 0
- },
- {
- "Weave Jaggie Threshold",
- SETTING_SLIDER,
- &JaggieThreshold,
- 73, 0, 5000, 5,
- 0
- }
-};
-
-static deinterlace_method_t bobmethod =
-{
- DEINTERLACE_PLUGIN_API_VERSION,
- "DScaler: VideoBob",
- "VideoBob",
- 2,
- MM_ACCEL_X86_MMXEXT,
- 0,
- 2,
- settings,
- 1,
- deinterlace_videobob_packed422_scanline_mmxext,
- copy_scanline,
- 0
-};
-
-#ifdef BUILD_TVTIME_PLUGINS
-void deinterlace_plugin_init( void )
-#else
-void videobob_plugin_init( void )
-#endif
-{
- register_deinterlace_method( &bobmethod );
-}
-

Privacy Policy