bluez5: aac: use higher band limit for CBR mode

FDK-AAC encoder uses band pass filter, which is automatically
applied at all bitrates.
For CBR encoding mode, its values are as follows (for stereo):

* 0-12 kb/s:   5   kHz
* 12-20 kb/s:  6.4 kHz
* 20-28 kb/s:  9.6 kHz
* 40-56 kb/s:  13  kHz
* 56-72 kb/s:  16  kHz
* 72-576 kb/s: 17  kHz

VBR uses the following table (stereo):

* Mode 1: 13   kHz
* Mode 2: 13   kHz
* Mode 3: 15.7 kHz
* Mode 4: 16.5 kHz
* Mode 5: 19.3 kHz

17 kHz for CBR is a limiting value for high bitrate.

Assume >110 kbit/s as a "high bitrate" CBR and increase the
band pass cutout up to 19.3 kHz (as in mode 5 VBR).

Link: d8e6b1a3aa/libAACenc/src/bandwidth.cpp (L114-L160)
This commit is contained in:
ValdikSS 2026-04-05 19:58:00 +03:00
parent 49d5f4f236
commit a35b6b0c4b

View file

@ -395,6 +395,15 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
if (res != AACENC_OK) if (res != AACENC_OK)
goto error; goto error;
// Assume >110 kbit/s as a "high bitrate" CBR and increase the
// band pass cutout up to 19.3 kHz (as in mode 5 VBR).
if (!conf->vbr && this->cur_bitrate > 110000) {
res = aacEncoder_SetParam(this->aacenc, AACENC_BANDWIDTH,
19293);
if (res != AACENC_OK)
goto error;
}
res = aacEncoder_SetParam(this->aacenc, AACENC_TRANSMUX, TT_MP4_LATM_MCP1); res = aacEncoder_SetParam(this->aacenc, AACENC_TRANSMUX, TT_MP4_LATM_MCP1);
if (res != AACENC_OK) if (res != AACENC_OK)
goto error; goto error;