After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 163578 - [PATCH] Deinterlacer plugin
[PATCH] Deinterlacer plugin
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: High enhancement
: 0.10.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 163577
Blocks:
 
 
Reported: 2005-01-10 15:25 UTC by Martin Eikermann
Modified: 2008-06-11 11:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the plugin (335.51 KB, application/x-compressed-tar)
2005-01-10 15:26 UTC, Martin Eikermann
Details
new version (343.25 KB, application/x-compressed-tar)
2005-01-16 01:10 UTC, Martin Eikermann
Details
new version (0.0.3) (345.87 KB, application/x-compressed-tar)
2005-01-22 13:46 UTC, Martin Eikermann
Details

Description Martin Eikermann 2005-01-10 15:25:34 UTC
I've ported dscaler/tvtime deinterlacer methods to gstreamer.
Not all methods are supported by now. TomsMoComp and Greedy
give some great results already. Make sure u have an x86 box if
u like to give it a try. (There are no C fallbacks in the code
i ported :( ) and set the tff/fields properties on the plugin.

For now the plugin is called deinterlace2.
See eikermann.afraid.org/dscaler for some sample images.
Comment 1 Martin Eikermann 2005-01-10 15:26:47 UTC
Created attachment 35786 [details]
the plugin
Comment 2 Maciej Katafiasz 2005-01-10 16:28:26 UTC
Adding dep on bug 163577, as we should probably finish RFC first before we can
consider this plugin complete
Comment 3 Ronald Bultje 2005-01-10 17:28:54 UTC
How's the license? Billy's dscaler code is GPL, IIRC. We don't accept GPL code
in gst-plugins CVS.
Comment 4 Martin Eikermann 2005-01-10 18:33:43 UTC
Yes it's GPL. Someone with a bunch of good arguments
should ask him to relicense. I'm just not smart enough
to port deinterlacers ;-).

For the time being it's just fine in here or gst-sandbox.

btw, we must ask tvtime devels too. They did quite some
inline assembler porting job.
Comment 5 Christian Fredrik Kalager Schaller 2005-01-14 15:10:47 UTC
Just to update on this one, I am trying to get hold of Billy Biggs to get this
relicensed to LGPL, I think he will say yes, but he seems unavailable atm. I
will update this report as soon as I get a reply.
Comment 6 Martin Eikermann 2005-01-14 21:28:03 UTC
Originally the deinterlacer methods come from DScaler, developed by
Tom Barry and John Adcock. TvTime developers ported Tom and Johns
"TomsMoComp" and Greedy methods to Linux.


So we need to ask:
-----------------

