Commit b65e20f3 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Sebastian Dröge
Browse files

[MOVED FROM BAD 19/56] gst/deinterlace2/: Get rid of speedy.[ch] as we don't...

[MOVED FROM BAD 19/56] gst/deinterlace2/: Get rid of speedy.[ch] as we don't use most of it's code anyway and it doesn't seem to be relicens...

Original commit message from CVS:
* gst/deinterlace2/Makefile.am:
* gst/deinterlace2/gstdeinterlace2.c: (gst_deinterlace2_init):
* gst/deinterlace2/tvtime/greedy.c: (deinterlace_frame_di_greedy):
* gst/deinterlace2/tvtime/greedyh.c:
(deinterlace_frame_di_greedyh):
* gst/deinterlace2/tvtime/speedtools.h:
* gst/deinterlace2/tvtime/speedy.c:
* gst/deinterlace2/tvtime/speedy.h:
* gst/deinterlace2/tvtime/tomsmocomp.c: (Fieldcopy):
* gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc:
* gst/deinterlace2/tvtime/vfir.c: (deinterlace_frame_vfir):
Get rid of speedy.[ch] as we don't use most of it's code anyway
and it doesn't seem to be relicensed to LGPL. Use memcpy() instead
of the speedy memcpy everywhere instead.
* gst/deinterlace2/gstdeinterlace2.h:
Remove many unused declarations.
parent 8f588978
......@@ -4,7 +4,6 @@ libgstdeinterlace2_la_SOURCES = \
gstdeinterlace2.c \
tvtime/greedy.c \
tvtime/greedyh.c \
tvtime/speedy.c \
tvtime/vfir.c \
tvtime/tomsmocomp.c
......@@ -22,8 +21,6 @@ noinst_HEADERS = \
tvtime/greedyh.asm \
tvtime/greedyhmacros.h \
tvtime/plugins.h \
tvtime/speedtools.h \
tvtime/speedy.h \
tvtime/x86-64_macros.inc \
tvtime/tomsmocomp.h \
tvtime/tomsmocomp/SearchLoop0A.inc \
......
......@@ -28,7 +28,6 @@
#include <gst/video/video.h>
#include "tvtime/plugins.h"
#include "tvtime/speedy.h"
#include <string.h>
......@@ -234,9 +233,6 @@ gst_deinterlace2_init (GstDeinterlace2 * object, GstDeinterlace2Class * klass)
object->cpu_feature_flags = oil_cpu_get_flags ();
setup_speedy_calls (object->cpu_feature_flags, 0);
object->pMemcpy = speedy_memcpy;
object->method = dscaler_tomsmocomp_get_method ();
object->field_layout = GST_DEINTERLACE2_LAYOUT_AUTO;
object->fields = GST_DEINTERLACE2_ALL;
......
......@@ -47,76 +47,9 @@ typedef struct _GstDeinterlace2Class GstDeinterlace2Class;
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;
/*
* 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
{
guint8 *tt0, *t0, *m0, *b0, *bb0;
guint8 *tt1, *t1, *m1, *b1, *bb1;
guint8 *tt2, *t2, *m2, *b2, *bb2;
guint8 *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) (GstDeinterlace2 * object,
deinterlace_scanline_data_t * data, guint8 * output);
/*
* 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) (GstDeinterlace2 * object,
deinterlace_scanline_data_t * data, guint8 * output);
/*
* 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
{
guint8 *f0;
guint8 *f1;
guint8 *f2;
guint8 *f3;
};
typedef void (*deinterlace_frame_t) (GstDeinterlace2 * object);
/*
* This structure defines the deinterlacer plugin.
*/
......@@ -131,32 +64,10 @@ struct deinterlace_method_s
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;
const char *description[10];
};
/**
* 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);
/**
* Builds the usable method list.
*/
void filter_deinterlace_methods (int accel, int fieldsavailable);
#define MAX_FIELD_HISTORY 10
#define PICTURE_PROGRESSIVE 0
......@@ -245,9 +156,6 @@ struct _GstDeinterlace2
*/
gint field_height;
/* Function pointer to optimized memcpy function */
MEMCPY_FUNC *pMemcpy;
/* distance between lines in image
need not match the pixel width
*/
......
......@@ -26,20 +26,14 @@
* See: http://bugzilla.gnome.org/show_bug.cgi?id=163578
*/
#include <stdio.h>
#if defined (__SVR4) && defined (__sun)
# include <sys/int_types.h>
#else
# include <stdint.h>
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <_stdint.h>
#include "gstdeinterlace2.h"
#include "speedtools.h"
#include "speedy.h"
#include <string.h>
// This is a simple lightweight DeInterlace method that uses little CPU time
// but gives very good results for low or intermedite motion.
......@@ -352,7 +346,7 @@ deinterlace_frame_di_greedy (GstDeinterlace2 * object)
GST_BUFFER_DATA (object->field_history[object->history_count - 3].buf);
// copy first even line
object->pMemcpy (Dest, L1, object->line_length);
memcpy (Dest, L1, object->line_length);
Dest += object->output_stride;
} else {
InfoIsOdd = 0;
......@@ -365,18 +359,18 @@ deinterlace_frame_di_greedy (GstDeinterlace2 * object)
Pitch;
// copy first even line
object->pMemcpy (Dest, GST_BUFFER_DATA (object->field_history[0].buf),
memcpy (Dest, GST_BUFFER_DATA (object->field_history[0].buf),
object->line_length);
Dest += object->output_stride;
// then first odd line
object->pMemcpy (Dest, L1, object->line_length);
memcpy (Dest, L1, object->line_length);
Dest += object->output_stride;
}
for (Line = 0; Line < (object->field_height - 1); ++Line) {
func (L2, L1, L3, L2P, Dest, object->line_length);
Dest += object->output_stride;
object->pMemcpy (Dest, L3, object->line_length);
memcpy (Dest, L3, object->line_length);
Dest += object->output_stride;
L1 += Pitch;
......@@ -386,7 +380,7 @@ deinterlace_frame_di_greedy (GstDeinterlace2 * object)
}
if (InfoIsOdd) {
object->pMemcpy (Dest, L2, object->line_length);
memcpy (Dest, L2, object->line_length);
}
}
......@@ -400,8 +394,6 @@ static deinterlace_method_t greedyl_method = {
0,
0,
1,
0,
0,
deinterlace_frame_di_greedy,
{"Uses heuristics to detect motion in the input",
"frames and reconstruct image detail where",
......
......@@ -32,14 +32,12 @@
#include "greedyhmacros.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <_stdint.h>
#include <string.h>
#include "gst/gst.h"
#include "plugins.h"
#include "gstdeinterlace2.h"
#include "speedy.h"
static const unsigned int GreedyMaxComb = 5;
static const unsigned int GreedyMotionThreshold = 25;
......@@ -249,7 +247,7 @@ deinterlace_frame_di_greedyh (GstDeinterlace2 * object)
GST_BUFFER_DATA (object->field_history[object->history_count - 3].buf);
// copy first even line
object->pMemcpy (Dest, L1, object->line_length);
memcpy (Dest, L1, object->line_length);
Dest += object->output_stride;
} else {
InfoIsOdd = 0;
......@@ -262,18 +260,18 @@ deinterlace_frame_di_greedyh (GstDeinterlace2 * object)
Pitch;
// copy first even line
object->pMemcpy (Dest, GST_BUFFER_DATA (object->field_history[0].buf),
memcpy (Dest, GST_BUFFER_DATA (object->field_history[0].buf),
object->line_length);
Dest += object->output_stride;
// then first odd line
object->pMemcpy (Dest, L1, object->line_length);
memcpy (Dest, L1, object->line_length);
Dest += object->output_stride;
}
for (Line = 0; Line < (object->field_height - 1); ++Line) {
func (L1, L2, L3, L2P, Dest, object->line_length);
Dest += object->output_stride;
object->pMemcpy (Dest, L3, object->line_length);
memcpy (Dest, L3, object->line_length);
Dest += object->output_stride;
L1 += Pitch;
......@@ -283,7 +281,7 @@ deinterlace_frame_di_greedyh (GstDeinterlace2 * object)
}
if (InfoIsOdd) {
object->pMemcpy (Dest, L2, object->line_length);
memcpy (Dest, L2, object->line_length);
}
}
......@@ -297,8 +295,6 @@ static deinterlace_method_t greedyh_method = {
0,
0,
0,
0,
0,
deinterlace_frame_di_greedyh,
{"Uses heuristics to detect motion in the input",
"frames and reconstruct image detail where",
......
/*
*
* GStreamer
* Copyright (C) 2004 Billy Biggs <vektor@dumbterm.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Relicensed for GStreamer from GPL to LGPL with permit from Billy Biggs.
* See: http://bugzilla.gnome.org/show_bug.cgi?id=163578
*/
#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 */
This diff is collapsed.
/*
*
* GStreamer
* Copyright (C) 2004 Billy Biggs <vektor@dumbterm.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Relicensed for GStreamer from GPL to LGPL with permit from Billy Biggs.
* See: http://bugzilla.gnome.org/show_bug.cgi?id=163578
*/
#ifndef SPEEDY_H_INCLUDED
#define SPEEDY_H_INCLUDED
#if defined (__SVR4) && defined (__sun)
# include <sys/int_types.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 premultiplied 4:4:4:4 pixel onto a packed 4:2:2 scanline.
*/
extern void (*composite_colour4444_alpha_to_packed422_scanline)( uint8_t *output, uint8_t *input,
int af, int y, int cb, int cr,
int width, int alpha );
/*
* 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 );
/*
* 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 );
/*
* 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 );
/*
* 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.