view doc/AMR-library-tests @ 581:e2d5cad04cbf

libgsmhr1 RxFE: store CN R0+LPC separately from speech In the original GSM 06.06 code the ECU for speech mode is entirely separate from the CN generator, maintaining separate state. (The main intertie between them is the speech vs CN state variable, distinguishing between speech and CN BFIs, in addition to the CN-specific function of distinguishing between initial and update SIDs.) In the present RxFE implementation I initially thought that we could use the same saved_frame buffer for both ECU and CN, overwriting just the first 4 params (R0 and LPC) when a valid SID comes in. However, I now realize it was a bad idea: the original code has a corner case (long sequence of speech-mode BFIs to put the ECU in state 6, then SID and CN-mode BFIs, then a good speech frame) that would be broken by that buffer reuse approach. We could eliminate this corner case by resetting the ECU state when passing through a CN insertion period, but doing so would needlessly increase the behavioral diffs between GSM 06.06 and our version. Solution: use a separate CN-specific buffer for CN R0+LPC parameters, and match the behavior of GSM 06.06 code in this regard.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Feb 2025 10:02:45 +0000
parents cc0c244bd233
children
line wrap: on
line source

The present suite includes a pair of command line programs that exercise
libtwamr encoder and decoder in 3GPP test sequence format, allowing this library
to be tested against the official test sequences of 3GPP TS 26.074.

twamr-tseq-enc
==============

This program reads a *.inp file from the collection of TS 26.074, encodes it
per selected AMR mode using libtwamr functions, and emits the encoder output in
3GPP-defined .cod format.  The command line structure of twamr-tseq-enc is as
follows:

twamr-tseq-enc [-d] [-2] input.inp mode output.cod

The middle argument specifies the codec mode to be used; there is no default.
Ordinarily the mode argument is one of these 8 keywords:

	MR475
	MR515
	MR59
	MR67
	MR74
	MR795
	MR102
	MR122

However, this mode argument can also take the form of "file:$modefile", where
$modefile is an ASCII text file giving one of the above mode keywords per line.
This form is needed when testing the encoding of t21.inp per t21.mod control
file.

twamr-tseq-enc flag options: -d enables DTX, -2 switches the VAD algorithm from
VAD1 default to VAD2 alternative.  The two options can be combined as -d2.

twamr-tseq-dec
==============

This program reads a *.cod file in 3GPP AMR test sequence format, decodes it
using libtwamr functions, and emits the decoder output in a raw PCM *.out file.
The command line structure of twamr-tseq-dec is as follows:

twamr-tseq-dec [-r] input.cod output.out

By default the first word of each *.cod frame is expected to be a Tx frame type
as in enum TXFrameType; with -r option this first word is expected to be an Rx
frame type as in enum RXFrameType instead.  This option directly corresponds to
-rxframetype in the reference decoder program from 3GPP.

Byte order considerations
=========================

Both twamr-tseq-enc and twamr-tseq-dec read and write their input and output
files (16-bit linear PCM on one end and 3GPP *.cod test sequence format on the
other end) in the local machine's native byte order.  3GPP shipped their
TS 26.074 collection of AMR test sequences in little-endian byte order; given
that most GSM software developers are now largely forced by economic pressures
to work on x86 or ARM architecture machines rather than more noble SPARC or
PowerPC systems, the local byte order of the developer's machine will typically
be LE, matching TS 26.074 files as published.