On Thursday 12 December 2019 22:27:39 Andrey Semashev wrote: > On 2019-10-06 20:58, Pali Rohár wrote: > > This patch provides support for aptX and aptX HD codecs in bluetooth A2DP > > profile. It uses open source LGPLv2.1+ licensed libopenaptx library which > > can be found at https://github.com/pali/libopenaptx. > > > > aptX for s24 stereo samples provides fixed 6:1 compression ratio and > > bitrate 352.8 kbit/s, aptX HD provides fixed 4:1 compression ratio and > > bitrate 529.2 kbit/s. > > > > According to soundexpert research, aptX codec used in bluetooth A2DP is no > > better than SBC High Quality settings. And you cannot hear difference > > between aptX and SBC High Quality, aptX is just a copper-less overpriced > > audio cable. > > > > aptX HD is high-bitrate version of aptX. It has clearly noticeable increase > > in sound quality (not dramatic though taking into account the increase in > > bitrate). > > > > http://soundexpert.org/news/-/blogs/audio-quality-of-bluetooth-aptx > > --- > > configure.ac | 36 +++ > > src/Makefile.am | 6 + > > src/modules/bluetooth/a2dp-codec-aptx.c | 479 ++++++++++++++++++++++++++++++++ > > src/modules/bluetooth/a2dp-codec-util.c | 8 + > > 4 files changed, 529 insertions(+) > > create mode 100644 src/modules/bluetooth/a2dp-codec-aptx.c > > [snip] > > > + > > +static size_t encode_buffer(void *codec_info, uint32_t timestamp, const uint8_t *input_buffer, size_t input_size, uint8_t *output_buffer, size_t output_size, size_t *processed) { > > + struct aptx_context *aptx_c = (struct aptx_context *) codec_info; > > + size_t written; > > + > > + *processed = aptx_encode(aptx_c, input_buffer, input_size, output_buffer, output_size, &written); > > + if (PA_UNLIKELY(*processed == 0 || *processed != input_size)) > > + pa_log_error("aptX encoding error"); > > + > > + return written; > > +} > > + > > +static size_t encode_buffer_hd(void *codec_info, uint32_t timestamp, const uint8_t *input_buffer, size_t input_size, uint8_t *output_buffer, size_t output_size, size_t *processed) { > > + struct aptx_hd_info *aptx_hd_info = (struct aptx_hd_info *) codec_info; > > + struct rtp_header *header; > > + size_t written; > > + > > + if (PA_UNLIKELY(output_size < sizeof(*header))) { > > + *processed = 0; > > + return 0; > > + } > > + > > + written = encode_buffer(aptx_hd_info->aptx_c, timestamp, input_buffer, input_size, output_buffer + sizeof(*header), output_size - sizeof(*header), processed); > > + > > + if (PA_LIKELY(written > 0)) { > > + header = (struct rtp_header *) output_buffer; > > I'm not sure I understand it correctly, but encode_buffer seems to be > producing encoded content at the beginning of the output buffer, and > encode_buffer_hd produces an RTP header followed by encoded content. Is this > difference intentional? What is expected to be placed in the output buffer - > a complete RTP packet or RTP payload only? > > The same comment applies to decode_buffer and decode_buffer_hd below. aptX does not use RTP. So A2DP buffer for aptX contains raw aptX samples. On the other hand aptX-HD uses RTP protocol, so aptX-HD samples are put into RTP packets and then RTP packets are passed to A2DP buffer. Hope this answer your question. -- Pali Rohár pali.rohar@xxxxxxxxx
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ pulseaudio-discuss mailing list pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss