vdr/xine-lib-vdr/src/post/deinterlace Makefile.am Makefile.in deinterlace.c deinterlace.h pulldown.h speedtools.h speedy.h tvtime.h xine_plugin.c

Darren Salt pkg-vdr-dvb-changes@lists.alioth.debian.org
Mon, 04 Apr 2005 22:38:20 +0000


Update of /cvsroot/pkg-vdr-dvb/vdr/xine-lib-vdr/src/post/deinterlace
In directory haydn:/tmp/cvs-serv13100/src/post/deinterlace

Added Files:
	Makefile.am Makefile.in deinterlace.c deinterlace.h pulldown.h 
	speedtools.h speedy.h tvtime.h xine_plugin.c 
Log Message:
Import of VDR-patched xine-lib.

--- NEW FILE: deinterlace.h ---
/**
 * 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.
 */

#ifndef DEINTERLACE_H_INCLUDED
#define DEINTERLACE_H_INCLUDED

#if HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <stdint.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

#define DEINTERLACE_PLUGIN_API_VERSION 0x00000004

/**
 * Our deinterlacer plugin API is modeled after DScaler's.  This module
 * represents the API that all deinterlacer plugins must export, and
 * also provides a registration mechanism for the application to be able
 * to iterate through available plugins and select an appropriate one.
 */

typedef struct deinterlace_setting_s deinterlace_setting_t;
typedef struct deinterlace_method_s deinterlace_method_t;
typedef struct deinterlace_scanline_data_s deinterlace_scanline_data_t;
typedef struct deinterlace_frame_data_s deinterlace_frame_data_t;

/**
 * Callback for setting change notification.
 */
typedef void (*setting_onchange_t)(deinterlace_setting_t *);

/**
 * Interface for plugin initialization.
 */
typedef void (*deinterlace_plugin_init_t)( void );

/**
 * There are two scanline functions that every deinterlacer plugin
 * must implement to do its work: one for a 'copy' and one for
 * an 'interpolate' for the currently active field.  This so so that
 * while plugins may be delaying fields, the external API assumes that
 * the plugin is completely realtime.
 *
 * Each deinterlacing routine can require data from up to four fields.
 * The most recent field captured is field 0, and increasing numbers go
 * backwards in time.
 */
struct deinterlace_scanline_data_s
{
    uint8_t *tt0, *t0, *m0, *b0, *bb0;
    uint8_t *tt1, *t1, *m1, *b1, *bb1;
    uint8_t *tt2, *t2, *m2, *b2, *bb2;
    uint8_t *tt3, *t3, *m3, *b3, *bb3;
    int bottom_field;
};

/**
 * |   t-3       t-2       t-1       t
 * | Field 3 | Field 2 | Field 1 | Field 0 |
 * |  TT3    |         |   TT1   |         |
 * |         |   T2    |         |   T0    |
 * |   M3    |         |    M1   |         |
 * |         |   B2    |         |   B0    |
 * |  BB3    |         |   BB1   |         |
 *
 * While all pointers are passed in, each plugin is only guarenteed for
 * the ones it indicates it requires (in the fields_required parameter)
 * to be available.
 *
 * Pointers are always to scanlines in the standard packed 4:2:2 format.
 */
typedef void (*deinterlace_interp_scanline_t)( uint8_t *output,
                                               deinterlace_scanline_data_t *data,
                                               int width );
/**
 * For the copy scanline, the API is basically the same, except that
 * we're given a scanline to 'copy'.
 *
 * |   t-3       t-2       t-1       t
 * | Field 3 | Field 2 | Field 1 | Field 0 |
 * |         |   TT2   |         |  TT0    |
 * |   T3    |         |   T1    |         |
 * |         |    M2   |         |   M0    |
 * |   B3    |         |   B1    |         |
 * |         |   BB2   |         |  BB0    |
 */
typedef void (*deinterlace_copy_scanline_t)( uint8_t *output,
                                             deinterlace_scanline_data_t *data,
                                             int width );

/**
 * The frame function is for deinterlacing plugins that can only act
 * on whole frames, rather than on a scanline at a time.
 */
struct deinterlace_frame_data_s
{
    uint8_t *f0;
    uint8_t *f1;
    uint8_t *f2;
    uint8_t *f3;
};

typedef void (*deinterlace_frame_t)( uint8_t *output, int outstride,
                                     deinterlace_frame_data_t *data,
                                     int bottom_field, int second_field, int width, int height );


/**
 * Plugin settings can be any of the following.
 */
typedef enum
{
    SETTING_ONOFF,
    SETTING_YESNO,
    SETTING_ITEMFROMLIST,
    SETTING_SLIDER
} setting_type_t;

/**
 * Each setting provides a pointer to the value, the min, max, default
 * and step increment, and if it's not 0, a function to be called
 * when the parameter is updated.
 */
struct deinterlace_setting_s
{
    const char *name;
    setting_type_t type;
    int *value;
    int defvalue;
    int minvalue;
    int maxvalue;
    int stepvalue;
    setting_onchange_t onchange;
};

/**
 * This structure defines the deinterlacer plugin.
 */
struct deinterlace_method_s
{
    int version;
    const char *name;
    const char *short_name;
    int fields_required;
    int accelrequired;
    int doscalerbob;
    int numsettings;
    deinterlace_setting_t *settings;
    int scanlinemode;
    deinterlace_interp_scanline_t interpolate_scanline;
    deinterlace_copy_scanline_t copy_scanline;
    deinterlace_frame_t deinterlace_frame;
    int delaysfield; /* delays output by one field relative to input */
};

/**
 * Registers a new deinterlace method.
 */
void register_deinterlace_method( deinterlace_method_t *method );

/**
 * Returns how many deinterlacing methods are available.
 */
int get_num_deinterlace_methods( void );

/**
 * Returns the specified method in the list.
 */
deinterlace_method_t *get_deinterlace_method( int i );

/**
 * Loads a deinterlace plugin from the given file.
 */
void register_deinterlace_plugin( const char *filename );

/**
 * Builds the usable method list.
 */
void filter_deinterlace_methods( int accel, int fieldsavailable );

#ifdef __cplusplus
};
#endif
#endif /* DEINTERLACE_H_INCLUDED */

--- NEW FILE: deinterlace.c ---
/**
 * 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.
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>

#define LOG_MODULE "deinterlace"
#define LOG_VERBOSE
/*
#define LOG
*/

#include "deinterlace.h"
#include "xine_internal.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;

