mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
configure.ac: postproc filters need liboil to detect the cpu architecture
Original commit message from CVS: Reviewed by: Edward Hervey <edward@fluendo.com> * configure.ac: postproc filters need liboil to detect the cpu architecture * ext/libpostproc/Makefile.am: Update for liboil requirement, libpostproc being moved around in ffmpeg mirror, and removal of unused header file. * ext/libpostproc/gstpostproc.h: Header file not needed anymore * ext/libpostproc/gstpostproc.c: (gst_pp_scope_get_type), (change_context), (append), (change_mode), (gst_post_proc_base_init), (gst_post_proc_class_init), (gst_post_proc_init), (gst_post_proc_dispose), (gst_post_proc_setcaps), (gst_post_proc_transform_ip), (gst_post_proc_set_property), (gst_post_proc_get_property), (gst_post_proc_deblock_set_property), (gst_post_proc_deblock_get_property), (gst_post_proc_tmpnoise_set_property), (gst_post_proc_tmpnoise_get_property), (gst_post_proc_autolevels_set_property), (gst_post_proc_autolevels_get_property), (gst_post_proc_forcequant_set_property), (gst_post_proc_forcequant_get_property), (gst_post_proc_register), (plugin_init): Port of postprocessing elements to 0.10.
This commit is contained in:
parent
5e39aa8e8e
commit
8b9468e7c7
5 changed files with 666 additions and 289 deletions
28
ChangeLog
28
ChangeLog
|
@ -1,3 +1,31 @@
|
||||||
|
2006-10-20 Mark Nauwelaerts <manauw@skynet.be>
|
||||||
|
|
||||||
|
Reviewed by: Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
postproc filters need liboil to detect the cpu architecture
|
||||||
|
* ext/libpostproc/Makefile.am:
|
||||||
|
Update for liboil requirement, libpostproc being moved around in
|
||||||
|
ffmpeg mirror, and removal of unused header file.
|
||||||
|
* ext/libpostproc/gstpostproc.h:
|
||||||
|
Header file not needed anymore
|
||||||
|
* ext/libpostproc/gstpostproc.c: (gst_pp_scope_get_type),
|
||||||
|
(change_context), (append), (change_mode),
|
||||||
|
(gst_post_proc_base_init), (gst_post_proc_class_init),
|
||||||
|
(gst_post_proc_init), (gst_post_proc_dispose),
|
||||||
|
(gst_post_proc_setcaps), (gst_post_proc_transform_ip),
|
||||||
|
(gst_post_proc_set_property), (gst_post_proc_get_property),
|
||||||
|
(gst_post_proc_deblock_set_property),
|
||||||
|
(gst_post_proc_deblock_get_property),
|
||||||
|
(gst_post_proc_tmpnoise_set_property),
|
||||||
|
(gst_post_proc_tmpnoise_get_property),
|
||||||
|
(gst_post_proc_autolevels_set_property),
|
||||||
|
(gst_post_proc_autolevels_get_property),
|
||||||
|
(gst_post_proc_forcequant_set_property),
|
||||||
|
(gst_post_proc_forcequant_get_property), (gst_post_proc_register),
|
||||||
|
(plugin_init):
|
||||||
|
Port of postprocessing elements to 0.10.
|
||||||
|
|
||||||
2006-10-13 Edward Hervey <edward@fluendo.com>
|
2006-10-13 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* ext/ffmpeg/gstffmpegcodecmap.c:
|
* ext/ffmpeg/gstffmpegcodecmap.c:
|
||||||
|
|
12
configure.ac
12
configure.ac
|
@ -38,6 +38,8 @@ AM_PROG_LIBTOOL
|
||||||
|
|
||||||
dnl *** required versions of GStreamer stuff ***
|
dnl *** required versions of GStreamer stuff ***
|
||||||
GST_REQ=0.10.4
|
GST_REQ=0.10.4
|
||||||
|
LIBOIL_MAJORMINOR=0.3
|
||||||
|
LIBOIL_REQ=0.3.6
|
||||||
|
|
||||||
dnl *** autotools stuff ****
|
dnl *** autotools stuff ****
|
||||||
|
|
||||||
|
@ -104,6 +106,16 @@ GST_CHECK_GST_CHECK($GST_MAJORMINOR, [$GST_REQ], no)
|
||||||
AC_MSG_NOTICE(Using GStreamer Core Plugins in $GST_PLUGINS_DIR)
|
AC_MSG_NOTICE(Using GStreamer Core Plugins in $GST_PLUGINS_DIR)
|
||||||
AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
|
AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
|
||||||
|
|
||||||
|
dnl liboil is required
|
||||||
|
PKG_CHECK_MODULES(LIBOIL, liboil-$LIBOIL_MAJORMINOR >= $LIBOIL_REQ, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
|
||||||
|
if test "x$HAVE_LIBOIL" != "xyes"
|
||||||
|
then
|
||||||
|
AC_ERROR([liboil-$LIBOIL_REQ or later is required])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(LIBOIL_CFLAGS)
|
||||||
|
AC_SUBST(LIBOIL_LIBS)
|
||||||
|
|
||||||
dnl *** set variables based on configure arguments ***
|
dnl *** set variables based on configure arguments ***
|
||||||
|
|
||||||
dnl set location of plugin directory
|
dnl set location of plugin directory
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
#plugin_LTLIBRARIES = libgstpostproc.la
|
plugin_LTLIBRARIES = libgstpostproc.la
|
||||||
#
|
|
||||||
#libgstpostproc_la_SOURCES = gstpostproc.c
|
libgstpostproc_la_SOURCES = gstpostproc.c
|
||||||
#
|
|
||||||
#libgstpostproc_la_CFLAGS = $(GST_CFLAGS) \
|
libgstpostproc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(LIBOIL_CFLAGS) \
|
||||||
# -I $(top_srcdir)/gst-libs/ext/ffmpeg/libavformat \
|
-I $(top_srcdir)/gst-libs/ext/ffmpeg \
|
||||||
# -I $(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec
|
-I $(top_srcdir)/gst-libs/ext/ffmpeg/libavformat \
|
||||||
#libgstpostproc_la_LIBADD = \
|
-I $(top_srcdir)/gst-libs/ext/ffmpeg/libavutil \
|
||||||
# $(top_builddir)/gst-libs/ext/ffmpeg/libavformat/libavformat.la \
|
-I $(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec
|
||||||
# $(top_builddir)/gst-libs/ext/ffmpeg/libavcodec/libavcodec.la
|
libgstpostproc_la_LIBADD = -lgstvideo-@GST_MAJORMINOR@ \
|
||||||
# $(top_builddir)/gst-libs/ext/ffmpeg/libavcodec/libpostproc/libffpostproc.la
|
$(top_builddir)/gst-libs/ext/ffmpeg/libavcodec/libavcodec.la \
|
||||||
#
|
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(LIBOIL_LIBS)
|
||||||
#libgstpostproc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
|
||||||
#
|
libgstpostproc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
#noinst_HEADERS = \
|
|
||||||
# gstpostproc.h
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2005 Edward Hervey (edward@fluendo.com)
|
Copyright (C) 2005 Edward Hervey (edward@fluendo.com)
|
||||||
|
Copyright (C) 2006 Mark Nauwelaerts (manauw@skynet.be)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,17 +22,22 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/gstcpu.h>
|
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
#include <gst/video/gstvideofilter.h>
|
||||||
|
#include <liboil/liboil.h>
|
||||||
|
#include <liboil/liboilcpu.h>
|
||||||
|
#include <liboil/liboilfunction.h>
|
||||||
|
|
||||||
#ifdef HAVE_FFMPEG_UNINSTALLED
|
#ifdef HAVE_FFMPEG_UNINSTALLED
|
||||||
#include <avcodec.h>
|
#include <avcodec.h>
|
||||||
|
#include <version.h>
|
||||||
#include <libpostproc/postprocess.h>
|
#include <libpostproc/postprocess.h>
|
||||||
#else
|
#else
|
||||||
#include <ffmpeg/avcodec.h>
|
#include <ffmpeg/avcodec.h>
|
||||||
|
#include <ffmpeg/version.h>
|
||||||
#include <ffmpeg/libpostproc/postprocess.h>
|
#include <ffmpeg/libpostproc/postprocess.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gstpostproc.h"
|
|
||||||
|
|
||||||
typedef struct _PostProcDetails PostProcDetails;
|
typedef struct _PostProcDetails PostProcDetails;
|
||||||
|
|
||||||
|
@ -64,8 +70,9 @@ static PostProcDetails filterdetails[] = {
|
||||||
|
|
||||||
typedef struct _GstPostProc GstPostProc;
|
typedef struct _GstPostProc GstPostProc;
|
||||||
|
|
||||||
struct _GstPostProc {
|
struct _GstPostProc
|
||||||
GstElement element;
|
{
|
||||||
|
GstVideoFilter element;
|
||||||
|
|
||||||
GstPad *sinkpad, *srcpad;
|
GstPad *sinkpad, *srcpad;
|
||||||
guint quality;
|
guint quality;
|
||||||
|
@ -76,63 +83,170 @@ struct _GstPostProc {
|
||||||
|
|
||||||
pp_mode_t *mode;
|
pp_mode_t *mode;
|
||||||
pp_context_t *context;
|
pp_context_t *context;
|
||||||
|
|
||||||
|
/* props of various filters */
|
||||||
|
gboolean autoq;
|
||||||
|
guint scope;
|
||||||
|
/* though not all needed at once,
|
||||||
|
* this avoids union or ugly re-use for simplicity */
|
||||||
|
gint diff, flat;
|
||||||
|
gint t1, t2, t3;
|
||||||
|
gboolean range;
|
||||||
|
gint quant;
|
||||||
|
|
||||||
|
/* argument string for pp */
|
||||||
|
gchar *cargs, *args;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _GstPostProcClass GstPostProcClass;
|
typedef struct _GstPostProcClass GstPostProcClass;
|
||||||
|
|
||||||
struct _GstPostProcClass {
|
struct _GstPostProcClass
|
||||||
GstElementClass parent_class;
|
{
|
||||||
|
GstVideoFilterClass parent_class;
|
||||||
|
|
||||||
gint filterid;
|
gint filterid;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
/* properties for the various pp filters */
|
||||||
ARG_0,
|
/* common props */
|
||||||
ARG_QUALITY
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_QUALITY,
|
||||||
|
PROP_AUTOQ,
|
||||||
|
PROP_SCOPE,
|
||||||
|
PROP_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* possible filter scopes */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SCOPE_BOTH,
|
||||||
|
SCOPE_CHROMA,
|
||||||
|
SCOPE_LUMA
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_QUALITY PP_QUALITY_MAX
|
||||||
|
#define DEFAULT_AUTOQ FALSE
|
||||||
|
#define DEFAULT_SCOPE SCOPE_BOTH
|
||||||
|
|
||||||
|
/* deblocking props */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_DIFF = PROP_MAX,
|
||||||
|
PROP_FLAT
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_DIFF -1
|
||||||
|
#define DEFAULT_FLAT -1
|
||||||
|
|
||||||
|
/* denoise props */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_T1 = PROP_MAX,
|
||||||
|
PROP_T2,
|
||||||
|
PROP_T3
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_T1 -1
|
||||||
|
#define DEFAULT_T2 -1
|
||||||
|
#define DEFAULT_T3 -1
|
||||||
|
|
||||||
|
/* autolevels */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_RANGE = PROP_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_RANGE FALSE
|
||||||
|
|
||||||
|
/* forceq props */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_QUANT = PROP_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_QUANT -1
|
||||||
|
|
||||||
|
|
||||||
/* hashtable, key = gtype, value = filterdetails index */
|
/* hashtable, key = gtype, value = filterdetails index */
|
||||||
static GHashTable *global_plugins;
|
static GHashTable *global_plugins;
|
||||||
|
|
||||||
/* TODO : add support for the other format supported by libpostproc */
|
/* TODO : add support for the other format supported by libpostproc */
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_postproc_src_template =
|
static GstStaticPadTemplate gst_post_proc_src_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("src",
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ IYUV, I420, YV12 }"))
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_postproc_sink_template =
|
static GstStaticPadTemplate gst_post_proc_sink_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ IYUV, I420, YV12 }"))
|
||||||
);
|
);
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (postproc_debug);
|
GST_DEBUG_CATEGORY (postproc_debug);
|
||||||
#define GST_CAT_DEFAULT postproc_debug
|
#define GST_CAT_DEFAULT postproc_debug
|
||||||
|
|
||||||
static void gst_postproc_class_init (GstPostProcClass * klass);
|
static void gst_post_proc_class_init (GstPostProcClass * klass);
|
||||||
static void gst_postproc_base_init (GstPostProcClass * klass);
|
static void gst_post_proc_base_init (GstPostProcClass * klass);
|
||||||
static void gst_postproc_init (GstPostProc * pproc);
|
static void gst_post_proc_init (GstPostProc * pproc);
|
||||||
static void gst_postproc_dispose (GObject * object);
|
static void gst_post_proc_dispose (GObject * object);
|
||||||
|
|
||||||
static GstPadLinkReturn gst_postproc_link (GstPad * pad, const GstCaps * caps);
|
static gboolean gst_post_proc_setcaps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
GstCaps * outcaps);
|
||||||
|
static GstFlowReturn gst_post_proc_transform_ip (GstBaseTransform * btrans,
|
||||||
|
GstBuffer * in);
|
||||||
|
|
||||||
static void gst_postproc_chain (GstPad * pad, GstData * data);
|
/* static GstStateChangeReturn gst_post_proc_change_state (GstElement * element, */
|
||||||
|
/* GstStateChange transition); */
|
||||||
|
|
||||||
static GstStateChangeReturn gst_postproc_change_state (GstElement * element,
|
static void gst_post_proc_set_property (GObject * object,
|
||||||
GstStateChange transition);
|
guint prop_id, const GValue * value, GParamSpec *pspec);
|
||||||
|
static void gst_post_proc_get_property (GObject * object,
|
||||||
static void gst_postproc_set_property ( GObject * object, guint prop_id,
|
guint prop_id, GValue * value, GParamSpec *pspec);
|
||||||
const GValue * value,
|
static void gst_post_proc_deblock_set_property (GObject * object,
|
||||||
GParamSpec *pspec );
|
guint prop_id, const GValue * value, GParamSpec *pspec);
|
||||||
static void gst_postproc_get_property ( GObject * object, guint prop_id,
|
static void gst_post_proc_deblock_get_property (GObject * object,
|
||||||
GValue * value, GParamSpec *pspec );
|
guint prop_id, GValue * value, GParamSpec *pspec);
|
||||||
|
static void gst_post_proc_autolevels_set_property (GObject * object,
|
||||||
|
guint prop_id, const GValue * value, GParamSpec *pspec);
|
||||||
|
static void gst_post_proc_autolevels_get_property (GObject * object,
|
||||||
|
guint prop_id, GValue * value, GParamSpec *pspec);
|
||||||
|
static void gst_post_proc_tmpnoise_set_property (GObject * object,
|
||||||
|
guint prop_id, const GValue * value, GParamSpec *pspec);
|
||||||
|
static void gst_post_proc_tmpnoise_get_property (GObject * object,
|
||||||
|
guint prop_id, GValue * value, GParamSpec *pspec);
|
||||||
|
static void gst_post_proc_forcequant_set_property (GObject * object,
|
||||||
|
guint prop_id, const GValue * value, GParamSpec *pspec);
|
||||||
|
static void gst_post_proc_forcequant_get_property (GObject * object,
|
||||||
|
guint prop_id, GValue * value, GParamSpec *pspec);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
|
#define GST_TYPE_PP_SCOPE (gst_pp_scope_get_type())
|
||||||
|
static GType
|
||||||
|
gst_pp_scope_get_type (void)
|
||||||
|
{
|
||||||
|
static GType pp_scope_type = 0;
|
||||||
|
|
||||||
|
static const GEnumValue pp_scope[] = {
|
||||||
|
{0, "Chrominance and Luminance filtering", "both"},
|
||||||
|
{1, "Chrominance only filtering", "chroma"},
|
||||||
|
{2, "Luminance only filtering", "luma"},
|
||||||
|
{0, NULL, NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!pp_scope_type) {
|
||||||
|
pp_scope_type =
|
||||||
|
g_enum_register_static ("GstPostProcPPScope", pp_scope);
|
||||||
|
}
|
||||||
|
return pp_scope_type;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
static void
|
static void
|
||||||
gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
|
gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
|
||||||
|
@ -166,25 +280,22 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
|
||||||
#define ROUND_UP_8(x) (((x)+7)&~7)
|
#define ROUND_UP_8(x) (((x)+7)&~7)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_context ( GstPostProc * postproc , gint width, gint height )
|
change_context (GstPostProc * postproc, gint width, gint height)
|
||||||
{
|
{
|
||||||
GstCPUFlags flags;
|
guint flags;
|
||||||
int ppflags;
|
gint ppflags;
|
||||||
/*
|
|
||||||
TODO : We need to find out what CPU flags we have in order to set
|
|
||||||
MMX/MMX2/3DNOW optimizations
|
|
||||||
*/
|
|
||||||
|
|
||||||
GST_DEBUG ("change_context, width:%d, height:%d",
|
GST_DEBUG_OBJECT (postproc, "change_context, width:%d, height:%d",
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
if ((width != postproc->width) && (height != postproc->height)) {
|
if ((width != postproc->width) && (height != postproc->height)) {
|
||||||
if (postproc->context)
|
if (postproc->context)
|
||||||
pp_free_context (postproc->context);
|
pp_free_context (postproc->context);
|
||||||
flags = gst_cpu_get_flags();
|
flags = oil_cpu_get_flags();
|
||||||
ppflags = (flags & GST_CPU_FLAG_MMX ? PP_CPU_CAPS_MMX : 0)
|
ppflags = (flags & OIL_IMPL_FLAG_MMX ? PP_CPU_CAPS_MMX : 0)
|
||||||
| (flags & GST_CPU_FLAG_MMXEXT ? PP_CPU_CAPS_MMX2 : 0)
|
| (flags & OIL_IMPL_FLAG_MMXEXT ? PP_CPU_CAPS_MMX2 : 0)
|
||||||
| (flags & GST_CPU_FLAG_3DNOW ? PP_CPU_CAPS_3DNOW : 0);
|
| (flags & OIL_IMPL_FLAG_3DNOW ? PP_CPU_CAPS_3DNOW : 0)
|
||||||
|
| (flags & OIL_IMPL_FLAG_ALTIVEC ? PP_CPU_CAPS_ALTIVEC : 0);
|
||||||
postproc->context = pp_get_context (width, height, PP_FORMAT_420 | ppflags);
|
postproc->context = pp_get_context (width, height, PP_FORMAT_420 | ppflags);
|
||||||
postproc->width = width;
|
postproc->width = width;
|
||||||
postproc->height = height;
|
postproc->height = height;
|
||||||
|
@ -194,24 +305,52 @@ change_context ( GstPostProc * postproc , gint width, gint height )
|
||||||
postproc->ysize = postproc->ystride * ROUND_UP_2 (height);
|
postproc->ysize = postproc->ystride * ROUND_UP_2 (height);
|
||||||
postproc->usize = postproc->ustride * ROUND_UP_2 (height) / 2;
|
postproc->usize = postproc->ustride * ROUND_UP_2 (height) / 2;
|
||||||
postproc->vsize = postproc->vstride * ROUND_UP_2 (height) / 2;
|
postproc->vsize = postproc->vstride * ROUND_UP_2 (height) / 2;
|
||||||
GST_DEBUG ("new strides are (YUV) : %d %d %d",
|
GST_DEBUG_OBJECT (postproc, "new strides are (YUV) : %d %d %d",
|
||||||
postproc->ystride, postproc->ustride, postproc->vstride);
|
postproc->ystride, postproc->ustride, postproc->vstride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/* append app to *base, and places result in *base */
|
||||||
change_mode ( GstPostProc * postproc )
|
/* all input strings are free'd */
|
||||||
|
static void inline
|
||||||
|
append (gchar ** base, gchar * app)
|
||||||
{
|
{
|
||||||
GstPostProcClass * klass = (GstPostProcClass *) G_OBJECT_GET_CLASS (G_OBJECT (postproc));
|
gchar *res;
|
||||||
|
gchar *sep;
|
||||||
|
|
||||||
if (postproc->mode)
|
if (**base && *app)
|
||||||
pp_free_mode (postproc->mode);
|
sep = ":";
|
||||||
postproc->mode = pp_get_mode_by_name_and_quality (filterdetails[klass->filterid].shortname,
|
else
|
||||||
postproc->quality);
|
sep = "";
|
||||||
|
res = g_strconcat (*base, sep, app, NULL);
|
||||||
|
g_free (*base);
|
||||||
|
g_free (app);
|
||||||
|
*base = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_postproc_base_init ( GstPostProcClass * klass)
|
change_mode (GstPostProc * postproc )
|
||||||
|
{
|
||||||
|
GstPostProcClass * klass;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
|
klass = (GstPostProcClass *) G_OBJECT_GET_CLASS (G_OBJECT (postproc));
|
||||||
|
|
||||||
|
if (postproc->mode)
|
||||||
|
pp_free_mode (postproc->mode);
|
||||||
|
|
||||||
|
name = g_strdup (filterdetails[klass->filterid].shortname);
|
||||||
|
append (&name, g_strdup (postproc->cargs));
|
||||||
|
append (&name, g_strdup (postproc->args));
|
||||||
|
GST_DEBUG_OBJECT (postproc, "requesting pp %s", name);
|
||||||
|
postproc->mode = pp_get_mode_by_name_and_quality (name, postproc->quality);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
g_assert (postproc->mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_base_init (GstPostProcClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
@ -221,61 +360,142 @@ gst_postproc_base_init ( GstPostProcClass * klass)
|
||||||
ppidx = GPOINTER_TO_INT (g_hash_table_lookup (global_plugins,
|
ppidx = GPOINTER_TO_INT (g_hash_table_lookup (global_plugins,
|
||||||
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class))));
|
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class))));
|
||||||
|
|
||||||
details.longname = g_strdup_printf ("LibPostProc %s filter", filterdetails[ppidx].longname);
|
details.longname = g_strdup_printf ("LibPostProc %s filter",
|
||||||
|
filterdetails[ppidx].longname);
|
||||||
details.klass = "Filter/Video";
|
details.klass = "Filter/Video";
|
||||||
details.description = g_strdup_printf ("LibPostProc %s", filterdetails[ppidx].description);
|
details.description = g_strdup_printf ("LibPostProc %s",
|
||||||
details.author = "Edward Hervey <edward@fluendo.com>";
|
filterdetails[ppidx].description);
|
||||||
|
details.author = "Edward Hervey <edward@fluendo.com>, Mark Nauwelaerts (manauw@skynet.be)";
|
||||||
gst_element_class_set_details (element_class, &details);
|
gst_element_class_set_details (element_class, &details);
|
||||||
g_free(details.longname);
|
g_free(details.longname);
|
||||||
g_free(details.description);
|
g_free(details.description);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_pad_template (element_class,
|
||||||
gst_static_pad_template_get (&gst_postproc_src_template));
|
gst_static_pad_template_get (&gst_post_proc_src_template));
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_pad_template (element_class,
|
||||||
gst_static_pad_template_get (&gst_postproc_sink_template));
|
gst_static_pad_template_get (&gst_post_proc_sink_template));
|
||||||
|
|
||||||
klass->filterid = ppidx;
|
klass->filterid = ppidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_postproc_class_init (GstPostProcClass * klass)
|
gst_post_proc_class_init (GstPostProcClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
/* GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); */
|
||||||
|
GstBaseTransformClass *btrans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
||||||
|
gint ppidx;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, ARG_QUALITY,
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_post_proc_set_property);
|
||||||
g_param_spec_uint ("quality", "Quality",
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_post_proc_get_property);
|
||||||
"Quality level of filter (6:best)",
|
|
||||||
0, 6, 6, G_PARAM_READWRITE));
|
|
||||||
|
|
||||||
gobject_class->dispose = gst_postproc_dispose;
|
/* common props */
|
||||||
gobject_class->set_property = gst_postproc_set_property;
|
g_object_class_install_property (gobject_class, PROP_QUALITY,
|
||||||
gobject_class->get_property = gst_postproc_get_property;
|
g_param_spec_uint ("quality", "Quality",
|
||||||
gstelement_class->change_state = gst_postproc_change_state;
|
"Quality level of filter (higher is better)",
|
||||||
|
0, PP_QUALITY_MAX, DEFAULT_QUALITY, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_AUTOQ,
|
||||||
|
g_param_spec_boolean ("autoq", "AutoQ",
|
||||||
|
"Automatically switch filter off if CPU too slow",
|
||||||
|
DEFAULT_AUTOQ, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_SCOPE,
|
||||||
|
g_param_spec_enum ("scope", "Scope",
|
||||||
|
"Operate on chrominance and/or luminance",
|
||||||
|
GST_TYPE_PP_SCOPE, DEFAULT_SCOPE, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
ppidx = klass->filterid;
|
||||||
|
/* per filter props */
|
||||||
|
if (g_strrstr (filterdetails[ppidx].longname, "deblock") != NULL &&
|
||||||
|
filterdetails[ppidx].longname[0] != 'x') {
|
||||||
|
/* deblocking */
|
||||||
|
g_object_class_install_property (gobject_class, PROP_DIFF,
|
||||||
|
g_param_spec_int ("difference", "Difference Factor",
|
||||||
|
"Higher values mean more deblocking (-1 = pp default)",
|
||||||
|
-1, G_MAXINT, DEFAULT_DIFF, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_FLAT,
|
||||||
|
g_param_spec_int ("flatness", "Flatness Threshold",
|
||||||
|
"Lower values mean more deblocking (-1 = pp default)",
|
||||||
|
-1, G_MAXINT, DEFAULT_FLAT, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
gobject_class->set_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_deblock_set_property);
|
||||||
|
gobject_class->get_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_deblock_get_property);
|
||||||
|
} else if (!(g_ascii_strcasecmp (filterdetails[ppidx].shortname, "tn"))) {
|
||||||
|
/* tmpnoise */
|
||||||
|
g_object_class_install_property (gobject_class, PROP_T1,
|
||||||
|
g_param_spec_int ("threshold-1", "Threshold One",
|
||||||
|
"Higher values mean stronger filtering (-1 = pp default)",
|
||||||
|
-1, G_MAXINT, DEFAULT_T1, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_T2,
|
||||||
|
g_param_spec_int ("threshold-2", "Threshold Two",
|
||||||
|
"Higher values mean stronger filtering (-1 = pp default)",
|
||||||
|
-1, G_MAXINT, DEFAULT_T2, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_T3,
|
||||||
|
g_param_spec_int ("threshold-3", "Threshold Three",
|
||||||
|
"Higher values mean stronger filtering (-1 = pp default)",
|
||||||
|
-1, G_MAXINT, DEFAULT_T3, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
gobject_class->set_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_tmpnoise_set_property);
|
||||||
|
gobject_class->get_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_tmpnoise_get_property);
|
||||||
|
} else if (!(g_ascii_strcasecmp (filterdetails[ppidx].shortname, "al"))) {
|
||||||
|
/* autolevels */
|
||||||
|
g_object_class_install_property (gobject_class, PROP_RANGE,
|
||||||
|
g_param_spec_boolean ("fully-range", "Fully Range",
|
||||||
|
"Stretch luminance to (0-255)",
|
||||||
|
DEFAULT_RANGE, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
gobject_class->set_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_autolevels_set_property);
|
||||||
|
gobject_class->get_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_autolevels_get_property);
|
||||||
|
|
||||||
|
} else if (!(g_ascii_strcasecmp (filterdetails[ppidx].shortname, "fq"))) {
|
||||||
|
/* forcequant */
|
||||||
|
g_object_class_install_property (gobject_class, PROP_QUANT,
|
||||||
|
g_param_spec_int ("quantizer", "Force Quantizer",
|
||||||
|
"Quantizer to use (-1 = pp default)",
|
||||||
|
-1, G_MAXINT, DEFAULT_QUANT, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
gobject_class->set_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_forcequant_set_property);
|
||||||
|
gobject_class->get_property =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_post_proc_forcequant_get_property);
|
||||||
|
}
|
||||||
|
|
||||||
|
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_post_proc_dispose);
|
||||||
|
btrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_post_proc_setcaps);
|
||||||
|
btrans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_post_proc_transform_ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_postproc_init (GstPostProc * postproc)
|
gst_post_proc_init (GstPostProc * postproc)
|
||||||
{
|
{
|
||||||
GST_FLAG_SET (postproc, GST_ELEMENT_WORK_IN_PLACE);
|
/* properties */
|
||||||
|
postproc->quality = DEFAULT_QUALITY;
|
||||||
postproc->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get
|
postproc->autoq = DEFAULT_AUTOQ;
|
||||||
(&gst_postproc_sink_template),
|
postproc->scope = DEFAULT_SCOPE;
|
||||||
"sink");
|
postproc->diff = DEFAULT_DIFF;
|
||||||
gst_pad_set_link_function (postproc->sinkpad, gst_postproc_link);
|
postproc->flat = DEFAULT_FLAT;
|
||||||
gst_pad_set_chain_function (postproc->sinkpad, gst_postproc_chain);
|
postproc->quant = DEFAULT_QUANT;
|
||||||
gst_element_add_pad (GST_ELEMENT (postproc), postproc->sinkpad);
|
postproc->t1 = DEFAULT_T1;
|
||||||
|
postproc->t2 = DEFAULT_T2;
|
||||||
postproc->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
|
postproc->t3 = DEFAULT_T3;
|
||||||
(&gst_postproc_src_template),
|
postproc->range = DEFAULT_RANGE;
|
||||||
"src");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (postproc), postproc->srcpad);
|
|
||||||
|
|
||||||
postproc->quality = 6;
|
|
||||||
postproc->mode = NULL;
|
postproc->mode = NULL;
|
||||||
|
postproc->cargs = g_strdup ("");
|
||||||
|
postproc->args = g_strdup ("");
|
||||||
change_mode (postproc);
|
change_mode (postproc);
|
||||||
|
|
||||||
postproc->context = NULL;
|
postproc->context = NULL;
|
||||||
postproc->width = 0;
|
postproc->width = 0;
|
||||||
postproc->height = 0;
|
postproc->height = 0;
|
||||||
|
@ -288,179 +508,338 @@ gst_postproc_init (GstPostProc * postproc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_postproc_dispose (GObject * object)
|
gst_post_proc_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
GstPostProc * postproc = (GstPostProc *) object;
|
GstPostProc * postproc = (GstPostProc *) object;
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
|
|
||||||
if (postproc->mode)
|
if (postproc->mode)
|
||||||
pp_free_mode(postproc->mode);
|
pp_free_mode (postproc->mode);
|
||||||
if (postproc->context)
|
if (postproc->context)
|
||||||
pp_free_context(postproc->context);
|
pp_free_context (postproc->context);
|
||||||
|
|
||||||
|
g_free (postproc->cargs);
|
||||||
|
postproc->cargs = NULL;
|
||||||
|
g_free (postproc->args);
|
||||||
|
postproc->args = NULL;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static gboolean
|
||||||
gst_postproc_link (GstPad * pad, const GstCaps * caps)
|
gst_post_proc_setcaps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
GstCaps * outcaps)
|
||||||
{
|
{
|
||||||
GstPostProc *postproc;
|
GstPostProc *postproc = (GstPostProc *) (btrans);
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstPad *otherpad;
|
gboolean ret = FALSE;
|
||||||
gboolean res;
|
|
||||||
GstPadLinkReturn ret;
|
|
||||||
gint width, height;
|
gint width, height;
|
||||||
/* create/replace pp_context here */
|
|
||||||
|
|
||||||
postproc = (GstPostProc *) gst_pad_get_parent (pad);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
otherpad = (pad == postproc->sinkpad) ? postproc->srcpad : postproc->sinkpad;
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
|
||||||
res = gst_structure_get_int (structure, "width", &width);
|
|
||||||
res &= gst_structure_get_int (structure, "height", &height);
|
|
||||||
|
|
||||||
if (!res)
|
|
||||||
return GST_PAD_LINK_REFUSED;
|
|
||||||
|
|
||||||
ret = gst_pad_try_set_caps (otherpad, caps);
|
|
||||||
|
|
||||||
if (GST_PAD_LINK_FAILED (ret))
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
|
if (gst_structure_get_int (structure, "width", &width) &&
|
||||||
|
gst_structure_get_int (structure, "height", &height)) {
|
||||||
change_context (postproc, width, height);
|
change_context (postproc, width, height);
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return GST_PAD_LINK_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_postproc_chain (GstPad * pad, GstData * data)
|
gst_post_proc_transform_ip (GstBaseTransform * btrans, GstBuffer * in)
|
||||||
{
|
{
|
||||||
GstPostProc *postproc;
|
GstPostProc *postproc;
|
||||||
GstBuffer *in, *out;
|
gint stride[3];
|
||||||
int stride[3];
|
guint8 *outplane[3];
|
||||||
unsigned char * outplane[3];
|
|
||||||
|
|
||||||
GST_DEBUG("chaining");
|
|
||||||
|
|
||||||
/* postprocess the buffer !*/
|
/* postprocess the buffer !*/
|
||||||
postproc = (GstPostProc *) gst_pad_get_parent (pad);
|
postproc = (GstPostProc *) btrans;
|
||||||
|
|
||||||
g_return_if_fail(GST_IS_BUFFER (data));
|
|
||||||
g_return_if_fail(postproc->mode != NULL);
|
|
||||||
g_return_if_fail(postproc->context != NULL);
|
|
||||||
|
|
||||||
in = GST_BUFFER (data);
|
|
||||||
out = gst_buffer_copy_on_write (in);
|
|
||||||
|
|
||||||
stride[0] = postproc->ystride;
|
stride[0] = postproc->ystride;
|
||||||
stride[1] = postproc->ustride;
|
stride[1] = postproc->ustride;
|
||||||
stride[2] = postproc->vstride;
|
stride[2] = postproc->vstride;
|
||||||
/* inplane[0] = GST_BUFFER_DATA(in); */
|
outplane[0] = GST_BUFFER_DATA (in);
|
||||||
/* inplane[1] = inplane[0] + postproc->ysize; */
|
|
||||||
/* inplane[2] = inplane[1] + postproc->usize; */
|
|
||||||
outplane[0] = GST_BUFFER_DATA(out);
|
|
||||||
outplane[1] = outplane[0] + postproc->ysize;
|
outplane[1] = outplane[0] + postproc->ysize;
|
||||||
outplane[2] = outplane[1] + postproc->usize;
|
outplane[2] = outplane[1] + postproc->usize;
|
||||||
|
|
||||||
GST_DEBUG ("calling pp_postprocess, width:%d, height:%d",
|
GST_DEBUG_OBJECT (postproc, "calling pp_postprocess, width:%d, height:%d",
|
||||||
postproc->width, postproc->height);
|
postproc->width, postproc->height);
|
||||||
|
|
||||||
pp_postprocess (outplane, stride,
|
pp_postprocess (outplane, stride, outplane, stride,
|
||||||
outplane, stride,
|
postproc->width, postproc->height, (int8_t*) "", 0,
|
||||||
postproc->width,
|
postproc->mode, postproc->context, 0);
|
||||||
postproc->height,
|
|
||||||
"", 0,
|
|
||||||
postproc->mode, postproc->context, 1);
|
|
||||||
|
|
||||||
gst_buffer_stamp (out, in);
|
|
||||||
|
|
||||||
gst_pad_push (postproc->srcpad, GST_DATA (out));
|
|
||||||
/*
|
|
||||||
void pp_postprocess(uint8_t * src[3], int srcStride[3],
|
|
||||||
uint8_t * dst[3], int dstStride[3],
|
|
||||||
int horizontalSize, int verticalSize,
|
|
||||||
QP_STORE_T *QP_store, int QP_stride,
|
|
||||||
pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
|
|
||||||
|
|
||||||
src is the src buffer data
|
|
||||||
srcStride is ->ystride, ->ustride, ->vstride
|
|
||||||
dst same as src
|
|
||||||
dstStride same as srcStride
|
|
||||||
horizontalSize and VerticalsSize are obvious
|
|
||||||
QP_store can be null and qp_stride too
|
|
||||||
mode = mode
|
|
||||||
context = context
|
|
||||||
pict_type = 0
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
|
||||||
gst_postproc_change_state (GstElement * element, GstStateChange transition)
|
|
||||||
{
|
|
||||||
GstPostProc *postproc = (GstPostProc *) element;
|
|
||||||
/* don't go to play if we don't have mode and context */
|
|
||||||
|
|
||||||
switch (transition) {
|
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
||||||
if ((!postproc->mode) && (!postproc->context))
|
|
||||||
return GST_STATE_CHANGE_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parent_class->change_state)
|
|
||||||
return parent_class->change_state (element, transition);
|
|
||||||
|
|
||||||
return GST_STATE_CHANGE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_postproc_set_property ( GObject * object, guint prop_id,
|
gst_post_proc_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value,
|
const GValue * value, GParamSpec *pspec)
|
||||||
GParamSpec *pspec )
|
|
||||||
{
|
{
|
||||||
GstPostProc *postproc = (GstPostProc *) object;
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
gint quality;
|
gint quality;
|
||||||
|
gchar *args;
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_QUALITY:
|
case PROP_QUALITY:
|
||||||
quality = g_value_get_uint (value);
|
quality = g_value_get_uint (value);
|
||||||
if (quality != postproc->quality) {
|
break;
|
||||||
postproc->quality = quality;
|
case PROP_AUTOQ:
|
||||||
change_mode (postproc);
|
postproc->autoq = g_value_get_boolean (value);
|
||||||
}
|
break;
|
||||||
|
case PROP_SCOPE:
|
||||||
|
postproc->scope = g_value_get_enum (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* construct common args */
|
||||||
|
args = postproc->autoq ? g_strdup ("autoq") : g_strdup ("");
|
||||||
|
switch (postproc->scope) {
|
||||||
|
case SCOPE_BOTH:
|
||||||
|
break;
|
||||||
|
case SCOPE_CHROMA:
|
||||||
|
append (&args, g_strdup ("noluma"));
|
||||||
|
break;
|
||||||
|
case SCOPE_LUMA:
|
||||||
|
append (&args, g_strdup ("nochrom"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (postproc->cargs);
|
||||||
|
postproc->cargs = args;
|
||||||
|
|
||||||
|
change_mode (postproc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_postproc_get_property ( GObject * object, guint prop_id,
|
gst_post_proc_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_QUALITY:
|
||||||
|
g_value_set_uint (value, postproc->quality);
|
||||||
|
break;
|
||||||
|
case PROP_AUTOQ:
|
||||||
|
g_value_set_boolean (value, postproc->autoq);
|
||||||
|
break;
|
||||||
|
case PROP_SCOPE:
|
||||||
|
g_value_set_enum (value, postproc->scope);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_deblock_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_DIFF:
|
||||||
|
postproc->diff = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
case PROP_FLAT:
|
||||||
|
postproc->flat = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_post_proc_set_property (object, prop_id, value, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* construct args */
|
||||||
|
g_free (postproc->args);
|
||||||
|
if (postproc->diff >= 0) {
|
||||||
|
postproc->args = g_strdup_printf ("%d", postproc->diff);
|
||||||
|
if (postproc->flat >= 0)
|
||||||
|
append (&postproc->args, g_strdup_printf ("%d", postproc->flat));
|
||||||
|
} else
|
||||||
|
postproc->args = g_strdup ("");
|
||||||
|
change_mode (postproc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_deblock_get_property ( GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec *pspec )
|
GValue * value, GParamSpec *pspec )
|
||||||
{
|
{
|
||||||
GstPostProc *postproc = (GstPostProc *) object;
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_QUALITY:
|
case PROP_DIFF:
|
||||||
g_value_set_uint (value, postproc->quality);
|
g_value_set_int (value, postproc->diff);
|
||||||
|
break;
|
||||||
|
case PROP_FLAT:
|
||||||
|
g_value_set_int (value, postproc->flat);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
gst_post_proc_get_property (object, prop_id, value, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_tmpnoise_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_T1:
|
||||||
|
postproc->t1 = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
case PROP_T2:
|
||||||
|
postproc->t2 = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
case PROP_T3:
|
||||||
|
postproc->t3 = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_post_proc_set_property (object, prop_id, value, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* construct args */
|
||||||
|
g_free (postproc->args);
|
||||||
|
if (postproc->t1 >= 0) {
|
||||||
|
postproc->args = g_strdup_printf ("%d", postproc->t1);
|
||||||
|
if (postproc->t2 >= 0) {
|
||||||
|
append (&postproc->args, g_strdup_printf ("%d", postproc->t2));
|
||||||
|
if (postproc->t3 >= 0)
|
||||||
|
append (&postproc->args, g_strdup_printf ("%d", postproc->t3));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
postproc->args = g_strdup ("");
|
||||||
|
change_mode (postproc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_tmpnoise_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec *pspec )
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_T1:
|
||||||
|
g_value_set_int (value, postproc->t1);
|
||||||
|
break;
|
||||||
|
case PROP_T2:
|
||||||
|
g_value_set_int (value, postproc->t2);
|
||||||
|
break;
|
||||||
|
case PROP_T3:
|
||||||
|
g_value_set_int (value, postproc->t3);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_post_proc_get_property (object, prop_id, value, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_autolevels_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_RANGE:
|
||||||
|
postproc->range = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_post_proc_set_property (object, prop_id, value, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* construct args */
|
||||||
|
g_free (postproc->args);
|
||||||
|
if (postproc->range)
|
||||||
|
postproc->args = g_strdup ("f");
|
||||||
|
else
|
||||||
|
postproc->args = g_strdup ("");
|
||||||
|
change_mode (postproc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_autolevels_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec *pspec )
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_RANGE:
|
||||||
|
g_value_set_boolean (value, postproc->range);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_post_proc_get_property (object, prop_id, value, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_forcequant_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_QUANT:
|
||||||
|
postproc->quant = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_post_proc_set_property (object, prop_id, value, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* construct args */
|
||||||
|
g_free (postproc->args);
|
||||||
|
if (postproc->quant >= 0)
|
||||||
|
postproc->args = g_strdup_printf ("%d", postproc->quant);
|
||||||
|
else
|
||||||
|
postproc->args = g_strdup ("");
|
||||||
|
change_mode (postproc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_post_proc_forcequant_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec *pspec )
|
||||||
|
{
|
||||||
|
GstPostProc *postproc = (GstPostProc *) object;
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_QUANT:
|
||||||
|
g_value_set_int (value, postproc->quant);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_post_proc_get_property (object, prop_id, value, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_postproc_register(GstPlugin * plugin)
|
gst_post_proc_register(GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
GTypeInfo typeinfo = {
|
GTypeInfo typeinfo = {
|
||||||
sizeof (GstPostProcClass),
|
sizeof (GstPostProcClass),
|
||||||
(GBaseInitFunc) gst_postproc_base_init,
|
(GBaseInitFunc) gst_post_proc_base_init,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc) gst_postproc_class_init,
|
(GClassInitFunc) gst_post_proc_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof (GstPostProc),
|
sizeof (GstPostProc),
|
||||||
0,
|
0,
|
||||||
(GInstanceInitFunc) gst_postproc_init,
|
(GInstanceInitFunc) gst_post_proc_init,
|
||||||
};
|
};
|
||||||
GType type;
|
GType type;
|
||||||
int i;
|
int i;
|
||||||
|
@ -469,8 +848,7 @@ gst_postproc_register(GstPlugin * plugin)
|
||||||
for (i = 0; filterdetails[i].shortname; i++) {
|
for (i = 0; filterdetails[i].shortname; i++) {
|
||||||
gchar *type_name;
|
gchar *type_name;
|
||||||
|
|
||||||
g_hash_table_insert (global_plugins,
|
g_hash_table_insert (global_plugins, GINT_TO_POINTER (0),
|
||||||
GINT_TO_POINTER (0),
|
|
||||||
GINT_TO_POINTER (i));
|
GINT_TO_POINTER (i));
|
||||||
|
|
||||||
/* create type_name */
|
/* create type_name */
|
||||||
|
@ -481,10 +859,10 @@ gst_postproc_register(GstPlugin * plugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create gtype */
|
/* create gtype */
|
||||||
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
type = g_type_register_static (GST_TYPE_VIDEO_FILTER, type_name,
|
||||||
|
&typeinfo, 0);
|
||||||
|
|
||||||
g_hash_table_insert (global_plugins,
|
g_hash_table_insert (global_plugins, GINT_TO_POINTER (type),
|
||||||
GINT_TO_POINTER (type),
|
|
||||||
GINT_TO_POINTER (i));
|
GINT_TO_POINTER (i));
|
||||||
|
|
||||||
/* register element */
|
/* register element */
|
||||||
|
@ -496,19 +874,21 @@ gst_postproc_register(GstPlugin * plugin)
|
||||||
g_free(type_name);
|
g_free(type_name);
|
||||||
}
|
}
|
||||||
g_hash_table_remove (global_plugins, GINT_TO_POINTER (0));
|
g_hash_table_remove (global_plugins, GINT_TO_POINTER (0));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
GST_DEBUG_CATEGORY_INIT (postproc_debug, "postproc", 0, "video postprocessing elements");
|
GST_DEBUG_CATEGORY_INIT (postproc_debug, "postproc", 0,
|
||||||
|
"video postprocessing elements");
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
av_log_set_callback (gst_ffmpeg_log_callback);
|
av_log_set_callback (gst_ffmpeg_log_callback);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Register the filters */
|
/* Register the filters */
|
||||||
gst_postproc_register( plugin );
|
gst_post_proc_register (plugin);
|
||||||
|
|
||||||
/* Now we can return the pointer to the newly created Plugin object. */
|
/* Now we can return the pointer to the newly created Plugin object. */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (C) 2005 Edward Hervey (edward@fluendo.com)
|
|
||||||
|
|
||||||
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 of the License, 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 __GST_POSTPROC_H__
|
|
||||||
#define __GST_POSTPROC_H__
|
|
||||||
|
|
||||||
#ifdef HAVE_FFMPEG_UNINSTALLED
|
|
||||||
#include <avcodec.h>
|
|
||||||
#include <avformat.h>
|
|
||||||
#else
|
|
||||||
#include <ffmpeg/avcodec.h>
|
|
||||||
#include <ffmpeg/avformat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (postproc_debug);
|
|
||||||
#define GST_CAT_DEFAULT postproc_debug
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
extern gboolean gst_postproc_register (GstPlugin * plugin);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in a new issue