All of lore.kernel.org
 help / color / mirror / Atom feed
* 24 bit sample embedded in 32 bits
@ 2012-07-02 10:11 Vipin Kumar
  2012-07-02 11:01 ` Clemens Ladisch
  2012-07-02 11:02 ` Jaroslav Kysela
  0 siblings, 2 replies; 4+ messages in thread
From: Vipin Kumar @ 2012-07-02 10:11 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org, Mark Brown

Hello,

I assume that the alsa framework expects the 24 bit sample data to be 
packed one after the other. for example while recording a 2 channel, 24 
bit sample data, typically the dma reads a fifo (which receives data 
from adc) and prepares a buffer which is then passed to the upper layers.

This buffer is expeted to be 24byte left channel and then 24 byte right 
channel. Am I right?

If the above assumption is correct, I need to find a way to tell the 
framework that the data is 24bit but is embedded in 32 bit. ie 32bit 
left and then 32 bit right channel data

I am tending to think that there has to be a way but I am unable to find 
it. Can you please point me to the right direction

Regards
Vipin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 24 bit sample embedded in 32 bits
  2012-07-02 10:11 24 bit sample embedded in 32 bits Vipin Kumar
@ 2012-07-02 11:01 ` Clemens Ladisch
  2012-07-02 11:11   ` Vipin Kumar
  2012-07-02 11:02 ` Jaroslav Kysela
  1 sibling, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2012-07-02 11:01 UTC (permalink / raw)
  To: Vipin Kumar; +Cc: alsa-devel@alsa-project.org, Mark Brown

Vipin Kumar wrote:
> I assume that the alsa framework expects the 24 bit sample data to be
> packed one after the other.

ALSA expects the sample data to conform to whatever sample format has
been configured.

Most hardware uses 32-bit sample words in memory to make the
interface to the PCI bus easier.

> I need to find a way to tell the framework that the data is 24bit
> but is embedded in 32 bit.

(HH = highest byte, LL = lowest byte, MM = middle byte)

LL MM HH     SNDRV_PCM_FORMAT_S24_3LE
xx LL MM HH  SNDRV_PCM_FORMAT_S32_LE
LL MM HH xx  SNDRV_PCM_FORMAT_S24_LE
HH MM LL     SNDRV_PCM_FORMAT_S24_3BE
HH MM LL xx  SNDRV_PCM_FORMAT_S32_BE
xx HH MM LL  SNDRV_PCM_FORMAT_S24_BE


Regards,
Clemens

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 24 bit sample embedded in 32 bits
  2012-07-02 10:11 24 bit sample embedded in 32 bits Vipin Kumar
  2012-07-02 11:01 ` Clemens Ladisch
@ 2012-07-02 11:02 ` Jaroslav Kysela
  1 sibling, 0 replies; 4+ messages in thread
From: Jaroslav Kysela @ 2012-07-02 11:02 UTC (permalink / raw)
  To: alsa-devel; +Cc: vipin.kumar

Date 2.7.2012 12:11, Vipin Kumar wrote:
> Hello,
> 
> I assume that the alsa framework expects the 24 bit sample data to be 
> packed one after the other. for example while recording a 2 channel, 24 
> bit sample data, typically the dma reads a fifo (which receives data 
> from adc) and prepares a buffer which is then passed to the upper layers.
> 
> This buffer is expeted to be 24byte left channel and then 24 byte right 
> channel. Am I right?
> 
> If the above assumption is correct, I need to find a way to tell the 
> framework that the data is 24bit but is embedded in 32 bit. ie 32bit 
> left and then 32 bit right channel data
> 
> I am tending to think that there has to be a way but I am unable to find 
> it. Can you please point me to the right direction

Use S/U24 or S/U32 formats - look to adriver.h for SNDRV_PCM_FORMAT
constants. S/U24 expects 24-bit samples with zero MSB in 32-bit words.
S/U32 expects 32-bit samples (LSB is zero for 24-bit data).

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 24 bit sample embedded in 32 bits
  2012-07-02 11:01 ` Clemens Ladisch
@ 2012-07-02 11:11   ` Vipin Kumar
  0 siblings, 0 replies; 4+ messages in thread
From: Vipin Kumar @ 2012-07-02 11:11 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel@alsa-project.org, Mark Brown

On 7/2/2012 4:31 PM, Clemens Ladisch wrote:
> Vipin Kumar wrote:
>> I assume that the alsa framework expects the 24 bit sample data to be
>> packed one after the other.
>
> ALSA expects the sample data to conform to whatever sample format has
> been configured.
>
> Most hardware uses 32-bit sample words in memory to make the
> interface to the PCI bus easier.
>
>> I need to find a way to tell the framework that the data is 24bit
>> but is embedded in 32 bit.
>
> (HH = highest byte, LL = lowest byte, MM = middle byte)
>
> LL MM HH     SNDRV_PCM_FORMAT_S24_3LE
> xx LL MM HH  SNDRV_PCM_FORMAT_S32_LE
> LL MM HH xx  SNDRV_PCM_FORMAT_S24_LE
> HH MM LL     SNDRV_PCM_FORMAT_S24_3BE
> HH MM LL xx  SNDRV_PCM_FORMAT_S32_BE
> xx HH MM LL  SNDRV_PCM_FORMAT_S24_BE
>

Thanks Clemens, Jaroslav,

This was very helpful..I would try more cases and come back for more 
doubts if there are any :)

Regards
Vipin

>
> Regards,
> Clemens
> .
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-02 11:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 10:11 24 bit sample embedded in 32 bits Vipin Kumar
2012-07-02 11:01 ` Clemens Ladisch
2012-07-02 11:11   ` Vipin Kumar
2012-07-02 11:02 ` Jaroslav Kysela

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.