void register_deinterlace_method( deinterlace_method_t *method )
{
    methodlist_item_t **dest = &methodlist;
    methodlist_item_t *cur = methodlist;

    while( cur ) {
        if( cur->method == method ) return;
        dest = &(cur->next);
        cur = cur->next;
    }

    *dest = malloc( sizeof( methodlist_item_t ) );
    if( *dest ) {
        (*dest)->method = method;
        (*dest)->next = 0;
    } else {
      printf( "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 register_deinterlace_plugin( const char *filename )
{
    void *handle = dlopen( filename, RTLD_NOW );

    if( !handle ) {
        printf( "deinterlace: Can't load plugin '%s': %s\n", filename, dlerror() );
    } else {
        deinterlace_plugin_init_t plugin_init;
        plugin_init = (deinterlace_plugin_init_t) dlsym( handle, "deinterlace_plugin_init" );
        if( plugin_init ) {
            plugin_init();
        }
    }
}

void filter_deinterlace_methods( int accel, int fields_available )
{
    methodlist_item_t *prev = 0;
    methodlist_item_t *cur = methodlist;

    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. */
	  lprintf( "%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. */
	  lprintf( "%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;
    }
}


--- NEW FILE: pulldown.h ---
/**
 * Copyright (c) 2001, 2002, 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.
 */

#ifndef PULLDOWN_H_INCLUDED
#define PULLDOWN_H_INCLUDED

#if HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <stdint.h>
#endif

#include "speedy.h"

#ifdef __cplusplus
extern "C" {
#endif

#define PULLDOWN_SEQ_AA (1<<0) /* next - prev */
#define PULLDOWN_SEQ_AB (1<<1) /* prev - next */
#define PULLDOWN_SEQ_BC (1<<2) /* prev - next */
#define PULLDOWN_SEQ_CC (1<<3) /* next - prev */
#define PULLDOWN_SEQ_DD (1<<4) /* next - prev */

#define PULLDOWN_ACTION_NEXT_PREV (1<<0) /* next - prev */
#define PULLDOWN_ACTION_PREV_NEXT (1<<1) /* prev - next */

/**
 * Returns 1 if the source is the previous field, 0 if it is
 * the next field, for the given action.
 */
int pulldown_source( int action, int bottom_field );

int determine_pulldown_offset( int top_repeat, int bot_repeat, int tff, int last_offset );
int determine_pulldown_offset_history( int top_repeat, int bot_repeat, int tff, int *realbest );
int determine_pulldown_offset_history_new( int top_repeat, int bot_repeat, int tff, int predicted );
int determine_pulldown_offset_short_history_new( int top_repeat, int bot_repeat, int tff, int predicted );
int determine_pulldown_offset_dalias( pulldown_metrics_t *old_peak, pulldown_metrics_t *old_relative,
                                      pulldown_metrics_t *old_mean, pulldown_metrics_t *new_peak,
                                      pulldown_metrics_t *new_relative, pulldown_metrics_t *new_mean );

void diff_factor_packed422_frame( pulldown_metrics_t *peak, pulldown_metrics_t *rel, pulldown_metrics_t *mean,
                                  uint8_t *old, uint8_t *new, int w, int h, int os, int ns );

int pulldown_drop( int action, int bottom_field );

#ifdef __cplusplus
};
#endif
#endif /* PULLDOWN_H_INCLUDED */

--- NEW FILE: tvtime.h ---
/**
 * Copyright (c) 2001, 2002, 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.
 */

#ifndef TVTIME_H_INCLUDED
#define TVTIME_H_INCLUDED

#if HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <stdint.h>
#endif

#include "deinterlace.h"

/**
 * Which pulldown algorithm we're using.
 */
enum {
    PULLDOWN_NONE = 0,
    PULLDOWN_VEKTOR = 1, /* vektor's adaptive pulldown detection. */
    PULLDOWN_DALIAS = 2, /* Using dalias's pulldown detection */
    PULLDOWN_MAX = 4,
};

enum
{
    FRAMERATE_FULL = 0,
    FRAMERATE_HALF_TFF = 1,
    FRAMERATE_HALF_BFF = 2,
    FRAMERATE_MAX = 3
};


typedef struct {
  /**
   * Which pulldown algorithm we're using.
   */
  unsigned int pulldown_alg;

  /**
   * Current deinterlacing method.
   */
  deinterlace_method_t *curmethod;


  /* internal data */
  int last_topdiff;
  int last_botdiff;

  int pdoffset;
  int pderror;
  int pdlastbusted;
  int filmmode;


} tvtime_t;


int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
                                             uint8_t *curframe,
                                             uint8_t *lastframe,
                                             uint8_t *secondlastframe,
                                             int bottom_field, int second_field,
                                             int width,
                                             int frame_height,
                                             int instride,
                                             int outstride );


int tvtime_build_copied_field( tvtime_t *this, uint8_t *output,
                                       uint8_t *curframe,
                                       int bottom_field,
                                       int width,
                                       int frame_height,
                                       int instride,
                                       int outstride );
tvtime_t *tvtime_new_context(void);

void tvtime_reset_context( tvtime_t *this );


#endif 

--- NEW FILE: speedy.h ---
/**
 * Copyright (c) 2002, 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.
 */

#ifndef SPEEDY_H_INCLUDED
#define SPEEDY_H_INCLUDED

#if HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <stdint.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Speedy is a collection of optimized functions plus their C fallbacks.
 * This includes a simple system to select which functions to use
 * at runtime.
 *
 * The optimizations are done with the help of the mmx.h system, from
 * libmpeg2 by Michel Lespinasse and Aaron Holtzman.
 *
 * The library is a collection of function pointers which must be first
 * initialized by setup_speedy_calls() to point at the fastest available
 * implementation of each function.
 */

/**
 * Struct for pulldown detection metrics.
 */
typedef struct pulldown_metrics_s {
    /* difference: total, even lines, odd lines */
    int d, e, o;
    /* noise: temporal, spacial (current), spacial (past) */
    int t, s, p;
} pulldown_metrics_t;

/**
 * Interpolates a packed 4:2:2 scanline using linear interpolation.
 */
extern void (*interpolate_packed422_scanline)( uint8_t *output, uint8_t *top,
                                               uint8_t *bot, int width );

/**
 * Blits a colour to a packed 4:2:2 scanline.
 */
extern void (*blit_colour_packed422_scanline)( uint8_t *output,
                                               int width, int y, int cb, int cr );

/**
 * Blits a colour to a packed 4:4:4:4 scanline.  I use luma/cb/cr instead of
 * RGB but this will of course work for either.
 */
extern void (*blit_colour_packed4444_scanline)( uint8_t *output,
                                                int width, int alpha, int luma,
                                                int cb, int cr );

/**
 * Blit from and to packed 4:2:2 scanline.
 */
extern void (*blit_packed422_scanline)( uint8_t *dest, const uint8_t *src, int width );

/**
 * Composites a packed 4:4:4:4 scanline onto a packed 4:2:2 scanline.
 * Chroma is downsampled by dropping samples (nearest neighbour).
 */
extern void (*composite_packed4444_to_packed422_scanline)( uint8_t *output,
                                                           uint8_t *input,
                                                           uint8_t *foreground,
                                                           int width );

/**
 * Composites a packed 4:4:4:4 scanline onto a packed 4:2:2 scanline.
 * Chroma is downsampled by dropping samples (nearest neighbour).  The
 * alpha value provided is in the range 0-256 and is first applied to
 * the input (for fadeouts).
 */
extern void (*composite_packed4444_alpha_to_packed422_scanline)( uint8_t *output,
                                                                 uint8_t *input,
                                                                 uint8_t *foreground,
                                                                 int width, int alpha );

/**
 * Takes an alphamask and the given colour (in Y'CbCr) and composites it
 * onto a packed 4:4:4:4 scanline.
 */
extern void (*composite_alphamask_to_packed4444_scanline)( uint8_t *output,
                                                           uint8_t *input,
                                                           uint8_t *mask, int width,
                                                           int textluma, int textcb,
                                                           int textcr );

/**
 * Takes an alphamask and the given colour (in Y'CbCr) and composites it
 * onto a packed 4:4:4:4 scanline.  The alpha value provided is in the
 * range 0-256 and is first applied to the input (for fadeouts).
 */
extern void (*composite_alphamask_alpha_to_packed4444_scanline)( uint8_t *output,
                                                                 uint8_t *input,
                                                                 uint8_t *mask, int width,
                                                                 int textluma, int textcb,
                                                                 int textcr, int alpha );

/**
 * Sub-pixel data bar renderer.  There are 128 bars.
 */
extern void (*composite_bars_packed4444_scanline)( uint8_t *output,
                                                   uint8_t *background, int width,
                                                   int a, int luma, int cb, int cr,
                                                   int percentage );


/**
 * Premultiplies the colour by the alpha channel in a packed 4:4:4:4
 * scanline.
 */
extern void (*premultiply_packed4444_scanline)( uint8_t *output, uint8_t *input, int width );

/**
 * Blend between two packed 4:2:2 scanline.  Pos is the fade value in
 * the range 0-256.  A value of 0 gives 100% src1, and a value of 256
 * gives 100% src2.  Anything in between gives the appropriate faded
 * version.
 */
extern void (*blend_packed422_scanline)( uint8_t *output, uint8_t *src1,
                                         uint8_t *src2, int width, int pos );

/**
 * Calculates the 'difference factor' for two scanlines.  This is a
 * metric where higher values indicate that the two scanlines are more
 * different.
 */
extern unsigned int (*diff_factor_packed422_scanline)( uint8_t *cur, uint8_t *old, int width );

/**
 * Calculates the 'comb factor' for a set of three scanlines.  This is a
 * metric where higher values indicate a more likely chance that the two
 * fields are at separate points in time.
 */
extern unsigned int (*comb_factor_packed422_scanline)( uint8_t *top, uint8_t *mid,
                                                       uint8_t *bot, int width );

/**
 * Vertical [1 2 1] chroma filter.
 */
extern void (*vfilter_chroma_121_packed422_scanline)( uint8_t *output, int width,
                                                      uint8_t *m, uint8_t *t, uint8_t *b );

/**
 * Vertical [3 3 2] chroma filter.
 */
extern void (*vfilter_chroma_332_packed422_scanline)( uint8_t *output, int width,
                                                      uint8_t *m, uint8_t *t, uint8_t *b );

/**
 * In-place [1 2 1] filter.
 */
extern void (*filter_luma_121_packed422_inplace_scanline)( uint8_t *data, int width );

/**
 * In-place [1 4 6 4 1] filter.
 */
extern void (*filter_luma_14641_packed422_inplace_scanline)( uint8_t *data, int width );

/**
 * Sets the chroma of the scanline to neutral (128) in-place.
 */
extern void (*kill_chroma_packed422_inplace_scanline)( uint8_t *data, int width );

/**
 * Mirrors the scanline in-place.
 */
extern void (*mirror_packed422_inplace_scanline)( uint8_t *data, int width );

/**
 * Mirrors the first half of the scanline onto the second half in-place.
 */
extern void (*halfmirror_packed422_inplace_scanline)( uint8_t *data, int width );

/**
 * Inverts the colours on a scanline in-place.
 */
extern void (*invert_colour_packed422_inplace_scanline)( uint8_t *data, int width );

/**
 * Fast memcpy function, used by all of the blit functions.  Won't blit
 * anything if dest == src.
 */
extern void *(*speedy_memcpy)( void *output, const void *input, size_t size );

/**
 * Calculates the block difference metrics for dalias' pulldown
 * detection algorithm.
 */
extern void (*diff_packed422_block8x8)( pulldown_metrics_t *m, uint8_t *old,
                                        uint8_t *new, int os, int ns );

/**
 * Takes an alpha mask and subpixelly blits it using linear
 * interpolation.
 */
extern void (*a8_subpix_blit_scanline)( uint8_t *output, uint8_t *input,
                                        int lasta, int startpos, int width );

/**
 * 1/4 vertical subpixel blit for packed 4:2:2 scanlines using linear
 * interpolation.
 */
extern void (*quarter_blit_vertical_packed422_scanline)( uint8_t *output, uint8_t *one,
                                                         uint8_t *three, int width );

/**
 * Vertical subpixel blit for packed 4:2:2 scanlines using linear
 * interpolation.
 */
extern void (*subpix_blit_vertical_packed422_scanline)( uint8_t *output, uint8_t *top,
                                                        uint8_t *bot, int subpixpos, int width );

/**
 * 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, 
                                                                  uint8_t *input,
                                                                  int width, int alpha );

/**
 * I think this function needs to be rethought and renamed, but here
 * it is for now.  This function horizontally resamples a scanline
 * using linear interpolation to compensate for a change in pixel
 * aspect ratio.
 */
extern void (*aspect_adjust_packed4444_scanline)( uint8_t *output,
                                                  uint8_t *input, 
                                                  int width,
                                                  double pixel_aspect );

/**
 * Convert a packed 4:4:4 surface to a packed 4:2:2 surface using
 * nearest neighbour chroma downsampling.
 */
extern void (*packed444_to_packed422_scanline)( uint8_t *output,
                                                uint8_t *input,
                                                int width );

/**
 * Converts packed 4:2:2 to packed 4:4:4 scanlines using nearest
 * neighbour chroma upsampling.
 */
extern void (*packed422_to_packed444_scanline)( uint8_t *output,
                                                uint8_t *input,
                                                int width );

/**
 * This filter actually does not meet the spec so calling it rec601
 * is a bit of a lie.  I got the filter from Poynton's site.  This
 * converts a scanline from packed 4:2:2 to packed 4:4:4.  But this
 * function should point at some high quality to-the-spec resampler.
 */
extern void (*packed422_to_packed444_rec601_scanline)( uint8_t *dest,
                                                       uint8_t *src,
                                                       int width );

/**
 * Conversions between Y'CbCr and R'G'B'.  We use Rec.601 numbers
 * since our source is broadcast video, but I think there is an
 * argument to be made for switching to Rec.709.
 */
extern void (*packed444_to_rgb24_rec601_scanline)( uint8_t *output,
                                                   uint8_t *input,
                                                   int width );
extern void (*rgb24_to_packed444_rec601_scanline)( uint8_t *output,
                                                   uint8_t *input,
                                                   int width );
extern void (*rgba32_to_packed4444_rec601_scanline)( uint8_t *output,
                                                     uint8_t *input,
                                                     int width );

/**
 * Chroma upsampler for a chroma plane (8 bit per pixel) from
 * 4:2:2 to 4:4:4.  I believe that implements the filter described
 * in the MPEG2 spec, but I have not confirmed.
 */
extern void (*chroma_422_to_444_mpeg2_plane)( uint8_t *dst, uint8_t *src,
                                              int width, int height );

/**
 * Chroma upsampler for a chroma plane (8 bit per pixel) from
 * 4:2:0 to 4:2:2.  I believe that implements the filter described
 * in the MPEG2 spec, but I have not confirmed.
 */
extern void (*chroma_420_to_422_mpeg2_plane)( uint8_t *dst, uint8_t *src,
                                              int width, int height, int progressive );

/**
 * Sets up the function pointers to point at the fastest function
 * available.  Requires accelleration settings (see mm_accel.h).
 */
void setup_speedy_calls( uint32_t accel, int verbose );

/**
 * Returns a bitfield of what accellerations were used when speedy was
 * initialized.  See mm_accel.h.
 */
uint32_t speedy_get_accel( void );

#ifdef __cplusplus
};
#endif
#endif /* SPEEDY_H_INCLUDED */

--- NEW FILE: Makefile.in ---
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004  Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@


SOURCES = $(xineplug_post_tvtime_la_SOURCES)

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
	$(srcdir)/Makefile.in $(top_srcdir)/misc/Makefile.common
subdir = src/post/deinterlace
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/_xine.m4 $(top_srcdir)/m4/aa.m4 \
	$(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/arts.m4 \
	$(top_srcdir)/m4/as.m4 $(top_srcdir)/m4/caca.m4 \
	$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/directx.m4 \
	$(top_srcdir)/m4/dl.m4 $(top_srcdir)/m4/dvdnav.m4 \
	$(top_srcdir)/m4/esd.m4 $(top_srcdir)/m4/ffmpeg.m4 \
	$(top_srcdir)/m4/freetype2.m4 $(top_srcdir)/m4/gettext.m4 \
	$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
	$(top_srcdir)/m4/irixal.m4 $(top_srcdir)/m4/lcmessage.m4 \
	$(top_srcdir)/m4/libFLAC.m4 $(top_srcdir)/m4/libfame.m4 \
	$(top_srcdir)/m4/ogg.m4 $(top_srcdir)/m4/opengl.m4 \
	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/progtest.m4 \
	$(top_srcdir)/m4/sdl.m4 $(top_srcdir)/m4/speex.m4 \
	$(top_srcdir)/m4/theora.m4 $(top_srcdir)/m4/vorbis.m4 \
	$(top_srcdir)/m4/xv.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 = $(top_builddir)/src/xine-engine/libxine.la
xineplug_post_tvtime_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
	$(top_builddir)/src/post/deinterlace/plugins/libdeinterlaceplugins.la
am_xineplug_post_tvtime_la_OBJECTS = xine_plugin.lo deinterlace.lo \
	pulldown.lo speedy.lo tvtime.lo
xineplug_post_tvtime_la_OBJECTS =  \
	$(am_xineplug_post_tvtime_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
	$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(xineplug_post_tvtime_la_SOURCES)
DIST_SOURCES = $(xineplug_post_tvtime_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
	html-recursive info-recursive install-data-recursive \
	install-exec-recursive install-info-recursive \
	install-recursive installcheck-recursive installdirs-recursive \
	pdf-recursive ps-recursive uninstall-info-recursive \
	uninstall-recursive
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
AAINFO = @AAINFO@
AALIB_CFLAGS = @AALIB_CFLAGS@
AALIB_CONFIG = @AALIB_CONFIG@
AALIB_LIBS = @AALIB_LIBS@
ACLOCAL = @ACLOCAL@
ACLOCAL_DIR = @ACLOCAL_DIR@
ALLOCA = @ALLOCA@
ALSA_CFLAGS = @ALSA_CFLAGS@
ALSA_LIBS = @ALSA_LIBS@
ALSA_STATIC_LIB = @ALSA_STATIC_LIB@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ARTS_CFLAGS = @ARTS_CFLAGS@
ARTS_CONFIG = @ARTS_CONFIG@
ARTS_LIBS = @ARTS_LIBS@
AS = @AS@
ASFLAGS = @ASFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_ASF_FALSE = @BUILD_ASF_FALSE@
BUILD_ASF_TRUE = @BUILD_ASF_TRUE@
BUILD_DHA_KMOD_FALSE = @BUILD_DHA_KMOD_FALSE@
BUILD_DHA_KMOD_TRUE = @BUILD_DHA_KMOD_TRUE@
BUILD_FAAD_FALSE = @BUILD_FAAD_FALSE@
BUILD_FAAD_TRUE = @BUILD_FAAD_TRUE@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CACA_CFLAGS = @CACA_CFLAGS@
CACA_CONFIG = @CACA_CONFIG@
CACA_LIBS = @CACA_LIBS@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCAS = @CCAS@
CCASCOMPILE = @CCASCOMPILE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEFS = @DEFS@
DEPCOMP = @DEPCOMP@
DEPDIR = @DEPDIR@
DEPMOD = @DEPMOD@
DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
DIRECTFB_LIBS = @DIRECTFB_LIBS@
DIRECTX_AUDIO_LIBS = @DIRECTX_AUDIO_LIBS@
DIRECTX_CPPFLAGS = @DIRECTX_CPPFLAGS@
DIRECTX_VIDEO_LIBS = @DIRECTX_VIDEO_LIBS@
DLLTOOL = @DLLTOOL@
DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
DVDNAV_CONFIG = @DVDNAV_CONFIG@
DVDNAV_LIBS = @DVDNAV_LIBS@
DYNAMIC_LD_LIBS = @DYNAMIC_LD_LIBS@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_VCD_FALSE = @ENABLE_VCD_FALSE@
ENABLE_VCD_TRUE = @ENABLE_VCD_TRUE@
ESD_CFLAGS = @ESD_CFLAGS@
ESD_CONFIG = @ESD_CONFIG@
ESD_LIBS = @ESD_LIBS@
EXEEXT = @EXEEXT@
EXTRA_X_CFLAGS = @EXTRA_X_CFLAGS@
EXTRA_X_LIBS = @EXTRA_X_LIBS@
F77 = @F77@
FFLAGS = @FFLAGS@
FFMPEG_CPPFLAGS = @FFMPEG_CPPFLAGS@
FFMPEG_LIBS = @FFMPEG_LIBS@
FIG2DEV = @FIG2DEV@
FREETYPE_CONFIG = @FREETYPE_CONFIG@
FT2_CFLAGS = @FT2_CFLAGS@
FT2_LIBS = @FT2_LIBS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GLUT_LIBS = @GLUT_LIBS@
GLU_LIBS = @GLU_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOME_VFS_CFLAGS = @GNOME_VFS_CFLAGS@
GNOME_VFS_LIBS = @GNOME_VFS_LIBS@
GOOM_LIBS = @GOOM_LIBS@
HAVE_AA_FALSE = @HAVE_AA_FALSE@
HAVE_AA_TRUE = @HAVE_AA_TRUE@
HAVE_ALSA09_FALSE = @HAVE_ALSA09_FALSE@
HAVE_ALSA09_TRUE = @HAVE_ALSA09_TRUE@
HAVE_ALSA_FALSE = @HAVE_ALSA_FALSE@
HAVE_ALSA_TRUE = @HAVE_ALSA_TRUE@
HAVE_ARMV4L_FALSE = @HAVE_ARMV4L_FALSE@
HAVE_ARMV4L_TRUE = @HAVE_ARMV4L_TRUE@
HAVE_ARTS_FALSE = @HAVE_ARTS_FALSE@
HAVE_ARTS_TRUE = @HAVE_ARTS_TRUE@
HAVE_BSDI_CDROM = @HAVE_BSDI_CDROM@
HAVE_CACA_FALSE = @HAVE_CACA_FALSE@
HAVE_CACA_TRUE = @HAVE_CACA_TRUE@
HAVE_CDROM_IOCTLS_FALSE = @HAVE_CDROM_IOCTLS_FALSE@
HAVE_CDROM_IOCTLS_TRUE = @HAVE_CDROM_IOCTLS_TRUE@
HAVE_COREAUDIO_FALSE = @HAVE_COREAUDIO_FALSE@
HAVE_COREAUDIO_TRUE = @HAVE_COREAUDIO_TRUE@
HAVE_DARWIN_CDROM = @HAVE_DARWIN_CDROM@
HAVE_DIRECTFB_FALSE = @HAVE_DIRECTFB_FALSE@
HAVE_DIRECTFB_TRUE = @HAVE_DIRECTFB_TRUE@
HAVE_DIRECTX_FALSE = @HAVE_DIRECTX_FALSE@
HAVE_DIRECTX_TRUE = @HAVE_DIRECTX_TRUE@
HAVE_DVDNAV_FALSE = @HAVE_DVDNAV_FALSE@
HAVE_DVDNAV_TRUE = @HAVE_DVDNAV_TRUE@
HAVE_DXR3_FALSE = @HAVE_DXR3_FALSE@
HAVE_DXR3_TRUE = @HAVE_DXR3_TRUE@
HAVE_ESD_FALSE = @HAVE_ESD_FALSE@
HAVE_ESD_TRUE = @HAVE_ESD_TRUE@
HAVE_FB_FALSE = @HAVE_FB_FALSE@
HAVE_FB_TRUE = @HAVE_FB_TRUE@
HAVE_FFMMX_FALSE = @HAVE_FFMMX_FALSE@
HAVE_FFMMX_TRUE = @HAVE_FFMMX_TRUE@
HAVE_FFMPEG_FALSE = @HAVE_FFMPEG_FALSE@
HAVE_FFMPEG_TRUE = @HAVE_FFMPEG_TRUE@
HAVE_FIG2DEV_FALSE = @HAVE_FIG2DEV_FALSE@
HAVE_FIG2DEV_TRUE = @HAVE_FIG2DEV_TRUE@
HAVE_FLAC_FALSE = @HAVE_FLAC_FALSE@
HAVE_FLAC_TRUE = @HAVE_FLAC_TRUE@
HAVE_FREEBSD_CDROM = @HAVE_FREEBSD_CDROM@
HAVE_GNOME_VFS_FALSE = @HAVE_GNOME_VFS_FALSE@
HAVE_GNOME_VFS_TRUE = @HAVE_GNOME_VFS_TRUE@
HAVE_IRIXAL_FALSE = @HAVE_IRIXAL_FALSE@
HAVE_IRIXAL_TRUE = @HAVE_IRIXAL_TRUE@
HAVE_LIBFAME_FALSE = @HAVE_LIBFAME_FALSE@
HAVE_LIBFAME_TRUE = @HAVE_LIBFAME_TRUE@
HAVE_LIBMNG_FALSE = @HAVE_LIBMNG_FALSE@
HAVE_LIBMNG_TRUE = @HAVE_LIBMNG_TRUE@
HAVE_LIBPNG_FALSE = @HAVE_LIBPNG_FALSE@
HAVE_LIBPNG_TRUE = @HAVE_LIBPNG_TRUE@
HAVE_LIBRTE_FALSE = @HAVE_LIBRTE_FALSE@
HAVE_LIBRTE_TRUE = @HAVE_LIBRTE_TRUE@
HAVE_LIBSMBCLIENT_FALSE = @HAVE_LIBSMBCLIENT_FALSE@
HAVE_LIBSMBCLIENT_TRUE = @HAVE_LIBSMBCLIENT_TRUE@
HAVE_LINUX_CDROM = @HAVE_LINUX_CDROM@
HAVE_LINUX_FALSE = @HAVE_LINUX_FALSE@
HAVE_LINUX_TRUE = @HAVE_LINUX_TRUE@
HAVE_MACOSX_VIDEO_FALSE = @HAVE_MACOSX_VIDEO_FALSE@
HAVE_MACOSX_VIDEO_TRUE = @HAVE_MACOSX_VIDEO_TRUE@
HAVE_MLIB_FALSE = @HAVE_MLIB_FALSE@
HAVE_MLIB_TRUE = @HAVE_MLIB_TRUE@
HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
HAVE_OSS_FALSE = @HAVE_OSS_FALSE@
HAVE_OSS_TRUE = @HAVE_OSS_TRUE@
HAVE_POLYPAUDIO_FALSE = @HAVE_POLYPAUDIO_FALSE@
HAVE_POLYPAUDIO_TRUE = @HAVE_POLYPAUDIO_TRUE@
HAVE_SDL_FALSE = @HAVE_SDL_FALSE@
HAVE_SDL_TRUE = @HAVE_SDL_TRUE@
HAVE_SGMLTOOLS_FALSE = @HAVE_SGMLTOOLS_FALSE@
HAVE_SGMLTOOLS_TRUE = @HAVE_SGMLTOOLS_TRUE@
HAVE_SOLARIS_CDROM = @HAVE_SOLARIS_CDROM@
HAVE_SPEEX_FALSE = @HAVE_SPEEX_FALSE@
HAVE_SPEEX_TRUE = @HAVE_SPEEX_TRUE@
HAVE_STK_FALSE = @HAVE_STK_FALSE@
HAVE_STK_TRUE = @HAVE_STK_TRUE@
HAVE_SUNAUDIO_FALSE = @HAVE_SUNAUDIO_FALSE@
HAVE_SUNAUDIO_TRUE = @HAVE_SUNAUDIO_TRUE@
HAVE_SUNDGA_FALSE = @HAVE_SUNDGA_FALSE@
HAVE_SUNDGA_TRUE = @HAVE_SUNDGA_TRUE@
HAVE_SUNFB_FALSE = @HAVE_SUNFB_FALSE@
HAVE_SUNFB_TRUE = @HAVE_SUNFB_TRUE@
HAVE_SYNCFB_FALSE = @HAVE_SYNCFB_FALSE@
HAVE_SYNCFB_TRUE = @HAVE_SYNCFB_TRUE@
HAVE_THEORA_FALSE = @HAVE_THEORA_FALSE@
HAVE_THEORA_TRUE = @HAVE_THEORA_TRUE@
HAVE_V4L_FALSE = @HAVE_V4L_FALSE@
HAVE_V4L_TRUE = @HAVE_V4L_TRUE@
HAVE_VCDNAV_FALSE = @HAVE_VCDNAV_FALSE@
HAVE_VCDNAV_TRUE = @HAVE_VCDNAV_TRUE@
HAVE_VIDIX_FALSE = @HAVE_VIDIX_FALSE@
HAVE_VIDIX_TRUE = @HAVE_VIDIX_TRUE@
HAVE_VLDXVMC_FALSE = @HAVE_VLDXVMC_FALSE@
HAVE_VLDXVMC_TRUE = @HAVE_VLDXVMC_TRUE@
HAVE_VORBIS_FALSE = @HAVE_VORBIS_FALSE@
HAVE_VORBIS_TRUE = @HAVE_VORBIS_TRUE@
HAVE_W32DLL_FALSE = @HAVE_W32DLL_FALSE@
HAVE_W32DLL_TRUE = @HAVE_W32DLL_TRUE@
HAVE_WIN32_CDROM = @HAVE_WIN32_CDROM@
HAVE_X11_FALSE = @HAVE_X11_FALSE@
HAVE_X11_TRUE = @HAVE_X11_TRUE@
HAVE_XVMC_FALSE = @HAVE_XVMC_FALSE@
HAVE_XVMC_TRUE = @HAVE_XVMC_TRUE@
HAVE_XV_FALSE = @HAVE_XV_FALSE@
HAVE_XV_TRUE = @HAVE_XV_TRUE@
HAVE_XXMC_FALSE = @HAVE_XXMC_FALSE@
HAVE_XXMC_TRUE = @HAVE_XXMC_TRUE@
HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
HOST_OS_DARWIN_FALSE = @HOST_OS_DARWIN_FALSE@
HOST_OS_DARWIN_TRUE = @HOST_OS_DARWIN_TRUE@
INCLUDED_INTL_FALSE = @INCLUDED_INTL_FALSE@
INCLUDED_INTL_TRUE = @INCLUDED_INTL_TRUE@
INCLUDES = @INCLUDES@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLDIR = @INTLDIR@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
IRIXAL_CFLAGS = @IRIXAL_CFLAGS@
IRIXAL_LIBS = @IRIXAL_LIBS@
IRIXAL_STATIC_LIB = @IRIXAL_STATIC_LIB@
KSTAT_LIBS = @KSTAT_LIBS@
LDFLAGS = @LDFLAGS@
LIBCDIO_CFLAGS = @LIBCDIO_CFLAGS@
LIBCDIO_LIBS = @LIBCDIO_LIBS@
LIBFAME_CFLAGS = @LIBFAME_CFLAGS@
LIBFAME_CONFIG = @LIBFAME_CONFIG@
LIBFAME_LIBS = @LIBFAME_LIBS@
LIBFFMPEG_CFLAGS = @LIBFFMPEG_CFLAGS@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBICONV = @LIBICONV@
LIBISO9660_LIBS = @LIBISO9660_LIBS@
LIBMODPLUG_CFLAGS = @LIBMODPLUG_CFLAGS@
LIBMODPLUG_LIBS = @LIBMODPLUG_LIBS@
LIBMPEG2_CFLAGS = @LIBMPEG2_CFLAGS@
LIBNAME = @LIBNAME@
LIBOBJS = @LIBOBJS@
LIBPNG_CONFIG = @LIBPNG_CONFIG@
LIBS = @LIBS@
LIBSMBCLIENT_LIBS = @LIBSMBCLIENT_LIBS@
LIBSTK_CFLAGS = @LIBSTK_CFLAGS@
LIBSTK_LIBS = @LIBSTK_LIBS@
LIBTOOL = $(SHELL) $(top_builddir)/libtool-nofpic
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBVCDINFO_LIBS = @LIBVCDINFO_LIBS@
LIBVCD_CFLAGS = @LIBVCD_CFLAGS@
LIBVCD_LIBS = @LIBVCD_LIBS@
LIBVCD_SYSDEP = @LIBVCD_SYSDEP@
LINUX_CDROM_TIMEOUT = @LINUX_CDROM_TIMEOUT@
LINUX_INCLUDE = @LINUX_INCLUDE@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_REVISION = @LT_REVISION@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MKNOD = @MKNOD@
MLIB_CFLAGS = @MLIB_CFLAGS@
MLIB_LIBS = @MLIB_LIBS@
MNG_LIBS = @MNG_LIBS@
MSGFMT = @MSGFMT@
NET_LIBS = @NET_LIBS@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJCFLAGS = @OBJCFLAGS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OPENGL_CFLAGS = @OPENGL_CFLAGS@
OPENGL_LIBS = @OPENGL_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PASS1_CFLAGS = @PASS1_CFLAGS@
PASS2_CFLAGS = @PASS2_CFLAGS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
POFILES = @POFILES@
POLYPAUDIO_CFLAGS = @POLYPAUDIO_CFLAGS@
POLYPAUDIO_LIBS = @POLYPAUDIO_LIBS@
POSUB = @POSUB@
PPC_ARCH_FALSE = @PPC_ARCH_FALSE@
PPC_ARCH_TRUE = @PPC_ARCH_TRUE@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SET_MAKE = @SET_MAKE@
SGMLTOOLS = @SGMLTOOLS@
SHELL = @SHELL@
SPEC_VERSION = @SPEC_VERSION@
SPEEX_CFLAGS = @SPEEX_CFLAGS@
SPEEX_LIBS = @SPEEX_LIBS@
STATIC = @STATIC@
STRIP = @STRIP@
SUNDGA_CFLAGS = @SUNDGA_CFLAGS@
SUNDGA_LIBS = @SUNDGA_LIBS@
TAR_NAME = @TAR_NAME@
THEORAENC_LIBS = @THEORAENC_LIBS@
THEORAFILE_LIBS = @THEORAFILE_LIBS@
THEORA_CFLAGS = @THEORA_CFLAGS@
THEORA_LIBS = @THEORA_LIBS@
THREAD_CFLAGS = @THREAD_CFLAGS@
THREAD_CFLAGS_CONFIG = @THREAD_CFLAGS_CONFIG@
THREAD_INCLUDES = @THREAD_INCLUDES@
THREAD_LIBS = @THREAD_LIBS@
THREAD_LIBS_CONFIG = @THREAD_LIBS_CONFIG@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
W32DLL_DEP = @W32DLL_DEP@
W32_NO_OPTIMIZE = @W32_NO_OPTIMIZE@
WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
WIN32_FALSE = @WIN32_FALSE@
WIN32_TRUE = @WIN32_TRUE@
XGETTEXT = @XGETTEXT@
XINE_ACFLAGS = @XINE_ACFLAGS@
XINE_BIN_AGE = @XINE_BIN_AGE@
XINE_BUILD_CC = @XINE_BUILD_CC@
XINE_BUILD_DATE = @XINE_BUILD_DATE@
XINE_BUILD_OS = @XINE_BUILD_OS@
XINE_CONFIG_PREFIX = @XINE_CONFIG_PREFIX@
XINE_DATADIR = @XINE_DATADIR@
XINE_FONTDIR = @XINE_FONTDIR@
XINE_FONTPATH = @XINE_FONTPATH@
XINE_IFACE_AGE = @XINE_IFACE_AGE@
XINE_LOCALEDIR = @XINE_LOCALEDIR@
XINE_LOCALEPATH = @XINE_LOCALEPATH@
XINE_MAJOR = @XINE_MAJOR@
XINE_MINOR = @XINE_MINOR@
XINE_PLUGINDIR = @XINE_PLUGINDIR@
XINE_PLUGINPATH = @XINE_PLUGINPATH@
XINE_PLUGIN_MIN_SYMS = @XINE_PLUGIN_MIN_SYMS@
XINE_SCRIPTPATH = @XINE_SCRIPTPATH@
XINE_SUB = @XINE_SUB@
XVMC_LIB = @XVMC_LIB@
XV_LIB = @XV_LIB@
XXMC_LIB = @XXMC_LIB@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZLIB_INCLUDES = @ZLIB_INCLUDES@
ZLIB_LIBS = @ZLIB_LIBS@
ZLIB_LIBS_CONFIG = @ZLIB_LIBS_CONFIG@
ac_ct_AR = @ac_ct_AR@
ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
ac_ct_F77 = @ac_ct_F77@
ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@
am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = $(XINE_PLUGINDIR)/post
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
w32_path = @w32_path@
XINE_LIB = $(top_builddir)/src/xine-engine/libxine.la
SUBDIRS = plugins
EXTRA_DIST = 
lib_LTLIBRARIES = xineplug_post_tvtime.la
xineplug_post_tvtime_la_SOURCES = xine_plugin.c \
	deinterlace.c pulldown.c speedy.c tvtime.c 

xineplug_post_tvtime_la_LIBADD = $(XINE_LIB) \
	$(top_builddir)/src/post/deinterlace/plugins/libdeinterlaceplugins.la

xineplug_post_tvtime_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@
noinst_HEADERS = deinterlace.h pulldown.h speedtools.h speedy.h tvtime.h
all: all-recursive

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/misc/Makefile.common $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
		&& exit 0; \
	      exit 1;; \
	  esac; \
	done; \
	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/post/deinterlace/Makefile'; \
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --gnu  src/post/deinterlace/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@case '$?' in \
	  *config.status*) \
	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
	  *) \
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
	esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

$(top_srcdir)/configure:  $(am__configure_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
	@$(NORMAL_INSTALL)
	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
	  if test -f $$p; then \
	    f=$(am__strip_dir) \
	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
	  else :; fi; \
	done

uninstall-libLTLIBRARIES:
	@$(NORMAL_UNINSTALL)
	@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
	  p=$(am__strip_dir) \
	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
	done

clean-libLTLIBRARIES:
	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
	  test "$$dir" != "$$p" || dir=.; \
	  echo "rm -f \"$${dir}/so_locations\""; \
	  rm -f "$${dir}/so_locations"; \
	done
xineplug_post_tvtime.la: $(xineplug_post_tvtime_la_OBJECTS) $(xineplug_post_tvtime_la_DEPENDENCIES) 
	$(LINK) -rpath $(libdir) $(xineplug_post_tvtime_la_LDFLAGS) $(xineplug_post_tvtime_la_OBJECTS) $(xineplug_post_tvtime_la_LIBADD) $(LIBS)

mostlyclean-compile:
	-rm -f *.$(OBJEXT)

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deinterlace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pulldown.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speedy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvtime.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xine_plugin.Plo@am__quote@

.c.o:
@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c $<

.c.obj:
@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`

.c.lo:
@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs

distclean-libtool:
	-rm -f libtool
uninstall-info-am:

# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
#     (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
	@set fnord $$MAKEFLAGS; amf=$$2; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    dot_seen=yes; \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	done; \
	if test "$$dot_seen" = "no"; then \
	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
	fi; test -z "$$fail"

mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
	@set fnord $$MAKEFLAGS; amf=$$2; \
	dot_seen=no; \
	case "$@" in \
	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
	  *) list='$(SUBDIRS)' ;; \
	esac; \
	rev=''; for subdir in $$list; do \
	  if test "$$subdir" = "."; then :; else \
	    rev="$$subdir $$rev"; \
	  fi; \
	done; \
	rev="$$rev ."; \
	target=`echo $@ | sed s/-recursive//`; \
	for subdir in $$rev; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"
tags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
	done
ctags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
	done

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	mkid -fID $$unique
tags: TAGS

TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
	  include_option=--etags-include; \
	  empty_fix=.; \
	else \
	  include_option=--include; \
	  empty_fix=; \
	fi; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    test ! -f $$subdir/TAGS || \
	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
	  fi; \
	done; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
	  test -n "$$unique" || unique=$$empty_fix; \
	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	    $$tags $$unique; \
	fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(CTAGS_ARGS)$$tags$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$tags $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && cd $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) $$here

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(DISTFILES)
	$(mkdir_p) $(distdir)/../../../misc
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
	list='$(DISTFILES)'; for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
	  esac; \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkdir_p) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    test -d "$(distdir)/$$subdir" \
	    || $(mkdir_p) "$(distdir)/$$subdir" \
	    || exit 1; \
	    distdir=`$(am__cd) $(distdir) && pwd`; \
	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
	    (cd $$subdir && \
	      $(MAKE) $(AM_MAKEFLAGS) \
	        top_distdir="$$top_distdir" \
	        distdir="$$distdir/$$subdir" \
	        distdir) \
	      || exit 1; \
	  fi; \
	done
check-am: all-am
check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
	for dir in "$(DESTDIR)$(libdir)"; do \
	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
	done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-recursive
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install

clean-generic:

distclean-generic:
	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
clean: clean-recursive

clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
	mostlyclean-am

distclean: distclean-recursive
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
	distclean-libtool distclean-tags

dvi: dvi-recursive

dvi-am:

html: html-recursive

info: info-recursive

info-am:

install-data-am:
	@$(NORMAL_INSTALL)
	$(MAKE) $(AM_MAKEFLAGS) install-data-hook

install-exec-am: install-libLTLIBRARIES

install-info: install-info-recursive

install-man:

installcheck-am:

maintainer-clean: maintainer-clean-recursive
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-recursive

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool

pdf: pdf-recursive

pdf-am:

ps: ps-recursive

ps-am:

uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
	@$(NORMAL_INSTALL)
	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook

uninstall-info: uninstall-info-recursive

.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
	clean clean-generic clean-libLTLIBRARIES clean-libtool \
	clean-recursive ctags ctags-recursive distclean \
	distclean-compile distclean-generic distclean-libtool \
	distclean-recursive distclean-tags distdir dvi dvi-am html \
	html-am info info-am install install-am install-data \
	install-data-am install-data-hook install-exec install-exec-am \
	install-info install-info-am install-libLTLIBRARIES \
	install-man install-strip installcheck installcheck-am \
	installdirs installdirs-am maintainer-clean \
	maintainer-clean-generic maintainer-clean-recursive \
	mostlyclean mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
	tags tags-recursive uninstall uninstall-am uninstall-hook \
	uninstall-info-am uninstall-libLTLIBRARIES


$(XINE_LIB):
	@cd $(top_srcdir)/src/xine-engine && $(MAKE)

install-data-hook:
	@if test $$MAKELEVEL -le 4 ; then \
	  if test -x "$(top_srcdir)/post-install.sh" ; then \
	    $(top_srcdir)/post-install.sh ; \
	  fi \
	fi

pass1:
	@$(MAKE) MULTIPASS_CFLAGS="$(PASS1_CFLAGS)"

pass2:
	@$(MAKE) MULTIPASS_CFLAGS="$(PASS2_CFLAGS)"

debug:
	@$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"

install-debug: debug
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
	@list='$(SUBDIRS)'; for subdir in $$list; do \
	  (cd $$subdir && $(MAKE) $@) || exit; \
	done;
	$(MAKE) $(AM_MAKEFLAGS) install-data-hook

install-includeHEADERS: $(include_HEADERS)
	@$(NORMAL_INSTALL)
	$(install_sh) -d $(DESTDIR)$(includedir)/xine
	@list='$(include_HEADERS)'; for p in $$list; do \
	  if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p"; \
	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p; \
	done

uninstall-includeHEADERS:
	@$(NORMAL_UNINSTALL)
	list='$(include_HEADERS)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(includedir)/xine/$$p; \
	done

uninstall-hook:
	@if echo '$(libdir)' | egrep ^'$(XINE_PLUGINDIR)' >/dev/null; then \
	  list='$(lib_LTLIBRARIES)'; for p in $$list; do \
	    p="`echo $$p | sed -e 's/\.la$$/\.so/g;s|^.*/||'`"; \
	    echo " rm -f $(DESTDIR)$(libdir)/$$p"; \
	    rm -f $(DESTDIR)$(libdir)/$$p; \
	  done; \
	fi

mostlyclean-generic:
	-rm -f *~ \#* .*~ .\#*

maintainer-clean-generic:
	-@echo "This command is intended for maintainers to use;"
	-@echo "it deletes files that may require special tools to rebuild."
	-rm -f Makefile.in
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

--- NEW FILE: xine_plugin.c ---
/*
 * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
 *
 * $Id: xine_plugin.c,v 1.1 2005/04/04 22:38:18 dsalt-guest Exp $
 *
 * advanced video deinterlacer plugin
 * Jun/2003 by Miguel Freitas
 *
 * heavily based on tvtime.sf.net by Billy Biggs
 */

/*
#define LOG
*/

#include "xine_internal.h"
#include "post.h"
#include "xineutils.h"
#include <pthread.h>

#include "tvtime.h"
#include "speedy.h"
#include "deinterlace.h"
#include "plugins/plugins.h"

/* plugin class initialization function */
static void *deinterlace_init_plugin(xine_t *xine, void *);


/* plugin catalog information */
post_info_t deinterlace_special_info = { XINE_POST_TYPE_VIDEO_FILTER };

plugin_info_t xine_plugin_info[] = {
  /* type, API, "name", version, special_info, init_function */  
  { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin },
  { PLUGIN_NONE, 0, "", 0, NULL, NULL }
};


typedef struct post_plugin_deinterlace_s post_plugin_deinterlace_t;

#define MAX_NUM_METHODS 30
static char *enum_methods[MAX_NUM_METHODS];
static char *enum_pulldown[] = { "none", "vektor", NULL };
static char *enum_framerate[] = { "full", "half_top", "half_bottom", NULL };

/*
 * this is the struct used by "parameters api" 
 */
typedef struct deinterlace_parameters_s {

  int method;
  int enabled;
  int pulldown;
  int framerate_mode;
  int judder_correction;
  int use_progressive_frame_flag;
  int chroma_filter;
  int cheap_mode;

} deinterlace_parameters_t;

/*
 * description of params struct
 */
START_PARAM_DESCR( deinterlace_parameters_t )
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, 
            "pulldown algorithm" )
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)" )
PARAM_ITEM( POST_PARAM_TYPE_BOOL, use_progressive_frame_flag, NULL, 0, 1, 0,
            "disable deinterlacing when progressive_frame flag is set" )
PARAM_ITEM( POST_PARAM_TYPE_BOOL, chroma_filter, NULL, 0, 1, 0,
            "apply chroma filter after deinterlacing" )
PARAM_ITEM( POST_PARAM_TYPE_BOOL, cheap_mode, NULL, 0, 1, 0,
            "skip image format conversion - cheaper but not 100% correct" )
END_PARAM_DESCR( param_descr )


#define NUM_RECENT_FRAMES  2
#define FPS_24_DURATION    3754
#define FRAMES_TO_SYNC     20

/* plugin structure */
struct post_plugin_deinterlace_s {
  post_plugin_t      post;
  xine_post_in_t     parameter_input;

  /* private data */
  int                cur_method;
  int                enabled;
  int                pulldown;
  int                framerate_mode;
  int                judder_correction;
  int                use_progressive_frame_flag;
  int                chroma_filter;
  int                cheap_mode;
  tvtime_t          *tvtime;
  int                tvtime_changed;
  int                vo_deinterlace_enabled;
  
  int                framecounter;
  uint8_t            rff_pattern;

  vo_frame_t        *recent_frame[NUM_RECENT_FRAMES];

  pthread_mutex_t    lock;
};


typedef struct post_class_deinterlace_s {
  post_class_t class;
  deinterlace_parameters_t init_param;
} post_class_deinterlace_t;

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]);
      this->recent_frame[i] = NULL;
    }
  }
  this->tvtime_changed++;
}

