[pulseaudio-discuss] SBC XQ for PA 13.0

Hyperion h1p8r10n at yandex.com
Mon Sep 16 07:25:48 UTC 2019


Hi, 

Following what has already be done in some Android derivatives, here's a simple patch that extend SBP bitpool negociation to XQ quality.

According to :
--> http://soundexpert.org/articles/-/blogs/audio-quality-of-sbc-xq-bluetooth-audio-codec 
--> https://lineageos.org/engineering/Bluetooth-SBC-XQ/ , 
--> and confirmed by my own experimentation on more than 10 different devices, 

here are the features of the (very simple and non intrusive) patch : 
- allow to use bitpool 76 on devices that support it, aka SBC XQ
- harmless for devices limited to bitpool 53
- deprecates the need for APTX & APTX HD support, which are not better than SBC XQ, are not Open Source, and less supported by devices

This patch will be superseded by multi-profiles Pali Rohar A2DP stack implementation, when it's ready for production. Thanks to Pali for the help testing many codec parameters.

Let me know if I have to clone the git to push my patch, or if a regular PA dev could do it.

All the best
JP

diff -rNaud pulseaudio-13.0/src/modules/bluetooth/a2dp-codec-sbc.c pulseaudio-13.0-new/src/modules/bluetooth/a2dp-codec-sbc.c
--- pulseaudio-13.0/src/modules/bluetooth/a2dp-codec-sbc.c	2019-09-13 15:20:03.000000000 +0200
+++ pulseaudio-13.0-new/src/modules/bluetooth/a2dp-codec-sbc.c	2019-09-16 08:57:50.363122019 +0200
@@ -290,10 +290,10 @@
         return 0;
     }
 
-    if (capabilities->allocation_method & SBC_ALLOCATION_LOUDNESS)
-        config->allocation_method = SBC_ALLOCATION_LOUDNESS;
-    else if (capabilities->allocation_method & SBC_ALLOCATION_SNR)
+    if (capabilities->allocation_method & SBC_ALLOCATION_SNR)
         config->allocation_method = SBC_ALLOCATION_SNR;
+    else if (capabilities->allocation_method & SBC_ALLOCATION_LOUDNESS)
+        config->allocation_method = SBC_ALLOCATION_LOUDNESS;
     else {
         pa_log_error("No supported allocation method");
         return 0;
diff -rNaud pulseaudio-13.0/src/modules/bluetooth/a2dp-codecs.h pulseaudio-13.0-new/src/modules/bluetooth/a2dp-codecs.h
--- pulseaudio-13.0/src/modules/bluetooth/a2dp-codecs.h	2019-09-13 15:20:03.000000000 +0200
+++ pulseaudio-13.0-new/src/modules/bluetooth/a2dp-codecs.h	2019-09-16 08:44:20.382086305 +0200
@@ -61,14 +61,11 @@
  * Allocation method = Loudness
  * Subbands = 8
  */
-#define SBC_BITPOOL_MQ_MONO_44100		19
-#define SBC_BITPOOL_MQ_MONO_48000		18
-#define SBC_BITPOOL_MQ_JOINT_STEREO_44100	35
-#define SBC_BITPOOL_MQ_JOINT_STEREO_48000	33
-#define SBC_BITPOOL_HQ_MONO_44100		31
-#define SBC_BITPOOL_HQ_MONO_48000		29
-#define SBC_BITPOOL_HQ_JOINT_STEREO_44100	53
-#define SBC_BITPOOL_HQ_JOINT_STEREO_48000	51
+
+#define SBC_BITPOOL_HQ_MONO_44100		38
+#define SBC_BITPOOL_HQ_MONO_48000		38
+#define SBC_BITPOOL_HQ_JOINT_STEREO_44100	76
+#define SBC_BITPOOL_HQ_JOINT_STEREO_48000	76
 
 #define MPEG_CHANNEL_MODE_MONO		(1 << 3)
 #define MPEG_CHANNEL_MODE_DUAL_CHANNEL	(1 << 2)




More information about the pulseaudio-discuss mailing list