Repository navigation
H.264 decoder over avkit container samples, bit-exact against ffmpeg (D1 of avkit#89) - #1
Merged
Merged
Conversation
…fmpeg Package decode takes an avcC record (ISO/IEC 14496-15 5.3.3.1) or an avkit container.TrackConfig plus length-prefixed samples, and returns pictures in display order with their PTS, chroma format and bit depth. The decoding itself is github.com/oops1/go.264 (BSD-2-Clause, pure Go), pinned at v1.12.0 and forced onto its software path. Resource bounds: MaxFrameMBs (default 36864) and MaxSampleBytes (default 64 MiB) are enforced before any buffer sized by the stream is allocated; a bomb SPS is refused under a 256 MiB memory limit. tools/ holds the oracle harness (jvt: download ITU-T H.264.1 streams, compare every picture's MD5 with ffmpeg -f framemd5) and covergate, which reads the cover profile itself instead of trusting a rounded percentage. Refs go-avkit/avkit#89 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* .github/workflows/ci.yml: gofmt, 3 OS with race + exact coverage gate (tools/covergate), fuzz, govulncheck, amd64/arm64, 386, riscv64/loong64/ ppc64le/s390x under qemu. * testdata/jvt: ffmpeg framemd5 MD5s for 73 ITU-T H.264.1 AVCv1 streams; TestJVTConformance runs them when DECODE_JVT_DIR is set. MR2..MR5_TANDBERG are pendingUpstream (oops1/go.264#2). * testdata/fuzz: seed corpus; Fuzz{ParseAVCC,DecodeSample,DecodeAnnexB}. * testdata/real-files.txt: hashes of 5 real MP4/MKV files, 900 pictures each. * tools/jvt: fetch, compare, diff, bits, file, clip, seeds. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Windows checks text files out with CRLF, so every ffmpeg MD5 carried a trailing \r and no picture matched. Read the manifests tolerantly and mark testdata -text so the bytes are never rewritten. * govulncheck v1.1.4 panics on Go 1.27.3 (x/tools/go/ssa: unexpected expr *ast.KeyValueExpr); use @latest as the org's tooling rule says. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PowerShell on the Windows runner split `-coverprofile=cover.out` at the dot
("FAIL .out [setup failed]"). The first Windows failure (CRLF) was fixed in the
previous commit; this is the second.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Downloaded ITU-T H.264 (V16, 06/2026) and checked every clause cited against it: 7.4.3, 8.2.1 (+8.2.1.1..8.2.1.3), 8.2.5.1..8.2.5.4, C.4.4 are right. Table numbers and sub-clause numbers that were not opened (Table 6-1, Table A-1, 7.3.2.1.1) are dropped. ISO/IEC 14496-15 is paywalled: the avcC comments now cite mp4ff's reader, which was opened, and the High-profile extension is read for every profile except 66/77/88 as mp4ff does (it also covers 244). Coverage was checked per function (`go tool cover -func`: every line 100.0%); tools/covergate already fails on any statement block that never ran, which is stricter than per function. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…bases exactly Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wave D1 of go-avkit/avkit#89: H.264 decoder
New module
github.com/go-avkit/decode. Input is what avkit'scontainerhands over (avcC or
TrackConfigparameter sets + length-prefixed samples, orraw Annex B); output is pictures in display order as planar YUV with chroma
format, bit depth and PTS. The decoding is oops1/go.264 v1.12.0 (BSD-2-Clause,
license checked 2026-11-01), software path only, fixed upstream where wrong
(upstream is active: last push 2026-10-09, so patched by PR, not forked).
Measured (single thread, vs
ffmpeg -f framemd5 -pix_fmt yuv420p)testdata/real-files.txtProfiles claimed: Constrained Baseline, Baseline without FMO/ASO, Main
progressive, High 4:2:0 8-bit progressive (no JVT FRExt stream measured yet).
Everything else returns
ErrUnsupported.Security
MaxFrameMBs/MaxSampleByteschecked before any stream-sized allocation;bomb test under a 256 MiB memory limit asserts refusal and < 8 MiB allocated;
three fuzz targets with committed corpus, run 60-90 s each locally (clean) and
in CI; govulncheck in CI; NAL lengths bounds-checked (32-bit lane in CI).
Not done / honest gaps
re-read against the text (README says so). ISO/IEC 14496-15 is paywalled.
manifests and
DECODE_JVT_DIRtest are.CI: gofmt, 3 OS with race and exact coverage gate (tools/covergate reads the
profile; the library is at 100% of 152 statements), fuzz, govulncheck, amd64,
arm64, 386, riscv64/loong64/ppc64le/s390x under qemu. Renovate config as the
org's other repos. Not merged, not tagged.
🤖 Generated with Claude Code