static int set_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;

  pthread_mutex_lock (&this->lock);

  if( this->enabled != param->enabled ||
      this->cheap_mode != param->cheap_mode )
    _flush_frames(this);

  this->cur_method = param->method;

  this->enabled = param->enabled;

  this->pulldown = param->pulldown;
  this->framerate_mode = param->framerate_mode;
  this->judder_correction = param->judder_correction;
  this->use_progressive_frame_flag = param->use_progressive_frame_flag;
  this->chroma_filter = param->chroma_filter;
  this->cheap_mode = param->cheap_mode;

  this->tvtime_changed++;

  pthread_mutex_unlock (&this->lock);

  return 1;
}

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;
  param->framerate_mode = this->framerate_mode;
  param->judder_correction = this->judder_correction;
  param->use_progressive_frame_flag = this->use_progressive_frame_flag;
  param->chroma_filter = this->chroma_filter;
  param->cheap_mode = this->cheap_mode;

  return 1;
}
 
static xine_post_api_descr_t * get_param_descr (void) {
  return &param_descr;
}

static char * get_help (void) {
  return _("Advanced tvtime/deinterlacer plugin with pulldown detection\n"
           "This plugin aims to provide deinterlacing mechanisms comparable "
           "to high quality progressive DVD players and so called "
           "line-doublers, for use with computer monitors, projectors and "
           "other progressive display devices.\n"
           "\n"
           "Parameters\n"
           "\n"
           "  Method: Select deinterlacing method/algorithm to use, see below for "
           "explanation of each method.\n"
           "\n"
           "  Enabled: Enable/disable the plugin.\n"
           "\n"
           "  Pulldown: Choose the 2-3 pulldown detection algorithm. 24 FPS films "
           "that have being converted to NTSC can be detected and intelligently "
           "reconstructed to their original (non-interlaced) frames.\n"
           "\n"
           "  Framerate_mode: Selecting 'full' will deinterlace every field "
           "to an unique frame for television quality and beyond. This feature will "
           "effetively double the frame rate, improving smoothness. Note, however, "
           "that full 59.94 FPS is not possible with plain 2.4 Linux kernel (that "
           "use a timer interrupt frequency of 100Hz). Newer RedHat and 2.6 kernels "
           "use higher HZ settings (512 and 1000, respectively) and should work fine.\n"
           "\n"
           "  Judder_correction: Once 2-3 pulldown is enabled and a film material "
           "is detected, it is possible to reduce the frame rate to original rate "
           "used (24 FPS). This will make the frames evenly spaced in time, "
           "matching the speed they were shot and eliminating the judder effect.\n"
           "\n"
           "  Use_progressive_frame_flag: Well mastered MPEG2 streams uses a flag "
           "to indicate progressive material. This setting control whether we trust "
           "this flag or not (some rare and buggy mpeg2 streams set it wrong).\n"
           "\n"
           "  Chroma_filter: DVD/MPEG2 use an interlaced image format that has "
           "a very poor vertical chroma resolution. Upsampling the chroma for purposes "
           "of deinterlacing may cause some artifacts to occur (eg. color stripes). Use "
           "this option to blur the chroma vertically after deinterlacing to remove "
           "the artifacts. Warning: cpu intensive.\n"
           "\n"
           "  Cheap_mode: This will skip the expensive YV12->YUY2 image conversion, "
           "tricking tvtime/dscaler routines like if they were still handling YUY2 "
           "images. Of course, this is not correct, not all pixels will be evaluated "
           "by the algorithms to decide the regions to deinterlace and chroma will be "
           "processed separately. Nevertheless, it allows people with not so fast "
           "systems to try deinterlace algorithms, in a tradeoff between quality "
           "and cpu usage.\n"
           "\n"
           "Deinterlacing methods: (Not all methods are available for all plataforms)\n"
           "\n"
           "(FIXME: explain each method, check tvtime/dscaler docs... i fell lazy)\n"
           "\n"
           "* Uses several algorithms from tvtime and dscaler projects.\n"
           );
}

