linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v3] a2dp-codecs: Fix SBC_MAX_BITPOOL and add SBC quality modes
Date: Tue, 29 Jan 2019 18:12:07 +0100	[thread overview]
Message-ID: <20190129171207.8976-1-pali.rohar@gmail.com> (raw)
In-Reply-To: <CABBYNZJCKhfX8jdYPqQvXDrtGQvMVT-htqE8WoyGYPLh1E78zA@mail.gmail.com>

According to A2DP specification; section SBC; Codec Specific Information
Elements; Minimum / Maximum Bitpool Value, range for Bitpool value is from
2 to 250.

A2DP specification also defines bitpool values for two SBC modes: Middle
Quality and High Quality. They depends on channel mode and frequency. So
add definitions for them into a2dp-codecs file too.

File android/hal-audio-sbc.c was updated to use High Quality mode for
chosen frequency.
---
 android/hal-audio-sbc.c      |  6 +++---
 profiles/audio/a2dp-codecs.h | 12 +++++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/android/hal-audio-sbc.c b/android/hal-audio-sbc.c
index 80e271ed6..b06cafb7b 100644
--- a/android/hal-audio-sbc.c
+++ b/android/hal-audio-sbc.c
@@ -92,7 +92,7 @@ static const a2dp_sbc_t sbc_presets[] = {
 		.block_length = SBC_BLOCK_LENGTH_4 | SBC_BLOCK_LENGTH_8 |
 				SBC_BLOCK_LENGTH_12 | SBC_BLOCK_LENGTH_16,
 		.min_bitpool = SBC_MIN_BITPOOL,
-		.max_bitpool = SBC_MAX_BITPOOL
+		.max_bitpool = SBC_BITPOOL_HQ_JOINT_STEREO_44100,
 	},
 	{
 		.frequency = SBC_SAMPLING_FREQ_44100,
@@ -101,7 +101,7 @@ static const a2dp_sbc_t sbc_presets[] = {
 		.allocation_method = SBC_ALLOCATION_LOUDNESS,
 		.block_length = SBC_BLOCK_LENGTH_16,
 		.min_bitpool = SBC_MIN_BITPOOL,
-		.max_bitpool = SBC_MAX_BITPOOL
+		.max_bitpool = SBC_BITPOOL_HQ_JOINT_STEREO_44100,
 	},
 	{
 		.frequency = SBC_SAMPLING_FREQ_48000,
@@ -110,7 +110,7 @@ static const a2dp_sbc_t sbc_presets[] = {
 		.allocation_method = SBC_ALLOCATION_LOUDNESS,
 		.block_length = SBC_BLOCK_LENGTH_16,
 		.min_bitpool = SBC_MIN_BITPOOL,
-		.max_bitpool = SBC_MAX_BITPOOL
+		.max_bitpool = SBC_BITPOOL_HQ_JOINT_STEREO_48000,
 	},
 };
 
diff --git a/profiles/audio/a2dp-codecs.h b/profiles/audio/a2dp-codecs.h
index 16088dc26..0d2cc155b 100644
--- a/profiles/audio/a2dp-codecs.h
+++ b/profiles/audio/a2dp-codecs.h
@@ -53,8 +53,18 @@
 #define SBC_ALLOCATION_SNR		(1 << 1)
 #define SBC_ALLOCATION_LOUDNESS		1
 
-#define SBC_MAX_BITPOOL			64
 #define SBC_MIN_BITPOOL			2
+#define SBC_MAX_BITPOOL			250
+
+/* Other settings: Block length = 16, 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 MPEG_CHANNEL_MODE_MONO		(1 << 3)
 #define MPEG_CHANNEL_MODE_DUAL_CHANNEL	(1 << 2)
-- 
2.11.0


  reply	other threads:[~2019-01-29 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-26 10:45 [PATCH] a2dp-codecs: Remove wrong definition of SBC_MAX_BITPOOL Pali Rohár
2019-01-26 15:25 ` Luiz Augusto von Dentz
2019-01-27 10:07   ` Pali Rohár
2019-01-28 23:10 ` [PATCH v2] a2dp-codecs: Fix SBC_MAX_BITPOOL and add SBC quality modes Pali Rohár
2019-01-29 11:46   ` Luiz Augusto von Dentz
2019-01-29 17:12     ` Pali Rohár [this message]
2019-01-31 10:52       ` [PATCH v3] " Luiz Augusto von Dentz
2019-01-31 11:13         ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190129171207.8976-1-pali.rohar@gmail.com \
    --to=pali.rohar@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).