ws-m4a: bench lines (AAC-LC / ALAC decode, ALAC encode, MDCT; bench.sh also builds the m4a fixtures); m4a decoder bitrate from the sample sizes

This commit is contained in:
4DBug committed 2026-10-31 09:04:03 -05:00
1 parent 83d43f6c6d
commit a7ed692156
3 files changed
+45 -4

No files matched your search

+5 -3
View File
@@ -194,7 +194,7 @@ function M4a.open(r: Bytes.Reader, opts: DecodeOptions?): (Types.Decoder?, Err.E
channels = channels,
frames = frames,
duration = frames / sr,
bitrate = if movie.duration > 0 then math.floor((r.limit - r.base) * 8 / math.max(frames / sr, 1e-9)) else 0,
bitrate = 0,
tags = tags,
pictures = pictures,
codec = t.codec,
@@ -202,9 +202,11 @@ function M4a.open(r: Bytes.Reader, opts: DecodeOptions?): (Types.Decoder?, Err.E
movie = movie,
error = nil,
}
if t.bitrate then
dec.bitrate = t.bitrate
local bytes = 0
for i = 1, t.sampleCount do
bytes += t.sizes[i]
end
dec.bitrate = if frames > 0 then math.floor(bytes * 8 * sr / frames) else (t.bitrate or 0)
-- decode the next packet into pend; false at the end / on an error
local function fill(): boolean