static xine_post_api_t post_api = {
  set_parameters,
  get_parameters,
  get_param_descr,
  get_help,
};


/* plugin class functions */
static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int inputs,
					 xine_audio_port_t **audio_target,
					 xine_video_port_t **video_target);
static char          *deinterlace_get_identifier(post_class_t *class_gen);
static char          *deinterlace_get_description(post_class_t *class_gen);
static void           deinterlace_class_dispose(post_class_t *class_gen);

/* plugin instance functions */
static void           deinterlace_dispose(post_plugin_t *this_gen);

/* replaced video_port functions */
static int            deinterlace_get_property(xine_video_port_t *port_gen, int property);
static int            deinterlace_set_property(xine_video_port_t *port_gen, int property, int value);
static void           deinterlace_flush(xine_video_port_t *port_gen);
static void           deinterlace_open(xine_video_port_t *port_gen, xine_stream_t *stream);
static void           deinterlace_close(xine_video_port_t *port_gen, xine_stream_t *stream);

/* frame intercept check */
static int            deinterlace_intercept_frame(post_video_port_t *port, vo_frame_t *frame);

/* replaced vo_frame functions */
static int            deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream);


static void *deinterlace_init_plugin(xine_t *xine, void *data)
{
  post_class_deinterlace_t *class = (post_class_deinterlace_t *)xine_xmalloc(sizeof(post_class_deinterlace_t));
  uint32_t config_flags = xine_mm_accel();
  int i;

  if (!class)
    return NULL;
  
  class->class.open_plugin     = deinterlace_open_plugin;
  class->class.get_identifier  = deinterlace_get_identifier;
  class->class.get_description = deinterlace_get_description;
  class->class.dispose         = deinterlace_class_dispose;


  setup_speedy_calls(xine_mm_accel(),0);

  linear_plugin_init();
  linearblend_plugin_init();
  greedy_plugin_init();
  greedy2frame_plugin_init();
  weave_plugin_init();
  double_plugin_init();
  vfir_plugin_init();

  scalerbob_plugin_init();

  /*
  dscaler_greedyh_plugin_init();
  dscaler_twoframe_plugin_init();

  dscaler_videobob_plugin_init();
  dscaler_videoweave_plugin_init();
  dscaler_tomsmocomp_plugin_init();
  */
  filter_deinterlace_methods( config_flags, 5 /*fieldsavailable*/ );
  if( !get_num_deinterlace_methods() ) {
      xprintf(xine, XINE_VERBOSITY_LOG, 
	      _("tvtime: No deinterlacing methods available, exiting.\n"));
      return NULL;
  }

  enum_methods[0] = "use_vo_driver";
  for(i = 0; i < get_num_deinterlace_methods(); i++ ) {
    enum_methods[i+1] = (char *)get_deinterlace_method(i)->short_name;
  }
  enum_methods[i+1] = NULL;


  /* Some default values */
  class->init_param.method                     = 1; /* First (plugin) method available */
  class->init_param.enabled                    = 1;
  class->init_param.pulldown                   = 1; /* vektor */
  class->init_param.framerate_mode             = 0; /* full */
  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;

  return &class->class;
}


