The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
Víctor Manuel Jáquez Leal <vjaq... @igalia.com>
Date: Fri, 10 Dec 2010 20:59:16 +0100
Local: Fri, Dec 10 2010 2:59 pm
Subject: [PATCH 0/2] audio decoder (aac only)
Hi, This is a more o less stable element for aac audio decoding.
* It works for SN 23.i3.3 and 23.i3.8 * The input requires to be parsed (aacparse required if the stream is not in a container) * The performance for an audio only pipeline is from 10% to 0% of arm usage * A/V rendering looks quite good (IMO)
TODO:
* Fix caps renegotiation when parametric stereo stream is detected * Tests for non-framed streams
Happy holidays.
vmjl
Víctor Manuel Jáquez Leal (2): base: add codec update_params() callback adec: aac decoder implementation
Makefile | 4 +- gstdspadec.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++ gstdspadec.h | 47 +++++++++ gstdspbase.c | 8 ++ gstdspbase.h | 3 + plugin.c | 4 + tidsp/td_aacdec.c | 175 +++++++++++++++++++++++++++++++++ 7 files changed, 519 insertions(+), 2 deletions(-) create mode 100644 gstdspadec.c create mode 100644 gstdspadec.h create mode 100644 tidsp/td_aacdec.c
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Víctor Manuel Jáquez Leal <vjaq... @igalia.com>
Date: Fri, 10 Dec 2010 20:59:17 +0100
Local: Fri, Dec 10 2010 2:59 pm
Subject: [PATCH 1/2] base: add codec update_params() callback
The aacdec SN recives an event message when the stream is detected as parametric stereo[1] when the SN was configured without it support. This patch add the callback update_params(), which will update the SN parameters according to the received message.
1. http://en.wikipedia.org/wiki/Parametric_Stereo
Signed-off-by: Víctor Manuel Jáquez Leal <vjaq... @igalia.com> --- gstdspbase.c | 8 ++++++++ gstdspbase.h | 1 + 2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gstdspbase.c b/gstdspbase.c index 953328a..dd6b98f 100644 --- a/gstdspbase.c +++ b/gstdspbase.c @@ -227,6 +227,14 @@ got_message(GstDspBase *self, pr_debug(self, "playback completed"); break; } + + if (msg->arg_1 == 1 && (msg->arg_2 & 0x0600) == 0x0600) { + struct td_codec *codec = self->codec; + if (codec->update_params && self->node) + codec->update_params(self, self->node, msg->arg_2); + break; + } + pr_warning(self, "DSP event: cmd=0x%04X, arg1=%u, arg2=0x%04X", msg->cmd, msg->arg_1, msg->arg_2); if ((msg->arg_2 & 0x0F00) == 0x0F00) diff --git a/gstdspbase.h b/gstdspbase.h index 829b5b1..0014635 100644 --- a/gstdspbase.h +++ b/gstdspbase.h @@ -56,6 +56,7 @@ struct td_codec { bool (*handle_extra_data)(GstDspBase *base, GstBuffer *buf); void (*flush_buffer)(GstDspBase *base); void (*send_params)(GstDspBase *base, struct dsp_node *node); + void (*update_params) (GstDspBase *base, struct dsp_node *node, uint32_t msg); };
struct _GstDspBase { -- 1.7.0.2
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Víctor Manuel Jáquez Leal <vjaq... @igalia.com>
Date: Fri, 10 Dec 2010 20:59:18 +0100
Local: Fri, Dec 10 2010 2:59 pm
Subject: [PATCH 2/2] adec: aac decoder implementation
This is the first approach of the AAC decoder using the SN mpeg4aacdec_sn.dll64P release 23.i3.3 and 23.i3.8 The performance of a simple pipeline goes among 10% and 0% of CPU usage (montored with top and with gstreamer 0.10.31)
My testing pipeline is something like:
gst-launch filesrc location=test.aac ! aacparse ! dspadec ! alsasink
Issues: when a parametric stereo media is found, a downstream caps renegotiation is done, but somehow (I don't understand why) the renegotiation is not honored and the output is rendered wrong (because of the reduced framerate).
Signed-off-by: Víctor Manuel Jáquez Leal <vjaq... @igalia.com> --- Makefile | 4 +- gstdspadec.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++ gstdspadec.h | 47 +++++++++ gstdspbase.h | 2 + plugin.c | 4 + tidsp/td_aacdec.c | 175 +++++++++++++++++++++++++++++++++ 6 files changed, 510 insertions(+), 2 deletions(-) create mode 100644 gstdspadec.c create mode 100644 gstdspadec.h create mode 100644 tidsp/td_aacdec.c
diff --git a/Makefile b/Makefile index c397101..4303eeb 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ prefix := /usr D = $(DESTDIR)
tidsp.a: tidsp/td_mp4vdec.o tidsp/td_h264dec.o tidsp/td_wmvdec.o \ - tidsp/td_jpegdec.o \ + tidsp/td_jpegdec.o tidsp/td_aacdec.o \ tidsp/td_mp4venc.o tidsp/td_jpegenc.o tidsp/td_h264enc.o tidsp.a: override CFLAGS += -fPIC -I.
@@ -34,7 +34,7 @@ gst_plugin := libgstdsp.so $(gst_plugin): plugin.o gstdspdummy.o gstdspbase.o gstdspvdec.o \ gstdspvenc.o gstdsph263enc.o gstdspmp4venc.o gstdspjpegenc.o \ dsp_bridge.o util.o log.o gstdspparse.o async_queue.o gstdsph264enc.o \ - tidsp.a + gstdspadec.o tidsp.a $(gst_plugin): override CFLAGS += $(GST_CFLAGS) -fPIC \ -D VERSION='"$(version)"' -D DSPDIR='"$(dspdir)"' $(gst_plugin): override LIBS += $(GST_LIBS) diff --git a/gstdspadec.c b/gstdspadec.c new file mode 100644 index 0000000..98ddcb6 --- /dev/null +++ b/gstdspadec.c @@ -0,0 +1,280 @@ +/* + * Copyright (C) 2010 Víctor M. Jáquez Leal + * + * Author: Víctor M. Jáquez Leal <vjaq... @igalia.com> + * + * This file may be used under the terms of the GNU Lesser General Public + * License version 2.1, a copy of which is found in LICENSE included in the + * packaging of this file. + */ + +#include "gstdspadec.h" + +#include "log.h" + +#define GST_CAT_DEFAULT gstdsp_debug + +static GstDspBaseClass *parent_class; + +static inline GstCaps * +generate_sink_template(void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty(); + + struc = gst_structure_new("audio/mpeg", + "mpegversion", GST_TYPE_INT_RANGE, 1, 4, + NULL); + + gst_caps_append_structure(caps, struc); + + return caps; +} + +static inline GstCaps * +generate_src_template(void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty(); + + struc = gst_structure_new("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "channels", GST_TYPE_INT_RANGE, 1, 8, + NULL); + + gst_caps_append_structure(caps, struc); + + return caps; +} + +static void * +create_node(GstDspBase *base) +{ + GstDspADec *self; + struct td_codec *codec; + int dsp_handle; + struct dsp_node *node; + + const struct dsp_uuid usn_uuid = { 0x79A3C8B3, 0x95F2, 0x403F, 0x9A, 0x4B, + { 0xCF, 0x80, 0x57, 0x73, 0x05, 0x41 } }; + + self = GST_DSP_ADEC(base); + dsp_handle = base->dsp_handle; + + if (!gstdsp_register(dsp_handle, &usn_uuid, DSP_DCD_LIBRARYTYPE, "usn.dll64P")) { + pr_err(self, "failed to register usn node library"); + return NULL; + } + + codec = base->codec; + if (!codec) { + pr_err(self, "unknown algorithm"); + return NULL; + } + + pr_info(base, "algo=%s", codec->filename); + + if (!gstdsp_register(dsp_handle, codec->uuid, DSP_DCD_LIBRARYTYPE, codec->filename)) { + pr_err(self, "failed to register algo node library"); + return NULL; + } + + if (!gstdsp_register(dsp_handle, codec->uuid, DSP_DCD_NODETYPE, codec->filename)) { + pr_err(self, "failed to register algo node"); + return NULL; + } + + { + struct dsp_node_attr_in attrs = { + .cb = sizeof(attrs), + .priority = 10, + .timeout = 10000, + }; + void *arg_data; + + codec->create_args(base, &attrs.profile_id, &arg_data); + if (!dsp_node_allocate(dsp_handle, base->proc, codec->uuid, arg_data, &attrs, &node)) { + pr_err(self, "dsp node allocate failed"); + free(arg_data); + return NULL; + } + free(arg_data); + } + + if (!dsp_node_create(dsp_handle, node)) { + pr_err(self, "dsp node create failed"); + dsp_node_free(dsp_handle, node); + return NULL; + } + + pr_info(self, "dsp node created"); + + if (codec->send_params) + codec->send_params(base, node); + + if (codec->setup_params) + codec->setup_params(base); + + base->flush_buffer = codec->flush_buffer; + + return node; +} + +static inline void +configure_caps(GstDspADec *self, + GstCaps *in, + GstCaps *out) +{ + GstDspBase *base; + GstStructure *out_struc, *in_struc; + uint channels; + + + base = GST_DSP_BASE(self); + + in_struc = gst_caps_get_structure(in, 0); + + out_struc = gst_structure_new("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + NULL); + + if (gst_structure_get_int(in_struc, "channels", &channels)) + gst_structure_set(out_struc, "channels", G_TYPE_INT, channels, NULL); + + if (gst_structure_get_int(in_struc, "rate", &self->samplerate)) + gst_structure_set(out_struc, "rate", G_TYPE_INT, self->samplerate, NULL); + + if (base->alg == GSTDSP_AACDEC) { + const char *fmt; + gst_structure_get_boolean(in_struc, "framed", &self->packetised); + fmt = gst_structure_get_string(in_struc, "stream-format"); + self->raw = strcmp(fmt, "raw") == 0; + } + + base->output_buffer_size = 4 * 1024; + + gst_caps_append_structure(out, out_struc); +} + +static gboolean +sink_setcaps(GstPad *pad, + GstCaps *caps) +{ + GstDspADec *self; + GstDspBase *base; + GstStructure *in_struc; + const char *name; + GstCaps *out_caps; + + self = GST_DSP_ADEC(GST_PAD_PARENT(pad)); + base = GST_DSP_BASE(self); + + { + gchar *str = gst_caps_to_string(caps); + pr_info(self, "sink caps: %s", str); + g_free(str); + } + + in_struc = gst_caps_get_structure(caps, 0); + + name = gst_structure_get_name(in_struc); + if (strcmp(name, "audio/mpeg") == 0) { + int version = 1; + + gst_structure_get_int(in_struc, "mpegversion", &version); + if (version == 2 || version == 4) { + base->alg = GSTDSP_AACDEC; + base->codec = &td_aacdec_codec; + } + } + + du_port_alloc_buffers(base->ports[0], 4); + du_port_alloc_buffers(base->ports[1], 4); + + out_caps = gst_caps_new_empty(); + configure_caps(self, caps, out_caps); + base->tmp_caps = out_caps; + + return TRUE; +} + +static void +instance_init(GTypeInstance *instance, + gpointer g_class) +{ + GstDspBase *base; + + base = GST_DSP_BASE(instance); + + base->use_pad_alloc = TRUE; + base->create_node = create_node; + + gst_pad_set_setcaps_function(base->sinkpad, sink_setcaps); +} + +static void +base_init(gpointer g_class) +{ + GstElementClass *element_class; + GstPadTemplate *template; + + element_class = GST_ELEMENT_CLASS(g_class); + + gst_element_class_set_details_simple(element_class, + "DSP audio decoder", + "Codec/Decoder/Audio", + "Decodes audio with TI's DSP algorithms", + "Víctor M. Jáquez Leal"); + + template = gst_pad_template_new("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template()); + + gst_element_class_add_pad_template(element_class, template); + gst_object_unref(template); + + template = gst_pad_template_new("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template()); + + gst_element_class_add_pad_template(element_class, template); + gst_object_unref(template); +} + +static void +class_init(gpointer g_class, + gpointer class_data) +{ + parent_class = g_type_class_peek_parent(g_class); +} + +GType +gst_dsp_adec_get_type(void) +{ + static GType type; + + if (G_UNLIKELY(type == 0)) { + GTypeInfo type_info = { + .class_size = sizeof(GstDspADecClass), + .class_init = class_init, + .base_init = base_init, + .instance_size = sizeof(GstDspADec), + .instance_init = instance_init, + }; + + type = g_type_register_static(GST_DSP_BASE_TYPE, "GstDspADec", &type_info, 0); + } + + return type; +} diff --git a/gstdspadec.h b/gstdspadec.h new file mode 100644 index 0000000..5f48463 --- /dev/null +++ b/gstdspadec.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Víctor M. Jáquez Leal + * + * Author: Víctor M. Jáquez Leal <vjaq... @igalia.com> + * + * This file may be used under the terms of the GNU Lesser General Public + * License version 2.1, a copy of which is found in LICENSE included in the + * packaging of this file. + */ + +#ifndef GST_DSP_ADEC_H +#define GST_DSP_ADEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_DSP_ADEC(obj) (GstDspADec *)(obj) +#define GST_DSP_ADEC_TYPE (gst_dsp_adec_get_type()) +#define GST_DSP_ADEC_CLASS(obj) (GstDspADecClass *)(obj) + +typedef struct GstDspADec GstDspADec; +typedef struct GstDspADecClass GstDspADecClass; + +#include "gstdspbase.h" + +enum { + GSTDSP_AACDEC, +}; + +struct GstDspADec { + GstDspBase element; + guint samplerate; + gboolean parametric_stereo; + gboolean packetised; + gboolean raw; +}; + +struct GstDspADecClass { + GstDspBaseClass parent_class; +}; + +GType gst_dsp_adec_get_type(void); + +G_END_DECLS + +#endif /* GST_DSP_ADEC_H */ diff --git a/gstdspbase.h b/gstdspbase.h index 0014635..90fece4 100644 --- a/gstdspbase.h +++ b/gstdspbase.h @@ -159,6 +159,8 @@ extern struct td_codec td_mp4venc_codec; extern struct td_codec td_jpegenc_codec; extern struct td_codec td_h264enc_codec;
+extern struct td_codec td_aacdec_codec; + G_END_DECLS
#endif /* GST_DSP_BASE_H */
...
read more »
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Felipe Contreras <felipe.contre... @nokia.com>
Date: Mon, 13 Dec 2010 17:34:48 +0200
Local: Mon, Dec 13 2010 10:34 am
Subject: Re: [PATCH 1/2] base: add codec update_params() callback
vjaq
... @igalia.com wrote:
> The aacdec SN recives an event message when the stream is detected
> as parametric stereo[1] when the SN was configured without it
> support.
> This patch add the callback update_params(), which will update the > SN parameters according to the received message.
> 1. http://en.wikipedia.org/wiki/Parametric_Stereo
> Signed-off-by: Víctor Manuel Jáquez Leal <vjaq... @igalia.com> > --- > gstdspbase.c | 8 ++++++++ > gstdspbase.h | 1 + > 2 files changed, 9 insertions(+), 0 deletions(-)
> diff --git a/gstdspbase.c b/gstdspbase.c > index 953328a..dd6b98f 100644 > --- a/gstdspbase.c > +++ b/gstdspbase.c > @@ -227,6 +227,14 @@ got_message(GstDspBase *self, > pr_debug(self, "playback completed"); > break; > } > + > + if (msg->arg_1 == 1 && (msg->arg_2 & 0x0600) == 0x0600) { > + struct td_codec *codec = self->codec; > + if (codec->update_params && self->node)
Why do you check for 'self->node'? If the node is there I don't think got_message could be called.
> + codec->update_params(self, self->node, msg->arg_2); > + break; > + }
Cheers. -- Felipe Contreras
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Felipe Contreras <felipe.contre... @nokia.com>
Date: Mon, 13 Dec 2010 17:38:08 +0200
Local: Mon, Dec 13 2010 10:38 am
Subject: Re: [PATCH 2/2] adec: aac decoder implementation
vjaq
... @igalia.com wrote:
> This is the first approach of the AAC decoder using the SN
> mpeg4aacdec_sn.dll64P release 23.i3.3 and 23.i3.8
> The performance of a simple pipeline goes among 10% and 0% of CPU > usage (montored with top and with gstreamer 0.10.31)
10%? That's a bit too much for sending audio buffers, isn't it?
> My testing pipeline is something like:
> gst-launch filesrc location=test.aac ! aacparse ! dspadec ! alsasink
> Issues: when a parametric stereo media is found, a downstream caps > renegotiation is done, but somehow (I don't understand why) the > renegotiation is not honored and the output is rendered wrong (because > of the reduced framerate).
> Signed-off-by: Víctor Manuel Jáquez Leal <vjaq... @igalia.com>
Looks fine to me. -- Felipe Contreras
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Víctor M. Jáquez L. <vjaq... @igalia.com>
Date: Mon, 13 Dec 2010 16:55:21 +0100
Local: Mon, Dec 13 2010 10:55 am
Subject: Re: [PATCH 1/2] base: add codec update_params() callback
On Mon, Dec 13, 2010 at 05:34:48PM +0200, Felipe Contreras wrote:
> vjaq
... @igalia.com wrote:
> > The aacdec SN recives an event message when the stream is detected
> > as parametric stereo[1] when the SN was configured without it
> > support.
> > This patch add the callback update_params(), which will update the > > SN parameters according to the received message.
> > 1. http://en.wikipedia.org/wiki/Parametric_Stereo
> > Signed-off-by: V ctor Manuel J quez Leal <vjaq... @igalia.com> > > --- > > gstdspbase.c | 8 ++++++++ > > gstdspbase.h | 1 + > > 2 files changed, 9 insertions(+), 0 deletions(-)
> > diff --git a/gstdspbase.c b/gstdspbase.c > > index 953328a..dd6b98f 100644 > > --- a/gstdspbase.c > > +++ b/gstdspbase.c > > @@ -227,6 +227,14 @@ got_message(GstDspBase *self, > > pr_debug(self, "playback completed"); > > break; > > } > > + > > + if (msg->arg_1 == 1 && (msg->arg_2 & 0x0600) == 0x0600) { > > + struct td_codec *codec = self->codec; > > + if (codec->update_params && self->node)
> Why do you check for 'self->node'? If the node is there I don't think > got_message could be called.
Yep, I was confused when I wrote it. vmjl
> > + codec->update_params(self, self->node, msg->arg_2); > > + break; > > + }
> Cheers.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Víctor M. Jáquez L. <vjaq... @igalia.com>
Date: Thu, 16 Dec 2010 15:41:37 +0100
Local: Thurs, Dec 16 2010 9:41 am
Subject: Re: [PATCH 1/2] base: add codec update_params() callback
On Mon, Dec 13, 2010 at 04:55:21PM +0100, V ctor M. J quez L. wrote:
> On Mon, Dec 13, 2010 at 05:34:48PM +0200, Felipe Contreras wrote:
> > vjaq
... @igalia.com wrote:
> > > The aacdec SN recives an event message when the stream is detected
> > > as parametric stereo[1] when the SN was configured without it
> > > support.
> > > This patch add the callback update_params(), which will update the > > > SN parameters according to the received message.
> > > 1. http://en.wikipedia.org/wiki/Parametric_Stereo
> > > Signed-off-by: V ctor Manuel J quez Leal <vjaq... @igalia.com> > > > --- > > > gstdspbase.c | 8 ++++++++ > > > gstdspbase.h | 1 + > > > 2 files changed, 9 insertions(+), 0 deletions(-)
> > > diff --git a/gstdspbase.c b/gstdspbase.c > > > index 953328a..dd6b98f 100644 > > > --- a/gstdspbase.c > > > +++ b/gstdspbase.c > > > @@ -227,6 +227,14 @@ got_message(GstDspBase *self, > > > pr_debug(self, "playback completed"); > > > break; > > > } > > > + > > > + if (msg->arg_1 == 1 && (msg->arg_2 & 0x0600) == 0x0600) { > > > + struct td_codec *codec = self->codec; > > > + if (codec->update_params && self->node)
> > Why do you check for 'self->node'? If the node is there I don't think > > got_message could be called.
> Yep, I was confused when I wrote it.
Shall I resend these patches with this modification? Do you plan to integrate the duration, vpp and this into your next branch?
vmjl
> vmjl
> > > + codec->update_params(self, self->node, msg->arg_2); > > > + break; > > > + }
> > Cheers.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Felipe Contreras <felipe.contre... @gmail.com>
Date: Thu, 23 Dec 2010 14:16:47 +0200
Local: Thurs, Dec 23 2010 7:16 am
Subject: Re: [PATCH 1/2] base: add codec update_params() callback
2010/12/16 Víctor M. Jáquez L. <vjaq... @igalia.com>:
> Shall I resend these patches with this modification?
Please do. You might beat me to it.
> Do you plan to integrate the duration, vpp and this into your next branch?
Yeap. Any time now :) -- Felipe Contreras
You must
Sign in before you can post messages.
You do not have the permission required to post.