[Audio-dev] CR: HELIX_FEATURE_16BIT_MIXENGINE (was: Choosing the right audio data type)
Wolfgang Schildbach wschildbach at helixcommunity.orgRe-sending.
At 10:21 PM 7/12/2004 +0200, Wolfgang Schildbach wrote:
>Synopsis:
> Configure the native audio data type by profile rather than by platform
>
>Overview:
> As discussed earlier (see below), this introduces a new feature,
> HELIX_FEATURE_16BIT_MIXENGINE that determines the audio datatype in the
> mix engine. This feature will be set on all profiles that include
> helix-client-mobile-common.
>
>The old behaviour was for symbian and palmos to use a 16-bit datatype, and
>for all others to use a 32-bit datatype. Now this will be determined by
>profile. Note that if you are working on a non-symbian, non-palmos
>platform that uses one of the above profiles, the mixengine behaviour will
>change for you now!
>
>Profiles affected:
>
>All that derive from helix-client-mobile-common:
> helix-client-linux-ipaq
> helix-client-mobile-basic
> helix-client-s60-common
> helix-client-s60-basic
> helix-client-s60-advanced
> helix-client-microcore-common
> helix-client-microcore-s60-12
> helix-client-microcore-s60-20
>
>Platforms affected:
> All, when the above profiles are selected
>
>Branches affected:
> HEAD (although the profile change will be reflected everywhere)
>
>Files changed:
> ribosome/build/umakepf/helix-client-mobile-common.pfi
> ribosome/doc/features.html
> client/audiosvc/mixengine.cpp
> client/audiosvc/pub/mixengine.h
>
>- Wolfgang
>
>Index: helix-client-mobile-common.pfi
>===================================================================
>RCS file: /cvsroot/ribosome/build/umakepf/helix-client-mobile-common.pfi,v
>retrieving revision 1.10
>diff -u -w -r1.10 helix-client-mobile-common.pfi
>--- helix-client-mobile-common.pfi 16 Mar 2004 20:38:12 -0000 1.10
>+++ helix-client-mobile-common.pfi 12 Jul 2004 15:23:40 -0000
>@@ -47,6 +47,7 @@
> project.AddDefines('HELIX_FEATURE_MUTE_PREFERENCE')
> project.AddDefines('HELIX_FEATURE_MINI_VOLUME_SINK')
> project.AddDefines('HELIX_FEATURE_NEWAUDIOSTREAM')
>+project.AddDefines('HELIX_FEATURE_16BIT_MIXENGINE')
> project.AddDefines('HELIX_FEATURE_AUDIO')
> project.AddDefines('HELIX_FEATURE_MIN_HEAP')
> project.AddDefines('HELIX_FEATURE_VIDEO')
>Index: pub/mixengine.h
>===================================================================
>RCS file: /cvsroot/client/audiosvc/pub/mixengine.h,v
>retrieving revision 1.9
>diff -u -w -r1.9 mixengine.h
>--- pub/mixengine.h 20 Feb 2004 16:43:53 -0000 1.9
>+++ pub/mixengine.h 12 Jul 2004 15:23:25 -0000
>@@ -43,11 +43,12 @@
>
> // define the "native audio data type"
> // on memory- and resource-constrained devices, use 16-bit processing
>-#if defined(_PALMOS) || defined(_SYMBIAN)
>+#ifdef HELIX_FEATURE_16BIT_MIXENGINE
> typedef INT16 tAudioSample ;
>
>-#if defined(HELIX_FEATURE_GAINTOOL) || defined(HELIX_FEATURE_CROSSFADE)
>-#error "gain tool and crossfader do not work on 16-bit data types yet"
>+#if defined(HELIX_FEATURE_GAINTOOL) || defined(HELIX_FEATURE_CROSSFADE)\
>+ || defined(HELIX_FEATURE_LIMITER)
>+#error "gain tool, crossfader and limiter do not work on 16-bit data
>types yet"
> #endif
>
> #else // all other platforms use 32-bit processing
>Index: mixengine.cpp
>===================================================================
>RCS file: /cvsroot/client/audiosvc/mixengine.cpp,v
>retrieving revision 1.10
>diff -u -w -r1.10 mixengine.cpp
>--- mixengine.cpp 20 Feb 2004 16:43:53 -0000 1.10
>+++ mixengine.cpp 12 Jul 2004 15:23:25 -0000
>@@ -410,11 +410,12 @@
> if (m_pResampler && bHaveInput)
> {
> #ifdef HELIX_FEATURE_RESAMPLER
>- // compiler should optimize one of these branches away.
>- if (NBITS_PER_AUDIOSAMPLE == 32)
>+// the resampler function prototype is different for 16-bit and 32-bit
>resampler.
>+#ifndef HELIX_FEATURE_16BIT_MIXENGINE
> m_nOutputSamplesLeft_3 +=
> m_pResampler->Resample(m_pBuffer_1, nSamples_2, (signed int*)(m_pBuffer_3
> + m_nOutputSamplesLeft_3) ) ;
>- else
>+#else
> m_nOutputSamplesLeft_3 +=
> m_pResampler->Resample(m_pBuffer_1, nSamples_2, (signed
> short*)(m_pBuffer_3 + m_nOutputSamplesLeft_3) ) ;
>+#endif
>
> // assert that the resampler did not write out-of-bounds
> HX_ASSERT(m_nOutputSamplesLeft_3 <= m_ulBufferSize_3) ;
>Index: features.html
>===================================================================
>RCS file: /cvsroot/ribosome/build/doc/features.html,v
>retrieving revision 1.2
>diff -u -w -r1.2 features.html
>--- features.html 31 Oct 2002 02:17:17 -0000 1.2
>+++ features.html 12 Jul 2004 15:34:54 -0000
>@@ -133,7 +133,8 @@
> style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
> New"'>HELIX_FEATURE_VOLUME<o:p></o:p></span></p>
>
> <p class=MsoNormal
> style='mso-layout-grid-align:none;text-autospace:none'><span
>-style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
>New"'>HELIX_FEATURE_CROSSFADE<o:p></o:p></span></p>
>+style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
>New"'>HELIX_FEATURE_CROSSFADE - support cross fading between
>+streams in the mix engine<o:p></o:p></span></p>
>
> <p class=MsoNormal
> style='mso-layout-grid-align:none;text-autospace:none'><span
> style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
> New"'>HELIX_FEATURE_ESOUND<o:p></o:p></span></p>
>@@ -142,7 +143,20 @@
> style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
> New"'>HELIX_FEATURE_MIXER<o:p></o:p></span></p>
>
> <p class=MsoNormal
> style='mso-layout-grid-align:none;text-autospace:none'><span
>-style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
>New"'>HELIX_FEATURE_RESAMPLER<o:p></o:p></span></p>
>+style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
>New"'>HELIX_FEATURE_RESAMPLER - use a resampler
>+in the mix engine<o:p></o:p></span></p>
>+
>+<p class=MsoNormal
>style='mso-layout-grid-align:none;text-autospace:none'><span
>+style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
>New"'>HELIX_FEATURE_GAINTOOL - use the gain tool (i.e. support SetVolume)
>+in the mix engine<o:p></o:p></span></p>
>+
>+<p class=MsoNormal
>style='mso-layout-grid-align:none;text-autospace:none'><span
>+style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
>New"'>HELIX_FEATURE_LIMITER - use the limiter in the mix
>+engine. Necessary for >0dB gain.<o:p></o:p></span></p>
>+
>+<p class=MsoNormal
>style='mso-layout-grid-align:none;text-autospace:none'><span
>+style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
>New"'>HELIX_FEATURE_16BIT_MIXENGINE - use INT16 instead
>+of INT32 as audio datatype in the mix engine<o:p></o:p></span></p>
>
> <p class=MsoNormal
> style='mso-layout-grid-align:none;text-autospace:none'><span
> style='mso-bidi-font-size:10.0pt;mso-bidi-font-family:"Courier
> New"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
>
>At 08:52 AM 7/7/2004 -0400, Eric Hyche wrote:
>
>
>>At 04:15 PM 7/6/2004 +0200, Wolfgang Schildbach wrote:
>>>At 09:31 AM 7/6/2004 -0400, Eric Hyche wrote:
>>>
>>>>Setting this via a HELIX_FEATURE_xxx seems like a good
>>>>idea to me.
>>>>
>>>>However, if we currently only use a 16-bit mixengine on
>>>>Palm and Symbian, then won't setting this feature in
>>>>helix-client-mobile-common affect more platforms than
>>>>those two?
>>>
>>>Yes, this is worth pointing out: It would probably change behavior on
>>>more than these two platforms. It depends on which platforms use the
>>>profiles mentioned below.
>>>
>>>However, any platform that is fixed point but does not use a 16 bit data
>>>type, has no resampler implementation, which is a problem. And any
>>>platform that is floating point is probably amiss using a mobile
>>>profile. So I would argue that it does the right thing...
>>>
>>>Profile owners: Any comments?
>>
>>I'm not necessarily a profile "owner", but I think this
>>would only change behavior on the helix-client-linux-ipaq -
>>I assume the microcore already uses a 16-bit mixengine.
>>If that's the case, then I would go ahead and check
>>it in.
>>
>>Eric
>>
>>>- Wolfgang
>>>
>>>PS: I just realized that profiles are possibly not branched. That would
>>>mean a change in a profile changes behavior across all branches... right?
>>>
>>>
>>>>Eric
>>>>
>>>>At 02:52 PM 7/6/2004 +0200, Wolfgang Schildbach wrote:
>>>>>Synopsis:
>>>>> How to configure the native audio data type for the audio services
>>>>> mix engine?
>>>>>
>>>>>Overview:
>>>>> Per compile-time choice, the mix engine internally either works with
>>>>> 32 bit (signed int) data, or with 16 bit (signed short) data. Right
>>>>> now, we use 16 bit on PALMOS and Symbian (and potentially on ARMV4l,
>>>>> too), and 32-bit on all other platforms. This is "configured" in
>>>>> client/audiosvc/pub/mixengine.h, through a define.
>>>>>
>>>>>Factors pro 32-bit:
>>>>>- 32 bit is the data type of choice if you want to do high-quality audio
>>>>>- 32 bits make it possible to create gain > 0 dB (like downmixing
>>>>>multichannel to stereo, or any amplification).
>>>>>- the cross fade, the gain tool, and the limiter only have 32-bit
>>>>>implementations
>>>>>
>>>>>Factors pro 16-bit:
>>>>>- 16 bit only consumes half the memory bandwidth
>>>>>- the fixed point resampler only has a 16-bit interface.
>>>>>
>>>>>Since the decision 16-bit vs. 32-bit has a few consequences, I think
>>>>>this should be configurable in the profile .pf definitions, rather
>>>>>than by a well-hidden ifdef.
>>>>>
>>>>>I suggest to introduce a new HELIX_FEATURE_MIXENGINE_16BIT. This would
>>>>>be set in the helix-client-mobile-common .pf file, and thus influence
>>>>>all profiles that derive from this:
>>>>>
>>>>>helix-client-linux-ipaq
>>>>>helix-client-mobile-basic
>>>>>helix-client-s60-common
>>>>>helix-client-s60-basic
>>>>>helix-client-s60-advanced
>>>>>helix-client-microcore-common
>>>>>helix-client-microcore-s60-12
>>>>>helix-client-microcore-s60-20
>>>>>
>>>>>It should probably also be set in the helix-client-mobile-openwave and
>>>>>helix-client-wince-420 profiles.
>>>>>
>>>>>Opinions?
>>>>>
>>>>>-
>>>>>- Wolfgang Schildbach, Principal Codec Engineer, RealNetworks Codec Group
>>>>>- email wschildbach at helixcommunity.org
>>>>>
>>>>>
>>>>>
>>>>>_______________________________________________
>>>>>Porting-discuss mailing list
>>>>>Porting-discuss at lists.helixcommunity.org
>>>>>http://lists.helixcommunity.org/mailman/listinfo/porting-discuss
>>>>
>>>>======================================
>>>>M. Eric Hyche (ehyche at real.com)
>>>>Core Technologies
>>>>RealNetworks, Inc.
>>>
>>>-
>>>- Wolfgang Schildbach, Principal Codec Engineer, RealNetworks Codec Group
>>>- email wschildbach at helixcommunity.org
>>
>>======================================
>>M. Eric Hyche (ehyche at real.com)
>>Core Technologies
>>RealNetworks, Inc.
>
>-
>- Wolfgang Schildbach, Principal Codec Engineer, RealNetworks Codec Group
>- email wschildbach at helixcommunity.org
>
>
>
>_______________________________________________
>Porting-discuss mailing list
>Porting-discuss at lists.helixcommunity.org
>http://lists.helixcommunity.org/mailman/listinfo/porting-discuss
-
- Wolfgang Schildbach, Principal Codec Engineer, RealNetworks Codec Group
- email wschildbach at helixcommunity.org