Coder Social home page Coder Social logo

openaptx's Introduction

[open]aptx - reverse-engineered apt-X

This project is for research purposes only. Without a proper license private and commercial usage might be a case of a patent infringement. If you are looking for a library, which can be installed and used legally (commercial, private and educational usage), go to the Qualcomm® aptX™ homepage and contact Qualcomm customer service.

The source code itself is licensed under the terms of the MIT license. However, compression algorithms are patented and licensed under the terms of a proprietary license. Hence, compilation and redistribution in a binary format is forbidden!

Compilation

mkdir build && cd build
cmake -DENABLE_DOC=ON -DWITH_FFMPEG=ON -DWITH_SNDFILE=ON ..
make && make install

Configure options

  • ENABLE_DOC - build and install manual files (requires Doxygen)
  • ENABLE_APTX_DECODER_API - build with apt-X / apt-X HD decoder API (default: ON)
  • ENABLE_APTX_ENCODER_API - build with apt-X / apt-X HD encoder API (default: ON)
  • ENABLE_APTX422 - build reverse engineered apt-X library based on bt-aptX-x86-4.2.2.so
  • ENABLE_APTXHD100 - build reverse engineered apt-X HD library based on aptXHD-1.0.0-ARMv7A
  • WITH_FFMPEG - use FFmpeg as a back-end (otherwise, stub library will be built)
  • WITH_SNDFILE - read file formats supported by libsndfile (used by openaptx utils)

In the apt-X stub library (build without FFmpeg back-end), all symbols are exported as weak. As a consequence, it should be possible to overwrite them during runtime with other library which exports strong symbols. However, it might be required to define LD_DYNAMIC_WEAK environment variable - for more information consult ld.so manual.

When reverse-engineered libraries were enabled, they will be automatically linked with the apt-X stub library (build without FFmpeg back-end). See previous paragraph for the meaning of this.

Benchmark

Below is the result of a small benchmark test performed with various apt-X encoding libraries. Test was done with the usage of aptxenc and aptxhdenc tools from this repository. Elapsed user time was calculated with the usage of a standard UNIX time command line tool. All libraries (except original Qualcomm libraries) were compiled with Clang version 8.0.7 with the O2 or O3 optimization level.

Setup

  • CPU: ARM Cortex-A53
  • Input file: WAV audio, Microsoft PCM, 16 bit, stereo 48000 Hz
  • Input duration: 15 minutes 45 seconds

Results

Library apt-X Mbit/s apt-X HD Mbit/s
libaptX-1.0.16-rel-Android21 1m00.370s 1.23673
libaptXHD-1.0.1-rel-Android21 1m07.030s 1.11109
openaptx-stub 0m04.480s 0.0 0m04.820s 0.0
openaptx-ffmpeg (libavcodec-58.54.100) 1m58.100s 0.60835 2m03.270s 0.58354
aptx422 1m19.840s 0.91721
aptxHD100 1m21.950s 0.89616
libopenaptx-0.2.0 1m22.090s 0.89062 1m25.730s 0.85429

Resources

  1. AptX audio codec family
  2. Method and apparatus for electrical signal coding
  3. Two-channel QMF bank

openaptx's People

Contributors

arkq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openaptx's Issues

Is configure missing? Don't know how to make it.

cmake -DENABLE_DOC=ON -DWITH_FFMPEG=ON -DWITH_SNDFILE=ON -DENABLE_APTX422=ON -DENABLE_APTXHD100=ON ..
CMake Warning at CMakeLists.txt:22 (message):
Building apt-X / apt-X HD with FFmpeg: Compiling openaptx with FFmpeg as an
encoding backend requires apt-X Adaptive API support in the client code.
Otherwise, client will not be able to free resources allocated with the
aptxbtenc_init() function.

CMake Error at src/CMakeLists.txt:24 (install):
install TARGETS given no LIBRARY DESTINATION for shared library target
"aptx-4.2.2".

CMake Error at src/CMakeLists.txt:38 (install):
install TARGETS given no LIBRARY DESTINATION for shared library target
"aptxHD-1.0.0".

CMake Error at src/CMakeLists.txt:89 (install):
install TARGETS given no LIBRARY DESTINATION for shared library target
"aptx".

CMake Error at utils/CMakeLists.txt:25 (install):
install TARGETS given no RUNTIME DESTINATION for executable target
"aptxdec".

-- Configuring incomplete, errors occurred!
See also "/home/pi/openaptx/build/CMakeFiles/CMakeOutput.log".

Bluealsa crash when using aptX

When running mplayer with multiple files with a set of headphones supporting AptX, bluealsa crashes when mplayer switches files. Investigation led to attempting to free the same memory twice: in file aptx-ffmpeg.c line 137 from the openaptx project,
encoder_ctx_free is called; in a2dp-audio.c, a thread cleanup handler is also freeing the context. This double free causes bluealsa to crash. I removed the thread cleanup handler call from a2dp-audio.c, and this fixes the crash. Here's a link to a patch.

a2dp-audio.c.patch.txt

can't install

No package 'bluez' found <- https://github.com/Arkq/bluez-alsa <- trying to install that <- heres the problem -> bluez is already the newest version (5.50-1+rpt1).

How can I install this over my existing installation and use it

Decode very slow on Raspberry Pi Zero

I compiled from source using the WITH_FFMPEG backend. Playback is not possible, decode speed is lower than realtime. Using AAC I get 13% CPU usage.

Is this a problem in ffmpeg? Not sure where to raise this issue.

Same Header Name

Unless I missed a configuration option, it appears that your header and libopenaptx's are both openaptx.h. Obviously, this means that one cannot have both packages installed simultaneously.

Synchronization errors

Hi @arkq , I'm testing openaptx with bluealsa on raspios.
I have some issues using with a Samsung A5 (2017) connected via bluetooth, forcing it to use aptx coded, but I don't think it is related on the device itself.
I get a plethora of errors on syslog getting the audio streams choppy and unusable.

Those are the errors:
Jan 24 11:33:10 moode bluealsa[20368]: [aptx @ 0x3bd000] Synchronization error
Jan 24 11:33:10 moode bluealsa[20368]: openaptx: ffmpeg apt-X: Send packet failed: Invalid data found when processing input
Jan 24 11:33:10 moode bluealsa[20368]: /usr/bin/bluealsa: E: Apt-X decoding error: Communication error on send

openaptx is built with those flags:
-DENABLE_DOC=ON -DENABLE_APTX422=ON -DENABLE_APTXHD100=ON -DWITH_FFMPEG=ON -DWITH_SNDFILE=ON

I had to add libavutil>=56.22.100 dependency in CMakeFiles to complete the build.
Thank you for the effort you are putting in your projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.