diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-06-13 01:48:09 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-06-13 01:48:09 +0000 |
commit | d349cabadd8f4b3530a9ae7049faa3f11387eab8 (patch) | |
tree | 8d6e84bc870bc7473ea55e18bf3b58062251c59d /src/post/deinterlace/deinterlace.c | |
parent | a6b05cacbf52dd3b3b7aa4974d81e2221e203097 (diff) | |
download | xine-lib-d349cabadd8f4b3530a9ae7049faa3f11387eab8.tar.gz xine-lib-d349cabadd8f4b3530a9ae7049faa3f11387eab8.tar.bz2 |
new deinterlacer plugin based on tvtime
(please report if compilation breaks on non-x86 plataform)
see xine-devel for more information
CVS patchset: 5032
CVS date: 2003/06/13 01:48:09
Diffstat (limited to 'src/post/deinterlace/deinterlace.c')
-rw-r--r-- | src/post/deinterlace/deinterlace.c | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/post/deinterlace/deinterlace.c b/src/post/deinterlace/deinterlace.c new file mode 100644 index 000000000..f797f28cf --- /dev/null +++ b/src/post/deinterlace/deinterlace.c @@ -0,0 +1,125 @@ +/** + * 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 <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> +#include "deinterlace.h" + +typedef struct methodlist_item_s methodlist_item_t; + +struct methodlist_item_s +{ + deinterlace_method_t *method; + methodlist_item_t *next; +}; + +static methodlist_item_t *methodlist = 0; +static initialized = 0; + +void register_deinterlace_method( deinterlace_method_t *method ) +{ + methodlist_item_t **dest; + + if( initialized ) + return; + + if( !methodlist ) { + dest = &methodlist; + } else { + methodlist_item_t *cur = methodlist; + while( cur->next ) cur = cur->next; + dest = &(cur->next); + } + + *dest = (methodlist_item_t *) malloc( sizeof( methodlist_item_t ) ); + if( *dest ) { + (*dest)->method = method; + (*dest)->next = 0; + } else { + fprintf( stderr, "deinterlace: Can't allocate memory.\n" ); + } +} + +int get_num_deinterlace_methods( void ) +{ + methodlist_item_t *cur = methodlist; + int count = 0; + while( cur ) { + count++; + cur = cur->next; + } + return count; +} + +deinterlace_method_t *get_deinterlace_method( int i ) +{ + methodlist_item_t *cur = methodlist; + + if( !cur ) return 0; + while( i-- ) { + if( !cur->next ) return 0; + cur = cur->next; + } + + return cur->method; +} + +void filter_deinterlace_methods( int accel, int fields_available ) +{ + methodlist_item_t *prev = 0; + methodlist_item_t *cur = methodlist; + + if( initialized ) + return; + + while( cur ) { + methodlist_item_t *next = cur->next; + int drop = 0; + + if( (cur->method->accelrequired & accel) != cur->method->accelrequired ) { + /* This method is no good, drop it from the list. */ + fprintf( stderr, "deinterlace: %s disabled: required " + "CPU accelleration features unavailable.\n", + cur->method->short_name ); + drop = 1; + } + if( cur->method->fields_required > fields_available ) { + /* This method is no good, drop it from the list. */ + fprintf( stderr, "deinterlace: %s disabled: requires " + "%d field buffers, only %d available.\n", + cur->method->short_name, cur->method->fields_required, + fields_available ); + drop = 1; + } + + if( drop ) { + if( prev ) { + prev->next = next; + } else { + methodlist = next; + } + free( cur ); + } else { + prev = cur; + } + cur = next; + } + initialized = 1; +} + |