2's complement conversion filter

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

2's complement conversion filter

elellilrah
Hello,
I need to develop a plugin filter to convert my video stream from 2's complement (14 bit) to regular RGB data (16 bit, 3 color).  First, does anyone know of a plugin that will do this?  The video data generated by the camera comes in 2's complement and was a design decision long ago that I cannot change.

That said, I have embarked on developing a plugin for it.  I've begun with the "gstreamer plugin writers guide.pdf" and have done the following:
Downloaded the plugin developer, section 3.1
cd'd to /gst-template/gst-plugin/src and ran ../tools/make_element MyPlugin
And adjusted the /src/Makefile.am file to look like this (the guide isn't exact about this)

#######################################################################
# TODO: change libgstplugin.la to something else, e.g. libmysomething.la     #
######################################################################
plugin_LTLIBRARIES = libgstmyplugin.la

######################################################################
# TODO: for the next set of variables, name the prefix if you named the .la, #
#  e.g. libmysomething.la => libmysomething_la_SOURCES                       #
#                            libmysomething_la_CFLAGS                        #
#                            libmysomething_la_LIBADD                        #
#                            libmysomething_la_LDFLAGS                       #
#####################################################################

# compiler and linker flags used to compile this plugin, set in configure.ac
libgstplugin_la_LIBTOOLFLAGS = --tag=disable-static

# sources used to compile this plug-in
libgstmyplugin_la_SOURCES = gstmyplugin.c gstmyplugin.h
libgstmyplugin_la_CFLAGS = $(GST_CFLAGS)
libgstmyplugin_la_LIBADD = $(GST_LIBS)
libgstmyplugin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

# headers we need but don't want installed
noinst_HEADERS = gstplugin.h gstmyplugin.h

I then cd'd to /gst-tempplate/gst-plugin and ran ./autogen.sh
and received an error about the #include in gstmyplugin.c
and found the autogenerator made a mistake in the naming:
#include "gstmymyplugin.h"
so I removed the extra my to have:
#include "gstmyplugin.h"
Then ./autogen.sh worked without errors!  That was good.
So then I ran make && sudo make install
and watched things fly by.  

But now to the next question - how to I find my plugin name and how do I get it registered so it works from gst-launch?  I'm going through the guide and haven't figured this out yet.  Any guidance is greatly appreciated!
Reply | Threaded
Open this post in threaded view
|

Re: 2's complement conversion filter

elellilrah
Ah!  So the path variable wasn't set, as the writers guide suggested.
For the future, after doing the above, type the following:
export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-0.10/
then run
make && sudo make install
and now my plugin is registered, or at least gst-inspect shows it with gst-inspect myplugin

However, I learned that the vestigial problem of having mymyplugin gets spread throughout the .c file!
Once I get rid of that, and run
make && sudo make install
then I can run
gst-launch videotestsrc ! myplugin ! ffmpegcolorspace ! ximagesink
and get printf messages that something is working.  That's great!  Now to figure out how to do the word-by-word 2's complement to unsigned conversion...
Reply | Threaded
Open this post in threaded view
|

Re: 2's complement conversion filter

Luis de Bethencourt
On 2 May 2012 01:10, elellilrah <[hidden email]> wrote:

> Ah!  So the path variable wasn't set, as the writers guide suggested.
> For the future, after doing the above, type the following:
> export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-0.10/
> then run
> make && sudo make install
> and now my plugin is registered, or at least gst-inspect shows it with
> gst-inspect myplugin
>
> However, I learned that the vestigial problem of having mymyplugin gets
> spread throughout the .c file!
> Once I get rid of that, and run
> make && sudo make install
> then I can run
> gst-launch videotestsrc ! myplugin ! ffmpegcolorspace ! ximagesink
> and get printf messages that something is working.  That's great!  Now to
> figure out how to do the word-by-word 2's complement to unsigned
> conversion...

Are you doing this for the challenge or because you need it?
Would using colorspace with caps-filter do the trick?

Luis
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 2's complement conversion filter

elellilrah
Luis,

If there's a filter that can convert 14-bit 2's complement signed data to 16 bit unsigned data, I'll use it!  No, I'm not doing this for challenge, I just haven't found the right tool for the job.  And since I didn't know about how to run a filter to make the modification, making my own was my last resort.
Can you provide a little guidance how to configure colorspace to do that?  I see it's in the bad plugin family, so I'm having a little trouble getting it going along with the capsfilter.

Thanks!