static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int inputs,
					 xine_audio_port_t **audio_target,
					 xine_video_port_t **video_target)
{
  post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)xine_xmalloc(sizeof(post_plugin_deinterlace_t));
  post_in_t                 *input;
  xine_post_in_t            *input_api;
  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();
  this->tvtime_changed++;

  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;
  port->new_port.close        = deinterlace_close;
  port->new_port.get_property = deinterlace_get_property;
  port->new_port.set_property = deinterlace_set_property;
  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;
  input_api->data = &post_api;
  xine_list_append_content(this->post.input, input_api);

  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;
}

static char *deinterlace_get_identifier(post_class_t *class_gen)
{
  return "tvtime";
}

static char *deinterlace_get_description(post_class_t *class_gen)
{
  return "advanced deinterlacer plugin with pulldown detection";
}

static void deinterlace_class_dispose(post_class_t *class_gen)
{
  free(class_gen);
}


static void deinterlace_dispose(post_plugin_t *this_gen)
{
  post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)this_gen;

  if (_x_post_dispose(this_gen)) {
    _flush_frames(this);
    free(this);
  }
}


static int deinterlace_get_property(xine_video_port_t *port_gen, int property) {
  post_video_port_t *port = (post_video_port_t *)port_gen;
  post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post;
  if( property == XINE_PARAM_VO_DEINTERLACE && this->cur_method )
    return this->enabled;
  else
    return port->original_port->get_property(port->original_port, property);
}

