mirror of
https://github.com/google/liblc3.git
synced 2026-05-13 15:48:02 +00:00
feature: Add lc3_encoder_disable_ltpf
LTPF requires a lot of processing power, so disabling it might be required for embedded low-performance devices.
This commit is contained in:
committed by
Antoine SOULIER
parent
1de85e2d9b
commit
9f1e206b34
10
src/lc3.c
10
src/lc3.c
@@ -301,7 +301,7 @@ static void analyze(struct lc3_encoder *encoder,
|
||||
|
||||
bool att = lc3_attdet_run(dt, sr_pcm, nbytes, &encoder->attdet, xt);
|
||||
|
||||
side->pitch_present =
|
||||
side->pitch_present = !encoder->ltpf_bypass &&
|
||||
lc3_ltpf_analyse(dt, sr_pcm, &encoder->ltpf, xt, &side->ltpf);
|
||||
|
||||
memmove(xt - nt, xt + (ns-nt), nt * sizeof(*xt));
|
||||
@@ -313,7 +313,7 @@ static void analyze(struct lc3_encoder *encoder,
|
||||
lc3_mdct_forward(dt, sr_pcm, sr, xs, xd, xf);
|
||||
|
||||
bool nn_flag = lc3_energy_compute(dt, sr, xf, e);
|
||||
if (nn_flag)
|
||||
if (nn_flag || encoder->ltpf_bypass)
|
||||
lc3_ltpf_disable(&side->ltpf);
|
||||
|
||||
side->bw = lc3_bwdet_run(dt, sr, e);
|
||||
@@ -424,6 +424,12 @@ LC3_EXPORT struct lc3_encoder *lc3_setup_encoder(
|
||||
return lc3_hr_setup_encoder(false, dt_us, sr_hz, sr_pcm_hz, mem);
|
||||
}
|
||||
|
||||
LC3_EXPORT void lc3_encoder_disable_ltpf(
|
||||
struct lc3_encoder *encoder)
|
||||
{
|
||||
encoder->ltpf_bypass = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a frame
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user