H.264: Cabac / Cavlc resolved once per process (upvalue), not per slice; AAC: SBR / PS required with the first SBR element (AacSbr chunk: an AAC-LC open compiles 55 KB, not 203 KB); m4a: Alac required for an ALAC track; chunked build: Vp8 / Vp8L and the Opus CELT encoder in chunks of their own; load check: AAC-LC and HE-AACv2 m4a opens

This commit is contained in:
4DBug committed 2026-11-03 02:51:47 -06:00
1 parent 05a44e1193
commit 3f0a0df9c7
12 files changed
+4057 -3950

No files matched your search

+16 -7
View File
@@ -27910,7 +27910,6 @@ local __compat = __compat local buffer, bit32, type, __iter = __compat.buffer, _
local Err = __include("core/Err")
local Bits = __include("core/Bits")
local Decode = __include("codecs/audio/Aac/Decode")
local Sbr = __include("codecs/audio/Aac/Sbr")
local Aac = {}
@@ -28180,7 +28179,7 @@ local function reset(self)
c.prevShape = 0
end
for _, e in __iter(self.state.sbrElems) do
Sbr.restart(e)
__include("codecs/audio/Aac/Sbr").restart(e)
end
end
@@ -28316,7 +28315,7 @@ local __compat = __compat local buffer, bit32, __iter = __compat.buffer, __compa
-- Written from the standard; no third-party code. PNS uses FFmpeg's LCG so the noise matches it.
local Mdct = __include("codecs/audio/Mdct")
local Tables = __include("codecs/audio/Aac/Tables")
local Sbr = __include("codecs/audio/Aac/Sbr")
local Sbr= nil -- codecs/audio/Aac/Sbr (and Ps), required with the first SBR element
local readu32, byteswap, lshift, rshift, band = buffer.readu32, bit32.byteswap, bit32.lshift, bit32.rshift, bit32.band
local floor, sqrt, abs = math.floor, math.sqrt, math.abs
@@ -29054,6 +29053,9 @@ end
local function sbrElement(st, i, nch)
local e = st.sbrElems[i]
if not e or e.nch ~= nch then
if Sbr == nil then
Sbr = __include("codecs/audio/Aac/Sbr")
end
e = Sbr.element(nch, st.sbrRate, st.psOut and nch == 1)
st.sbrElems[i] = e
end
@@ -29217,7 +29219,8 @@ if buffer.len(B) < len + 16 then
if kind == 13 or kind == 14 then -- EXT_SBR_DATA / EXT_SBR_DATA_CRC
st.sbr = true
if st.sbrOn and nElem > 0 and lastElement ~= 3 then
Sbr.extension(sbrElement(st, nElem, lastElement == 1 and 2 or 1), B, start + 4, count * 8 - 4, kind == 14)
local e = sbrElement(st, nElem, lastElement == 1 and 2 or 1)
Sbr.extension(e, B, start + 4, count * 8 - 4, kind == 14)
end
end
st.extensions =st.extensions+ 1
@@ -111529,6 +111532,7 @@ local Deblock = __include("codecs/video/H264/Deblock")
local Inter = __include("codecs/video/H264/Inter")
local Pool = __include("codecs/video/Video/Pool")
local Types = __include("Types")
local Cabac, Cavlc= nil, nil -- the entropy decoder a stream uses, required on its first slice
local PAD, PADC = Inter.PAD, Inter.PADC
local CHROMA_QP = Tables.CHROMA_QP
@@ -112448,11 +112452,16 @@ local function decodeSlice(self, sh, r)
local before = 0
local st = S.sliceTab
local ok, err
-- the entropy decoder the stream uses, required on its first slice
if pps.cabac then
ok, err = __include("codecs/video/H264/Cabac").slice(S, self.M, r)
if Cabac == nil then
Cabac = __include("codecs/video/H264/Cabac")
end
ok, err = Cabac.slice(S, self.M, r)
else
ok, err = __include("codecs/video/H264/Cavlc").slice(S, self.M, r)
if Cavlc == nil then
Cavlc = __include("codecs/video/H264/Cavlc")
end
ok, err = Cavlc.slice(S, self.M, r)
end
for i = 1, #st do
if st[i] ~= 0 then