codecs/audio/Aac: HE-AAC (SBR) and HE-AACv2 (baseline PS) decoding
New shared modules under codecs/audio/Aac: Sbr (bitstream, band tables, delta decoding), SbrBits, SbrQmf (32-band analysis / 64-band synthesis QMF through DCT-IV), SbrHf (HF generation and adjustment), Ps (baseline PS), SbrTables (ISO tables, from syom 0.8.1, MIT). Explicit signalling enables SBR at construction; implicit SBR / PS is found by Decoder:probe / Aac.probeFrames. audio/aac and audio/m4a report the output rate and take opts.sbr = false for the core only; m4a scales iTunSMPB by the media tick. Outside the folder: containers/AudioWrap writes an AAC-LC ADTS header for HE-AAC AudioSpecificConfigs (the decoder finds SBR in the stream); the api's default openAudio hook forwards opts.sbr.
This commit is contained in:
1 parent
627ddded77
commit
686a1fbf86
14 files changed
+2967
-35
No files matched your search
@@ -310,6 +310,13 @@ local function adts(track: Types.Track, packets: { Types.Packet }): (buffer?, Er
|
||||
profile = b0 // 8 -- audio object type
|
||||
rateIndex = (b0 % 8) * 2 + b1 // 128
|
||||
chanConfig = (b1 // 8) % 16
|
||||
-- HE-AAC (5) / HE-AACv2 (29), 14496-3 1.6.2.1: ADTS carries the AAC-LC core (the decoder finds SBR / PS in it)
|
||||
if (profile == 5 or profile == 29) and rateIndex ~= 15 and buffer.len(c) >= 4 then
|
||||
local v = buffer.readu8(c, 1) * 65536 + buffer.readu8(c, 2) * 256 + buffer.readu8(c, 3)
|
||||
local extIndex = (v // 2 ^ 15) % 16 -- after aot (5), sfi (4), channels (4): bits 13 .. 16
|
||||
local core = if extIndex == 15 then -1 else (v // 2 ^ 10) % 32 -- bits 17 .. 21
|
||||
profile = if core == 2 then 2 else -1
|
||||
end
|
||||
else
|
||||
local rates = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 }
|
||||
profile = 2
|
||||
|
||||
Reference in new issue
Block a user