Commit 0518c150 authored by Martin Eikermann's avatar Martin Eikermann Committed by Sebastian Dröge

[MOVED FROM BAD 01/56] gst/deinterlace2/: Add a deinterlacer plugin based on...

[MOVED FROM BAD 01/56] gst/deinterlace2/: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL f...

Original commit message from CVS:
Based on a patch by: Martin Eikermann <meiker at upb dot de>
* gst/deinterlace2/Makefile.am:
* gst/deinterlace2/gstdeinterlace2.c:
(gst_deinterlace2_method_get_type),
(gst_deinterlace2_fields_get_type),
(gst_deinterlace2_field_layout_get_type),
(gst_deinterlace2_base_init), (gst_deinterlace2_class_init),
(gst_deinterlace2_init), (gst_deinterlace2_set_method),
(gst_deinterlace2_set_property), (gst_deinterlace2_get_property),
(gst_deinterlace2_finalize), (gst_deinterlace2_pop_history),
(gst_deinterlace2_head_history), (gst_deinterlace2_push_history),
(gst_deinterlace2_deinterlace_scanlines), (gst_deinterlace2_chain),
(gst_deinterlace2_setcaps), (gst_deinterlace2_sink_event),
(gst_deinterlace2_change_state), (gst_deinterlace2_src_event),
(gst_deinterlace2_src_query), (gst_deinterlace2_src_query_types),
(plugin_init):
* gst/deinterlace2/gstdeinterlace2.h:
* gst/deinterlace2/tvtime/greedy.c: (copy_scanline),
(deinterlace_greedy_packed422_scanline_mmxext),
(dscaler_greedyl_get_method):
* gst/deinterlace2/tvtime/greedyh.asm:
* gst/deinterlace2/tvtime/greedyh.c:
(deinterlace_frame_di_greedyh), (dscaler_greedyh_get_method),
(greedyh_init), (greedyh_filter_mmx), (greedyh_filter_3dnow),
(greedyh_filter_sse):
* gst/deinterlace2/tvtime/greedyh.h:
* gst/deinterlace2/tvtime/greedyhmacros.h:
* gst/deinterlace2/tvtime/mmx.h:
* gst/deinterlace2/tvtime/plugins.h:
* gst/deinterlace2/tvtime/speedtools.h:
* gst/deinterlace2/tvtime/speedy.c: (multiply_alpha), (clip255),
(comb_factor_packed422_scanline_mmx),
(diff_factor_packed422_scanline_c),
(diff_factor_packed422_scanline_mmx),
(diff_packed422_block8x8_mmx), (diff_packed422_block8x8_c),
(packed444_to_packed422_scanline_c),
(packed422_to_packed444_scanline_c),
(packed422_to_packed444_rec601_scanline_c),
(vfilter_chroma_121_packed422_scanline_mmx),
(vfilter_chroma_121_packed422_scanline_c),
(vfilter_chroma_332_packed422_scanline_mmx),
(vfilter_chroma_332_packed422_scanline_c),
(kill_chroma_packed422_inplace_scanline_mmx),
(kill_chroma_packed422_inplace_scanline_c),
(invert_colour_packed422_inplace_scanline_mmx),
(invert_colour_packed422_inplace_scanline_c),
(mirror_packed422_inplace_scanline_c),
(interpolate_packed422_scanline_c),
(convert_uyvy_to_yuyv_scanline_mmx),
(convert_uyvy_to_yuyv_scanline_c),
(interpolate_packed422_scanline_mmx),
(interpolate_packed422_scanline_mmxext),
(blit_colour_packed422_scanline_c),
(blit_colour_packed422_scanline_mmx),
(blit_colour_packed422_scanline_mmxext),
(blit_colour_packed4444_scanline_c),
(blit_colour_packed4444_scanline_mmx),
(blit_colour_packed4444_scanline_mmxext), (small_memcpy),
(speedy_memcpy_c), (speedy_memcpy_mmx), (speedy_memcpy_mmxext),
(blit_packed422_scanline_c), (blit_packed422_scanline_mmx),
(blit_packed422_scanline_mmxext),
(composite_colour4444_alpha_to_packed422_scanline_c),
(composite_colour4444_alpha_to_packed422_scanline_mmxext),
(composite_packed4444_alpha_to_packed422_scanline_c),
(composite_packed4444_alpha_to_packed422_scanline_mmxext),
(composite_packed4444_to_packed422_scanline_c),
(composite_packed4444_to_packed422_scanline_mmxext),
(composite_alphamask_to_packed4444_scanline_c),
(composite_alphamask_to_packed4444_scanline_mmxext),
(composite_alphamask_alpha_to_packed4444_scanline_c),
(premultiply_packed4444_scanline_c),
(premultiply_packed4444_scanline_mmxext),
(blend_packed422_scanline_c), (blend_packed422_scanline_mmxext),
(quarter_blit_vertical_packed422_scanline_mmxext),
(quarter_blit_vertical_packed422_scanline_c),
(subpix_blit_vertical_packed422_scanline_c),
(a8_subpix_blit_scanline_c), (myround), (init_RGB_to_YCbCr_tables),
(init_YCbCr_to_RGB_tables), (rgb24_to_packed444_rec601_scanline_c),
(rgba32_to_packed4444_rec601_scanline_c),
(packed444_to_rgb24_rec601_scanline_c),
(packed444_to_nonpremultiplied_packed4444_scanline_c),
(aspect_adjust_packed4444_scanline_c), (setup_speedy_calls),
(speedy_get_accel):
* gst/deinterlace2/tvtime/speedy.h:
* gst/deinterlace2/tvtime/sse.h:
* gst/deinterlace2/tvtime/tomsmocomp.c: (Fieldcopy),
(deinterlace_frame_di_tomsmocomp), (dscaler_tomsmocomp_get_method),
(tomsmocomp_init), (tomsmocomp_filter_mmx),
(tomsmocomp_filter_3dnow), (tomsmocomp_filter_sse):
* gst/deinterlace2/tvtime/tomsmocomp.h:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoop0A.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopBottom.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA8.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA2.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA6.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH2.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopTop.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVA.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVAH.inc:
* gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc:
* gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc:
* gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll2.inc:
* gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc:
* gst/deinterlace2/tvtime/vfir.c: (deinterlace_line),
(deinterlace_scanline_vfir), (copy_scanline),
(dscaler_vfir_get_method):
* gst/deinterlace2/tvtime/x86-64_macros.inc:
Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer,
which was relicensed to LGPL for GStreamer and in theory provides
better and faster results than the simple deinterlace element.
Fixes bug #163578.
Ported to GStreamer 0.10 but still not enabled or included in the
build system by default because of bad artefacts caused by a bug
somewhere and as it can be only build on x86/amd64 ATM and requires
special CFLAGS. Will be fixed soon.
parent 2a362d14
plugin_LTLIBRARIES = libgstdeinterlace2.la
libgstdeinterlace2_la_SOURCES = \
gstdeinterlace2.c \
tvtime/greedy.c \
tvtime/greedyh.asm \
tvtime/greedyh.c \
tvtime/speedy.c \
tvtime/vfir.c \
tvtime/x86-64_macros.inc \
tvtime/tomsmocomp.c \
tvtime/tomsmocomp/SearchLoop0A.inc \
tvtime/tomsmocomp/SearchLoopBottom.inc \
tvtime/tomsmocomp/SearchLoopEdgeA8.inc \
tvtime/tomsmocomp/SearchLoopEdgeA.inc \
tvtime/tomsmocomp/SearchLoopOddA2.inc \
tvtime/tomsmocomp/SearchLoopOddA6.inc \
tvtime/tomsmocomp/SearchLoopOddAH2.inc \
tvtime/tomsmocomp/SearchLoopOddAH.inc \
tvtime/tomsmocomp/SearchLoopOddA.inc \
tvtime/tomsmocomp/SearchLoopTop.inc \
tvtime/tomsmocomp/SearchLoopVAH.inc \
tvtime/tomsmocomp/SearchLoopVA.inc \
tvtime/tomsmocomp/StrangeBob.inc \
tvtime/tomsmocomp/TomsMoCompAll2.inc \
tvtime/tomsmocomp/TomsMoCompAll.inc \
tvtime/tomsmocomp/tomsmocompmacros.h \
tvtime/tomsmocomp/WierdBob.inc
libgstdeinterlace2_la_CFLAGS = $(GST_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(LIBOIL_CFLAGS) -march=athlon-xp
libgstdeinterlace2_la_LIBADD = $(GST_LIBS) \
$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(LIBOIL_LIBS)
libgstdeinterlace2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = \
gstdeinterlace2.h \
tvtime/mmx.h \
tvtime/sse.h \
tvtime/greedyh.h \
tvtime/greedyhmacros.h \
tvtime/plugins.h \
tvtime/speedtools.h \
tvtime/speedy.h \
tvtime/tomsmocomp.h
This diff is collapsed.
/*
* GStreamer
* Copyright (C) 2005 Martin Eikermann <meiker@upb.de>
* Copyright (C) 2008 Sebastian Dröge <slomo@circular-chaos.org>
*
* 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.
*/
#ifndef __GST_DEINTERLACE_2_H__
#define __GST_DEINTERLACE_2_H__
#include <liboil/liboil.h>
#include <liboil/liboilfunction.h>
#include <liboil/liboilcpu.h>
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
G_BEGIN_DECLS
#define GST_TYPE_DEINTERLACE2 \
(gst_deinterlace2_get_type())
#define GST_DEINTERLACE2(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEINTERLACE2,GstDeinterlace2))
#define GST_DEINTERLACE2_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEINTERLACE2,GstDeinterlace2))
#define GST_IS_DEINTERLACE2(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEINTERLACE2))
#define GST_IS_DEINTERLACE2_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEINTERLACE2))
typedef struct _GstDeinterlace2 GstDeinterlace2;
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.
*/
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;
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
#define PICTURE_INTERLACED_BOTTOM 1
#define PICTURE_INTERLACED_TOP 2
#define PICTURE_INTERLACED_MASK (PICTURE_INTERLACED_BOTTOM | PICTURE_INTERLACED_TOP)
typedef void (MEMCPY_FUNC) (void *pOutput, const void *pInput, size_t nSize);
typedef struct
{
/* pointer to the start of data for this field */
GstBuffer *buf;
/* see PICTURE_ flags */
guint flags;
} GstPicture;
typedef enum
{
GST_DEINTERLACE2_TOM,
GST_DEINTERLACE2_GREEDY_H,
GST_DEINTERLACE2_GREEDY_L,
GST_DEINTERLACE2_VFIR
} GstDeinterlace2Methods;
typedef enum
{
GST_DEINTERLACE2_ALL, /* All (missing data is interp.) */
GST_DEINTERLACE2_TF, /* Top Fields Only */
GST_DEINTERLACE2_BF /* Bottom Fields Only */
} GstDeinterlace2Fields;
typedef enum
{
GST_DEINTERLACE2_LAYOUT_AUTO,
GST_DEINTERLACE2_LAYOUT_TFF,
GST_DEINTERLACE2_LAYOUT_BFF
} GstDeinterlace2FieldLayout;
struct _GstDeinterlace2
{
GstElement parent;
GstPad *srcpad, *sinkpad;
guint history_count;
guint cpu_feature_flags;
GstDeinterlace2FieldLayout field_layout;
guint frame_size;
gint frame_rate_n, frame_rate_d;
GstDeinterlace2Fields fields;
GstDeinterlace2Methods method_id;
deinterlace_method_t *method;
/* The most recent pictures
PictureHistory[0] is always the most recent.
Pointers are NULL if the picture in question isn't valid, e.g. because
the program just started or a picture was skipped.
*/
GstPicture field_history[MAX_FIELD_HISTORY];
/* Current overlay buffer pointer. */
GstBuffer *out_buf;
/* Overlay pitch (number of bytes between scanlines). */
guint output_stride;
/* Number of bytes of actual data in each scanline. May be less than
OverlayPitch since the overlay's scanlines might have alignment
requirements. Generally equal to FrameWidth * 2.
*/
guint line_length;
/* Number of pixels in each scanline. */
gint frame_width;
/* Number of scanlines per frame. */
gint frame_height;
/* Number of scanlines per field. FrameHeight / 2, mostly for
cleanliness so we don't have to keep dividing FrameHeight by 2.
*/
gint field_height;
/* Function pointer to optimized memcpy function */
MEMCPY_FUNC *pMemcpy;
/* distance between lines in image
need not match the pixel width
*/
guint field_stride;
gboolean bottom_field;
};
struct _GstDeinterlace2Class
{
GstElementClass parent_class;
};
GType gst_deinterlace2_get_type (void);
G_END_DECLS
#endif /* __GST_DEINTERLACE_2_H__ */
/*
*
* GStreamer
* Copyright (c) 2000 Tom Barry All rights reserved.
* mmx.h port copyright (c) 2002 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 Tom Barry
* and Billy Biggs.
* 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 "mmx.h"
#include "sse.h"
#include "gstdeinterlace2.h"
#include "speedtools.h"
#include "speedy.h"
// This is a simple lightweight DeInterlace method that uses little CPU time
// but gives very good results for low or intermedite motion.
// It defers frames by one field, but that does not seem to produce noticeable
// lip sync problems.
//
// The method used is to take either the older or newer weave pixel depending
// upon which give the smaller comb factor, and then clip to avoid large damage
// when wrong.
//
// I'd intended this to be part of a larger more elaborate method added to
// Blended Clip but this give too good results for the CPU to ignore here.
static void
copy_scanline (GstDeinterlace2 * object,
deinterlace_scanline_data_t * data, uint8_t * output)
{
blit_packed422_scanline (output, data->m1, object->frame_width);
}
static int GreedyMaxComb = 15;
static void
deinterlace_greedy_packed422_scanline_mmxext (GstDeinterlace2 * object,
deinterlace_scanline_data_t * data, uint8_t * output)
{
#ifdef HAVE_CPU_I386
mmx_t MaxComb;
uint8_t *m0 = data->m0;
uint8_t *t1 = data->t1;
uint8_t *b1 = data->b1;
uint8_t *m2 = data->m2;
int width = object->frame_width;
// How badly do we let it weave? 0-255
MaxComb.ub[0] = GreedyMaxComb;
MaxComb.ub[1] = GreedyMaxComb;
MaxComb.ub[2] = GreedyMaxComb;
MaxComb.ub[3] = GreedyMaxComb;
MaxComb.ub[4] = GreedyMaxComb;
MaxComb.ub[5] = GreedyMaxComb;
MaxComb.ub[6] = GreedyMaxComb;
MaxComb.ub[7] = GreedyMaxComb;
// L2 == m0
// L1 == t1
// L3 == b1
// LP2 == m2
width /= 4;
while (width--) {
movq_m2r (*t1, mm1); // L1
movq_m2r (*m0, mm2); // L2
movq_m2r (*b1, mm3); // L3
movq_m2r (*m2, mm0); // LP2
// average L1 and L3 leave result in mm4
movq_r2r (mm1, mm4); // L1
pavgb_r2r (mm3, mm4); // (L1 + L3)/2
// get abs value of possible L2 comb
movq_r2r (mm2, mm7); // L2
psubusb_r2r (mm4, mm7); // L2 - avg
movq_r2r (mm4, mm5); // avg
psubusb_r2r (mm2, mm5); // avg - L2
por_r2r (mm7, mm5); // abs(avg-L2)
movq_r2r (mm4, mm6); // copy of avg for later
// get abs value of possible LP2 comb
movq_r2r (mm0, mm7); // LP2
psubusb_r2r (mm4, mm7); // LP2 - avg
psubusb_r2r (mm0, mm4); // avg - LP2
por_r2r (mm7, mm4); // abs(avg-LP2)
// use L2 or LP2 depending upon which makes smaller comb
psubusb_r2r (mm5, mm4); // see if it goes to zero
psubusb_r2r (mm5, mm5); // 0
pcmpeqb_r2r (mm5, mm4); // if (mm4=0) then FF else 0
pcmpeqb_r2r (mm4, mm5); // opposite of mm4
// if Comb(LP2) <= Comb(L2) then mm4=ff, mm5=0 else mm4=0, mm5 = 55
pand_r2r (mm2, mm5); // use L2 if mm5 == ff, else 0
pand_r2r (mm0, mm4); // use LP2 if mm4 = ff, else 0
por_r2r (mm5, mm4); // may the best win
// Now lets clip our chosen value to be not outside of the range
// of the high/low range L1-L3 by more than abs(L1-L3)
// This allows some comb but limits the damages and also allows more
// detail than a boring oversmoothed clip.
movq_r2r (mm1, mm2); // copy L1
psubusb_r2r (mm3, mm2); // - L3, with saturation
paddusb_r2r (mm3, mm2); // now = Max(L1,L3)
pcmpeqb_r2r (mm7, mm7); // all ffffffff
psubusb_r2r (mm1, mm7); // - L1
paddusb_r2r (mm7, mm3); // add, may sat at fff..
psubusb_r2r (mm7, mm3); // now = Min(L1,L3)
// allow the value to be above the high or below the low by amt of MaxComb
paddusb_m2r (MaxComb, mm2); // increase max by diff
psubusb_m2r (MaxComb, mm3); // lower min by diff
psubusb_r2r (mm3, mm4); // best - Min
paddusb_r2r (mm3, mm4); // now = Max(best,Min(L1,L3)
pcmpeqb_r2r (mm7, mm7); // all ffffffff
psubusb_r2r (mm4, mm7); // - Max(best,Min(best,L3)
paddusb_r2r (mm7, mm2); // add may sat at FFF..
psubusb_r2r (mm7, mm2); // now = Min( Max(best, Min(L1,L3), L2 )=L2 clipped
movntq_r2m (mm2, *output); // move in our clipped best
// Advance to the next set of pixels.
output += 8;
m0 += 8;
t1 += 8;
b1 += 8;
m2 += 8;
}
sfence ();
emms ();
#endif
}
static deinterlace_method_t greedyl_method = {
0, //DEINTERLACE_PLUGIN_API_VERSION,
"Motion Adaptive: Simple Detection",
"AdaptiveSimple",
3,
OIL_IMPL_FLAG_MMXEXT,
0,
0,
0,
1,
copy_scanline,
deinterlace_greedy_packed422_scanline_mmxext,
0,
{"Uses heuristics to detect motion in the input",
"frames and reconstruct image detail where",
"possible. Use this for high quality output",
"even on monitors set to an arbitrary refresh",
"rate.",
"",
"Simple detection uses linear interpolation",
"where motion is detected, using a two-field",
"buffer. This is the Greedy: Low Motion",
"deinterlacer from DScaler."}
};
deinterlace_method_t *
dscaler_greedyl_get_method (void)
{
return &greedyl_method;
}
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
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "greedyh.h"
#include "greedyhmacros.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "gst/gst.h"
#include "plugins.h"
#include "gstdeinterlace2.h"
#include "speedy.h"
#define MAXCOMB_DEFAULT 5
#define MOTIONTHRESHOLD_DEFAULT 25
#define MOTIONSENSE_DEFAULT 30
unsigned int GreedyMaxComb;
unsigned int GreedyMotionThreshold;
unsigned int GreedyMotionSense;
#define IS_SSE
#define SSE_TYPE SSE
#define FUNCT_NAME greedyDScaler_SSE
#include "greedyh.asm"
#undef SSE_TYPE
#undef IS_SSE
#undef FUNCT_NAME
#define IS_3DNOW
#define FUNCT_NAME greedyDScaler_3DNOW
#define SSE_TYPE 3DNOW
#include "greedyh.asm"
#undef SSE_TYPE
#undef IS_3DNOW
#undef FUNCT_NAME
#define IS_MMX
#define SSE_TYPE MMX
#define FUNCT_NAME greedyDScaler_MMX
#include "greedyh.asm"
#undef SSE_TYPE
#undef IS_MMX
#undef FUNCT_NAME
void
deinterlace_frame_di_greedyh (GstDeinterlace2 * object)
{
if (object->cpu_feature_flags & OIL_IMPL_FLAG_SSE) {
greedyh_filter_sse (object);
} else if (object->cpu_feature_flags & OIL_IMPL_FLAG_3DNOW) {
greedyh_filter_3dnow (object);
} else {
greedyh_filter_mmx (object);
}
}
static deinterlace_method_t greedyh_method = {
0, //DEINTERLACE_PLUGIN_API_VERSION,
"Motion Adaptive: Advanced Detection",
"AdaptiveAdvanced",
4,
OIL_IMPL_FLAG_MMX,
0,
0,
0,
0,
0,
0,
deinterlace_frame_di_greedyh,
{"Uses heuristics to detect motion in the input",
"frames and reconstruct image detail where",
"possible. Use this for high quality output",
"even on monitors set to an arbitrary refresh",
"rate.",
"",
"Advanced detection uses linear interpolation",
"where motion is detected, using a four-field",
"buffer. This is the Greedy: High Motion",
"deinterlacer from DScaler."}
};
deinterlace_method_t *
dscaler_greedyh_get_method (void)
{
greedyh_init ();
return &greedyh_method;
}
void
greedyh_init (void)
{
GreedyMaxComb = MAXCOMB_DEFAULT;
GreedyMotionThreshold = MOTIONTHRESHOLD_DEFAULT;
GreedyMotionSense = MOTIONSENSE_DEFAULT;
}
void
greedyh_filter_mmx (GstDeinterlace2 * object)
{
greedyDScaler_MMX (object);
}
void
greedyh_filter_3dnow (GstDeinterlace2 * object)
{
greedyDScaler_3DNOW (object);
}
void
greedyh_filter_sse (GstDeinterlace2 * object)
{
greedyDScaler_SSE (object);
}
/*
*
* 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 GREEDYH_H_INCLUDED
#define GREEDYH_H_INCLUDED
#include "gstdeinterlace2.h"
#ifdef __cplusplus
extern "C" {
#endif
void greedyh_init( void );
void greedyh_filter_mmx( GstDeinterlace2 *object );
void greedyh_filter_3dnow( GstDeinterlace2 *object );
void greedyh_filter_sse( GstDeinterlace2 *object );
#ifdef __cplusplus
};
#endif
#endif /* GREEDYH_H_INCLUDED */
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2001 Tom Barry. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
//
// This file is subject to the terms of the GNU General Public License as
// published by the Free Software Foundation. A copy of this license is