c8d9bad845
The previous src/libs/g722 was spandsp's G.722 offered only under GPL-2 or LGPL-2.1. That blocks shipping rtphone statically linked in a closed binary (the freeware VQ for Asterisk engine) without a relink offer. Asterisk's codecs/g722 is the same code: Steve Underwood placed his contributions in the public domain there, and the CMU 1993 code under it is "completely unrestricted" for any use. src/libs/g722/README.md records the provenance and both statements. It also fixes the decoded level. Asterisk's copy halves the encoder input and doubles the decoder output, so streams from Asterisk and ffmpeg decode at their original level. The old copy decoded them 6 dB too quiet (ITU-convention streams from pjmedia 12 dB), and its encoder clipped input above -6 dBFS. Local changes to Asterisk's files: - the decoder saturates its output instead of casting. Asterisk's cast wraps: 259 samples in 11 s of speech peaking at -0.2 dBFS came out with the opposite sign; - g722.h includes <stdint.h> and maps __inline__ for MSVC (the removed g722_inttypes.h used to). Dropped: g722_bitstream.*, g722codec.c and three helper headers, none used. The API is unchanged (g722_encode_init / g722_decode, same options). Measured in vq-core (16 simultaneous replayed calls, NISQA speech): - G.711 control calls score identically; - normal-level G.722: SilentCall -0.09..-0.14, DeadAir-01 -0.06..-0.09, MOS unchanged; - loud G.722 with a clipped source now shows AmpClipping 0.02-0.03 and MOS 3.89/4.28 instead of 4.45: the codec overshoots on the clipped peaks at the correct level, which the old -6 dB hid; - results are identical across runs (the old decoder varied by up to 0.30 MOS). G.722 still loses about 44% of its packets in AudioReceiver because G722Codec::info() reports an 8 kHz sample rate for 16 kHz audio. That is fixed separately. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
14 lines
396 B
CMake
14 lines
396 B
CMake
project (g722_codec)
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
# G.722 from Asterisk (codecs/g722): Steve Underwood's spandsp code, which he
|
|
# placed in the public domain, on top of the CMU 1993 codec, whose use "for
|
|
# any research or commercial purpose, is completely unrestricted". See README.md.
|
|
set (G722_SOURCES
|
|
g722_decode.c
|
|
g722_encode.c
|
|
)
|
|
|
|
add_library(g722_codec ${G722_SOURCES})
|