Linux-Bluetooth Archive on lore.kernel.org
 help / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] a2dp-codecs: Remove wrong definition of SBC_MAX_BITPOOL
Date: Sat, 26 Jan 2019 17:25:18 +0200
Message-ID: <CABBYNZKvzSJWvWrid4wTaLZEnhoUYb-3GtYK3k+EvY922Zxm3g@mail.gmail.com> (raw)
In-Reply-To: <20190126104539.26421-1-pali.rohar@gmail.com>

Hi Pali,

On Sat, Jan 26, 2019 at 12:47 PM Pali Rohár <pali.rohar@gmail.com> wrote:
>
> According to A2DP specification; section SBC; Codec Specific Information
> Elements; Minimum / Maximum Bitpool Value, range for Bitpool value is from
> 2 to 250. Decoder shell support 2 as Minimum Bitpool Value and High Quality
> Bitpool value as the Maximum Bitpool Value at a minimum. A2DP defines
> maximal High Quality Bitpool value as 53.

A2DP recommends 53 bitpool for high quality, 64 was used as upper
bound to limit bandwidth so it had nothing to do with A2DP more like a
interval detail.

> Therefore instead of SBC_MAX_BITPOOL macro, defines two macros, one for
> minimal value of "Maximum Bitpool Value" and maximal value of "Maximum
> Bitpool Value".

We could define the recommended bitpools by quality, like the A2DP do,
and then the MAX to 250, that should make it a bit more clearer.

> I have no idea what is origin of value 64 as it does not match minimum nor
> maximum bitpool value. Lot of headsets declares maximum value to 53, so use
> this value also in android/hal-audio-sbc.c

We could define 64 as ultra high quality for those that wish a better
quality than 53, past that there a very limited return in terms of
quality.

> ---
>  android/hal-audio-sbc.c      | 6 +++---
>  profiles/audio/a2dp-codecs.h | 3 ++-
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/android/hal-audio-sbc.c b/android/hal-audio-sbc.c
> index 80e271ed6..541b2d6a7 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_MAX_BITPOOL_MIN,
>         },
>         {
>                 .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_MAX_BITPOOL_MIN,
>         },
>         {
>                 .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_MAX_BITPOOL_MIN,
>         },
>  };
>
> diff --git a/profiles/audio/a2dp-codecs.h b/profiles/audio/a2dp-codecs.h
> index 0bdd29110..f31f3a311 100644
> --- a/profiles/audio/a2dp-codecs.h
> +++ b/profiles/audio/a2dp-codecs.h
> @@ -53,8 +53,9 @@
>  #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_MIN            53
> +#define SBC_MAX_BITPOOL_MAX            250
>
>  #define MPEG_CHANNEL_MODE_MONO         (1 << 3)
>  #define MPEG_CHANNEL_MODE_DUAL_CHANNEL (1 << 2)
> --
> 2.11.0
>


-- 
Luiz Augusto von Dentz

  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-26 10:45 Pali Rohár
2019-01-26 15:25 ` Luiz Augusto von Dentz [this message]
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     ` [PATCH v3] " Pali Rohár
2019-01-31 10:52       ` Luiz Augusto von Dentz
2019-01-31 11:13         ` Pali Rohár

Reply instructions:

You may reply publically 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=CABBYNZKvzSJWvWrid4wTaLZEnhoUYb-3GtYK3k+EvY922Zxm3g@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    /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

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox