Advanced Audio Distribution Profile Specification
Advanced Audio Distribution Profile Specification
Advanced Audio Distribution Profile Specification
\
|
|
.
|
\
|
+
|
.
|
\
|
+ = L n M m
M
M
n m n h n h
p m
t
with M=nrof_subbands and L=10*nrof_subbands. The prototype filters (h
p
) for both M=4
and M=8 are in Section 12.8. This synthesis filterbank has the same structure as the
one that is used in [12].
For more details refer to Section 2.4.3.2.2, "Synthesis subband filter" in [12]. The
sb_sample[blk][ch][sb] values, as calculated in Section 12.6.4, "Reconstruction of the
Subband Samples" and Section 12.6.5, "Joint Processing", are the input of the
synthesis filter. The outputs of the synthesis filter are the decoded audio output
samples.
A detailed filter block diagram can be found in Figure 12.3.
BLUETOOTH SPECIFICATION Page 67 of 77
Advanced Audio Distribution Profile (A2DP)
SBC Synthesis for 4 subbands
START
END
These Flow Diagrams are adapted from Figure A.2 and paragraph 2.4.3.2.2 in ISO/IEC 11172-3
Build a 40 values vector U
for i=0 to 4 do
for j=0 to 3 do
U[i*8+j] = V[i*16+j]
U[i*8+4+j] = V[i*16+12+j]
Matrixing
for k=0 to 7 do
for i=0 to 3 do
V[k] = sum(N[k][i]*S[i])
N[k][i] = cos[(i+0.5)(k+2)pi/4)]
Input 4 New Subband Samples
for i=0 to 3 do
S[i] = next_input_subband_sample
Shifting
for i=79 down to 8 do
V[i] = V[i-8]
Window by 40 coefficients
Produce vector W
for i=0 to 39 do
W[i] = U[i]*D[i] (D[i]: filter coeffs table
12-23 multiplied by -4)
Calculate 4 audio samples
for j=0 to 3 do
for i=0 to 9 do
X[j] = sum(W[j+4*i])
Output 4 reconstructed Audio
Samples
for i=0 to 3 do
next_output_audio_sample = X[i]
SBC Synthesis for 8 subbands
START
END
Build a 80 values vector U
for i=0 to 4 do
for j=0 to 7 do
U[i*16+j] = V[i*32+j]
U[i*16+8+j] = V[i*32+24+j]
Matrixing
for k=0 to 15 do
for i=0 to 7 do
V[k] = sum(N[k][i]*S[i])
N[k][i] = cos[(i+0.5)(k+4)pi/8)]
Input 8 New Subband Samples
for i=0 to 7 do
S[i] = next_input_subband_sample
Shifting
for i=159 down to 16 do
V[i] = V[i-16]
Window by 80 coefficients
Produce vector W
for i=0 to 79 do
W[i] = U[i]*D[i] (D[i]: filter coeffs table
12-24 multiplied by -8)
Calculate 8 audio samples
for j=0 to 7 do
for i=0 to 9 do
X[j] = sum(W[j+8*i])
Output 8 reconstructed Audio
Samples
for i=0 to 7 do
next_output_audio_sample = X[i]
Figure 12.3: Flow Diagrams of the Synthesis Filter
12.7 Encoding Processes
In Figure 12.4 the operation of the encoder is illustrated. Via a polyphase analysis filter
the input PCM is split into subband signals. For each subband a scale factor is
calculated. On the basis of the scale factors the bit allocation, and from there the levels
are derived for each subband. Then the subband samples are scaled and quantized
and finally, a bitstream is generated. This process is further described in this section.
BLUETOOTH SPECIFICATION Page 68 of 77
Advanced Audio Distribution Profile (A2DP)
Bitstream
packing
Derive
allocation
APCM
Polyphase
analysis
Bitstream
Scalefactors Levels
PCM
Input
Quantized
Subband
samples
Scalefactors &
Subband samples
L
R
Figure 12.4: Diagram of the encoder
12.7.1 Analysis Filter
Analysis of the input PCM is calculated for each channel separately. For each block of
nrof_subbands consecutive PCM samples the analysis filter is applied to calculate
nrof_subbands subband samples. The analysis filter is a polyphase filterbank according
to
], 1 , 0 [ ], 1 , 0 [ ,
2 2
1
cos ] [ ] [ = =
|
|
.
|
\
|
|
.
|
\
|
|
.
|
\
|
+ = L n M m
M
M
n m n h n h
p m
t
with M=nrof_subbands and L=10*nrof_subbands. The prototype filters for both M=4 and
M=8 are in Section 12.8. This analysis filterbank has the same structure as the one that
is used in [12].
A detailed filter block diagram can be found in Figure 12.5.
BLUETOOTH SPECIFICATION Page 69 of 77
Advanced Audio Distribution Profile (A2DP)
SBC Analysis for 4 subbands
START
END
These Flow Diagrams are adapted from Figure C.4 and paragraph C.1.3 in ISO/IEC 11172-3
Partial Calculation
for i=0 to 7 do
for k=0 to 4 do
Y[i] = sum(Z[i+k*8])
Windowing by 40 coefficients
Produce Vector Z
for i=0 to 39 do
Z[i]=C[i]*X[i]
(C[i]: filter coeffs table 12-23)
Input 4 New Audio Samples
for i=39 down to 4 do
X[i] = X[i-4]
for i=3 down to 0 do
X[i] = next_input_audio_sample
Calculate 4 subband samples by
Matrixing
for i=0 to 3 do
for k=0 to 7 do
S[i] = sum(M[i][k] * Y[k])
M[i][k] = cos[(i+0.5)*(k-2)*pi/4]
Output 4 Subband Samples
for i=0 to 3 do
next_output_subband_sample = S[i]
SBC Analysis for 8 subbands
START
END
Partial Calculation
for i=0 to 15 do
for k=0 to 4 do
Y[i] = sum(Z[i+k*16])
Windowing by 80 coefficients
Produce Vector Z
for i=0 to 79 do
Z[i]=C[i]*X[i]
(C[i]: filter coeffs table 12-24)
Input 8 New Audio Samples
for i=79 down to 8 do
X[i] = X[i-8]
for i=7 down to 0 do
X[i] = next_input_audio_sample
Calculate 8 subband samples by
Matrixing
for i=0 to 7 do
for k=0 to 15 do
S[i] = sum(M[i][k] * Y[k])
M[i][k] = cos[(i+0.5)*(k-4)*pi/8]
Output 8 Subband Samples
for i=0 to 7 do
next_output_subband_sample = S[i]
Figure 12.5: Flow Diagrams of the Analysis Filter
12.7.2 Scale Factors
For each subband a scale factor is calculated by taking the next higher scale factor
value of the maximum absolute value in each subband. The scale factor values are
defined in Section 12.6.2.
12.7.3 Joint_Stereo Channel Mode Operation
For the JOINT_STEREO channel mode operation a slightly different procedure is
applied. From the L and R subband signals sum and difference subband signals are
derived and scale factors are calculated for these sum and difference subband signals.
A simple criterion may be used to determine whether the L and R subband signals are
transmitted or the sum and difference subband signals, e.g., if the sum of the scale
BLUETOOTH SPECIFICATION Page 70 of 77
Advanced Audio Distribution Profile (A2DP)
factors of L and R is larger than the sum of the scale factors of the sum and difference
signals, the subband is coded using joint coding.
12.7.4 Bit Allocation
The bit allocation is exactly the same for the encoder and the decoder, and is described
in Section 12.6.3.
12.7.5 Quantization
The subband samples are normalized and quantized using the following formula.
quantized_sb_sample[blk][ch][sb] = ((sb_sample[blk][ch][sb] / scalefactor[ch][sb] + 1.0)
* levels[ch][sb]) / 2.0
12.8 Tables
In the case that the LOUDNESS bit allocation method is used in the bit allocation
process, the next two tables are used.
offset4 fs = 16000 fs = 32000 fs = 44100 fs = 48000
sb = 0 -1 -2 -2 -2
sb = 1 0 0 0 0
sb = 2 0 0 0 0
sb = 3 0 1 1 1
Table 12.21: Offset table for four subbands
offset8 fs = 16000 fs = 32000 fs = 44100 fs = 48000
sb = 0 -2 -3 -4 -4
sb = 1 0 0 0 0
sb = 2 0 0 0 0
sb = 3 0 0 0 0
sb = 4 0 0 0 0
sb = 5 0 0 0 0
sb = 6 0 1 1 1
sb = 7 1 2 2 2
Table 12.22: Offset table for eight subbands
For the analysis and synthesis filters the filter coefficients are defined in the next two
tables. The tables shall be read row-wise.
Proto_4_40
0.00000000E+00 5.36548976E-04 1.49188357E-03 2.73370904E-03
3.83720193E-03 3.89205149E-03 1.86581691E-03 -3.06012286E-03
1.09137620E-02 2.04385087E-02 2.88757392E-02 3.21939290E-02
2.58767811E-02 6.13245186E-03 -2.88217274E-02 -7.76463494E-02
BLUETOOTH SPECIFICATION Page 71 of 77
Advanced Audio Distribution Profile (A2DP)
1.35593274E-01 1.94987841E-01 2.46636662E-01 2.81828203E-01
2.94315332E-01 2.81828203E-01 2.46636662E-01 1.94987841E-01
-1.35593274E-01 -7.76463494E-02 -2.88217274E-02 6.13245186E-03
2.58767811E-02 3.21939290E-02 2.88757392E-02 2.04385087E-02
-1.09137620E-02 -3.06012286E-03 1.86581691E-03 3.89205149E-03
3.83720193E-03 2.73370904E-03 1.49188357E-03 5.36548976E-04
Table 12.23:Filter coefficients for four subbands
Proto_8_80
0.00000000E+00 1.56575398E-04 3.43256425E-04 5.54620202E-04
8.23919506E-04 1.13992507E-03 1.47640169E-03 1.78371725E-03
2.01182542E-03 2.10371989E-03 1.99454554E-03 1.61656283E-03
9.02154502E-04 -1.78805361E-04 -1.64973098E-03 -3.49717454E-03
5.65949473E-03 8.02941163E-03 1.04584443E-02 1.27472335E-02
1.46525263E-02 1.59045603E-02 1.62208471E-02 1.53184106E-02
1.29371806E-02 8.85757540E-03 2.92408442E-03 -4.91578024E-03
-1.46404076E-02 -2.61098752E-02 -3.90751381E-02 -5.31873032E-02
6.79989431E-02 8.29847578E-02 9.75753918E-02 1.11196689E-01
1.23264548E-01 1.33264415E-01 1.40753505E-01 1.45389847E-01
1.46955068E-01 1.45389847E-01 1.40753505E-01 1.33264415E-01
1.23264548E-01 1.11196689E-01 9.75753918E-02 8.29847578E-02
-6.79989431E-02 -5.31873032E-02 -3.90751381E-02 -2.61098752E-02
-1.46404076E-02 -4.91578024E-03 2.92408442E-03 8.85757540E-03
1.29371806E-02 1.53184106E-02 1.62208471E-02 1.59045603E-02
1.46525263E-02 1.27472335E-02 1.04584443E-02 8.02941163E-03
-5.65949473E-03 -3.49717454E-03 -1.64973098E-03 -1.78805361E-04
9.02154502E-04 1.61656283E-03 1.99454554E-03 2.10371989E-03
2.01182542E-03 1.78371725E-03 1.47640169E-03 1.13992507E-03
8.23919506E-04 5.54620202E-04 3.43256425E-04 1.56575398E-04
Table 12.24: Filter coefficients for eight subbands
12.9 Calculation of Bit Rate and Frame Length
Bit Rate (bit_rate) is calculated using the following equation:
bit_rate = 8 * frame_length* f
s
/ nrof_subbands / nrof_blocks,
where f
s
, nrof_subbands and nrof_blocks denote sampling frequency, number of
subbands and number of blocks, respectively. Bit Rate is expressed in kb/s, because f
s
is expressed in kHz. The Frame Length (frame_length) is expressed in bytes as
BLUETOOTH SPECIFICATION Page 72 of 77
Advanced Audio Distribution Profile (A2DP)
frame_length = 4 + (4 * nrof_subbands * nrof_channels ) / 8
+ nrof_blocks * nrof_channels * bitpool / 8 (.
for the MONO and DUAL_CHANNEL channel modes, and
frame_length = 4 + (4 * nrof_subbands * nrof_channels ) / 8
+ (join * nrof_subbands + nrof_blocks * bitpool ) / 8(.
for the STEREO and JOINT_ STEREO channel modes.
Here, nrof_channels and bitpool denote number of channels and bitpool value,
respectively. When joint stereo is used, join = 1, otherwise 0. For reference, see section
12.5.
BLUETOOTH SPECIFICATION Page 73 of 77
Advanced Audio Distribution Profile (A2DP)
13 Appendix C (Informative): Signaling Flows
This section contains an example of typical signaling procedures defined in AVDTP for
audio streaming set up. This section is informative only. For details, refer to GAVDP [3]
and AVDTP [4]. In this example, the SRC is assumed to be the INT, while the SNK to
be the ACP.
13.1 Audio Streaming Set Up
The initial states of the both devices are <IDLE>.
The SRC initiates Stream Endpoint (SEP) Discovery procedure. This procedure serves
to return the media type and SEID for each stream end-point. The SRC finds the audio-
type stream end-point.
Then, Get All Capabilities procedure is initiated to collect service capabilities of the SNK.
There are two kinds of service capabilities; one is an application service capability and
the other is a transport service capability. The application service capability for A2DP
consists of audio codec capability and content protection capability. Regarding the
transport service capability, refer to Section 5.4 in AVDTP [4].
Based on collected SEP information and service capabilities, the SRC determines the
most suitable audio streaming parameters (codec, content protection and transport
service) for the SNK and the SRC itself. Then, SRC requests the SNK to configure the
audio parameters of the SNK by using the Stream Configuration procedure. The SRC
also configures the audio parameters of itself.
Then, L2CAP channels are established as defined in the Stream Establishment
procedure. Finally, the states of both devices are set at <OPEN>.
BLUETOOTH SPECIFICATION Page 74 of 77
Advanced Audio Distribution Profile (A2DP)
SRC SNK
User initiated action /
Internal Event
Stream Configuration
Stream Establishment
OPEN
Get All Capabilities
Stream End Point Discovery
IDLE
Figure 13.1: Audio Streaming Set Up
13.2 Audio Streaming
The SRC initiates Start Streaming procedure by a user initiated action or an internal
event. The states of both devices are changed from <OPEN> to <STREAMING>. Audio
streaming is started after this procedure is completed.
BLUETOOTH SPECIFICATION Page 75 of 77
Advanced Audio Distribution Profile (A2DP)
SRC SNK
User Initiated Action /
Internal event
Start Streaming
OPEN
STREAMING
Figure 13.2: Audio Streaming
BLUETOOTH SPECIFICATION Page 76 of 77
Advanced Audio Distribution Profile (A2DP)
14 Appendix D: Requirements for Codecs Implementation
This section defines requirements to fulfill when the manufacturer implements the codec
in the devices.
14.1 Decoder Implementation
14.1.1 SBC Decoder
[D1] It shall be able to decode SBC bitstream syntax.
[D2] Its output shall satisfy at least the 14 bit criteria that are defined in SBC test spec
for Configuration, VBR, maximum bit rate, special test and typical bitstreams.
14.1.2 Optional Codec Decoder
[D3] The output of its decoder shall satisfy the criteria that are defined for its
conformance to the reference.
14.1.3 Vendor Specific A2DP Codec Decoder
Bluetooth does not impose any requirements.
14.2 Encoder Implementation
14.2.1 SBC Encoder
[E1] Its output shall be compliant with SBC bitstream syntax.
[E2] The subjective quality (measured by standardized way or by objective testing
methods, see [20] and [21]) shall be equivalent to that of reference encoder.
14.2.2 Optional Codec Encoder
[E3] Its output shall be compliant to corresponding bitstream syntax.
14.2.3 Vendor Specific A2DP Codec Encoder
- Bluetooth does not impose any requirements.
BLUETOOTH SPECIFICATION Page 77 of 77
Advanced Audio Distribution Profile (A2DP)
15 Appendix E: Acronyms and Abbreviations
Acronym Description
A/V Audio/Video
A2DP Advanced Audio Distribution Profile
ACP Acceptor
AVDTP Audio/Video Distribution Transport Protocol
AVRCP Audio/Video Remote Control Profile
CP_Type Content Protection Type
CRC Cyclic Redundancy Check
GAP Generic Access Profile
GAVDP Generic Audio/Video Distribution Profile
ICS Implementation Conformance Statement
IETF Internet Engineering Task Force
INT Initiator
LM Link Manager
LSB Least Significant Bit (Byte)
MPEG Moving Picture Expert Group
MSB Most Significant Bit (Byte)
MTU Maximum Transmission Unit
PSM Protocol/Service Multiplexer
QoS Quality of Service
RFA Reserved for Future Additions
RFD Reserved for Future Definition
RTP Real-time Transport Protocol
SBC Low Complexity Subband Codec
SDP Service Discovery Protocol
SEID Stream End Point Identifier
SEP Stream End Point
SNK Sink
SRC Source
TSS Test Suite Structure
VDP Video Distribution Profile