static int deinterlace_set_property(xine_video_port_t *port_gen, int property, int value) {
  post_video_port_t *port = (post_video_port_t *)port_gen;
  post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post;
  if( property == XINE_PARAM_VO_DEINTERLACE ) {
    pthread_mutex_lock (&this->lock);

    if( this->enabled != value )
      _flush_frames(this);

    this->enabled = value;

    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, 
                                      this->vo_deinterlace_enabled);

    return this->enabled;
  } else
    return port->original_port->set_property(port->original_port, property, value);
}

static void deinterlace_flush(xine_video_port_t *port_gen) {
  post_video_port_t *port = (post_video_port_t *)port_gen;
  post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post;

  _flush_frames(this);

  port->original_port->flush(port->original_port);
}

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, 
                                    this->vo_deinterlace_enabled);
}

static void deinterlace_close(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;

  port->stream = NULL;
  _flush_frames(this);
  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);
}


static int deinterlace_intercept_frame(post_video_port_t *port, vo_frame_t *frame)
{
  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, 
                                      this->vo_deinterlace_enabled);
  }
  
  return (this->enabled && this->cur_method &&
      (frame->flags & VO_INTERLACED_FLAG) && 
      (frame->format == XINE_IMGFMT_YV12 || frame->format == XINE_IMGFMT_YUY2) );
}


