mirror of
https://github.com/google/liblc3.git
synced 2026-05-19 09:58:01 +00:00
feature: Add 2.5 ms and 5 ms LC3 plus frame durations
fix: Check TNS bitstream data fix: LTPF Activation with 2.5 ms frame sizes
This commit is contained in:
committed by
Antoine Soulier
parent
a75f187e00
commit
149cb6537e
@@ -25,46 +25,55 @@
|
||||
|
||||
/**
|
||||
* Return number of samples, delayed samples and
|
||||
* encoded spectrum coefficients within a frame
|
||||
* - For encoding, keep 1.25 ms of temporal winodw
|
||||
* encoded spectrum coefficients within a frame.
|
||||
*
|
||||
* - The number of MDCT delayed samples is the sum of half a frame and
|
||||
* an ovelap of future by 1.25 ms (2.5ms, 5ms and 10ms frame durations)
|
||||
* or 2 ms (7.5ms frame duration).
|
||||
*
|
||||
* - For encoding, keep 1.25 ms of temporal previous samples
|
||||
* - For decoding, keep 18 ms of history, aligned on frames, and a frame
|
||||
*/
|
||||
|
||||
#define __LC3_NS(dt_us, sr_hz) \
|
||||
( (dt_us * sr_hz) / 1000 / 1000 )
|
||||
( (dt_us) * (sr_hz) / 1000 / 1000 )
|
||||
|
||||
#define __LC3_ND(dt_us, sr_hz) \
|
||||
( (dt_us) == 7500 ? 23 * __LC3_NS(dt_us, sr_hz) / 30 \
|
||||
: 5 * __LC3_NS(dt_us, sr_hz) / 8 )
|
||||
( __LC3_NS(dt_us, sr_hz) / 2 + \
|
||||
__LC3_NS((dt_us) == 7500 ? 2000 : 1250, sr_hz) )
|
||||
|
||||
#define __LC3_NT(sr_hz) \
|
||||
( (5 * sr_hz) / 4000 )
|
||||
( __LC3_NS(1250, sr_hz) )
|
||||
|
||||
#define __LC3_NH(dt_us, sr_hz) \
|
||||
( ((3 - ((dt_us) >= 10000)) + 1) * __LC3_NS(dt_us, sr_hz) )
|
||||
( __LC3_NS(18000, sr_hz) + 2*__LC3_NS(dt_us, sr_hz) - \
|
||||
(__LC3_NS(18000, sr_hz) % __LC3_NS(dt_us, sr_hz)) )
|
||||
|
||||
|
||||
/**
|
||||
* Frame duration 7.5ms or 10ms
|
||||
* Frame duration
|
||||
*/
|
||||
|
||||
enum lc3_dt {
|
||||
LC3_DT_7M5,
|
||||
LC3_DT_10M,
|
||||
LC3_DT_2M5 = 0,
|
||||
LC3_DT_5M = 1,
|
||||
LC3_DT_7M5 = 2,
|
||||
LC3_DT_10M = 3,
|
||||
|
||||
LC3_NUM_DT
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Sampling frequency
|
||||
*/
|
||||
|
||||
enum lc3_srate {
|
||||
LC3_SRATE_8K,
|
||||
LC3_SRATE_16K,
|
||||
LC3_SRATE_24K,
|
||||
LC3_SRATE_32K,
|
||||
LC3_SRATE_48K,
|
||||
LC3_SRATE_8K = 0,
|
||||
LC3_SRATE_16K = 1,
|
||||
LC3_SRATE_24K = 2,
|
||||
LC3_SRATE_32K = 3,
|
||||
LC3_SRATE_48K = 4,
|
||||
|
||||
LC3_NUM_SRATE,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user