[alsa-devel] Question about Conversion to S24_LE from S24_3LE

Takashi Iwai tiwai at suse.de
Mon Aug 20 08:47:47 CEST 2012


At Mon, 20 Aug 2012 14:57:51 +0900 (JST),
etsuko suzuki wrote:
> 
> Hello, Takashi.
> 
> > Hm, I guess your message didn't reach properly, or was filtered by some spam
>  filter.
> > Better to contact with Jaroslav (Cc'ed), who maintains alsa-devel ML.
> 
> I contacted him in August 17. 
> However, there is no reply yet.

Didn't you read his mail in Aug. 16?
You were in Cc.

> 
> [No.1]
> 
> > > http://msdn.microsoft.com/en-us/windows/hardware/gg463006.aspx
> > > 
> > > In this, I found the statement 'left-alinged'. 
> > > (In 'Details about wValidBitsPerSample')
> > > 
> > > I understood 'left-alinged' was 'LSB padding'.
> > > So I thought S24_LE was LSB padding.
> > 
> > No.  S24_LE has the MSB padding of 8 bits in 32 bit container.
> 
> That is, does it mean that this document is not correct?
> (I don't understand why this document differs from what you say.)

Well, Microsoft doesn't conquer the whole world yet.
Their definition isn't what we define for our purpose.

> http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/Docs/multichaudP.pdf
> (This PDF is the same as what was written before. 
>  The page is written on this.)
> 
> On the 6 page of this PDF, it is written to like this.
> 
>   'If wValidBitsPerSample is less than wBitsPerSample, 
>    then the actual 
>    PCM data is "left-aligned" within the container. 
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
>    The sample itself is justified most significant;
>    all extra bits are at the least-significant 
>    portion of the container.
>    All non-valid data bits must be set to 0.'
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> In S24_LE, I think 'wBitsPerSample' indicates 
> 'the container size'(=32) and 
> 'wValidBitsPerSample' indicates 'the bit of actual valid data'(=24).

You _think_ but you utterly misunderstand the terms.

ALSA S24 is not what you think.  S24 is a special format, 3 bytes LSB
in 4 bytes container.  This _is_ the definition.  There is no such a
format in MS's WAV definition.

wValidBitsPerSample is rather corresponding to hw_params ms_bits
parameter.

> 
> [No.2]
> 
> It was written that Microsoft has defined
> the new structure 'WAVE_FORMAT_EXTENSIBLE'(FORMAT_CODE:0xFFFE).
> (On the 4 page of this PDF.)
> 
> I think that the new structure should be used
> in this(the container size > the bit of actual valid data) case.
> 
> But the structure recording 
> by arecord was 'WAVE_FORMAT_PCM'(FORMAT_CODE:0x0001).
> 
> > % od -t x4 ubuntu_rec_S24_LE_48000.wav 
> > 0000000 46464952 003a9824 45564157 20746d66
> > 0000010 00000010 00020001 0000bb80 0005dc00
>                        ^^^^ 0x0001:WAVE_FORMAT_PCM
> 
> (The 'FORMAT_CODE' is written in this page.
>  http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/wave.html)
> 
> 
> Why does ALSA NOT use the new structure?

Because it's new, and no one cared such a thing.

> Has ALSA corresponded to the new structure?

Please send a fix patch if you'd like to improve :)


thanks,

Takashi


More information about the Alsa-devel mailing list