static void apply_chroma_filter( uint8_t *data, int stride, int width, int height )
{
  int i;

  /* ok, using linearblend inplace is a bit weird: the result of a scanline
   * interpolation will affect the next scanline. this might not be a problem
   * at all, we just want a kind of filter here.
   */
  for( i = 0; i < height; i++, data += stride ) {
    vfilter_chroma_332_packed422_scanline( data, width,
                                           data, 
                                           (i) ? (data - stride) : data,
                                           (i < height-1) ? (data + stride) : data );
  }
}

/* Build the output frame from the specified field. */
static int deinterlace_build_output_field(
             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,
             int64_t pts, int64_t duration, int skip)
{
  vo_frame_t *deinterlaced_frame;
  int scaler = 1;
  int force24fps;
            
  force24fps = this->judder_correction && !this->cheap_mode &&
               ( (this->pulldown == PULLDOWN_DALIAS) ||
                 (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,
    frame->flags | VO_BOTH_FIELDS);
  pthread_mutex_lock (&this->lock);
    
  _x_extra_info_merge(deinterlaced_frame->extra_info, frame->extra_info);
    
  if( skip > 0 && !this->pulldown ) {
    deinterlaced_frame->bad_frame = 1;
  } else {
    if( this->tvtime->curmethod->doscalerbob ) {
      if( yuy2_frame->format == XINE_IMGFMT_YUY2 ) {
        deinterlaced_frame->bad_frame = !tvtime_build_copied_field(this->tvtime,
                           deinterlaced_frame->base[0],
                           yuy2_frame->base[0], bottom_field,
                           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, 
                           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, 
                           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, 
                           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], 
                           (this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0],
                           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], 
                           (this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0],
                           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], 
                           (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], 
                           (this->recent_frame[1])?this->recent_frame[1]->base[2]:yuy2_frame->base[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 ) {
      this->framecounter++;
      if( pts && this->framecounter > FRAMES_TO_SYNC ) {
        deinterlaced_frame->pts = pts;
        this->framecounter = 0;
      } else
        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], 
                             frame->width, frame->height / scaler );
      skip = deinterlaced_frame->draw(deinterlaced_frame, stream);
    } else {
      skip = 0;
    }
  } else {
    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], 
                           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;
}