For the original deinterlace methods:
 * Tom Barry <trbarry@trbarry.com>,
 * John Adcock <john at adcock8 dot freeserve dot co dot uk>
 DScaler developers run a support forum at sf.net. And request
 everyone to post their inquiries in there. From what I can see
 John Adcock answers to questions regulary.
 DScaler Forum: http://deinterlace.sourceforge.net/phpBB/viewforum.php?f=1
 
 Files that are ports based on their initial implementation and
 carry their copyright:
  - plugins/greedyhmacros.h
  - plugins/greedy.c
  - plugins/greedyh.asm
  - plugins/tomsmocomp/*


For TvTime in general and most of its deinterlacer methods:
 * Billy Biggs <vektor@dumbterm.net>:
  - plugins/kdetv_greedyh.c
  - plugins/kdetv_tomsmocomp.c
  - plugins/weave.c
  - plugins/weavetff.c
  - plugins/tomsmocomp.c
  - plugins/tomsmocomp.h
  - plugins/plugins.h
  - plugins/weavebff.c
  - plugins/linear.c
  - plugins/vfir.c
  - plugins/scalerbob.c
  - plugins/speedy.c
  - plugins/speedy.h
  - plugins/speedtools.h
  - plugins/greedy.c
  - plugins/greedyh.c
  - plugins/greedyh.h

Matthew J. Marjanovic <maddog@mir.com>:
 plugins/speedy.c


If linearblend is a benefit, also:
----------------------------------

 A deinterlacing method originally for mplayer.
 * Michael Niedermayer (michaelni@gmx.at):
  - plugins/linearblend.c


Code to be removed before inclusion:
------------------------------------

Stefan Jahn <stefan@lkcc.org>:
 plugins/speedy.c
  In particular the code for UYVY to YUYV conversion routine originally taken
  from rivatv. (rivatv-convert.c video image conversion routines)
 (This conversion routines can be dropped: Not used. But it's still in there)


Others:
-------

Aaron Holtzman <aholtzma@ess.eng r.uvic.ca> (libmpeg2):
Michel Lespinasse <walken@zoy.org> (libmpeg2):
 plugins/cpu_accel.c
 plugins/mmx.h
 plugins/mm_accel.h
 plugins/attributes.h
 (These files contain cpu detection code and preprocessor defined
  SIMD routines. I already found a very similar file with copyright from
  H. Dietz and R. Fisher in case they'd deny relicensing.
  e.g. here: https://cvs.comedi.org/cgi-bin/viewcvs.cgi/opts/mmx.h?rev=1.1
  &content-type=text/vnd.viewcvs-markup. No GPL header in this one, must be
  public domain then.)

Cheung Auyeung <auyeung@mot.com>:
 plugins/speedy.c
 (Don't think it is necessary to ask him as the copyright statement basically   
  says: Do what you want but include this disclaimer.)
Comment 7 Martin Eikermann 2005-01-16 01:10:58 UTC
Created attachment 36080 [details]
new version

removed the gpl code originally taken from libmpeg2 and replaced it with a free
version
Comment 8 Billy Biggs 2005-01-18 15:37:45 UTC
Some of the algorithms and code that I wrote I have relicensed elsewhere under
the MIT license, and I'm definitely in favour for that.  However, the DScaler
stuff will be more tricky, since it's GPL'ed for sure and there are more authors
than what you listed.  Dirk Ziegelmeier of kdetv is the guy who did the gcc asm
port of the dscaler filters, so he's probably the most important contact.

I can probably tell you where all of the code comes from and maybe help rewrite
parts.  You can contact me on irc.freenode.net as 'vektor'.
Comment 9 Christian Fredrik Kalager Schaller 2005-01-20 17:50:39 UTC
Ok, I mailed Dirk Ziegelmeier, Michael Niedermayer, Tom Barry and John Adcock
asking for permission.
 
Comment 10 Christian Fredrik Kalager Schaller 2005-01-20 18:26:50 UTC
Got the following reply from John Adcock:

Christian
 
I'm happy to relicence my deinterlace stuff (which in this case is the greedy
method) under the LGPL.  It's up to Tom for the MoComp stuff.  Also note that
there is a new method Diag in the Dscaler5 tree that is LGPL.
 
John
Comment 11 Christian Fredrik Kalager Schaller 2005-01-21 08:53:56 UTC
Got this from Dirk Ziegelmeier:
Hello GStreamer folks,

I have no objections against relicensing my porting work of any DScaler 
deinterlacer/filter to LGPL! Also feel free to look around in 
kdeextragear-3/kdetv for an image filter (Sharpness) I ported from DScaler 
(the other filters are trivial, but if you want, take them after asking the 
original authors for relicensing permission.

Dirk Ziegelmeier
Comment 12 Christian Fredrik Kalager Schaller 2005-01-21 08:54:56 UTC
Got this from Tom Barry

Hi Christian -

I'm the author of the Greedy (High Motion), Greedy (Low Motion), and 
TomsMoComp deinterlacer functions.

And LGPL is fine with me.  That is also true of the Avisynth versions if 
they are any easier to port for some reason (still asm, www.trbarry.com ).

- Tom
Comment 13 Christian Fredrik Kalager Schaller 2005-01-21 10:25:36 UTC
Martin, I mailed with Michael Niedermayer and he says there is no linearblend.c.
So I guess this code is removed. Or is it something we might want to include, if
so do you have a link to it somewhere that I can show Michael?
Comment 14 Christian Fredrik Kalager Schaller 2005-01-21 11:26:27 UTC
Ok, following update from Michael Niedermayer:

> sorry, theres no linearblend.c in either of the 2 attachments

but if you are talking about linearblend.c from tvtime cvs, I am pretty certain 
that i havnt written any part of it, the code is quite inefficient ..., 
anyway, in case there are any parts in linearblend.c 
(http://cvs.sourceforge.net/viewcvs.py/tvtime/tvtime/plugins/linearblend.c?rev=1.16&view=markup)

i did write, i am gladly relicensing them under LGPL herewith

-- 
Michael
Comment 15 Billy Biggs 2005-01-21 16:22:31 UTC
To be clear, any code that I wrote I am also willing to relicense under the
LGPL.  One thing I would like for this filter is to make sure the diff to the
tvtime upstream code is as small as possible, and ideally nothing, so that we
can easily share code.  If you are going to rip out the rivatv code, I would
rather split it into a different file in tvtime upstream to make the diff smaller.

Some other things I noticed in the filter code:
 - the vfir filter code is inspired from ffmpeg sources, but Uraeus says this
   is LGPL anyway.
 - there is memcpy code in speedy.c inspired by xine, mplayer, and the
   linux kernel
 - diff and comb factor code in speedy.c I think is from DScaler, but I was
   playing around with this a bunch
Comment 16 Martin Eikermann 2005-01-22 13:46:01 UTC
Created attachment 36375 [details]
new version (0.0.3)

* streamlined code
* new methods: Greedy Low Motion, Vertical Blur (vfir)
* made tff (top field first) property an enum (auto, tff, bff)
Comment 17 Christian Fredrik Kalager Schaller 2005-01-24 12:13:34 UTC
Martin and Billy, with planned rewrites etc. included, are there any more
permissions we need? Or are the current permissions + planned rewrites enough to
make this all LGPL?
Comment 18 Martin Eikermann 2005-01-24 13:09:00 UTC
We should have all permissions we need. Billy is going to split out
the last GPL code from speedy.c upstream.

Billy: In #15 u mentioned the diff/comb factor code. Was DScaler source of
inspiration or copy?
Comment 19 Billy Biggs 2005-01-31 05:01:13 UTC
Some of those functions are a direct port of the diff/comb functions in
FD_CommonFunctions.asm in DScaler.
Comment 20 Ronald Bultje 2005-02-02 17:53:23 UTC
Hi Martin,

I playing around with this (trying to add some tvtime-/dscaler-like deinterlace
function to the TV-display function of Cupid - no worries Billy ;) ). Here´s
some comments:

* tff=0 (default) doesn´t work. Just play around with it, the result looks
horrible (like a shaky picture as if frame orders were randomly inversed the
wrong way). Also, it´s very slow. Tff=1/2 work fine. Rename it to field-order to
make it clear or so...
* some docs on the differences (technically, or in cpu-use or result or
whatever) between the different dinterlacing methods would be nice, it´s
complete black magic to me so I don´t know what to choose.
* If you want, feel free to patch to remove deinterlace from CVS (and rename
this to deinterlace), this seems to work a *lot* better (I really, really like it).
* change License to LGPL. ;).
Comment 21 Martin Eikermann 2005-02-02 19:39:41 UTC
Hmmm, sure it's the fault of tff. There is a known issue with the greedy low
motion method. tff=0 will default to tff=1 before any deinterlacing done, since
there is no notation of field-order in caps or somewhere else yet. I still
hesitate to make a patch and replace the old deinterlace plugin cause there are
no C fallback routines (except Greedy Low Motion, IIRC) and there are definitly
some arch-portability preprocessor macros missing. Billy is currently working to
split out the last bit of GPL code. I'll work on that patch so we can replace
the old deinterlace plugin soon.
Comment 22 Jan Schmidt 2005-08-18 08:42:46 UTC
We should re-open work on this code for 0.9, now that we're free to add
properties to caps and stuff. 

Did the work to split out memcpy/other-GPL code from speedy.c ever happen?
Comment 23 Christian Fredrik Kalager Schaller 2005-11-04 18:19:33 UTC
Martin and Billy, where are we on this? Is this LGPL and ready to go into 0.8?
(and also ready to be ported to 0.9)
Comment 24 Billy Biggs 2005-11-10 05:06:24 UTC
Is the version from comment #16 really the latest?

I haven't done any work to replace bits of GPL code.  What do you really
need from me here.  Is there a more recent patch?
Comment 25 Andy Wingo 2006-01-27 17:14:24 UTC
Billy I think the current blocker is that we *still* don't have adequate notation for top/bottom frames in GStreamer. Not sure about the status of the patch -- probably should look into remerging with upstream when someone gets around to looking at this again.
Comment 26 Christian Fredrik Kalager Schaller 2006-03-27 15:02:16 UTC
Billy, my impression was that the GPL code in this patch at this point where only  stuff from tvtime. You said at some point that you would prefer to rewrite the code to make it cleaner/shareable instead of just say 'ok' on relicensing the tvtime code. Is this still your stance?
Comment 27 Julian Scheel 2006-10-11 17:16:03 UTC
Is there any progress happening in this case?
If people do not have enough time for rewriting maybe for now relicensing and adaption of the current code should be targeted?
Comment 28 Edward Hervey 2006-10-12 10:51:59 UTC
Tim just ported the gst-deinterlace plugin to 0.10 . It's available in gst-plugins-bad.

2006-10-11  Tim-Philipp Müller  <tim at centricular dot net>

	* configure.ac:
	* gst/deinterlace/Makefile.am:
	* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_base_init),
	(gst_deinterlace_class_init), (gst_deinterlace_init),
	(gst_deinterlace_stop), (gst_deinterlace_transform_caps),
	(gst_deinterlace_set_caps), (gst_deinterlace_transform_ip),
	(gst_deinterlace_set_property), (gst_deinterlace_get_property):
	* gst/deinterlace/gstdeinterlace.h:
	  Port simple deinterlacer from 0.8. Use at your own risk, don't blame
	  me for anything it does or does not do to your precious pictures.

Comment 29 Julian Scheel 2006-10-12 11:46:35 UTC
The simple deinterlace-plugin isn't comparable with the tvtime-algorithms, this patch uses, they are ways better in quality.
Comment 30 Sebastian Dröge (slomo) 2008-06-11 11:11:33 UTC
Ok, it's committed to gst-plugins-bad and ported to gstreamer 0.10 now. Still not build or enabled by default as there are some bugs left and it can be built on x86 only atm.


2008-06-11  Sebastian Dröge  <slomo@circular-chaos.org>

	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.