* Question about pcm_formats[] array in sound/core/pcm_misc.c
@ 2007-12-11 20:31 Timur Tabi
2007-12-13 8:41 ` Jaroslav Kysela
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2007-12-11 20:31 UTC (permalink / raw)
To: alsa-devel
I'm confused about the entries for unsigned 24-bit sound in the pcm_formats[] array:
[SNDRV_PCM_FORMAT_U24_BE] = {
.width = 24, .phys = 32, .le = 0, .signd = 0,
.silence = { 0x80, 0x00, 0x00 },
},
and
[SNDRV_PCM_FORMAT_U24_3BE] = {
.width = 24, .phys = 24, .le = 0, .signd = 0,
.silence = { 0x80, 0x00, 0x00 },
},
SNDRV_PCM_FORMAT_U24_BE means a 24-bit sample packed into a 32-bit word. So I
presume that if the 24-bit sample is:
0x123456
then when that sample is written to memory, it looks like this:
X X + 1 X + 2 X + 3
0x00 0x12 0x34 0x56
(where X is some address in memory).
If that's so, shouldn't the entry for SNDRV_PCM_FORMAT_U24_BE look like this:
[SNDRV_PCM_FORMAT_U24_BE] = {
.width = 24, .phys = 32, .le = 0, .signd = 0,
.silence = { 0x00, 0x80, 0x00, 0x00 },
}, ^^^^^^
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Question about pcm_formats[] array in sound/core/pcm_misc.c
2007-12-11 20:31 Question about pcm_formats[] array in sound/core/pcm_misc.c Timur Tabi
@ 2007-12-13 8:41 ` Jaroslav Kysela
0 siblings, 0 replies; 2+ messages in thread
From: Jaroslav Kysela @ 2007-12-13 8:41 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel
On Tue, 11 Dec 2007, Timur Tabi wrote:
> I'm confused about the entries for unsigned 24-bit sound in the pcm_formats[] array:
>
> [SNDRV_PCM_FORMAT_U24_BE] = {
> .width = 24, .phys = 32, .le = 0, .signd = 0,
> .silence = { 0x80, 0x00, 0x00 },
> },
>
> and
>
> [SNDRV_PCM_FORMAT_U24_3BE] = {
> .width = 24, .phys = 24, .le = 0, .signd = 0,
> .silence = { 0x80, 0x00, 0x00 },
> },
>
> SNDRV_PCM_FORMAT_U24_BE means a 24-bit sample packed into a 32-bit word. So I
> presume that if the 24-bit sample is:
>
> 0x123456
>
> then when that sample is written to memory, it looks like this:
>
> X X + 1 X + 2 X + 3
> 0x00 0x12 0x34 0x56
>
> (where X is some address in memory).
>
> If that's so, shouldn't the entry for SNDRV_PCM_FORMAT_U24_BE look like this:
>
> [SNDRV_PCM_FORMAT_U24_BE] = {
> .width = 24, .phys = 32, .le = 0, .signd = 0,
> .silence = { 0x00, 0x80, 0x00, 0x00 },
> }, ^^^^^^
Good catch. It looks like a bug and your proposal seems to be correct.
Jaroslav
-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-13 8:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-11 20:31 Question about pcm_formats[] array in sound/core/pcm_misc.c Timur Tabi
2007-12-13 8:41 ` 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.