From: Takashi Iwai <tiwai@suse.de>
To: Ben Collins <bcollins@bluecherry.net>
Cc: alsa-devel@alsa-project.org
Subject: Re: [RFC] G.723-24 format patch
Date: Mon, 10 May 2010 22:58:01 +0200 [thread overview]
Message-ID: <s5hpr13qxt2.wl%tiwai@suse.de> (raw)
In-Reply-To: <1273513826.4325.4.camel@maclara>
At Mon, 10 May 2010 13:50:26 -0400,
Ben Collins wrote:
>
> On Sat, 2010-05-08 at 11:58 +0200, Takashi Iwai wrote:
> > At Sat, 01 May 2010 11:36:03 -0400,
> > Ben Collins wrote:
> > >
> > > I'm writing a driver for a card that only has hardware support for
> > > G.723-24 ADPCM format. I am working around the lack of support in alsa
> > > at the moment for this format, but wanted to take a crack at
> > > implementing it properly.
> > >
> > > G.723-24 is a 3-bit signed sample at a fixed 8khz mono sample rate
> > > (24000 bit rate). Basically means you need to take in at least 3 bytes
> > > (8 samples) minimum for processing the standard packed version.
> > >
> > > I don't have hardware that supports it, but since I was in the code, I
> > > added a G723_24_1B format for producing 1 sample per byte (3 lower bits
> > > are actual sample), but for my use I am producing the standard packed
> > > stream.
> > >
> > > Only question I had is that since this is signed, should I expect or
> > > want the _1B version to be a 1 byte sign extended version of the 3-bit
> > > sample, or just expect the lower 3 bits of the byte to be the g723-24
> > > sample? Looking at other unpacked examples, I assume the latter rather
> > > than the former.
> >
> > I suppose both are non-linear formats, so you shouldn't give
> > signed/unsigned flags for them. Otherwise snd_pcm_format_linear()
> > will return 1.
> >
> > Other than that, addition of these new formats look good to me.
>
> I may not be understanding the implications of setting them as
> signed/unsigned. G.723 decoder treats each sample as signed. Does
> alsa-lib do special things when it is signed even though it doesn't
> understand the actual encoding?
The signed/unsigned information is useful only for linear PCM formats
(e.g. U8, S16, etc), so that they can be converted with each other
simply with bit shift and sign-bit flip. Non-linear formats
(e.g. ADPCM, ulaw, etc) require specific conversions, thus its
conversion to other formats isn't supported always in the kernel, and
signed/unsigned information isn't referred as well.
Similarly, in alsa-lib, signed/unsigned information doesn't give much
merit but for linear PCM formats.
thanks,
Takashi
prev parent reply other threads:[~2010-05-10 20:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-01 15:36 [RFC] G.723-24 format patch Ben Collins
2010-05-08 9:58 ` Takashi Iwai
2010-05-10 17:50 ` Ben Collins
2010-05-10 20:58 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hpr13qxt2.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=bcollins@bluecherry.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.