static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream)
{
  post_video_port_t *port = (post_video_port_t *)frame->port;
  post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post;
  vo_frame_t *orig_frame;
  vo_frame_t *yuy2_frame;
  int i, skip = 0, progressive = 0;
  int fields[2];
  int framerate_mode;

  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 ) {
    tvtime_reset_context(this->tvtime);

    if( this->cur_method )
      this->tvtime->curmethod = get_deinterlace_method( this->cur_method-1 );
    else
      this->tvtime->curmethod = NULL;

    port->original_port->set_property(port->original_port, 
                                XINE_PARAM_VO_DEINTERLACE, 
                                !this->cur_method);

    this->tvtime_changed = 0;
  }
  pthread_mutex_unlock (&this->lock);

  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) ) {
    /*
     * special case for ntsc 3:2 pulldown (called flags or soft pulldown).
     * we know all frames are indeed progressive.
     */
    progressive = 1;
  }

  /* 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)
   */
  if( this->use_progressive_frame_flag &&
      (frame->repeat_first_field || frame->progressive_frame) ) {
    progressive = 1;
  }
  
  if( !frame->bad_frame && 
      (frame->flags & VO_INTERLACED_FLAG) &&
      this->tvtime->curmethod ) {

    frame->flags &= ~VO_INTERLACED_FLAG;

    /* convert to YUY2 if needed */
    if( frame->format == XINE_IMGFMT_YV12 && !this->cheap_mode ) {

      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], 
                   yuy2_frame->base[0], yuy2_frame->pitches[0],
                   frame->width, frame->height, 
                   frame->progressive_frame || progressive );
  
    } else {
      yuy2_frame = frame;
      yuy2_frame->lock(yuy2_frame);
    }


    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 ) ) { 
        this->recent_frame[i]->free(this->recent_frame[i]);
        this->recent_frame[i] = NULL;
      }
    }

    if( !this->cheap_mode ) {
      framerate_mode = this->framerate_mode;
      this->tvtime->pulldown_alg = this->pulldown;
    } else {
      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.
       * frame->flags allow us to find the first decoded field.
       *
       * note: frame->field() is called later to switch decoded
       *       field but frame->flags do not change.
       */
      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;
      } else {
        fields[0] = 1;
        fields[1] = 0;
      }
    } else if ( framerate_mode == FRAMERATE_HALF_TFF ) {
      fields[0] = 0;
    } else if ( framerate_mode == FRAMERATE_HALF_BFF ) {
      fields[0] = 1;
    }
    
    
    if( progressive ) {

      /* If the previous field was interlaced and this one is progressive
       * we need to run a deinterlace on the first field of this frame
       * in order to let output for the previous frames last field be
       * generated. This is only necessary for the deinterlacers that
       * delay output by one field.  This is signaled by the delaysfield
       * flag in the deinterlace method structure. The previous frames
       * 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 && 
          this->tvtime->curmethod->delaysfield)
      {
	skip = deinterlace_build_output_field( 
          this, port, stream,
          frame, yuy2_frame,
          fields[0], 0,
	  0,
	  (framerate_mode == FRAMERATE_FULL) ? this->recent_frame[0]->duration/2 : this->recent_frame[0]->duration,
	  0);
      }
      pthread_mutex_unlock (&this->lock);
      skip = yuy2_frame->draw(yuy2_frame, stream);
      pthread_mutex_lock (&this->lock);
      _x_post_frame_copy_up(frame, yuy2_frame);

    } else {


      /* If the previous field was progressive and we are using a
       * filter that delays it's output by one field then we need
       * to skip the first field's output. Otherwise the effective
       * display duration of the previous frame will be extended
       * by 1/2 of this frames duration when output is generated
       * using the last field of the progressive frame. */

      /* 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( 
          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( 
          this, port, stream,
          frame, yuy2_frame,
          fields[1], 1,
          0,
          frame->duration/2,
          skip);
      }
    }

    /* don't drop frames when pulldown mode is enabled. otherwise 
     * pulldown detection fails (yo-yo effect has also been seen)
     */
    if( this->pulldown )
      skip = 0;

    /* 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] )
      this->recent_frame[i]->free(this->recent_frame[i]);
    for( ; i ; i-- )
      this->recent_frame[i] = this->recent_frame[i-1];
    if (port->stream)
      this->recent_frame[0] = yuy2_frame;
    else {
      /* do not keep this frame when no stream is connected to us,
       * otherwise, this frame might never get freed */
      yuy2_frame->free(yuy2_frame);
      this->recent_frame[0] = NULL;
    }

    pthread_mutex_unlock (&this->lock);

  } else {
    skip = frame->draw(frame, stream);
  }
  
  _x_post_frame_copy_up(orig_frame, frame);
  
  return skip;
}

--- NEW FILE: Makefile.am ---
include $(top_srcdir)/misc/Makefile.common

SUBDIRS = plugins

EXTRA_DIST = 

libdir = $(XINE_PLUGINDIR)/post

lib_LTLIBRARIES = xineplug_post_tvtime.la

xineplug_post_tvtime_la_SOURCES = xine_plugin.c \
	deinterlace.c pulldown.c speedy.c tvtime.c 
xineplug_post_tvtime_la_LIBADD = $(XINE_LIB) \
	$(top_builddir)/src/post/deinterlace/plugins/libdeinterlaceplugins.la

xineplug_post_tvtime_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@

noinst_HEADERS = deinterlace.h pulldown.h speedtools.h speedy.h tvtime.h

--- NEW FILE: speedtools.h ---
/**
 * 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.
 */

#ifndef SPEEDTOOLS_H_INCLUDED
#define SPEEDTOOLS_H_INCLUDED

#define PREFETCH_2048(x) \
    { int *pfetcha = (int *) x; \
        prefetchnta( pfetcha ); \
        prefetchnta( pfetcha + 64 ); \
        prefetchnta( pfetcha + 128 ); \
        prefetchnta( pfetcha + 192 ); \
        pfetcha += 256; \
        prefetchnta( pfetcha ); \
        prefetchnta( pfetcha + 64 ); \
        prefetchnta( pfetcha + 128 ); \
        prefetchnta( pfetcha + 192 ); }

#define READ_PREFETCH_2048(x) \
    { int *pfetcha = (int *) x; int pfetchtmp; \
        pfetchtmp = pfetcha[ 0 ] + pfetcha[ 16 ] + pfetcha[ 32 ] + pfetcha[ 48 ] + \
            pfetcha[ 64 ] + pfetcha[ 80 ] + pfetcha[ 96 ] + pfetcha[ 112 ] + \
            pfetcha[ 128 ] + pfetcha[ 144 ] + pfetcha[ 160 ] + pfetcha[ 176 ] + \
            pfetcha[ 192 ] + pfetcha[ 208 ] + pfetcha[ 224 ] + pfetcha[ 240 ]; \
        pfetcha += 256; \
        pfetchtmp = pfetcha[ 0 ] + pfetcha[ 16 ] + pfetcha[ 32 ] + pfetcha[ 48 ] + \
            pfetcha[ 64 ] + pfetcha[ 80 ] + pfetcha[ 96 ] + pfetcha[ 112 ] + \
            pfetcha[ 128 ] + pfetcha[ 144 ] + pfetcha[ 160 ] + pfetcha[ 176 ] + \
            pfetcha[ 192 ] + pfetcha[ 208 ] + pfetcha[ 224 ] + pfetcha[ 240 ]; }

#endif /* SPEEDTOOLS_H_INCLUDED */