diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..544312a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,136 @@ +name: ci + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +# CI pins the Go release below (Renovate moves it). The go.mod floor is 1.27.4, the release +# govpx v0.5.3 requires. +jobs: + gofmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.27.4' + - name: gofmt + run: | + unformatted=$(gofmt -l .) + if [ -n "$unformatted" ]; then + echo "::error::these files are not gofmt-clean:"; echo "$unformatted" + exit 1 + fi + + # Vet, build and race-test on three OSes. The libvpx vectors run in the lane below. + test: + name: test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.27.4' + - run: go vet ./... + - run: go build ./... + - run: go test -race ./... + + # Tools are modules of their own. + tools: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.27.4' + - run: cd tools/vpxfetch && go vet ./... && go test ./... + - run: cd tools/portgovpx && go vet ./... && go test ./... + + # libvpx's 376 decoder vectors, picture by picture, native and with the SIMD experiment. + vectors: + name: vectors (${{ matrix.label }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - { os: ubuntu-latest, label: amd64, goexperiment: '' } + - { os: ubuntu-latest, label: amd64 simd, goexperiment: simd } + - { os: ubuntu-24.04-arm, label: arm64, goexperiment: '' } + - { os: ubuntu-24.04-arm, label: arm64 simd, goexperiment: simd } + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.27.4' + - name: cache the vectors + uses: actions/cache@v6.1.0 + with: + path: libvpx-vectors + key: libvpx-vectors-${{ hashFiles('testdata/libvpx/*.md5') }} + - name: fetch the vectors + run: cd tools/vpxfetch && go run . --manifests ../../testdata/libvpx --dir ../../libvpx-vectors + - name: decode and compare + env: + GOEXPERIMENT: ${{ matrix.goexperiment }} + LIBVPX_VECTORS_DIR: ${{ github.workspace }}/libvpx-vectors + run: go test -race -timeout 40m -count=1 -v -run 'TestLibvpxVectors$|TestLibvpxVectorsThreaded$' . + + # The fuzz corpora run as ordinary tests; this lane runs them on the 32-bit target too, where + # int is 32 bits wide and a size computed in int wraps. + arch-386: + name: arch 386 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.27.4' + - run: GOARCH=386 go vet ./... + - run: GOARCH=386 go test ./... + + arch-qemu: + name: arch ${{ matrix.goarch }} (qemu) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - { goarch: riscv64, qemu: qemu-riscv64-static } + - { goarch: loong64, qemu: qemu-loongarch64-static } + - { goarch: ppc64le, qemu: qemu-ppc64le-static } + - { goarch: s390x, qemu: qemu-s390x-static } + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.27.4' + # `qemu-user-static` is a virtual package on Ubuntu 26.04; `qemu-user` ships the dynamic + # `qemu-` that `go test -exec` needs, and both names are accepted below. + - name: install qemu user-mode emulators + timeout-minutes: 10 + run: sudo apt-get update && sudo apt-get install -y qemu-user qemu-user-binfmt + - name: Test under qemu (${{ matrix.goarch }}) + run: | + base="${{ matrix.qemu }}" + q="" + for cand in "$base" "${base%-static}"; do + command -v "$cand" >/dev/null 2>&1 && q="$cand" && break + done + # A missing emulator FAILS this lane: a lane that reports success for an + # architecture it never ran is the one outcome this matrix exists to rule out. + if [ -z "$q" ]; then + echo "::error::no qemu user emulator for ${{ matrix.goarch }} (looked for $base and ${base%-static})" + exit 1 + fi + echo "running ${{ matrix.goarch }} under $q" + GOARCH=${{ matrix.goarch }} go test -exec="$q" ./... diff --git a/PATENTS b/PATENTS new file mode 100644 index 0000000..fc4de9e --- /dev/null +++ b/PATENTS @@ -0,0 +1,108 @@ +Alliance for Open Media Patent License 1.0 + +1. License Terms. + +1.1. Patent License. Subject to the terms and conditions of this License, each + Licensor, on behalf of itself and successors in interest and assigns, + grants Licensee a non-sublicensable, perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable (except as expressly stated in this + License) patent license to its Necessary Claims to make, use, sell, offer + for sale, import or distribute any Implementation. + +1.2. Conditions. + +1.2.1. Availability. As a condition to the grant of rights to Licensee to make, + sell, offer for sale, import or distribute an Implementation under + Section 1.1, Licensee must make its Necessary Claims available under + this License, and must reproduce this License with any Implementation + as follows: + + a. For distribution in source code, by including this License in the + root directory of the source code with its Implementation. + + b. For distribution in any other form (including binary, object form, + and/or hardware description code (e.g., HDL, RTL, Gate Level Netlist, + GDSII, etc.)), by including this License in the documentation, legal + notices, and/or other written materials provided with the + Implementation. + +1.2.2. Additional Conditions. This license is directly from Licensor to + Licensee. Licensee acknowledges as a condition of benefiting from it + that no rights from Licensor are received from suppliers, distributors, + or otherwise in connection with this License. + +1.3. Defensive Termination. If any Licensee, its Affiliates, or its agents + initiates patent litigation or files, maintains, or voluntarily + participates in a lawsuit against another entity or any person asserting + that any Implementation infringes Necessary Claims, any patent licenses + granted under this License directly to the Licensee are immediately + terminated as of the date of the initiation of action unless 1) that suit + was in response to a corresponding suit regarding an Implementation first + brought against an initiating entity, or 2) that suit was brought to + enforce the terms of this License (including intervention in a third-party + action by a Licensee). + +1.4. Disclaimers. The Reference Implementation and Specification are provided + "AS IS" and without warranty. The entire risk as to implementing or + otherwise using the Reference Implementation or Specification is assumed + by the implementer and user. Licensor expressly disclaims any warranties + (express, implied, or otherwise), including implied warranties of + merchantability, non-infringement, fitness for a particular purpose, or + title, related to the material. IN NO EVENT WILL LICENSOR BE LIABLE TO + ANY OTHER PARTY FOR LOST PROFITS OR ANY FORM OF INDIRECT, SPECIAL, + INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER FROM ANY CAUSES OF + ACTION OF ANY KIND WITH RESPECT TO THIS LICENSE, WHETHER BASED ON BREACH + OF CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, AND WHETHER OR + NOT THE OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +2. Definitions. + +2.1. Affiliate. "Affiliate" means an entity that directly or indirectly + Controls, is Controlled by, or is under common Control of that party. + +2.2. Control. "Control" means direct or indirect control of more than 50% of + the voting power to elect directors of that corporation, or for any other + entity, the power to direct management of such entity. + +2.3. Decoder. "Decoder" means any decoder that conforms fully with all + non-optional portions of the Specification. + +2.4. Encoder. "Encoder" means any encoder that produces a bitstream that can + be decoded by a Decoder only to the extent it produces such a bitstream. + +2.5. Final Deliverable. "Final Deliverable" means the final version of a + deliverable approved by the Alliance for Open Media as a Final + Deliverable. + +2.6. Implementation. "Implementation" means any implementation, including the + Reference Implementation, that is an Encoder and/or a Decoder. An + Implementation also includes components of an Implementation only to the + extent they are used as part of an Implementation. + +2.7. License. "License" means this license. + +2.8. Licensee. "Licensee" means any person or entity who exercises patent + rights granted under this License. + +2.9. Licensor. "Licensor" means (i) any Licensee that makes, sells, offers + for sale, imports or distributes any Implementation, or (ii) a person + or entity that has a licensing obligation to the Implementation as a + result of its membership and/or participation in the Alliance for Open + Media working group that developed the Specification. + +2.10. Necessary Claims. "Necessary Claims" means all claims of patents or + patent applications, (a) that currently or at any time in the future, + are owned or controlled by the Licensor, and (b) (i) would be an + Essential Claim as defined by the W3C Policy as of February 5, 2004 + (https://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential) + as if the Specification was a W3C Recommendation; or (ii) are infringed + by the Reference Implementation. + +2.11. Reference Implementation. "Reference Implementation" means an Encoder + and/or Decoder released by the Alliance for Open Media as a Final + Deliverable. + +2.12. Specification. "Specification" means the specification designated by + the Alliance for Open Media as a Final Deliverable for which this + License was issued. + diff --git a/README.md b/README.md index 69b7647..567e69f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,51 @@ # vpx -VP8 and VP9 decoders in Go (port of govpx v0.5.3, libvpx as oracle) + +VP8 and VP9 decoders in pure Go, no cgo. Packages `vp8` and `vp9` decode +packets to planar YUV (VP9 profiles 0 and 1; profiles 2 and 3 return +`vpx.ErrVP9NotImplemented`). The shared `vpx` package holds `Image` and the +error sentinels. + +```go +d, err := vp9.New(vp9.Options{MaxWidth: 4096, MaxHeight: 2304, Threads: 4, RowMT: true}) +// ... +if err := d.DecodeWithPTS(packet, pts); err == nil { + if img, ok := d.NextFrame(); ok { /* img is valid until the next decode */ } +} +``` + +## Status: v0.1.0 (M0) + +This release is a port of the decoder subset of +[govpx](https://github.com/thesyncim/govpx) v0.5.3 (BSD-3-Clause), extracted by +`tools/portgovpx` (a per-declaration closure of the decoder, written in Go with a +test), so that every later change is made here and measured against libvpx. +The design is in [docs/design/vpx-decoder.md](docs/design/vpx-decoder.md). + +At M0 the decoded picture is `vpx.Image`, a view of the decoder's buffers; the +design's `Picture` type replaces it later. The package has no extra behaviour +over govpx v0.5.3: the same 376 libvpx test vectors decode to the same md5 of +every picture, with 0 and with 4 threads. + +Changes from govpx v0.5.3 (each is also noted in the file): `internal/vpx/buffers/aligned.go` +rounds up to a power of two with `math/bits`, because govpx's `v >> 32` does not compile +for 32-bit targets. + +## Tests + +- `LIBVPX_VECTORS_DIR=DIR go test ./...` decodes libvpx's 376 decoder vectors and + compares every picture's md5 with libvpx's. `go run ./tools/vpxfetch + --manifests testdata/libvpx --dir DIR` (a module of its own, in `tools/`) + downloads them. Without the variable the vector tests are skipped and say so. +- Fuzz targets with committed corpora: `FuzzReadBool` (the boolean decoder against + RFC 6386, far past the end of the data), `FuzzVP8Decode` and `FuzzVP9Decode` + (any two packets; the size cap bounds allocation). +- The ported tree (`internal/`) is not held to the 100 % coverage gate of the + sibling repositories: it is measured by the vectors. Hand-written code is. + +## Licences + +BSD-3-Clause, see `LICENSE`. Derived files cite their govpx path +(`third_party/govpx/`), and where govpx cites a libvpx source file, that file's +licence and patent grant are in `third_party/libvpx/`. The AV1-derived SIMD +kernels carry goav1's licence in `third_party/goav1/` and the AOM patent grant is +`PATENTS`. diff --git a/docs/design/vpx-decoder.md b/docs/design/vpx-decoder.md new file mode 100644 index 0000000..a442d1a --- /dev/null +++ b/docs/design/vpx-decoder.md @@ -0,0 +1,521 @@ +# In-house VP8 and VP9 decoding: design + +Status: proposal, revision 2, 2026-11-28. Nothing here is implemented yet. + +This document decides how VP8 and VP9 decoding moves out of the third-party +module `github.com/thesyncim/govpx` and into one go-avkit module built on +`go-videodsp/kernels`. That module is `go-avkit/vpx`, described in §2. + +- The source of the port is govpx **v0.5.3**. Its licence is BSD-3-Clause, + "Copyright (c) 2026, The govpx authors". +- The consumer is `go-avkit/decode` **v0.19.1**, `vpx.go` at `e59325a`. + +Each statement is marked as one of three kinds: + +- **measured**: the number comes from a run that is cited. +- **read**: taken from a file or section that was opened, cited by path and + line, or by section and page. +- **inferred**: not checked yet. Each inferred statement names the step that + will check it. + +When `go-avkit/vpx` is created, this document moves there. +`go-avkit/vp9` keeps its header-only scope. + +## 0. Starting point + +### What decode uses from govpx + +Read in `vpx.go` at `e59325a`: + +- **Construction.** + - `govpx.VP9DecoderOptions{MaxWidth: side, MaxHeight: side}` at `:127`. + - `govpx.DecoderOptions{MaxWidth: side, MaxHeight: side}` at `:137`. + - Threads: VP9 gets `Threads` plus `DecoderRowMT` when `Config.Threads >= 2`; + VP8 is capped at `Threads = 2`. +- **Per packet** (`:166-173`): `DecodeWithPTS(data, uint64(pts))`, then + `NextFrame()` (returns an image and ok), then `LastFrameCorrupted()`. The + corruption flag becomes `Frame.Corrupt`. +- **Images.** The image is strided and aliases decoder storage. `vpxFrame` + copies it into packed, owned `Frame` planes (`packPlane8/16`). +- **Recycle** is decode's pool of at most `maxFreePlanes = 4` packed plane sets. +- **Errors.** `classifyVPX` maps govpx's sentinels onto unsupported, over-limit, + closed and bitstream errors. +- **Superframes.** `vp9Frames` (`:325-337`) splits a superframe by its index. + "A packet without a well-formed index is one frame, as govpx reads it" + (`:325-326`), returning `[][]byte{data}` at `:331`, `:336` and `:347`. +- **Tests on govpx types.** `vpx_guard_test.go` and `vpx_threads_test.go`. +- **The govpx version** in decode's `go.mod` at `e59325a` is still **v0.5.2** + (`go.mod:15`). Step D-1 (§4) bumps it to v0.5.3 so that the port and the + dependency are the same code. + +### Conformance (measured) + +The decode README reports 373 of 376 libvpx test vectors matching libvpx's md5 +on every picture, with and without `GOEXPERIMENT=simd`. The three VP9 4:4:0 +vectors are refused with `ErrUnsupported`, and 0 vectors differ. + +The tests are `vpx_libvpx_test.go:23` (`const libvpxVectors = 376`) and +`TestLibvpxVectorsThreaded`. + +### Speed (measured) + +The source is go-avkit/decode#125, comment "Measured on tag v0.19.0". Setup: + +- 1080p crowd_run, first 300 frames, encoded by libvpx at 4 Mb/s. +- Ryzen 9 7950X, one pinned core, 5 interleaved rounds. +- 1-minute load between 1.0 and 3.4. +- Reference: libvpx via `ffmpeg -threads 1`. + +µs per frame: + +| stream | t1 | t1+Recycle | t4 | t4+Recycle | libvpx x1 | +|------------|------|------------|------|------------|-----------| +| VP9 1-tile | 7495 | 7260 | 3448 | 3163 | 2623 | +| VP9 4-tile | 7553 | 7319 | 2745 | 2491 | 2610 | +| VP8 | 5172 | 4927 | 3601 | 3392 | 2427 | + +### Profiles: partial, and they set no targets + +- **VP9 1080p:** vertical convolve about 20%, loop filter 23% + (the 2026-11-28 handoff). +- **VP8 1080p** (#125): loop filter 30%, token reading 20%, + `runtime.memmove` 12.5%. The memmove is decode's per-frame copy. + +These shares come from different builds and do not add up to a whole profile. +They give a floor, not a plan. + +- Even if VP9 convolution and loop filtering cost nothing, the rest would still + take 0.57 × 7495 ≈ **4272 µs**. That is 1.63x libvpx. +- So the rest of the VP9 decoder (parsing, mode decoding, tokens, + reconstruction, and whatever the partial profile does not name) must get + faster too. + +For that reason milestone M0 starts with a **complete flat profile**: + +- every function above 0.5%, for govpx-port and for libvpx (`perf` on + `ffmpeg -threads 1`); +- grouped into the same stages: bool/tokens, modes/MV, inter prediction, + intra, itx, reconstruction add, loop filter, copy/alloc, other. + +Every target after M0 is derived from that table (§5). + +### govpx v0.5.3 (measured and read) + +Source lines, excluding tests, counted with `git ls-files` and `git show`. The +total is 231,222 source and 263,271 test lines, and the encoder accounts for +most of it. + +| part | source lines | +|---|---| +| VP9 decoder: `internal/vp9/decoder` | 7,515 | +| VP9 decoder: `internal/vp9/codec/vp9_decoder*.go` (8 files) | 10,890 | +| VP9 decoder: `dsp` (part of it is encoder SAD and variance) | 9,970 | +| VP9 decoder: `tables` | 3,332 | +| VP9 decoder: `common` | 1,213 | +| VP9 decoder: `bitstream` | 1,026 | +| VP8 decoder: `internal/vp8/decoder` | 6,211 | +| VP8 decoder: `dsp` | 3,727 | +| VP8 decoder: `boolcoder` | 1,366 | +| VP8 decoder: `common` | 949 | +| VP8 decoder: `tables` | 824 | +| VP8 decoder: its share of `internal/vp8/codec` (40,579 lines, mixed) | not yet separated | +| `internal/pixel`, used by both decoders | 14,296 | + +`internal/pixel` is imported by both decoders. This was read with +`git grep "govpx/internal/pixel"` over `internal/vp8/{decoder,dsp}`, +`internal/vp9/dsp` and `vp9_decoder*.go`. + +`internal/pixel` derives from `thesyncim/goav1` (BSD-2-Clause). That project's +`LICENSE`, `NOTICE` and `PATENTS` sit in `third_party/goav1/`. + +At govpx's root are `LICENSE`, `NOTICE`, `LICENSE.libvpx` and `PATENTS.libvpx` +(read: directory listing). govpx contains no `.s` files; its SIMD is Go SIMD +under `GOEXPERIMENT=simd`. + +govpx is pinned to libvpx v1.16.0 (`UPSTREAM.md`). Its NOTICE requires derived +code to cite the libvpx source files. + +## 1. Decision: port the decoder subset of govpx; libvpx stays the oracle + +**Decision.** We port the decoder subset of govpx v0.5.3 into `go-avkit/vpx`. +Then we replace its DSP and plumbing step by step, starting from a measured +profile. We do not rewrite either decoder from the specifications. + +1. **A port reaches parity on day one.** The ported code is the code that + produces 373/0 today. The check is the vector suite plus a differential lane + against govpx (§4, D0b). +2. **A rewrite must earn every vector again.** + - govpx itself needed upstream fixes to make 32 more VP9 vectors match, and + profiles 1 to 3 started decoding at the same time (go-avkit/decode#128). + - The VP9 specification v0.7 is 167 pages of normative process, and the 376 + vectors exercise reference scaling (§5.16), high bit depth (§5.20) and the + probability adaptation (§8.4). Source: its contents pages, which were + opened. +3. **Speed: no claim either way.** This document does not claim that the + parsing and control code is cheap. The 4272 µs floor in §0 suggests it is + not. The M0 profile decides what gets rewritten, and a rewrite of any stage + is allowed when the profile shows a gap. + +**The correctness contract.** + +- **Valid streams: a bound of 0.** The output must equal the integer decoding + process of the specifications (VP9 v0.7 §8; RFC 6386 with its reference + decoder, Attachment One, §20). + - The reason is drift. Any difference in a reference picture propagates + through motion compensation into every later inter frame until the next key + frame. An error bound per picture is therefore not a bound on the stream. + - Reordering the integer arithmetic is allowed when a range proof shows it + exact (§3). Changing the result is not. +- **Invalid streams: no bound on the pictures.** Memory safety, no crash, and + the same error class as before (§4). + +The oracles are libvpx, through the md5 of every picture in the 376 vectors, +and, for each kernel, a portable Go reference ported from the libvpx C function +it replaces (cited by path). + +## 2. Layout: one module, go-avkit/vpx + +``` +go-avkit/vpx NEW module (BSD-3-Clause) + vp8/ public VP8 decoder + vp9/ public VP9 decoder + internal/pixel ported from govpx internal/pixel (goav1-derived); shrinks as kernels land + internal/frame bordered frame buffers, ref-counted picture pool + internal/rowmt row/tile worker synchronisation + internal/bool wide-window bool decoder (VP8 and VP9) + third_party/... notices (§2.1) +go-avkit/vp8, go-avkit/vp9 unchanged: header parsers, no dependencies +go-avkit/boolcoder unchanged +go-videodsp/kernels + vpx, vp8, vp9 kernel packages (§3) +go-avkit/decode unchanged API; imports go-avkit/vpx/vp8 and /vp9 +``` + +**Why one module.** Both decoders share `internal/pixel`, frame buffers and +threading. A single module keeps these `internal`, so no public package exists +only to be deleted later. + +- `internal/pixel` can shrink to nothing without an API change. +- `go-avkit/vp8` and `go-avkit/vp9` stay header-only and dependency-free. + `go-avkit/vpx` may import them for the header parse; decode keeps its own + until D1. + +**The wide bool decoder** lives in `vpx/internal/bool`, not in boolcoder. It is +hot-path code shaped for the two decoders. boolcoder stays the small, general +module it is now. If a third consumer appears, the reader moves to boolcoder, +which is the lowest shared library. + +### Public decoder API + +The API covers everything decode uses today (§0), so step D0c is an import swap. + +```go +type Options struct { + MaxWidth, MaxHeight int // refuse a frame above either (ErrFrameRejected); 0 = codec max + Threads int // <= 1: serial + RowMT bool // VP9 only: row-parallel within a tile +} +func New(o Options) (*Decoder, error) +func (d *Decoder) DecodeWithPTS(packet []byte, pts uint64) error +func (d *Decoder) NextFrame() (*Picture, bool) // pictures in output order; one call per shown frame +func (d *Decoder) LastFrameCorrupted() (bool, error) // -> Frame.Corrupt +func (d *Decoder) Close() error +// Picture: strided planes, BitDepth, subsampling, PTS; Release() (F1, below) +// errors: ErrNotImplemented, ErrFrameRejected, ErrClosed, ErrInvalidData, ErrNeedKeyFrame +``` + +The method names and sentinel meanings are govpx's, so `classifyVPX` keeps its +table and changes only its imports. + +**Threads** is the `Options.Threads` and `RowMT` pair. VP9 uses tile-parallel +plus row-MT; VP8 uses a macroblock-row pipeline. Both are built on +`internal/rowmt`. + +**Recycle and picture lifetime (F1).** decode's contract is an owned `Frame` per +picture. Without Recycle, each picture is therefore an allocation. `DecodeInto` +would only move the copy, because a shown picture is also a reference picture, +and `show_existing_frame` outputs a picture the decoder still holds. + +F1 instead adopts the scheme of go-avkit/h265, a ref-counted +`DecodedPicture.Release()` (`recycle.go:191`, `output_lifetime_test.go`): + +- **Inside the decoder.** `Picture` holds a reference to its frame buffer, and + `Release` returns it to the `internal/frame` pool once neither the + reference-frame slots nor the caller hold it. +- **In decode.** Recycle wraps this. With Recycle, decode hands out frames + backed by released pictures instead of packing a copy. Without Recycle, decode + keeps its owned copy, and its memory stays proportional to the pictures + output. + +F1 is therefore measured **with Recycle**. + +### 2.1 Licence notices, per module + +go-avkit modules are BSD-3-Clause (`go-avkit/vp9/LICENSE`, read), and govpx is +BSD-3-Clause. + +**go-avkit/vpx:** + +- *govpx.* Its files carry no per-file headers. So the port **adds** the govpx + copyright line to each derived file, and ships govpx's `LICENSE` and `NOTICE` + as `third_party/govpx/`. +- *libvpx.* `LICENSE.libvpx` and `PATENTS.libvpx` go in `third_party/libvpx/`. + Derived files cite their libvpx source file, as govpx's NOTICE requires. +- *goav1.* goav1's `LICENSE` and `NOTICE` go in `third_party/goav1/`. Its + `PATENTS` file, the AOM patent licence, goes **at the module root** for as long + as any goav1-derived code remains in the module. +- These notices are never removed from a file that still derives from govpx. + +**go-videodsp/kernels:** every VPx kernel whose portable reference is a +line-by-line port of libvpx C cites its source file. The module then ships +libvpx's `LICENSE` and `PATENTS` under `third_party/libvpx/`, plus a `PATENTS` +at its root. + +**go-avkit/decode:** no derived code, so no new notices. + +## 3. Kernels for go-videodsp/kernels + +### 3.1 Convolution (read) + +**VP9**, VP9 v0.7 §8.5.2, p. 87: + +``` +intermediate[r][c] = Clip1(Round2(s, 7)) // horizontal pass +pred[r][c] = Clip1(Round2(s, 7)) // vertical pass +intermediateHeight = (((h - 1) * yStep + 15) >> 4) + 8 +``` + +- The spec's `+ 15` is the worst case over fractional starting positions. + libvpx computes the exact count with `+ y0_q4` + (`vpx_dsp/vpx_convolve.c:179`). +- The extra rows are never read by the vertical pass, so the outputs are + equal. A kernel may use either count. +- Each pass is `clip_pixel(ROUND_POWER_OF_TWO(sum, 7))` (`:22-107`), and the + average is `ROUND_POWER_OF_TWO(dst + res, 1)` (`:192-204`). +- The filter tables are `vp9/common/vp9_filter.c:15-79`. + +**VP8**, RFC 6386 §18.3: `clamp255((a + 64) >> 7)` after each pass, with 6 +taps. libvpx: `vp8/common/filter.c:15-31` (tables) and `:33-109` (passes). + +**HEVC** (`hevc.HPass8` and `VPass8`) keeps an unclipped 14-bit intermediate and +rounds at the weighting stage. **H.264** `mc.PutLuma` uses `+16 >> 5`, and its +centre position `j` takes the unclipped intermediate with `+512 >> 10`. Neither +kernel's arithmetic is reusable here. + +**The shared go-asmgen builder** is "N-tap multiply-accumulate, +`Round2(·, R)`, clip to u8 between passes". It needs a **32-bit accumulator**: + +- VP8's positive taps alone reach 160 × 255 = 40800 (half-sample row + `{3, -16, 77, 77, -16, 3}`, `filter.c:15-31`), which overflows int16. +- The alternative is 16-bit saturating adds in a fixed order, with a written + proof that no partial sum saturates for any tap row and any 8-bit input. + +What it covers: + +| codec | taps | R | covered | +|---|---|---|---| +| VP8 | 6 | 7 | fully | +| VP9 | 8 | 7 | fully | +| H.264 | 6 | 5 | only the 1-D half-sample positions (`b`, `h`); `j` is not covered | + +### 3.2 Inverse transform (read) + +**Rounding.** VP9 v0.7 §8.7.2, p. 100: + +- The final rounding is `Round2(T[i], Min(6, n + 2))`. +- In **lossless** mode the WHT result is stored with **no** `Round2`. +- libvpx's shifts are at `inv_txfm.c:173`, `:345`, `:742` and `:1206`. Its + constants are 14-bit cospi (`txfm_common.h:17`, `cospi_16_64 = 11585`). + +**HEVC's** 7-bit matrix (`hevc.IDCT`) is not reusable. + +**Lane widths.** `inv_txfm.h:24-59` makes int16 a **storage** width for valid +8-bit streams (18 bits at 10-bit, 20 bits at 12-bit). It does not make int16 an +arithmetic width. + +- `idct4_c` forms `(input[0] + input[2]) * cospi_16_64` (`inv_txfm.c:138-139`). + The sum before the multiply can reach 17 bits. +- So every multiply-accumulate is **widened**: `PMADDWD` on AVX2 and + `SMULL`/`SMLAL` on NEON, with a 32-bit accumulator, then the round-shift by + 14, then narrowing. +- `SQRDMULH` / `PMULHRSW` is exact only for a single product of in-range + operands. It may be used only where a range proof shows exactly that. +- Each add-then-multiply in a kernel needs a written range proof, kept next to + the kernel's portable reference. + +**VP8.** `sinpi8sqrt2 = 35468` (`vp8/common/idctllm.c:27`) does not fit int16, +and the C truncates with `>> 16`. + +- SIMD uses the `PMULHW` add-back: multiply by `35468 - 65536` and add the input + back. +- `cospi8sqrt2minus1 = 20091` (`:26`) uses `PMULHW` plus the input in the same + way. + +**Two in-tree behaviours already differ on invalid input.** govpx's scalar +`idct8` narrows each stage to int16 (`internal/vp9/dsp/idct8.go:36`, the same as +libvpx's `int16_t step[]`). Its SIMD path computes in Int32 +(`idct_core_simd.go:26`). On out-of-range coefficients the two can differ. §4 +therefore does not require identical pictures on invalid input. + +### 3.3 Loop filter (read) + +**One shared kernel.** VP8's `vp8_filter` (`vp8/common/loopfilter_filters.c:45-88`) +and VP9's `filter4` (`vpx_dsp/loopfilter.c:80-110`) are the same arithmetic. +Both masks are 0/−1 byte values: + +- VP8 builds a 0/1 flag and returns `mask - 1`; +- VP9 builds a 0/−1 accumulator and returns `~mask`. + +One `Filter4` kernel therefore serves both codecs. + +**VP9 only:** + +- `filter8` (`:162-180`) and `filter16` (`:235-282`); +- the flat masks (`:48`, `:61`); +- the `_dual` entry points (`:112-354`); +- high bit depth from `:429`. + +**VP8 only:** + +- the macroblock-edge filter (`:138`), whose taps are `(27*w + 63) >> 7`, + `18` and `9` (RFC 6386 §15.3); +- the simple filter (`:238-300`). + +H.264's `lf.Deblock*` shares the edge gather/transpose builders, not the +arithmetic. + +### 3.4 What goes where + +| package | kernels | first 8-bit; then | +|---|---|---| +| `kernels/vpx` | `Filter4` H/V (+dual); convolve copy/avg (reuse `pix` if it has a `(a+b+1)>>1` average; inferred, checked at K2) | — | +| `kernels/vp9` | `Convolve8{H,V,HV}` put/avg, w ∈ {4..64}; scaled `Convolve8`; `LPF{H,V}{8,16}[Dual]`; `IDCT{4,8,16,32}Add` with eob variants, `IADST{4,8,16}`, `IWHT4x4Add`; the 10 intra predictors, 4 to 32 | `[]uint16` + `bd` | +| `kernels/vp8` | `SixTap*`, `Bilinear*`; `MBFilter{H,V}`, `SimpleFilter{H,V}`; `IDCT4x4Add`, DC-only, `IWalsh4x4`; intra 16x16/8x8 and 10 `B_*` 4x4 modes | — | + +**Reused from kernels:** + +- the `cpu` dispatch; +- the bounds-once and `Try*` convention; +- zero allocations; +- NEON then AVX2; +- the go-asmgen builders. + +**NEON instructions needed.** These are checked against the go-asmgen gap +registry (design.md §1): `SMULL`/`SMLAL`, `RSHRN`/`SQRSHRUN`, `URSHR`, `UABD`, +`UADDL`/`USUBL`, `SQADD`/`SQSUB` and `SQRDMULH`. + +## 4. Migration of go-avkit/decode, and security + +**Gates on every decode release:** + +- **Vectors.** `TestLibvpxVectors` and `TestLibvpxVectorsThreaded` give **373 + match / 3 refused / 0 differ**, plain and with `GOEXPERIMENT=simd`, on amd64 + and arm64. +- **API.** `apidiff` against the previous tag reports no change. +- **Supply chain.** `govulncheck` passes. +- **Fuzzing.** The fuzz targets below pass, with their corpus committed. + +**The differential lane (D0b to T1)** runs govpx and `go-avkit/vpx` side by +side: + +- *The 376 vectors:* identical pictures, frame by frame. +- *Range-checked inputs:* identical pictures. These are fuzz inputs that pass + libvpx's range checks; the harness rejects an input when any coefficient + leaves the `inv_txfm.h` ranges. +- *Every other invalid input:* no crash, and the same error class + (`classifyVPX`). The pictures may differ (§3.2). + +| step | what changes | gate added | +|---|---|---| +| D-1 | decode bumps govpx v0.5.2 → v0.5.3 | vectors | +| D0a | `go-avkit/vpx` v0.1.0: the port, its own vector suite (decode's `vpxfetch` list and md5s), and the notices of §2.1 | vectors in vpx | +| D0b | decode adds the test-only differential lane | lane green | +| D0c | decode switches to `go-avkit/vpx`; the two govpx-typed tests are rewritten | **Corrupt test**: a vector with a damaged frame yields `Frame.Corrupt`. **Size cap**: a frame above `MaxWidth`/`MaxHeight` is refused with `ErrOverLimit` before any allocation. **Threads floor**: crowd_run t2 ≤ 0.8 × t1 and t4 ≤ govpx's t4 × 1.05 (VP9 4-tile 2745, VP9 1-tile 3448, VP8 3601 µs), so a port that silently runs single-threaded fails | +| D1 | decode's `vp9Frames`, `checkVPX` and `bitReader` are replaced by `vp9.SplitSuperframe` and `vp9.ParseHeader` | a malformed superframe index stays **one frame**, as at `vpx.go:325-337`, with a test per malformation (bad size bytes, zero-size frame, sum ≠ length). If the stricter `SplitSuperframe` is kept, the change of behaviour is stated in the release notes | +| F1, K*, B1, T1 | §5 milestones; decode bumps the dependency each time | vectors, lane | +| D2 (after T1) | lane removed; govpx leaves `go.mod`; README, landing page and docs updated; `Config.Threads` doc and the "profile 0" vs "profiles 0-3" text fixed | — | + +### Security + +- **Fuzz targets with committed corpora:** + - the `internal/bool` reader, including reads past the end, which must return + the defined padding behaviour (zeros, as libvpx's reader does; inferred, + `bitreader.h` is opened at B1) and never index out of bounds; + - each decoder, fed packets; + - the frame pool, fed a random sequence of decode, `NextFrame`, `Release` and + double `Release` calls; + - **asm against the portable reference**, a differential fuzz per kernel over + random blocks, strides and edge positions. +- **32-bit overflow.** VP9 frame sizes reach 65536 × 65536. A bordered 12-bit + 4:4:4 buffer is about (65536 + 2·160)² × 2 bytes × 3 planes ≈ 2.6 × 10¹⁰ + bytes, which is more than 2³¹. + - All size arithmetic is done in `uint64` and checked against `MaxWidth` / + `MaxHeight` and a byte cap before allocation. + - A test on `GOARCH=386` and `GOARCH=arm` asserts the refusal. + - Bomb tests run under `GOMEMLIMIT` and `ulimit -v`. +- **Motion vectors.** MVs are clamped (VP9 v0.7 §6.5.3–6.5.5; libvpx's border + extension) before any kernel call. The Go wrapper proves the source rectangle, + including the filter taps, lies inside the bordered buffer before entering + asm. A test drives extreme MVs on minimum-size frames. + +## 5. Milestones (protocol, then targets derived from M0) + +**Protocol for every timing:** + +- crowd_run 1080p, 300 frames, as in #125; +- one pinned core, interleaved rounds; +- 1-minute load under 8; +- libvpx (`ffmpeg -threads 1`) measured in the same session; +- results in µs per frame, plus the stage table of the flat profile. + +**Order.** The algorithmic change (the copy removal, F1) comes before the +assembly steps. After that, each codec goes in descending order of its measured +share. For VP8 that is the loop filter before tokens (30% before 20%). + +| # | milestone | exit criterion | +|---|---|---| +| M0 = D0c | port in place | VP9 1-tile ≤ 7645, VP8 ≤ 5275 (govpx + 2%); D0c threads floor; **flat profile table** for port and libvpx committed in `docs/perf/` | +| F1 | ref-counted `Picture.Release`, frame pool, decode Recycle on top | with Recycle: copy/alloc stage ≤ 1% of the profile; B/op per 300 frames ≤ 20 MB; µs/frame target = M0 − M0's copy/alloc stage time | +| K1 | loop filter: `vpx.Filter4`, VP9 `LPF*`, VP8 MB and simple filters | each codec's loop-filter stage ≤ 1.2 × libvpx's same stage; whole-frame target = previous − (M0 stage − 1.2 × libvpx stage) | +| B1 | `internal/bool` wide reader | bool/token stage ≤ 1.2 × libvpx's | +| K2 | convolution (VP9 `Convolve8*`, VP8 `SixTap*`/`Bilinear*`) | inter-prediction stage ≤ 1.2 × libvpx's | +| K3 | itx | itx stage ≤ 1.2 × libvpx's | +| K4 | intra, reconstruction add | those stages ≤ 1.2 × libvpx's | +| R1 | the remaining stages: modes/MV, other | **TBD from M0.** Each stage above 1.2 × libvpx in M0's table gets its own milestone with the same rule | +| K5 | high bit depth; `internal/pixel` empty; no hot path on Go SIMD | on the profile-2 10-bit vectors, µs/frame ≤ 1.3 × libvpx (same protocol, each vector's frames summed); the build without `GOEXPERIMENT=simd` within 3% of the build with it, on crowd_run 8-bit and on the profile-2 vectors | +| T1 | `internal/rowmt`: VP8 N-worker MB rows; VP9 high-bit-depth row-MT | crowd_run t2 and t4 (and the 10-bit profile-2 crowd_run encode for VP9): t4 ≤ 0.35 × t1 for VP9 4-tile, ≤ 0.45 × t1 for VP9 1-tile and VP8; the threaded vectors are 373/0 | +| M∞ | parity | t1 VP9 1-tile ≤ 2623, VP8 ≤ 2427 (libvpx x1); this closes #125 | + +**Rules for targets:** + +- The whole-frame number of each milestone is computed from M0's stage table. + It is not guessed beforehand. +- A milestone that misses its target is still released if it is faster than the + previous step. Its PR records the gap, and the gap stays open on #125. + +**Withdrawn from revision 1:** the whole-frame targets (≤ 6400, ≤ 5000, …). They +did not follow from the profile shares (see the 4272 µs floor) and are replaced +by the stage rule above. + +## 6. Bibliography (opened for this document) + +- *VP9 Bitstream & Decoding Process Specification* v0.7, 22 February 2017. + Opened: contents, §8.5.2 pp. 87–88, §8.7.2 p. 100. +- RFC 6386. Opened: contents, §7.3, §15.3, §18.3. +- libvpx `351a0abb3b9601002a6cd9a22fdae8889c0131dc`: + - `vpx_dsp/vpx_convolve.c`, `vpx_dsp/loopfilter.c`, `vpx_dsp/inv_txfm.c`, + `vpx_dsp/inv_txfm.h`, `vpx_dsp/txfm_common.h`; + - `vp9/common/vp9_filter.c`; + - `vp8/common/filter.c`, `filter.h`, `loopfilter_filters.c`, `idctllm.c`. +- govpx v0.5.3: root listing, `UPSTREAM.md`, `NOTICE`, `third_party/goav1/`, + `internal/vp9/dsp/idct8.go`, line counts, and the `internal/pixel` import + graph. +- go-avkit/decode `e59325a`: `vpx.go`, `go.mod`, README; issue #125. +- go-avkit/h265: `recycle.go:191`. +- go-videodsp/kernels: `docs/design/design.md`. + +**Not opened, and to open at the milestone named:** + +- `vpx_dsp/bitreader.h` and `vp8/decoder/dboolhuff.h` (B1); +- `vp9/decoder/vp9_decodeframe.c` and `vp8/decoder/threading.c` (T1); +- `vp9/common/vp9_reconintra.c` and `vpx_dsp/intrapred.c` (K4); +- `idct_core_simd.go:26` was cited by the reviewers and was not re-read here. diff --git a/fuzz_test.go b/fuzz_test.go new file mode 100644 index 0000000..cadabd9 --- /dev/null +++ b/fuzz_test.go @@ -0,0 +1,87 @@ +// Copyright (c) 2026, go-avkit +// SPDX-License-Identifier: BSD-3-Clause + +package vpx_test + +import ( + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/go-avkit/vpx/vp8" + "github.com/go-avkit/vpx/vp9" +) + +// The fuzz targets feed a decoder any two packets in a row, a first one that may start a stream +// and a second that may continue it. The decoder must return, whatever it returns, and the size +// cap bounds what it allocates. +const fuzzSide = 512 + +func FuzzVP8Decode(f *testing.F) { + f.Add([]byte{}, []byte{}) + f.Fuzz(func(t *testing.T, a, b []byte) { + for _, th := range []int{0, 2} { + d, err := vp8.New(vp8.Options{MaxWidth: fuzzSide, MaxHeight: fuzzSide, Threads: th}) + if err != nil { + t.Fatal(err) + } + for i, p := range [][]byte{a, b} { + if d.DecodeWithPTS(p, uint64(i)) == nil { + d.NextFrame() + d.LastFrameCorrupted() + } + } + d.Close() + } + }) +} + +func FuzzVP9Decode(f *testing.F) { + f.Add([]byte{}, []byte{}) + f.Fuzz(func(t *testing.T, a, b []byte) { + for _, th := range []int{0, 2} { + d, err := vp9.New(vp9.Options{MaxWidth: fuzzSide, MaxHeight: fuzzSide, Threads: th, RowMT: th > 1}) + if err != nil { + t.Fatal(err) + } + for i, p := range [][]byte{a, b} { + if d.DecodeWithPTS(p, uint64(i)) == nil { + d.NextFrame() + d.LastFrameCorrupted() + } + } + d.Close() + } + }) +} + +// seedVectors are small vectors whose first two packets are the seeds. +var seedVectors = map[string]string{ + "vp80": "vp80-00-comprehensive-001.ivf", + "vp90": "vp90-2-02-size-08x08.webm", +} + +// TestWriteFuzzSeeds writes the seeds of the two decoder fuzz targets from the vectors. It runs only +// when VPX_WRITE_CORPUS names the directory to write them into (the module root). +func TestWriteFuzzSeeds(t *testing.T) { + root := os.Getenv("VPX_WRITE_CORPUS") + dir := os.Getenv("LIBVPX_VECTORS_DIR") + if root == "" || dir == "" { + t.Skip("VPX_WRITE_CORPUS and LIBVPX_VECTORS_DIR are not both set") + } + for prefix, target := range map[string]string{"vp80": "FuzzVP8Decode", "vp90": "FuzzVP9Decode"} { + in, err := samples(filepath.Join(dir, seedVectors[prefix])) + if err != nil || len(in) < 2 { + t.Fatalf("%s: %d packets, %v", seedVectors[prefix], len(in), err) + } + out := filepath.Join(root, "testdata", "fuzz", target) + if err := os.MkdirAll(out, 0o755); err != nil { + t.Fatal(err) + } + body := fmt.Sprintf("go test fuzz v1\n[]byte(%q)\n[]byte(%q)\n", in[0], in[1]) + if err := os.WriteFile(filepath.Join(out, "first-two-packets"), []byte(body), 0o644); err != nil { + t.Fatal(err) + } + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2540e10 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/go-avkit/vpx + +go 1.27.4 diff --git a/internal/pixel/copy16_rows_amd64.go b/internal/pixel/copy16_rows_amd64.go new file mode 100644 index 0000000..3cffd23 --- /dev/null +++ b/internal/pixel/copy16_rows_amd64.go @@ -0,0 +1,28 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/copy16_rows_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import "simd/archsimd" + +// Copy16Rows follows libvpx v1.16.0 vp8/common/reconinter.c row order. +// A whole row is loaded before its store, preserving per-row memmove aliases. +func Copy16Rows(src []byte, ss int, dst []byte, ds int) bool { + if !Enabled || (uint(ss)|uint(ds))>>30 != 0 || 15*ss+16 > len(src) || 15*ds+16 > len(dst) { + return false + } + for row := range 16 { + v := archsimd.LoadUint8x16(src[row*ss:]) + v.Store(dst[row*ds:]) + } + return true +} diff --git a/internal/pixel/copy16_rows_arm64.go b/internal/pixel/copy16_rows_arm64.go new file mode 100644 index 0000000..5dd31c0 --- /dev/null +++ b/internal/pixel/copy16_rows_arm64.go @@ -0,0 +1,37 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/copy16_rows_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import "simd/archsimd" + +// Copy16Rows follows libvpx v1.16.0 vp8/common/reconinter.c row order. +// A whole row is loaded before its store, preserving per-row memmove aliases. +func Copy16Rows(src []byte, ss int, dst []byte, ds int) bool { + if !Enabled || (uint(ss)|uint(ds))>>30 != 0 || 15*ss+16 > len(src) || 15*ds+16 > len(dst) { + return false + } + _ = src[15*ss+15] + _ = dst[15*ds+15] + so, do := 0, 0 + ss2, ss3, ss4 := 2*ss, 3*ss, 4*ss + ds2, ds3, ds4 := 2*ds, 3*ds, 4*ds + for range 4 { + archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])).StoreArray((*[16]byte)(dst[do : do+16])) + archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss : so+ss+16])).StoreArray((*[16]byte)(dst[do+ds : do+ds+16])) + archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss2 : so+ss2+16])).StoreArray((*[16]byte)(dst[do+ds2 : do+ds2+16])) + archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss3 : so+ss3+16])).StoreArray((*[16]byte)(dst[do+ds3 : do+ds3+16])) + so += ss4 + do += ds4 + } + return true +} diff --git a/internal/pixel/copy8_rows_amd64.go b/internal/pixel/copy8_rows_amd64.go new file mode 100644 index 0000000..9aae492 --- /dev/null +++ b/internal/pixel/copy8_rows_amd64.go @@ -0,0 +1,31 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/copy8_rows_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import "encoding/binary" + +// Copy8Rows preserves libvpx v1.16.0 vp8/common/reconinter.c row order. +// Exact eight-byte row dataflow is adapted from goav1 recon_gosimd.go. +// Each full row is loaded before its store, preserving per-row memmove aliases. +func Copy8Rows(src []byte, ss int, dst []byte, ds int) bool { + if !Enabled || (uint(ss)|uint(ds))>>30 != 0 || 7*ss+8 > len(src) || 7*ds+8 > len(dst) { + return false + } + if &src[0] != &dst[0] || ss != ds { + for row := range 8 { + v := binary.LittleEndian.Uint64(src[row*ss:]) + binary.LittleEndian.PutUint64(dst[row*ds:], v) + } + } + return true +} diff --git a/internal/pixel/copy8_rows_arm64.go b/internal/pixel/copy8_rows_arm64.go new file mode 100644 index 0000000..0273b50 --- /dev/null +++ b/internal/pixel/copy8_rows_arm64.go @@ -0,0 +1,31 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/copy8_rows_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import "encoding/binary" + +// Copy8Rows preserves libvpx v1.16.0 vp8/common/reconinter.c row order. +// Exact eight-byte row dataflow is adapted from goav1 recon_gosimd.go. +// Each full row is loaded before its store, preserving per-row memmove aliases. +func Copy8Rows(src []byte, ss int, dst []byte, ds int) bool { + if !Enabled || (uint(ss)|uint(ds))>>30 != 0 || 7*ss+8 > len(src) || 7*ds+8 > len(dst) { + return false + } + if &src[0] != &dst[0] || ss != ds { + for row := range 8 { + v := binary.LittleEndian.Uint64(src[row*ss:]) + binary.LittleEndian.PutUint64(dst[row*ds:], v) + } + } + return true +} diff --git a/internal/pixel/copy_block_simd.go b/internal/pixel/copy_block_simd.go new file mode 100644 index 0000000..3598ff2 --- /dev/null +++ b/internal/pixel/copy_block_simd.go @@ -0,0 +1,197 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/copy_block_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// CopyBlock copies a w x h byte block from src (stride ss) to dst (stride ds) +// using fixed-width register/SIMD loads and stores for standard VP8/VP9 block +// widths (4, 8, 16, 32, 64), avoiding per-row runtime.memmove call overhead. +func CopyBlock(src []byte, ss int, dst []byte, ds, w, h int) { + if w <= 0 || h <= 0 { + return + } + if ss >= 0 && ds >= 0 && (h-1)*ss+w <= len(src) && (h-1)*ds+w <= len(dst) { + _ = src[(h-1)*ss+w-1] + _ = dst[(h-1)*ds+w-1] + so, do := 0, 0 + switch w { + case 4: + for range h { + binary.LittleEndian.PutUint32(dst[do:], binary.LittleEndian.Uint32(src[so:])) + so += ss + do += ds + } + return + case 8: + ss2, ds2 := 2*ss, 2*ds + ss3, ds3 := 3*ss, 3*ds + ss4, ds4 := 4*ss, 4*ds + y := 0 + for ; y+3 < h; y += 4 { + v0 := *(*[8]byte)(src[so : so+8]) + v1 := *(*[8]byte)(src[so+ss : so+ss+8]) + v2 := *(*[8]byte)(src[so+ss2 : so+ss2+8]) + v3 := *(*[8]byte)(src[so+ss3 : so+ss3+8]) + *(*[8]byte)(dst[do : do+8]) = v0 + *(*[8]byte)(dst[do+ds : do+ds+8]) = v1 + *(*[8]byte)(dst[do+ds2 : do+ds2+8]) = v2 + *(*[8]byte)(dst[do+ds3 : do+ds3+8]) = v3 + so += ss4 + do += ds4 + } + for ; y < h; y++ { + *(*[8]byte)(dst[do : do+8]) = *(*[8]byte)(src[so : so+8]) + so += ss + do += ds + } + return + case 16: + ss2, ds2 := 2*ss, 2*ds + ss3, ds3 := 3*ss, 3*ds + ss4, ds4 := 4*ss, 4*ds + y := 0 + for ; y+3 < h; y += 4 { + v0 := *(*[16]byte)(src[so : so+16]) + v1 := *(*[16]byte)(src[so+ss : so+ss+16]) + v2 := *(*[16]byte)(src[so+ss2 : so+ss2+16]) + v3 := *(*[16]byte)(src[so+ss3 : so+ss3+16]) + *(*[16]byte)(dst[do : do+16]) = v0 + *(*[16]byte)(dst[do+ds : do+ds+16]) = v1 + *(*[16]byte)(dst[do+ds2 : do+ds2+16]) = v2 + *(*[16]byte)(dst[do+ds3 : do+ds3+16]) = v3 + so += ss4 + do += ds4 + } + for ; y < h; y++ { + *(*[16]byte)(dst[do : do+16]) = *(*[16]byte)(src[so : so+16]) + so += ss + do += ds + } + return + case 32: + ss2, ds2 := 2*ss, 2*ds + ss3, ds3 := 3*ss, 3*ds + ss4, ds4 := 4*ss, 4*ds + y := 0 + for ; y+3 < h; y += 4 { + *(*[32]byte)(dst[do : do+32]) = *(*[32]byte)(src[so : so+32]) + *(*[32]byte)(dst[do+ds : do+ds+32]) = *(*[32]byte)(src[so+ss : so+ss+32]) + *(*[32]byte)(dst[do+ds2 : do+ds2+32]) = *(*[32]byte)(src[so+ss2 : so+ss2+32]) + *(*[32]byte)(dst[do+ds3 : do+ds3+32]) = *(*[32]byte)(src[so+ss3 : so+ss3+32]) + so += ss4 + do += ds4 + } + for ; y < h; y++ { + *(*[32]byte)(dst[do : do+32]) = *(*[32]byte)(src[so : so+32]) + so += ss + do += ds + } + return + case 64: + ss2, ds2 := 2*ss, 2*ds + y := 0 + for ; y+1 < h; y += 2 { + *(*[64]byte)(dst[do : do+64]) = *(*[64]byte)(src[so : so+64]) + *(*[64]byte)(dst[do+ds : do+ds+64]) = *(*[64]byte)(src[so+ss : so+ss+64]) + so += ss2 + do += ds2 + } + for ; y < h; y++ { + *(*[64]byte)(dst[do : do+64]) = *(*[64]byte)(src[so : so+64]) + so += ss + do += ds + } + return + } + } + for y := range h { + copy(dst[y*ds:y*ds+w], src[y*ss:y*ss+w]) + } +} + +// ExtendPlaneBorder replicates the four visible edges of a plane into its +// surrounding border using SIMD 16-byte stores for left/right margins (16 or 32 +// bytes) and row copies for top/bottom margins. +func ExtendPlaneBorder(full []byte, origin, stride, width, height, borderX, borderY int) bool { + if len(full) == 0 || stride <= 0 || width <= 0 || height <= 0 || borderX <= 0 || borderY <= 0 { + return false + } + if borderX > stride/2 || width > stride-2*borderX { + return false + } + if origin < borderX || borderY > (origin-borderX)/stride { + return false + } + tail := len(full) - origin + if width+borderX > tail { + return false + } + maxRows := (tail - width - borderX) / stride + if height-1 > maxRows || borderY > maxRows-(height-1) { + return false + } + switch borderX { + case 32: + rowStart := origin + for range height { + row := full[rowStart-32 : rowStart+width+32] + lf := archsimd.BroadcastUint8x16(row[32]) + lf.StoreArray((*[16]byte)(row[0:16])) + lf.StoreArray((*[16]byte)(row[16:32])) + rf := archsimd.BroadcastUint8x16(row[width+31]) + rf.StoreArray((*[16]byte)(row[width+32 : width+48])) + rf.StoreArray((*[16]byte)(row[width+48 : width+64])) + rowStart += stride + } + case 16: + rowStart := origin + for range height { + row := full[rowStart-16 : rowStart+width+16] + archsimd.BroadcastUint8x16(row[16]).StoreArray((*[16]byte)(row[0:16])) + archsimd.BroadcastUint8x16(row[width+15]).StoreArray((*[16]byte)(row[width+16 : width+32])) + rowStart += stride + } + default: + rowStart := origin + for range height { + leftFill := full[rowStart] + leftDst := full[rowStart-borderX : rowStart] + for i := range leftDst { + leftDst[i] = leftFill + } + rightFill := full[rowStart+width-1] + rightDst := full[rowStart+width : rowStart+width+borderX] + for i := range rightDst { + rightDst[i] = rightFill + } + rowStart += stride + } + } + span := width + 2*borderX + topSrc := full[origin-borderX : origin-borderX+span] + for y := borderY; y >= 1; y-- { + dstStart := origin - y*stride - borderX + copy(full[dstStart:dstStart+span], topSrc) + } + botOrigin := origin + (height-1)*stride + botSrc := full[botOrigin-borderX : botOrigin-borderX+span] + for y := 1; y <= borderY; y++ { + dstStart := botOrigin + y*stride - borderX + copy(full[dstStart:dstStart+span], botSrc) + } + return true +} diff --git a/internal/pixel/dc_pair_native_amd64.go b/internal/pixel/dc_pair_native_amd64.go new file mode 100644 index 0000000..f6bec05 --- /dev/null +++ b/internal/pixel/dc_pair_native_amd64.go @@ -0,0 +1,119 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/dc_pair_native_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// DCPairInPlaceInt32Native retains the one-window ABI and exact fallback +// while computing rounded DC coefficients and byte clipping with SIMD. +func DCPairInPlaceInt32Native(c0, c1 int32, b []byte, stride int) { + if !Enabled { + dcPairNativeScalar(c0, c1, b, stride, b, stride) + return + } + if stride >= 8 && len(b) >= 8 && stride <= (len(b)-8)/3 { + plus, minus := dcPairCoeffBytes(c0, c1) + dcPairByteRows2(b, stride, b, stride, plus, minus) + b2 := b[2*stride:] + dcPairByteRows2(b2, stride, b2, stride, plus, minus) + return + } + d0, d1 := dcPairNativeDelta(c0), dcPairNativeDelta(c1) + // Exact original enabled fallback: complete block0 before slicing block1, + // and evaluate destination before capturing each four-byte prediction. + for block := range 2 { + p, d, delta := b, b, d0 + if block != 0 { + p = b[4:] + d = b[4:] + delta = d1 + } + v := archsimd.BroadcastInt32x4(int32(delta)) + for y := range 4 { + StorePixels4(d[y*stride:], LoadPixels4(p[y*stride:]).Add(v)) + } + } +} + +// Rounding uses wrapping int32 vector addition before the arithmetic shift. +// Each lane has only a positive or negative clipped correction. The byte +// shuffle repeats four copies of DC0 and DC1 in each eight-byte row packet. +var dcPairCoeffByteIndices = [16]int8{0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4} + +func dcPairCoeffBytes(c0, c1 int32) (archsimd.Uint8x16, archsimd.Uint8x16) { + d := archsimd.Int32x4{}.SetElem(0, c0).SetElem(1, c1).Add(archsimd.BroadcastInt32x4(4)).ShiftAllRight(3) + zero := archsimd.LoadInt16x8Array(&packZero16).ToBits().ReshapeToUint32s().BitsToInt32() + maxByte := archsimd.BroadcastInt32x4(255) + indices := archsimd.LoadInt8x16Array(&dcPairCoeffByteIndices) + plus := d.Max(zero).Min(maxByte).ToBits().ReshapeToUint8s().PermuteOrZero(indices) + minus := zero.Sub(d).Max(zero).Min(maxByte).ToBits().ReshapeToUint8s().PermuteOrZero(indices) + return plus, minus +} + +// Both exact eight-byte rows are captured before the two ordered stores. +// Callers prove complete windows and exact aliasing or mutually disjoint views. +func dcPairByteRows2(src []byte, ps int, out []byte, ds int, plus, minus archsimd.Uint8x16) { + v := (archsimd.Uint64x2{}).SetElem(0, binary.LittleEndian.Uint64(src)).SetElem(1, binary.LittleEndian.Uint64(src[ps:])).ReshapeToUint8s() + v = v.AddSaturated(plus).SubSaturated(minus) + words := v.ReshapeToUint64s() + binary.LittleEndian.PutUint64(out, words.GetElem(0)) + binary.LittleEndian.PutUint64(out[ds:], words.GetElem(1)) +} + +// DCPairNative selects a single arithmetic owner for paired DC reconstruction. +// Complete x64 windows use byte SIMD; fallback access order stays unchanged. +const DCPairNative = true + +// DCPairInt32Native owns rounding, byte arithmetic and fallback, so a public +// caller need not keep ten arguments live across a boolean helper call. +func DCPairInt32Native(c0, c1 int32, pred []byte, ps int, dst []byte, ds int) { + if !Enabled { + dcPairNativeScalar(c0, c1, pred, ps, dst, ds) + return + } +fast: + for { + if ps < 8 || ds < 8 || len(pred) < 8 || len(dst) < 8 || ps > (len(pred)-8)/3 || ds > (len(dst)-8)/3 { + break fast + } + if &pred[0] == &dst[0] { + if ps != ds { + break fast + } + } else if slicesOverlapExact(pred, dst, len(pred), len(dst)) { + break fast + } + plus, minus := dcPairCoeffBytes(c0, c1) + dcPairByteRows2(pred, ps, dst, ds, plus, minus) + dcPairByteRows2(pred[2*ps:], ps, dst[2*ds:], ds, plus, minus) + return + } + d0, d1 := dcPairNativeDelta(c0), dcPairNativeDelta(c1) + // Exact enabled fallback: block0 is complete before slicing block1. + // Capture each four-byte prediction before its store as AddConstant does. + for block := range 2 { + p, d, delta := pred, dst, d0 + if block != 0 { + p = pred[4:] + d = dst[4:] + delta = d1 + } + v := archsimd.BroadcastInt32x4(int32(delta)) + for y := range 4 { + StorePixels4(d[y*ds:], LoadPixels4(p[y*ps:]).Add(v)) + } + } +} diff --git a/internal/pixel/dc_pair_native_arm64.go b/internal/pixel/dc_pair_native_arm64.go new file mode 100644 index 0000000..f789a62 --- /dev/null +++ b/internal/pixel/dc_pair_native_arm64.go @@ -0,0 +1,176 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/dc_pair_native_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// DCPairInPlaceInt32Native specializes libvpx v1.16.0's idct_dequant_0_2x_neon +// for one prediction/destination window, retaining every fallback access order. +func DCPairInPlaceInt32Native(c0, c1 int32, b []byte, stride int) { + if !Enabled { + dcPairNativeScalar(c0, c1, b, stride, b, stride) + return + } + d0, d1 := dcPairNativeDelta(c0), dcPairNativeDelta(c1) + if stride >= 8 && len(b) >= 8 && stride <= (len(b)-8)/3 { + if d0 == 0 && d1 == 0 { + return + } + _ = b[3*stride+7] + b2 := b[2*stride:] + if d0 >= 0 && d1 >= 0 { + addV := dcPairByteMask(uint8(d0), uint8(d1)) + v0 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(b), binary.LittleEndian.Uint64(b[stride:])}).ReshapeToUint8s().AddSaturated(addV).ReshapeToUint64s() + v1 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(b2), binary.LittleEndian.Uint64(b2[stride:])}).ReshapeToUint8s().AddSaturated(addV).ReshapeToUint64s() + binary.LittleEndian.PutUint64(b, v0.GetElem(0)) + binary.LittleEndian.PutUint64(b[stride:], v0.GetElem(1)) + binary.LittleEndian.PutUint64(b2, v1.GetElem(0)) + binary.LittleEndian.PutUint64(b2[stride:], v1.GetElem(1)) + return + } + if d0 <= 0 && d1 <= 0 { + subV := dcPairByteMask(uint8(-d0), uint8(-d1)) + v0 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(b), binary.LittleEndian.Uint64(b[stride:])}).ReshapeToUint8s().SubSaturated(subV).ReshapeToUint64s() + v1 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(b2), binary.LittleEndian.Uint64(b2[stride:])}).ReshapeToUint8s().SubSaturated(subV).ReshapeToUint64s() + binary.LittleEndian.PutUint64(b, v0.GetElem(0)) + binary.LittleEndian.PutUint64(b[stride:], v0.GetElem(1)) + binary.LittleEndian.PutUint64(b2, v1.GetElem(0)) + binary.LittleEndian.PutUint64(b2[stride:], v1.GetElem(1)) + return + } + var a0, a1, s0, s1 uint8 + if d0 > 0 { + a0 = uint8(d0) + s1 = uint8(-d1) + } else { + s0 = uint8(-d0) + a1 = uint8(d1) + } + addV, subV := dcPairByteMask(a0, a1), dcPairByteMask(s0, s1) + v0 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(b), binary.LittleEndian.Uint64(b[stride:])}).ReshapeToUint8s().AddSaturated(addV).SubSaturated(subV).ReshapeToUint64s() + v1 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(b2), binary.LittleEndian.Uint64(b2[stride:])}).ReshapeToUint8s().AddSaturated(addV).SubSaturated(subV).ReshapeToUint64s() + binary.LittleEndian.PutUint64(b, v0.GetElem(0)) + binary.LittleEndian.PutUint64(b[stride:], v0.GetElem(1)) + binary.LittleEndian.PutUint64(b2, v1.GetElem(0)) + binary.LittleEndian.PutUint64(b2[stride:], v1.GetElem(1)) + return + } + // Exact original enabled fallback: complete block0 before slicing block1, + // and evaluate destination before capturing each four-byte prediction. + for block := range 2 { + p, d, delta := b, b, d0 + if block != 0 { + p = b[4:] + d = b[4:] + delta = d1 + } + v := archsimd.BroadcastInt32x4(int32(delta)) + for y := range 4 { + StorePixels4(d[y*stride:], LoadPixels4(p[y*stride:]).Add(v)) + } + } +} + +func dcPairByteMask(b0, b1 uint8) archsimd.Uint8x16 { + w0 := uint32(b0) * 0x01010101 + w1 := uint32(b1) * 0x01010101 + q := uint64(w0) | (uint64(w1) << 32) + return archsimd.BroadcastUint64x2(q).ReshapeToUint8s() +} + +// Saturating the rounded coefficients to int16 is sufficient when the pixel +// addition also saturates: any larger-magnitude delta already clips every +// possible byte result. Scalar rounding deliberately wraps at int32 first. +func dcPairSignedCoeff8(c0, c1 int32) archsimd.Int16x8 { + d := archsimd.Int32x4{}.SetElem(0, (c0+4)>>3).SetElem(1, (c1+4)>>3).SaturateToInt16() + d = d.InterleaveLo(d) + return d.InterleaveLo(d) +} + +// Callers prove both exact eight-byte windows and preserve the original +// two-row read packet before its two ordered stores. Saturating signed sums +// preserve the final byte clipping for every rounded int32 coefficient. +func dcPairSignedRows2(src []byte, ps int, out []byte, ds int, delta archsimd.Int16x8) { + lo := binary.LittleEndian.Uint64(src) + hi := binary.LittleEndian.Uint64(src[ps:]) + l := (archsimd.Uint64x2{}).SetElem(0, lo).ReshapeToUint8s().ExtendLo8ToUint16().BitsToInt16().AddSaturated(delta).SaturateToUint8().ReshapeToUint64s() + h := (archsimd.Uint64x2{}).SetElem(0, hi).ReshapeToUint8s().ExtendLo8ToUint16().BitsToInt16().AddSaturated(delta).SaturateToUint8().ReshapeToUint64s() + binary.LittleEndian.PutUint64(out, l.GetElem(0)) + binary.LittleEndian.PutUint64(out[ds:], h.GetElem(0)) +} + +// DCPairNative selects the single-owner ARM implementation of libvpx +// v1.16.0 idct_dequant_0_2x_neon, retaining the original signed product math. +const DCPairNative = true + +// DCPairInt32Native owns rounding, byte arithmetic and fallback, so a public +// caller need not keep ten arguments live across a boolean helper call. +func DCPairInt32Native(c0, c1 int32, pred []byte, ps int, dst []byte, ds int) { + if !Enabled { + dcPairNativeScalar(c0, c1, pred, ps, dst, ds) + return + } +fast: + for { + if ps < 8 || ds < 8 || len(pred) < 8 || len(dst) < 8 || ps > (len(pred)-8)/3 || ds > (len(dst)-8)/3 { + break fast + } + if &pred[0] == &dst[0] { + if ps != ds { + break fast + } + } else if slicesOverlapExact(pred, dst, len(pred), len(dst)) { + break fast + } + delta := dcPairSignedCoeff8(c0, c1) + dcPairSignedRows2(pred, ps, dst, ds, delta) + dcPairSignedRows2(pred[2*ps:], ps, dst[2*ds:], ds, delta) + return + } + d0, d1 := dcPairNativeDelta(c0), dcPairNativeDelta(c1) + // Exact enabled fallback: block0 is complete before slicing block1. + // Capture each four-byte prediction before its store as AddConstant does. + for block := range 2 { + p, d, delta := pred, dst, d0 + if block != 0 { + p = pred[4:] + d = dst[4:] + delta = d1 + } + v := archsimd.BroadcastInt32x4(int32(delta)) + for y := range 4 { + StorePixels4(d[y*ds:], LoadPixels4(p[y*ps:]).Add(v)) + } + } +} + +// AddConstantPair4 retains its direct boolean no-read/no-write decline API. +// Valid calls delegate to the same native arithmetic owner; d<<3 rounds +// exactly back to d because accepted signed deltas lie in [-255,255]. +func AddConstantPair4(pred []byte, ps int, dst []byte, ds int, d0, d1 int16) bool { + if !Enabled || ps < 8 || ds < 8 || len(pred) < 8 || len(dst) < 8 || ps > (len(pred)-8)/3 || ds > (len(dst)-8)/3 || d0 < -255 || d0 > 255 || d1 < -255 || d1 > 255 { + return false + } + if &pred[0] == &dst[0] { + if ps != ds { + return false + } + } else if slicesOverlapExact(pred, dst, len(pred), len(dst)) { + return false + } + DCPairInt32Native(int32(d0)<<3, int32(d1)<<3, pred, ps, dst, ds) + return true +} diff --git a/internal/pixel/dc_pair_native_fallback.go b/internal/pixel/dc_pair_native_fallback.go new file mode 100644 index 0000000..3db9af7 --- /dev/null +++ b/internal/pixel/dc_pair_native_fallback.go @@ -0,0 +1,41 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/dc_pair_native_fallback.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package pixel + +// Keep libvpx v1.16.0 idct_dequant_0_2x_neon's int32 product rounding: +// input+4 wraps in int32 before the arithmetic shift, then clips the delta. +func dcPairNativeDelta(input int32) int16 { + v := int((input + 4) >> 3) + if v > 255 { + v = 255 + } else if v < -255 { + v = -255 + } + return int16(v) +} + +// dcPairNativeScalar retains the disabled DSP's row prechecks and block order. +// It is distinct from the generic pixel scalar per-pixel bounds behavior. +func dcPairNativeScalar(c0, c1 int32, pred []byte, ps int, dst []byte, ds int) { + d0, d1 := dcPairNativeDelta(c0), dcPairNativeDelta(c1) + dcPairNativeScalarBlock(int(d0), pred, ps, dst, ds) + dcPairNativeScalarBlock(int(d1), pred[4:], ps, dst[4:], ds) +} +func dcPairNativeScalarBlock(delta int, pred []byte, ps int, dst []byte, ds int) { + for y := range 4 { + d := dst[y*ds : y*ds+4 : y*ds+4] + p := pred[y*ps : y*ps+4 : y*ps+4] + d[0] = byte(min(max(delta+int(p[0]), 0), 255)) + d[1] = byte(min(max(delta+int(p[1]), 0), 255)) + d[2] = byte(min(max(delta+int(p[2]), 0), 255)) + d[3] = byte(min(max(delta+int(p[3]), 0), 255)) + } +} diff --git a/internal/pixel/dc_pair_simd.go b/internal/pixel/dc_pair_simd.go new file mode 100644 index 0000000..13c3b10 --- /dev/null +++ b/internal/pixel/dc_pair_simd.go @@ -0,0 +1,51 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/dc_pair_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// AddConstantPair4 adds independent clamped DC deltas to two adjacent 4x4 +// blocks using all sixteen byte lanes. Partial aliases retain block order in +// the caller; exact in-place layouts and disjoint buffers can run together. +func AddConstantPair4(pred []byte, ps int, dst []byte, ds int, d0, d1 int16) bool { + if !Enabled || ps < 8 || ds < 8 || len(pred) < 8 || len(dst) < 8 || ps > (len(pred)-8)/3 || ds > (len(dst)-8)/3 || d0 < -255 || d0 > 255 || d1 < -255 || d1 > 255 { + return false + } + if &pred[0] == &dst[0] { + if ps != ds { + return false + } + } else if slicesOverlapExact(pred, dst, len(pred), len(dst)) { + return false + } + + // Each byte lane has either a positive or a negative delta, never both. + // Unsigned saturation therefore clips exactly without widening pixels. + pattern := func(lo, hi int16) archsimd.Uint8x16 { + a, b := uint32(byte(lo))*0x01010101, uint32(byte(hi))*0x01010101 + return archsimd.BroadcastUint64x2(uint64(a) | uint64(b)<<32).ReshapeToUint8s() + } + plus := pattern(max(d0, 0), max(d1, 0)) + minus := pattern(max(-d0, 0), max(-d1, 0)) + rows := func(y int) { + v := packRows8(pred, y*ps, ps).AddSaturated(plus).SubSaturated(minus).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[y*ds:], v.GetElem(0)) + binary.LittleEndian.PutUint64(dst[(y+1)*ds:], v.GetElem(1)) + } + rows(0) + rows(2) + return true +} diff --git a/internal/pixel/enabled_amd64.go b/internal/pixel/enabled_amd64.go new file mode 100644 index 0000000..c6a7099 --- /dev/null +++ b/internal/pixel/enabled_amd64.go @@ -0,0 +1,28 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/enabled_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import "simd/archsimd" + +// Keep feature checks in the compiler's feature domain, as in goav1. +var Enabled = archsimd.X86.AVX2() + +// Native 649237be timing selects the general vertical internal-filter body +// on x64; ARM retains its measured exact-width store specialization. +const internalVerticalGeneric = true + +// Retain the independently measured x64 edge paths. +const internalFused = false + +const narrowPixelStats16 = true +const transposeLFColumns16 = false diff --git a/internal/pixel/enabled_arm64.go b/internal/pixel/enabled_arm64.go new file mode 100644 index 0000000..ee20acf --- /dev/null +++ b/internal/pixel/enabled_arm64.go @@ -0,0 +1,26 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/enabled_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +// ASIMD is mandatory on the arm64 platforms supported by Go. +const Enabled = true + +// Native 649237be timing selects the general vertical internal-filter body +// on x64; ARM retains its measured exact-width store specialization. +const internalVerticalGeneric = false + +// M4 measurements select three-edge row/column reuse. +const internalFused = true + +const narrowPixelStats16 = true +const transposeLFColumns16 = true diff --git a/internal/pixel/fill_fixed_arm64.go b/internal/pixel/fill_fixed_arm64.go new file mode 100644 index 0000000..5f24d61 --- /dev/null +++ b/internal/pixel/fill_fixed_arm64.go @@ -0,0 +1,15 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/fill_fixed_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +const fillFixedRows = true diff --git a/internal/pixel/filter_arm64.go b/internal/pixel/filter_arm64.go new file mode 100644 index 0000000..a00d907 --- /dev/null +++ b/internal/pixel/filter_arm64.go @@ -0,0 +1,675 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/filter_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// filterWide8 implements ARM64 NEON 8-tap and 2-tap subpixel convolution using +// unsigned widening multiplies (UMULL / MulWidenLo) and URHADD (Average). +// +// For all standard VP9 8-tap filters (regular, smooth, sharp, bilinear): +// - Positive tap sum <= 192 => max positive product sum = 255*192 = 48960 < 65535 (fits uint16). +// - Negative tap sum <= 102 => max negative product sum = 255*102 = 26010 < 65535 (fits uint16). +// - (pos + 64) <= 49024 < 65535, so SubSaturated(neg) produces 0 whenever the +// signed rounded result would clip to 0, and exact (pos - neg + 64) otherwise. +// - Shifting right by 7 and SaturateToUint8 yields bit-exact clipPixel((sum+64)>>7). +func filterWide8(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) bool { + if len(taps) != 8 || w <= 0 || w%8 != 0 || h <= 0 || ss < 0 || ds < 0 || step < 0 { + return false + } + if step != 1 && step != ss { + return false + } + _ = src[(h-1)*ss+w-1+7*step] + _ = dst[(h-1)*ds+w-1] + + // Fast path: 2-tap bilinear filter embedded in 8-tap table ([0,0,0,t3,t4,0,0,0]). + if (taps[0]|taps[1]|taps[2]|taps[5]|taps[6]|taps[7]) == 0 && + taps[3] >= 0 && taps[4] >= 0 && int(taps[3])+int(taps[4]) <= 128 { + return filterBilinear8ARM64(src[3*step:], ss, dst, ds, w, h, step, uint8(taps[3]), uint8(taps[4])) + } + + mode := narrow8Mode(taps) + if mode == 0 { + return false + } + + // Verify unsigned positive/negative sums fit uint16 with +64 bias. + var posSum, negSum int + for _, t := range taps { + if t >= 0 { + posSum += int(t) + } else { + negSum -= int(t) + } + } + if posSum*255+64 > 65535 || negSum*255 > 65535 { + return false + } + + if step == ss { + return filterVert8ARM64(src, ss, dst, ds, w, h, taps, mode) + } + return filterHoriz8ARM64(src, ss, dst, ds, w, h, taps, mode) +} + +func filterLinearFast(src []byte, ss int, dst []byte, ds, w, h, step int, t0, t1 uint8) bool { + return filterBilinear8ARM64(src, ss, dst, ds, w, h, step, t0, t1) +} + +// FilterHalfPelDisjoint computes (src[i]+src[i+step]+1)>>1 for disjoint +// src/dst planes directly via the ARM64 NEON half-pel kernel, skipping the +// generic slicesOverlap and 2-tap dispatch in FilterBilinear. +func FilterHalfPelDisjoint(src []byte, ss int, dst []byte, ds, w, h, step int) { + if !filterBilinear8ARM64(src, ss, dst, ds, w, h, step, 64, 64) { + FilterBilinear(src, ss, dst, ds, w, h, step, 64, 64) + } +} + +func filterBilinear8ARM64(src []byte, ss int, dst []byte, ds, w, h, step int, t0, t1 uint8) bool { + if w <= 0 || h <= 0 || ss < 0 || ds < 0 || step < 0 { + return false + } + _ = src[(h-1)*ss+w-1+step] + _ = dst[(h-1)*ds+w-1] + // Half-pel (64, 64): single NEON URHADD instruction per 16 pixels. + if t0 == 64 && t1 == 64 { + if step == 1 { + if w == 4 { + so, do := 0, 0 + y := 0 + for ; y+3 < h; y += 4 { + s0, s1, s2, s3 := src[so:], src[so+ss:], src[so+2*ss:], src[so+3*ss:] + a := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s0), + binary.LittleEndian.Uint32(s1), + binary.LittleEndian.Uint32(s2), + binary.LittleEndian.Uint32(s3), + }).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s0[1:]), + binary.LittleEndian.Uint32(s1[1:]), + binary.LittleEndian.Uint32(s2[1:]), + binary.LittleEndian.Uint32(s3[1:]), + }).ReshapeToUint8s() + out := a.Average(b).ReshapeToUint32s() + binary.LittleEndian.PutUint32(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint32(dst[do+ds:], out.GetElem(1)) + binary.LittleEndian.PutUint32(dst[do+2*ds:], out.GetElem(2)) + binary.LittleEndian.PutUint32(dst[do+3*ds:], out.GetElem(3)) + so += 4 * ss + do += 4 * ds + } + for ; y < h; y++ { + a := archsimd.LoadUint32x4Array(&[4]uint32{binary.LittleEndian.Uint32(src[so:])}).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{binary.LittleEndian.Uint32(src[so+1:])}).ReshapeToUint8s() + binary.LittleEndian.PutUint32(dst[do:], a.Average(b).ReshapeToUint32s().GetElem(0)) + so += ss + do += ds + } + return true + } + if w == 8 { + so, do := 0, 0 + y := 0 + for ; y+1 < h; y += 2 { + s0, s1 := src[so:], src[so+ss:] + a := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(s0), binary.LittleEndian.Uint64(s1)}).ReshapeToUint8s() + b := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(s0[1:]), binary.LittleEndian.Uint64(s1[1:])}).ReshapeToUint8s() + out := a.Average(b).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint64(dst[do+ds:], out.GetElem(1)) + so += 2 * ss + do += 2 * ds + } + if y < h { + a, b := load8(src[so:]), load8(src[so+1:]) + storeBytes8(dst[do:], a.Average(b)) + } + return true + } + if w == 16 { + so, do := 0, 0 + y := 0 + for ; y+1 < h; y += 2 { + r0 := src[so : so+17] + r1 := src[so+ss : so+ss+17] + archsimd.LoadUint8x16Array((*[16]byte)(r0[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(r0[1:17]))).StoreArray((*[16]byte)(dst[do : do+16])) + archsimd.LoadUint8x16Array((*[16]byte)(r1[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(r1[1:17]))).StoreArray((*[16]byte)(dst[do+ds : do+ds+16])) + so += 2 * ss + do += 2 * ds + } + if y < h { + row := src[so : so+17] + archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(row[1:17]))).StoreArray((*[16]byte)(dst[do : do+16])) + } + return true + } + so, do := 0, 0 + for range h { + x := 0 + for ; x+16 <= w; x += 16 { + row := src[so+x : so+x+17] + archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(row[1:17]))).StoreArray((*[16]byte)(dst[do+x : do+x+16])) + } + if x < w { + a, b := load8(src[so+x:]), load8(src[so+x+1:]) + storeBytes8(dst[do+x:], a.Average(b)) + } + so += ss + do += ds + } + return true + } + // Vertical half-pel. + if w == 4 { + r0 := binary.LittleEndian.Uint32(src) + so, do := ss, 0 + y := 0 + for ; y+3 < h; y += 4 { + r1 := binary.LittleEndian.Uint32(src[so:]) + r2 := binary.LittleEndian.Uint32(src[so+ss:]) + r3 := binary.LittleEndian.Uint32(src[so+2*ss:]) + r4 := binary.LittleEndian.Uint32(src[so+3*ss:]) + a := archsimd.LoadUint32x4Array(&[4]uint32{r0, r1, r2, r3}).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{r1, r2, r3, r4}).ReshapeToUint8s() + out := a.Average(b).ReshapeToUint32s() + binary.LittleEndian.PutUint32(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint32(dst[do+ds:], out.GetElem(1)) + binary.LittleEndian.PutUint32(dst[do+2*ds:], out.GetElem(2)) + binary.LittleEndian.PutUint32(dst[do+3*ds:], out.GetElem(3)) + r0 = r4 + so += 4 * ss + do += 4 * ds + } + for ; y < h; y++ { + r1 := binary.LittleEndian.Uint32(src[so:]) + a := archsimd.LoadUint32x4Array(&[4]uint32{r0}).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{r1}).ReshapeToUint8s() + binary.LittleEndian.PutUint32(dst[do:], a.Average(b).ReshapeToUint32s().GetElem(0)) + r0 = r1 + so += ss + do += ds + } + return true + } + if w == 8 { + r0 := binary.LittleEndian.Uint64(src) + so, do := ss, 0 + y := 0 + for ; y+1 < h; y += 2 { + r1 := binary.LittleEndian.Uint64(src[so:]) + r2 := binary.LittleEndian.Uint64(src[so+ss:]) + a := archsimd.LoadUint64x2Array(&[2]uint64{r0, r1}).ReshapeToUint8s() + b := archsimd.LoadUint64x2Array(&[2]uint64{r1, r2}).ReshapeToUint8s() + out := a.Average(b).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint64(dst[do+ds:], out.GetElem(1)) + r0 = r2 + so += 2 * ss + do += 2 * ds + } + if y < h { + a, b := load8(src[so-ss:]), load8(src[so:]) + storeBytes8(dst[do:], a.Average(b)) + } + return true + } + if w == 16 { + a := archsimd.LoadUint8x16Array((*[16]byte)(src[0:16])) + ss2, ds2 := 2*ss, 2*ds + ss3, ds3 := 3*ss, 3*ds + ss4, ds4 := 4*ss, 4*ds + so, do := ss, 0 + y := 0 + for ; y+3 < h; y += 4 { + b := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + c := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss : so+ss+16])) + d := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss2 : so+ss2+16])) + e := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss3 : so+ss3+16])) + a.Average(b).StoreArray((*[16]byte)(dst[do : do+16])) + b.Average(c).StoreArray((*[16]byte)(dst[do+ds : do+ds+16])) + c.Average(d).StoreArray((*[16]byte)(dst[do+ds2 : do+ds2+16])) + d.Average(e).StoreArray((*[16]byte)(dst[do+ds3 : do+ds3+16])) + a = e + so += ss4 + do += ds4 + } + for ; y < h; y++ { + b := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + a.Average(b).StoreArray((*[16]byte)(dst[do : do+16])) + a = b + so += ss + do += ds + } + return true + } + if w == 32 { + a0 := archsimd.LoadUint8x16Array((*[16]byte)(src[0:16])) + a1 := archsimd.LoadUint8x16Array((*[16]byte)(src[16:32])) + ss2, ds2 := 2*ss, 2*ds + so, do := ss, 0 + y := 0 + for ; y+1 < h; y += 2 { + b0 := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + b1 := archsimd.LoadUint8x16Array((*[16]byte)(src[so+16 : so+32])) + c0 := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss : so+ss+16])) + c1 := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss+16 : so+ss+32])) + a0.Average(b0).StoreArray((*[16]byte)(dst[do : do+16])) + a1.Average(b1).StoreArray((*[16]byte)(dst[do+16 : do+32])) + b0.Average(c0).StoreArray((*[16]byte)(dst[do+ds : do+ds+16])) + b1.Average(c1).StoreArray((*[16]byte)(dst[do+ds+16 : do+ds+32])) + a0, a1 = c0, c1 + so += ss2 + do += ds2 + } + if y < h { + b0 := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + b1 := archsimd.LoadUint8x16Array((*[16]byte)(src[so+16 : so+32])) + a0.Average(b0).StoreArray((*[16]byte)(dst[do : do+16])) + a1.Average(b1).StoreArray((*[16]byte)(dst[do+16 : do+32])) + } + return true + } + for x := 0; x < w; { + if x+16 <= w { + a := archsimd.LoadUint8x16Array((*[16]byte)(src[x : x+16])) + so, do := ss+x, x + for range h { + b := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + a.Average(b).StoreArray((*[16]byte)(dst[do : do+16])) + a = b + so += ss + do += ds + } + x += 16 + } else { + a := load8(src[x:]) + so, do := ss+x, x + for range h { + b := load8(src[so:]) + storeBytes8(dst[do:], a.Average(b)) + a = b + so += ss + do += ds + } + x += 8 + } + } + return true + } + + // General 2-tap non-negative bilinear using UMULL (MulWidenLo). + c0, c1 := archsimd.BroadcastUint8x16(t0), archsimd.BroadcastUint8x16(t1) + bias := archsimd.BroadcastUint16x8(64) + if step == 1 { + if w == 4 { + so, do := 0, 0 + y := 0 + for ; y+3 < h; y += 4 { + s0, s1, s2, s3 := src[so:], src[so+ss:], src[so+2*ss:], src[so+3*ss:] + a := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s0), + binary.LittleEndian.Uint32(s1), + binary.LittleEndian.Uint32(s2), + binary.LittleEndian.Uint32(s3), + }).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s0[1:]), + binary.LittleEndian.Uint32(s1[1:]), + binary.LittleEndian.Uint32(s2[1:]), + binary.LittleEndian.Uint32(s3[1:]), + }).ReshapeToUint8s() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := a.HiToLo().MulWidenLo(c0).Add(b.HiToLo().MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + out := lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).ReshapeToUint32s() + binary.LittleEndian.PutUint32(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint32(dst[do+ds:], out.GetElem(1)) + binary.LittleEndian.PutUint32(dst[do+2*ds:], out.GetElem(2)) + binary.LittleEndian.PutUint32(dst[do+3*ds:], out.GetElem(3)) + so += 4 * ss + do += 4 * ds + } + for ; y < h; y++ { + a := archsimd.LoadUint32x4Array(&[4]uint32{binary.LittleEndian.Uint32(src[so:])}).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{binary.LittleEndian.Uint32(src[so+1:])}).ReshapeToUint8s() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + binary.LittleEndian.PutUint32(dst[do:], lo.TruncToUint8().ReshapeToUint32s().GetElem(0)) + so += ss + do += ds + } + return true + } + if w == 8 { + so, do := 0, 0 + y := 0 + for ; y+1 < h; y += 2 { + s0, s1 := src[so:], src[so+ss:] + a := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(s0), binary.LittleEndian.Uint64(s1)}).ReshapeToUint8s() + b := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(s0[1:]), binary.LittleEndian.Uint64(s1[1:])}).ReshapeToUint8s() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := a.HiToLo().MulWidenLo(c0).Add(b.HiToLo().MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + out := lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint64(dst[do+ds:], out.GetElem(1)) + so += 2 * ss + do += 2 * ds + } + if y < h { + a, b := load8(src[so:]), load8(src[so+1:]) + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + storeBytes8(dst[do:], lo.TruncToUint8()) + } + return true + } + if w == 16 { + so, do := 0, 0 + for range h { + row := src[so : so+17] + a, b := archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(row[1:17])) + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := a.HiToLo().MulWidenLo(c0).Add(b.HiToLo().MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).StoreArray((*[16]byte)(dst[do : do+16])) + so += ss + do += ds + } + return true + } + so, do := 0, 0 + for range h { + x := 0 + for ; x+16 <= w; x += 16 { + row := src[so+x : so+x+17] + a, b := archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(row[1:17])) + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := a.HiToLo().MulWidenLo(c0).Add(b.HiToLo().MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).StoreArray((*[16]byte)(dst[do+x : do+x+16])) + } + if x < w { + a, b := load8(src[so+x:]), load8(src[so+x+1:]) + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + storeBytes8(dst[do+x:], lo.TruncToUint8()) + } + so += ss + do += ds + } + return true + } + if w == 4 { + r0 := binary.LittleEndian.Uint32(src) + so, do := ss, 0 + y := 0 + for ; y+3 < h; y += 4 { + r1 := binary.LittleEndian.Uint32(src[so:]) + r2 := binary.LittleEndian.Uint32(src[so+ss:]) + r3 := binary.LittleEndian.Uint32(src[so+2*ss:]) + r4 := binary.LittleEndian.Uint32(src[so+3*ss:]) + a := archsimd.LoadUint32x4Array(&[4]uint32{r0, r1, r2, r3}).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{r1, r2, r3, r4}).ReshapeToUint8s() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := a.HiToLo().MulWidenLo(c0).Add(b.HiToLo().MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + out := lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).ReshapeToUint32s() + binary.LittleEndian.PutUint32(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint32(dst[do+ds:], out.GetElem(1)) + binary.LittleEndian.PutUint32(dst[do+2*ds:], out.GetElem(2)) + binary.LittleEndian.PutUint32(dst[do+3*ds:], out.GetElem(3)) + r0 = r4 + so += 4 * ss + do += 4 * ds + } + for ; y < h; y++ { + r1 := binary.LittleEndian.Uint32(src[so:]) + a := archsimd.LoadUint32x4Array(&[4]uint32{r0}).ReshapeToUint8s() + b := archsimd.LoadUint32x4Array(&[4]uint32{r1}).ReshapeToUint8s() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + binary.LittleEndian.PutUint32(dst[do:], lo.TruncToUint8().ReshapeToUint32s().GetElem(0)) + r0 = r1 + so += ss + do += ds + } + return true + } + if w == 8 { + r0 := binary.LittleEndian.Uint64(src) + so, do := ss, 0 + y := 0 + for ; y+1 < h; y += 2 { + r1 := binary.LittleEndian.Uint64(src[so:]) + r2 := binary.LittleEndian.Uint64(src[so+ss:]) + a := archsimd.LoadUint64x2Array(&[2]uint64{r0, r1}).ReshapeToUint8s() + b := archsimd.LoadUint64x2Array(&[2]uint64{r1, r2}).ReshapeToUint8s() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := a.HiToLo().MulWidenLo(c0).Add(b.HiToLo().MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + out := lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[do:], out.GetElem(0)) + binary.LittleEndian.PutUint64(dst[do+ds:], out.GetElem(1)) + r0 = r2 + so += 2 * ss + do += 2 * ds + } + if y < h { + a, b := load8(src[so-ss:]), load8(src[so:]) + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + storeBytes8(dst[do:], lo.TruncToUint8()) + } + return true + } + if w == 16 { + a := archsimd.LoadUint8x16Array((*[16]byte)(src[0:16])) + ah := a.HiToLo() + so, do := ss, 0 + for range h { + b := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + bh := b.HiToLo() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := ah.MulWidenLo(c0).Add(bh.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).StoreArray((*[16]byte)(dst[do : do+16])) + a, ah = b, bh + so += ss + do += ds + } + return true + } + for x := 0; x < w; { + if x+16 <= w { + a := archsimd.LoadUint8x16Array((*[16]byte)(src[x : x+16])) + ah := a.HiToLo() + so, do := ss+x, x + for range h { + b := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + bh := b.HiToLo() + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + hi := ah.MulWidenLo(c0).Add(bh.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s()).StoreArray((*[16]byte)(dst[do : do+16])) + a, ah = b, bh + so += ss + do += ds + } + x += 16 + } else { + a := load8(src[x:]) + so, do := ss+x, x + for range h { + b := load8(src[so:]) + lo := a.MulWidenLo(c0).Add(b.MulWidenLo(c1)).Add(bias).ShiftAllRight(7) + storeBytes8(dst[do:], lo.TruncToUint8()) + a = b + so += ss + do += ds + } + x += 8 + } + } + return true +} + +func filterAbsU8(t int16) archsimd.Uint8x16 { + if t < 0 { + t = -t + } + return archsimd.BroadcastUint8x16(uint8(t)) +} + +// filterHoriz8ARM64 runs 8-tap horizontal convolution via uint8 MulWidenLo. +// For 16-wide chunks, two overlapping 16-byte loads feed ConcatShiftBytesRight +// to produce all 8 shifted tap vectors for 16 output pixels with zero widen8s. +func filterHoriz8ARM64(src []byte, ss int, dst []byte, ds, w, h int, taps []int16, mode int) bool { + c0, c1, c2, c3 := filterAbsU8(taps[0]), filterAbsU8(taps[1]), filterAbsU8(taps[2]), filterAbsU8(taps[3]) + c4, c5, c6, c7 := filterAbsU8(taps[4]), filterAbsU8(taps[5]), filterAbsU8(taps[6]), filterAbsU8(taps[7]) + bias := archsimd.BroadcastUint16x8(64) + + for y := range h { + so, do := y*ss, y*ds + x := 0 + for ; x+16 <= w; x += 16 { + row := src[so+x : so+x+23] + v0 := archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])) + v1 := archsimd.LoadUint8x16Array((*[16]byte)(row[1:17])) + v2 := archsimd.LoadUint8x16Array((*[16]byte)(row[2:18])) + v3 := archsimd.LoadUint8x16Array((*[16]byte)(row[3:19])) + v4 := archsimd.LoadUint8x16Array((*[16]byte)(row[4:20])) + v5 := archsimd.LoadUint8x16Array((*[16]byte)(row[5:21])) + v6 := archsimd.LoadUint8x16Array((*[16]byte)(row[6:22])) + v7 := archsimd.LoadUint8x16Array((*[16]byte)(row[7:23])) + + var posLo, negLo, posHi, negHi archsimd.Uint16x8 + if mode == 1 { + negLo = v0.MulWidenLo(c0).Add(v2.MulWidenLo(c2)).Add(v5.MulWidenLo(c5)).Add(v7.MulWidenLo(c7)) + posLo = bias.Add(v1.MulWidenLo(c1)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v6.MulWidenLo(c6)) + negHi = v0.HiToLo().MulWidenLo(c0).Add(v2.HiToLo().MulWidenLo(c2)).Add(v5.HiToLo().MulWidenLo(c5)).Add(v7.HiToLo().MulWidenLo(c7)) + posHi = bias.Add(v1.HiToLo().MulWidenLo(c1)).Add(v3.HiToLo().MulWidenLo(c3)).Add(v4.HiToLo().MulWidenLo(c4)).Add(v6.HiToLo().MulWidenLo(c6)) + } else { + negLo = v0.MulWidenLo(c0).Add(v1.MulWidenLo(c1)).Add(v6.MulWidenLo(c6)).Add(v7.MulWidenLo(c7)) + posLo = bias.Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v5.MulWidenLo(c5)) + negHi = v0.HiToLo().MulWidenLo(c0).Add(v1.HiToLo().MulWidenLo(c1)).Add(v6.HiToLo().MulWidenLo(c6)).Add(v7.HiToLo().MulWidenLo(c7)) + posHi = bias.Add(v2.HiToLo().MulWidenLo(c2)).Add(v3.HiToLo().MulWidenLo(c3)).Add(v4.HiToLo().MulWidenLo(c4)).Add(v5.HiToLo().MulWidenLo(c5)) + } + outLo := posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8() + outHi := posHi.SubSaturated(negHi).ShiftAllRight(7).SaturateToUint8() + outLo.ReshapeToUint64s().InterleaveLo(outHi.ReshapeToUint64s()).ReshapeToUint8s().Store(dst[do+x : do+x+16]) + } + if x < w { + p := src[so+x:] + var v0, v1, v2, v3, v4, v5, v6, v7 archsimd.Uint8x16 + if len(p) >= 16 { + v0 = archsimd.LoadUint8x16(p[:16]) + z := archsimd.Uint8x16{} + v1 = z.ConcatShiftBytesRight(v0, 1) + v2 = z.ConcatShiftBytesRight(v0, 2) + v3 = z.ConcatShiftBytesRight(v0, 3) + v4 = z.ConcatShiftBytesRight(v0, 4) + v5 = z.ConcatShiftBytesRight(v0, 5) + v6 = z.ConcatShiftBytesRight(v0, 6) + v7 = z.ConcatShiftBytesRight(v0, 7) + } else { + v0, v1, v2, v3 = load8(p), load8(p[1:]), load8(p[2:]), load8(p[3:]) + v4, v5, v6, v7 = load8(p[4:]), load8(p[5:]), load8(p[6:]), load8(p[7:]) + } + var posLo, negLo archsimd.Uint16x8 + if mode == 1 { + negLo = v0.MulWidenLo(c0).Add(v2.MulWidenLo(c2)).Add(v5.MulWidenLo(c5)).Add(v7.MulWidenLo(c7)) + posLo = bias.Add(v1.MulWidenLo(c1)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v6.MulWidenLo(c6)) + } else { + negLo = v0.MulWidenLo(c0).Add(v1.MulWidenLo(c1)).Add(v6.MulWidenLo(c6)).Add(v7.MulWidenLo(c7)) + posLo = bias.Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v5.MulWidenLo(c5)) + } + storeBytes8(dst[do+x:], posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8()) + } + } + return true +} + +// filterVert8ARM64 runs 8-tap vertical convolution via uint8 MulWidenLo. +// Keeping 7 Uint8x16 sliding rows in registers processes 16 columns at a time +// with one 16-byte load and one 16-byte store per output row. +func filterVert8ARM64(src []byte, ss int, dst []byte, ds, w, h int, taps []int16, mode int) bool { + c0, c1, c2, c3 := filterAbsU8(taps[0]), filterAbsU8(taps[1]), filterAbsU8(taps[2]), filterAbsU8(taps[3]) + c4, c5, c6, c7 := filterAbsU8(taps[4]), filterAbsU8(taps[5]), filterAbsU8(taps[6]), filterAbsU8(taps[7]) + bias := archsimd.BroadcastUint16x8(64) + + x := 0 + for ; x+16 <= w; x += 16 { + v0 := archsimd.LoadUint8x16Array((*[16]byte)(src[0*ss+x : 0*ss+x+16])) + v1 := archsimd.LoadUint8x16Array((*[16]byte)(src[1*ss+x : 1*ss+x+16])) + v2 := archsimd.LoadUint8x16Array((*[16]byte)(src[2*ss+x : 2*ss+x+16])) + v3 := archsimd.LoadUint8x16Array((*[16]byte)(src[3*ss+x : 3*ss+x+16])) + v4 := archsimd.LoadUint8x16Array((*[16]byte)(src[4*ss+x : 4*ss+x+16])) + v5 := archsimd.LoadUint8x16Array((*[16]byte)(src[5*ss+x : 5*ss+x+16])) + v6 := archsimd.LoadUint8x16Array((*[16]byte)(src[6*ss+x : 6*ss+x+16])) + h0, h1, h2, h3 := v0.HiToLo(), v1.HiToLo(), v2.HiToLo(), v3.HiToLo() + h4, h5, h6 := v4.HiToLo(), v5.HiToLo(), v6.HiToLo() + so, do := 7*ss+x, x + if mode == 1 { + for range h { + v7 := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + h7 := v7.HiToLo() + negLo := v0.MulWidenLo(c0).Add(v2.MulWidenLo(c2)).Add(v5.MulWidenLo(c5)).Add(v7.MulWidenLo(c7)) + posLo := bias.Add(v1.MulWidenLo(c1)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v6.MulWidenLo(c6)) + negHi := h0.MulWidenLo(c0).Add(h2.MulWidenLo(c2)).Add(h5.MulWidenLo(c5)).Add(h7.MulWidenLo(c7)) + posHi := bias.Add(h1.MulWidenLo(c1)).Add(h3.MulWidenLo(c3)).Add(h4.MulWidenLo(c4)).Add(h6.MulWidenLo(c6)) + outLo := posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8() + outHi := posHi.SubSaturated(negHi).ShiftAllRight(7).SaturateToUint8() + outLo.ReshapeToUint64s().InterleaveLo(outHi.ReshapeToUint64s()).ReshapeToUint8s().StoreArray((*[16]byte)(dst[do : do+16])) + v0, v1, v2, v3, v4, v5, v6 = v1, v2, v3, v4, v5, v6, v7 + h0, h1, h2, h3, h4, h5, h6 = h1, h2, h3, h4, h5, h6, h7 + so += ss + do += ds + } + } else { + for range h { + v7 := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + h7 := v7.HiToLo() + negLo := v0.MulWidenLo(c0).Add(v1.MulWidenLo(c1)).Add(v6.MulWidenLo(c6)).Add(v7.MulWidenLo(c7)) + posLo := bias.Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v5.MulWidenLo(c5)) + negHi := h0.MulWidenLo(c0).Add(h1.MulWidenLo(c1)).Add(h6.MulWidenLo(c6)).Add(h7.MulWidenLo(c7)) + posHi := bias.Add(h2.MulWidenLo(c2)).Add(h3.MulWidenLo(c3)).Add(h4.MulWidenLo(c4)).Add(h5.MulWidenLo(c5)) + outLo := posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8() + outHi := posHi.SubSaturated(negHi).ShiftAllRight(7).SaturateToUint8() + outLo.ReshapeToUint64s().InterleaveLo(outHi.ReshapeToUint64s()).ReshapeToUint8s().StoreArray((*[16]byte)(dst[do : do+16])) + v0, v1, v2, v3, v4, v5, v6 = v1, v2, v3, v4, v5, v6, v7 + h0, h1, h2, h3, h4, h5, h6 = h1, h2, h3, h4, h5, h6, h7 + so += ss + do += ds + } + } + } + if x < w { + v0 := load8(src[0*ss+x:]) + v1 := load8(src[1*ss+x:]) + v2 := load8(src[2*ss+x:]) + v3 := load8(src[3*ss+x:]) + v4 := load8(src[4*ss+x:]) + v5 := load8(src[5*ss+x:]) + v6 := load8(src[6*ss+x:]) + so, do := 7*ss+x, x + for range h { + v7 := load8(src[so:]) + var posLo, negLo archsimd.Uint16x8 + if mode == 1 { + negLo = v0.MulWidenLo(c0).Add(v2.MulWidenLo(c2)).Add(v5.MulWidenLo(c5)).Add(v7.MulWidenLo(c7)) + posLo = bias.Add(v1.MulWidenLo(c1)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v6.MulWidenLo(c6)) + } else { + negLo = v0.MulWidenLo(c0).Add(v1.MulWidenLo(c1)).Add(v6.MulWidenLo(c6)).Add(v7.MulWidenLo(c7)) + posLo = bias.Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v4.MulWidenLo(c4)).Add(v5.MulWidenLo(c5)) + } + storeBytes8(dst[do:], posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8()) + v0, v1, v2, v3, v4, v5, v6 = v1, v2, v3, v4, v5, v6, v7 + so += ss + do += ds + } + } + return true +} diff --git a/internal/pixel/filter_avx2.go b/internal/pixel/filter_avx2.go new file mode 100644 index 0000000..96d9c27 --- /dev/null +++ b/internal/pixel/filter_avx2.go @@ -0,0 +1,73 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/filter_avx2.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import "simd/archsimd" + +func filterLinearFast(src []byte, ss int, dst []byte, ds, w, h, step int, t0, t1 uint8) bool { + return false +} + +// Sixteen output pixels per AVX2 register. The same negative-first proof as +// filterNarrow8 permits exact int16 arithmetic; byte stores use AVX2-safe +// 128-bit packing rather than AVX-512 narrowing operations. +func filterWide8(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) bool { + if len(taps) != 8 || w <= 0 || w%16 != 0 || h <= 0 || ss < 0 || ds < 0 || step < 0 { + return false + } + mode := narrow8Mode(taps) + if mode == 0 { + return false + } + defer archsimd.ClearAVXUpperBits() + _ = src[(h-1)*ss+w-1+7*step] + _ = dst[(h-1)*ds+w-1] + c0 := archsimd.BroadcastInt16x16(taps[0]) + c1 := archsimd.BroadcastInt16x16(taps[1]) + c2 := archsimd.BroadcastInt16x16(taps[2]) + c3 := archsimd.BroadcastInt16x16(taps[3]) + c4 := archsimd.BroadcastInt16x16(taps[4]) + c5 := archsimd.BroadcastInt16x16(taps[5]) + c6 := archsimd.BroadcastInt16x16(taps[6]) + c7 := archsimd.BroadcastInt16x16(taps[7]) + bias := archsimd.BroadcastInt16x16(64) + for y := range h { + for x := 0; x < w; x += 16 { + p := src[y*ss+x:] + acc := bias + if mode == 1 { + acc = acc.Add(archsimd.LoadUint8x16(p[0*step:]).ExtendToUint16().BitsToInt16().Mul(c0)) + acc = acc.Add(archsimd.LoadUint8x16(p[2*step:]).ExtendToUint16().BitsToInt16().Mul(c2)) + acc = acc.Add(archsimd.LoadUint8x16(p[5*step:]).ExtendToUint16().BitsToInt16().Mul(c5)) + acc = acc.Add(archsimd.LoadUint8x16(p[7*step:]).ExtendToUint16().BitsToInt16().Mul(c7)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[1*step:]).ExtendToUint16().BitsToInt16().Mul(c1)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[3*step:]).ExtendToUint16().BitsToInt16().Mul(c3)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[4*step:]).ExtendToUint16().BitsToInt16().Mul(c4)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[6*step:]).ExtendToUint16().BitsToInt16().Mul(c6)) + } else { + acc = acc.Add(archsimd.LoadUint8x16(p[0*step:]).ExtendToUint16().BitsToInt16().Mul(c0)) + acc = acc.Add(archsimd.LoadUint8x16(p[1*step:]).ExtendToUint16().BitsToInt16().Mul(c1)) + acc = acc.Add(archsimd.LoadUint8x16(p[6*step:]).ExtendToUint16().BitsToInt16().Mul(c6)) + acc = acc.Add(archsimd.LoadUint8x16(p[7*step:]).ExtendToUint16().BitsToInt16().Mul(c7)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[2*step:]).ExtendToUint16().BitsToInt16().Mul(c2)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[3*step:]).ExtendToUint16().BitsToInt16().Mul(c3)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[4*step:]).ExtendToUint16().BitsToInt16().Mul(c4)) + acc = acc.AddSaturated(archsimd.LoadUint8x16(p[5*step:]).ExtendToUint16().BitsToInt16().Mul(c5)) + } + acc = acc.ShiftAllRight(7) + lo, hi := packBytes(acc.GetLo()).ReshapeToUint64s(), packBytes(acc.GetHi()).ReshapeToUint64s() + lo.InterleaveLo(hi).ReshapeToUint8s().Store(dst[y*ds+x:]) + } + } + return true +} diff --git a/internal/pixel/filter_bilinear2d_arm64.go b/internal/pixel/filter_bilinear2d_arm64.go new file mode 100644 index 0000000..2a5e50d --- /dev/null +++ b/internal/pixel/filter_bilinear2d_arm64.go @@ -0,0 +1,481 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/filter_bilinear2d_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// FilterBilinear2D performs fused 1-pass 2D bilinear interpolation directly +// from src into dst without an intermediate scratch buffer, bit-exact with +// sequential horizontal (hx0, hx1) followed by vertical (hy0, hy1) passes. +func FilterBilinear2D(src []byte, ss int, dst []byte, ds, w, h int, hx0, hx1, hy0, hy1 uint8) bool { + if !Enabled || w <= 0 || h <= 0 || ss < 0 || ds < 0 || (w != 4 && w%8 != 0) { + return false + } + if int(hx0)+int(hx1) > 128 || int(hy0)+int(hy1) > 128 { + return false + } + if ss <= 1<<20 && ds <= 1<<20 && w <= 64 && h <= 64 { + if len(src) <= h*ss+w || len(dst) < (h-1)*ds+w { + return false + } + } else if len(src) <= w || ss > (len(src)-1-w)/h || len(dst) < w || (h > 1 && ds > (len(dst)-w)/(h-1)) { + return false + } + // Disjointness guard: fused rolling rows require dst not to overwrite + // unread rows of src. + if slicesOverlap(src, dst, h*ss+w+1, (h-1)*ds+w) { + return false + } + _ = src[h*ss+w] + _ = dst[(h-1)*ds+w-1] + + // Fast path 1: 2D half-pel (64,64) x (64,64) — 2 NEON URHADD per 16 pixels. + if hx0 == 64 && hx1 == 64 && hy0 == 64 && hy1 == 64 { + if w == 16 { + r0 := src[0:17] + prev := archsimd.LoadUint8x16Array((*[16]byte)(r0[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(r0[1:17]))) + ss2, ds2 := 2*ss, 2*ds + so, do := ss, 0 + y := 0 + for ; y+1 < h; y += 2 { + row1 := src[so : so+17] + row2 := src[so+ss : so+ss+17] + cur1 := archsimd.LoadUint8x16Array((*[16]byte)(row1[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(row1[1:17]))) + cur2 := archsimd.LoadUint8x16Array((*[16]byte)(row2[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(row2[1:17]))) + prev.Average(cur1).StoreArray((*[16]byte)(dst[do : do+16])) + cur1.Average(cur2).StoreArray((*[16]byte)(dst[do+ds : do+ds+16])) + prev = cur2 + so += ss2 + do += ds2 + } + if y < h { + row := src[so : so+17] + cur := archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(row[1:17]))) + prev.Average(cur).StoreArray((*[16]byte)(dst[do : do+16])) + } + return true + } + if w == 8 { + prev := load8(src[0:]).Average(load8(src[1:])) + so, do := ss, 0 + for range h { + cur := load8(src[so:]).Average(load8(src[so+1:])) + storeBytes8(dst[do:], prev.Average(cur)) + prev = cur + so += ss + do += ds + } + return true + } + if w == 4 { + prev := load4(src[0:]).Average(load4(src[1:])) + so, do := ss, 0 + for range h { + cur := load4(src[so:]).Average(load4(src[so+1:])) + binary.LittleEndian.PutUint32(dst[do:], prev.Average(cur).ReshapeToUint32s().GetElem(0)) + prev = cur + so += ss + do += ds + } + return true + } + for x := 0; x < w; { + if x+16 <= w { + r0 := src[x : x+17] + prev := archsimd.LoadUint8x16Array((*[16]byte)(r0[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(r0[1:17]))) + so, do := ss+x, x + for range h { + row := src[so : so+17] + cur := archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(row[1:17]))) + prev.Average(cur).StoreArray((*[16]byte)(dst[do : do+16])) + prev = cur + so += ss + do += ds + } + x += 16 + } else { + prev := load8(src[x:]).Average(load8(src[x+1:])) + so, do := ss+x, x + for range h { + cur := load8(src[so:]).Average(load8(src[so+1:])) + storeBytes8(dst[do:], prev.Average(cur)) + prev = cur + so += ss + do += ds + } + x += 8 + } + } + return true + } + + cx0, cx1 := archsimd.BroadcastUint8x16(hx0), archsimd.BroadcastUint8x16(hx1) + cy0, cy1 := archsimd.BroadcastUint8x16(hy0), archsimd.BroadcastUint8x16(hy1) + bias := archsimd.BroadcastUint16x8(64) + + // Fast path 2: horizontal half-pel (64,64), arbitrary vertical tap — + // saves 2 widening multiplies + add + shift per 16 pixels per row. + if hx0 == 64 && hx1 == 64 { + if w == 16 { + prev := archsimd.LoadUint8x16Array((*[16]byte)(src[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(src[1:17]))) + s, d := src[ss:], dst + for range h { + cur := archsimd.LoadUint8x16Array((*[16]byte)(s[0:16])).Average(archsimd.LoadUint8x16Array((*[16]byte)(s[1:17]))) + outLo := prev.MulWidenLo(cy0).Add(cur.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + outHi := prev.HiToLo().MulWidenLo(cy0).Add(cur.HiToLo().MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + outLo.ReshapeToUint8s().ConcatEven(outHi.ReshapeToUint8s()).StoreArray((*[16]byte)(d[0:16])) + prev = cur + if len(s) > ss { + s = s[ss:] + } + if len(d) > ds { + d = d[ds:] + } + } + return true + } + if w == 8 { + prev := load8(src[0:]).Average(load8(src[1:])) + so, do := ss, 0 + for range h { + cur := load8(src[so:]).Average(load8(src[so+1:])) + out := prev.MulWidenLo(cy0).Add(cur.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + storeBytes8(dst[do:], out.TruncToUint8()) + prev = cur + so += ss + do += ds + } + return true + } + } + // Fast path 3: vertical half-pel (64,64), arbitrary horizontal tap — + // vertical pass collapses to a single NEON URHADD per 16 pixels. + if hy0 == 64 && hy1 == 64 { + if w == 16 { + r0 := src[0:17] + a, b := archsimd.LoadUint8x16Array((*[16]byte)(r0[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(r0[1:17])) + pLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + pHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + prev := pLo.ReshapeToUint8s().ConcatEven(pHi.ReshapeToUint8s()) + so, do := ss, 0 + for range h { + row := src[so : so+17] + a, b = archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(row[1:17])) + cLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + cHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + cur := cLo.ReshapeToUint8s().ConcatEven(cHi.ReshapeToUint8s()) + prev.Average(cur).StoreArray((*[16]byte)(dst[do : do+16])) + prev = cur + so += ss + do += ds + } + return true + } + if w == 8 { + a, b := load8(src[0:]), load8(src[1:]) + prev := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + so, do := ss, 0 + for range h { + a, b = load8(src[so:]), load8(src[so+1:]) + cur := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + storeBytes8(dst[do:], prev.Average(cur)) + prev = cur + so += ss + do += ds + } + return true + } + } + + if w == 16 { + a, b := archsimd.LoadUint8x16Array((*[16]byte)(src[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(src[1:17])) + prevLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + prevHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + s, d := src[ss:], dst + for range h { + a, b = archsimd.LoadUint8x16Array((*[16]byte)(s[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(s[1:17])) + curLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + curHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + outLo := prevLo.MulWidenLo(cy0).Add(curLo.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + outHi := prevHi.MulWidenLo(cy0).Add(curHi.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + outLo.ReshapeToUint8s().ConcatEven(outHi.ReshapeToUint8s()).StoreArray((*[16]byte)(d[0:16])) + prevLo, prevHi = curLo, curHi + if len(s) > ss { + s = s[ss:] + } + if len(d) > ds { + d = d[ds:] + } + } + return true + } + if w == 8 { + a0, b0 := load8(src[0:]), load8(src[1:]) + prev := a0.MulWidenLo(cx0).Add(b0.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + so, do := ss, 0 + y := 0 + for ; y+1 < h; y += 2 { + r0 := src[so : so+9] + r1 := src[so+ss : so+ss+9] + a := archsimd.LoadUint64x2Array(&[2]uint64{ + binary.LittleEndian.Uint64(r0[0:8]), + binary.LittleEndian.Uint64(r1[0:8]), + }).ReshapeToUint8s() + b := archsimd.LoadUint64x2Array(&[2]uint64{ + binary.LittleEndian.Uint64(r0[1:9]), + binary.LittleEndian.Uint64(r1[1:9]), + }).ReshapeToUint8s() + c0 := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + c1 := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + o0 := prev.MulWidenLo(cy0).Add(c0.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7).TruncToUint8() + o1 := c0.MulWidenLo(cy0).Add(c1.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7).TruncToUint8() + storeBytes8(dst[do:], o0) + storeBytes8(dst[do+ds:], o1) + prev = c1 + so += 2 * ss + do += 2 * ds + } + if y < h { + a, b := load8(src[so:]), load8(src[so+1:]) + cur := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + out := prev.MulWidenLo(cy0).Add(cur.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + storeBytes8(dst[do:], out.TruncToUint8()) + } + return true + } + if w == 4 { + a, b := load4(src[0:]), load4(src[1:]) + prev := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + so, do := ss, 0 + for range h { + a, b = load4(src[so:]), load4(src[so+1:]) + cur := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + out := prev.MulWidenLo(cy0).Add(cur.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7).TruncToUint8() + binary.LittleEndian.PutUint32(dst[do:], out.ReshapeToUint32s().GetElem(0)) + prev = cur + so += ss + do += ds + } + return true + } + + for x := 0; x < w; { + if x+16 <= w { + r0 := src[x : x+17] + a, b := archsimd.LoadUint8x16Array((*[16]byte)(r0[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(r0[1:17])) + prevLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + prevHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + so, do := ss+x, x + for range h { + row := src[so : so+17] + a, b = archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])), archsimd.LoadUint8x16Array((*[16]byte)(row[1:17])) + curLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + curHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + outLo := prevLo.MulWidenLo(cy0).Add(curLo.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + outHi := prevHi.MulWidenLo(cy0).Add(curHi.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + outLo.ReshapeToUint8s().ConcatEven(outHi.ReshapeToUint8s()).StoreArray((*[16]byte)(dst[do : do+16])) + prevLo, prevHi = curLo, curHi + so += ss + do += ds + } + x += 16 + } else { + a, b := load8(src[x:]), load8(src[x+1:]) + prev := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + so, do := ss+x, x + for range h { + a, b = load8(src[so:]), load8(src[so+1:]) + cur := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7).TruncToUint8() + out := prev.MulWidenLo(cy0).Add(cur.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + storeBytes8(dst[do:], out.TruncToUint8()) + prev = cur + so += ss + do += ds + } + x += 8 + } + } + return true +} + +// FilterBilinear2DPair8x8 performs fused 8x8 bilinear interpolation on two +// chroma planes (U and V) in lockstep, packing 8 bytes of src0 in the low +// 64 bits and 8 bytes of src1 in the high 64 bits of each 128-bit NEON vector. +// Handles 1D horizontal (hy0==128), 1D vertical (hx0==128), and 2D subpel. +func FilterBilinear2DPair8x8( + src0 []byte, ss0 int, src1 []byte, ss1 int, + dst0 []byte, ds0 int, dst1 []byte, ds1 int, + hx0, hx1, hy0, hy1 uint8, +) bool { + if !Enabled || ss0 < 0 || ss1 < 0 || ds0 < 0 || ds1 < 0 { + return false + } + if int(hx0)+int(hx1) > 128 || int(hy0)+int(hy1) > 128 { + return false + } + if ss0 > 1<<20 || ss1 > 1<<20 || ds0 > 1<<20 || ds1 > 1<<20 { + return false + } + srcNeed0 := 8*ss0 + 9 + srcNeed1 := 8*ss1 + 9 + dstNeed0 := 7*ds0 + 8 + dstNeed1 := 7*ds1 + 8 + if hy1 == 0 { + srcNeed0 = 7*ss0 + 9 + srcNeed1 = 7*ss1 + 9 + } + if hx1 == 0 { + srcNeed0-- + srcNeed1-- + } + if len(src0) < srcNeed0 || len(src1) < srcNeed1 || len(dst0) < dstNeed0 || len(dst1) < dstNeed1 { + return false + } + if slicesOverlap(src0, dst0, srcNeed0, dstNeed0) || slicesOverlap(src1, dst1, srcNeed1, dstNeed1) || + slicesOverlap(src0, dst1, srcNeed0, dstNeed1) || slicesOverlap(src1, dst0, srcNeed1, dstNeed0) { + return false + } + _ = src0[srcNeed0-1] + _ = src1[srcNeed1-1] + _ = dst0[dstNeed0-1] + _ = dst1[dstNeed1-1] + + loadPair := func(a, b []byte) archsimd.Uint8x16 { + return archsimd.LoadUint64x2Array(&[2]uint64{ + binary.LittleEndian.Uint64(a), + binary.LittleEndian.Uint64(b), + }).ReshapeToUint8s() + } + storePair := func(a, b []byte, v archsimd.Uint8x16) { + u := v.ReshapeToUint64s() + binary.LittleEndian.PutUint64(a, u.GetElem(0)) + binary.LittleEndian.PutUint64(b, u.GetElem(1)) + } + + // 1D horizontal only (hy0 == 128, hy1 == 0). + if hy1 == 0 { + if hx0 == 64 && hx1 == 64 { + so0, so1, do0, do1 := 0, 0, 0, 0 + for range 8 { + a := loadPair(src0[so0:], src1[so1:]) + b := loadPair(src0[so0+1:], src1[so1+1:]) + storePair(dst0[do0:], dst1[do1:], a.Average(b)) + so0 += ss0 + so1 += ss1 + do0 += ds0 + do1 += ds1 + } + return true + } + cx0, cx1 := archsimd.BroadcastUint8x16(hx0), archsimd.BroadcastUint8x16(hx1) + bias := archsimd.BroadcastUint16x8(64) + so0, so1, do0, do1 := 0, 0, 0, 0 + for range 8 { + a := loadPair(src0[so0:], src1[so1:]) + b := loadPair(src0[so0+1:], src1[so1+1:]) + lo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + hi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + storePair(dst0[do0:], dst1[do1:], lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s())) + so0 += ss0 + so1 += ss1 + do0 += ds0 + do1 += ds1 + } + return true + } + + // 1D vertical only (hx0 == 128, hx1 == 0). + if hx1 == 0 { + if hy0 == 64 && hy1 == 64 { + prev := loadPair(src0[0:], src1[0:]) + so0, so1, do0, do1 := ss0, ss1, 0, 0 + for range 8 { + cur := loadPair(src0[so0:], src1[so1:]) + storePair(dst0[do0:], dst1[do1:], prev.Average(cur)) + prev = cur + so0 += ss0 + so1 += ss1 + do0 += ds0 + do1 += ds1 + } + return true + } + cy0, cy1 := archsimd.BroadcastUint8x16(hy0), archsimd.BroadcastUint8x16(hy1) + bias := archsimd.BroadcastUint16x8(64) + prev := loadPair(src0[0:], src1[0:]) + so0, so1, do0, do1 := ss0, ss1, 0, 0 + for range 8 { + cur := loadPair(src0[so0:], src1[so1:]) + lo := prev.MulWidenLo(cy0).Add(cur.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + hi := prev.HiToLo().MulWidenLo(cy0).Add(cur.HiToLo().MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + storePair(dst0[do0:], dst1[do1:], lo.ReshapeToUint8s().ConcatEven(hi.ReshapeToUint8s())) + prev = cur + so0 += ss0 + so1 += ss1 + do0 += ds0 + do1 += ds1 + } + return true + } + + // 2D half-pel (64,64) x (64,64). + if hx0 == 64 && hx1 == 64 && hy0 == 64 && hy1 == 64 { + prev := loadPair(src0[0:], src1[0:]).Average(loadPair(src0[1:], src1[1:])) + so0, so1, do0, do1 := ss0, ss1, 0, 0 + for range 8 { + cur := loadPair(src0[so0:], src1[so1:]).Average(loadPair(src0[so0+1:], src1[so1+1:])) + storePair(dst0[do0:], dst1[do1:], prev.Average(cur)) + prev = cur + so0 += ss0 + so1 += ss1 + do0 += ds0 + do1 += ds1 + } + return true + } + + cx0, cx1 := archsimd.BroadcastUint8x16(hx0), archsimd.BroadcastUint8x16(hx1) + cy0, cy1 := archsimd.BroadcastUint8x16(hy0), archsimd.BroadcastUint8x16(hy1) + bias := archsimd.BroadcastUint16x8(64) + + // 2D general dual-plane 16-lane NEON. + a := loadPair(src0[0:], src1[0:]) + b := loadPair(src0[1:], src1[1:]) + pLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + pHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + prev := pLo.ReshapeToUint8s().ConcatEven(pHi.ReshapeToUint8s()) + so0, so1, do0, do1 := ss0, ss1, 0, 0 + for range 8 { + a = loadPair(src0[so0:], src1[so1:]) + b = loadPair(src0[so0+1:], src1[so1+1:]) + cLo := a.MulWidenLo(cx0).Add(b.MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + cHi := a.HiToLo().MulWidenLo(cx0).Add(b.HiToLo().MulWidenLo(cx1)).Add(bias).ShiftAllRight(7) + cur := cLo.ReshapeToUint8s().ConcatEven(cHi.ReshapeToUint8s()) + oLo := prev.MulWidenLo(cy0).Add(cur.MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + oHi := prev.HiToLo().MulWidenLo(cy0).Add(cur.HiToLo().MulWidenLo(cy1)).Add(bias).ShiftAllRight(7) + storePair(dst0[do0:], dst1[do1:], oLo.ReshapeToUint8s().ConcatEven(oHi.ReshapeToUint8s())) + prev = cur + so0 += ss0 + so1 += ss1 + do0 += ds0 + do1 += ds1 + } + return true +} + +func load4(src []byte) archsimd.Uint8x16 { + return archsimd.LoadUint32x4Array(&[4]uint32{binary.LittleEndian.Uint32(src)}).ReshapeToUint8s() +} diff --git a/internal/pixel/filter_bilinear2d_stub.go b/internal/pixel/filter_bilinear2d_stub.go new file mode 100644 index 0000000..39670ec --- /dev/null +++ b/internal/pixel/filter_bilinear2d_stub.go @@ -0,0 +1,235 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/filter_bilinear2d_stub.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || !arm64 || purego + +package pixel + +import "encoding/binary" + +func filterBilinear2DHalf16(src []byte, ss int, dst []byte, ds, h int) { + const maskFE = uint64(0xfefefefefefefefe) + s0 := src[:17] + a0, b0 := binary.LittleEndian.Uint64(s0[0:8]), binary.LittleEndian.Uint64(s0[1:9]) + p0 := (a0 | b0) - (((a0 ^ b0) & maskFE) >> 1) + a1, b1 := binary.LittleEndian.Uint64(s0[8:16]), binary.LittleEndian.Uint64(s0[9:17]) + p1 := (a1 | b1) - (((a1 ^ b1) & maskFE) >> 1) + si, di := ss, 0 + for range h { + s := src[si : si+17] + d := dst[di : di+16] + a0, b0 = binary.LittleEndian.Uint64(s[0:8]), binary.LittleEndian.Uint64(s[1:9]) + c0 := (a0 | b0) - (((a0 ^ b0) & maskFE) >> 1) + binary.LittleEndian.PutUint64(d[0:8], (p0|c0)-(((p0^c0)&maskFE)>>1)) + p0 = c0 + + a1, b1 = binary.LittleEndian.Uint64(s[8:16]), binary.LittleEndian.Uint64(s[9:17]) + c1 := (a1 | b1) - (((a1 ^ b1) & maskFE) >> 1) + binary.LittleEndian.PutUint64(d[8:16], (p1|c1)-(((p1^c1)&maskFE)>>1)) + p1 = c1 + + si += ss + di += ds + } +} + +func filterBilinear2DHalf8(src []byte, ss int, dst []byte, ds, h int) { + const maskFE = uint64(0xfefefefefefefefe) + s0 := src[:9] + a0, b0 := binary.LittleEndian.Uint64(s0[0:8]), binary.LittleEndian.Uint64(s0[1:9]) + p0 := (a0 | b0) - (((a0 ^ b0) & maskFE) >> 1) + si, di := ss, 0 + for range h { + s := src[si : si+9] + a0, b0 = binary.LittleEndian.Uint64(s[0:8]), binary.LittleEndian.Uint64(s[1:9]) + c0 := (a0 | b0) - (((a0 ^ b0) & maskFE) >> 1) + binary.LittleEndian.PutUint64(dst[di:di+8], (p0|c0)-(((p0^c0)&maskFE)>>1)) + p0 = c0 + si += ss + di += ds + } +} + +func filterBilinear2DHalfWide(src []byte, ss int, dst []byte, ds, w, h int) { + const maskFE = uint64(0xfefefefefefefefe) + var prev [8]uint64 + cols := w >> 3 + s0 := src[:w+1] + for c := range cols { + x := c << 3 + a, b := binary.LittleEndian.Uint64(s0[x:x+8]), binary.LittleEndian.Uint64(s0[x+1:x+9]) + prev[c] = (a | b) - (((a ^ b) & maskFE) >> 1) + } + si, di := ss, 0 + for range h { + s := src[si : si+w+1] + d := dst[di : di+w] + for c := range cols { + x := c << 3 + a, b := binary.LittleEndian.Uint64(s[x:x+8]), binary.LittleEndian.Uint64(s[x+1:x+9]) + cur := (a | b) - (((a ^ b) & maskFE) >> 1) + p := prev[c] + prev[c] = cur + binary.LittleEndian.PutUint64(d[x:x+8], (p|cur)-(((p^cur)&maskFE)>>1)) + } + si += ss + di += ds + } +} + +func filterBilinear2DGen16(src []byte, ss int, dst []byte, ds, h int, hf0, hf1, vf0, vf1 uint64) { + const ( + mask00FF = uint64(0x00ff00ff00ff00ff) + maskFF00 = uint64(0xff00ff00ff00ff00) + bias64 = uint64(0x0040004000400040) + ) + sFirst := src[:17] + w0, w1 := binary.LittleEndian.Uint64(sFirst[0:8]), binary.LittleEndian.Uint64(sFirst[1:9]) + pLo0 := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + pHi0 := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + w2, w3 := binary.LittleEndian.Uint64(sFirst[8:16]), binary.LittleEndian.Uint64(sFirst[9:17]) + pLo1 := (((w2&mask00FF)*hf0 + (w3&mask00FF)*hf1 + bias64) >> 7) & mask00FF + pHi1 := ((((w2>>8)&mask00FF)*hf0 + ((w3>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + si, di := ss, 0 + for range h { + s := src[si : si+17] + d := dst[di : di+16] + w0, w1 = binary.LittleEndian.Uint64(s[0:8]), binary.LittleEndian.Uint64(s[1:9]) + cLo0 := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + cHi0 := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + oLo0 := ((pLo0*vf0 + cLo0*vf1 + bias64) >> 7) & mask00FF + oHi0 := ((pHi0*vf0 + cHi0*vf1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[0:8], oLo0|oHi0) + pLo0, pHi0 = cLo0, cHi0 + + w2, w3 = binary.LittleEndian.Uint64(s[8:16]), binary.LittleEndian.Uint64(s[9:17]) + cLo1 := (((w2&mask00FF)*hf0 + (w3&mask00FF)*hf1 + bias64) >> 7) & mask00FF + cHi1 := ((((w2>>8)&mask00FF)*hf0 + ((w3>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + oLo1 := ((pLo1*vf0 + cLo1*vf1 + bias64) >> 7) & mask00FF + oHi1 := ((pHi1*vf0 + cHi1*vf1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[8:16], oLo1|oHi1) + pLo1, pHi1 = cLo1, cHi1 + + si += ss + di += ds + } +} + +func filterBilinear2DGen8(src []byte, ss int, dst []byte, ds, h int, hf0, hf1, vf0, vf1 uint64) { + const ( + mask00FF = uint64(0x00ff00ff00ff00ff) + maskFF00 = uint64(0xff00ff00ff00ff00) + bias64 = uint64(0x0040004000400040) + ) + sFirst := src[:9] + w0, w1 := binary.LittleEndian.Uint64(sFirst[0:8]), binary.LittleEndian.Uint64(sFirst[1:9]) + pLo := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + pHi := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + si, di := ss, 0 + for range h { + s := src[si : si+9] + w0, w1 = binary.LittleEndian.Uint64(s[0:8]), binary.LittleEndian.Uint64(s[1:9]) + cLo := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + cHi := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + oLo := ((pLo*vf0 + cLo*vf1 + bias64) >> 7) & mask00FF + oHi := ((pHi*vf0 + cHi*vf1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(dst[di:di+8], oLo|oHi) + pLo, pHi = cLo, cHi + si += ss + di += ds + } +} + +func filterBilinear2DGenWide(src []byte, ss int, dst []byte, ds, w, h int, hf0, hf1, vf0, vf1 uint64) { + const ( + mask00FF = uint64(0x00ff00ff00ff00ff) + maskFF00 = uint64(0xff00ff00ff00ff00) + bias64 = uint64(0x0040004000400040) + ) + var prevLo, prevHi [8]uint64 + cols := w >> 3 + sFirst := src[:w+1] + for c := range cols { + x := c << 3 + w0, w1 := binary.LittleEndian.Uint64(sFirst[x:x+8]), binary.LittleEndian.Uint64(sFirst[x+1:x+9]) + prevLo[c] = (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + prevHi[c] = ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + } + si, di := ss, 0 + for range h { + s := src[si : si+w+1] + d := dst[di : di+w] + for c := range cols { + x := c << 3 + w0, w1 := binary.LittleEndian.Uint64(s[x:x+8]), binary.LittleEndian.Uint64(s[x+1:x+9]) + cLo := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + cHi := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + oLo := ((prevLo[c]*vf0 + cLo*vf1 + bias64) >> 7) & mask00FF + oHi := ((prevHi[c]*vf0 + cHi*vf1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[x:x+8], oLo|oHi) + prevLo[c], prevHi[c] = cLo, cHi + } + si += ss + di += ds + } +} + +func FilterBilinear2D(src []byte, ss int, dst []byte, ds, w, h int, hx0, hx1, hy0, hy1 uint8) bool { + if w <= 0 || h <= 0 || ss < 0 || ds < 0 || w%8 != 0 || w > 64 { + return false + } + if int(hx0)+int(hx1) != 128 || int(hy0)+int(hy1) != 128 { + return false + } + if ss <= 1<<20 && ds <= 1<<20 && h <= 64 { + if len(src) <= h*ss+w || len(dst) < (h-1)*ds+w { + return false + } + } else if len(src) <= w || ss > (len(src)-1-w)/h || len(dst) < w || (h > 1 && ds > (len(dst)-w)/(h-1)) { + return false + } + if &src[0] == &dst[0] { + return false + } + _ = src[h*ss+w] + _ = dst[(h-1)*ds+w-1] + + if hx0 == 64 && hx1 == 64 && hy0 == 64 && hy1 == 64 { + switch w { + case 16: + filterBilinear2DHalf16(src, ss, dst, ds, h) + case 8: + filterBilinear2DHalf8(src, ss, dst, ds, h) + default: + filterBilinear2DHalfWide(src, ss, dst, ds, w, h) + } + return true + } + switch w { + case 16: + filterBilinear2DGen16(src, ss, dst, ds, h, uint64(hx0), uint64(hx1), uint64(hy0), uint64(hy1)) + case 8: + filterBilinear2DGen8(src, ss, dst, ds, h, uint64(hx0), uint64(hx1), uint64(hy0), uint64(hy1)) + default: + filterBilinear2DGenWide(src, ss, dst, ds, w, h, uint64(hx0), uint64(hx1), uint64(hy0), uint64(hy1)) + } + return true +} + +func FilterBilinear2DPair8x8(src0 []byte, ss0 int, src1 []byte, ss1 int, dst0 []byte, ds0 int, dst1 []byte, ds1 int, hx0, hx1, hy0, hy1 uint8) bool { + if !FilterBilinear2D(src0, ss0, dst0, ds0, 8, 8, hx0, hx1, hy0, hy1) { + return false + } + return FilterBilinear2D(src1, ss1, dst1, ds1, 8, 8, hx0, hx1, hy0, hy1) +} + +func FilterHalfPelDisjoint(src []byte, ss int, dst []byte, ds, w, h, step int) { + FilterBilinear(src, ss, dst, ds, w, h, step, 64, 64) +} diff --git a/internal/pixel/filter_six_simd.go b/internal/pixel/filter_six_simd.go new file mode 100644 index 0000000..0f55543 --- /dev/null +++ b/internal/pixel/filter_six_simd.go @@ -0,0 +1,240 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/filter_six_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// Odd VP8 interpolation phases have zero outer taps. The six-tap caller +// proves the coefficient signs/bounds before omitting those unused inputs. +func filterFourNarrow8(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) { + if w != 4 && h > 1 && step == ss && filterVerticalFour8(src, ss, dst, ds, w, h, taps) { + return + } + if step == 1 && w >= 8 && w%8 == 0 && filterHorizFour16(src, ss, dst, ds, w, h, taps) { + return + } + c0, c1 := archsimd.BroadcastInt16x8(taps[0]), archsimd.BroadcastInt16x8(taps[1]) + c2, c3 := archsimd.BroadcastInt16x8(taps[2]), archsimd.BroadcastInt16x8(taps[3]) + bias := archsimd.BroadcastInt16x8(64) + n := 8 + if w == 4 { + n = 4 + } + for y := range h { + for x := 0; x < w; x += n { + at := y*ss + x + var p0, p1, p2, p3 archsimd.Int16x8 + if step == 1 && len(src)-at >= 16 { + a := archsimd.LoadUint8x16(src[at:]) + z := archsimd.Uint8x16{} + p0 = widen8(a) + p1 = widen8(z.ConcatShiftBytesRight(a, 1)) + p2 = widen8(z.ConcatShiftBytesRight(a, 2)) + p3 = widen8(z.ConcatShiftBytesRight(a, 3)) + } else { + p0, p1 = widen8(loadN(src[at:], n)), widen8(loadN(src[at+step:], n)) + p2, p3 = widen8(loadN(src[at+2*step:], n)), widen8(loadN(src[at+3*step:], n)) + } + v := mulAdd16(p0.Mul(c0).Add(bias), p3, c3) + v = v.AddSaturated(p1.Mul(c1)).AddSaturated(p2.Mul(c2)) + packed := packBytes(filterShift7(v)) + if n == 4 { + binary.LittleEndian.PutUint32(dst[y*ds+x:], packed.ReshapeToUint32s().GetElem(0)) + } else { + storeBytes8(dst[y*ds+x:], packed) + } + } + } +} + +// Nonnegative two-tap filters with total weight <=128 fit signed int16, +// including the rounding bias: 255*128+64 =32704. Eight output pixels can +// therefore share one multiply-add pipeline with no intermediate clipping. +func filterLinear8(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) bool { + if len(taps) != 2 || taps[0] < 0 || taps[1] < 0 || int(taps[0])+int(taps[1]) > 128 || w <= 0 || (w != 4 && w%8 != 0) || h <= 0 || ss < 0 || ds < 0 || step < 0 { + return false + } + _ = src[(h-1)*ss+w-1+step] + _ = dst[(h-1)*ds+w-1] + if w >= 8 && (step == 1 || step == ss) && filterLinearFast(src, ss, dst, ds, w, h, step, uint8(taps[0]), uint8(taps[1])) { + return true + } + c0, c1, bias := archsimd.BroadcastInt16x8(taps[0]), archsimd.BroadcastInt16x8(taps[1]), archsimd.BroadcastInt16x8(64) + n := 8 + if w == 4 { + n = 4 + } + for y := range h { + for x := 0; x < w; x += n { + p := src[y*ss+x:] + a, b := widen8(loadN(p, n)), widen8(loadN(p[step:], n)) + v := packBytes(filterShift7(mulAdd16(a.Mul(c0).Add(bias), b, c1))) + if n == 4 { + binary.LittleEndian.PutUint32(dst[y*ds+x:], v.ReshapeToUint32s().GetElem(0)) + } else { + storeBytes8(dst[y*ds+x:], v) + } + } + } + return true +} + +// Standard VP9 filters have at most 128 total negative weight, and every +// coefficient is in [-128,128]. Accumulating negative products first keeps +// the signed int16 sum exact. Subsequent positive products may saturate only +// above 32767; those results already clip to byte 255 after rounding by 7. +// This ordering therefore permits eight int16 lanes without premature +// saturation changing a result. Arbitrary filters retain the int32 kernel. +func filterNarrow8(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) bool { + if len(taps) != 8 || w <= 0 || (w != 4 && w%8 != 0) || h <= 0 || ss < 0 || ds < 0 || step < 0 { + return false + } + mode := narrow8Mode(taps) + if mode == 0 { + return false + } + _ = src[(h-1)*ss+w-1+7*step] + _ = dst[(h-1)*ds+w-1] + if step == ss && filterVerticalNarrow8(src, ss, dst, ds, w, h, taps, mode) { + return true + } + c0, c1, c2, c3 := archsimd.BroadcastInt16x8(taps[0]), archsimd.BroadcastInt16x8(taps[1]), archsimd.BroadcastInt16x8(taps[2]), archsimd.BroadcastInt16x8(taps[3]) + c4, c5, c6, c7 := archsimd.BroadcastInt16x8(taps[4]), archsimd.BroadcastInt16x8(taps[5]), archsimd.BroadcastInt16x8(taps[6]), archsimd.BroadcastInt16x8(taps[7]) + bias := archsimd.BroadcastInt16x8(64) + n := 8 + if w == 4 { + n = 4 + } + for y := range h { + for x := 0; x < w; x += n { + p := src[y*ss+x:] + var p0, p1, p2, p3, p4, p5, p6, p7 archsimd.Int16x8 + if step == 1 && len(p) >= 16 { + a := archsimd.LoadUint8x16(p) + z := archsimd.Uint8x16{} + p0 = widen8(a) + p1 = widen8(z.ConcatShiftBytesRight(a, 1)) + p2 = widen8(z.ConcatShiftBytesRight(a, 2)) + p3 = widen8(z.ConcatShiftBytesRight(a, 3)) + p4 = widen8(z.ConcatShiftBytesRight(a, 4)) + p5 = widen8(z.ConcatShiftBytesRight(a, 5)) + p6 = widen8(z.ConcatShiftBytesRight(a, 6)) + p7 = widen8(z.ConcatShiftBytesRight(a, 7)) + } else { + p0, p1, p2, p3 = widen8(loadN(p, n)), widen8(loadN(p[step:], n)), widen8(loadN(p[2*step:], n)), widen8(loadN(p[3*step:], n)) + p4, p5, p6, p7 = widen8(loadN(p[4*step:], n)), widen8(loadN(p[5*step:], n)), widen8(loadN(p[6*step:], n)), widen8(loadN(p[7*step:], n)) + } + + acc := bias + if mode == 1 { + acc = mulAdd16(acc, p0, c0) + acc = mulAdd16(acc, p2, c2) + acc = mulAdd16(acc, p5, c5) + acc = mulAdd16(acc, p7, c7) + acc = acc.AddSaturated(p1.Mul(c1)).AddSaturated(p3.Mul(c3)).AddSaturated(p4.Mul(c4)).AddSaturated(p6.Mul(c6)) + } else { + acc = mulAdd16(acc, p0, c0) + acc = mulAdd16(acc, p1, c1) + acc = mulAdd16(acc, p6, c6) + acc = mulAdd16(acc, p7, c7) + acc = acc.AddSaturated(p2.Mul(c2)).AddSaturated(p3.Mul(c3)).AddSaturated(p4.Mul(c4)).AddSaturated(p5.Mul(c5)) + } + packed := packBytes(filterShift7(acc)) + if n == 4 { + binary.LittleEndian.PutUint32(dst[y*ds+x:], packed.ReshapeToUint32s().GetElem(0)) + } else { + storeBytes8(dst[y*ds+x:], packed) + } + } + } + return true +} + +func narrow8Mode(taps []int16) int { + t0, t1, t2, t3, t4, t5, t6, t7 := taps[0], taps[1], taps[2], taps[3], taps[4], taps[5], taps[6], taps[7] + if min(t0, t1, t2, t3, t4, t5, t6, t7) < -128 || max(t0, t1, t2, t3, t4, t5, t6, t7) > 128 { + return 0 + } + if max(t0, t2, t5, t7) <= 0 && min(t1, t3, t4, t6) >= 0 { + if -int(t0)-int(t2)-int(t5)-int(t7) <= 128 { + return 1 + } + return 0 + } + if max(t0, t1, t6, t7) <= 0 && min(t2, t3, t4, t5) >= 0 && -int(t0)-int(t1)-int(t6)-int(t7) <= 128 { + return 2 + } + return 0 +} + +// VP8's two negative taps total at most 128. Accumulating those first keeps +// the signed int16 sum exact; subsequent positive saturation already clips +// to byte 255 after the final rounding shift. +func filterSixNarrow8(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) bool { + if len(taps) != 6 || w <= 0 || (w != 4 && w%8 != 0) || h <= 0 || ss < 0 || ds < 0 || step < 0 { + return false + } + if min(taps[0], taps[2], taps[3], taps[5]) < 0 || max(taps[1], taps[4]) > 0 || min(taps[1], taps[4]) < -128 || max(taps[0], taps[2], taps[3], taps[5]) > 128 || -int(taps[1])-int(taps[4]) > 128 { + return false + } + _ = src[(h-1)*ss+w-1+5*step] + _ = dst[(h-1)*ds+w-1] + if taps[0] == 0 && taps[5] == 0 { + filterFourNarrow8(src[step:], ss, dst, ds, w, h, step, taps[1:5]) + return true + } + if w != 4 && h > 1 && step == ss && filterVerticalSix8(src, ss, dst, ds, w, h, taps) { + return true + } + if step == 1 && w >= 8 && w%8 == 0 && filterHorizSix16(src, ss, dst, ds, w, h, taps) { + return true + } + c0, c1, c2 := archsimd.BroadcastInt16x8(taps[0]), archsimd.BroadcastInt16x8(taps[1]), archsimd.BroadcastInt16x8(taps[2]) + c3, c4, c5 := archsimd.BroadcastInt16x8(taps[3]), archsimd.BroadcastInt16x8(taps[4]), archsimd.BroadcastInt16x8(taps[5]) + bias := archsimd.BroadcastInt16x8(64) + n := 8 + if w == 4 { + n = 4 + } + for y := range h { + for x := 0; x < w; x += n { + at := y*ss + x + var p0, p1, p2, p3, p4, p5 archsimd.Int16x8 + if step == 1 && len(src)-at >= 16 { + a := archsimd.LoadUint8x16(src[at:]) + z := archsimd.Uint8x16{} + p0 = widen8(a) + p1 = widen8(z.ConcatShiftBytesRight(a, 1)) + p2 = widen8(z.ConcatShiftBytesRight(a, 2)) + p3 = widen8(z.ConcatShiftBytesRight(a, 3)) + p4 = widen8(z.ConcatShiftBytesRight(a, 4)) + p5 = widen8(z.ConcatShiftBytesRight(a, 5)) + } else { + p0, p1, p2 = widen8(loadN(src[at:], n)), widen8(loadN(src[at+step:], n)), widen8(loadN(src[at+2*step:], n)) + p3, p4, p5 = widen8(loadN(src[at+3*step:], n)), widen8(loadN(src[at+4*step:], n)), widen8(loadN(src[at+5*step:], n)) + } + v := mulAdd16(p1.Mul(c1).Add(bias), p4, c4) + v = v.AddSaturated(p0.Mul(c0)).AddSaturated(p2.Mul(c2)).AddSaturated(p3.Mul(c3)).AddSaturated(p5.Mul(c5)) + b := packBytes(filterShift7(v)) + if n == 4 { + binary.LittleEndian.PutUint32(dst[y*ds+x:], b.ReshapeToUint32s().GetElem(0)) + } else { + storeBytes8(dst[y*ds+x:], b) + } + } + } + return true +} diff --git a/internal/pixel/filter_six_vertical_amd64.go b/internal/pixel/filter_six_vertical_amd64.go new file mode 100644 index 0000000..803de09 --- /dev/null +++ b/internal/pixel/filter_six_vertical_amd64.go @@ -0,0 +1,81 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/filter_six_vertical_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import "simd/archsimd" + +// Rolling rows require disjoint input/output and non-overlapping output rows. +func filterVerticalRowsAllowed(src, dst []byte, ds, w, h int) bool { + if h < 2 || w%8 != 0 || ds < w || len(src) == 0 || len(dst) == 0 { + return false + } + return !slicesOverlap(src, dst, len(src), len(dst)) +} +func filterHorizFour16(_ []byte, _ int, _ []byte, _, _, _ int, _ []int16) bool { + return false +} + +func filterHorizSix16(_ []byte, _ int, _ []byte, _, _, _ int, _ []int16) bool { + return false +} + +func filterVerticalSix8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { + if !filterVerticalRowsAllowed(src, dst, ds, w, h) { + return false + } + c0 := archsimd.BroadcastInt16x8(taps[0]) + c1 := archsimd.BroadcastInt16x8(taps[1]) + c2 := archsimd.BroadcastInt16x8(taps[2]) + c3 := archsimd.BroadcastInt16x8(taps[3]) + c4 := archsimd.BroadcastInt16x8(taps[4]) + c5 := archsimd.BroadcastInt16x8(taps[5]) + bias := archsimd.BroadcastInt16x8(64) + for x := 0; x < w; x += 8 { + p0 := widen8(load8(src[0*ss+x:])) + p1 := widen8(load8(src[1*ss+x:])) + p2 := widen8(load8(src[2*ss+x:])) + p3 := widen8(load8(src[3*ss+x:])) + p4 := widen8(load8(src[4*ss+x:])) + for y := range h { + p5 := widen8(load8(src[(y+5)*ss+x:])) + v := mulAdd16(p1.Mul(c1).Add(bias), p4, c4) + v = v.AddSaturated(p0.Mul(c0)).AddSaturated(p2.Mul(c2)).AddSaturated(p3.Mul(c3)).AddSaturated(p5.Mul(c5)) + storeBytes8(dst[y*ds+x:], packBytes(filterShift7(v))) + p0, p1, p2, p3, p4 = p1, p2, p3, p4, p5 + } + } + return true +} +func filterVerticalFour8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { + if !filterVerticalRowsAllowed(src, dst, ds, w, h) { + return false + } + c0 := archsimd.BroadcastInt16x8(taps[0]) + c1 := archsimd.BroadcastInt16x8(taps[1]) + c2 := archsimd.BroadcastInt16x8(taps[2]) + c3 := archsimd.BroadcastInt16x8(taps[3]) + bias := archsimd.BroadcastInt16x8(64) + for x := 0; x < w; x += 8 { + p0 := widen8(load8(src[0*ss+x:])) + p1 := widen8(load8(src[1*ss+x:])) + p2 := widen8(load8(src[2*ss+x:])) + for y := range h { + p3 := widen8(load8(src[(y+3)*ss+x:])) + v := mulAdd16(p0.Mul(c0).Add(bias), p3, c3) + v = v.AddSaturated(p1.Mul(c1)).AddSaturated(p2.Mul(c2)) + storeBytes8(dst[y*ds+x:], packBytes(filterShift7(v))) + p0, p1, p2 = p1, p2, p3 + } + } + return true +} diff --git a/internal/pixel/filter_six_vertical_arm64.go b/internal/pixel/filter_six_vertical_arm64.go new file mode 100644 index 0000000..53140ed --- /dev/null +++ b/internal/pixel/filter_six_vertical_arm64.go @@ -0,0 +1,299 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/filter_six_vertical_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import "simd/archsimd" + +// Rolling rows require disjoint input/output and non-overlapping output rows. +func filterVerticalRowsAllowed(src, dst []byte, ds, w, h int) bool { + if h < 2 || w%8 != 0 || ds < w || len(src) == 0 || len(dst) == 0 { + return false + } + return !slicesOverlap(src, dst, len(src), len(dst)) +} +func filterHorizSix16(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { + if int(taps[0])+int(taps[2])+int(taps[3])+int(taps[5]) > 256 { + return false + } + c0 := archsimd.BroadcastUint8x16(uint8(taps[0])) + c1 := archsimd.BroadcastUint8x16(uint8(-taps[1])) + c2 := archsimd.BroadcastUint8x16(uint8(taps[2])) + c3 := archsimd.BroadcastUint8x16(uint8(taps[3])) + c4 := archsimd.BroadcastUint8x16(uint8(-taps[4])) + c5 := archsimd.BroadcastUint8x16(uint8(taps[5])) + bias := archsimd.BroadcastUint16x8(64) + if w == 8 { + so, do := 0, 0 + z := archsimd.Uint8x16{} + for range h { + var v0, v1, v2, v3, v4, v5 archsimd.Uint8x16 + if len(src)-so >= 16 { + v0 = archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + v1 = z.ConcatShiftBytesRight(v0, 1) + v2 = z.ConcatShiftBytesRight(v0, 2) + v3 = z.ConcatShiftBytesRight(v0, 3) + v4 = z.ConcatShiftBytesRight(v0, 4) + v5 = z.ConcatShiftBytesRight(v0, 5) + } else { + v0, v1, v2 = load8(src[so:]), load8(src[so+1:]), load8(src[so+2:]) + v3, v4, v5 = load8(src[so+3:]), load8(src[so+4:]), load8(src[so+5:]) + } + pos := bias.Add(v0.MulWidenLo(c0)).Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v5.MulWidenLo(c5)) + neg := v1.MulWidenLo(c1).Add(v4.MulWidenLo(c4)) + storeBytes8(dst[do:], pos.SubSaturated(neg).ShiftAllRight(7).SaturateToUint8()) + so += ss + do += ds + } + return true + } + so, do := 0, 0 + for range h { + x := 0 + for ; x+16 <= w; x += 16 { + row := src[so+x : so+x+21] + v0 := archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])) + v1 := archsimd.LoadUint8x16Array((*[16]byte)(row[1:17])) + v2 := archsimd.LoadUint8x16Array((*[16]byte)(row[2:18])) + v3 := archsimd.LoadUint8x16Array((*[16]byte)(row[3:19])) + v4 := archsimd.LoadUint8x16Array((*[16]byte)(row[4:20])) + v5 := archsimd.LoadUint8x16Array((*[16]byte)(row[5:21])) + posLo := bias.Add(v0.MulWidenLo(c0)).Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v5.MulWidenLo(c5)) + negLo := v1.MulWidenLo(c1).Add(v4.MulWidenLo(c4)) + posHi := bias.Add(v0.HiToLo().MulWidenLo(c0)).Add(v2.HiToLo().MulWidenLo(c2)).Add(v3.HiToLo().MulWidenLo(c3)).Add(v5.HiToLo().MulWidenLo(c5)) + negHi := v1.HiToLo().MulWidenLo(c1).Add(v4.HiToLo().MulWidenLo(c4)) + outLo := posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8() + outHi := posHi.SubSaturated(negHi).ShiftAllRight(7).SaturateToUint8() + outLo.ReshapeToUint64s().InterleaveLo(outHi.ReshapeToUint64s()).ReshapeToUint8s().StoreArray((*[16]byte)(dst[do+x : do+x+16])) + } + if x < w { + v0, v1, v2 := load8(src[so+x:]), load8(src[so+x+1:]), load8(src[so+x+2:]) + v3, v4, v5 := load8(src[so+x+3:]), load8(src[so+x+4:]), load8(src[so+x+5:]) + pos := bias.Add(v0.MulWidenLo(c0)).Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v5.MulWidenLo(c5)) + neg := v1.MulWidenLo(c1).Add(v4.MulWidenLo(c4)) + storeBytes8(dst[do+x:], pos.SubSaturated(neg).ShiftAllRight(7).SaturateToUint8()) + } + so += ss + do += ds + } + return true +} + +func filterVerticalSix8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { + if !filterVerticalRowsAllowed(src, dst, ds, w, h) { + return false + } + if int(taps[0])+int(taps[2])+int(taps[3])+int(taps[5]) <= 256 { + c0 := archsimd.BroadcastUint8x16(uint8(taps[0])) + c1 := archsimd.BroadcastUint8x16(uint8(-taps[1])) + c2 := archsimd.BroadcastUint8x16(uint8(taps[2])) + c3 := archsimd.BroadcastUint8x16(uint8(taps[3])) + c4 := archsimd.BroadcastUint8x16(uint8(-taps[4])) + c5 := archsimd.BroadcastUint8x16(uint8(taps[5])) + bias := archsimd.BroadcastUint16x8(64) + x := 0 + for ; x+16 <= w; x += 16 { + v0 := archsimd.LoadUint8x16Array((*[16]byte)(src[0*ss+x : 0*ss+x+16])) + v1 := archsimd.LoadUint8x16Array((*[16]byte)(src[1*ss+x : 1*ss+x+16])) + v2 := archsimd.LoadUint8x16Array((*[16]byte)(src[2*ss+x : 2*ss+x+16])) + v3 := archsimd.LoadUint8x16Array((*[16]byte)(src[3*ss+x : 3*ss+x+16])) + v4 := archsimd.LoadUint8x16Array((*[16]byte)(src[4*ss+x : 4*ss+x+16])) + h0, h1, h2, h3, h4 := v0.HiToLo(), v1.HiToLo(), v2.HiToLo(), v3.HiToLo(), v4.HiToLo() + so, do := 5*ss+x, x + for range h { + v5 := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + h5 := v5.HiToLo() + posLo := bias.Add(v0.MulWidenLo(c0)).Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v5.MulWidenLo(c5)) + negLo := v1.MulWidenLo(c1).Add(v4.MulWidenLo(c4)) + posHi := bias.Add(h0.MulWidenLo(c0)).Add(h2.MulWidenLo(c2)).Add(h3.MulWidenLo(c3)).Add(h5.MulWidenLo(c5)) + negHi := h1.MulWidenLo(c1).Add(h4.MulWidenLo(c4)) + outLo := posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8() + outHi := posHi.SubSaturated(negHi).ShiftAllRight(7).SaturateToUint8() + outLo.ReshapeToUint64s().InterleaveLo(outHi.ReshapeToUint64s()).ReshapeToUint8s().StoreArray((*[16]byte)(dst[do : do+16])) + v0, v1, v2, v3, v4 = v1, v2, v3, v4, v5 + h0, h1, h2, h3, h4 = h1, h2, h3, h4, h5 + so += ss + do += ds + } + } + if x < w { + v0 := load8(src[0*ss+x:]) + v1 := load8(src[1*ss+x:]) + v2 := load8(src[2*ss+x:]) + v3 := load8(src[3*ss+x:]) + v4 := load8(src[4*ss+x:]) + so, do := 5*ss+x, x + for range h { + v5 := load8(src[so:]) + pos := bias.Add(v0.MulWidenLo(c0)).Add(v2.MulWidenLo(c2)).Add(v3.MulWidenLo(c3)).Add(v5.MulWidenLo(c5)) + neg := v1.MulWidenLo(c1).Add(v4.MulWidenLo(c4)) + storeBytes8(dst[do:], pos.SubSaturated(neg).ShiftAllRight(7).SaturateToUint8()) + v0, v1, v2, v3, v4 = v1, v2, v3, v4, v5 + so += ss + do += ds + } + } + return true + } + c0 := archsimd.BroadcastInt16x8(taps[0]) + c1 := archsimd.BroadcastInt16x8(taps[1]) + c2 := archsimd.BroadcastInt16x8(taps[2]) + c3 := archsimd.BroadcastInt16x8(taps[3]) + c4 := archsimd.BroadcastInt16x8(taps[4]) + c5 := archsimd.BroadcastInt16x8(taps[5]) + bias := archsimd.BroadcastInt16x8(64) + for x := 0; x < w; x += 8 { + p0 := widen8(load8(src[0*ss+x:])) + p1 := widen8(load8(src[1*ss+x:])) + p2 := widen8(load8(src[2*ss+x:])) + p3 := widen8(load8(src[3*ss+x:])) + p4 := widen8(load8(src[4*ss+x:])) + for y := range h { + p5 := widen8(load8(src[(y+5)*ss+x:])) + v := mulAdd16(p1.Mul(c1).Add(bias), p4, c4) + v = v.AddSaturated(p0.Mul(c0)).AddSaturated(p2.Mul(c2)).AddSaturated(p3.Mul(c3)).AddSaturated(p5.Mul(c5)) + storeBytes8(dst[y*ds+x:], packBytes(filterShift7(v))) + p0, p1, p2, p3, p4 = p1, p2, p3, p4, p5 + } + } + return true +} +func filterHorizFour16(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { + if int(taps[1])+int(taps[2]) > 256 { + return false + } + c0 := archsimd.BroadcastUint8x16(uint8(-taps[0])) + c1 := archsimd.BroadcastUint8x16(uint8(taps[1])) + c2 := archsimd.BroadcastUint8x16(uint8(taps[2])) + c3 := archsimd.BroadcastUint8x16(uint8(-taps[3])) + bias := archsimd.BroadcastUint16x8(64) + if w == 8 { + so, do := 0, 0 + z := archsimd.Uint8x16{} + for range h { + var v0, v1, v2, v3 archsimd.Uint8x16 + if len(src)-so >= 16 { + v0 = archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + v1 = z.ConcatShiftBytesRight(v0, 1) + v2 = z.ConcatShiftBytesRight(v0, 2) + v3 = z.ConcatShiftBytesRight(v0, 3) + } else { + v0, v1 = load8(src[so:]), load8(src[so+1:]) + v2, v3 = load8(src[so+2:]), load8(src[so+3:]) + } + pos := bias.Add(v1.MulWidenLo(c1)).Add(v2.MulWidenLo(c2)) + neg := v0.MulWidenLo(c0).Add(v3.MulWidenLo(c3)) + storeBytes8(dst[do:], pos.SubSaturated(neg).ShiftAllRight(7).SaturateToUint8()) + so += ss + do += ds + } + return true + } + so, do := 0, 0 + for range h { + x := 0 + for ; x+16 <= w; x += 16 { + row := src[so+x : so+x+19] + v0 := archsimd.LoadUint8x16Array((*[16]byte)(row[0:16])) + v1 := archsimd.LoadUint8x16Array((*[16]byte)(row[1:17])) + v2 := archsimd.LoadUint8x16Array((*[16]byte)(row[2:18])) + v3 := archsimd.LoadUint8x16Array((*[16]byte)(row[3:19])) + posLo := bias.Add(v1.MulWidenLo(c1)).Add(v2.MulWidenLo(c2)) + negLo := v0.MulWidenLo(c0).Add(v3.MulWidenLo(c3)) + posHi := bias.Add(v1.HiToLo().MulWidenLo(c1)).Add(v2.HiToLo().MulWidenLo(c2)) + negHi := v0.HiToLo().MulWidenLo(c0).Add(v3.HiToLo().MulWidenLo(c3)) + outLo := posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8() + outHi := posHi.SubSaturated(negHi).ShiftAllRight(7).SaturateToUint8() + outLo.ReshapeToUint64s().InterleaveLo(outHi.ReshapeToUint64s()).ReshapeToUint8s().StoreArray((*[16]byte)(dst[do+x : do+x+16])) + } + if x < w { + v0, v1 := load8(src[so+x:]), load8(src[so+x+1:]) + v2, v3 := load8(src[so+x+2:]), load8(src[so+x+3:]) + pos := bias.Add(v1.MulWidenLo(c1)).Add(v2.MulWidenLo(c2)) + neg := v0.MulWidenLo(c0).Add(v3.MulWidenLo(c3)) + storeBytes8(dst[do+x:], pos.SubSaturated(neg).ShiftAllRight(7).SaturateToUint8()) + } + so += ss + do += ds + } + return true +} + +func filterVerticalFour8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { + if !filterVerticalRowsAllowed(src, dst, ds, w, h) { + return false + } + if int(taps[1])+int(taps[2]) <= 256 { + c0 := archsimd.BroadcastUint8x16(uint8(-taps[0])) + c1 := archsimd.BroadcastUint8x16(uint8(taps[1])) + c2 := archsimd.BroadcastUint8x16(uint8(taps[2])) + c3 := archsimd.BroadcastUint8x16(uint8(-taps[3])) + bias := archsimd.BroadcastUint16x8(64) + x := 0 + for ; x+16 <= w; x += 16 { + v0 := archsimd.LoadUint8x16Array((*[16]byte)(src[0*ss+x : 0*ss+x+16])) + v1 := archsimd.LoadUint8x16Array((*[16]byte)(src[1*ss+x : 1*ss+x+16])) + v2 := archsimd.LoadUint8x16Array((*[16]byte)(src[2*ss+x : 2*ss+x+16])) + h0, h1, h2 := v0.HiToLo(), v1.HiToLo(), v2.HiToLo() + so, do := 3*ss+x, x + for range h { + v3 := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + h3 := v3.HiToLo() + posLo := bias.Add(v1.MulWidenLo(c1)).Add(v2.MulWidenLo(c2)) + negLo := v0.MulWidenLo(c0).Add(v3.MulWidenLo(c3)) + posHi := bias.Add(h1.MulWidenLo(c1)).Add(h2.MulWidenLo(c2)) + negHi := h0.MulWidenLo(c0).Add(h3.MulWidenLo(c3)) + outLo := posLo.SubSaturated(negLo).ShiftAllRight(7).SaturateToUint8() + outHi := posHi.SubSaturated(negHi).ShiftAllRight(7).SaturateToUint8() + outLo.ReshapeToUint64s().InterleaveLo(outHi.ReshapeToUint64s()).ReshapeToUint8s().StoreArray((*[16]byte)(dst[do : do+16])) + v0, v1, v2 = v1, v2, v3 + h0, h1, h2 = h1, h2, h3 + so += ss + do += ds + } + } + if x < w { + v0 := load8(src[0*ss+x:]) + v1 := load8(src[1*ss+x:]) + v2 := load8(src[2*ss+x:]) + so, do := 3*ss+x, x + for range h { + v3 := load8(src[so:]) + pos := bias.Add(v1.MulWidenLo(c1)).Add(v2.MulWidenLo(c2)) + neg := v0.MulWidenLo(c0).Add(v3.MulWidenLo(c3)) + storeBytes8(dst[do:], pos.SubSaturated(neg).ShiftAllRight(7).SaturateToUint8()) + v0, v1, v2 = v1, v2, v3 + so += ss + do += ds + } + } + return true + } + c0 := archsimd.BroadcastInt16x8(taps[0]) + c1 := archsimd.BroadcastInt16x8(taps[1]) + c2 := archsimd.BroadcastInt16x8(taps[2]) + c3 := archsimd.BroadcastInt16x8(taps[3]) + bias := archsimd.BroadcastInt16x8(64) + for x := 0; x < w; x += 8 { + p0 := widen8(load8(src[0*ss+x:])) + p1 := widen8(load8(src[1*ss+x:])) + p2 := widen8(load8(src[2*ss+x:])) + for y := range h { + p3 := widen8(load8(src[(y+3)*ss+x:])) + v := mulAdd16(p0.Mul(c0).Add(bias), p3, c3) + v = v.AddSaturated(p1.Mul(c1)).AddSaturated(p2.Mul(c2)) + storeBytes8(dst[y*ds+x:], packBytes(filterShift7(v))) + p0, p1, p2 = p1, p2, p3 + } + } + return true +} diff --git a/internal/pixel/goav1_convolve_simd.go b/internal/pixel/goav1_convolve_simd.go new file mode 100644 index 0000000..70275ea --- /dev/null +++ b/internal/pixel/goav1_convolve_simd.go @@ -0,0 +1,235 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/goav1_convolve_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// A zero-padded eight-tap coefficient block is shared by VP8 and VP9. +type hbdTaps16 = [8]archsimd.Int16x8 + +// Read exactly eight bytes; the last codec row may have no trailing padding. +func u8Samples8(pix []byte) archsimd.Int16x8 { return widen8(load8(pix)) } + +func u8SumRowX(pix []byte, t *hbdTaps16, n int) (lo, hi archsimd.Int32x4) { + lo = archsimd.BroadcastInt32x4(0) + hi = lo + if len(pix) < 16 { + for k := range n { + lo, hi = mac(lo, hi, u8Samples8(pix[k:]), t[k]) + } + return lo, hi + } + a := archsimd.LoadUint8x16(pix[:16]) + b := archsimd.Uint8x16{} + lo, hi = mac(lo, hi, a.ExtendLo8ToUint16().BitsToInt16(), t[0]) + lo, hi = mac(lo, hi, b.ConcatShiftBytesRight(a, 1).ExtendLo8ToUint16().BitsToInt16(), t[1]) + lo, hi = mac(lo, hi, b.ConcatShiftBytesRight(a, 2).ExtendLo8ToUint16().BitsToInt16(), t[2]) + lo, hi = mac(lo, hi, b.ConcatShiftBytesRight(a, 3).ExtendLo8ToUint16().BitsToInt16(), t[3]) + lo, hi = mac(lo, hi, b.ConcatShiftBytesRight(a, 4).ExtendLo8ToUint16().BitsToInt16(), t[4]) + lo, hi = mac(lo, hi, b.ConcatShiftBytesRight(a, 5).ExtendLo8ToUint16().BitsToInt16(), t[5]) + lo, hi = mac(lo, hi, b.ConcatShiftBytesRight(a, 6).ExtendLo8ToUint16().BitsToInt16(), t[6]) + lo, hi = mac(lo, hi, b.ConcatShiftBytesRight(a, 7).ExtendLo8ToUint16().BitsToInt16(), t[7]) + return lo, hi +} + +func u8SumColY(pix []byte, step int, t *hbdTaps16, n int) (lo, hi archsimd.Int32x4) { + lo = archsimd.BroadcastInt32x4(0) + hi = lo + for k := range n { + lo, hi = mac(lo, hi, u8Samples8(pix[k*step:]), t[k]) + } + return lo, hi +} + +func pixelDiffAcc(sse, sum archsimd.Int32x4, a, b archsimd.Uint8x16) (archsimd.Int32x4, archsimd.Int32x4) { + lo := a.ExtendLo8ToUint16().BitsToInt16().Sub(b.ExtendLo8ToUint16().BitsToInt16()) + hi := widenHi8(a).BitsToInt16().Sub(widenHi8(b).BitsToInt16()) + sse = sse.Add(square8(lo)).Add(square8(hi)) + sum = sum.Add(sumDiff16(lo.Add(hi))) + return sse, sum +} + +func reducePixelAcc(sse, sum archsimd.Int32x4) (total, signed pixelStatsReduction) { + // ARM reduces before crossing to scalar registers. Keep the original + // scalar extraction on amd64, where native short-row measurements win. + if vectorPixelAccReduction { + return pixelStatsReduction(sum32(sse)), pixelStatsReduction(sum32(sum)) + } + total = pixelStatsReduction(sse.GetElem(0)) + pixelStatsReduction(sse.GetElem(1)) + pixelStatsReduction(sse.GetElem(2)) + pixelStatsReduction(sse.GetElem(3)) + signed = pixelStatsReduction(sum.GetElem(0)) + pixelStatsReduction(sum.GetElem(1)) + pixelStatsReduction(sum.GetElem(2)) + pixelStatsReduction(sum.GetElem(3)) + return total, signed +} + +func pixelStatsRows16(src []byte, srcStride int, ref []byte, refStride int, w, h int) (sse uint32, sum int32) { + if (uint(srcStride)|uint(refStride))>>57 == 0 && h > 0 && w == 32 && h <= 64 { + _ = src[(h-1)*srcStride+31] + _ = ref[(h-1)*refStride+31] + var s0, s1, s2, s3, sumAcc archsimd.Int32x4 + var sum16a, sum16b archsimd.Int16x8 + for r := range h { + a0 := archsimd.LoadUint8x16Array((*[16]byte)(src[0:16])) + b0 := archsimd.LoadUint8x16Array((*[16]byte)(ref[0:16])) + lo0 := a0.ExtendLo8ToUint16().BitsToInt16().Sub(b0.ExtendLo8ToUint16().BitsToInt16()) + hi0 := widenHi8(a0).BitsToInt16().Sub(widenHi8(b0).BitsToInt16()) + a1 := archsimd.LoadUint8x16Array((*[16]byte)(src[16:32])) + b1 := archsimd.LoadUint8x16Array((*[16]byte)(ref[16:32])) + lo1 := a1.ExtendLo8ToUint16().BitsToInt16().Sub(b1.ExtendLo8ToUint16().BitsToInt16()) + hi1 := widenHi8(a1).BitsToInt16().Sub(widenHi8(b1).BitsToInt16()) + // Max per-lane abs after 32 rows per accumulator: 32 * 2 * 255 = 16320 < 32767. + sum16a = sum16a.Add(lo0).Add(hi0) + sum16b = sum16b.Add(lo1).Add(hi1) + s0 = s0.Add(square8(lo0)) + s1 = s1.Add(square8(hi0)) + s2 = s2.Add(square8(lo1)) + s3 = s3.Add(square8(hi1)) + if r&31 == 31 { + sumAcc = sumAcc.Add(sumDiff16(sum16a)).Add(sumDiff16(sum16b)) + sum16a = archsimd.Int16x8{} + sum16b = archsimd.Int16x8{} + } + if r+1 < h { + src = src[srcStride:] + ref = ref[refStride:] + } + } + if h&31 != 0 { + sumAcc = sumAcc.Add(sumDiff16(sum16a)).Add(sumDiff16(sum16b)) + } + total, signed := reducePixelAcc(s0.Add(s1).Add(s2.Add(s3)), sumAcc) + return uint32(total), int32(signed) + } + if (uint(srcStride)|uint(refStride))>>57 == 0 && h > 0 && w == 64 && h <= 64 { + _ = src[(h-1)*srcStride+63] + _ = ref[(h-1)*refStride+63] + var s0, s1, s2, s3, sumAcc archsimd.Int32x4 + var sum16a, sum16b archsimd.Int16x8 + for r := range h { + a0 := archsimd.LoadUint8x16Array((*[16]byte)(src[0:16])) + b0 := archsimd.LoadUint8x16Array((*[16]byte)(ref[0:16])) + lo0 := a0.ExtendLo8ToUint16().BitsToInt16().Sub(b0.ExtendLo8ToUint16().BitsToInt16()) + hi0 := widenHi8(a0).BitsToInt16().Sub(widenHi8(b0).BitsToInt16()) + a1 := archsimd.LoadUint8x16Array((*[16]byte)(src[16:32])) + b1 := archsimd.LoadUint8x16Array((*[16]byte)(ref[16:32])) + lo1 := a1.ExtendLo8ToUint16().BitsToInt16().Sub(b1.ExtendLo8ToUint16().BitsToInt16()) + hi1 := widenHi8(a1).BitsToInt16().Sub(widenHi8(b1).BitsToInt16()) + a2 := archsimd.LoadUint8x16Array((*[16]byte)(src[32:48])) + b2 := archsimd.LoadUint8x16Array((*[16]byte)(ref[32:48])) + lo2 := a2.ExtendLo8ToUint16().BitsToInt16().Sub(b2.ExtendLo8ToUint16().BitsToInt16()) + hi2 := widenHi8(a2).BitsToInt16().Sub(widenHi8(b2).BitsToInt16()) + a3 := archsimd.LoadUint8x16Array((*[16]byte)(src[48:64])) + b3 := archsimd.LoadUint8x16Array((*[16]byte)(ref[48:64])) + lo3 := a3.ExtendLo8ToUint16().BitsToInt16().Sub(b3.ExtendLo8ToUint16().BitsToInt16()) + hi3 := widenHi8(a3).BitsToInt16().Sub(widenHi8(b3).BitsToInt16()) + // Max per-lane abs after 16 rows per accumulator: 16 * 4 * 255 = 16320 < 32767. + sum16a = sum16a.Add(lo0).Add(hi0).Add(lo1).Add(hi1) + sum16b = sum16b.Add(lo2).Add(hi2).Add(lo3).Add(hi3) + s0 = s0.Add(square8(lo0)).Add(square8(lo2)) + s1 = s1.Add(square8(hi0)).Add(square8(hi2)) + s2 = s2.Add(square8(lo1)).Add(square8(lo3)) + s3 = s3.Add(square8(hi1)).Add(square8(hi3)) + if r&15 == 15 { + sumAcc = sumAcc.Add(sumDiff16(sum16a)).Add(sumDiff16(sum16b)) + sum16a = archsimd.Int16x8{} + sum16b = archsimd.Int16x8{} + } + if r+1 < h { + src = src[srcStride:] + ref = ref[refStride:] + } + } + if h&15 != 0 { + sumAcc = sumAcc.Add(sumDiff16(sum16a)).Add(sumDiff16(sum16b)) + } + total, signed := reducePixelAcc(s0.Add(s1).Add(s2.Add(s3)), sumAcc) + return uint32(total), int32(signed) + } + sseAcc := archsimd.BroadcastInt32x4(0) + sumAcc := archsimd.BroadcastInt32x4(0) + for r := range h { + srow := src[r*srcStride : r*srcStride+w] + rrow := ref[r*refStride : r*refStride+w] + for c := 0; c < w; c += 16 { + sseAcc, sumAcc = pixelDiffAcc(sseAcc, sumAcc, archsimd.LoadUint8x16(srow[c:c+16]), archsimd.LoadUint8x16(rrow[c:c+16])) + } + } + total, signed := reducePixelAcc(sseAcc, sumAcc) + return uint32(total), int32(signed) +} + +func pixelStatsPairs8(src []byte, srcStride int, ref []byte, refStride int, h int) (sse uint32, sum int32) { + sseAcc := archsimd.BroadcastInt32x4(0) + sumAcc := archsimd.BroadcastInt32x4(0) + r := 0 + for ; r+2 <= h; r += 2 { + sseAcc, sumAcc = pixelDiffAcc(sseAcc, sumAcc, packRows8(src, r*srcStride, srcStride), packRows8(ref, r*refStride, refStride)) + } + if r < h { + srow, rrow := src[r*srcStride:], ref[r*refStride:] + if len(srow) < 8 || len(rrow) < 8 { + // Preserve the original scalar access/panic order for short rows. + total, signed := reducePixelAcc(sseAcc, sumAcc) + t, sg := pixelStatsPureGo(srow, srcStride, rrow, refStride, 8, 1) + return uint32(total + pixelStatsReduction(t)), int32(signed + pixelStatsReduction(sg)) + } + // The final eight pixels need only one exact low-half packet. + a := archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(srow)).ReshapeToUint8s() + b := archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(rrow)).ReshapeToUint8s() + delta := a.ExtendLo8ToUint16().BitsToInt16().Sub(b.ExtendLo8ToUint16().BitsToInt16()) + sseAcc = sseAcc.Add(square8(delta)) + sumAcc = sumAcc.Add(sumDiff16(delta)) + } + total, signed := reducePixelAcc(sseAcc, sumAcc) + return uint32(total), int32(signed) +} + +func packRows8(p []byte, off, stride int) archsimd.Uint8x16 { + lo := binary.LittleEndian.Uint64(p[off:]) + hi := binary.LittleEndian.Uint64(p[off+stride:]) + return archsimd.BroadcastUint64x2(lo).SetElem(1, hi).ReshapeToUint8s() +} + +// Four exact four-byte row loads fill one byte vector, eliminating the +// per-row widening/setup of the 4x4 and 4x8 variance hot paths. +func packRows4(p []byte, off, stride int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p[off:])).SetElem(1, binary.LittleEndian.Uint32(p[off+stride:])).SetElem(2, binary.LittleEndian.Uint32(p[off+2*stride:])).SetElem(3, binary.LittleEndian.Uint32(p[off+3*stride:])).ReshapeToUint8s() +} +func pixelStatsQuads4(src []byte, ss int, ref []byte, rs, h int) (uint32, int32) { + var sse, sum archsimd.Int32x4 + for y := 0; y < h; y += 4 { + sse, sum = pixelDiffAcc(sse, sum, packRows4(src, y*ss, ss), packRows4(ref, y*rs, rs)) + } + return uint32(sum32(sse)), sum32(sum) +} + +func pixelStatsSIMD(src []byte, srcStride int, ref []byte, refStride int, w, h int) (sse uint32, sum int32) { + switch { + case narrowPixelStats16 && w == 16 && h > 0 && h <= 64: + return pixelStats16Narrow(src, srcStride, ref, refStride, h) + case w == 4 && h%4 == 0: + return pixelStatsQuads4(src, srcStride, ref, refStride, h) + case w == 8: + return pixelStatsPairs8(src, srcStride, ref, refStride, h) + case w >= 16 && w&15 == 0: + return pixelStatsRows16(src, srcStride, ref, refStride, w, h) + } + return pixelStatsPureGo(src, srcStride, ref, refStride, w, h) +} + +// pixelStatsPureGo is govpx's glue for the extracted goav1 fallback contract. +func pixelStatsPureGo(src []byte, ss int, ref []byte, rs, w, h int) (uint32, int32) { + sum, sse := StatsScalar(src, ss, ref, rs, w, h) + return sse, int32(sum) +} diff --git a/internal/pixel/goav1_loopfilter_bytes_simd.go b/internal/pixel/goav1_loopfilter_bytes_simd.go new file mode 100644 index 0000000..19dbc72 --- /dev/null +++ b/internal/pixel/goav1_loopfilter_bytes_simd.go @@ -0,0 +1,695 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/goav1_loopfilter_bytes_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Byte-domain dataflow extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// Saturating the threshold sum is exact for block limits below 255. The +// complete int16 path retains the full public threshold domain. +func loopFilterByteWide(p []byte, q0, step, outer, n, blimit, limit, thresh, kind int) bool { + if n <= 0 || step <= 0 || outer <= 0 || n%8 != 0 || (kind != 2 && kind != 4 && kind != 6) || blimit < 0 || blimit >= 255 || limit < 0 || limit > 255 || thresh < 0 || thresh > 255 || (step != 1 && outer != 1) { + return false + } + // With positive strides these endpoints cover every exact 4/8/16-byte + // row load and each strictly smaller modified store window below. + left, right := 4, 3 + if kind == 2 { + left, right = 2, 1 + } + _ = p[q0-left*step] + _ = p[q0+right*step+(n-1)*outer] + chunk := 16 + // Preserve the original eight-position ordering for overlapping layouts. + if (outer == 1 && step < 16) || (step == 1 && outer < left+right+1) { + chunk = 8 + } + for base := 0; base < n; base += chunk { + lanes := min(chunk, n-base) + if lanes != 8 && lanes != 16 { + return false + } + loopFilterBytes(p, q0+base*outer, step, outer, lanes, blimit, limit, thresh, kind) + } + return true +} +func loadLFByte(p []byte, off, lanes int) archsimd.Uint8x16 { + if lanes == 8 { + return load8(p[off:]) + } + return archsimd.LoadUint8x16Array((*[16]byte)(p[off : off+16])) +} + +// The filter entry point has already proved the complete tile. Each shape +// reads only its exact four/eight bytes, with no per-row width dispatch. +func loadLFColumnTile[Size [4]byte | [8]byte](p []byte, off, pitch int) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + base := p[off:] + row := func(y int) archsimd.Uint8x16 { + at := base[y*pitch:] + var size Size + if len(size) == 4 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(at)).ReshapeToUint8s() + } + return archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(at)).ReshapeToUint8s() + } + var size Size + if len(size) == 4 { + a0, a1 := zipBytesLo(row(0), row(1)), zipBytesLo(row(2), row(3)) + a2, a3 := zipBytesLo(row(4), row(5)), zipBytesLo(row(6), row(7)) + b0, b2 := a0.InterleaveLo(a1).ReshapeToUint32s(), a2.InterleaveLo(a3).ReshapeToUint32s() + c01, c23 := b0.InterleaveLo(b2).ReshapeToUint8s(), b0.InterleaveHi(b2).ReshapeToUint8s() + z := archsimd.Uint8x16{} + return c01, highBytes(c01), c23, highBytes(c23), z, z, z, z + } + return transposeBytes8(row(0), row(1), row(2), row(3), row(4), row(5), row(6), row(7)) +} +func joinLFBytes(a, b archsimd.Uint8x16) archsimd.Uint8x16 { + return a.ReshapeToUint64s().InterleaveLo(b.ReshapeToUint64s()).ReshapeToUint8s() +} +func loadLFColumns[Size [4]byte | [8]byte](p []byte, off, pitch, lanes int) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + var size Size + if transposeLFColumns16 && lanes == 16 && len(size) == 8 { + return loadLFColumns16(p, off, pitch) + } + a0, a1, a2, a3, a4, a5, a6, a7 := loadLFColumnTile[Size](p, off, pitch) + if lanes == 8 { + return a0, a1, a2, a3, a4, a5, a6, a7 + } + b0, b1, b2, b3, b4, b5, b6, b7 := loadLFColumnTile[Size](p, off+8*pitch, pitch) + return joinLFBytes(a0, b0), joinLFBytes(a1, b1), joinLFBytes(a2, b2), joinLFBytes(a3, b3), joinLFBytes(a4, b4), joinLFBytes(a5, b5), joinLFBytes(a6, b6), joinLFBytes(a7, b7) +} +func lfAbsByte(a, b archsimd.Uint8x16) archsimd.Uint8x16 { return a.Max(b).Sub(a.Min(b)) } +func lfJoinSigned(a, b archsimd.Int8x16) archsimd.Int8x16 { + return joinLFBytes(a.ToBits(), b.ToBits()).BitsToInt8() +} +func lfMacroCorrection(f archsimd.Int8x16, c int16) archsimd.Int8x16 { + // The 9/18/27 corrections fit int8 after rounding (maximum +/-27). + k, bias := archsimd.BroadcastInt16x8(c), archsimd.BroadcastInt16x8(63) + lo := lfTruncSigned(filterShift7(f.ExtendLo8ToInt16().Mul(k).Add(bias))) + hi := lfTruncSigned(filterShift7(highBytes(f.ToBits()).BitsToInt8().ExtendLo8ToInt16().Mul(k).Add(bias))) + return lfJoinSigned(lo, hi) +} +func loopFilterBytes(p []byte, off, step, outer, lanes, blimit, limit, thresh, kind int) { + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Uint8x16 + if step == 1 && outer > 1 { + if kind == 2 { + a0, a1, a2, a3, _, _, _, _ := loadLFColumns[[4]byte](p, off-2, outer, lanes) + p1, p0, q0, q1 = a0, a1, a2, a3 + } else { + p3, p2, p1, p0, q0, q1, q2, q3 = loadLFColumns[[8]byte](p, off-4, outer, lanes) + } + } else { + p1, p0, q0, q1 = loadLFByte(p, off-2*step, lanes), loadLFByte(p, off-step, lanes), loadLFByte(p, off, lanes), loadLFByte(p, off+step, lanes) + if kind != 2 { + p3, p2, q2, q3 = loadLFByte(p, off-4*step, lanes), loadLFByte(p, off-3*step, lanes), loadLFByte(p, off+2*step, lanes), loadLFByte(p, off+3*step, lanes) + } + } + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(blimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) == 0 { + return + } + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-2*step, step, outer, lanes, 4, np1, np0, nq0, nq1, z, z) +} +func storeLFBytes(p []byte, off, step, outer, lanes, count int, a, b, c, d, e, f archsimd.Uint8x16) { + if outer == 1 { + store := func(at int, v archsimd.Uint8x16) { + if lanes == 16 { + v.StoreArray((*[16]byte)(p[at : at+16])) + } else { + binary.LittleEndian.PutUint64(p[at:], v.ReshapeToUint64s().GetElem(0)) + } + } + store(off, a) + store(off+step, b) + if count >= 4 { + store(off+2*step, c) + store(off+3*step, d) + } + if count == 6 { + store(off+4*step, e) + store(off+5*step, f) + } + return + } + storeLFByteTile(p, off, outer, count, a, b, c, d, e, f) + if lanes == 16 { + storeLFByteTile(p, off+8*outer, outer, count, highBytes(a), highBytes(b), highBytes(c), highBytes(d), highBytes(e), highBytes(f)) + } +} +func storeLFByteTile(p []byte, off, pitch, count int, a, b, c, d, e, f archsimd.Uint8x16) { + switch count { + case 2: + storeLFByteTileRows[[2]byte](p, off, pitch, a, b, c, d, e, f) + case 4: + storeLFByteTileRows[[4]byte](p, off, pitch, a, b, c, d, e, f) + case 6: + storeLFByteTileRows[[6]byte](p, off, pitch, a, b, c, d, e, f) + } +} + +func storeLFByteTileRows[Size [2]byte | [4]byte | [6]byte](p []byte, off, pitch int, a, b, c, d, e, f archsimd.Uint8x16) { + base := p[off:] + var width Size + if len(width) == 2 { + rows := zipBytesLo(a, b) + binary.LittleEndian.PutUint16(base, rows.GetElem(0)) + binary.LittleEndian.PutUint16(base[pitch:], rows.GetElem(1)) + binary.LittleEndian.PutUint16(base[2*pitch:], rows.GetElem(2)) + binary.LittleEndian.PutUint16(base[3*pitch:], rows.GetElem(3)) + binary.LittleEndian.PutUint16(base[4*pitch:], rows.GetElem(4)) + binary.LittleEndian.PutUint16(base[5*pitch:], rows.GetElem(5)) + binary.LittleEndian.PutUint16(base[6*pitch:], rows.GetElem(6)) + binary.LittleEndian.PutUint16(base[7*pitch:], rows.GetElem(7)) + return + } + if len(width) == 4 { + ab, cd := zipBytesLo(a, b), zipBytesLo(c, d) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(base, lo.GetElem(0)) + binary.LittleEndian.PutUint32(base[pitch:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(base[2*pitch:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(base[3*pitch:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(base[4*pitch:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(base[5*pitch:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(base[6*pitch:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(base[7*pitch:], hi.GetElem(3)) + return + } + z := archsimd.Uint8x16{} + r0, r1, r2, r3, r4, r5, r6, r7 := transposeBytes8(a, b, c, d, e, f, z, z) + // The size is constant in each instantiation. Unrolling keeps the + // transposed row values in registers until their exact-width store. + store := func(y int, row archsimd.Uint8x16) { + var size Size + v := row.ReshapeToUint64s().GetElem(0) + dest := base[y*pitch:] + if len(size) == 2 { + binary.LittleEndian.PutUint16(dest, uint16(v)) + } else { + binary.LittleEndian.PutUint32(dest, uint32(v)) + if len(size) == 6 { + binary.LittleEndian.PutUint16(dest[4:], uint16(v>>32)) + } + } + } + store(0, r0) + store(1, r1) + store(2, r2) + store(3, r3) + store(4, r4) + store(5, r5) + store(6, r6) + store(7, r7) +} + +func lfFilterDelta(outer, p0, q0 archsimd.Int8x16) archsimd.Int8x16 { + delta := q0.SubSaturated(p0) + return outer.AddSaturated(delta).AddSaturated(delta).AddSaturated(delta) +} + +// LoopFilterSimpleHorizontal16 applies the VP8 simple 16-pixel horizontal edge +// filter directly in byte-domain SIMD without multi-layer dispatch or normal-LF +// limit/hev work. s points at row p1 (2 rows above the edge). +func LoopFilterSimpleHorizontal16(s []byte, stride int, blimit byte) bool { + if stride < 16 || blimit >= 255 || 3*stride+16 > len(s) { + return false + } + p1 := archsimd.LoadUint8x16Array((*[16]byte)(s[0:16])) + p0 := archsimd.LoadUint8x16Array((*[16]byte)(s[stride : stride+16])) + q0 := archsimd.LoadUint8x16Array((*[16]byte)(s[2*stride : 2*stride+16])) + q1 := archsimd.LoadUint8x16Array((*[16]byte)(s[3*stride : 3*stride+16])) + d0, d3 := lfAbsByte(p0, q0), lfAbsByte(p1, q1) + need := lfByteLE(d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)), archsimd.BroadcastUint8x16(blimit)) + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) == 0 { + return true + } + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + f := lfFilterDelta(p1c.SubSaturated(q1c), p0c, q0c).Masked(need) + f1 := lfByteShift3(f.AddSaturated(archsimd.BroadcastInt8x16(4))) + f2 := lfByteShift3(f.AddSaturated(archsimd.BroadcastInt8x16(3))) + p0c.AddSaturated(f2).ToBits().Xor(bias).StoreArray((*[16]byte)(s[stride : stride+16])) + q0c.SubSaturated(f1).ToBits().Xor(bias).StoreArray((*[16]byte)(s[2*stride : 2*stride+16])) + return true +} + +// LoopFilterSimpleHorizontal3Inner16 filters the 3 inner 4-row horizontal +// subblock edges of a 16x16 macroblock (offsets 0, 4*stride, 8*stride from s, +// where s points at row yOff+2*stride) in one call with shared constants. +func LoopFilterSimpleHorizontal3Inner16(s []byte, stride int, blimit byte) bool { + if stride < 16 || blimit >= 255 || 11*stride+16 > len(s) { + return false + } + blimV := archsimd.BroadcastUint8x16(blimit) + bias := archsimd.BroadcastUint8x16(128) + c4 := archsimd.BroadcastInt8x16(4) + c3 := archsimd.BroadcastInt8x16(3) + off := 0 + for range 3 { + e := s[off:] + p1 := archsimd.LoadUint8x16Array((*[16]byte)(e[0:16])) + p0 := archsimd.LoadUint8x16Array((*[16]byte)(e[stride : stride+16])) + q0 := archsimd.LoadUint8x16Array((*[16]byte)(e[2*stride : 2*stride+16])) + q1 := archsimd.LoadUint8x16Array((*[16]byte)(e[3*stride : 3*stride+16])) + d0, d3 := lfAbsByte(p0, q0), lfAbsByte(p1, q1) + need := lfByteLE(d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)), blimV) + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + f := lfFilterDelta(p1c.SubSaturated(q1c), p0c, q0c).Masked(need) + f1 := lfByteShift3(f.AddSaturated(c4)) + f2 := lfByteShift3(f.AddSaturated(c3)) + p0c.AddSaturated(f2).ToBits().Xor(bias).StoreArray((*[16]byte)(e[stride : stride+16])) + q0c.SubSaturated(f1).ToBits().Xor(bias).StoreArray((*[16]byte)(e[2*stride : 2*stride+16])) + } + off += 4 * stride + } + return true +} + +// LoopFilterSimpleVertical16 applies the VP8 simple 16-pixel vertical edge +// filter directly in byte-domain SIMD. s points at column p1 (2 cols left of edge). +// Uses direct 4-byte row loads + 4x uint64 transposed stores (4 UMOVs instead +// of 16) to avoid generic tile-gather/scatter overhead. +func LoopFilterSimpleVertical16(s []byte, stride int, blimit byte) bool { + if stride < 4 || blimit >= 255 || 15*stride+4 > len(s) { + return false + } + // Gather 16x4 bytes (rows 0..15, columns [p1, p0, q0, q1]) into 4 Uint32x4 + // vectors and transpose into column vectors p1, p0, q0, q1. + _ = s[15*stride+3] + o1 := stride + o2 := o1 + stride + o3 := o2 + stride + o4 := o3 + stride + o5 := o4 + stride + o6 := o5 + stride + o7 := o6 + stride + o8 := o7 + stride + o9 := o8 + stride + o10 := o9 + stride + o11 := o10 + stride + o12 := o11 + stride + o13 := o12 + stride + o14 := o13 + stride + o15 := o14 + stride + s0, s1, s2, s3 := s[0:], s[o1:], s[o2:], s[o3:] + s4, s5, s6, s7 := s[o4:], s[o5:], s[o6:], s[o7:] + r0 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s0), binary.LittleEndian.Uint32(s4), + binary.LittleEndian.Uint32(s2), binary.LittleEndian.Uint32(s6), + }).ReshapeToUint8s() + r1 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s1), binary.LittleEndian.Uint32(s5), + binary.LittleEndian.Uint32(s3), binary.LittleEndian.Uint32(s7), + }).ReshapeToUint8s() + s8, s9, s10, s11 := s[o8:], s[o9:], s[o10:], s[o11:] + s12, s13, s14, s15 := s[o12:], s[o13:], s[o14:], s[o15:] + r2 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s8), binary.LittleEndian.Uint32(s12), + binary.LittleEndian.Uint32(s10), binary.LittleEndian.Uint32(s14), + }).ReshapeToUint8s() + r3 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s9), binary.LittleEndian.Uint32(s13), + binary.LittleEndian.Uint32(s11), binary.LittleEndian.Uint32(s15), + }).ReshapeToUint8s() + // 4x16 byte transpose in exact row order 0..15 (cross-arch arm64+amd64). + t0 := zipBytesLo(r0, r1) + t1 := zipBytesLo(highBytes(r0), highBytes(r1)) + t2 := zipBytesLo(r2, r3) + t3 := zipBytesLo(highBytes(r2), highBytes(r3)) + u0 := t0.InterleaveLo(t1).ReshapeToUint32s() + u1 := t0.InterleaveHi(t1).ReshapeToUint32s() + u2 := t2.InterleaveLo(t3).ReshapeToUint32s() + u3 := t2.InterleaveHi(t3).ReshapeToUint32s() + loP := u0.InterleaveLo(u1).ReshapeToUint64s() // p1[0..7], p0[0..7] + loQ := u0.InterleaveHi(u1).ReshapeToUint64s() // q0[0..7], q1[0..7] + hiP := u2.InterleaveLo(u3).ReshapeToUint64s() // p1[8..15], p0[8..15] + hiQ := u2.InterleaveHi(u3).ReshapeToUint64s() // q0[8..15], q1[8..15] + p1 := loP.InterleaveLo(hiP).ReshapeToUint8s() + p0 := loP.InterleaveHi(hiP).ReshapeToUint8s() + q0 := loQ.InterleaveLo(hiQ).ReshapeToUint8s() + q1 := loQ.InterleaveHi(hiQ).ReshapeToUint8s() + + d0, d3 := lfAbsByte(p0, q0), lfAbsByte(p1, q1) + need := lfByteLE(d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)), archsimd.BroadcastUint8x16(blimit)) + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) == 0 { + return true + } + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + f := lfFilterDelta(p1c.SubSaturated(q1c), p0c, q0c).Masked(need) + f1 := lfByteShift3(f.AddSaturated(archsimd.BroadcastInt8x16(4))) + f2 := lfByteShift3(f.AddSaturated(archsimd.BroadcastInt8x16(3))) + np0 := p0c.AddSaturated(f2).ToBits().Xor(bias) + nq0 := q0c.SubSaturated(f1).ToBits().Xor(bias) + // Interleave np0 and nq0 into 16 pairs of [p0, q0] and extract via 4 uint64s. + pairLo := zipBytesLo(np0, nq0).ReshapeToUint64s() + pairHi := zipBytesLo(highBytes(np0), highBytes(nq0)).ReshapeToUint64s() + v0, v1 := pairLo.GetElem(0), pairLo.GetElem(1) + v2, v3 := pairHi.GetElem(0), pairHi.GetElem(1) + binary.LittleEndian.PutUint16(s0[1:], uint16(v0)) + binary.LittleEndian.PutUint16(s1[1:], uint16(v0>>16)) + binary.LittleEndian.PutUint16(s2[1:], uint16(v0>>32)) + binary.LittleEndian.PutUint16(s3[1:], uint16(v0>>48)) + binary.LittleEndian.PutUint16(s4[1:], uint16(v1)) + binary.LittleEndian.PutUint16(s5[1:], uint16(v1>>16)) + binary.LittleEndian.PutUint16(s6[1:], uint16(v1>>32)) + binary.LittleEndian.PutUint16(s7[1:], uint16(v1>>48)) + binary.LittleEndian.PutUint16(s8[1:], uint16(v2)) + binary.LittleEndian.PutUint16(s9[1:], uint16(v2>>16)) + binary.LittleEndian.PutUint16(s10[1:], uint16(v2>>32)) + binary.LittleEndian.PutUint16(s11[1:], uint16(v2>>48)) + binary.LittleEndian.PutUint16(s12[1:], uint16(v3)) + binary.LittleEndian.PutUint16(s13[1:], uint16(v3>>16)) + binary.LittleEndian.PutUint16(s14[1:], uint16(v3>>32)) + binary.LittleEndian.PutUint16(s15[1:], uint16(v3>>48)) + return true +} + +// LoopFilterSimpleVertical3Inner16 filters the 3 inner 4-column vertical +// subblock edges of a 16x16 macroblock (columns +0, +4, +8 from s, where s +// points at yOff+2) in one call, sharing the 16 row slices and SIMD constants. +func LoopFilterSimpleVertical3Inner16(s []byte, stride int, blimit byte) bool { + if stride < 12 || blimit >= 255 || 15*stride+12 > len(s) { + return false + } + _ = s[15*stride+11] + o1 := stride + o2 := o1 + stride + o3 := o2 + stride + o4 := o3 + stride + o5 := o4 + stride + o6 := o5 + stride + o7 := o6 + stride + o8 := o7 + stride + o9 := o8 + stride + o10 := o9 + stride + o11 := o10 + stride + o12 := o11 + stride + o13 := o12 + stride + o14 := o13 + stride + o15 := o14 + stride + s0, s1, s2, s3 := s[0:12], s[o1:o1+12], s[o2:o2+12], s[o3:o3+12] + s4, s5, s6, s7 := s[o4:o4+12], s[o5:o5+12], s[o6:o6+12], s[o7:o7+12] + s8, s9, s10, s11 := s[o8:o8+12], s[o9:o9+12], s[o10:o10+12], s[o11:o11+12] + s12, s13, s14, s15 := s[o12:o12+12], s[o13:o13+12], s[o14:o14+12], s[o15:o15+12] + blimV := archsimd.BroadcastUint8x16(blimit) + bias := archsimd.BroadcastUint8x16(128) + c4 := archsimd.BroadcastInt8x16(4) + c3 := archsimd.BroadcastInt8x16(3) + for col := 0; col <= 8; col += 4 { + r0 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s0[col:]), binary.LittleEndian.Uint32(s4[col:]), + binary.LittleEndian.Uint32(s2[col:]), binary.LittleEndian.Uint32(s6[col:]), + }).ReshapeToUint8s() + r1 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s1[col:]), binary.LittleEndian.Uint32(s5[col:]), + binary.LittleEndian.Uint32(s3[col:]), binary.LittleEndian.Uint32(s7[col:]), + }).ReshapeToUint8s() + r2 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s8[col:]), binary.LittleEndian.Uint32(s12[col:]), + binary.LittleEndian.Uint32(s10[col:]), binary.LittleEndian.Uint32(s14[col:]), + }).ReshapeToUint8s() + r3 := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(s9[col:]), binary.LittleEndian.Uint32(s13[col:]), + binary.LittleEndian.Uint32(s11[col:]), binary.LittleEndian.Uint32(s15[col:]), + }).ReshapeToUint8s() + t0 := zipBytesLo(r0, r1) + t1 := zipBytesLo(highBytes(r0), highBytes(r1)) + t2 := zipBytesLo(r2, r3) + t3 := zipBytesLo(highBytes(r2), highBytes(r3)) + u0 := t0.InterleaveLo(t1).ReshapeToUint32s() + u1 := t0.InterleaveHi(t1).ReshapeToUint32s() + u2 := t2.InterleaveLo(t3).ReshapeToUint32s() + u3 := t2.InterleaveHi(t3).ReshapeToUint32s() + loP := u0.InterleaveLo(u1).ReshapeToUint64s() + loQ := u0.InterleaveHi(u1).ReshapeToUint64s() + hiP := u2.InterleaveLo(u3).ReshapeToUint64s() + hiQ := u2.InterleaveHi(u3).ReshapeToUint64s() + p1 := loP.InterleaveLo(hiP).ReshapeToUint8s() + p0 := loP.InterleaveHi(hiP).ReshapeToUint8s() + q0 := loQ.InterleaveLo(hiQ).ReshapeToUint8s() + q1 := loQ.InterleaveHi(hiQ).ReshapeToUint8s() + + d0, d3 := lfAbsByte(p0, q0), lfAbsByte(p1, q1) + need := lfByteLE(d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)), blimV) + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) == 0 { + continue + } + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + f := lfFilterDelta(p1c.SubSaturated(q1c), p0c, q0c).Masked(need) + f1 := lfByteShift3(f.AddSaturated(c4)) + f2 := lfByteShift3(f.AddSaturated(c3)) + np0 := p0c.AddSaturated(f2).ToBits().Xor(bias) + nq0 := q0c.SubSaturated(f1).ToBits().Xor(bias) + pairLo := zipBytesLo(np0, nq0).ReshapeToUint64s() + pairHi := zipBytesLo(highBytes(np0), highBytes(nq0)).ReshapeToUint64s() + v0, v1 := pairLo.GetElem(0), pairLo.GetElem(1) + v2, v3 := pairHi.GetElem(0), pairHi.GetElem(1) + w := col + 1 + binary.LittleEndian.PutUint16(s0[w:], uint16(v0)) + binary.LittleEndian.PutUint16(s1[w:], uint16(v0>>16)) + binary.LittleEndian.PutUint16(s2[w:], uint16(v0>>32)) + binary.LittleEndian.PutUint16(s3[w:], uint16(v0>>48)) + binary.LittleEndian.PutUint16(s4[w:], uint16(v1)) + binary.LittleEndian.PutUint16(s5[w:], uint16(v1>>16)) + binary.LittleEndian.PutUint16(s6[w:], uint16(v1>>32)) + binary.LittleEndian.PutUint16(s7[w:], uint16(v1>>48)) + binary.LittleEndian.PutUint16(s8[w:], uint16(v2)) + binary.LittleEndian.PutUint16(s9[w:], uint16(v2>>16)) + binary.LittleEndian.PutUint16(s10[w:], uint16(v2>>32)) + binary.LittleEndian.PutUint16(s11[w:], uint16(v2>>48)) + binary.LittleEndian.PutUint16(s12[w:], uint16(v3)) + binary.LittleEndian.PutUint16(s13[w:], uint16(v3>>16)) + binary.LittleEndian.PutUint16(s14[w:], uint16(v3>>32)) + binary.LittleEndian.PutUint16(s15[w:], uint16(v3>>48)) + } + return true +} + +func transpose16x16Uint8( + r0, r1, r2, r3, r4, r5, r6, r7, + r8, r9, r10, r11, r12, r13, r14, r15 archsimd.Uint8x16, +) ( + archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, + archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, + archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, + archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, +) { + // Pass 1: 8-bit interleave -> 16-bit pairs. + a0, a1 := zipBytesLo(r0, r1), zipBytesHi(r0, r1) + a2, a3 := zipBytesLo(r2, r3), zipBytesHi(r2, r3) + a4, a5 := zipBytesLo(r4, r5), zipBytesHi(r4, r5) + a6, a7 := zipBytesLo(r6, r7), zipBytesHi(r6, r7) + a8, a9 := zipBytesLo(r8, r9), zipBytesHi(r8, r9) + a10, a11 := zipBytesLo(r10, r11), zipBytesHi(r10, r11) + a12, a13 := zipBytesLo(r12, r13), zipBytesHi(r12, r13) + a14, a15 := zipBytesLo(r14, r15), zipBytesHi(r14, r15) + + // Pass 2: 16-bit interleave -> 32-bit quads. + b0, b1 := a0.InterleaveLo(a2).ReshapeToUint32s(), a0.InterleaveHi(a2).ReshapeToUint32s() + b2, b3 := a1.InterleaveLo(a3).ReshapeToUint32s(), a1.InterleaveHi(a3).ReshapeToUint32s() + b4, b5 := a4.InterleaveLo(a6).ReshapeToUint32s(), a4.InterleaveHi(a6).ReshapeToUint32s() + b6, b7 := a5.InterleaveLo(a7).ReshapeToUint32s(), a5.InterleaveHi(a7).ReshapeToUint32s() + b8, b9 := a8.InterleaveLo(a10).ReshapeToUint32s(), a8.InterleaveHi(a10).ReshapeToUint32s() + b10, b11 := a9.InterleaveLo(a11).ReshapeToUint32s(), a9.InterleaveHi(a11).ReshapeToUint32s() + b12, b13 := a12.InterleaveLo(a14).ReshapeToUint32s(), a12.InterleaveHi(a14).ReshapeToUint32s() + b14, b15 := a13.InterleaveLo(a15).ReshapeToUint32s(), a13.InterleaveHi(a15).ReshapeToUint32s() + + // Pass 3: 32-bit interleave -> 64-bit octets. + cl0, cl1 := b0.InterleaveLo(b4).ReshapeToUint64s(), b0.InterleaveHi(b4).ReshapeToUint64s() + cl2, cl3 := b1.InterleaveLo(b5).ReshapeToUint64s(), b1.InterleaveHi(b5).ReshapeToUint64s() + cl4, cl5 := b2.InterleaveLo(b6).ReshapeToUint64s(), b2.InterleaveHi(b6).ReshapeToUint64s() + cl6, cl7 := b3.InterleaveLo(b7).ReshapeToUint64s(), b3.InterleaveHi(b7).ReshapeToUint64s() + ch0, ch1 := b8.InterleaveLo(b12).ReshapeToUint64s(), b8.InterleaveHi(b12).ReshapeToUint64s() + ch2, ch3 := b9.InterleaveLo(b13).ReshapeToUint64s(), b9.InterleaveHi(b13).ReshapeToUint64s() + ch4, ch5 := b10.InterleaveLo(b14).ReshapeToUint64s(), b10.InterleaveHi(b14).ReshapeToUint64s() + ch6, ch7 := b11.InterleaveLo(b15).ReshapeToUint64s(), b11.InterleaveHi(b15).ReshapeToUint64s() + + // Pass 4: 64-bit interleave -> 16-byte columns. + return cl0.InterleaveLo(ch0).ReshapeToUint8s(), cl0.InterleaveHi(ch0).ReshapeToUint8s(), + cl1.InterleaveLo(ch1).ReshapeToUint8s(), cl1.InterleaveHi(ch1).ReshapeToUint8s(), + cl2.InterleaveLo(ch2).ReshapeToUint8s(), cl2.InterleaveHi(ch2).ReshapeToUint8s(), + cl3.InterleaveLo(ch3).ReshapeToUint8s(), cl3.InterleaveHi(ch3).ReshapeToUint8s(), + cl4.InterleaveLo(ch4).ReshapeToUint8s(), cl4.InterleaveHi(ch4).ReshapeToUint8s(), + cl5.InterleaveLo(ch5).ReshapeToUint8s(), cl5.InterleaveHi(ch5).ReshapeToUint8s(), + cl6.InterleaveLo(ch6).ReshapeToUint8s(), cl6.InterleaveHi(ch6).ReshapeToUint8s(), + cl7.InterleaveLo(ch7).ReshapeToUint8s(), cl7.InterleaveHi(ch7).ReshapeToUint8s() +} + +func lfSimpleEdge(p1, p0, q0, q1, blimV, bias archsimd.Uint8x16, c4, c3 archsimd.Int8x16) (archsimd.Uint8x16, archsimd.Uint8x16, uint64) { + d0, d3 := lfAbsByte(p0, q0), lfAbsByte(p1, q1) + need := lfByteLE(d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)), blimV) + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + changed := bits.GetElem(0) | bits.GetElem(1) + if changed == 0 { + return p0, q0, 0 + } + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + f := lfFilterDelta(p1c.SubSaturated(q1c), p0c, q0c).Masked(need) + f1 := lfByteShift3(f.AddSaturated(c4)) + f2 := lfByteShift3(f.AddSaturated(c3)) + return p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias), changed +} + +// LoopFilterSimpleVertical4All16 filters all 4 vertical edges of a 16x16 +// macroblock (MB left edge at cols 0..3 with mblimit, plus the 3 inner edges at +// cols 4..7, 8..11, 12..15 with blimit) via a single 16x16 SIMD transpose. +// s must point at yOff-2 (col -2 of the macroblock). +func LoopFilterSimpleVertical4All16(s []byte, stride int, mblimit, blimit byte) bool { + if stride < 16 || mblimit >= 255 || blimit >= 255 || 15*stride+16 > len(s) { + return false + } + _ = s[15*stride+15] + o1 := stride + o2 := o1 + stride + o3 := o2 + stride + o4 := o3 + stride + o5 := o4 + stride + o6 := o5 + stride + o7 := o6 + stride + o8 := o7 + stride + o9 := o8 + stride + o10 := o9 + stride + o11 := o10 + stride + o12 := o11 + stride + o13 := o12 + stride + o14 := o13 + stride + o15 := o14 + stride + + p0 := (*[16]byte)(s[0:16]) + p1 := (*[16]byte)(s[o1 : o1+16]) + p2 := (*[16]byte)(s[o2 : o2+16]) + p3 := (*[16]byte)(s[o3 : o3+16]) + p4 := (*[16]byte)(s[o4 : o4+16]) + p5 := (*[16]byte)(s[o5 : o5+16]) + p6 := (*[16]byte)(s[o6 : o6+16]) + p7 := (*[16]byte)(s[o7 : o7+16]) + p8 := (*[16]byte)(s[o8 : o8+16]) + p9 := (*[16]byte)(s[o9 : o9+16]) + p10 := (*[16]byte)(s[o10 : o10+16]) + p11 := (*[16]byte)(s[o11 : o11+16]) + p12 := (*[16]byte)(s[o12 : o12+16]) + p13 := (*[16]byte)(s[o13 : o13+16]) + p14 := (*[16]byte)(s[o14 : o14+16]) + p15 := (*[16]byte)(s[o15 : o15+16]) + + r0 := archsimd.LoadUint8x16Array(p0) + r1 := archsimd.LoadUint8x16Array(p1) + r2 := archsimd.LoadUint8x16Array(p2) + r3 := archsimd.LoadUint8x16Array(p3) + r4 := archsimd.LoadUint8x16Array(p4) + r5 := archsimd.LoadUint8x16Array(p5) + r6 := archsimd.LoadUint8x16Array(p6) + r7 := archsimd.LoadUint8x16Array(p7) + r8 := archsimd.LoadUint8x16Array(p8) + r9 := archsimd.LoadUint8x16Array(p9) + r10 := archsimd.LoadUint8x16Array(p10) + r11 := archsimd.LoadUint8x16Array(p11) + r12 := archsimd.LoadUint8x16Array(p12) + r13 := archsimd.LoadUint8x16Array(p13) + r14 := archsimd.LoadUint8x16Array(p14) + r15 := archsimd.LoadUint8x16Array(p15) + + c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15 := transpose16x16Uint8( + r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, + ) + + mblimV := archsimd.BroadcastUint8x16(mblimit) + blimV := archsimd.BroadcastUint8x16(blimit) + bias := archsimd.BroadcastUint8x16(128) + c4v := archsimd.BroadcastInt8x16(4) + c3v := archsimd.BroadcastInt8x16(3) + + var ch0, ch1, ch2, ch3 uint64 + c1, c2, ch0 = lfSimpleEdge(c0, c1, c2, c3, mblimV, bias, c4v, c3v) + c5, c6, ch1 = lfSimpleEdge(c4, c5, c6, c7, blimV, bias, c4v, c3v) + c9, c10, ch2 = lfSimpleEdge(c8, c9, c10, c11, blimV, bias, c4v, c3v) + c13, c14, ch3 = lfSimpleEdge(c12, c13, c14, c15, blimV, bias, c4v, c3v) + if (ch0 | ch1 | ch2 | ch3) == 0 { + return true + } + + r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15 = transpose16x16Uint8( + c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, + ) + + r0.StoreArray(p0) + r1.StoreArray(p1) + r2.StoreArray(p2) + r3.StoreArray(p3) + r4.StoreArray(p4) + r5.StoreArray(p5) + r6.StoreArray(p6) + r7.StoreArray(p7) + r8.StoreArray(p8) + r9.StoreArray(p9) + r10.StoreArray(p10) + r11.StoreArray(p11) + r12.StoreArray(p12) + r13.StoreArray(p13) + r14.StoreArray(p14) + r15.StoreArray(p15) + return true +} diff --git a/internal/pixel/goav1_ops_amd64.go b/internal/pixel/goav1_ops_amd64.go new file mode 100644 index 0000000..4a194c7 --- /dev/null +++ b/internal/pixel/goav1_ops_amd64.go @@ -0,0 +1,21 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/goav1_ops_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "simd/archsimd" +) + +func widenHi8(v archsimd.Uint8x16) archsimd.Uint16x8 { + return highBytes(v).ExtendLo8ToUint16() +} diff --git a/internal/pixel/goav1_ops_arm64.go b/internal/pixel/goav1_ops_arm64.go new file mode 100644 index 0000000..0707daf --- /dev/null +++ b/internal/pixel/goav1_ops_arm64.go @@ -0,0 +1,37 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/goav1_ops_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "simd/archsimd" +) + +func loopFilterWide(p []byte, q0, step, outer, n, blimit, limit, thresh, kind int) bool { + return loopFilterByteWide(p, q0, step, outer, n, blimit, limit, thresh, kind) +} + +var lfByteRight1 = archsimd.BroadcastInt8x16(-1) +var lfByteRight3 = archsimd.BroadcastInt8x16(-3) + +func lfByteShift1(v archsimd.Int8x16) archsimd.Int8x16 { return v.Shift(lfByteRight1) } +func lfByteShift3(v archsimd.Int8x16) archsimd.Int8x16 { return v.Shift(lfByteRight3) } +func lfByteHalf(v archsimd.Uint8x16) archsimd.Uint8x16 { return v.Shift(lfByteRight1) } +func lfByteLE(a, b archsimd.Uint8x16) archsimd.Mask8x16 { return a.LessEqual(b) } +func lfByteGT(a, b archsimd.Uint8x16) archsimd.Mask8x16 { return a.Greater(b) } +func lfTruncSigned(v archsimd.Int16x8) archsimd.Int8x16 { return v.TruncToInt8() } + +func lfByteNot(v archsimd.Mask8x16) archsimd.Mask8x16 { return v.Not() } + +func widenHi8(v archsimd.Uint8x16) archsimd.Uint16x8 { + return v.HiToLo().ExtendLo8ToUint16() +} diff --git a/internal/pixel/helpers_amd64.go b/internal/pixel/helpers_amd64.go new file mode 100644 index 0000000..e84e8d3 --- /dev/null +++ b/internal/pixel/helpers_amd64.go @@ -0,0 +1,103 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/helpers_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +func load8(b []byte) archsimd.Uint8x16 { + return archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(b)).ReshapeToUint8s() +} +func storeBytes8(b []byte, v archsimd.Uint8x16) { + binary.LittleEndian.PutUint64(b, v.ReshapeToUint64s().GetElem(0)) +} + +func widen8(v archsimd.Uint8x16) archsimd.Int16x8 { return v.ExtendLo8ToUint16().BitsToInt16() } +func high4(v archsimd.Int16x8) archsimd.Int32x4 { + return v.ToBits().ReshapeToUint32s().BitsToInt32().PermuteScalars(2, 3, 0, 1).ToBits().ReshapeToUint16s().BitsToInt16().ExtendLo4ToInt32() +} +func mac(lo, hi archsimd.Int32x4, v, c archsimd.Int16x8) (archsimd.Int32x4, archsimd.Int32x4) { + c32 := c.ExtendLo4ToInt32() + return lo.Add(v.ExtendLo4ToInt32().Mul(c32)), hi.Add(high4(v).Mul(c32)) +} +func packBytes(v archsimd.Int16x8) archsimd.Uint8x16 { + return v.Max(archsimd.LoadInt16x8Array(&packZero16)).Min(archsimd.BroadcastInt16x8(255)).ToBits().ReshapeToUint8s().PermuteOrZero(archsimd.LoadInt8x16Array(&packByteIndices)) +} +func store8(b []byte, lo, hi archsimd.Int32x4) { + storeBytes8(b, packBytes(lo.SaturateToInt16Concat(hi))) +} + +// A VEX load avoids Go 1.27's legacy MOVUPS from its zero XMM register +// while a caller still has live AVX2 vectors. +var packZero16 [8]int16 + +var packByteIndices = [16]int8{0, 2, 4, 6, 8, 10, 12, 14, -128, -128, -128, -128, -128, -128, -128, -128} + +func StorePixels4(s []byte, v archsimd.Int32x4) { + binary.LittleEndian.PutUint32(s, packBytes(v.SaturateToInt16Concat(v)).ReshapeToUint32s().GetElem(0)) +} +func sum32(v archsimd.Int32x4) int32 { + v = v.Add(v.PermuteScalars(2, 3, 0, 1)) + return v.Add(v.PermuteScalars(1, 0, 3, 2)).GetElem(0) +} + +func highBytes(v archsimd.Uint8x16) archsimd.Uint8x16 { + return v.ReshapeToUint32s().PermuteScalars(2, 3, 0, 1).ReshapeToUint8s() +} + +func permute16(v, i archsimd.Uint8x16) archsimd.Uint8x16 { return v.PermuteOrZero(i.BitsToInt8()) } + +func filterVertical8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { return false } + +func RoundTransform4(v archsimd.Int32x4) archsimd.Int32x4 { + return v.Add(archsimd.BroadcastInt32x4(8192)).ShiftAllRight(14) +} +func WrapTransform4(v archsimd.Int32x4) archsimd.Int32x4 { return v.ShiftAllLeft(16).ShiftAllRight(16) } + +func mulAdd16(sum, a, b archsimd.Int16x8) archsimd.Int16x8 { return a.Mul(b).Add(sum) } +func filterShift7(v archsimd.Int16x8) archsimd.Int16x8 { return v.ShiftAllRight(7) } + +func filterVerticalNarrow8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16, mode int) bool { + return false +} + +func MulAdd4(a, b, c archsimd.Int32x4) archsimd.Int32x4 { return a.Mul(b).Add(c) } +func MulAdd8(a, b, c archsimd.Int32x8) archsimd.Int32x8 { return a.Mul(b).Add(c) } + +func zipBytesLo(a, b archsimd.Uint8x16) archsimd.Uint16x8 { + return a.ExtendLo8ToUint16().Or(b.ExtendLo8ToUint16().ShiftAllLeft(8)) +} + +func zipBytesHi(a, b archsimd.Uint8x16) archsimd.Uint16x8 { + return zipBytesLo(highBytes(a), highBytes(b)) +} + +func square8(v archsimd.Int16x8) archsimd.Int32x4 { return v.DotProductPairs(v) } +func sumDiff16(v archsimd.Int16x8) archsimd.Int32x4 { + return v.DotProductPairs(archsimd.BroadcastInt16x8(1)) +} + +func lfShift3(v archsimd.Int16x8) archsimd.Int16x8 { return v.ShiftAllRight(3) } +func lfShift1(v archsimd.Int16x8) archsimd.Int16x8 { return v.ShiftAllRight(1) } + +func satInt16ToUint8(v archsimd.Int16x8) archsimd.Uint8x16 { + return v.Max(archsimd.Int16x8{}).Min(archsimd.BroadcastInt16x8(255)).ToBits().ReshapeToUint8s().PermuteOrZero(archsimd.LoadInt8x16Array(&packByteIndices)) +} + +// These compile-time-disabled ARM specializations retain the ordinary +// implementation here, without changing amd64's selected instruction bodies. +func loadLFColumns16(p []byte, off, pitch int) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + return loadLFColumns[[8]byte](p, off, pitch, 16) +} diff --git a/internal/pixel/helpers_arm64.go b/internal/pixel/helpers_arm64.go new file mode 100644 index 0000000..765cc24 --- /dev/null +++ b/internal/pixel/helpers_arm64.go @@ -0,0 +1,172 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/helpers_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +func load8(b []byte) archsimd.Uint8x16 { + return archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(b)).ReshapeToUint8s() +} +func storeBytes8(b []byte, v archsimd.Uint8x16) { + binary.LittleEndian.PutUint64(b, v.ReshapeToUint64s().GetElem(0)) +} + +func widen8(v archsimd.Uint8x16) archsimd.Int16x8 { return v.ExtendLo8ToUint16().BitsToInt16() } +func high4(v archsimd.Int16x8) archsimd.Int32x4 { return v.HiToLo().ExtendLo4ToInt32() } +func mac(lo, hi archsimd.Int32x4, v, c archsimd.Int16x8) (archsimd.Int32x4, archsimd.Int32x4) { + return lo.Add(v.MulWidenLo(c)), hi.Add(v.HiToLo().MulWidenLo(c)) +} +func packBytes(v archsimd.Int16x8) archsimd.Uint8x16 { return v.SaturateToUint8() } + +// Same narrowing layout as goav1's planePackPairI16/planeNarrowWord. +func store8(b []byte, lo, hi archsimd.Int32x4) { + l := lo.SaturateToInt16().ToBits().ReshapeToUint64s() + h := hi.SaturateToInt16().ToBits().ReshapeToUint64s() + storeBytes8(b, l.InterleaveLo(h).ReshapeToUint16s().BitsToInt16().SaturateToUint8()) +} + +func StorePixels4(s []byte, v archsimd.Int32x4) { + binary.LittleEndian.PutUint32(s, v.SaturateToInt16().SaturateToUint8().ReshapeToUint32s().GetElem(0)) +} +func sum32(v archsimd.Int32x4) int32 { return v.ReduceSum() } + +func highBytes(v archsimd.Uint8x16) archsimd.Uint8x16 { return v.HiToLo() } + +func permute16(v, i archsimd.Uint8x16) archsimd.Uint8x16 { return v.LookupOrZero(i) } + +// Keep the eight-tap vertical window in registers. Adjacent output rows +// share seven input rows; only the incoming row needs another memory load. +func filterVertical8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16) bool { + if len(taps) != 8 || w <= 0 || w%8 != 0 || h <= 0 || ss < 0 || ds < 0 { + return false + } + _ = src[(h+6)*ss+w-1] + _ = dst[(h-1)*ds+w-1] + c0 := archsimd.BroadcastInt16x8(taps[0]) + c1 := archsimd.BroadcastInt16x8(taps[1]) + c2 := archsimd.BroadcastInt16x8(taps[2]) + c3 := archsimd.BroadcastInt16x8(taps[3]) + c4 := archsimd.BroadcastInt16x8(taps[4]) + c5 := archsimd.BroadcastInt16x8(taps[5]) + c6 := archsimd.BroadcastInt16x8(taps[6]) + c7 := archsimd.BroadcastInt16x8(taps[7]) + bias := archsimd.BroadcastInt32x4(64) + for x := 0; x < w; x += 8 { + p0 := widen8(load8(src[0*ss+x:])) + p1 := widen8(load8(src[1*ss+x:])) + p2 := widen8(load8(src[2*ss+x:])) + p3 := widen8(load8(src[3*ss+x:])) + p4 := widen8(load8(src[4*ss+x:])) + p5 := widen8(load8(src[5*ss+x:])) + p6 := widen8(load8(src[6*ss+x:])) + for y := range h { + p7 := widen8(load8(src[(y+7)*ss+x:])) + lo, hi := bias, bias + lo, hi = mac(lo, hi, p0, c0) + lo, hi = mac(lo, hi, p1, c1) + lo, hi = mac(lo, hi, p2, c2) + lo, hi = mac(lo, hi, p3, c3) + lo, hi = mac(lo, hi, p4, c4) + lo, hi = mac(lo, hi, p5, c5) + lo, hi = mac(lo, hi, p6, c6) + lo, hi = mac(lo, hi, p7, c7) + store8(dst[y*ds+x:], lo.ShiftAllRight(7), hi.ShiftAllRight(7)) + p0, p1, p2, p3, p4, p5, p6 = p1, p2, p3, p4, p5, p6, p7 + } + } + return true +} + +func RoundTransform4(v archsimd.Int32x4) archsimd.Int32x4 { + return v.Add(archsimd.BroadcastInt32x4(8192)).ShiftAllRight(14) +} +func WrapTransform4(v archsimd.Int32x4) archsimd.Int32x4 { return v.TruncToInt16().ExtendLo4ToInt32() } + +func mulAdd16(sum, a, b archsimd.Int16x8) archsimd.Int16x8 { return a.MulAdd(b, sum) } + +func filterShift7(v archsimd.Int16x8) archsimd.Int16x8 { return v.ShiftAllRight(7) } + +func filterVerticalNarrow8(src []byte, ss int, dst []byte, ds, w, h int, taps []int16, mode int) bool { + if len(taps) != 8 || w <= 0 || w%8 != 0 || h <= 0 || ss < 0 || ds < 0 { + return false + } + _ = src[(h+6)*ss+w-1] + _ = dst[(h-1)*ds+w-1] + c0 := archsimd.BroadcastInt16x8(taps[0]) + c1 := archsimd.BroadcastInt16x8(taps[1]) + c2 := archsimd.BroadcastInt16x8(taps[2]) + c3 := archsimd.BroadcastInt16x8(taps[3]) + c4 := archsimd.BroadcastInt16x8(taps[4]) + c5 := archsimd.BroadcastInt16x8(taps[5]) + c6 := archsimd.BroadcastInt16x8(taps[6]) + c7 := archsimd.BroadcastInt16x8(taps[7]) + bias := archsimd.BroadcastInt16x8(64) + for x := 0; x < w; x += 8 { + p0 := widen8(load8(src[0*ss+x:])) + p1 := widen8(load8(src[1*ss+x:])) + p2 := widen8(load8(src[2*ss+x:])) + p3 := widen8(load8(src[3*ss+x:])) + p4 := widen8(load8(src[4*ss+x:])) + p5 := widen8(load8(src[5*ss+x:])) + p6 := widen8(load8(src[6*ss+x:])) + for y := range h { + p7 := widen8(load8(src[(y+7)*ss+x:])) + acc := bias + if mode == 1 { + acc = mulAdd16(acc, p0, c0) + acc = mulAdd16(acc, p2, c2) + acc = mulAdd16(acc, p5, c5) + acc = mulAdd16(acc, p7, c7) + acc = acc.AddSaturated(p1.Mul(c1)).AddSaturated(p3.Mul(c3)).AddSaturated(p4.Mul(c4)).AddSaturated(p6.Mul(c6)) + } else { + acc = mulAdd16(acc, p0, c0) + acc = mulAdd16(acc, p1, c1) + acc = mulAdd16(acc, p6, c6) + acc = mulAdd16(acc, p7, c7) + acc = acc.AddSaturated(p2.Mul(c2)).AddSaturated(p3.Mul(c3)).AddSaturated(p4.Mul(c4)).AddSaturated(p5.Mul(c5)) + } + storeBytes8(dst[y*ds+x:], packBytes(filterShift7(acc))) + p0, p1, p2, p3, p4, p5, p6 = p1, p2, p3, p4, p5, p6, p7 + } + } + return true +} + +func MulAdd4(a, b, c archsimd.Int32x4) archsimd.Int32x4 { return a.MulAdd(b, c) } + +func zipBytesLo(a, b archsimd.Uint8x16) archsimd.Uint16x8 { + return a.InterleaveLo(b).ReshapeToUint16s() +} + +func zipBytesHi(a, b archsimd.Uint8x16) archsimd.Uint16x8 { + return a.InterleaveHi(b).ReshapeToUint16s() +} + +func square8(v archsimd.Int16x8) archsimd.Int32x4 { + hi := v.HiToLo() + return v.MulWidenLo(v).Add(hi.MulWidenLo(hi)) +} +func sumDiff16(v archsimd.Int16x8) archsimd.Int32x4 { + return v.ExtendLo4ToInt32().Add(v.HiToLo().ExtendLo4ToInt32()) +} + +var lfRight3 = archsimd.BroadcastInt16x8(-3) +var lfRight1 = archsimd.BroadcastInt16x8(-1) + +func lfShift3(v archsimd.Int16x8) archsimd.Int16x8 { return v.Shift(lfRight3) } +func lfShift1(v archsimd.Int16x8) archsimd.Int16x8 { return v.Shift(lfRight1) } + +func satInt16ToUint8(v archsimd.Int16x8) archsimd.Uint8x16 { return v.SaturateToUint8() } diff --git a/internal/pixel/intra4x4_dc_fill_arm64.go b/internal/pixel/intra4x4_dc_fill_arm64.go new file mode 100644 index 0000000..c213788 --- /dev/null +++ b/internal/pixel/intra4x4_dc_fill_arm64.go @@ -0,0 +1,36 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/intra4x4_dc_fill_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// Intra4x4DCFill follows libvpx v1.16.0 vpx_dsp/intrapred.c DC rounding. +// The exact four-byte references are completely consumed before output stores. +func Intra4x4DCFill(dst []byte, ds int, above, left []byte) bool { + if !Enabled || uint(ds)>>30 != 0 || 3*ds+4 > len(dst) || len(above) < 4 || len(left) < 4 { + return false + } + a := binary.LittleEndian.Uint32(above) + l := binary.LittleEndian.Uint32(left) + v := archsimd.Uint32x4{}.SetElem(0, a).SetElem(1, l).ReshapeToUint8s().ExtendLo8ToUint16() + value := byte((int(v.ReduceSum()) + 4) >> 3) + word := archsimd.BroadcastUint8x16(value).ReshapeToUint32s().GetElem(0) + binary.LittleEndian.PutUint32(dst, word) + binary.LittleEndian.PutUint32(dst[ds:], word) + binary.LittleEndian.PutUint32(dst[2*ds:], word) + binary.LittleEndian.PutUint32(dst[3*ds:], word) + return true +} diff --git a/internal/pixel/intra_dc_fill_arm64.go b/internal/pixel/intra_dc_fill_arm64.go new file mode 100644 index 0000000..b06c9d7 --- /dev/null +++ b/internal/pixel/intra_dc_fill_arm64.go @@ -0,0 +1,85 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/intra_dc_fill_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// IntraDCFill follows libvpx v1.16.0 vpx_dsp/intrapred.c DC rounding. +// All references are consumed before stores, including destination aliases. +const IntraDCFillNative = true + +func IntraDCFill(dst []byte, ds int, above, left []byte, n int, up, lf bool) bool { + if !Enabled || (n != 8 && n != 16) || uint(ds)>>30 != 0 || (n-1)*ds+n > len(dst) || (up && len(above) < n) || (lf && len(left) < n) { + return false + } + value := byte(128) + if up || lf { + var acc archsimd.Uint16x8 + if up { + if n == 8 { + v := archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(above)).ReshapeToUint8s() + acc = acc.Add(v.ExtendLo8ToUint16()) + } else { + v := archsimd.LoadUint8x16(above) + acc = acc.Add(v.ExtendLo8ToUint16()).Add(v.HiToLo().ExtendLo8ToUint16()) + } + } + if lf { + if n == 8 { + v := archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(left)).ReshapeToUint8s() + acc = acc.Add(v.ExtendLo8ToUint16()) + } else { + v := archsimd.LoadUint8x16(left) + acc = acc.Add(v.ExtendLo8ToUint16()).Add(v.HiToLo().ExtendLo8ToUint16()) + } + } + sum := int(acc.ReduceSum()) + if n == 8 { + if up && lf { + value = byte((sum + 8) >> 4) + } else { + value = byte((sum + 4) >> 3) + } + } else { + if up && lf { + value = byte((sum + 16) >> 5) + } else { + value = byte((sum + 8) >> 4) + } + } + } + v := archsimd.BroadcastUint8x16(value) + d2, d3 := 2*ds, 3*ds + if n == 8 { + word := v.ReshapeToUint64s().GetElem(0) + for row := 0; row < 8; row += 4 { + at := dst[row*ds:] + binary.LittleEndian.PutUint64(at, word) + binary.LittleEndian.PutUint64(at[ds:], word) + binary.LittleEndian.PutUint64(at[d2:], word) + binary.LittleEndian.PutUint64(at[d3:], word) + } + } else { + for row := 0; row < 16; row += 4 { + at := dst[row*ds:] + v.Store(at) + v.Store(at[ds:]) + v.Store(at[d2:]) + v.Store(at[d3:]) + } + } + return true +} diff --git a/internal/pixel/kernels_simd.go b/internal/pixel/kernels_simd.go new file mode 100644 index 0000000..d5d892c --- /dev/null +++ b/internal/pixel/kernels_simd.go @@ -0,0 +1,778 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/kernels_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +func Stats(src []byte, ss int, ref []byte, rs, w, h int) (int, uint32) { + if !Enabled { + return StatsScalar(src, ss, ref, rs, w, h) + } + + if (w == 4 && h%4 == 0 || w == 8 || w >= 16 && w%16 == 0) && w <= 64 { + if h <= 4096 { + sse, sum := pixelStatsSIMD(src, ss, ref, rs, w, h) + return int(sum), sse + } + return statsTallSIMD(src, ss, ref, rs, w, h) + } + + var sums, squares archsimd.Int32x4 + tailSum := 0 + var tailSSE uint32 + for y := range h { + a, b := src[y*ss:], ref[y*rs:] + x := 0 + for ; x+8 <= w; x += 8 { + d := widen8(load8(a[x:])).Sub(widen8(load8(b[x:]))) + sums = sums.Add(sumDiff16(d)) + squares = squares.Add(square8(d)) + } + if x+4 <= w { + d := LoadPixels4(a[x:]).Sub(LoadPixels4(b[x:])) + sums = sums.Add(d) + squares = squares.Add(d.Mul(d)) + x += 4 + } + for ; x < w; x++ { + d := int(a[x]) - int(b[x]) + tailSum += d + tailSSE += uint32(d * d) + } + } + return int(sum32(sums)) + tailSum, uint32(sum32(squares)) + tailSSE +} + +// FilterBilinear runs a nonnegative 2-tap bilinear filter (t0+t1 <= 128) +// directly without slice-tap dispatch overhead. +func FilterBilinear(src []byte, ss int, dst []byte, ds, w, h, step int, t0, t1 uint8) { + if Enabled && (w == 4 || w%8 == 0) && (step == 1 || step == ss) && + filterLinearFast(src, ss, dst, ds, w, h, step, t0, t1) { + return + } + taps := [2]int16{int16(t0), int16(t1)} + if Enabled && filterLinear8(src, ss, dst, ds, w, h, step, taps[:]) { + return + } + FilterScalar(src, ss, dst, ds, w, h, step, taps[:]) +} + +// Filter uses widening int32 products: negative filter lobes cannot overflow +// or saturate before the codec's single rounding and clipping operation. +func Filter(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) { + if !Enabled { + FilterScalar(src, ss, dst, ds, w, h, step, taps) + return + } + + if len(taps) == 6 && filterSixNarrow8(src, ss, dst, ds, w, h, step, taps) { + return + } + + if len(taps) == 2 && filterLinear8(src, ss, dst, ds, w, h, step, taps) { + return + } + + if filterWide8(src, ss, dst, ds, w, h, step, taps) { + return + } + + if filterNarrow8(src, ss, dst, ds, w, h, step, taps) { + return + } + + if step == ss && filterVertical8(src, ss, dst, ds, w, h, taps) { + return + } + + if w == 4 { + bias := archsimd.BroadcastInt32x4(64) + var c [8]archsimd.Int32x4 + for k, v := range taps { + c[k] = archsimd.BroadcastInt32x4(int32(v)) + } + for y := range h { + sum := bias + for k := range taps { + sum = sum.Add(LoadPixels4(src[y*ss+k*step:]).Mul(c[k])) + } + StorePixels4(dst[y*ds:], sum.ShiftAllRight(7)) + } + return + } + + var c [8]archsimd.Int16x8 + for i, v := range taps { + c[i] = archsimd.BroadcastInt16x8(v) + } + bias := archsimd.BroadcastInt32x4(64) + for y := range h { + a, b := src[y*ss:], dst[y*ds:] + x := 0 + for ; x+8 <= w; x += 8 { + var lo, hi archsimd.Int32x4 + if step == 1 { + lo, hi = u8SumRowX(a[x:], &c, len(taps)) + } else { + lo, hi = u8SumColY(a[x:], step, &c, len(taps)) + } + lo, hi = lo.Add(bias), hi.Add(bias) + store8(b[x:], lo.ShiftAllRight(7), hi.ShiftAllRight(7)) + } + for ; x < w; x++ { + v := 64 + for k, c := range taps { + v += int(a[x+k*step]) * int(c) + } + b[x] = byte(min(max(v>>7, 0), 255)) + } + } +} +func Average(src []byte, ss int, dst []byte, ds, w, h int) { + if !Enabled { + AverageScalar(src, ss, dst, ds, w, h) + return + } + + // Small rows contain no vector packet. Avoid rechecking the packet loop + // at every row while retaining the original scalar read/store order. + if w < 8 { + for y := range h { + a, b := src[y*ss:], dst[y*ds:] + for x := range w { + b[x] = byte((int(a[x]) + int(b[x]) + 1) >> 1) + } + } + return + } + + for y := range h { + a, b := src[y*ss:], dst[y*ds:] + x := 0 + for ; x+8 <= w; x += 8 { + v := load8(a[x:]).Average(load8(b[x:])) + storeBytes8(b[x:], v) + } + for ; x < w; x++ { + b[x] = byte((int(a[x]) + int(b[x]) + 1) >> 1) + } + } +} + +func AddConstant8x8InPlace(dst []byte, stride, delta int) { + if !Enabled || stride < 8 || len(dst) < 8 || (stride <= 1<<20 && len(dst) < 7*stride+8) || (stride > 1<<20 && stride > (len(dst)-8)/7) { + AddConstantScalar(dst, stride, dst, stride, 8, 8, delta) + return + } + if delta == 0 { + return + } + _ = dst[7*stride+7] + d0, d1, d2, d3 := dst[0:], dst[2*stride:], dst[4*stride:], dst[6*stride:] + if delta > 0 { + d := uint8(255) + if delta < 255 { + d = uint8(delta) + } + dv := archsimd.BroadcastUint8x16(d) + v0 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d0)).SetElem(1, binary.LittleEndian.Uint64(d0[stride:])).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + v1 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d1)).SetElem(1, binary.LittleEndian.Uint64(d1[stride:])).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + v2 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d2)).SetElem(1, binary.LittleEndian.Uint64(d2[stride:])).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + v3 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d3)).SetElem(1, binary.LittleEndian.Uint64(d3[stride:])).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + binary.LittleEndian.PutUint64(d0, v0.GetElem(0)) + binary.LittleEndian.PutUint64(d0[stride:], v0.GetElem(1)) + binary.LittleEndian.PutUint64(d1, v1.GetElem(0)) + binary.LittleEndian.PutUint64(d1[stride:], v1.GetElem(1)) + binary.LittleEndian.PutUint64(d2, v2.GetElem(0)) + binary.LittleEndian.PutUint64(d2[stride:], v2.GetElem(1)) + binary.LittleEndian.PutUint64(d3, v3.GetElem(0)) + binary.LittleEndian.PutUint64(d3[stride:], v3.GetElem(1)) + return + } + mag := -delta + d := uint8(255) + if mag < 255 { + d = uint8(mag) + } + dv := archsimd.BroadcastUint8x16(d) + v0 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d0)).SetElem(1, binary.LittleEndian.Uint64(d0[stride:])).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + v1 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d1)).SetElem(1, binary.LittleEndian.Uint64(d1[stride:])).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + v2 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d2)).SetElem(1, binary.LittleEndian.Uint64(d2[stride:])).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + v3 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(d3)).SetElem(1, binary.LittleEndian.Uint64(d3[stride:])).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + binary.LittleEndian.PutUint64(d0, v0.GetElem(0)) + binary.LittleEndian.PutUint64(d0[stride:], v0.GetElem(1)) + binary.LittleEndian.PutUint64(d1, v1.GetElem(0)) + binary.LittleEndian.PutUint64(d1[stride:], v1.GetElem(1)) + binary.LittleEndian.PutUint64(d2, v2.GetElem(0)) + binary.LittleEndian.PutUint64(d2[stride:], v2.GetElem(1)) + binary.LittleEndian.PutUint64(d3, v3.GetElem(0)) + binary.LittleEndian.PutUint64(d3[stride:], v3.GetElem(1)) +} + +func AddConstant16x16InPlace(dst []byte, stride, delta int) { + if !Enabled || stride < 16 || len(dst) < 16 || (stride <= 1<<20 && len(dst) < 15*stride+16) || (stride > 1<<20 && stride > (len(dst)-16)/15) { + AddConstantScalar(dst, stride, dst, stride, 16, 16, delta) + return + } + if delta == 0 { + return + } + _ = dst[15*stride+15] + off := 0 + if delta > 0 { + d := uint8(255) + if delta < 255 { + d = uint8(delta) + } + dv := archsimd.BroadcastUint8x16(d) + for range 16 { + p := (*[16]byte)(dst[off : off+16]) + archsimd.LoadUint8x16Array(p).AddSaturated(dv).StoreArray(p) + off += stride + } + return + } + mag := -delta + d := uint8(255) + if mag < 255 { + d = uint8(mag) + } + dv := archsimd.BroadcastUint8x16(d) + for range 16 { + p := (*[16]byte)(dst[off : off+16]) + archsimd.LoadUint8x16Array(p).SubSaturated(dv).StoreArray(p) + off += stride + } +} + +// AddLumaDC16x16InPlace adds 16 per-4x4-block DC residuals ((dcs[b]+4)>>3) to +// a 16x16 luma macroblock in-place using 16-byte SIMD saturated arithmetic +// (4 horizontally adjacent 4x4 blocks per vector). +func AddLumaDC16x16InPlace(dst []byte, stride int, dcs *[16]int16) { + if !Enabled || stride < 16 || len(dst) < 16 || (stride <= 1<<20 && len(dst) < 15*stride+16) || (stride > 1<<20 && stride > (len(dst)-16)/15) { + for br := range 4 { + for bc := range 4 { + delta := (int(dcs[br*4+bc]) + 4) >> 3 + if delta != 0 { + off := br*4*stride + bc*4 + AddConstantScalar(dst[off:], stride, dst[off:], stride, 4, 4, delta) + } + } + } + return + } + _ = dst[15*stride+15] + c4 := archsimd.BroadcastInt16x8(4) + zero := archsimd.Int16x8{} + dLo := lfShift3(archsimd.LoadInt16x8Array((*[8]int16)(dcs[0:8])).Add(c4)) + dHi := lfShift3(archsimd.LoadInt16x8Array((*[8]int16)(dcs[8:16])).Add(c4)) + + posLo := satInt16ToUint8(dLo) + posHi := satInt16ToUint8(dHi) + negLo := satInt16ToUint8(zero.Sub(dLo)) + negHi := satInt16ToUint8(zero.Sub(dHi)) + + tpLo := zipBytesLo(posLo, posLo) + tpHi := zipBytesLo(posHi, posHi) + tnLo := zipBytesLo(negLo, negLo) + tnHi := zipBytesLo(negHi, negHi) + + pv0, pv1 := tpLo.InterleaveLo(tpLo).ReshapeToUint8s(), tpLo.InterleaveHi(tpLo).ReshapeToUint8s() + pv2, pv3 := tpHi.InterleaveLo(tpHi).ReshapeToUint8s(), tpHi.InterleaveHi(tpHi).ReshapeToUint8s() + nv0, nv1 := tnLo.InterleaveLo(tnLo).ReshapeToUint8s(), tnLo.InterleaveHi(tnLo).ReshapeToUint8s() + nv2, nv3 := tnHi.InterleaveLo(tnHi).ReshapeToUint8s(), tnHi.InterleaveHi(tnHi).ReshapeToUint8s() + + apply4 := func(off int, pv, nv archsimd.Uint8x16) { + p0 := (*[16]byte)(dst[off : off+16]) + p1 := (*[16]byte)(dst[off+stride : off+stride+16]) + p2 := (*[16]byte)(dst[off+2*stride : off+2*stride+16]) + p3 := (*[16]byte)(dst[off+3*stride : off+3*stride+16]) + archsimd.LoadUint8x16Array(p0).AddSaturated(pv).SubSaturated(nv).StoreArray(p0) + archsimd.LoadUint8x16Array(p1).AddSaturated(pv).SubSaturated(nv).StoreArray(p1) + archsimd.LoadUint8x16Array(p2).AddSaturated(pv).SubSaturated(nv).StoreArray(p2) + archsimd.LoadUint8x16Array(p3).AddSaturated(pv).SubSaturated(nv).StoreArray(p3) + } + apply4(0, pv0, nv0) + apply4(4*stride, pv1, nv1) + apply4(8*stride, pv2, nv2) + apply4(12*stride, pv3, nv3) +} + +// DequantWalshAddLumaDC16x16InPlace fuses Y2 dequantization, 4x4 inverse +// Walsh-Hadamard transform, and 16x16 luma DC-only residual addition into one +// register-resident SIMD pass with zero intermediate stack arrays. +func DequantWalshAddLumaDC16x16InPlace(dst []byte, stride int, y2q *[16]int16, y2dq *[16]int16) bool { + if !Enabled || stride < 16 || len(dst) < 16 || (stride <= 1<<20 && len(dst) < 15*stride+16) || (stride > 1<<20 && stride > (len(dst)-16)/15) { + return false + } + _ = dst[15*stride+15] + p0 := archsimd.LoadInt16x8Array((*[8]int16)(y2q[0:8])).Mul(archsimd.LoadInt16x8Array((*[8]int16)(y2dq[0:8]))) + p1 := archsimd.LoadInt16x8Array((*[8]int16)(y2q[8:16])).Mul(archsimd.LoadInt16x8Array((*[8]int16)(y2dq[8:16]))) + in0 := p0.ExtendLo4ToInt32() + in1 := high4(p0) + in2 := p1.ExtendLo4ToInt32() + in3 := high4(p1) + a, b, c, d := in0.Add(in3), in1.Add(in2), in1.Sub(in2), in0.Sub(in3) + out0 := a.Add(b).ShiftAllLeft(16).ShiftAllRight(16) + out1 := c.Add(d).ShiftAllLeft(16).ShiftAllRight(16) + out2 := a.Sub(b).ShiftAllLeft(16).ShiftAllRight(16) + out3 := d.Sub(c).ShiftAllLeft(16).ShiftAllRight(16) + in0, in1, in2, in3 = Transpose4(out0, out1, out2, out3) + a, b, c, d = in0.Add(in3), in1.Add(in2), in1.Sub(in2), in0.Sub(in3) + bias3 := archsimd.BroadcastInt32x4(3) + bias4 := archsimd.BroadcastInt32x4(4) + // Final Walsh shift (+3)>>3, truncated to int16, then DC residual shift (+4)>>3. + r0 := a.Add(b).Add(bias3).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16).Add(bias4).ShiftAllRight(3) + r1 := c.Add(d).Add(bias3).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16).Add(bias4).ShiftAllRight(3) + r2 := a.Sub(b).Add(bias3).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16).Add(bias4).ShiftAllRight(3) + r3 := d.Sub(c).Add(bias3).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16).Add(bias4).ShiftAllRight(3) + r0, r1, r2, r3 = Transpose4(r0, r1, r2, r3) + + zero := archsimd.Int32x4{} + max255 := archsimd.BroadcastInt32x4(255) + splat := archsimd.BroadcastUint32x4(0x01010101) + apply4 := func(off int, row archsimd.Int32x4) { + // Each int32 lane holds 0..255 in byte 0; splat each lane's byte 0 across its 4 bytes. + pv32 := row.Max(zero).Min(max255).ToBits().Mul(splat).ReshapeToUint8s() + nv32 := zero.Sub(row).Max(zero).Min(max255).ToBits().Mul(splat).ReshapeToUint8s() + q0 := (*[16]byte)(dst[off : off+16]) + q1 := (*[16]byte)(dst[off+stride : off+stride+16]) + q2 := (*[16]byte)(dst[off+2*stride : off+2*stride+16]) + q3 := (*[16]byte)(dst[off+3*stride : off+3*stride+16]) + archsimd.LoadUint8x16Array(q0).AddSaturated(pv32).SubSaturated(nv32).StoreArray(q0) + archsimd.LoadUint8x16Array(q1).AddSaturated(pv32).SubSaturated(nv32).StoreArray(q1) + archsimd.LoadUint8x16Array(q2).AddSaturated(pv32).SubSaturated(nv32).StoreArray(q2) + archsimd.LoadUint8x16Array(q3).AddSaturated(pv32).SubSaturated(nv32).StoreArray(q3) + } + apply4(0, r0) + apply4(4*stride, r1) + apply4(8*stride, r2) + apply4(12*stride, r3) + return true +} + +func AddConstant(pred []byte, ps int, dst []byte, ds, w, h, delta int) { + if !Enabled { + AddConstantScalar(pred, ps, dst, ds, w, h, delta) + return + } + if w <= 0 || h <= 0 { + return + } + if delta == 0 && ps == ds && len(pred) > 0 && len(dst) > 0 && &pred[0] == &dst[0] { + return + } + _ = pred[(h-1)*ps+w-1] + _ = dst[(h-1)*ds+w-1] + canBatchRows := ps >= w && ds >= w && + ((&pred[0] == &dst[0] && ps == ds) || !slicesOverlap(pred, dst, (h-1)*ps+w, (h-1)*ds+w)) + + // Saturating 8-bit add/sub (UQADD/UQSUB on ARM64, PADDUSB/PSUBUSB on AMD64) + // processes 16 pixels per instruction without widening to int32. + if delta >= 0 { + d := uint8(255) + if delta < 255 { + d = uint8(delta) + } + dv := archsimd.BroadcastUint8x16(d) + if canBatchRows && w == 4 && h == 4 { + v := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(pred[0:]), + binary.LittleEndian.Uint32(pred[ps:]), + binary.LittleEndian.Uint32(pred[2*ps:]), + binary.LittleEndian.Uint32(pred[3*ps:]), + }).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint32s() + binary.LittleEndian.PutUint32(dst[0:], v.GetElem(0)) + binary.LittleEndian.PutUint32(dst[ds:], v.GetElem(1)) + binary.LittleEndian.PutUint32(dst[2*ds:], v.GetElem(2)) + binary.LittleEndian.PutUint32(dst[3*ds:], v.GetElem(3)) + return + } + if canBatchRows && w == 8 { + if h == 8 { + p0, p1, p2, p3 := pred[0:], pred[2*ps:], pred[4*ps:], pred[6*ps:] + v0 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p0), binary.LittleEndian.Uint64(p0[ps:])}).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + v1 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p1), binary.LittleEndian.Uint64(p1[ps:])}).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + v2 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p2), binary.LittleEndian.Uint64(p2[ps:])}).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + v3 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p3), binary.LittleEndian.Uint64(p3[ps:])}).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + d0, d1, d2, d3 := dst[0:], dst[2*ds:], dst[4*ds:], dst[6*ds:] + binary.LittleEndian.PutUint64(d0, v0.GetElem(0)) + binary.LittleEndian.PutUint64(d0[ds:], v0.GetElem(1)) + binary.LittleEndian.PutUint64(d1, v1.GetElem(0)) + binary.LittleEndian.PutUint64(d1[ds:], v1.GetElem(1)) + binary.LittleEndian.PutUint64(d2, v2.GetElem(0)) + binary.LittleEndian.PutUint64(d2[ds:], v2.GetElem(1)) + binary.LittleEndian.PutUint64(d3, v3.GetElem(0)) + binary.LittleEndian.PutUint64(d3[ds:], v3.GetElem(1)) + return + } + po, do := 0, 0 + y := 0 + for ; y+1 < h; y += 2 { + v := archsimd.LoadUint64x2Array(&[2]uint64{ + binary.LittleEndian.Uint64(pred[po:]), + binary.LittleEndian.Uint64(pred[po+ps:]), + }).ReshapeToUint8s().AddSaturated(dv).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[do:], v.GetElem(0)) + binary.LittleEndian.PutUint64(dst[do+ds:], v.GetElem(1)) + po += 2 * ps + do += 2 * ds + } + if y < h { + storeBytes8(dst[do:], load8(pred[po:]).AddSaturated(dv)) + } + return + } + for y := range h { + po, do := y*ps, y*ds + x := 0 + for ; x+16 <= w; x += 16 { + archsimd.LoadUint8x16Array((*[16]byte)(pred[po+x : po+x+16])).AddSaturated(dv).StoreArray((*[16]byte)(dst[do+x : do+x+16])) + } + for ; x+8 <= w; x += 8 { + storeBytes8(dst[do+x:], load8(pred[po+x:]).AddSaturated(dv)) + } + for ; x < w; x += 4 { + StorePixels4(dst[do+x:], LoadPixels4(pred[po+x:]).Add(archsimd.BroadcastInt32x4(int32(delta)))) + } + } + return + } + + d := uint8(255) + if -delta < 255 { + d = uint8(-delta) + } + dv := archsimd.BroadcastUint8x16(d) + if canBatchRows && w == 4 && h == 4 { + v := archsimd.LoadUint32x4Array(&[4]uint32{ + binary.LittleEndian.Uint32(pred[0:]), + binary.LittleEndian.Uint32(pred[ps:]), + binary.LittleEndian.Uint32(pred[2*ps:]), + binary.LittleEndian.Uint32(pred[3*ps:]), + }).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint32s() + binary.LittleEndian.PutUint32(dst[0:], v.GetElem(0)) + binary.LittleEndian.PutUint32(dst[ds:], v.GetElem(1)) + binary.LittleEndian.PutUint32(dst[2*ds:], v.GetElem(2)) + binary.LittleEndian.PutUint32(dst[3*ds:], v.GetElem(3)) + return + } + if canBatchRows && w == 8 { + if h == 8 { + p0, p1, p2, p3 := pred[0:], pred[2*ps:], pred[4*ps:], pred[6*ps:] + v0 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p0), binary.LittleEndian.Uint64(p0[ps:])}).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + v1 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p1), binary.LittleEndian.Uint64(p1[ps:])}).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + v2 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p2), binary.LittleEndian.Uint64(p2[ps:])}).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + v3 := archsimd.LoadUint64x2Array(&[2]uint64{binary.LittleEndian.Uint64(p3), binary.LittleEndian.Uint64(p3[ps:])}).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + d0, d1, d2, d3 := dst[0:], dst[2*ds:], dst[4*ds:], dst[6*ds:] + binary.LittleEndian.PutUint64(d0, v0.GetElem(0)) + binary.LittleEndian.PutUint64(d0[ds:], v0.GetElem(1)) + binary.LittleEndian.PutUint64(d1, v1.GetElem(0)) + binary.LittleEndian.PutUint64(d1[ds:], v1.GetElem(1)) + binary.LittleEndian.PutUint64(d2, v2.GetElem(0)) + binary.LittleEndian.PutUint64(d2[ds:], v2.GetElem(1)) + binary.LittleEndian.PutUint64(d3, v3.GetElem(0)) + binary.LittleEndian.PutUint64(d3[ds:], v3.GetElem(1)) + return + } + po, do := 0, 0 + y := 0 + for ; y+1 < h; y += 2 { + v := archsimd.LoadUint64x2Array(&[2]uint64{ + binary.LittleEndian.Uint64(pred[po:]), + binary.LittleEndian.Uint64(pred[po+ps:]), + }).ReshapeToUint8s().SubSaturated(dv).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[do:], v.GetElem(0)) + binary.LittleEndian.PutUint64(dst[do+ds:], v.GetElem(1)) + po += 2 * ps + do += 2 * ds + } + if y < h { + storeBytes8(dst[do:], load8(pred[po:]).SubSaturated(dv)) + } + return + } + for y := range h { + po, do := y*ps, y*ds + x := 0 + for ; x+16 <= w; x += 16 { + archsimd.LoadUint8x16Array((*[16]byte)(pred[po+x : po+x+16])).SubSaturated(dv).StoreArray((*[16]byte)(dst[do+x : do+x+16])) + } + for ; x+8 <= w; x += 8 { + storeBytes8(dst[do+x:], load8(pred[po+x:]).SubSaturated(dv)) + } + for ; x < w; x += 4 { + StorePixels4(dst[do+x:], LoadPixels4(pred[po+x:]).Add(archsimd.BroadcastInt32x4(int32(delta)))) + } + } +} +func TMPredict(dst []byte, ds int, above, left []byte, top byte, w int) { + if !Enabled { + TMPredictScalar(dst, ds, above, left, top, w) + return + } + + if TMNative { + if w == 4 { + TMPredict4Native(dst, ds, above, left, top, false) + return + } + TMPredictNative(dst, ds, above, left, top, w) + return + } + + if (w == 8 || w == 16) && tmpredictBytesX64(dst, ds, above, left, top, w) { + return + } + + if (w == 8 || w == 16) && TMPredictBytes(dst, ds, above, left, top, w) { + return + } + + t := archsimd.BroadcastInt32x4(int32(top)) + for y := range w { + v := archsimd.BroadcastInt32x4(int32(left[y])).Sub(t) + for x := 0; x < w; x += 4 { + StorePixels4(dst[y*ds+x:], LoadPixels4(above[x:]).Add(v)) + } + } +} + +func loadN(b []byte, n int) archsimd.Uint8x16 { + if n == 4 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(b)).ReshapeToUint8s() + } + return load8(b) +} + +// slicesOverlap reports whether the first na elements of a and first nb +// elements of b overlap, using only O(1) safe pointer equality. +// Two slices sharing a backing array share the same tail element &s[:cap(s)][cap(s)-1] +// unless cap-clipped via 3-index slicing; callers do not pass cap-clipped +// aliases of the same backing buffer. +func slicesOverlap[T any](a, b []T, na, nb int) bool { + if na <= 0 || nb <= 0 { + return false + } + if &a[0] == &b[0] { + return true + } + ca, cb := cap(a), cap(b) + if &a[:ca][ca-1] == &b[:cb][cb-1] { + if ca >= cb { + return ca-cb < na + } + return cb-ca < nb + } + return false +} + +// slicesOverlapExact extends slicesOverlap to handle small 3-index cap-clipped +// backing aliases (e.g. unit tests constructing buf[0:n:n] and buf[k:k+n:k+n]). +// On real codec planes (where at least one slice exceeds 256 elements), this +// still runs in O(1). +func slicesOverlapExact[T any](a, b []T, na, nb int) bool { + if slicesOverlap(a, b, na, nb) { + return true + } + if na <= 0 || nb <= 0 || cap(a) > 25000 || cap(b) > 25000 || (len(a) != cap(a) && len(b) != cap(b)) { + return false + } + a0, b0 := &a[0], &b[0] + for i := 1; i < na; i++ { + if &a[i] == b0 { + return true + } + } + for j := 1; j < nb; j++ { + if &b[j] == a0 { + return true + } + } + return false +} + +func Sum(src []byte, ss, w, h int) int { + if !Enabled { + return SumScalar(src, ss, w, h) + } + + var a archsimd.Int32x4 + tail := 0 + for y := range h { + x := 0 + for ; x+8 <= w; x += 8 { + v := widen8(load8(src[y*ss+x:])) + a = a.Add(v.ExtendLo4ToInt32()).Add(high4(v)) + } + for ; x < w; x++ { + tail += int(src[y*ss+x]) + } + } + return int(sum32(a)) + tail +} + +func Intra4(dst []byte, ds int, border *[16]byte, indices *[4][16]byte) { + if !Enabled { + Intra4Scalar(dst, ds, border, indices) + return + } + + v := archsimd.LoadUint8x16Array(border) + var lo, hi archsimd.Int16x8 + for i := range 4 { + p := permute16(v, archsimd.LoadUint8x16Array(&indices[i])) + lo = lo.Add(widen8(p)) + hi = hi.Add(widen8(highBytes(p))) + } + round := archsimd.BroadcastInt16x8(2) + a := packBytes(lo.Add(round).ShiftAllRight(2)).ReshapeToUint64s().GetElem(0) + b := packBytes(hi.Add(round).ShiftAllRight(2)).ReshapeToUint64s().GetElem(0) + binary.LittleEndian.PutUint32(dst, uint32(a)) + binary.LittleEndian.PutUint32(dst[ds:], uint32(a>>32)) + binary.LittleEndian.PutUint32(dst[2*ds:], uint32(b)) + binary.LittleEndian.PutUint32(dst[3*ds:], uint32(b>>32)) +} +func FillBlock(dst []byte, ds, w, h int, value byte) { + if !Enabled { + FillBlockScalar(dst, ds, w, h, value) + return + } + + // Prove the full fixed-width window before stores. Declining retains + // the original row-by-row bounds and partial-write panic behavior. + if fillFixedRows && h > 1 && h <= 64 && uint(ds)>>30 == 0 && (w == 4 || w == 8 || w == 16) && (h-1)*ds+w <= len(dst) { + v := archsimd.BroadcastUint8x16(value) + if h&3 == 0 { + d2, d3 := 2*ds, 3*ds + switch w { + case 16: + for row := 0; row < h; row += 4 { + at := dst[row*ds:] + v.Store(at) + v.Store(at[ds:]) + v.Store(at[d2:]) + v.Store(at[d3:]) + } + case 8: + word := v.ReshapeToUint64s().GetElem(0) + for row := 0; row < h; row += 4 { + at := dst[row*ds:] + binary.LittleEndian.PutUint64(at, word) + binary.LittleEndian.PutUint64(at[ds:], word) + binary.LittleEndian.PutUint64(at[d2:], word) + binary.LittleEndian.PutUint64(at[d3:], word) + } + case 4: + word := v.ReshapeToUint32s().GetElem(0) + for row := 0; row < h; row += 4 { + at := dst[row*ds:] + binary.LittleEndian.PutUint32(at, word) + binary.LittleEndian.PutUint32(at[ds:], word) + binary.LittleEndian.PutUint32(at[d2:], word) + binary.LittleEndian.PutUint32(at[d3:], word) + } + } + return + } + switch w { + case 16: + for row := range h { + v.Store(dst[row*ds:]) + } + case 8: + word := v.ReshapeToUint64s().GetElem(0) + for row := range h { + binary.LittleEndian.PutUint64(dst[row*ds:], word) + } + case 4: + word := v.ReshapeToUint32s().GetElem(0) + for row := range h { + binary.LittleEndian.PutUint32(dst[row*ds:], word) + } + } + return + } + v := archsimd.BroadcastUint8x16(value) + for y := range h { + v.StorePart(dst[y*ds : y*ds+w]) + } +} +func RepeatRow(dst []byte, ds int, above []byte, w int) { + if !Enabled { + RepeatRowScalar(dst, ds, above, w) + return + } + v := loadN(above, min(w, 8)) + if w == 16 { + v = archsimd.LoadUint8x16(above) + } + for y := range w { + v.StorePart(dst[y*ds : y*ds+w]) + } +} +func Horizontal(dst []byte, ds int, left []byte, w int) { + if !Enabled { + HorizontalScalar(dst, ds, left, w) + return + } + for y := range w { + v := archsimd.BroadcastUint8x16(left[y]) + v.StorePart(dst[y*ds : y*ds+w]) + } +} + +func Mul16(a, b, out []int16, n int) { + if !Enabled { + Mul16Scalar(a, b, out, n) + return + } + if n == 16 && len(a) >= 16 && len(b) >= 16 && len(out) >= 16 { + // Load both halves before storing so partial aliasing between inputs + // and out is always safe without an overlap check. + a0 := archsimd.LoadInt16x8Array((*[8]int16)(a[0:8])) + b0 := archsimd.LoadInt16x8Array((*[8]int16)(b[0:8])) + a1 := archsimd.LoadInt16x8Array((*[8]int16)(a[8:16])) + b1 := archsimd.LoadInt16x8Array((*[8]int16)(b[8:16])) + a0.Mul(b0).StoreArray((*[8]int16)(out[0:8])) + a1.Mul(b1).StoreArray((*[8]int16)(out[8:16])) + return + } + i := 0 + for ; i+8 <= n; i += 8 { + archsimd.LoadInt16x8(a[i:]).Mul(archsimd.LoadInt16x8(b[i:])).Store(out[i:]) + } + for ; i < n; i++ { + out[i] = a[i] * b[i] + } +} + +// Batch exceptionally tall strips to keep the signed vector sum exact in +// int32. Width is at most 64, so a batch sums at most 64*4096*255. SSE +// intentionally wraps modulo 2^32, matching StatsScalar. +func statsTallSIMD(src []byte, ss int, ref []byte, rs, w, h int) (int, uint32) { + var totalSum int + var totalSSE uint32 + for h > 4096 { + sse, sum := pixelStatsSIMD(src, ss, ref, rs, w, 4096) + totalSum += int(sum) + totalSSE += sse + src, ref = src[4096*ss:], ref[4096*rs:] + h -= 4096 + } + sse, sum := pixelStatsSIMD(src, ss, ref, rs, w, h) + return totalSum + int(sum), totalSSE + sse +} diff --git a/internal/pixel/loopfilter_avx2.go b/internal/pixel/loopfilter_avx2.go new file mode 100644 index 0000000..9d845c4 --- /dev/null +++ b/internal/pixel/loopfilter_avx2.go @@ -0,0 +1,126 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_avx2.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "simd/archsimd" +) + +func loopFilterWide(p []byte, q0, step, outer, n, blimit, limit, thresh, kind int) bool { + if loopFilterByteWide(p, q0, step, outer, n, blimit, limit, thresh, kind) { + return true + } + return loopFilterWide16(p, q0, step, outer, n, blimit, limit, thresh, kind) +} +func loopFilterWide16(p []byte, q0, step, outer, n, blimit, limit, thresh, kind int) bool { + if (kind != 2 && kind != 4 && kind != 6) || n < 16 || (step != 1 && outer != 1) { + return false + } + width := 8 + if kind == 2 { + width = 4 + } + if (outer == 1 && step < 16) || (step == 1 && outer < width) { + return false + } + defer archsimd.ClearAVXUpperBits() + base := 0 + for ; base+16 <= n; base += 16 { + loopFilterNarrow16(p, q0+base*outer, step, outer, blimit, limit, thresh, kind) + } + if base < n { + loopFilterNarrow8(p, q0+base*outer, step, outer, blimit, limit, thresh, kind) + } + return true +} +func wideBytes(a, b archsimd.Uint8x16) archsimd.Uint8x16 { + return a.ReshapeToUint64s().InterleaveLo(b.ReshapeToUint64s()).ReshapeToUint8s() +} +func loadEdgeRows16(p []byte, off, pitch, width int) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + archsimd.ClearAVXUpperBits() + a0, a1, a2, a3, a4, a5, a6, a7 := loadEdgeRows(p, off, pitch, width) + b0, b1, b2, b3, b4, b5, b6, b7 := loadEdgeRows(p, off+8*pitch, pitch, width) + return wideBytes(a0, b0), wideBytes(a1, b1), wideBytes(a2, b2), wideBytes(a3, b3), wideBytes(a4, b4), wideBytes(a5, b5), wideBytes(a6, b6), wideBytes(a7, b7) +} +func edgeLoad16(p []byte, off, outer int) archsimd.Int16x16 { + // The wide entry point uses this only for contiguous horizontal samples. + return archsimd.LoadUint8x16(p[off:]).ExtendToUint16().BitsToInt16() +} +func widen16(v archsimd.Uint8x16) archsimd.Int16x16 { return v.ExtendToUint16().BitsToInt16() } +func anyWide16(v archsimd.Mask16x16) bool { return !v.ToInt16x16().IsZero() } + +func lfClamp16(v archsimd.Int16x16) archsimd.Int16x16 { + return v.Max(archsimd.BroadcastInt16x16(-128)).Min(archsimd.BroadcastInt16x16(127)) +} +func lfWideShift1(v archsimd.Int16x16) archsimd.Int16x16 { return v.ShiftAllRight(1) } +func lfWideShift3(v archsimd.Int16x16) archsimd.Int16x16 { return v.ShiftAllRight(3) } +func lfWideShift7(v archsimd.Int16x16) archsimd.Int16x16 { return v.ShiftAllRight(7) } +func storeNarrowEdge16(p []byte, off, step, outer, count int, v0, v1, v2, v3, v4, v5 archsimd.Int16x16) { + // Materialize full-width vectors before the width boundary. Keeping wide + // values live across ClearAVXUpperBits would force vector reloads and + // immediately dirty the upper halves again. This handoff uses six VEX + // stores, then only 128-bit loads and operations in the callee. + var words [96]int16 + v0.Store(words[0:]) + v1.Store(words[16:]) + v2.Store(words[32:]) + v3.Store(words[48:]) + v4.Store(words[64:]) + v5.Store(words[80:]) + storeNarrowEdge16Memory(p, off, step, outer, count, &words) +} + +//go:noinline +func storeNarrowEdge16Memory(p []byte, off, step, outer, count int, words *[96]int16) { + archsimd.ClearAVXUpperBits() + + if outer != 1 { + storeNarrowEdge(p, off, step, outer, count, archsimd.LoadInt16x8(words[0:]), archsimd.LoadInt16x8(words[16:]), archsimd.LoadInt16x8(words[32:]), archsimd.LoadInt16x8(words[48:]), archsimd.LoadInt16x8(words[64:]), archsimd.LoadInt16x8(words[80:])) + storeNarrowEdge(p, off+8*outer, step, outer, count, archsimd.LoadInt16x8(words[8:]), archsimd.LoadInt16x8(words[24:]), archsimd.LoadInt16x8(words[40:]), archsimd.LoadInt16x8(words[56:]), archsimd.LoadInt16x8(words[72:]), archsimd.LoadInt16x8(words[88:])) + return + } + wideBytes(packBytes(archsimd.LoadInt16x8(words[0:])), packBytes(archsimd.LoadInt16x8(words[8:]))).Store(p[off:]) + wideBytes(packBytes(archsimd.LoadInt16x8(words[16:])), packBytes(archsimd.LoadInt16x8(words[24:]))).Store(p[off+step:]) + if count >= 4 { + wideBytes(packBytes(archsimd.LoadInt16x8(words[32:])), packBytes(archsimd.LoadInt16x8(words[40:]))).Store(p[off+2*step:]) + wideBytes(packBytes(archsimd.LoadInt16x8(words[48:])), packBytes(archsimd.LoadInt16x8(words[56:]))).Store(p[off+3*step:]) + } + if count == 6 { + wideBytes(packBytes(archsimd.LoadInt16x8(words[64:])), packBytes(archsimd.LoadInt16x8(words[72:]))).Store(p[off+4*step:]) + wideBytes(packBytes(archsimd.LoadInt16x8(words[80:])), packBytes(archsimd.LoadInt16x8(words[88:]))).Store(p[off+5*step:]) + } +} + +// Masking a word shift removes bits arriving from the adjacent byte. +// Shifting biased unsigned bytes and subtracting the shifted bias gives +// exact signed rounding without widening either half of the packet. +func lfByteShift1(v archsimd.Int8x16) archsimd.Int8x16 { + u := v.ToBits().Xor(archsimd.BroadcastUint8x16(128)).ReshapeToUint16s().ShiftAllRight(1).ReshapeToUint8s() + return u.And(archsimd.BroadcastUint8x16(127)).Sub(archsimd.BroadcastUint8x16(64)).BitsToInt8() +} +func lfByteShift3(v archsimd.Int8x16) archsimd.Int8x16 { + u := v.ToBits().Xor(archsimd.BroadcastUint8x16(128)).ReshapeToUint16s().ShiftAllRight(3).ReshapeToUint8s() + return u.And(archsimd.BroadcastUint8x16(31)).Sub(archsimd.BroadcastUint8x16(16)).BitsToInt8() +} +func lfByteHalf(v archsimd.Uint8x16) archsimd.Uint8x16 { + return v.ReshapeToUint16s().ShiftAllRight(1).ReshapeToUint8s().And(archsimd.BroadcastUint8x16(127)) +} +func lfByteLE(a, b archsimd.Uint8x16) archsimd.Mask8x16 { + return a.SubSaturated(b).Equal(archsimd.Uint8x16{}) +} +func lfByteGT(a, b archsimd.Uint8x16) archsimd.Mask8x16 { return lfByteNot(lfByteLE(a, b)) } +func lfTruncSigned(v archsimd.Int16x8) archsimd.Int8x16 { + return v.ToBits().ReshapeToUint8s().PermuteOrZero(archsimd.LoadInt8x16Array(&packByteIndices)).BitsToInt8() +} + +func lfByteNot(v archsimd.Mask8x16) archsimd.Mask8x16 { return v.ToInt8x16().Equal(archsimd.Int8x16{}) } diff --git a/internal/pixel/loopfilter_columns_arm64.go b/internal/pixel/loopfilter_columns_arm64.go new file mode 100644 index 0000000..4b5d172 --- /dev/null +++ b/internal/pixel/loopfilter_columns_arm64.go @@ -0,0 +1,124 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_columns_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// loadLFColumns16 uses the 16x8 TRN schedule from libvpx v1.16.0's +// VP8 vertical filter (also in govpx assembly at 691cd051). Pairing rows +// eight apart avoids two separate 8x8 transposes and eight final joins. +// The caller proves sixteen rows of eight readable bytes; every scalar +// load reads exactly eight bytes, even at the last row and unaligned offsets. +func loadLFColumns16(p []byte, off, pitch int) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Uint8x16 + base := p[off:] + r0 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[0*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[8*pitch:])).ReshapeToUint32s() + r1 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[1*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[9*pitch:])).ReshapeToUint32s() + r2 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[2*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[10*pitch:])).ReshapeToUint32s() + r3 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[3*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[11*pitch:])).ReshapeToUint32s() + r4 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[4*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[12*pitch:])).ReshapeToUint32s() + r5 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[5*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[13*pitch:])).ReshapeToUint32s() + r6 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[6*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[14*pitch:])).ReshapeToUint32s() + r7 := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(base[7*pitch:])).SetElem(1, binary.LittleEndian.Uint64(base[15*pitch:])).ReshapeToUint32s() + a0 := r0.InterleaveEven(r4).ReshapeToUint16s() + a1 := r0.InterleaveOdd(r4).ReshapeToUint16s() + a2 := r1.InterleaveEven(r5).ReshapeToUint16s() + a3 := r1.InterleaveOdd(r5).ReshapeToUint16s() + a4 := r2.InterleaveEven(r6).ReshapeToUint16s() + a5 := r2.InterleaveOdd(r6).ReshapeToUint16s() + a6 := r3.InterleaveEven(r7).ReshapeToUint16s() + a7 := r3.InterleaveOdd(r7).ReshapeToUint16s() + b0 := a0.InterleaveEven(a4).ReshapeToUint8s() + b1 := a0.InterleaveOdd(a4).ReshapeToUint8s() + b2 := a2.InterleaveEven(a6).ReshapeToUint8s() + b3 := a2.InterleaveOdd(a6).ReshapeToUint8s() + b4 := a1.InterleaveEven(a5).ReshapeToUint8s() + b5 := a1.InterleaveOdd(a5).ReshapeToUint8s() + b6 := a3.InterleaveEven(a7).ReshapeToUint8s() + b7 := a3.InterleaveOdd(a7).ReshapeToUint8s() + p3 = b0.InterleaveEven(b2) + p2 = b0.InterleaveOdd(b2) + p1 = b1.InterleaveEven(b3) + p0 = b1.InterleaveOdd(b3) + q0 = b4.InterleaveEven(b6) + q1 = b4.InterleaveOdd(b6) + q2 = b5.InterleaveEven(b7) + q3 = b5.InterleaveOdd(b7) + return p3, p2, p1, p0, q0, q1, q2, q3 +} + +const NativeLFByAxis = true + +// CanLoopFilterMacroHorizontal16 proves the complete sequential fused window. +func CanLoopFilterMacroHorizontal16(p []byte, pitch int, mblimit, blimit byte) bool { + return Enabled && uint(pitch-16)>>30 == 0 && 19*pitch+16 <= len(p) && mblimit != 255 && blimit != 255 +} + +// LoopFilterMacroHorizontal16Unchecked requires a successful corresponding +// CanLoopFilterMacroHorizontal16 call on this unchanged slice, pitch and limits. +func LoopFilterMacroHorizontal16Unchecked(p []byte, pitch int, mblimit, blimit, limit, thresh byte) { + loopFilterMacroInternalFusedHorizontal(p, pitch, int(mblimit), int(blimit), int(limit), int(thresh)) +} + +// CanLoopFilterMacroVertical16 proves the complete sequential fused window. +func CanLoopFilterMacroVertical16(p []byte, pitch int, mblimit, blimit byte) bool { + return Enabled && uint(pitch-20)>>30 == 0 && 15*pitch+20 <= len(p) && mblimit != 255 && blimit != 255 +} + +// LoopFilterMacroVertical16Unchecked requires a successful corresponding +// CanLoopFilterMacroVertical16 call on this unchanged slice, pitch and limits. +func LoopFilterMacroVertical16Unchecked(p []byte, pitch int, mblimit, blimit, limit, thresh byte) { + loopFilterMacroInternalFusedVertical(p, pitch, int(mblimit), int(blimit), int(limit), int(thresh)) +} + +// LoopFilterMacroInternal16 applies the VP8 macroblock edge and three internal +// edges, in that order, to sixteen lanes. p starts four pixels before the +// macroblock; step crosses edges and outer walks along them. It returns false +// without writing when the complete, nonoverlapping 20x16 window is unavailable. +func LoopFilterMacroInternal16(p []byte, step, outer, mblimit, blimit, limit, thresh int) bool { + if !Enabled || step <= 0 || outer <= 0 || mblimit < 0 || mblimit >= 255 || blimit < 0 || blimit >= 255 || limit < 0 || limit > 255 || thresh < 0 || thresh > 255 { + return false + } + if !((outer == 1 && step >= 16) || (step == 1 && outer >= 20)) || len(p) == 0 { + return false + } + // Prove 19*step+15*outer < len(p) before either multiplication. Incoming + // four-byte rows and six-byte stores stay within this exact window, even + // with unaligned addresses and the smallest accepted pitch. + avail := len(p) - 1 + if step > avail/19 { + return false + } + avail -= 19 * step + if outer > avail/15 { + return false + } + if outer == 1 { + loopFilterMacroInternalFusedHorizontal(p, step, mblimit, blimit, limit, thresh) + } else { + loopFilterMacroInternalFusedVertical(p, outer, mblimit, blimit, limit, thresh) + } + return true +} + +// Only identity corrections can skip stores. Unsigned ABS preserves -128. +func uvRoundedZero(f archsimd.Int8x16, kind int) bool { + bound := uint8(4) + if kind == 6 { + bound = 3 + } + return f.Abs().ToBits().ReduceMax() < bound +} diff --git a/internal/pixel/loopfilter_core_avx2.go b/internal/pixel/loopfilter_core_avx2.go new file mode 100644 index 0000000..137a951 --- /dev/null +++ b/internal/pixel/loopfilter_core_avx2.go @@ -0,0 +1,79 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_core_avx2.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. + +package pixel + +import "simd/archsimd" + +func loopFilterNarrow16(p []byte, off, step, outer, blimit, limit, thresh, kind int) { + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Int16x16 + if step == 1 && outer > 1 { + start, width := off-4, 8 + if kind == 2 { + start, width = off-2, 4 + } + c0, c1, c2, c3, c4, c5, c6, c7 := loadEdgeRows16(p, start, outer, width) + if kind == 2 { + p1, p0, q0, q1 = widen16(c0), widen16(c1), widen16(c2), widen16(c3) + } else { + p3, p2, p1, p0, q0, q1, q2, q3 = widen16(c0), widen16(c1), widen16(c2), widen16(c3), widen16(c4), widen16(c5), widen16(c6), widen16(c7) + } + } else { + p1, p0, q0, q1 = edgeLoad16(p, off-2*step, outer), edgeLoad16(p, off-step, outer), edgeLoad16(p, off, outer), edgeLoad16(p, off+step, outer) + if kind != 2 { + p3, p2, q2, q3 = edgeLoad16(p, off-4*step, outer), edgeLoad16(p, off-3*step, outer), edgeLoad16(p, off+2*step, outer), edgeLoad16(p, off+3*step, outer) + } + } + boundary := p0.Sub(q0).Abs().ShiftAllLeft(1).Add(p1.Sub(q1).Abs().ShiftAllRight(1)) + need := boundary.LessEqual(archsimd.BroadcastInt16x16(int16(blimit))) + if kind != 2 { + delta := p3.Sub(p2).Abs().Max(p2.Sub(p1).Abs()).Max(p1.Sub(p0).Abs()).Max(q1.Sub(q0).Abs()).Max(q2.Sub(q1).Abs()).Max(q3.Sub(q2).Abs()) + need = need.And(delta.LessEqual(archsimd.BroadcastInt16x16(int16(limit)))) + } + if !anyWide16(need) { + return + } + hev := p1.Sub(p0).Abs().Max(q1.Sub(q0).Abs()).Greater(archsimd.BroadcastInt16x16(int16(thresh))) + center, three, four := archsimd.BroadcastInt16x16(128), archsimd.BroadcastInt16x16(3), archsimd.BroadcastInt16x16(4) + f := lfClamp16(p1.Sub(q1)) + if kind == 4 { + f = f.Masked(hev) + } + f = lfClamp16(f.Add(q0.Sub(p0).Mul(three))).Masked(need) + zero := archsimd.Int16x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := lfClamp16(p0.Sub(center).Add(lfWideShift3(lfClamp16(fh.Add(three))))) + qs0 := lfClamp16(q0.Sub(center).Sub(lfWideShift3(lfClamp16(fh.Add(four))))) + ff := f.Masked(hev.ToInt16x16().Equal(zero)) + bias := archsimd.BroadcastInt16x16(63) + u := lfWideShift7(ff.Mul(archsimd.BroadcastInt16x16(27)).Add(bias)) + o2, o3 := lfClamp16(ps0.Add(u)).Add(center), lfClamp16(qs0.Sub(u)).Add(center) + u = lfWideShift7(ff.Mul(archsimd.BroadcastInt16x16(18)).Add(bias)) + o1, o4 := lfClamp16(p1.Sub(center).Add(u)).Add(center), lfClamp16(q1.Sub(center).Sub(u)).Add(center) + u = lfWideShift7(ff.Mul(archsimd.BroadcastInt16x16(9)).Add(bias)) + o0, o5 := lfClamp16(p2.Sub(center).Add(u)).Add(center), lfClamp16(q2.Sub(center).Sub(u)).Add(center) + storeNarrowEdge16(p, off-3*step, step, outer, 6, o0, o1, o2, o3, o4, o5) + return + } + f1, f2 := lfWideShift3(lfClamp16(f.Add(four))), lfWideShift3(lfClamp16(f.Add(three))) + o0, o1 := lfClamp16(p0.Sub(center).Add(f2)).Add(center), lfClamp16(q0.Sub(center).Sub(f1)).Add(center) + if kind == 2 { + storeNarrowEdge16(p, off-step, step, outer, 2, o0, o1, zero, zero, zero, zero) + } else { + u := lfWideShift1(f1.Add(archsimd.BroadcastInt16x16(1))).Masked(hev.ToInt16x16().Equal(zero)) + oP1, oQ1 := lfClamp16(p1.Sub(center).Add(u)).Add(center), lfClamp16(q1.Sub(center).Sub(u)).Add(center) + storeNarrowEdge16(p, off-2*step, step, outer, 4, oP1, o0, o1, oQ1, zero, zero) + } +} diff --git a/internal/pixel/loopfilter_internal_arith_simd.go b/internal/pixel/loopfilter_internal_arith_simd.go new file mode 100644 index 0000000..833f248 --- /dev/null +++ b/internal/pixel/loopfilter_internal_arith_simd.go @@ -0,0 +1,123 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_internal_arith_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Byte-domain dataflow extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +// Sixteen-position VP8 internal edges share the canonical byte arithmetic. +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +func loopFilterInternalEdge(p []byte, off, step, outer, blimit, limit, thresh int) { + const kind, lanes = 4, 16 + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Uint8x16 + if step == 1 && outer > 1 { + if kind == 2 { + a0, a1, a2, a3, _, _, _, _ := loadLFColumns[[4]byte](p, off-2, outer, lanes) + p1, p0, q0, q1 = a0, a1, a2, a3 + } else { + p3, p2, p1, p0, q0, q1, q2, q3 = loadLFColumns[[8]byte](p, off-4, outer, lanes) + } + } else { + p1, p0, q0, q1 = loadLFByte(p, off-2*step, lanes), loadLFByte(p, off-step, lanes), loadLFByte(p, off, lanes), loadLFByte(p, off+step, lanes) + if kind != 2 { + p3, p2, q2, q3 = loadLFByte(p, off-4*step, lanes), loadLFByte(p, off-3*step, lanes), loadLFByte(p, off+2*step, lanes), loadLFByte(p, off+3*step, lanes) + } + } + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(blimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) == 0 { + return + } + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + // The caller proves the complete 16x16 window. These stores touch exactly + // four filtered bytes at each position, including overlapping logical rows. + base := off - 2*step + if outer == 1 { + np1.StoreArray((*[16]byte)(p[base : base+16])) + np0.StoreArray((*[16]byte)(p[base+step : base+step+16])) + nq0.StoreArray((*[16]byte)(p[base+2*step : base+2*step+16])) + nq1.StoreArray((*[16]byte)(p[base+3*step : base+3*step+16])) + } else { + { + ab, cd := zipBytesLo(np1, np0), zipBytesLo(nq0, nq1) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + } + { + ab, cd := zipBytesLo(highBytes(np1), highBytes(np0)), zipBytesLo(highBytes(nq0), highBytes(nq1)) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+8*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+9*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+10*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+11*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+12*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+13*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+14*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+15*outer:], hi.GetElem(3)) + } + } + +} diff --git a/internal/pixel/loopfilter_internal_fused_simd.go b/internal/pixel/loopfilter_internal_fused_simd.go new file mode 100644 index 0000000..4a24cca --- /dev/null +++ b/internal/pixel/loopfilter_internal_fused_simd.go @@ -0,0 +1,239 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_internal_fused_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Byte-domain dataflow extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +// Three internal edges reuse neighboring rows/columns in their original order. +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +func loopFilterInternalFusedHorizontal(p []byte, pitch, blimit, limit, thresh int) { + const kind, lanes, outer = 4, 16, 1 + step := pitch + p3, p2, p1, p0 := loadLFByte(p, 0, 16), loadLFByte(p, step, 16), loadLFByte(p, 2*step, 16), loadLFByte(p, 3*step, 16) + q0, q1, q2, q3 := loadLFByte(p, 4*step, 16), loadLFByte(p, 5*step, 16), loadLFByte(p, 6*step, 16), loadLFByte(p, 7*step, 16) + blim, lim, thr := archsimd.BroadcastUint8x16(byte(blimit)), archsimd.BroadcastUint8x16(byte(limit)), archsimd.BroadcastUint8x16(byte(thresh)) + for edge := 4; edge <= 12; edge += 4 { + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + // The caller proves the complete 16x16 window. These stores touch exactly + // four filtered bytes at each position, including overlapping logical rows. + base := off - 2*step + if outer == 1 { + np1.StoreArray((*[16]byte)(p[base : base+16])) + np0.StoreArray((*[16]byte)(p[base+step : base+step+16])) + nq0.StoreArray((*[16]byte)(p[base+2*step : base+2*step+16])) + nq1.StoreArray((*[16]byte)(p[base+3*step : base+3*step+16])) + } else { + { + ab, cd := zipBytesLo(np1, np0), zipBytesLo(nq0, nq1) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + } + { + ab, cd := zipBytesLo(highBytes(np1), highBytes(np0)), zipBytesLo(highBytes(nq0), highBytes(nq1)) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+8*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+9*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+10*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+11*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+12*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+13*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+14*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+15*outer:], hi.GetElem(3)) + } + } + + q0, q1 = nq0, nq1 + } + if edge == 12 { + break + } + p3, p2, p1, p0 = q0, q1, q2, q3 + q0, q1, q2, q3 = loadLFByte(p, (edge+4)*step, 16), loadLFByte(p, (edge+5)*step, 16), loadLFByte(p, (edge+6)*step, 16), loadLFByte(p, (edge+7)*step, 16) + } +} +func loopFilterInternalFusedVertical(p []byte, pitch, blimit, limit, thresh int) { + const kind, lanes, step = 4, 16, 1 + outer := pitch + p3, p2, p1, p0, q0, q1, q2, q3 := loadLFColumns[[8]byte](p, 0, outer, 16) + blim, lim, thr := archsimd.BroadcastUint8x16(byte(blimit)), archsimd.BroadcastUint8x16(byte(limit)), archsimd.BroadcastUint8x16(byte(thresh)) + for edge := 4; edge <= 12; edge += 4 { + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + // The caller proves the complete 16x16 window. These stores touch exactly + // four filtered bytes at each position, including overlapping logical rows. + base := off - 2*step + if outer == 1 { + np1.StoreArray((*[16]byte)(p[base : base+16])) + np0.StoreArray((*[16]byte)(p[base+step : base+step+16])) + nq0.StoreArray((*[16]byte)(p[base+2*step : base+2*step+16])) + nq1.StoreArray((*[16]byte)(p[base+3*step : base+3*step+16])) + } else { + { + ab, cd := zipBytesLo(np1, np0), zipBytesLo(nq0, nq1) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + } + { + ab, cd := zipBytesLo(highBytes(np1), highBytes(np0)), zipBytesLo(highBytes(nq0), highBytes(nq1)) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+8*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+9*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+10*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+11*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+12*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+13*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+14*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+15*outer:], hi.GetElem(3)) + } + } + + q0, q1 = nq0, nq1 + } + if edge == 12 { + break + } + p3, p2, p1, p0 = q0, q1, q2, q3 + var l0, l1, l2, l3 archsimd.Uint8x16 + { + base := edge + 4 + 0*outer + row := func(y int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p[base+y*outer:])).ReshapeToUint8s() + } + a0, a1 := zipBytesLo(row(0), row(1)), zipBytesLo(row(2), row(3)) + a2, a3 := zipBytesLo(row(4), row(5)), zipBytesLo(row(6), row(7)) + b0, b2 := a0.InterleaveLo(a1).ReshapeToUint32s(), a2.InterleaveLo(a3).ReshapeToUint32s() + c01, c23 := b0.InterleaveLo(b2).ReshapeToUint8s(), b0.InterleaveHi(b2).ReshapeToUint8s() + l0, l1, l2, l3 = c01, highBytes(c01), c23, highBytes(c23) + } + { + base := edge + 4 + 8*outer + row := func(y int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p[base+y*outer:])).ReshapeToUint8s() + } + a0, a1 := zipBytesLo(row(0), row(1)), zipBytesLo(row(2), row(3)) + a2, a3 := zipBytesLo(row(4), row(5)), zipBytesLo(row(6), row(7)) + b0, b2 := a0.InterleaveLo(a1).ReshapeToUint32s(), a2.InterleaveLo(a3).ReshapeToUint32s() + c01, c23 := b0.InterleaveLo(b2).ReshapeToUint8s(), b0.InterleaveHi(b2).ReshapeToUint8s() + q0, q1, q2, q3 = joinLFBytes(l0, c01), joinLFBytes(l1, highBytes(c01)), joinLFBytes(l2, c23), joinLFBytes(l3, highBytes(c23)) + } + } +} diff --git a/internal/pixel/loopfilter_macro_internal_fused_amd64.go b/internal/pixel/loopfilter_macro_internal_fused_amd64.go new file mode 100644 index 0000000..2423325 --- /dev/null +++ b/internal/pixel/loopfilter_macro_internal_fused_amd64.go @@ -0,0 +1,421 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_macro_internal_fused_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Byte-domain dataflow extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && amd64 && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +// The macroblock edge and three internal edges retain sequential arithmetic. +// Horizontal and vertical macroblock/internal edges carry exact byte dataflow. +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +func loopFilterMacroInternalFusedHorizontal(p []byte, pitch, mblimit, blimit, limit, thresh int) { + const kind, lanes, outer = 4, 16, 1 + step := pitch + p3, p2, p1, p0 := loadLFByte(p, 0, 16), loadLFByte(p, step, 16), loadLFByte(p, 2*step, 16), loadLFByte(p, 3*step, 16) + q0, q1, q2, q3 := loadLFByte(p, 4*step, 16), loadLFByte(p, 5*step, 16), loadLFByte(p, 6*step, 16), loadLFByte(p, 7*step, 16) + { + const kind = 6 + off := 4 * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(mblimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if !macroRoundedZeroR2(f, kind) { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + np2.StoreArray((*[16]byte)(p[off+-3*step : off+-3*step+16])) + np1.StoreArray((*[16]byte)(p[off+-2*step : off+-2*step+16])) + np0.StoreArray((*[16]byte)(p[off+-1*step : off+-1*step+16])) + nq0.StoreArray((*[16]byte)(p[off+0*step : off+0*step+16])) + nq1.StoreArray((*[16]byte)(p[off+1*step : off+1*step+16])) + nq2.StoreArray((*[16]byte)(p[off+2*step : off+2*step+16])) + + q0, q1, q2 = nq0, nq1, nq2 + } + } + } + } + { + edge := 4 + + p3, p2, p1, p0 = q0, q1, q2, q3 + q0, q1, q2, q3 = loadLFByte(p, (edge+4)*step, 16), loadLFByte(p, (edge+5)*step, 16), loadLFByte(p, (edge+6)*step, 16), loadLFByte(p, (edge+7)*step, 16) + } + + blim, lim, thr := archsimd.BroadcastUint8x16(byte(blimit)), archsimd.BroadcastUint8x16(byte(limit)), archsimd.BroadcastUint8x16(byte(thresh)) + for edge := 8; edge <= 16; edge += 4 { + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if !macroRoundedZeroR2(f, kind) { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + // The caller proves the complete 16x16 window. These stores touch exactly + // four filtered bytes at each position, including overlapping logical rows. + base := off - 2*step + if outer == 1 { + np1.StoreArray((*[16]byte)(p[base : base+16])) + np0.StoreArray((*[16]byte)(p[base+step : base+step+16])) + nq0.StoreArray((*[16]byte)(p[base+2*step : base+2*step+16])) + nq1.StoreArray((*[16]byte)(p[base+3*step : base+3*step+16])) + } else { + { + ab, cd := zipBytesLo(np1, np0), zipBytesLo(nq0, nq1) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + } + { + ab, cd := zipBytesLo(highBytes(np1), highBytes(np0)), zipBytesLo(highBytes(nq0), highBytes(nq1)) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+8*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+9*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+10*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+11*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+12*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+13*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+14*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+15*outer:], hi.GetElem(3)) + } + } + + q0, q1 = nq0, nq1 + } + } + if edge == 16 { + break + } + p3, p2, p1, p0 = q0, q1, q2, q3 + q0, q1, q2, q3 = loadLFByte(p, (edge+4)*step, 16), loadLFByte(p, (edge+5)*step, 16), loadLFByte(p, (edge+6)*step, 16), loadLFByte(p, (edge+7)*step, 16) + } +} +func loopFilterMacroInternalFusedVertical(p []byte, pitch, mblimit, blimit, limit, thresh int) { + const kind, lanes, step = 4, 16, 1 + outer := pitch + p3, p2, p1, p0, q0, q1, q2, q3 := loadLFColumns[[8]byte](p, 0, outer, 16) + { + const kind = 6 + off := 4 * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(mblimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if !macroRoundedZeroR2(f, kind) { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + { + base := off - 3*step + 0*outer + ab, cd, ef := zipBytesLo(np2, np1), zipBytesLo(np0, nq0), zipBytesLo(nq1, nq2) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint16(p[base+0*outer+4:], ef.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint16(p[base+1*outer+4:], ef.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint16(p[base+2*outer+4:], ef.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint16(p[base+3*outer+4:], ef.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint16(p[base+4*outer+4:], ef.GetElem(4)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint16(p[base+5*outer+4:], ef.GetElem(5)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint16(p[base+6*outer+4:], ef.GetElem(6)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + binary.LittleEndian.PutUint16(p[base+7*outer+4:], ef.GetElem(7)) + } + { + base := off - 3*step + 8*outer + ab, cd, ef := zipBytesLo(highBytes(np2), highBytes(np1)), zipBytesLo(highBytes(np0), highBytes(nq0)), zipBytesLo(highBytes(nq1), highBytes(nq2)) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint16(p[base+0*outer+4:], ef.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint16(p[base+1*outer+4:], ef.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint16(p[base+2*outer+4:], ef.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint16(p[base+3*outer+4:], ef.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint16(p[base+4*outer+4:], ef.GetElem(4)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint16(p[base+5*outer+4:], ef.GetElem(5)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint16(p[base+6*outer+4:], ef.GetElem(6)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + binary.LittleEndian.PutUint16(p[base+7*outer+4:], ef.GetElem(7)) + } + + q0, q1, q2 = nq0, nq1, nq2 + } + } + } + } + { + edge := 4 + + p3, p2, p1, p0 = q0, q1, q2, q3 + var l0, l1, l2, l3 archsimd.Uint8x16 + { + base := edge + 4 + 0*outer + row := func(y int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p[base+y*outer:])).ReshapeToUint8s() + } + a0, a1 := zipBytesLo(row(0), row(1)), zipBytesLo(row(2), row(3)) + a2, a3 := zipBytesLo(row(4), row(5)), zipBytesLo(row(6), row(7)) + b0, b2 := a0.InterleaveLo(a1).ReshapeToUint32s(), a2.InterleaveLo(a3).ReshapeToUint32s() + c01, c23 := b0.InterleaveLo(b2).ReshapeToUint8s(), b0.InterleaveHi(b2).ReshapeToUint8s() + l0, l1, l2, l3 = c01, highBytes(c01), c23, highBytes(c23) + } + { + base := edge + 4 + 8*outer + row := func(y int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p[base+y*outer:])).ReshapeToUint8s() + } + a0, a1 := zipBytesLo(row(0), row(1)), zipBytesLo(row(2), row(3)) + a2, a3 := zipBytesLo(row(4), row(5)), zipBytesLo(row(6), row(7)) + b0, b2 := a0.InterleaveLo(a1).ReshapeToUint32s(), a2.InterleaveLo(a3).ReshapeToUint32s() + c01, c23 := b0.InterleaveLo(b2).ReshapeToUint8s(), b0.InterleaveHi(b2).ReshapeToUint8s() + q0, q1, q2, q3 = joinLFBytes(l0, c01), joinLFBytes(l1, highBytes(c01)), joinLFBytes(l2, c23), joinLFBytes(l3, highBytes(c23)) + } + } + + blim, lim, thr := archsimd.BroadcastUint8x16(byte(blimit)), archsimd.BroadcastUint8x16(byte(limit)), archsimd.BroadcastUint8x16(byte(thresh)) + for edge := 8; edge <= 16; edge += 4 { + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if !macroRoundedZeroR2(f, kind) { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + // The caller proves the complete 16x16 window. These stores touch exactly + // four filtered bytes at each position, including overlapping logical rows. + base := off - 2*step + if outer == 1 { + np1.StoreArray((*[16]byte)(p[base : base+16])) + np0.StoreArray((*[16]byte)(p[base+step : base+step+16])) + nq0.StoreArray((*[16]byte)(p[base+2*step : base+2*step+16])) + nq1.StoreArray((*[16]byte)(p[base+3*step : base+3*step+16])) + } else { + { + ab, cd := zipBytesLo(np1, np0), zipBytesLo(nq0, nq1) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + } + { + ab, cd := zipBytesLo(highBytes(np1), highBytes(np0)), zipBytesLo(highBytes(nq0), highBytes(nq1)) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+8*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+9*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+10*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+11*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+12*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+13*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+14*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+15*outer:], hi.GetElem(3)) + } + } + + q0, q1 = nq0, nq1 + } + } + if edge == 16 { + break + } + p3, p2, p1, p0 = q0, q1, q2, q3 + var l0, l1, l2, l3 archsimd.Uint8x16 + { + base := edge + 4 + 0*outer + row := func(y int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p[base+y*outer:])).ReshapeToUint8s() + } + a0, a1 := zipBytesLo(row(0), row(1)), zipBytesLo(row(2), row(3)) + a2, a3 := zipBytesLo(row(4), row(5)), zipBytesLo(row(6), row(7)) + b0, b2 := a0.InterleaveLo(a1).ReshapeToUint32s(), a2.InterleaveLo(a3).ReshapeToUint32s() + c01, c23 := b0.InterleaveLo(b2).ReshapeToUint8s(), b0.InterleaveHi(b2).ReshapeToUint8s() + l0, l1, l2, l3 = c01, highBytes(c01), c23, highBytes(c23) + } + { + base := edge + 4 + 8*outer + row := func(y int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p[base+y*outer:])).ReshapeToUint8s() + } + a0, a1 := zipBytesLo(row(0), row(1)), zipBytesLo(row(2), row(3)) + a2, a3 := zipBytesLo(row(4), row(5)), zipBytesLo(row(6), row(7)) + b0, b2 := a0.InterleaveLo(a1).ReshapeToUint32s(), a2.InterleaveLo(a3).ReshapeToUint32s() + c01, c23 := b0.InterleaveLo(b2).ReshapeToUint8s(), b0.InterleaveHi(b2).ReshapeToUint8s() + q0, q1, q2, q3 = joinLFBytes(l0, c01), joinLFBytes(l1, highBytes(c01)), joinLFBytes(l2, c23), joinLFBytes(l3, highBytes(c23)) + } + } +} + +// Exact rounded identity test: normal |f|<4, macro |f|<3. +func macroRoundedZeroR2(f archsimd.Int8x16, kind int) bool { + bound := uint8(4) + if kind == 6 { + bound = 3 + } + return f.Abs().ToBits().Less(archsimd.BroadcastUint8x16(bound)).ToBits() == 65535 +} diff --git a/internal/pixel/loopfilter_macro_internal_fused_arm64.go b/internal/pixel/loopfilter_macro_internal_fused_arm64.go new file mode 100644 index 0000000..9e6cdba --- /dev/null +++ b/internal/pixel/loopfilter_macro_internal_fused_arm64.go @@ -0,0 +1,540 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_macro_internal_fused_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Byte-domain dataflow extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && arm64 && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +// The macroblock edge and three internal edges retain sequential arithmetic. +// Disjoint vertical rows are packed after all dependent edges are computed. +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +func loopFilterMacroInternalFusedHorizontal(p []byte, pitch, mblimit, blimit, limit, thresh int) { + const kind, lanes, outer = 4, 16, 1 + step := pitch + p3, p2, p1, p0 := loadLFByte(p, 0, 16), loadLFByte(p, step, 16), loadLFByte(p, 2*step, 16), loadLFByte(p, 3*step, 16) + q0, q1, q2, q3 := loadLFByte(p, 4*step, 16), loadLFByte(p, 5*step, 16), loadLFByte(p, 6*step, 16), loadLFByte(p, 7*step, 16) + { + const kind = 6 + off := 4 * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(mblimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if f.Abs().ToBits().ReduceMax() >= 3 { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + np2.StoreArray((*[16]byte)(p[off+-3*step : off+-3*step+16])) + np1.StoreArray((*[16]byte)(p[off+-2*step : off+-2*step+16])) + np0.StoreArray((*[16]byte)(p[off+-1*step : off+-1*step+16])) + nq0.StoreArray((*[16]byte)(p[off+0*step : off+0*step+16])) + nq1.StoreArray((*[16]byte)(p[off+1*step : off+1*step+16])) + nq2.StoreArray((*[16]byte)(p[off+2*step : off+2*step+16])) + + q0, q1, q2 = nq0, nq1, nq2 + } + } + } + } + { + edge := 4 + + p3, p2, p1, p0 = q0, q1, q2, q3 + q0, q1, q2, q3 = loadLFByte(p, (edge+4)*step, 16), loadLFByte(p, (edge+5)*step, 16), loadLFByte(p, (edge+6)*step, 16), loadLFByte(p, (edge+7)*step, 16) + } + + blim, lim, thr := archsimd.BroadcastUint8x16(byte(blimit)), archsimd.BroadcastUint8x16(byte(limit)), archsimd.BroadcastUint8x16(byte(thresh)) + for edge := 8; edge <= 16; edge += 4 { + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if f.Abs().ToBits().ReduceMax() >= 4 { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + // The caller proves the complete 16x16 window. These stores touch exactly + // four filtered bytes at each position, including overlapping logical rows. + base := off - 2*step + if outer == 1 { + np1.StoreArray((*[16]byte)(p[base : base+16])) + np0.StoreArray((*[16]byte)(p[base+step : base+step+16])) + nq0.StoreArray((*[16]byte)(p[base+2*step : base+2*step+16])) + nq1.StoreArray((*[16]byte)(p[base+3*step : base+3*step+16])) + } else { + { + ab, cd := zipBytesLo(np1, np0), zipBytesLo(nq0, nq1) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+0*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+1*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+2*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+3*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+4*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+5*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+6*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+7*outer:], hi.GetElem(3)) + } + { + ab, cd := zipBytesLo(highBytes(np1), highBytes(np0)), zipBytesLo(highBytes(nq0), highBytes(nq1)) + lo, hi := ab.InterleaveLo(cd).ReshapeToUint32s(), ab.InterleaveHi(cd).ReshapeToUint32s() + binary.LittleEndian.PutUint32(p[base+8*outer:], lo.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+9*outer:], lo.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+10*outer:], lo.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+11*outer:], lo.GetElem(3)) + binary.LittleEndian.PutUint32(p[base+12*outer:], hi.GetElem(0)) + binary.LittleEndian.PutUint32(p[base+13*outer:], hi.GetElem(1)) + binary.LittleEndian.PutUint32(p[base+14*outer:], hi.GetElem(2)) + binary.LittleEndian.PutUint32(p[base+15*outer:], hi.GetElem(3)) + } + } + + q0, q1 = nq0, nq1 + } + } + if edge == 16 { + break + } + p3, p2, p1, p0 = q0, q1, q2, q3 + q0, q1, q2, q3 = loadLFByte(p, (edge+4)*step, 16), loadLFByte(p, (edge+5)*step, 16), loadLFByte(p, (edge+6)*step, 16), loadLFByte(p, (edge+7)*step, 16) + } +} +func loopFilterMacroInternalFusedVertical(p []byte, pitch, mblimit, blimit, limit, thresh int) { + const kind, lanes, step = 4, 16, 1 + outer := pitch + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Uint8x16 + w0 := archsimd.LoadUint8x16(p[0*outer:]).ReshapeToUint64s() + w8 := archsimd.LoadUint8x16(p[8*outer:]).ReshapeToUint64s() + r0 := w0.InterleaveLo(w8).ReshapeToUint32s() + h0 := w0.InterleaveHi(w8).ReshapeToUint32s() + w1 := archsimd.LoadUint8x16(p[1*outer:]).ReshapeToUint64s() + w9 := archsimd.LoadUint8x16(p[9*outer:]).ReshapeToUint64s() + r1 := w1.InterleaveLo(w9).ReshapeToUint32s() + h1 := w1.InterleaveHi(w9).ReshapeToUint32s() + w2 := archsimd.LoadUint8x16(p[2*outer:]).ReshapeToUint64s() + w10 := archsimd.LoadUint8x16(p[10*outer:]).ReshapeToUint64s() + r2 := w2.InterleaveLo(w10).ReshapeToUint32s() + h2 := w2.InterleaveHi(w10).ReshapeToUint32s() + w3 := archsimd.LoadUint8x16(p[3*outer:]).ReshapeToUint64s() + w11 := archsimd.LoadUint8x16(p[11*outer:]).ReshapeToUint64s() + r3 := w3.InterleaveLo(w11).ReshapeToUint32s() + h3 := w3.InterleaveHi(w11).ReshapeToUint32s() + w4 := archsimd.LoadUint8x16(p[4*outer:]).ReshapeToUint64s() + w12 := archsimd.LoadUint8x16(p[12*outer:]).ReshapeToUint64s() + r4 := w4.InterleaveLo(w12).ReshapeToUint32s() + h4 := w4.InterleaveHi(w12).ReshapeToUint32s() + w5 := archsimd.LoadUint8x16(p[5*outer:]).ReshapeToUint64s() + w13 := archsimd.LoadUint8x16(p[13*outer:]).ReshapeToUint64s() + r5 := w5.InterleaveLo(w13).ReshapeToUint32s() + h5 := w5.InterleaveHi(w13).ReshapeToUint32s() + w6 := archsimd.LoadUint8x16(p[6*outer:]).ReshapeToUint64s() + w14 := archsimd.LoadUint8x16(p[14*outer:]).ReshapeToUint64s() + r6 := w6.InterleaveLo(w14).ReshapeToUint32s() + h6 := w6.InterleaveHi(w14).ReshapeToUint32s() + w7 := archsimd.LoadUint8x16(p[7*outer:]).ReshapeToUint64s() + w15 := archsimd.LoadUint8x16(p[15*outer:]).ReshapeToUint64s() + r7 := w7.InterleaveLo(w15).ReshapeToUint32s() + h7 := w7.InterleaveHi(w15).ReshapeToUint32s() + a0 := r0.InterleaveEven(r4).ReshapeToUint16s() + a1 := r0.InterleaveOdd(r4).ReshapeToUint16s() + a2 := r1.InterleaveEven(r5).ReshapeToUint16s() + a3 := r1.InterleaveOdd(r5).ReshapeToUint16s() + a4 := r2.InterleaveEven(r6).ReshapeToUint16s() + a5 := r2.InterleaveOdd(r6).ReshapeToUint16s() + a6 := r3.InterleaveEven(r7).ReshapeToUint16s() + a7 := r3.InterleaveOdd(r7).ReshapeToUint16s() + ab0 := a0.InterleaveEven(a4).ReshapeToUint8s() + ab1 := a0.InterleaveOdd(a4).ReshapeToUint8s() + ab2 := a2.InterleaveEven(a6).ReshapeToUint8s() + ab3 := a2.InterleaveOdd(a6).ReshapeToUint8s() + ab4 := a1.InterleaveEven(a5).ReshapeToUint8s() + ab5 := a1.InterleaveOdd(a5).ReshapeToUint8s() + ab6 := a3.InterleaveEven(a7).ReshapeToUint8s() + ab7 := a3.InterleaveOdd(a7).ReshapeToUint8s() + p3 = ab0.InterleaveEven(ab2) + p2 = ab0.InterleaveOdd(ab2) + p1 = ab1.InterleaveEven(ab3) + p0 = ab1.InterleaveOdd(ab3) + q0 = ab4.InterleaveEven(ab6) + q1 = ab4.InterleaveOdd(ab6) + q2 = ab5.InterleaveEven(ab7) + q3 = ab5.InterleaveOdd(ab7) + c0 := h0.InterleaveEven(h4).ReshapeToUint16s() + c1 := h0.InterleaveOdd(h4).ReshapeToUint16s() + c2 := h1.InterleaveEven(h5).ReshapeToUint16s() + c3 := h1.InterleaveOdd(h5).ReshapeToUint16s() + c4 := h2.InterleaveEven(h6).ReshapeToUint16s() + c5 := h2.InterleaveOdd(h6).ReshapeToUint16s() + c6 := h3.InterleaveEven(h7).ReshapeToUint16s() + c7 := h3.InterleaveOdd(h7).ReshapeToUint16s() + cb0 := c0.InterleaveEven(c4).ReshapeToUint8s() + cb1 := c0.InterleaveOdd(c4).ReshapeToUint8s() + cb2 := c2.InterleaveEven(c6).ReshapeToUint8s() + cb3 := c2.InterleaveOdd(c6).ReshapeToUint8s() + cb4 := c1.InterleaveEven(c5).ReshapeToUint8s() + cb5 := c1.InterleaveOdd(c5).ReshapeToUint8s() + cb6 := c3.InterleaveEven(c7).ReshapeToUint8s() + cb7 := c3.InterleaveOdd(c7).ReshapeToUint8s() + later0 := cb0.InterleaveEven(cb2) + later1 := cb0.InterleaveOdd(cb2) + later2 := cb1.InterleaveEven(cb3) + later3 := cb1.InterleaveOdd(cb3) + later4 := cb4.InterleaveEven(cb6) + later5 := cb4.InterleaveOdd(cb6) + later6 := cb5.InterleaveEven(cb7) + later7 := cb5.InterleaveOdd(cb7) + var lfO0, lfO1, lfO2, lfO3, lfO4, lfO5, lfO6, lfO7, lfO8, lfO9, lfO10, lfO11, lfO12, lfO13, lfO14, lfO15 archsimd.Uint8x16 + lfO0, lfO1, lfO2 = p2, p1, p0 + changed := false + { + const kind = 6 + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(mblimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if f.Abs().ToBits().ReduceMax() >= 3 { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + lfO0, lfO1, lfO2 = np2, np1, np0 + changed = true + + q0, q1, q2 = nq0, nq1, nq2 + } + } + } + } + { + + p3, p2, p1, p0 = q0, q1, q2, q3 + q0, q1, q2, q3 = later0, later1, later2, later3 + + } + + blim, lim, thr := archsimd.BroadcastUint8x16(byte(blimit)), archsimd.BroadcastUint8x16(byte(limit)), archsimd.BroadcastUint8x16(byte(thresh)) + { + const edge = 8 + + lfO3, lfO4, lfO5, lfO6 = p3, p2, p1, p0 + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if f.Abs().ToBits().ReduceMax() >= 4 { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + lfO5, lfO6 = np1, np0 + changed = true + + q0, q1 = nq0, nq1 + } + } + p3, p2, p1, p0 = q0, q1, q2, q3 + q0, q1, q2, q3 = later4, later5, later6, later7 + + } + { + const edge = 12 + + lfO7, lfO8, lfO9, lfO10 = p3, p2, p1, p0 + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if f.Abs().ToBits().ReduceMax() >= 4 { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + lfO9, lfO10 = np1, np0 + changed = true + + q0, q1 = nq0, nq1 + } + } + p3, p2, p1, p0 = q0, q1, q2, q3 + // The wrapper proves all twenty columns, including the wide loads at column four. + var r0, r1, r2, r3 archsimd.Uint16x8 + { + w0 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+0*outer : 4+0*outer+16])).ReshapeToUint32s() + w1 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+4*outer : 4+4*outer+16])).ReshapeToUint32s() + w2 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+8*outer : 4+8*outer+16])).ReshapeToUint32s() + w3 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+12*outer : 4+12*outer+16])).ReshapeToUint32s() + w01, w23 := w0.InterleaveOdd(w1).ReshapeToUint64s(), w2.InterleaveOdd(w3).ReshapeToUint64s() + r0 = w01.InterleaveHi(w23).ReshapeToUint16s() + } + { + w0 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+1*outer : 4+1*outer+16])).ReshapeToUint32s() + w1 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+5*outer : 4+5*outer+16])).ReshapeToUint32s() + w2 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+9*outer : 4+9*outer+16])).ReshapeToUint32s() + w3 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+13*outer : 4+13*outer+16])).ReshapeToUint32s() + w01, w23 := w0.InterleaveOdd(w1).ReshapeToUint64s(), w2.InterleaveOdd(w3).ReshapeToUint64s() + r1 = w01.InterleaveHi(w23).ReshapeToUint16s() + } + { + w0 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+2*outer : 4+2*outer+16])).ReshapeToUint32s() + w1 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+6*outer : 4+6*outer+16])).ReshapeToUint32s() + w2 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+10*outer : 4+10*outer+16])).ReshapeToUint32s() + w3 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+14*outer : 4+14*outer+16])).ReshapeToUint32s() + w01, w23 := w0.InterleaveOdd(w1).ReshapeToUint64s(), w2.InterleaveOdd(w3).ReshapeToUint64s() + r2 = w01.InterleaveHi(w23).ReshapeToUint16s() + } + { + w0 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+3*outer : 4+3*outer+16])).ReshapeToUint32s() + w1 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+7*outer : 4+7*outer+16])).ReshapeToUint32s() + w2 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+11*outer : 4+11*outer+16])).ReshapeToUint32s() + w3 := archsimd.LoadUint8x16Array((*[16]byte)(p[4+15*outer : 4+15*outer+16])).ReshapeToUint32s() + w01, w23 := w0.InterleaveOdd(w1).ReshapeToUint64s(), w2.InterleaveOdd(w3).ReshapeToUint64s() + r3 = w01.InterleaveHi(w23).ReshapeToUint16s() + } + a0, a1 := r0.InterleaveEven(r2).ReshapeToUint8s(), r0.InterleaveOdd(r2).ReshapeToUint8s() + a2, a3 := r1.InterleaveEven(r3).ReshapeToUint8s(), r1.InterleaveOdd(r3).ReshapeToUint8s() + q0, q1, q2, q3 = a0.InterleaveEven(a2), a0.InterleaveOdd(a2), a1.InterleaveEven(a3), a1.InterleaveOdd(a3) + + } + { + const edge = 16 + + lfO11, lfO12, lfO13, lfO14 = p3, p2, p1, p0 + off := edge * step + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, blim) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, lim)) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) != 0 { + hev := lfByteGT(d1.Max(d2), thr) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + if f.Abs().ToBits().ReduceMax() >= 4 { + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + + lfO13, lfO14 = np1, np0 + changed = true + + q0, q1 = nq0, nq1 + } + } + } + + if changed { + lfO15 = q0 + storeLFRowValues(p, pitch, lfO0, lfO1, lfO2, lfO3, lfO4, lfO5, lfO6, lfO7, lfO8, lfO9, lfO10, lfO11, lfO12, lfO13, lfO14, lfO15, q1) + } + +} diff --git a/internal/pixel/loopfilter_narrow_simd.go b/internal/pixel/loopfilter_narrow_simd.go new file mode 100644 index 0000000..f5aea60 --- /dev/null +++ b/internal/pixel/loopfilter_narrow_simd.go @@ -0,0 +1,119 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_narrow_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// Narrow filters keep samples in named registers. The flat VP9 filter needs +// two 16-vector arrays, but reserving and clearing those on every VP8 edge +// dominates its loop-filter workload. +func loopFilterNarrow8(p []byte, off, step, outer, blimit, limit, thresh, kind int) { + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Int16x8 + if step == 1 && outer > 1 { + start, width := off-4, 8 + if kind == 2 { + start, width = off-2, 4 + } + c0, c1, c2, c3, c4, c5, c6, c7 := loadEdgeRows(p, start, outer, width) + if kind == 2 { + p1, p0, q0, q1 = widen8(c0), widen8(c1), widen8(c2), widen8(c3) + } else { + p3, p2, p1, p0, q0, q1, q2, q3 = widen8(c0), widen8(c1), widen8(c2), widen8(c3), widen8(c4), widen8(c5), widen8(c6), widen8(c7) + } + } else { + p1, p0, q0, q1 = edgeLoad(p, off-2*step, outer), edgeLoad(p, off-step, outer), edgeLoad(p, off, outer), edgeLoad(p, off+step, outer) + if kind != 2 { + p3, p2, q2, q3 = edgeLoad(p, off-4*step, outer), edgeLoad(p, off-3*step, outer), edgeLoad(p, off+2*step, outer), edgeLoad(p, off+3*step, outer) + } + } + boundary := p0.Sub(q0).Abs().ShiftAllLeft(1).Add(p1.Sub(q1).Abs().ShiftAllRight(1)) + need := boundary.LessEqual(archsimd.BroadcastInt16x8(int16(blimit))) + if kind != 2 { + delta := p3.Sub(p2).Abs().Max(p2.Sub(p1).Abs()).Max(p1.Sub(p0).Abs()).Max(q1.Sub(q0).Abs()).Max(q2.Sub(q1).Abs()).Max(q3.Sub(q2).Abs()) + need = need.And(delta.LessEqual(archsimd.BroadcastInt16x8(int16(limit)))) + } + if !any16(need) { + return + } + hev := p1.Sub(p0).Abs().Max(q1.Sub(q0).Abs()).Greater(archsimd.BroadcastInt16x8(int16(thresh))) + center, three, four := archsimd.BroadcastInt16x8(128), archsimd.BroadcastInt16x8(3), archsimd.BroadcastInt16x8(4) + f := lfClamp(p1.Sub(q1)) + if kind == 4 { + f = f.Masked(hev) + } + f = lfClamp(f.Add(q0.Sub(p0).Mul(three))).Masked(need) + zero := archsimd.Int16x8{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := lfClamp(p0.Sub(center).Add(lfShift3(lfClamp(fh.Add(three))))) + qs0 := lfClamp(q0.Sub(center).Sub(lfShift3(lfClamp(fh.Add(four))))) + ff := f.Masked(hev.ToInt16x8().Equal(zero)) + bias := archsimd.BroadcastInt16x8(63) + u := filterShift7(ff.Mul(archsimd.BroadcastInt16x8(27)).Add(bias)) + o2, o3 := lfClamp(ps0.Add(u)).Add(center), lfClamp(qs0.Sub(u)).Add(center) + u = filterShift7(ff.Mul(archsimd.BroadcastInt16x8(18)).Add(bias)) + o1, o4 := lfClamp(p1.Sub(center).Add(u)).Add(center), lfClamp(q1.Sub(center).Sub(u)).Add(center) + u = filterShift7(ff.Mul(archsimd.BroadcastInt16x8(9)).Add(bias)) + o0, o5 := lfClamp(p2.Sub(center).Add(u)).Add(center), lfClamp(q2.Sub(center).Sub(u)).Add(center) + storeNarrowEdge(p, off-3*step, step, outer, 6, o0, o1, o2, o3, o4, o5) + return + } + f1, f2 := lfShift3(lfClamp(f.Add(four))), lfShift3(lfClamp(f.Add(three))) + o0, o1 := lfClamp(p0.Sub(center).Add(f2)).Add(center), lfClamp(q0.Sub(center).Sub(f1)).Add(center) + if kind == 2 { + storeNarrowEdge(p, off-step, step, outer, 2, o0, o1, zero, zero, zero, zero) + } else { + u := lfShift1(f1.Add(archsimd.BroadcastInt16x8(1))).Masked(hev.ToInt16x8().Equal(zero)) + oP1, oQ1 := lfClamp(p1.Sub(center).Add(u)).Add(center), lfClamp(q1.Sub(center).Sub(u)).Add(center) + storeNarrowEdge(p, off-2*step, step, outer, 4, oP1, o0, o1, oQ1, zero, zero) + } +} +func storeNarrowEdge(p []byte, off, step, outer, count int, v0, v1, v2, v3, v4, v5 archsimd.Int16x8) { + if step != 1 || outer == 1 { + edgeStore(p, off, outer, v0) + edgeStore(p, off+step, outer, v1) + if count >= 4 { + edgeStore(p, off+2*step, outer, v2) + edgeStore(p, off+3*step, outer, v3) + } + if count == 6 { + edgeStore(p, off+4*step, outer, v4) + edgeStore(p, off+5*step, outer, v5) + } + return + } + z := archsimd.Uint8x16{} + r0, r1, r2, r3, r4, r5, r6, r7 := transposeBytes8(packBytes(v0), packBytes(v1), packBytes(v2), packBytes(v3), packBytes(v4), packBytes(v5), z, z) + // Exactly the original 2/4/6 modified columns are written; no neighboring + // bytes are rewritten when parallel workers filter other row regions. + rows := [8]uint64{r0.ReshapeToUint64s().GetElem(0), r1.ReshapeToUint64s().GetElem(0), r2.ReshapeToUint64s().GetElem(0), r3.ReshapeToUint64s().GetElem(0), r4.ReshapeToUint64s().GetElem(0), r5.ReshapeToUint64s().GetElem(0), r6.ReshapeToUint64s().GetElem(0), r7.ReshapeToUint64s().GetElem(0)} + switch count { + case 2: + for y, v := range rows { + binary.LittleEndian.PutUint16(p[off+y*outer:], uint16(v)) + } + case 4: + for y, v := range rows { + binary.LittleEndian.PutUint32(p[off+y*outer:], uint32(v)) + } + case 6: + for y, v := range rows { + row := p[off+y*outer : off+y*outer+6] + binary.LittleEndian.PutUint32(row, uint32(v)) + binary.LittleEndian.PutUint16(row[4:], uint16(v>>32)) + } + } +} diff --git a/internal/pixel/loopfilter_nonflat_arith_simd.go b/internal/pixel/loopfilter_nonflat_arith_simd.go new file mode 100644 index 0000000..96a77ce --- /dev/null +++ b/internal/pixel/loopfilter_nonflat_arith_simd.go @@ -0,0 +1,93 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_nonflat_arith_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Byte-domain dataflow extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +// Non-flat VP9 packets share the canonical byte-filter arithmetic. +package pixel + +import "simd/archsimd" + +func loopFilterNonFlatBytes(p []byte, off, step, outer, blimit, limit, thresh int) bool { + const kind, lanes = 4, 8 + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Uint8x16 + if step == 1 && outer > 1 { + if kind == 2 { + a0, a1, a2, a3, _, _, _, _ := loadLFColumns[[4]byte](p, off-2, outer, lanes) + p1, p0, q0, q1 = a0, a1, a2, a3 + } else { + p3, p2, p1, p0, q0, q1, q2, q3 = loadLFColumns[[8]byte](p, off-4, outer, lanes) + } + } else { + p1, p0, q0, q1 = loadLFByte(p, off-2*step, lanes), loadLFByte(p, off-step, lanes), loadLFByte(p, off, lanes), loadLFByte(p, off+step, lanes) + if kind != 2 { + p3, p2, q2, q3 = loadLFByte(p, off-4*step, lanes), loadLFByte(p, off-3*step, lanes), loadLFByte(p, off+2*step, lanes), loadLFByte(p, off+3*step, lanes) + } + } + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(blimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0) == 0 { + return true + } + // The upper eight lanes are outside this packet. A single active flat + // lane requires the full 7/15-tap filter, so reject without any stores. + flatDelta := lfAbsByte(p3, p0).Max(lfAbsByte(p2, p0)).Max(d1).Max(d2).Max(lfAbsByte(q2, q0)).Max(lfAbsByte(q3, q0)) + flat := need.And(lfByteLE(flatDelta, archsimd.BroadcastUint8x16(1))).ToInt8x16().ToBits().ReshapeToUint64s() + if flat.GetElem(0) != 0 { + return false + } + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-3*step, step, outer, lanes, 6, np2, np1, np0, nq0, nq1, nq2) + return true + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFBytes(p, off-step, step, outer, lanes, 2, np0, nq0, z, z, z, z) + return true + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + storeLFBytes(p, off-2*step, step, outer, lanes, 4, np1, np0, nq0, nq1, z, z) + return true +} diff --git a/internal/pixel/loopfilter_rowvalues_arm64.go b/internal/pixel/loopfilter_rowvalues_arm64.go new file mode 100644 index 0000000..e27976f --- /dev/null +++ b/internal/pixel/loopfilter_rowvalues_arm64.go @@ -0,0 +1,118 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_rowvalues_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +package pixel + +import "simd/archsimd" + +// storeLFRowValues transposes sixteen finalized columns into row stores. +// The caller proves disjoint rows and a complete 20x16 tile; these stores +// touch exactly columns 1..17, preserving the three surrounding columns. +func storeLFRowValues(p []byte, pitch int, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, tail archsimd.Uint8x16) { + t0_0_0_Lo := c0.InterleaveLo(c1) + t0_0_0_Hi := c0.InterleaveHi(c1) + t0_2_0_Lo := c2.InterleaveLo(c3) + t0_2_0_Hi := c2.InterleaveHi(c3) + t0_4_0_Lo := c4.InterleaveLo(c5) + t0_4_0_Hi := c4.InterleaveHi(c5) + t0_6_0_Lo := c6.InterleaveLo(c7) + t0_6_0_Hi := c6.InterleaveHi(c7) + t0_8_0_Lo := c8.InterleaveLo(c9) + t0_8_0_Hi := c8.InterleaveHi(c9) + t0_10_0_Lo := c10.InterleaveLo(c11) + t0_10_0_Hi := c10.InterleaveHi(c11) + t0_12_0_Lo := c12.InterleaveLo(c13) + t0_12_0_Hi := c12.InterleaveHi(c13) + t0_14_0_Lo := c14.InterleaveLo(c15) + t0_14_0_Hi := c14.InterleaveHi(c15) + t1_0_0_Lo := t0_0_0_Lo.ReshapeToUint16s().InterleaveLo(t0_2_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_0_0_Hi := t0_0_0_Lo.ReshapeToUint16s().InterleaveHi(t0_2_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_0_1_Lo := t0_0_0_Hi.ReshapeToUint16s().InterleaveLo(t0_2_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t1_0_1_Hi := t0_0_0_Hi.ReshapeToUint16s().InterleaveHi(t0_2_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t1_2_0_Lo := t0_4_0_Lo.ReshapeToUint16s().InterleaveLo(t0_6_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_2_0_Hi := t0_4_0_Lo.ReshapeToUint16s().InterleaveHi(t0_6_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_2_1_Lo := t0_4_0_Hi.ReshapeToUint16s().InterleaveLo(t0_6_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t1_2_1_Hi := t0_4_0_Hi.ReshapeToUint16s().InterleaveHi(t0_6_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t1_4_0_Lo := t0_8_0_Lo.ReshapeToUint16s().InterleaveLo(t0_10_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_4_0_Hi := t0_8_0_Lo.ReshapeToUint16s().InterleaveHi(t0_10_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_4_1_Lo := t0_8_0_Hi.ReshapeToUint16s().InterleaveLo(t0_10_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t1_4_1_Hi := t0_8_0_Hi.ReshapeToUint16s().InterleaveHi(t0_10_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t1_6_0_Lo := t0_12_0_Lo.ReshapeToUint16s().InterleaveLo(t0_14_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_6_0_Hi := t0_12_0_Lo.ReshapeToUint16s().InterleaveHi(t0_14_0_Lo.ReshapeToUint16s()).ReshapeToUint8s() + t1_6_1_Lo := t0_12_0_Hi.ReshapeToUint16s().InterleaveLo(t0_14_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t1_6_1_Hi := t0_12_0_Hi.ReshapeToUint16s().InterleaveHi(t0_14_0_Hi.ReshapeToUint16s()).ReshapeToUint8s() + t2_0_0_Lo := t1_0_0_Lo.ReshapeToUint32s().InterleaveLo(t1_2_0_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_0_0_Hi := t1_0_0_Lo.ReshapeToUint32s().InterleaveHi(t1_2_0_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_0_1_Lo := t1_0_0_Hi.ReshapeToUint32s().InterleaveLo(t1_2_0_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t2_0_1_Hi := t1_0_0_Hi.ReshapeToUint32s().InterleaveHi(t1_2_0_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t2_0_2_Lo := t1_0_1_Lo.ReshapeToUint32s().InterleaveLo(t1_2_1_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_0_2_Hi := t1_0_1_Lo.ReshapeToUint32s().InterleaveHi(t1_2_1_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_0_3_Lo := t1_0_1_Hi.ReshapeToUint32s().InterleaveLo(t1_2_1_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t2_0_3_Hi := t1_0_1_Hi.ReshapeToUint32s().InterleaveHi(t1_2_1_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_0_Lo := t1_4_0_Lo.ReshapeToUint32s().InterleaveLo(t1_6_0_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_0_Hi := t1_4_0_Lo.ReshapeToUint32s().InterleaveHi(t1_6_0_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_1_Lo := t1_4_0_Hi.ReshapeToUint32s().InterleaveLo(t1_6_0_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_1_Hi := t1_4_0_Hi.ReshapeToUint32s().InterleaveHi(t1_6_0_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_2_Lo := t1_4_1_Lo.ReshapeToUint32s().InterleaveLo(t1_6_1_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_2_Hi := t1_4_1_Lo.ReshapeToUint32s().InterleaveHi(t1_6_1_Lo.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_3_Lo := t1_4_1_Hi.ReshapeToUint32s().InterleaveLo(t1_6_1_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t2_2_3_Hi := t1_4_1_Hi.ReshapeToUint32s().InterleaveHi(t1_6_1_Hi.ReshapeToUint32s()).ReshapeToUint8s() + t3_0_0_Lo := t2_0_0_Lo.ReshapeToUint64s().InterleaveLo(t2_2_0_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_0_Hi := t2_0_0_Lo.ReshapeToUint64s().InterleaveHi(t2_2_0_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_1_Lo := t2_0_0_Hi.ReshapeToUint64s().InterleaveLo(t2_2_0_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_1_Hi := t2_0_0_Hi.ReshapeToUint64s().InterleaveHi(t2_2_0_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_2_Lo := t2_0_1_Lo.ReshapeToUint64s().InterleaveLo(t2_2_1_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_2_Hi := t2_0_1_Lo.ReshapeToUint64s().InterleaveHi(t2_2_1_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_3_Lo := t2_0_1_Hi.ReshapeToUint64s().InterleaveLo(t2_2_1_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_3_Hi := t2_0_1_Hi.ReshapeToUint64s().InterleaveHi(t2_2_1_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_4_Lo := t2_0_2_Lo.ReshapeToUint64s().InterleaveLo(t2_2_2_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_4_Hi := t2_0_2_Lo.ReshapeToUint64s().InterleaveHi(t2_2_2_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_5_Lo := t2_0_2_Hi.ReshapeToUint64s().InterleaveLo(t2_2_2_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_5_Hi := t2_0_2_Hi.ReshapeToUint64s().InterleaveHi(t2_2_2_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_6_Lo := t2_0_3_Lo.ReshapeToUint64s().InterleaveLo(t2_2_3_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_6_Hi := t2_0_3_Lo.ReshapeToUint64s().InterleaveHi(t2_2_3_Lo.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_7_Lo := t2_0_3_Hi.ReshapeToUint64s().InterleaveLo(t2_2_3_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_7_Hi := t2_0_3_Hi.ReshapeToUint64s().InterleaveHi(t2_2_3_Hi.ReshapeToUint64s()).ReshapeToUint8s() + t3_0_0_Lo.StoreArray((*[16]byte)(p[0*pitch+1 : 0*pitch+17])) + p[0*pitch+17] = tail.GetElem(0) + t3_0_0_Hi.StoreArray((*[16]byte)(p[1*pitch+1 : 1*pitch+17])) + p[1*pitch+17] = tail.GetElem(1) + t3_0_1_Lo.StoreArray((*[16]byte)(p[2*pitch+1 : 2*pitch+17])) + p[2*pitch+17] = tail.GetElem(2) + t3_0_1_Hi.StoreArray((*[16]byte)(p[3*pitch+1 : 3*pitch+17])) + p[3*pitch+17] = tail.GetElem(3) + t3_0_2_Lo.StoreArray((*[16]byte)(p[4*pitch+1 : 4*pitch+17])) + p[4*pitch+17] = tail.GetElem(4) + t3_0_2_Hi.StoreArray((*[16]byte)(p[5*pitch+1 : 5*pitch+17])) + p[5*pitch+17] = tail.GetElem(5) + t3_0_3_Lo.StoreArray((*[16]byte)(p[6*pitch+1 : 6*pitch+17])) + p[6*pitch+17] = tail.GetElem(6) + t3_0_3_Hi.StoreArray((*[16]byte)(p[7*pitch+1 : 7*pitch+17])) + p[7*pitch+17] = tail.GetElem(7) + t3_0_4_Lo.StoreArray((*[16]byte)(p[8*pitch+1 : 8*pitch+17])) + p[8*pitch+17] = tail.GetElem(8) + t3_0_4_Hi.StoreArray((*[16]byte)(p[9*pitch+1 : 9*pitch+17])) + p[9*pitch+17] = tail.GetElem(9) + t3_0_5_Lo.StoreArray((*[16]byte)(p[10*pitch+1 : 10*pitch+17])) + p[10*pitch+17] = tail.GetElem(10) + t3_0_5_Hi.StoreArray((*[16]byte)(p[11*pitch+1 : 11*pitch+17])) + p[11*pitch+17] = tail.GetElem(11) + t3_0_6_Lo.StoreArray((*[16]byte)(p[12*pitch+1 : 12*pitch+17])) + p[12*pitch+17] = tail.GetElem(12) + t3_0_6_Hi.StoreArray((*[16]byte)(p[13*pitch+1 : 13*pitch+17])) + p[13*pitch+17] = tail.GetElem(13) + t3_0_7_Lo.StoreArray((*[16]byte)(p[14*pitch+1 : 14*pitch+17])) + p[14*pitch+17] = tail.GetElem(14) + t3_0_7_Hi.StoreArray((*[16]byte)(p[15*pitch+1 : 15*pitch+17])) + p[15*pitch+17] = tail.GetElem(15) +} diff --git a/internal/pixel/loopfilter_simd.go b/internal/pixel/loopfilter_simd.go new file mode 100644 index 0000000..f9b1e9c --- /dev/null +++ b/internal/pixel/loopfilter_simd.go @@ -0,0 +1,531 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// LoopFilterInternal16 filters the three four-pixel-spaced internal edges +// of a 16x16 tile. step crosses the edges; outer walks along them. Edges +// retain their original order because each can read the preceding result. +func LoopFilterInternal16(p []byte, step, outer, blimit, limit, thresh int) bool { + if !Enabled || step <= 0 || outer <= 0 || blimit < 0 || blimit >= 255 || limit < 0 || limit > 255 || thresh < 0 || thresh > 255 { + return false + } + if !((outer == 1 && step >= 16) || (step == 1 && outer >= 8)) { + return false + } + // Three complete eight-row/column windows occupy the exact 16x16 tile. + // Divide before multiplying so oversized strides cannot wrap the tile. + if len(p) == 0 { + return false + } + span := (len(p) - 1) / 15 + if step > span || outer > span-step { + return false + } + if internalFused { + if outer == 1 { + loopFilterInternalFusedHorizontal(p, step, blimit, limit, thresh) + } else { + loopFilterInternalFusedVertical(p, outer, blimit, limit, thresh) + } + return true + } + if internalVerticalGeneric && step == 1 { + loopFilterBytes(p, 4, 1, outer, 16, blimit, limit, thresh, 4) + loopFilterBytes(p, 8, 1, outer, 16, blimit, limit, thresh, 4) + loopFilterBytes(p, 12, 1, outer, 16, blimit, limit, thresh, 4) + return true + } + loopFilterInternalEdge(p, 4*step, step, outer, blimit, limit, thresh) + loopFilterInternalEdge(p, 8*step, step, outer, blimit, limit, thresh) + loopFilterInternalEdge(p, 12*step, step, outer, blimit, limit, thresh) + return true +} + +// loopFilterNonFlat uses the byte-domain narrow filter only when no lane +// requires flat filtering. It never writes a rejected packet. +func loopFilterNonFlat(p []byte, off, step, outer, blimit, limit, thresh int) bool { + if blimit < 0 || blimit >= 255 || limit < 0 || limit > 255 || thresh < 0 || thresh > 255 || !((outer == 1 && step >= 8) || (step == 1 && outer >= 8)) { + return false + } + if off < 0 || off >= len(p) || step > off/4 { + return false + } + room := len(p) - 1 - off + if step > room/3 || outer > (room-3*step)/7 { + return false + } + return loopFilterNonFlatBytes(p, off, step, outer, blimit, limit, thresh) +} + +// LoopFilter is the shared 8-bit libvpx deblocker. kind is 2 (VP8 simple), +// 4 (VP8/VP9 narrow), 6 (VP8 macroblock), 8 or 16 (VP9 flat filters). +// Lanes span eight independent edge positions; step crosses the edge and +// outer walks along it. All centering and signed saturation follow libvpx. +func LoopFilter(p []byte, q0, step, outer, n, blimit, limit, thresh, kind int) bool { + if !Enabled { + return false + } + if loopFilterWide(p, q0, step, outer, n, blimit, limit, thresh, kind) { + return true + } + if kind == 2 || kind == 4 || kind == 6 { + for base := 0; base < n; base += 8 { + loopFilterNarrow8(p, q0+base*outer, step, outer, blimit, limit, thresh, kind) + } + return true + } + for base := 0; base < n; base += 8 { + if !loopFilterNonFlat(p, q0+base*outer, step, outer, blimit, limit, thresh) { + loopFilter8(p, q0+base*outer, step, outer, blimit, limit, thresh, kind) + } + } + return true +} +func edgeLoad(p []byte, off, outer int) archsimd.Int16x8 { + if outer == 1 { + return widen8(load8(p[off:])) + } + var b [16]byte + for i := range 8 { + b[i] = p[off+i*outer] + } + return widen8(archsimd.LoadUint8x16(b[:])) +} +func edgeStore(p []byte, off, outer int, v archsimd.Int16x8) { + if outer == 1 { + storeBytes8(p[off:], packBytes(v)) + return + } + var b [16]byte + packBytes(v).Store(b[:]) + for i := range 8 { + p[off+i*outer] = b[i] + } +} + +// transposeBytes8 keeps eight strided edge positions in registers. Each +// input/output uses its low eight bytes; transposing twice is the identity. +func transposeBytes8(v0, v1, v2, v3, v4, v5, v6, v7 archsimd.Uint8x16) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + a0 := zipBytesLo(v0, v1) + a1 := zipBytesLo(v2, v3) + a2 := zipBytesLo(v4, v5) + a3 := zipBytesLo(v6, v7) + b0 := a0.InterleaveLo(a1).ReshapeToUint32s() + b1 := a0.InterleaveHi(a1).ReshapeToUint32s() + b2 := a2.InterleaveLo(a3).ReshapeToUint32s() + b3 := a2.InterleaveHi(a3).ReshapeToUint32s() + c01 := b0.InterleaveLo(b2).ReshapeToUint8s() + c23 := b0.InterleaveHi(b2).ReshapeToUint8s() + c45 := b1.InterleaveLo(b3).ReshapeToUint8s() + c67 := b1.InterleaveHi(b3).ReshapeToUint8s() + return c01, highBytes(c01), c23, highBytes(c23), c45, highBytes(c45), c67, highBytes(c67) +} +func loadEdgeRows(p []byte, off, pitch, width int) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + // loadN reads exactly width bytes, including on the final row. The slice + // checks prove the complete tile before any vector read. + row := func(y int) archsimd.Uint8x16 { + start := off + y*pitch + return loadN(p[start:start+width], width) + } + return transposeBytes8(row(0), row(1), row(2), row(3), row(4), row(5), row(6), row(7)) +} +func loadEdgeTile(p []byte, off, pitch, width int, a *[16]archsimd.Int16x8, first int) { + c0, c1, c2, c3, c4, c5, c6, c7 := loadEdgeRows(p, off, pitch, width) + a[first], a[first+1], a[first+2], a[first+3] = widen8(c0), widen8(c1), widen8(c2), widen8(c3) + if width == 8 { + a[first+4], a[first+5], a[first+6], a[first+7] = widen8(c4), widen8(c5), widen8(c6), widen8(c7) + } +} +func storeEdgeTile(p []byte, off, pitch, tileFirst, width, first, last int, b *[16]archsimd.Int16x8) { + c0, c1, c2, c3 := packBytes(b[tileFirst]), packBytes(b[tileFirst+1]), packBytes(b[tileFirst+2]), packBytes(b[tileFirst+3]) + c4, c5, c6, c7 := archsimd.Uint8x16{}, archsimd.Uint8x16{}, archsimd.Uint8x16{}, archsimd.Uint8x16{} + if width == 8 { + c4, c5, c6, c7 = packBytes(b[tileFirst+4]), packBytes(b[tileFirst+5]), packBytes(b[tileFirst+6]), packBytes(b[tileFirst+7]) + } + r0, r1, r2, r3, r4, r5, r6, r7 := transposeBytes8(c0, c1, c2, c3, c4, c5, c6, c7) + rows := [8]archsimd.Uint8x16{r0, r1, r2, r3, r4, r5, r6, r7} + // Only write columns that the original filter writes. Rewriting unchanged + // neighbors would introduce conflicting accesses in parallel row filtering. + for y := range 8 { + start := off + y*pitch + first - tileFirst + out := p[start : start+last-first] + bits := rows[y].ReshapeToUint64s().GetElem(0) >> uint(8*(first-tileFirst)) + switch last - first { + case 2: + binary.LittleEndian.PutUint16(out, uint16(bits)) + case 4: + binary.LittleEndian.PutUint32(out, uint32(bits)) + case 6: + binary.LittleEndian.PutUint32(out, uint32(bits)) + binary.LittleEndian.PutUint16(out[4:], uint16(bits>>32)) + case 7: + binary.LittleEndian.PutUint32(out, uint32(bits)) + binary.LittleEndian.PutUint16(out[4:], uint16(bits>>32)) + out[6] = byte(bits >> 48) + } + } +} +func loadFarEdgeTiles(p []byte, off, pitch int, a *[16]archsimd.Int16x8) { + // Pack both 4-column far strips (p7..p4 at off-8, q4..q7 at off+4) into + // one 8-byte row per scanline so a single 8x8 transpose produces all eight + // far columns in registers instead of two separate transposes. + row := func(y int) archsimd.Uint8x16 { + base := off + y*pitch + lo := uint64(binary.LittleEndian.Uint32(p[base-8 : base-4])) + hi := uint64(binary.LittleEndian.Uint32(p[base+4 : base+8])) + return archsimd.Uint64x2{}.SetElem(0, lo|(hi<<32)).ReshapeToUint8s() + } + c0, c1, c2, c3, c4, c5, c6, c7 := transposeBytes8(row(0), row(1), row(2), row(3), row(4), row(5), row(6), row(7)) + a[0], a[1], a[2], a[3] = widen8(c0), widen8(c1), widen8(c2), widen8(c3) + a[12], a[13], a[14], a[15] = widen8(c4), widen8(c5), widen8(c6), widen8(c7) +} +func storeEdgeTile14(p []byte, off, pitch int, b *[16]archsimd.Int16x8) { + // The 15-tap vertical filter writes 14 contiguous columns p6..q6 (indices + // 1..14) per row without touching p7 or q7. Two overlapping 8-byte stores + // cover [off-7, off+7) per row in 2 stores instead of 6. + z := archsimd.Uint8x16{} + l0, l1, l2, l3, l4, l5, l6, l7 := transposeBytes8( + z, packBytes(b[1]), packBytes(b[2]), packBytes(b[3]), + packBytes(b[4]), packBytes(b[5]), packBytes(b[6]), packBytes(b[7]), + ) + r0, r1, r2, r3, r4, r5, r6, r7 := transposeBytes8( + packBytes(b[8]), packBytes(b[9]), packBytes(b[10]), packBytes(b[11]), + packBytes(b[12]), packBytes(b[13]), packBytes(b[14]), z, + ) + left := [8]archsimd.Uint8x16{l0, l1, l2, l3, l4, l5, l6, l7} + right := [8]archsimd.Uint8x16{r0, r1, r2, r3, r4, r5, r6, r7} + for y := range 8 { + L := left[y].ReshapeToUint64s().GetElem(0) + R := right[y].ReshapeToUint64s().GetElem(0) + out := p[off-7+y*pitch : off+7+y*pitch] + binary.LittleEndian.PutUint64(out[0:8], (L>>8)|(R<<56)) + binary.LittleEndian.PutUint64(out[6:14], (L>>56)|(R<<8)) + } +} +func any16(m archsimd.Mask16x8) bool { + v := m.ToInt16x8().ToBits().ReshapeToUint64s() + return v.GetElem(0)|v.GetElem(1) != 0 +} +func all16(m archsimd.Mask16x8) bool { + v := m.ToInt16x8().ToBits().ReshapeToUint64s() + return v.GetElem(0)&v.GetElem(1) == ^uint64(0) +} +func maskDiff16(a, b archsimd.Mask16x8) bool { + x := a.ToInt16x8().Xor(b.ToInt16x8()).ToBits().ReshapeToUint64s() + return x.GetElem(0)|x.GetElem(1) != 0 +} +func lfClamp(v archsimd.Int16x8) archsimd.Int16x8 { + return v.Max(archsimd.BroadcastInt16x8(-128)).Min(archsimd.BroadcastInt16x8(127)) +} +func loopFilter8(p []byte, off, step, outer, blimit, limit, thresh, kind int) { + var a, b [16]archsimd.Int16x8 + // The narrow window always has p1,p0,q0,q1. Wider masks also inspect + // p3,p2,q2,q3, while the flat16 samples are loaded only after the mask. + first, last := 4, 12 + if kind == 2 { + first, last = 6, 10 + } + tileFirst, tileWidth := first, last-first + tiled := step == 1 && outer > 1 + if tiled { + loadEdgeTile(p, off+first-8, outer, tileWidth, &a, first) + } else { + for i := first; i < last; i++ { + a[i] = edgeLoad(p, off+(i-8)*step, outer) + } + } + if kind == 8 { + same := a[4].Xor(a[5]) + for i := 6; i < 12; i++ { + same = same.Or(a[4].Xor(a[i])) + } + if !any16(same.NotEqual(archsimd.Int16x8{})) { + return + } + } + for i := first; i < last; i++ { + b[i] = a[i] + } + p1, p0, q0, q1 := a[6], a[7], a[8], a[9] + boundary := p0.Sub(q0).Abs().ShiftAllLeft(1).Add(p1.Sub(q1).Abs().ShiftAllRight(1)) + need := boundary.LessEqual(archsimd.BroadcastInt16x8(int16(blimit))) + if kind != 2 { + maxdiff := a[4].Sub(a[5]).Abs().Max(a[5].Sub(p1).Abs()).Max(p1.Sub(p0).Abs()).Max(q1.Sub(q0).Abs()).Max(a[10].Sub(q1).Abs()).Max(a[11].Sub(a[10]).Abs()) + need = need.And(maxdiff.LessEqual(archsimd.BroadcastInt16x8(int16(limit)))) + } + if !any16(need) { + return + } + one := archsimd.BroadcastInt16x8(1) + if kind == 8 || kind == 16 { + flat := a[4].Sub(p0).Abs().Max(a[5].Sub(p0).Abs()).Max(p1.Sub(p0).Abs()).Max(q1.Sub(q0).Abs()).Max(a[10].Sub(q0).Abs()).Max(a[11].Sub(q0).Abs()).LessEqual(one).And(need) + hasFlat := any16(flat) + var flat2 archsimd.Mask16x8 + hasFlat2 := false + if kind == 16 && hasFlat { + far := archsimd.Int16x8{} + if tiled { + loadFarEdgeTiles(p, off, outer, &a) + } else { + for i := range 4 { + a[i] = edgeLoad(p, off+(i-8)*step, outer) + a[12+i] = edgeLoad(p, off+(i+4)*step, outer) + } + } + for i := range 4 { + far = far.Max(a[i].Sub(p0).Abs()).Max(a[12+i].Sub(q0).Abs()) + } + flat2 = flat.And(far.LessEqual(one)) + hasFlat2 = any16(flat2) + if hasFlat2 && !all16(flat2) { + b[1], b[2], b[3] = a[1], a[2], a[3] + b[12], b[13], b[14] = a[12], a[13], a[14] + } + } + if !hasFlat || maskDiff16(need, flat) { + hev := p1.Sub(p0).Abs().Max(q1.Sub(q0).Abs()).Greater(archsimd.BroadcastInt16x8(int16(thresh))) + center := archsimd.BroadcastInt16x8(128) + three := archsimd.BroadcastInt16x8(3) + four := archsimd.BroadcastInt16x8(4) + f := lfClamp(p1.Sub(q1)).Masked(hev) + f = lfClamp(f.Add(q0.Sub(p0).Mul(three))).Masked(need) + f1 := lfClamp(f.Add(four)).ShiftAllRight(3) + f2 := lfClamp(f.Add(three)).ShiftAllRight(3) + b[7] = lfClamp(p0.Sub(center).Add(f2)).Add(center) + b[8] = lfClamp(q0.Sub(center).Sub(f1)).Add(center) + u := f1.Add(one).ShiftAllRight(1).Masked(hev.ToInt16x8().Equal(archsimd.Int16x8{})) + b[6] = lfClamp(p1.Sub(center).Add(u)).Add(center) + b[9] = lfClamp(q1.Sub(center).Sub(u)).Add(center) + } + first, last = 6, 10 + if hasFlat { + if !hasFlat2 || maskDiff16(flat, flat2) { + flatFilter7(&a, &b, flat) + } + first, last = 5, 11 + if hasFlat2 { + flatFilter15(&a, &b, flat2) + first, last = 1, 15 + } + } + } else { + hev := p1.Sub(p0).Abs().Max(q1.Sub(q0).Abs()).Greater(archsimd.BroadcastInt16x8(int16(thresh))) + center := archsimd.BroadcastInt16x8(128) + three := archsimd.BroadcastInt16x8(3) + four := archsimd.BroadcastInt16x8(4) + f := lfClamp(p1.Sub(q1)) + if kind != 2 && kind != 6 { + f = f.Masked(hev) + } + f = lfClamp(f.Add(q0.Sub(p0).Mul(three))).Masked(need) + if kind == 6 { + fh := f.Masked(hev) + f1 := lfClamp(fh.Add(four)).ShiftAllRight(3) + f2 := lfClamp(fh.Add(three)).ShiftAllRight(3) + ps0 := lfClamp(p0.Sub(center).Add(f2)) + qs0 := lfClamp(q0.Sub(center).Sub(f1)) + ff := f.Masked(hev.ToInt16x8().Equal(archsimd.Int16x8{})) + bias := archsimd.BroadcastInt16x8(63) + u := ff.Mul(archsimd.BroadcastInt16x8(27)).Add(bias).ShiftAllRight(7) + b[7] = lfClamp(ps0.Add(u)).Add(center) + b[8] = lfClamp(qs0.Sub(u)).Add(center) + u = ff.Mul(archsimd.BroadcastInt16x8(18)).Add(bias).ShiftAllRight(7) + b[6] = lfClamp(p1.Sub(center).Add(u)).Add(center) + b[9] = lfClamp(q1.Sub(center).Sub(u)).Add(center) + u = ff.Mul(archsimd.BroadcastInt16x8(9)).Add(bias).ShiftAllRight(7) + b[5] = lfClamp(a[5].Sub(center).Add(u)).Add(center) + b[10] = lfClamp(a[10].Sub(center).Sub(u)).Add(center) + first, last = 5, 11 + } else { + f1 := lfClamp(f.Add(four)).ShiftAllRight(3) + f2 := lfClamp(f.Add(three)).ShiftAllRight(3) + b[7] = lfClamp(p0.Sub(center).Add(f2)).Add(center) + b[8] = lfClamp(q0.Sub(center).Sub(f1)).Add(center) + first, last = 7, 9 + if kind != 2 { + u := f1.Add(one).ShiftAllRight(1).Masked(hev.ToInt16x8().Equal(archsimd.Int16x8{})) + b[6] = lfClamp(p1.Sub(center).Add(u)).Add(center) + b[9] = lfClamp(q1.Sub(center).Sub(u)).Add(center) + first, last = 6, 10 + } + } + } + if tiled && first >= tileFirst && last <= tileFirst+tileWidth { + storeEdgeTile(p, off+tileFirst-8, outer, tileFirst, tileWidth, first, last, &b) + } else if tiled && first == 1 && last == 15 { + storeEdgeTile14(p, off, outer, &b) + } else { + for i := first; i < last; i++ { + edgeStore(p, off+(i-8)*step, outer, b[i]) + } + } +} + +// flatFilter7 computes the 7-tap flat filter over columns 5..10 using +// constant-indexed sliding sums (zero bounds checks or min/max branches). +func flatFilter7(a, b *[16]archsimd.Int16x8, mask archsimd.Mask16x8) { + a4, a5, a6, a7 := a[4], a[5], a[6], a[7] + a8, a9, a10, a11 := a[8], a[9], a[10], a[11] + round := archsimd.BroadcastInt16x8(4) + sum := a4.ShiftAllLeft(1).Add(a4).Add(a5).Add(a6).Add(a7).Add(a8) + if all16(mask) { + b[5] = sum.Add(a5).Add(round).ShiftAllRight(3) + sum = sum.Sub(a4).Add(a9) + b[6] = sum.Add(a6).Add(round).ShiftAllRight(3) + sum = sum.Sub(a4).Add(a10) + b[7] = sum.Add(a7).Add(round).ShiftAllRight(3) + sum = sum.Sub(a4).Add(a11) + b[8] = sum.Add(a8).Add(round).ShiftAllRight(3) + sum = sum.Sub(a5).Add(a11) + b[9] = sum.Add(a9).Add(round).ShiftAllRight(3) + sum = sum.Sub(a6).Add(a11) + b[10] = sum.Add(a10).Add(round).ShiftAllRight(3) + return + } + b[5] = sum.Add(a5).Add(round).ShiftAllRight(3).IfElse(mask, b[5]) + sum = sum.Sub(a4).Add(a9) + b[6] = sum.Add(a6).Add(round).ShiftAllRight(3).IfElse(mask, b[6]) + sum = sum.Sub(a4).Add(a10) + b[7] = sum.Add(a7).Add(round).ShiftAllRight(3).IfElse(mask, b[7]) + sum = sum.Sub(a4).Add(a11) + b[8] = sum.Add(a8).Add(round).ShiftAllRight(3).IfElse(mask, b[8]) + sum = sum.Sub(a5).Add(a11) + b[9] = sum.Add(a9).Add(round).ShiftAllRight(3).IfElse(mask, b[9]) + sum = sum.Sub(a6).Add(a11) + b[10] = sum.Add(a10).Add(round).ShiftAllRight(3).IfElse(mask, b[10]) +} + +// flatFilter15 computes the 15-tap flat2 filter over columns 1..14 using +// constant-indexed sliding sums with a fast path when all 8 lanes take flat2. +func flatFilter15(a, b *[16]archsimd.Int16x8, mask archsimd.Mask16x8) { + a0, a1, a2, a3 := a[0], a[1], a[2], a[3] + a4, a5, a6, a7 := a[4], a[5], a[6], a[7] + a8, a9, a10, a11 := a[8], a[9], a[10], a[11] + a12, a13, a14, a15 := a[12], a[13], a[14], a[15] + round := archsimd.BroadcastInt16x8(8) + // Initial sum for i=1: 7*a[0] + a[1] + ... + a[8]. + sum := a0.ShiftAllLeft(3).Sub(a0).Add(a1).Add(a2).Add(a3).Add(a4).Add(a5).Add(a6).Add(a7).Add(a8) + if all16(mask) { + b[1] = sum.Add(a1).Add(round).ShiftAllRight(4) + sum = sum.Sub(a0).Add(a9) + b[2] = sum.Add(a2).Add(round).ShiftAllRight(4) + sum = sum.Sub(a0).Add(a10) + b[3] = sum.Add(a3).Add(round).ShiftAllRight(4) + sum = sum.Sub(a0).Add(a11) + b[4] = sum.Add(a4).Add(round).ShiftAllRight(4) + sum = sum.Sub(a0).Add(a12) + b[5] = sum.Add(a5).Add(round).ShiftAllRight(4) + sum = sum.Sub(a0).Add(a13) + b[6] = sum.Add(a6).Add(round).ShiftAllRight(4) + sum = sum.Sub(a0).Add(a14) + b[7] = sum.Add(a7).Add(round).ShiftAllRight(4) + sum = sum.Sub(a0).Add(a15) + b[8] = sum.Add(a8).Add(round).ShiftAllRight(4) + sum = sum.Sub(a1).Add(a15) + b[9] = sum.Add(a9).Add(round).ShiftAllRight(4) + sum = sum.Sub(a2).Add(a15) + b[10] = sum.Add(a10).Add(round).ShiftAllRight(4) + sum = sum.Sub(a3).Add(a15) + b[11] = sum.Add(a11).Add(round).ShiftAllRight(4) + sum = sum.Sub(a4).Add(a15) + b[12] = sum.Add(a12).Add(round).ShiftAllRight(4) + sum = sum.Sub(a5).Add(a15) + b[13] = sum.Add(a13).Add(round).ShiftAllRight(4) + sum = sum.Sub(a6).Add(a15) + b[14] = sum.Add(a14).Add(round).ShiftAllRight(4) + return + } + b[1] = sum.Add(a1).Add(round).ShiftAllRight(4).IfElse(mask, b[1]) + sum = sum.Sub(a0).Add(a9) + b[2] = sum.Add(a2).Add(round).ShiftAllRight(4).IfElse(mask, b[2]) + sum = sum.Sub(a0).Add(a10) + b[3] = sum.Add(a3).Add(round).ShiftAllRight(4).IfElse(mask, b[3]) + sum = sum.Sub(a0).Add(a11) + b[4] = sum.Add(a4).Add(round).ShiftAllRight(4).IfElse(mask, b[4]) + sum = sum.Sub(a0).Add(a12) + b[5] = sum.Add(a5).Add(round).ShiftAllRight(4).IfElse(mask, b[5]) + sum = sum.Sub(a0).Add(a13) + b[6] = sum.Add(a6).Add(round).ShiftAllRight(4).IfElse(mask, b[6]) + sum = sum.Sub(a0).Add(a14) + b[7] = sum.Add(a7).Add(round).ShiftAllRight(4).IfElse(mask, b[7]) + sum = sum.Sub(a0).Add(a15) + b[8] = sum.Add(a8).Add(round).ShiftAllRight(4).IfElse(mask, b[8]) + sum = sum.Sub(a1).Add(a15) + b[9] = sum.Add(a9).Add(round).ShiftAllRight(4).IfElse(mask, b[9]) + sum = sum.Sub(a2).Add(a15) + b[10] = sum.Add(a10).Add(round).ShiftAllRight(4).IfElse(mask, b[10]) + sum = sum.Sub(a3).Add(a15) + b[11] = sum.Add(a11).Add(round).ShiftAllRight(4).IfElse(mask, b[11]) + sum = sum.Sub(a4).Add(a15) + b[12] = sum.Add(a12).Add(round).ShiftAllRight(4).IfElse(mask, b[12]) + sum = sum.Sub(a5).Add(a15) + b[13] = sum.Add(a13).Add(round).ShiftAllRight(4).IfElse(mask, b[13]) + sum = sum.Sub(a6).Add(a15) + b[14] = sum.Add(a14).Add(round).ShiftAllRight(4).IfElse(mask, b[14]) +} + +// LoopFilterUV8 joins two disjoint eight-position chroma edges into one +// sixteen-lane packet. Aliased planes retain sequential scalar/native calls. +func LoopFilterUV8(u, v []byte, step, outer, blimit, limit, thresh, kind int) bool { + if !Enabled || (kind != 4 && kind != 6) || blimit < 0 || blimit >= 255 || limit < 0 || limit > 255 || thresh < 0 || thresh > 255 { + return false + } + if !((outer == 1 && step >= 8) || (step == 1 && outer >= 8)) { + return false + } + // An eight-by-eight tile ends at 7*pitch+7. + pitch := max(step, outer) + if uint(pitch) >= 1<<28 || 7*pitch+8 > min(len(u), len(v)) { + return false + } + if slicesOverlap(u, v, len(u), len(v)) { + return false + } + loopFilterUVBytes(u, v, 4*step, step, outer, blimit, limit, thresh, kind) + return true +} +func loadLFUVByte(u, v []byte, off int) archsimd.Uint8x16 { + return joinLFBytes(loadLFByte(u, off, 8), loadLFByte(v, off, 8)) +} +func loadLFUVColumns(u, v []byte, off, pitch int) (archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16, archsimd.Uint8x16) { + a0, a1, a2, a3, a4, a5, a6, a7 := loadLFColumnTile[[8]byte](u, off, pitch) + b0, b1, b2, b3, b4, b5, b6, b7 := loadLFColumnTile[[8]byte](v, off, pitch) + return joinLFBytes(a0, b0), joinLFBytes(a1, b1), joinLFBytes(a2, b2), joinLFBytes(a3, b3), joinLFBytes(a4, b4), joinLFBytes(a5, b5), joinLFBytes(a6, b6), joinLFBytes(a7, b7) +} +func storeLFUV(u, v []byte, off, step, outer, count int, a, b, c, d, e, f archsimd.Uint8x16) { + if outer == 1 { + store := func(at int, x archsimd.Uint8x16) { + words := x.ReshapeToUint64s() + binary.LittleEndian.PutUint64(u[at:], words.GetElem(0)) + binary.LittleEndian.PutUint64(v[at:], words.GetElem(1)) + } + store(off, a) + store(off+step, b) + if count >= 4 { + store(off+2*step, c) + store(off+3*step, d) + } + if count == 6 { + store(off+4*step, e) + store(off+5*step, f) + } + return + } + storeLFByteTile(u, off, outer, count, a, b, c, d, e, f) + storeLFByteTile(v, off, outer, count, highBytes(a), highBytes(b), highBytes(c), highBytes(d), highBytes(e), highBytes(f)) +} diff --git a/internal/pixel/loopfilter_uv_arith_simd.go b/internal/pixel/loopfilter_uv_arith_simd.go new file mode 100644 index 0000000..e2fafcf --- /dev/null +++ b/internal/pixel/loopfilter_uv_arith_simd.go @@ -0,0 +1,81 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_uv_arith_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Byte-domain dataflow extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +// Paired eight-position planes share the canonical byte-filter arithmetic. +package pixel + +import "simd/archsimd" + +func loopFilterUVBytes(planeU, planeV []byte, off, step, outer, blimit, limit, thresh, kind int) { + var p3, p2, p1, p0, q0, q1, q2, q3 archsimd.Uint8x16 + if step == 1 { + p3, p2, p1, p0, q0, q1, q2, q3 = loadLFUVColumns(planeU, planeV, off-4, outer) + } else { + p3, p2, p1, p0 = loadLFUVByte(planeU, planeV, off-4*step), loadLFUVByte(planeU, planeV, off-3*step), loadLFUVByte(planeU, planeV, off-2*step), loadLFUVByte(planeU, planeV, off-step) + q0, q1, q2, q3 = loadLFUVByte(planeU, planeV, off), loadLFUVByte(planeU, planeV, off+step), loadLFUVByte(planeU, planeV, off+2*step), loadLFUVByte(planeU, planeV, off+3*step) + } + d1, d2, d0, d3 := lfAbsByte(p1, p0), lfAbsByte(q1, q0), lfAbsByte(p0, q0), lfAbsByte(p1, q1) + threshold := d0.AddSaturated(d0).AddSaturated(lfByteHalf(d3)) + need := lfByteLE(threshold, archsimd.BroadcastUint8x16(byte(blimit))) + if kind != 2 { + delta := d1.Max(d2).Max(lfAbsByte(p3, p2)).Max(lfAbsByte(p2, p1)).Max(lfAbsByte(q2, q1)).Max(lfAbsByte(q3, q2)) + need = need.And(lfByteLE(delta, archsimd.BroadcastUint8x16(byte(limit)))) + } + bits := need.ToInt8x16().ToBits().ReshapeToUint64s() + if bits.GetElem(0)|bits.GetElem(1) == 0 { + return + } + hev := lfByteGT(d1.Max(d2), archsimd.BroadcastUint8x16(byte(thresh))) + bias := archsimd.BroadcastUint8x16(128) + p1c, p0c, q0c, q1c := p1.Xor(bias).BitsToInt8(), p0.Xor(bias).BitsToInt8(), q0.Xor(bias).BitsToInt8(), q1.Xor(bias).BitsToInt8() + outerF := p1c.SubSaturated(q1c) + if kind == 4 { + outerF = outerF.Masked(hev) + } + // Add the same signed delta monotonically from the already-clamped + // outer correction. Intermediate saturation is then exact: a delta + // outside int8 forces the final clamp even at the opposite outer extreme. + f := lfFilterDelta(outerF, p0c, q0c).Masked(need) + // Identity corrections leave both disjoint chroma planes unchanged. + if uvRoundedZero(f, kind) { + return + } + three, four := archsimd.BroadcastInt8x16(3), archsimd.BroadcastInt8x16(4) + z := archsimd.Uint8x16{} + if kind == 6 { + fh := f.Masked(hev) + ps0 := p0c.AddSaturated(lfByteShift3(fh.AddSaturated(three))) + qs0 := q0c.SubSaturated(lfByteShift3(fh.AddSaturated(four))) + ff := f.Masked(lfByteNot(hev)) + u := lfMacroCorrection(ff, 27) + np0, nq0 := ps0.AddSaturated(u).ToBits().Xor(bias), qs0.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 18) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + u = lfMacroCorrection(ff, 9) + np2, nq2 := p2.Xor(bias).BitsToInt8().AddSaturated(u).ToBits().Xor(bias), q2.Xor(bias).BitsToInt8().SubSaturated(u).ToBits().Xor(bias) + storeLFUV(planeU, planeV, off-3*step, step, outer, 6, np2, np1, np0, nq0, nq1, nq2) + return + } + f1, f2 := lfByteShift3(f.AddSaturated(four)), lfByteShift3(f.AddSaturated(three)) + np0, nq0 := p0c.AddSaturated(f2).ToBits().Xor(bias), q0c.SubSaturated(f1).ToBits().Xor(bias) + if kind == 2 { + storeLFUV(planeU, planeV, off-step, step, outer, 2, np0, nq0, z, z, z, z) + return + } + u := lfByteShift1(f1.Add(archsimd.BroadcastInt8x16(1))).Masked(lfByteNot(hev)) + np1, nq1 := p1c.AddSaturated(u).ToBits().Xor(bias), q1c.SubSaturated(u).ToBits().Xor(bias) + storeLFUV(planeU, planeV, off-2*step, step, outer, 4, np1, np0, nq0, nq1, z, z) +} diff --git a/internal/pixel/loopfilter_uv_zero_amd64.go b/internal/pixel/loopfilter_uv_zero_amd64.go new file mode 100644 index 0000000..3a46a85 --- /dev/null +++ b/internal/pixel/loopfilter_uv_zero_amd64.go @@ -0,0 +1,57 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/loopfilter_uv_zero_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "simd/archsimd" +) + +// LoopFilterMacroInternal16 applies a VP8 macroblock edge and its three +// internal edges in order to sixteen lanes, carrying modified neighbors. +// Unsupported or incomplete windows decline without writing. +func LoopFilterMacroInternal16(p []byte, step, outer, mblimit, blimit, limit, thresh int) bool { + if !Enabled || step <= 0 || outer <= 0 || mblimit < 0 || mblimit >= 255 || blimit < 0 || blimit >= 255 || limit < 0 || limit > 255 || thresh < 0 || thresh > 255 { + return false + } + if !((outer == 1 && step >= 16) || (step == 1 && outer >= 20)) || len(p) == 0 { + return false + } + // Prove 19*step+15*outer < len(p) before either multiplication. Each + // exact row/column load/store stays inside this complete 20x16 window, + // including unaligned addresses and the smallest accepted pitch. + avail := len(p) - 1 + if step > avail/19 { + return false + } + avail -= 19 * step + if outer > avail/15 { + return false + } + defer archsimd.ClearAVXUpperBits() + if outer == 1 { + loopFilterMacroInternalFusedHorizontal(p, step, mblimit, blimit, limit, thresh) + } else { + loopFilterMacroInternalFusedVertical(p, outer, mblimit, blimit, limit, thresh) + } + return true +} + +// An identity correction needs no reconstruction or strided stores. The +// libvpx rounding formulas are zero for |f|<4 (normal) or |f|<3 (macro). +func uvRoundedZero(f archsimd.Int8x16, kind int) bool { + bound := int8(4) + if kind == 6 { + bound = 3 + } + return f.Abs().ToBits().Less(archsimd.BroadcastUint8x16(uint8(bound))).ToBits() == 65535 +} diff --git a/internal/pixel/scalar.go b/internal/pixel/scalar.go new file mode 100644 index 0000000..e3c60e7 --- /dev/null +++ b/internal/pixel/scalar.go @@ -0,0 +1,59 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/scalar.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Scalar entry points for non-experimental and purego builds. +//go:build !goexperiment.simd || (!arm64 && !amd64) || purego + +package pixel + +func Stats(src []byte, ss int, ref []byte, rs, w, h int) (sum int, sse uint32) { + return StatsScalar(src, ss, ref, rs, w, h) +} + +func Filter(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) { + FilterScalar(src, ss, dst, ds, w, h, step, taps) +} +func FilterBilinear(src []byte, ss int, dst []byte, ds, w, h, step int, t0, t1 uint8) { + taps := [2]int16{int16(t0), int16(t1)} + FilterScalar(src, ss, dst, ds, w, h, step, taps[:]) +} +func Average(src []byte, ss int, dst []byte, ds, w, h int) { AverageScalar(src, ss, dst, ds, w, h) } + +func AddConstant8x8InPlace(dst []byte, stride, delta int) { + AddConstantScalar(dst, stride, dst, stride, 8, 8, delta) +} +func AddConstant16x16InPlace(dst []byte, stride, delta int) { + AddConstantScalar(dst, stride, dst, stride, 16, 16, delta) +} +func AddLumaDC16x16InPlace(dst []byte, stride int, dcs *[16]int16) { + for br := range 4 { + for bc := range 4 { + delta := (int(dcs[br*4+bc]) + 4) >> 3 + if delta != 0 { + off := br*4*stride + bc*4 + AddConstantScalar(dst[off:], stride, dst[off:], stride, 4, 4, delta) + } + } + } +} + +func AddConstant(pred []byte, ps int, dst []byte, ds, w, h, delta int) { + AddConstantScalar(pred, ps, dst, ds, w, h, delta) +} +func TMPredict(dst []byte, ds int, above, left []byte, top byte, w int) { + TMPredictScalar(dst, ds, above, left, top, w) +} + +func Sum(src []byte, ss, w, h int) (sum int) { return SumScalar(src, ss, w, h) } + +func FillBlock(dst []byte, ds, w, h int, v byte) { FillBlockScalar(dst, ds, w, h, v) } +func RepeatRow(dst []byte, ds int, a []byte, w int) { RepeatRowScalar(dst, ds, a, w) } +func Horizontal(dst []byte, ds int, l []byte, w int) { HorizontalScalar(dst, ds, l, w) } +func Mul16(a, b, out []int16, n int) { Mul16Scalar(a, b, out, n) } diff --git a/internal/pixel/scalar_reference.go b/internal/pixel/scalar_reference.go new file mode 100644 index 0000000..325edba --- /dev/null +++ b/internal/pixel/scalar_reference.go @@ -0,0 +1,815 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/scalar_reference.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Independent scalar pixel kernels, also used for CPUs without AVX2. +package pixel + +import ( + "encoding/binary" +) + +var filterClipLUT = func() [512]byte { + var lut [512]byte + for i := range 512 { + v := i - 128 + if v < 0 { + v = 0 + } else if v > 255 { + v = 255 + } + lut[i] = byte(v) + } + return lut +}() + +func StatsScalar(src []byte, ss int, ref []byte, rs, w, h int) (sum int, sse uint32) { + if w <= 0 || h <= 0 { + return 0, 0 + } + switch w { + case 16: + var sum0, sum1, sse0, sse1, sse2, sse3 int + si, ri := 0, 0 + for range h { + s := (*[16]byte)(src[si : si+16]) + r := (*[16]byte)(ref[ri : ri+16]) + d0 := int(s[0]) - int(r[0]) + d1 := int(s[1]) - int(r[1]) + d2 := int(s[2]) - int(r[2]) + d3 := int(s[3]) - int(r[3]) + sum0 += d0 + d1 + d2 + d3 + sse0 += d0 * d0 + sse1 += d1 * d1 + sse2 += d2 * d2 + sse3 += d3 * d3 + d4 := int(s[4]) - int(r[4]) + d5 := int(s[5]) - int(r[5]) + d6 := int(s[6]) - int(r[6]) + d7 := int(s[7]) - int(r[7]) + sum1 += d4 + d5 + d6 + d7 + sse0 += d4 * d4 + sse1 += d5 * d5 + sse2 += d6 * d6 + sse3 += d7 * d7 + d8 := int(s[8]) - int(r[8]) + d9 := int(s[9]) - int(r[9]) + d10 := int(s[10]) - int(r[10]) + d11 := int(s[11]) - int(r[11]) + sum0 += d8 + d9 + d10 + d11 + sse0 += d8 * d8 + sse1 += d9 * d9 + sse2 += d10 * d10 + sse3 += d11 * d11 + d12 := int(s[12]) - int(r[12]) + d13 := int(s[13]) - int(r[13]) + d14 := int(s[14]) - int(r[14]) + d15 := int(s[15]) - int(r[15]) + sum1 += d12 + d13 + d14 + d15 + sse0 += d12 * d12 + sse1 += d13 * d13 + sse2 += d14 * d14 + sse3 += d15 * d15 + si += ss + ri += rs + } + return sum0 + sum1, uint32(sse0 + sse1 + sse2 + sse3) + case 32, 64: + var sum0, sum1, sse0, sse1, sse2, sse3 int + si, ri := 0, 0 + for range h { + sRow := src[si : si+w] + rRow := ref[ri : ri+w] + for x := 0; x < w; x += 16 { + s := (*[16]byte)(sRow[x : x+16]) + r := (*[16]byte)(rRow[x : x+16]) + d0 := int(s[0]) - int(r[0]) + d1 := int(s[1]) - int(r[1]) + d2 := int(s[2]) - int(r[2]) + d3 := int(s[3]) - int(r[3]) + sum0 += d0 + d1 + d2 + d3 + sse0 += d0 * d0 + sse1 += d1 * d1 + sse2 += d2 * d2 + sse3 += d3 * d3 + d4 := int(s[4]) - int(r[4]) + d5 := int(s[5]) - int(r[5]) + d6 := int(s[6]) - int(r[6]) + d7 := int(s[7]) - int(r[7]) + sum1 += d4 + d5 + d6 + d7 + sse0 += d4 * d4 + sse1 += d5 * d5 + sse2 += d6 * d6 + sse3 += d7 * d7 + d8 := int(s[8]) - int(r[8]) + d9 := int(s[9]) - int(r[9]) + d10 := int(s[10]) - int(r[10]) + d11 := int(s[11]) - int(r[11]) + sum0 += d8 + d9 + d10 + d11 + sse0 += d8 * d8 + sse1 += d9 * d9 + sse2 += d10 * d10 + sse3 += d11 * d11 + d12 := int(s[12]) - int(r[12]) + d13 := int(s[13]) - int(r[13]) + d14 := int(s[14]) - int(r[14]) + d15 := int(s[15]) - int(r[15]) + sum1 += d12 + d13 + d14 + d15 + sse0 += d12 * d12 + sse1 += d13 * d13 + sse2 += d14 * d14 + sse3 += d15 * d15 + } + si += ss + ri += rs + } + return sum0 + sum1, uint32(sse0 + sse1 + sse2 + sse3) + case 8: + var sum0, sum1, sse0, sse1, sse2, sse3 int + si, ri := 0, 0 + for range h { + s := src[si : si+8] + r := ref[ri : ri+8] + _ = s[7] + _ = r[7] + d0 := int(s[0]) - int(r[0]) + d1 := int(s[1]) - int(r[1]) + d2 := int(s[2]) - int(r[2]) + d3 := int(s[3]) - int(r[3]) + sum0 += d0 + d1 + d2 + d3 + sse0 += d0 * d0 + sse1 += d1 * d1 + sse2 += d2 * d2 + sse3 += d3 * d3 + d4 := int(s[4]) - int(r[4]) + d5 := int(s[5]) - int(r[5]) + d6 := int(s[6]) - int(r[6]) + d7 := int(s[7]) - int(r[7]) + sum1 += d4 + d5 + d6 + d7 + sse0 += d4 * d4 + sse1 += d5 * d5 + sse2 += d6 * d6 + sse3 += d7 * d7 + si += ss + ri += rs + } + return sum0 + sum1, uint32(sse0 + sse1 + sse2 + sse3) + case 4: + var sum0, sse0, sse1, sse2, sse3 int + si, ri := 0, 0 + for range h { + s := src[si : si+4] + r := ref[ri : ri+4] + _ = s[3] + _ = r[3] + d0 := int(s[0]) - int(r[0]) + d1 := int(s[1]) - int(r[1]) + d2 := int(s[2]) - int(r[2]) + d3 := int(s[3]) - int(r[3]) + sum0 += d0 + d1 + d2 + d3 + sse0 += d0 * d0 + sse1 += d1 * d1 + sse2 += d2 * d2 + sse3 += d3 * d3 + si += ss + ri += rs + } + return sum0, uint32(sse0 + sse1 + sse2 + sse3) + } + if w&7 == 0 { + var sum0, sum1, sse0, sse1, sse2, sse3 int + si, ri := 0, 0 + for range h { + s := src[si : si+w] + r := ref[ri : ri+w] + for x := 0; x < w; x += 8 { + sx := s[x : x+8] + rx := r[x : x+8] + _ = sx[7] + _ = rx[7] + d0 := int(sx[0]) - int(rx[0]) + d1 := int(sx[1]) - int(rx[1]) + d2 := int(sx[2]) - int(rx[2]) + d3 := int(sx[3]) - int(rx[3]) + sum0 += d0 + d1 + d2 + d3 + sse0 += d0 * d0 + sse1 += d1 * d1 + sse2 += d2 * d2 + sse3 += d3 * d3 + d4 := int(sx[4]) - int(rx[4]) + d5 := int(sx[5]) - int(rx[5]) + d6 := int(sx[6]) - int(rx[6]) + d7 := int(sx[7]) - int(rx[7]) + sum1 += d4 + d5 + d6 + d7 + sse0 += d4 * d4 + sse1 += d5 * d5 + sse2 += d6 * d6 + sse3 += d7 * d7 + } + si += ss + ri += rs + } + return sum0 + sum1, uint32(sse0 + sse1 + sse2 + sse3) + } + si, ri := 0, 0 + for range h { + s := src[si : si+w] + r := ref[ri : ri+w] + for x := range w { + d := int(s[x]) - int(r[x]) + sum += d + sse += uint32(d * d) + } + si += ss + ri += rs + } + return +} + +func filter2HorizSWAR(src []byte, ss int, dst []byte, ds, w, h, t0, t1 int) { + const ( + maskFE = uint64(0xfefefefefefefefe) + mask00FF = uint64(0x00ff00ff00ff00ff) + maskFF00 = uint64(0xff00ff00ff00ff00) + bias64 = uint64(0x0040004000400040) + ) + si, di := 0, 0 + if t0 == 64 && t1 == 64 { + for range h { + s := src[si : si+w+1] + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + a := binary.LittleEndian.Uint64(s[x:]) + b := binary.LittleEndian.Uint64(s[x+1:]) + binary.LittleEndian.PutUint64(d[x:], (a|b)-(((a^b)&maskFE)>>1)) + } + for ; x < w; x++ { + d[x] = byte((int(s[x]) + int(s[x+1]) + 1) >> 1) + } + si += ss + di += ds + } + return + } + f0, f1 := uint64(t0), uint64(t1) + for range h { + s := src[si : si+w+1] + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + w0 := binary.LittleEndian.Uint64(s[x:]) + w1 := binary.LittleEndian.Uint64(s[x+1:]) + lo := (((w0&mask00FF)*f0 + (w1&mask00FF)*f1 + bias64) >> 7) & mask00FF + hi := ((((w0>>8)&mask00FF)*f0 + ((w1>>8)&mask00FF)*f1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[x:], lo|hi) + } + for ; x < w; x++ { + d[x] = byte((int(s[x])*t0 + int(s[x+1])*t1 + 64) >> 7) + } + si += ss + di += ds + } +} + +func filter2VertSWAR(src []byte, ss int, dst []byte, ds, w, h, step, t0, t1 int) { + const ( + maskFE = uint64(0xfefefefefefefefe) + mask00FF = uint64(0x00ff00ff00ff00ff) + maskFF00 = uint64(0xff00ff00ff00ff00) + bias64 = uint64(0x0040004000400040) + ) + si, di := 0, 0 + if t0 == 64 && t1 == 64 { + for range h { + r0 := src[si : si+w] + r1 := src[si+step : si+step+w] + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + a := binary.LittleEndian.Uint64(r0[x:]) + b := binary.LittleEndian.Uint64(r1[x:]) + binary.LittleEndian.PutUint64(d[x:], (a|b)-(((a^b)&maskFE)>>1)) + } + for ; x < w; x++ { + d[x] = byte((int(r0[x]) + int(r1[x]) + 1) >> 1) + } + si += ss + di += ds + } + return + } + f0, f1 := uint64(t0), uint64(t1) + for range h { + r0 := src[si : si+w] + r1 := src[si+step : si+step+w] + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + w0 := binary.LittleEndian.Uint64(r0[x:]) + w1 := binary.LittleEndian.Uint64(r1[x:]) + lo := (((w0&mask00FF)*f0 + (w1&mask00FF)*f1 + bias64) >> 7) & mask00FF + hi := ((((w0>>8)&mask00FF)*f0 + ((w1>>8)&mask00FF)*f1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[x:], lo|hi) + } + for ; x < w; x++ { + d[x] = byte((int(r0[x])*t0 + int(r1[x])*t1 + 64) >> 7) + } + si += ss + di += ds + } +} + +func filter8HorizSWAR(src []byte, ss int, dst []byte, ds, w, h, t0, t1, t2, t3, t4, t5, t6, t7 int) { + const ( + mask00FF = uint64(0x00ff00ff00ff00ff) + bias4040 = uint64(0x4040404040404040) + ) + n0, p1, n2, p3 := uint64(-t0), uint64(t1), uint64(-t2), uint64(t3) + p4, n5, p6, n7 := uint64(t4), uint64(-t5), uint64(t6), uint64(-t7) + lut := &filterClipLUT + si, di := 0, 0 + for range h { + s := src[si : si+w+7] + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + w0 := binary.LittleEndian.Uint64(s[x:]) + w1 := binary.LittleEndian.Uint64(s[x+1:]) + w2 := binary.LittleEndian.Uint64(s[x+2:]) + w3 := binary.LittleEndian.Uint64(s[x+3:]) + w4 := binary.LittleEndian.Uint64(s[x+4:]) + w5 := binary.LittleEndian.Uint64(s[x+5:]) + w6 := binary.LittleEndian.Uint64(s[x+6:]) + w7 := binary.LittleEndian.Uint64(s[x+7:]) + accLo := bias4040 + (w1&mask00FF)*p1 + (w3&mask00FF)*p3 + (w4&mask00FF)*p4 + (w6&mask00FF)*p6 - + (w0&mask00FF)*n0 - (w2&mask00FF)*n2 - (w5&mask00FF)*n5 - (w7&mask00FF)*n7 + accHi := bias4040 + ((w1>>8)&mask00FF)*p1 + ((w3>>8)&mask00FF)*p3 + ((w4>>8)&mask00FF)*p4 + ((w6>>8)&mask00FF)*p6 - + ((w0>>8)&mask00FF)*n0 - ((w2>>8)&mask00FF)*n2 - ((w5>>8)&mask00FF)*n5 - ((w7>>8)&mask00FF)*n7 + out := uint64(lut[(accLo>>7)&0x1ff]) | + uint64(lut[(accHi>>7)&0x1ff])<<8 | + uint64(lut[(accLo>>23)&0x1ff])<<16 | + uint64(lut[(accHi>>23)&0x1ff])<<24 | + uint64(lut[(accLo>>39)&0x1ff])<<32 | + uint64(lut[(accHi>>39)&0x1ff])<<40 | + uint64(lut[(accLo>>55)&0x1ff])<<48 | + uint64(lut[(accHi>>55)&0x1ff])<<56 + binary.LittleEndian.PutUint64(d[x:], out) + } + for ; x < w; x++ { + v := int(s[x])*t0 + int(s[x+1])*t1 + int(s[x+2])*t2 + int(s[x+3])*t3 + + int(s[x+4])*t4 + int(s[x+5])*t5 + int(s[x+6])*t6 + int(s[x+7])*t7 + 64 + d[x] = byte(min(max(v>>7, 0), 255)) + } + si += ss + di += ds + } +} + +func filter8VertSWAR(src []byte, ss int, dst []byte, ds, w, h, step, t0, t1, t2, t3, t4, t5, t6, t7 int) { + const ( + mask00FF = uint64(0x00ff00ff00ff00ff) + bias4040 = uint64(0x4040404040404040) + ) + n0, p1, n2, p3 := uint64(-t0), uint64(t1), uint64(-t2), uint64(t3) + p4, n5, p6, n7 := uint64(t4), uint64(-t5), uint64(t6), uint64(-t7) + lut := &filterClipLUT + si, di := 0, 0 + s1, s2, s3, s4, s5, s6, s7 := step, 2*step, 3*step, 4*step, 5*step, 6*step, 7*step + for range h { + r0 := src[si : si+w] + r1 := src[si+s1 : si+s1+w] + r2 := src[si+s2 : si+s2+w] + r3 := src[si+s3 : si+s3+w] + r4 := src[si+s4 : si+s4+w] + r5 := src[si+s5 : si+s5+w] + r6 := src[si+s6 : si+s6+w] + r7 := src[si+s7 : si+s7+w] + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + w0 := binary.LittleEndian.Uint64(r0[x:]) + w1 := binary.LittleEndian.Uint64(r1[x:]) + w2 := binary.LittleEndian.Uint64(r2[x:]) + w3 := binary.LittleEndian.Uint64(r3[x:]) + w4 := binary.LittleEndian.Uint64(r4[x:]) + w5 := binary.LittleEndian.Uint64(r5[x:]) + w6 := binary.LittleEndian.Uint64(r6[x:]) + w7 := binary.LittleEndian.Uint64(r7[x:]) + accLo := bias4040 + (w1&mask00FF)*p1 + (w3&mask00FF)*p3 + (w4&mask00FF)*p4 + (w6&mask00FF)*p6 - + (w0&mask00FF)*n0 - (w2&mask00FF)*n2 - (w5&mask00FF)*n5 - (w7&mask00FF)*n7 + accHi := bias4040 + ((w1>>8)&mask00FF)*p1 + ((w3>>8)&mask00FF)*p3 + ((w4>>8)&mask00FF)*p4 + ((w6>>8)&mask00FF)*p6 - + ((w0>>8)&mask00FF)*n0 - ((w2>>8)&mask00FF)*n2 - ((w5>>8)&mask00FF)*n5 - ((w7>>8)&mask00FF)*n7 + out := uint64(lut[(accLo>>7)&0x1ff]) | + uint64(lut[(accHi>>7)&0x1ff])<<8 | + uint64(lut[(accLo>>23)&0x1ff])<<16 | + uint64(lut[(accHi>>23)&0x1ff])<<24 | + uint64(lut[(accLo>>39)&0x1ff])<<32 | + uint64(lut[(accHi>>39)&0x1ff])<<40 | + uint64(lut[(accLo>>55)&0x1ff])<<48 | + uint64(lut[(accHi>>55)&0x1ff])<<56 + binary.LittleEndian.PutUint64(d[x:], out) + } + for ; x < w; x++ { + v := int(r0[x])*t0 + int(r1[x])*t1 + int(r2[x])*t2 + int(r3[x])*t3 + + int(r4[x])*t4 + int(r5[x])*t5 + int(r6[x])*t6 + int(r7[x])*t7 + 64 + d[x] = byte(min(max(v>>7, 0), 255)) + } + si += ss + di += ds + } +} + +func FilterScalar(src []byte, ss int, dst []byte, ds, w, h, step int, taps []int16) { + if w <= 0 || h <= 0 { + return + } + switch len(taps) { + case 8: + t0, t1, t2, t3 := int(taps[0]), int(taps[1]), int(taps[2]), int(taps[3]) + t4, t5, t6, t7 := int(taps[4]), int(taps[5]), int(taps[6]), int(taps[7]) + if step == 1 { + if t0|t1|t2|t5|t6|t7 == 0 { + if t3 >= 0 && t4 >= 0 && t3+t4 == 128 && w >= 8 { + filter2HorizSWAR(src[3:], ss, dst, ds, w, h, t3, t4) + return + } + si, di := 3, 0 + for range h { + s := src[si : si+w+1] + d := dst[di : di+w] + x := 0 + for ; x+3 < w; x += 4 { + s0, s1, s2, s3, s4 := int(s[x]), int(s[x+1]), int(s[x+2]), int(s[x+3]), int(s[x+4]) + d[x] = byte(min(max((s0*t3+s1*t4+64)>>7, 0), 255)) + d[x+1] = byte(min(max((s1*t3+s2*t4+64)>>7, 0), 255)) + d[x+2] = byte(min(max((s2*t3+s3*t4+64)>>7, 0), 255)) + d[x+3] = byte(min(max((s3*t3+s4*t4+64)>>7, 0), 255)) + } + for ; x < w; x++ { + d[x] = byte(min(max((int(s[x])*t3+int(s[x+1])*t4+64)>>7, 0), 255)) + } + si += ss + di += ds + } + return + } + if w >= 8 && t0 <= 0 && t1 >= 0 && t2 <= 0 && t3 >= 0 && t4 >= 0 && t5 <= 0 && t6 >= 0 && t7 <= 0 && + (t1+t3+t4+t6)*255 <= 49087 && -(t0+t2+t5+t7)*255 <= 16448 { + filter8HorizSWAR(src, ss, dst, ds, w, h, t0, t1, t2, t3, t4, t5, t6, t7) + return + } + si, di := 0, 0 + for range h { + s := src[si : si+w+7] + d := dst[di : di+w] + for x := range w { + v := int(s[x])*t0 + int(s[x+1])*t1 + int(s[x+2])*t2 + int(s[x+3])*t3 + + int(s[x+4])*t4 + int(s[x+5])*t5 + int(s[x+6])*t6 + int(s[x+7])*t7 + 64 + d[x] = byte(min(max(v>>7, 0), 255)) + } + si += ss + di += ds + } + return + } + if t0|t1|t2|t5|t6|t7 == 0 { + if t3 >= 0 && t4 >= 0 && t3+t4 == 128 && w >= 8 { + filter2VertSWAR(src[3*step:], ss, dst, ds, w, h, step, t3, t4) + return + } + si, di := 3*step, 0 + for range h { + r0 := src[si : si+w] + r1 := src[si+step : si+step+w] + d := dst[di : di+w] + for x := range w { + d[x] = byte(min(max((int(r0[x])*t3+int(r1[x])*t4+64)>>7, 0), 255)) + } + si += ss + di += ds + } + return + } + if w >= 8 && t0 <= 0 && t1 >= 0 && t2 <= 0 && t3 >= 0 && t4 >= 0 && t5 <= 0 && t6 >= 0 && t7 <= 0 && + (t1+t3+t4+t6)*255 <= 49087 && -(t0+t2+t5+t7)*255 <= 16448 { + filter8VertSWAR(src, ss, dst, ds, w, h, step, t0, t1, t2, t3, t4, t5, t6, t7) + return + } + si, di := 0, 0 + s1, s2, s3, s4, s5, s6, s7 := step, 2*step, 3*step, 4*step, 5*step, 6*step, 7*step + for range h { + r0 := src[si : si+w] + r1 := src[si+s1 : si+s1+w] + r2 := src[si+s2 : si+s2+w] + r3 := src[si+s3 : si+s3+w] + r4 := src[si+s4 : si+s4+w] + r5 := src[si+s5 : si+s5+w] + r6 := src[si+s6 : si+s6+w] + r7 := src[si+s7 : si+s7+w] + d := dst[di : di+w] + for x := range w { + v := int(r0[x])*t0 + int(r1[x])*t1 + int(r2[x])*t2 + int(r3[x])*t3 + + int(r4[x])*t4 + int(r5[x])*t5 + int(r6[x])*t6 + int(r7[x])*t7 + 64 + d[x] = byte(min(max(v>>7, 0), 255)) + } + si += ss + di += ds + } + return + case 2: + t0, t1 := int(taps[0]), int(taps[1]) + if step == 1 { + if t0 >= 0 && t1 >= 0 && t0+t1 == 128 && w >= 8 { + filter2HorizSWAR(src, ss, dst, ds, w, h, t0, t1) + return + } + si, di := 0, 0 + for range h { + s := src[si : si+w+1] + d := dst[di : di+w] + for x := range w { + d[x] = byte(min(max((int(s[x])*t0+int(s[x+1])*t1+64)>>7, 0), 255)) + } + si += ss + di += ds + } + return + } + if t0 >= 0 && t1 >= 0 && t0+t1 == 128 && w >= 8 { + filter2VertSWAR(src, ss, dst, ds, w, h, step, t0, t1) + return + } + si, di := 0, 0 + for range h { + r0 := src[si : si+w] + r1 := src[si+step : si+step+w] + d := dst[di : di+w] + for x := range w { + d[x] = byte(min(max((int(r0[x])*t0+int(r1[x])*t1+64)>>7, 0), 255)) + } + si += ss + di += ds + } + return + case 6: + t0, t1, t2, t3, t4, t5 := int(taps[0]), int(taps[1]), int(taps[2]), int(taps[3]), int(taps[4]), int(taps[5]) + si, di := 0, 0 + if step == 1 { + for range h { + s := src[si : si+w+5] + d := dst[di : di+w] + x := 0 + for ; x+3 < w; x += 4 { + s0, s1, s2, s3, s4, s5 := int(s[x]), int(s[x+1]), int(s[x+2]), int(s[x+3]), int(s[x+4]), int(s[x+5]) + s6, s7, s8 := int(s[x+6]), int(s[x+7]), int(s[x+8]) + d[x] = byte(min(max((s0*t0+s1*t1+s2*t2+s3*t3+s4*t4+s5*t5+64)>>7, 0), 255)) + d[x+1] = byte(min(max((s1*t0+s2*t1+s3*t2+s4*t3+s5*t4+s6*t5+64)>>7, 0), 255)) + d[x+2] = byte(min(max((s2*t0+s3*t1+s4*t2+s5*t3+s6*t4+s7*t5+64)>>7, 0), 255)) + d[x+3] = byte(min(max((s3*t0+s4*t1+s5*t2+s6*t3+s7*t4+s8*t5+64)>>7, 0), 255)) + } + for ; x < w; x++ { + v := int(s[x])*t0 + int(s[x+1])*t1 + int(s[x+2])*t2 + int(s[x+3])*t3 + int(s[x+4])*t4 + int(s[x+5])*t5 + 64 + d[x] = byte(min(max(v>>7, 0), 255)) + } + si += ss + di += ds + } + return + } + s1, s2, s3, s4, s5 := step, 2*step, 3*step, 4*step, 5*step + for range h { + r0 := src[si : si+w] + r1 := src[si+s1 : si+s1+w] + r2 := src[si+s2 : si+s2+w] + r3 := src[si+s3 : si+s3+w] + r4 := src[si+s4 : si+s4+w] + r5 := src[si+s5 : si+s5+w] + d := dst[di : di+w] + for x := range w { + v := int(r0[x])*t0 + int(r1[x])*t1 + int(r2[x])*t2 + int(r3[x])*t3 + int(r4[x])*t4 + int(r5[x])*t5 + 64 + d[x] = byte(min(max(v>>7, 0), 255)) + } + si += ss + di += ds + } + return + } + for y := range h { + for x := range w { + v := 64 + for k, c := range taps { + v += int(src[y*ss+x+k*step]) * int(c) + } + dst[y*ds+x] = byte(min(max(v>>7, 0), 255)) + } + } +} + +func AverageScalar(src []byte, ss int, dst []byte, ds, w, h int) { + if w <= 0 || h <= 0 { + return + } + const maskFE = uint64(0xfefefefefefefefe) + si, di := 0, 0 + for range h { + s := src[si : si+w] + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + a := binary.LittleEndian.Uint64(s[x:]) + b := binary.LittleEndian.Uint64(d[x:]) + avg := (a | b) - (((a ^ b) & maskFE) >> 1) + binary.LittleEndian.PutUint64(d[x:], avg) + } + for ; x < w; x++ { + d[x] = byte((int(s[x]) + int(d[x]) + 1) >> 1) + } + si += ss + di += ds + } +} + +func AddConstantScalar(pred []byte, ps int, dst []byte, ds, w, h, delta int) { + if w <= 0 || h <= 0 { + return + } + if delta == 0 { + if &pred[0] != &dst[0] || ps != ds { + pi, di := 0, 0 + for range h { + copy(dst[di:di+w], pred[pi:pi+w]) + pi += ps + di += ds + } + } + return + } + pi, di := 0, 0 + if w&7 == 0 { + for range h { + p := pred[pi : pi+w] + d := dst[di : di+w] + for x := 0; x < w; x += 8 { + px := p[x : x+8] + dx := d[x : x+8] + _ = px[7] + _ = dx[7] + dx[0] = byte(min(max(int(px[0])+delta, 0), 255)) + dx[1] = byte(min(max(int(px[1])+delta, 0), 255)) + dx[2] = byte(min(max(int(px[2])+delta, 0), 255)) + dx[3] = byte(min(max(int(px[3])+delta, 0), 255)) + dx[4] = byte(min(max(int(px[4])+delta, 0), 255)) + dx[5] = byte(min(max(int(px[5])+delta, 0), 255)) + dx[6] = byte(min(max(int(px[6])+delta, 0), 255)) + dx[7] = byte(min(max(int(px[7])+delta, 0), 255)) + } + pi += ps + di += ds + } + return + } + if w == 4 { + for range h { + p := pred[pi : pi+4] + d := dst[di : di+4] + _ = p[3] + _ = d[3] + d[0] = byte(min(max(int(p[0])+delta, 0), 255)) + d[1] = byte(min(max(int(p[1])+delta, 0), 255)) + d[2] = byte(min(max(int(p[2])+delta, 0), 255)) + d[3] = byte(min(max(int(p[3])+delta, 0), 255)) + pi += ps + di += ds + } + return + } + for range h { + p := pred[pi : pi+w] + d := dst[di : di+w] + for x := range w { + d[x] = byte(min(max(int(p[x])+delta, 0), 255)) + } + pi += ps + di += ds + } +} + +func TMPredictScalar(dst []byte, ds int, above, left []byte, top byte, w int) { + for y := range w { + for x := range w { + dst[y*ds+x] = byte(min(max(int(above[x])+int(left[y])-int(top), 0), 255)) + } + } +} + +func SumScalar(src []byte, ss, w, h int) (sum int) { + if w <= 0 || h <= 0 { + return 0 + } + var s0, s1, s2, s3 int + si := 0 + for range h { + s := src[si : si+w] + x := 0 + for ; x+7 < w; x += 8 { + sx := s[x : x+8] + _ = sx[7] + s0 += int(sx[0]) + int(sx[4]) + s1 += int(sx[1]) + int(sx[5]) + s2 += int(sx[2]) + int(sx[6]) + s3 += int(sx[3]) + int(sx[7]) + } + for ; x < w; x++ { + s0 += int(s[x]) + } + si += ss + } + return s0 + s1 + s2 + s3 +} + +func Intra4Scalar(dst []byte, ds int, b *[16]byte, indices *[4][16]byte) { + for i := range 16 { + sum := 2 + int(b[indices[0][i]]) + int(b[indices[1][i]]) + int(b[indices[2][i]]) + int(b[indices[3][i]]) + dst[(i>>2)*ds+(i&3)] = byte(sum >> 2) + } +} + +func FillBlockScalar(dst []byte, ds, w, h int, v byte) { + if w > 0 && h > 0 && ds >= 0 && len(dst) >= w && (h == 1 || ds <= (len(dst)-w)/(h-1)) { + v64 := uint64(v) * 0x0101010101010101 + di := 0 + for range h { + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + binary.LittleEndian.PutUint64(d[x:], v64) + } + for ; x < w; x++ { + d[x] = v + } + di += ds + } + return + } + for y := range h { + for x := range w { + dst[y*ds+x] = v + } + } +} + +func RepeatRowScalar(dst []byte, ds int, a []byte, w int) { + src := a[:w] + di := 0 + for range w { + copy(dst[di:di+w], src) + di += ds + } +} + +func HorizontalScalar(dst []byte, ds int, l []byte, w int) { + if w <= 0 { + return + } + l = l[:w] + di := 0 + for y := range w { + v := l[y] + v64 := uint64(v) * 0x0101010101010101 + d := dst[di : di+w] + x := 0 + for ; x+7 < w; x += 8 { + binary.LittleEndian.PutUint64(d[x:], v64) + } + for ; x < w; x++ { + d[x] = v + } + di += ds + } +} + +func Mul16Scalar(a, b, out []int16, n int) { + if n <= 0 { + return + } + a = a[:n] + b = b[:n] + out = out[:n] + i := 0 + for ; i+3 < n; i += 4 { + out[i] = a[i] * b[i] + out[i+1] = a[i+1] * b[i+1] + out[i+2] = a[i+2] * b[i+2] + out[i+3] = a[i+3] * b[i+3] + } + for ; i < n; i++ { + out[i] = a[i] * b[i] + } +} diff --git a/internal/pixel/sse16_simd_amd64.go b/internal/pixel/sse16_simd_amd64.go new file mode 100644 index 0000000..7ca8354 --- /dev/null +++ b/internal/pixel/sse16_simd_amd64.go @@ -0,0 +1,35 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/sse16_simd_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import "simd/archsimd" + +// SSE16 widens a complete sixteen-pixel row into AVX2 int16 lanes. Two +// squared differences per dot-product lane accumulate modulo2^32. +func SSE16(src []byte, ss int, ref []byte, rs, h int) uint32 { + if !Enabled { + return SSE16Scalar(src, ss, ref, rs, h) + } + if h <= 0 { + return 0 + } + defer archsimd.ClearAVXUpperBits() + var acc archsimd.Int32x8 + for y := range h { + a := archsimd.LoadUint8x16(src[y*ss:]).ExtendToUint16().BitsToInt16() + b := archsimd.LoadUint8x16(ref[y*rs:]).ExtendToUint16().BitsToInt16() + d := a.Sub(b) + acc = acc.Add(d.DotProductPairs(d)) + } + return uint32(sum32(acc.GetLo().Add(acc.GetHi()))) +} diff --git a/internal/pixel/sse16_simd_arm64.go b/internal/pixel/sse16_simd_arm64.go new file mode 100644 index 0000000..5f5a20e --- /dev/null +++ b/internal/pixel/sse16_simd_arm64.go @@ -0,0 +1,65 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/sse16_simd_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import "simd/archsimd" + +// SSE16 computes squared error over sixteen columns, without the signed +// sum needed by variance. Only the requested rows and columns are read; +// accumulation wraps modulo2^32, as in Stats. +func SSE16(src []byte, ss int, ref []byte, rs, h int) uint32 { + if !Enabled { + return SSE16Scalar(src, ss, ref, rs, h) + } + if h <= 0 { + return 0 + } + if h == 16 && (uint(ss)|uint(rs))>>30 == 0 && 15*ss+16 <= len(src) && 15*rs+16 <= len(ref) { + _ = src[15*ss+15] + _ = ref[15*rs+15] + var s0, s1, s2, s3 archsimd.Int32x4 + so, ro := 0, 0 + ss2, ss3, ss4 := 2*ss, 3*ss, 4*ss + rs2, rs3, rs4 := 2*rs, 3*rs, 4*rs + for range 4 { + a0 := archsimd.LoadUint8x16Array((*[16]byte)(src[so : so+16])) + b0 := archsimd.LoadUint8x16Array((*[16]byte)(ref[ro : ro+16])) + a1 := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss : so+ss+16])) + b1 := archsimd.LoadUint8x16Array((*[16]byte)(ref[ro+rs : ro+rs+16])) + a2 := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss2 : so+ss2+16])) + b2 := archsimd.LoadUint8x16Array((*[16]byte)(ref[ro+rs2 : ro+rs2+16])) + a3 := archsimd.LoadUint8x16Array((*[16]byte)(src[so+ss3 : so+ss3+16])) + b3 := archsimd.LoadUint8x16Array((*[16]byte)(ref[ro+rs3 : ro+rs3+16])) + d0 := a0.Max(b0).Sub(a0.Min(b0)) + d1 := a1.Max(b1).Sub(a1.Min(b1)) + d2 := a2.Max(b2).Sub(a2.Min(b2)) + d3 := a3.Max(b3).Sub(a3.Min(b3)) + s0 = s0.Add(square8(d0.ExtendLo8ToUint16().BitsToInt16())) + s1 = s1.Add(square8(d0.HiToLo().ExtendLo8ToUint16().BitsToInt16())) + s2 = s2.Add(square8(d1.ExtendLo8ToUint16().BitsToInt16())) + s3 = s3.Add(square8(d1.HiToLo().ExtendLo8ToUint16().BitsToInt16())) + s0 = s0.Add(square8(d2.ExtendLo8ToUint16().BitsToInt16())) + s1 = s1.Add(square8(d2.HiToLo().ExtendLo8ToUint16().BitsToInt16())) + s2 = s2.Add(square8(d3.ExtendLo8ToUint16().BitsToInt16())) + s3 = s3.Add(square8(d3.HiToLo().ExtendLo8ToUint16().BitsToInt16())) + so += ss4 + ro += rs4 + } + return uint32(sum32(s0.Add(s1).Add(s2.Add(s3)))) + } + var lo, hi archsimd.Int32x4 + for y := range h { + lo, hi = ssePacket(lo, hi, archsimd.LoadUint8x16(src[y*ss:]), archsimd.LoadUint8x16(ref[y*rs:])) + } + return uint32(sum32(lo.Add(hi))) +} diff --git a/internal/pixel/sse8_rows_arm64.go b/internal/pixel/sse8_rows_arm64.go new file mode 100644 index 0000000..fc7dd49 --- /dev/null +++ b/internal/pixel/sse8_rows_arm64.go @@ -0,0 +1,62 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/sse8_rows_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// SSE8 packs pairs of exact eight-byte rows into one SIMD packet. An odd +// final row reads eight bytes, including for a minimally sized allocation. +func SSE8(src []byte, ss int, ref []byte, rs, h int) uint32 { + if !Enabled { + return SSE8Scalar(src, ss, ref, rs, h) + } + + // Bounded nonnegative geometry proves the final row offsets fit int64. + // The two endpoint checks cover exact8-byte loads, including unaligned, + // zero-stride and overlapping read-only rows, without requiring padding. + if h > 0 && h <= 64 && (uint(ss)|uint(rs))>>30 == 0 { + _ = src[(h-1)*ss+7] + _ = ref[(h-1)*rs+7] + var lo, hi archsimd.Int32x4 + so, ro, y := 0, 0, 0 + for ; y+2 <= h; y += 2 { + a := (archsimd.Uint64x2{}).SetElem(0, binary.LittleEndian.Uint64(src[so:])).SetElem(1, binary.LittleEndian.Uint64(src[so+ss:])).ReshapeToUint8s() + b := (archsimd.Uint64x2{}).SetElem(0, binary.LittleEndian.Uint64(ref[ro:])).SetElem(1, binary.LittleEndian.Uint64(ref[ro+rs:])).ReshapeToUint8s() + d := a.Max(b).Sub(a.Min(b)) + dl := widen8(d) + dh := widen8(highBytes(d)) + lo = lo.Add(square8(dl)) + hi = hi.Add(square8(dh)) + so += 2 * ss + ro += 2 * rs + } + if y < h { + a := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(src[so:])).ReshapeToUint8s() + b := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(ref[ro:])).ReshapeToUint8s() + lo = lo.Add(square8(widen8(a.Max(b).Sub(a.Min(b))))) + } + return uint32(sum32(lo.Add(hi))) + } + var lo, hi archsimd.Int32x4 + y := 0 + for ; y+2 <= h; y += 2 { + lo, hi = ssePacket(lo, hi, packRows8(src, y*ss, ss), packRows8(ref, y*rs, rs)) + } + if y < h { + lo, hi = ssePacket(lo, hi, load8(src[y*ss:]), load8(ref[y*rs:])) + } + return uint32(sum32(lo.Add(hi))) +} diff --git a/internal/pixel/sse8_rows_wide_amd64.go b/internal/pixel/sse8_rows_wide_amd64.go new file mode 100644 index 0000000..1d49397 --- /dev/null +++ b/internal/pixel/sse8_rows_wide_amd64.go @@ -0,0 +1,83 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/sse8_rows_wide_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// SSE8 packs pairs of exact eight-byte rows into one SIMD packet. An odd +// final row reads eight bytes, including for a minimally sized allocation. +func SSE8(src []byte, ss int, ref []byte, rs, h int) uint32 { + if !Enabled { + return SSE8Scalar(src, ss, ref, rs, h) + } + + // Bounded nonnegative geometry proves the final row offsets fit int64. + // The two endpoint checks cover exact8-byte loads, including unaligned, + // zero-stride and overlapping read-only rows, without requiring padding. + if h > 0 && h <= 64 && (uint(ss)|uint(rs))>>30 == 0 { + _ = src[(h-1)*ss+7] + _ = ref[(h-1)*rs+7] + if h >= 8 { + var acc archsimd.Int32x8 + so, ro, y := 0, 0, 0 + for ; y+2 <= h; y += 2 { + a := (archsimd.Uint64x2{}).SetElem(0, binary.LittleEndian.Uint64(src[so:])).SetElem(1, binary.LittleEndian.Uint64(src[so+ss:])).ReshapeToUint8s().ExtendToUint16().BitsToInt16() + b := (archsimd.Uint64x2{}).SetElem(0, binary.LittleEndian.Uint64(ref[ro:])).SetElem(1, binary.LittleEndian.Uint64(ref[ro+rs:])).ReshapeToUint8s().ExtendToUint16().BitsToInt16() + d := a.Sub(b) + acc = acc.Add(d.DotProductPairs(d)) + so += 2 * ss + ro += 2 * rs + } + if y < h { + a := archsimd.BroadcastUint64x4(binary.LittleEndian.Uint64(src[so:])).InterleaveLoGrouped(archsimd.Uint64x4{}).GetLo().ReshapeToUint8s().ExtendToUint16().BitsToInt16() + b := archsimd.BroadcastUint64x4(binary.LittleEndian.Uint64(ref[ro:])).InterleaveLoGrouped(archsimd.Uint64x4{}).GetLo().ReshapeToUint8s().ExtendToUint16().BitsToInt16() + d := a.Sub(b) + acc = acc.Add(d.DotProductPairs(d)) + } + result := uint32(sum32(acc.GetLo().Add(acc.GetHi()))) + archsimd.ClearAVXUpperBits() + return result + } + var lo, hi archsimd.Int32x4 + so, ro, y := 0, 0, 0 + for ; y+2 <= h; y += 2 { + a := (archsimd.Uint64x2{}).SetElem(0, binary.LittleEndian.Uint64(src[so:])).SetElem(1, binary.LittleEndian.Uint64(src[so+ss:])).ReshapeToUint8s() + b := (archsimd.Uint64x2{}).SetElem(0, binary.LittleEndian.Uint64(ref[ro:])).SetElem(1, binary.LittleEndian.Uint64(ref[ro+rs:])).ReshapeToUint8s() + d := a.Max(b).Sub(a.Min(b)) + dl := widen8(d) + dh := widen8(highBytes(d)) + lo = lo.Add(square8(dl)) + hi = hi.Add(square8(dh)) + so += 2 * ss + ro += 2 * rs + } + if y < h { + a := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(src[so:])).ReshapeToUint8s() + b := archsimd.BroadcastUint64x2(binary.LittleEndian.Uint64(ref[ro:])).ReshapeToUint8s() + lo = lo.Add(square8(widen8(a.Max(b).Sub(a.Min(b))))) + } + return uint32(sum32(lo.Add(hi))) + } + var lo, hi archsimd.Int32x4 + y := 0 + for ; y+2 <= h; y += 2 { + lo, hi = ssePacket(lo, hi, packRows8(src, y*ss, ss), packRows8(ref, y*rs, rs)) + } + if y < h { + lo, hi = ssePacket(lo, hi, load8(src[y*ss:]), load8(ref[y*rs:])) + } + return uint32(sum32(lo.Add(hi))) +} diff --git a/internal/pixel/sse_scalar.go b/internal/pixel/sse_scalar.go new file mode 100644 index 0000000..58b8cc9 --- /dev/null +++ b/internal/pixel/sse_scalar.go @@ -0,0 +1,88 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/sse_scalar.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package pixel + +// Squared-error-only references retain the codec's modulo-2^32 result. +func SSE16Scalar(src []byte, ss int, ref []byte, rs, h int) (sse uint32) { + var s0, s1, s2, s3 int + si, ri := 0, 0 + for range h { + s := src[si : si+16] + r := ref[ri : ri+16] + _ = s[15] + _ = r[15] + d0 := int(s[0]) - int(r[0]) + d1 := int(s[1]) - int(r[1]) + d2 := int(s[2]) - int(r[2]) + d3 := int(s[3]) - int(r[3]) + s0 += d0 * d0 + s1 += d1 * d1 + s2 += d2 * d2 + s3 += d3 * d3 + d4 := int(s[4]) - int(r[4]) + d5 := int(s[5]) - int(r[5]) + d6 := int(s[6]) - int(r[6]) + d7 := int(s[7]) - int(r[7]) + s0 += d4 * d4 + s1 += d5 * d5 + s2 += d6 * d6 + s3 += d7 * d7 + d8 := int(s[8]) - int(r[8]) + d9 := int(s[9]) - int(r[9]) + d10 := int(s[10]) - int(r[10]) + d11 := int(s[11]) - int(r[11]) + s0 += d8 * d8 + s1 += d9 * d9 + s2 += d10 * d10 + s3 += d11 * d11 + d12 := int(s[12]) - int(r[12]) + d13 := int(s[13]) - int(r[13]) + d14 := int(s[14]) - int(r[14]) + d15 := int(s[15]) - int(r[15]) + s0 += d12 * d12 + s1 += d13 * d13 + s2 += d14 * d14 + s3 += d15 * d15 + si += ss + ri += rs + } + return uint32(s0 + s1 + s2 + s3) +} + +func SSE8Scalar(src []byte, ss int, ref []byte, rs, h int) (sse uint32) { + var s0, s1, s2, s3 int + si, ri := 0, 0 + for range h { + s := src[si : si+8] + r := ref[ri : ri+8] + _ = s[7] + _ = r[7] + d0 := int(s[0]) - int(r[0]) + d1 := int(s[1]) - int(r[1]) + d2 := int(s[2]) - int(r[2]) + d3 := int(s[3]) - int(r[3]) + s0 += d0 * d0 + s1 += d1 * d1 + s2 += d2 * d2 + s3 += d3 * d3 + d4 := int(s[4]) - int(r[4]) + d5 := int(s[5]) - int(r[5]) + d6 := int(s[6]) - int(r[6]) + d7 := int(s[7]) - int(r[7]) + s0 += d4 * d4 + s1 += d5 * d5 + s2 += d6 * d6 + s3 += d7 * d7 + si += ss + ri += rs + } + return uint32(s0 + s1 + s2 + s3) +} diff --git a/internal/pixel/sse_simd.go b/internal/pixel/sse_simd.go new file mode 100644 index 0000000..e0c6168 --- /dev/null +++ b/internal/pixel/sse_simd.go @@ -0,0 +1,23 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/sse_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "simd/archsimd" +) + +func ssePacket(lo, hi archsimd.Int32x4, a, b archsimd.Uint8x16) (archsimd.Int32x4, archsimd.Int32x4) { + dl := widen8(a).Sub(widen8(b)) + dh := widenHi8(a).BitsToInt16().Sub(widenHi8(b).BitsToInt16()) + return lo.Add(square8(dl)), hi.Add(square8(dh)) +} diff --git a/internal/pixel/stats16_amd64.go b/internal/pixel/stats16_amd64.go new file mode 100644 index 0000000..66b495b --- /dev/null +++ b/internal/pixel/stats16_amd64.go @@ -0,0 +1,43 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/stats16_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import "simd/archsimd" + +type pixelStatsReduction = int64 + +const vectorPixelAccReduction = false + +// A full 16-byte row becomes one AVX2 packet. At 1..64 rows, signed +// differences stay within 16320 per int16 lane; squares accumulate in int32. +func pixelStats16Narrow(src []byte, ss int, ref []byte, rs, h int) (uint32, int32) { + if (uint(ss)|uint(rs))>>57 != 0 { + return pixelStatsRows16(src, ss, ref, rs, 16, h) + } + _ = src[(h-1)*ss+15] + _ = ref[(h-1)*rs+15] + var squares archsimd.Int32x8 + var signed archsimd.Int16x16 + for y := range h { + a := archsimd.LoadUint8x16(src[y*ss:]).ExtendToUint16().BitsToInt16() + b := archsimd.LoadUint8x16(ref[y*rs:]).ExtendToUint16().BitsToInt16() + d := a.Sub(b) + squares = squares.Add(d.DotProductPairs(d)) + signed = signed.Add(d) + } + sums := signed.DotProductPairs(archsimd.BroadcastInt16x16(1)) + sse := uint32(sum32(squares.GetLo().Add(squares.GetHi()))) + sum := sum32(sums.GetLo().Add(sums.GetHi())) + archsimd.ClearAVXUpperBits() + return sse, sum +} diff --git a/internal/pixel/stats16_arm64.go b/internal/pixel/stats16_arm64.go new file mode 100644 index 0000000..6a216ac --- /dev/null +++ b/internal/pixel/stats16_arm64.go @@ -0,0 +1,93 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/stats16_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import "simd/archsimd" + +type pixelStatsReduction = int32 + +const vectorPixelAccReduction = true + +// pixelStats16Narrow handles sixteen columns and 1..64 rows. Each signed +// sum lane receives two differences per row: |sum| <= 2*255*64 = 32640. +// Keeping sums in int16 eliminates widening in every row. Squared errors +// stay in separate int32 accumulators and reduce to at most 66585600. +func pixelStats16Narrow(src []byte, ss int, ref []byte, rs, h int) (uint32, int32) { + var s0, s1 archsimd.Int32x4 + var sum archsimd.Int16x8 + // Reject negative or implausibly large strides before the final-row + // bounds checks. At h<=64 and stride<2^57, (h-1)*stride+15 fits int64. + // The two checks then cover every exact 16-byte load, including zero + // strides and overlapping read-only rows; no padding is required. + if (uint(ss)|uint(rs))>>57 != 0 { + return pixelStatsRows16(src, ss, ref, rs, 16, h) + } + _ = src[(h-1)*ss+15] + _ = ref[(h-1)*rs+15] + if h == 16 && ss >= 16 && rs >= 16 && len(src) >= 16*ss && len(ref) >= 16*rs { + // Unroll 4 rows per iteration with constant trip count and independent + // accumulators to expose full NEON ILP across vector pipes and cut loop + // and slice-advance overhead by 4x. + var s2, s3 archsimd.Int32x4 + var sum1 archsimd.Int16x8 + ss2, rs2 := ss*2, rs*2 + ss3, rs3 := ss*3, rs*3 + ss4, rs4 := ss*4, rs*4 + for range 4 { + a0 := archsimd.LoadUint8x16Array((*[16]byte)(src[:16])) + b0 := archsimd.LoadUint8x16Array((*[16]byte)(ref[:16])) + lo0 := a0.ExtendLo8ToUint16().BitsToInt16().Sub(b0.ExtendLo8ToUint16().BitsToInt16()) + hi0 := a0.HiToLo().ExtendLo8ToUint16().BitsToInt16().Sub(b0.HiToLo().ExtendLo8ToUint16().BitsToInt16()) + sum = sum.Add(lo0).Add(hi0) + s0 = s0.Add(square8(lo0)) + s1 = s1.Add(square8(hi0)) + + a1 := archsimd.LoadUint8x16Array((*[16]byte)(src[ss : ss+16])) + b1 := archsimd.LoadUint8x16Array((*[16]byte)(ref[rs : rs+16])) + lo1 := a1.ExtendLo8ToUint16().BitsToInt16().Sub(b1.ExtendLo8ToUint16().BitsToInt16()) + hi1 := a1.HiToLo().ExtendLo8ToUint16().BitsToInt16().Sub(b1.HiToLo().ExtendLo8ToUint16().BitsToInt16()) + sum1 = sum1.Add(lo1).Add(hi1) + s2 = s2.Add(square8(lo1)) + s3 = s3.Add(square8(hi1)) + + a2 := archsimd.LoadUint8x16Array((*[16]byte)(src[ss2 : ss2+16])) + b2 := archsimd.LoadUint8x16Array((*[16]byte)(ref[rs2 : rs2+16])) + lo2 := a2.ExtendLo8ToUint16().BitsToInt16().Sub(b2.ExtendLo8ToUint16().BitsToInt16()) + hi2 := a2.HiToLo().ExtendLo8ToUint16().BitsToInt16().Sub(b2.HiToLo().ExtendLo8ToUint16().BitsToInt16()) + sum = sum.Add(lo2).Add(hi2) + s0 = s0.Add(square8(lo2)) + s1 = s1.Add(square8(hi2)) + + a3 := archsimd.LoadUint8x16Array((*[16]byte)(src[ss3 : ss3+16])) + b3 := archsimd.LoadUint8x16Array((*[16]byte)(ref[rs3 : rs3+16])) + lo3 := a3.ExtendLo8ToUint16().BitsToInt16().Sub(b3.ExtendLo8ToUint16().BitsToInt16()) + hi3 := a3.HiToLo().ExtendLo8ToUint16().BitsToInt16().Sub(b3.HiToLo().ExtendLo8ToUint16().BitsToInt16()) + sum1 = sum1.Add(lo3).Add(hi3) + s2 = s2.Add(square8(lo3)) + s3 = s3.Add(square8(hi3)) + + src = src[ss4:] + ref = ref[rs4:] + } + return uint32(sum32(s0.Add(s1).Add(s2.Add(s3)))), sum32(sumDiff16(sum.Add(sum1))) + } + for y := range h { + a, b := archsimd.LoadUint8x16(src[y*ss:]), archsimd.LoadUint8x16(ref[y*rs:]) + lo := a.ExtendLo8ToUint16().BitsToInt16().Sub(b.ExtendLo8ToUint16().BitsToInt16()) + hi := widenHi8(a).BitsToInt16().Sub(widenHi8(b).BitsToInt16()) + sum = sum.Add(lo).Add(hi) + s0 = s0.Add(square8(lo)) + s1 = s1.Add(square8(hi)) + } + return uint32(sum32(s0.Add(s1))), sum32(sumDiff16(sum)) +} diff --git a/internal/pixel/stubs_nonarm64.go b/internal/pixel/stubs_nonarm64.go new file mode 100644 index 0000000..bfb5d35 --- /dev/null +++ b/internal/pixel/stubs_nonarm64.go @@ -0,0 +1,48 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/stubs_nonarm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || !arm64 || purego + +package pixel + +const ( + fillFixedRows = false + IntraDCFillNative = false + NativeLFByAxis = false + TMNative = false +) + +func Intra4x4DCFill(dst []byte, ds int, above, left []byte) bool { return false } + +func IntraDCFill(dst []byte, ds int, above, left []byte, n int, up, lf bool) bool { return false } + +func CanLoopFilterMacroHorizontal16(p []byte, pitch int, mblimit, blimit byte) bool { return false } +func LoopFilterMacroHorizontal16Unchecked(p []byte, pitch int, mblimit, blimit, limit, thresh byte) {} + +func CanLoopFilterMacroVertical16(p []byte, pitch int, mblimit, blimit byte) bool { return false } +func LoopFilterMacroVertical16Unchecked(p []byte, pitch int, mblimit, blimit, limit, thresh byte) {} + +// TMPredict4Native retains libvpx v1.16.0 vpx_dsp/intrapred.c semantics +// through the existing generic pixel implementation. +func TMPredict4Native(dst []byte, ds int, above, left []byte, top byte, publicChecked bool) { + if publicChecked { + _ = above[3] + _ = left[3] + _ = dst[3*ds+3] + } + TMPredict(dst, ds, above, left, top, 4) +} + +func TMPredictBytes(dst []byte, ds int, above, left []byte, top byte, w int) bool { return false } + +// TMPredictNative preserves the original generic pixel semantics on other builds. +func TMPredictNative(dst []byte, ds int, above, left []byte, top byte, w int) { + TMPredict(dst, ds, above, left, top, w) +} diff --git a/internal/pixel/stubs_nosimd.go b/internal/pixel/stubs_nosimd.go new file mode 100644 index 0000000..e54bab4 --- /dev/null +++ b/internal/pixel/stubs_nosimd.go @@ -0,0 +1,181 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/stubs_nosimd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || (!arm64 && !amd64) || purego + +package pixel + +import ( + "encoding/binary" +) + +const Enabled = false + +func Copy16Rows(src []byte, ss int, dst []byte, ds int) bool { return false } +func Copy8Rows(src []byte, ss int, dst []byte, ds int) bool { return false } + +// CopyBlock copies a w x h byte block from src (stride ss) to dst (stride ds). +func CopyBlock(src []byte, ss int, dst []byte, ds, w, h int) { + if w <= 0 || h <= 0 { + return + } + si, di := 0, 0 + switch w { + case 4: + for range h { + binary.LittleEndian.PutUint32(dst[di:di+4], binary.LittleEndian.Uint32(src[si:si+4])) + si += ss + di += ds + } + case 8: + for range h { + binary.LittleEndian.PutUint64(dst[di:di+8], binary.LittleEndian.Uint64(src[si:si+8])) + si += ss + di += ds + } + case 16: + for range h { + s := src[si : si+16] + d := dst[di : di+16] + a := binary.LittleEndian.Uint64(s[0:8]) + b := binary.LittleEndian.Uint64(s[8:16]) + binary.LittleEndian.PutUint64(d[0:8], a) + binary.LittleEndian.PutUint64(d[8:16], b) + si += ss + di += ds + } + default: + for range h { + copy(dst[di:di+w], src[si:si+w]) + si += ss + di += ds + } + } +} + +func ExtendPlaneBorder(full []byte, origin, stride, width, height, borderX, borderY int) bool { + if len(full) == 0 || stride <= 0 || width <= 0 || height <= 0 || borderX <= 0 || borderY <= 0 { + return false + } + if borderX > stride/2 || width > stride-2*borderX { + return false + } + if origin < borderX || borderY > (origin-borderX)/stride { + return false + } + tail := len(full) - origin + if width+borderX > tail { + return false + } + maxRows := (tail - width - borderX) / stride + if height-1 > maxRows || borderY > maxRows-(height-1) { + return false + } + rowStart := origin + for range height { + leftFill := full[rowStart] + leftDst := full[rowStart-borderX : rowStart] + lv64 := uint64(leftFill) * 0x0101010101010101 + i := 0 + for ; i+7 < len(leftDst); i += 8 { + binary.LittleEndian.PutUint64(leftDst[i:], lv64) + } + for ; i < len(leftDst); i++ { + leftDst[i] = leftFill + } + rightFill := full[rowStart+width-1] + rightDst := full[rowStart+width : rowStart+width+borderX] + rv64 := uint64(rightFill) * 0x0101010101010101 + i = 0 + for ; i+7 < len(rightDst); i += 8 { + binary.LittleEndian.PutUint64(rightDst[i:], rv64) + } + for ; i < len(rightDst); i++ { + rightDst[i] = rightFill + } + rowStart += stride + } + span := width + 2*borderX + topSrc := full[origin-borderX : origin-borderX+span] + for y := 1; y <= borderY; y++ { + dstStart := origin - y*stride - borderX + copy(full[dstStart:dstStart+span], topSrc) + } + botOrigin := origin + (height-1)*stride + botSrc := full[botOrigin-borderX : botOrigin-borderX+span] + for y := 1; y <= borderY; y++ { + dstStart := botOrigin + y*stride - borderX + copy(full[dstStart:dstStart+span], botSrc) + } + return true +} + +// DCPairNative is false outside the native SIMD selection; public DSP retains +// its original libvpx v1.16.0 idctllm.c dispatch and scalar fallback. +const DCPairNative = false + +func DCPairInt32Native(c0, c1 int32, pred []byte, ps int, dst []byte, ds int) { + dcPairNativeScalar(c0, c1, pred, ps, dst, ds) +} + +// DCPairInPlaceInt32Native is the canonical disabled-DSP fallback outside +// the native SIMD selection of libvpx v1.16.0's paired DC operation. +func DCPairInPlaceInt32Native(c0, c1 int32, b []byte, stride int) { + dcPairNativeScalar(c0, c1, b, stride, b, stride) +} + +func AddConstantPair4(pred []byte, ps int, dst []byte, ds int, d0, d1 int16) bool { + if ps < 8 || ds < 8 || len(pred) < 8 || ps > (len(pred)-8)/3 || len(dst) < 8 || ds > (len(dst)-8)/3 { + return false + } + if &pred[0] != &dst[0] || ps != ds { + return false + } + a0, a1 := int(d0), int(d1) + if a0 == 0 && a1 == 0 { + return true + } + addConstPairRow(dst[0:8], binary.LittleEndian.Uint64(dst[0:8]), a0, a1) + addConstPairRow(dst[ds:ds+8], binary.LittleEndian.Uint64(dst[ds:ds+8]), a0, a1) + addConstPairRow(dst[2*ds:2*ds+8], binary.LittleEndian.Uint64(dst[2*ds:2*ds+8]), a0, a1) + addConstPairRow(dst[3*ds:3*ds+8], binary.LittleEndian.Uint64(dst[3*ds:3*ds+8]), a0, a1) + return true +} + +func addConstPairRow(d []byte, w uint64, a0, a1 int) { + _ = d[7] + d[0] = byte(min(max(int(w&0xff)+a0, 0), 255)) + d[1] = byte(min(max(int((w>>8)&0xff)+a0, 0), 255)) + d[2] = byte(min(max(int((w>>16)&0xff)+a0, 0), 255)) + d[3] = byte(min(max(int((w>>24)&0xff)+a0, 0), 255)) + d[4] = byte(min(max(int((w>>32)&0xff)+a1, 0), 255)) + d[5] = byte(min(max(int((w>>40)&0xff)+a1, 0), 255)) + d[6] = byte(min(max(int((w>>48)&0xff)+a1, 0), 255)) + d[7] = byte(min(max(int(w>>56)+a1, 0), 255)) +} + +func LoopFilterInternal16(_ []byte, _, _, _, _, _ int) bool { return false } + +// LoopFilterMacroInternal16 leaves unsupported targets to the separate edge paths. +func LoopFilterMacroInternal16(p []byte, step, outer, mblimit, blimit, limit, thresh int) bool { + return false +} + +func LoopFilter(_ []byte, _ int, _ int, _ int, _ int, _ int, _ int, _ int, _ int) bool { return false } +func LoopFilterSimpleHorizontal16(_ []byte, _ int, _ byte) bool { return false } +func LoopFilterSimpleHorizontal3Inner16(_ []byte, _ int, _ byte) bool { return false } +func LoopFilterSimpleVertical16(_ []byte, _ int, _ byte) bool { return false } +func LoopFilterSimpleVertical3Inner16(_ []byte, _ int, _ byte) bool { return false } +func LoopFilterSimpleVertical4All16(_ []byte, _ int, _, _ byte) bool { return false } +func LoopFilterUV8(_, _ []byte, _, _, _, _, _, _ int) bool { return false } +func DequantWalshAddLumaDC16x16InPlace(_ []byte, _ int, _, _ *[16]int16) bool { return false } + +func SSE16(src []byte, ss int, ref []byte, rs, h int) uint32 { return SSE16Scalar(src, ss, ref, rs, h) } +func SSE8(src []byte, ss int, ref []byte, rs, h int) uint32 { return SSE8Scalar(src, ss, ref, rs, h) } diff --git a/internal/pixel/tmpredict4_native_arm64.go b/internal/pixel/tmpredict4_native_arm64.go new file mode 100644 index 0000000..81af910 --- /dev/null +++ b/internal/pixel/tmpredict4_native_arm64.go @@ -0,0 +1,72 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/tmpredict4_native_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +var tm4LeftRows = [16]byte{0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3} + +// TMPredict4Native retains libvpx v1.16.0 vpx_dsp/intrapred.c clipping. +// publicChecked preserves the DSP public entry's original upfront checks. +// Above and left may be hoisted only when both are disjoint from all output. +// Invalid windows and aliases retain the original SIMD row-capture fallback. +func TMPredict4Native(dst []byte, ds int, above, left []byte, top byte, publicChecked bool) { + if publicChecked { + _ = above[3] + _ = left[3] + _ = dst[3*ds+3] + } + if !Enabled { + TMPredictScalar(dst, ds, above, left, top, 4) + return + } +fast: + for { + if uint(ds)>>30 != 0 { + break fast + } + span := 3*ds + 4 + if span > len(dst) || len(above) < 4 || len(left) < 4 { + break fast + } + if slicesOverlapExact(dst, above, span, 4) || slicesOverlapExact(dst, left, span, 4) { + break fast + } + av := archsimd.BroadcastUint32x4(binary.LittleEndian.Uint32(above)).ReshapeToUint8s() + lv := archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(left)).ReshapeToUint8s().LookupOrZero(archsimd.LoadUint8x16Array(&tm4LeftRows)) + t := archsimd.BroadcastUint8x16(top) + pos, neg := lv.SubSaturated(t), t.SubSaturated(lv) + tile := av.AddSaturated(pos).SubSaturated(neg) + if ds == 4 { + tile.Store(dst) + } else { + rows := tile.ReshapeToUint32s() + binary.LittleEndian.PutUint32(dst, rows.GetElem(0)) + binary.LittleEndian.PutUint32(dst[ds:], rows.GetElem(1)) + binary.LittleEndian.PutUint32(dst[2*ds:], rows.GetElem(2)) + binary.LittleEndian.PutUint32(dst[3*ds:], rows.GetElem(3)) + } + return + } + + // Exact original SIMD evaluation order for four-pixel rows: capture left + // once per row, then form the output slice before loading the above packet. + t := archsimd.BroadcastInt32x4(int32(top)) + for y := range 4 { + v := archsimd.BroadcastInt32x4(int32(left[y])).Sub(t) + StorePixels4(dst[y*ds:], LoadPixels4(above).Add(v)) + } +} diff --git a/internal/pixel/tmpredict_bytes_arm64.go b/internal/pixel/tmpredict_bytes_arm64.go new file mode 100644 index 0000000..36e537e --- /dev/null +++ b/internal/pixel/tmpredict_bytes_arm64.go @@ -0,0 +1,127 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/tmpredict_bytes_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// TMPredictBytes retains the checked direct-call contract of the libvpx +// v1.16.0 vpx_dsp/intrapred.c true-motion byte path. Declines read no input and +// write no output. TMPredictNative owns the single arithmetic implementation, +// including sequential per-row left capture when left aliases destination. +func TMPredictBytes(dst []byte, ds int, above, left []byte, top byte, w int) bool { + if !Enabled || (w != 8 && w != 16) || uint(ds)>>30 != 0 { + return false + } + span := (w-1)*ds + w + if span > len(dst) || len(above) < w || len(left) < w { + return false + } + if slicesOverlapExact(dst, above, span, w) { + return false + } + TMPredictNative(dst, ds, above, left, top, w) + return true +} + +const TMNative = true + +// TMPredictNative retains libvpx v1.16.0 vpx_dsp/intrapred.c semantics. +// It owns both the checked byte fast path and the original SIMD fallback, +// allowing the public wrapper to forward without preserving fallback arguments. +// Enabled is currently constant true in this ARM build selection. The explicit +// scalar branch also preserves the direct entry contract if that changes. +func TMPredictNative(dst []byte, ds int, above, left []byte, top byte, w int) { + if !Enabled { + TMPredictScalar(dst, ds, above, left, top, w) + return + } +fast: + for { + + if !Enabled || (w != 8 && w != 16) || uint(ds)>>30 != 0 { + break fast + } + span := (w-1)*ds + w + if span > len(dst) || len(above) < w || len(left) < w { + break fast + } + if slicesOverlapExact(dst, above, span, w) { + break fast + } + if !slicesOverlapExact(dst, left, span, w) { + // Only disjoint left/output windows may capture all left rows up front. + // The original per-row left read remains below for every alias. + t := archsimd.BroadcastUint8x16(top) + if w == 8 { + a8 := binary.LittleEndian.Uint64(above) + v := archsimd.Uint64x2{}.SetElem(0, a8).SetElem(1, a8).ReshapeToUint8s() + lv := archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(left)).ReshapeToUint8s() + pos, neg := lv.SubSaturated(t), t.SubSaturated(lv) + idx := archsimd.Uint64x2{}.SetElem(1, 0x0101010101010101).ReshapeToUint8s() + step := archsimd.BroadcastUint8x16(2) + off := 0 + for range 4 { + rows := v.AddSaturated(pos.LookupOrZero(idx)).SubSaturated(neg.LookupOrZero(idx)).ReshapeToUint64s() + binary.LittleEndian.PutUint64(dst[off:], rows.GetElem(0)) + binary.LittleEndian.PutUint64(dst[off+ds:], rows.GetElem(1)) + off += 2 * ds + idx = idx.Add(step) + } + } else { + v := archsimd.LoadUint8x16(above) + lv := archsimd.LoadUint8x16(left) + pos, neg := lv.SubSaturated(t), t.SubSaturated(lv) + idx := archsimd.Uint8x16{} + step := archsimd.BroadcastUint8x16(1) + off := 0 + for range 16 { + row := v.AddSaturated(pos.LookupOrZero(idx)).SubSaturated(neg.LookupOrZero(idx)) + row.Store(dst[off:]) + off += ds + idx = idx.Add(step) + } + } + return + } + // Read left per row after the previous row stores, including aliases. + // delta is in [-255,255]. Only one of plus/minus is nonzero, so these + // two unsigned saturations equal clamp(above+left-top,0,255) exactly. + if w == 8 { + v := archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(above)).ReshapeToUint8s() + for y := range 8 { + delta := int(left[y]) - int(top) + row := v.AddSaturated(archsimd.BroadcastUint8x16(byte(max(delta, 0)))).SubSaturated(archsimd.BroadcastUint8x16(byte(max(-delta, 0)))) + binary.LittleEndian.PutUint64(dst[y*ds:], row.ReshapeToUint64s().GetElem(0)) + } + } else { + v := archsimd.LoadUint8x16(above) + for y := range 16 { + delta := int(left[y]) - int(top) + row := v.AddSaturated(archsimd.BroadcastUint8x16(byte(max(delta, 0)))).SubSaturated(archsimd.BroadcastUint8x16(byte(max(-delta, 0)))) + row.Store(dst[y*ds:]) + } + } + return + + } + t := archsimd.BroadcastInt32x4(int32(top)) + for y := range w { + v := archsimd.BroadcastInt32x4(int32(left[y])).Sub(t) + for x := 0; x < w; x += 4 { + StorePixels4(dst[y*ds+x:], LoadPixels4(above[x:]).Add(v)) + } + } +} diff --git a/internal/pixel/tmpredict_bytes_x64_amd64.go b/internal/pixel/tmpredict_bytes_x64_amd64.go new file mode 100644 index 0000000..8c798b4 --- /dev/null +++ b/internal/pixel/tmpredict_bytes_x64_amd64.go @@ -0,0 +1,51 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/tmpredict_bytes_x64_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// Saturated byte differences express clip(above+left-top) exactly: at +// most one of positive and negative is nonzero. Capture above only after +// proving it cannot be changed by a destination store; left stays per-row. +func tmpredictBytesX64(dst []byte, ds int, above, left []byte, top byte, w int) bool { + if !Enabled || (w != 8 && w != 16) || uint(ds)>>30 != 0 { + return false + } + span := (w-1)*ds + w + if span > len(dst) || len(above) < w || len(left) < w { + return false + } + if slicesOverlapExact(dst, above, span, w) { + return false + } + var v archsimd.Uint8x16 + if w == 8 { + v = archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(above)).ReshapeToUint8s() + } else { + v = archsimd.LoadUint8x16(above) + } + t := archsimd.BroadcastUint8x16(top) + for y := 0; y < w; y++ { + l := archsimd.BroadcastUint8x16(left[y]) + row := v.AddSaturated(l.SubSaturated(t)).SubSaturated(t.SubSaturated(l)) + if w == 8 { + binary.LittleEndian.PutUint64(dst[y*ds:], row.ReshapeToUint64s().GetElem(0)) + } else { + row.Store(dst[y*ds:]) + } + } + return true +} diff --git a/internal/pixel/tmpredict_bytes_x64_other.go b/internal/pixel/tmpredict_bytes_x64_other.go new file mode 100644 index 0000000..fc84f87 --- /dev/null +++ b/internal/pixel/tmpredict_bytes_x64_other.go @@ -0,0 +1,15 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/tmpredict_bytes_x64_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || !amd64 || purego + +package pixel + +func tmpredictBytesX64(dst []byte, ds int, above, left []byte, top byte, w int) bool { return false } diff --git a/internal/pixel/transform_arm64.go b/internal/pixel/transform_arm64.go new file mode 100644 index 0000000..97fdbd7 --- /dev/null +++ b/internal/pixel/transform_arm64.go @@ -0,0 +1,58 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/transform_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Transpose extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && arm64 && !purego + +package pixel + +import "simd/archsimd" + +func i32AsI16(v archsimd.Int32x4) archsimd.Int16x8 { + return v.ToBits().ReshapeToUint16s().BitsToInt16() +} +func i16AsI32(v archsimd.Int16x8) archsimd.Int32x4 { + return v.ToBits().ReshapeToUint32s().BitsToInt32() +} +func i64AsI16(v archsimd.Int64x2) archsimd.Int16x8 { + return v.ToBits().ReshapeToUint16s().BitsToInt16() +} +func i16AsI64(v archsimd.Int16x8) archsimd.Int64x2 { + return v.ToBits().ReshapeToUint64s().BitsToInt64() +} +func Transpose8Int16(l0, l1, l2, l3, l4, l5, l6, l7 archsimd.Int16x8) (archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8) { + a0 := l0.InterleaveLo(l1) + a1 := l0.InterleaveHi(l1) + a2 := l2.InterleaveLo(l3) + a3 := l2.InterleaveHi(l3) + a4 := l4.InterleaveLo(l5) + a5 := l4.InterleaveHi(l5) + a6 := l6.InterleaveLo(l7) + a7 := l6.InterleaveHi(l7) + b0 := i32AsI16(i16AsI32(a0).InterleaveLo(i16AsI32(a2))) + b1 := i32AsI16(i16AsI32(a0).InterleaveHi(i16AsI32(a2))) + b2 := i32AsI16(i16AsI32(a1).InterleaveLo(i16AsI32(a3))) + b3 := i32AsI16(i16AsI32(a1).InterleaveHi(i16AsI32(a3))) + b4 := i32AsI16(i16AsI32(a4).InterleaveLo(i16AsI32(a6))) + b5 := i32AsI16(i16AsI32(a4).InterleaveHi(i16AsI32(a6))) + b6 := i32AsI16(i16AsI32(a5).InterleaveLo(i16AsI32(a7))) + b7 := i32AsI16(i16AsI32(a5).InterleaveHi(i16AsI32(a7))) + o0 := i64AsI16(i16AsI64(b0).InterleaveLo(i16AsI64(b4))) + o1 := i64AsI16(i16AsI64(b0).InterleaveHi(i16AsI64(b4))) + o2 := i64AsI16(i16AsI64(b1).InterleaveLo(i16AsI64(b5))) + o3 := i64AsI16(i16AsI64(b1).InterleaveHi(i16AsI64(b5))) + o4 := i64AsI16(i16AsI64(b2).InterleaveLo(i16AsI64(b6))) + o5 := i64AsI16(i16AsI64(b2).InterleaveHi(i16AsI64(b6))) + o6 := i64AsI16(i16AsI64(b3).InterleaveLo(i16AsI64(b7))) + o7 := i64AsI16(i16AsI64(b3).InterleaveHi(i16AsI64(b7))) + return o0, o1, o2, o3, o4, o5, o6, o7 +} diff --git a/internal/pixel/transform_avx2.go b/internal/pixel/transform_avx2.go new file mode 100644 index 0000000..00fcb8f --- /dev/null +++ b/internal/pixel/transform_avx2.go @@ -0,0 +1,56 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/transform_avx2.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// SPDX-License-Identifier: BSD-2-Clause +// Transpose extracted from goav1 ff46346e73f063ff1ea3a8d7f06ee26cd9baaad4. +// See UPSTREAM.md and ../../third_party/goav1/LICENSE. +//go:build goexperiment.simd && amd64 && !purego + +package pixel + +import ( + "simd/archsimd" +) + +func asI32(v archsimd.Int64x4) archsimd.Int32x8 { return v.AsInt32x8() } +func asI64(v archsimd.Int32x8) archsimd.Int64x4 { return v.AsInt64x4() } +func Transpose8(r0, r1, r2, r3, r4, r5, r6, r7 archsimd.Int32x8) (archsimd.Int32x8, archsimd.Int32x8, archsimd.Int32x8, archsimd.Int32x8, archsimd.Int32x8, archsimd.Int32x8, archsimd.Int32x8, archsimd.Int32x8) { + a0 := r0.InterleaveLoGrouped(r1) + a1 := r0.InterleaveHiGrouped(r1) + a2 := r2.InterleaveLoGrouped(r3) + a3 := r2.InterleaveHiGrouped(r3) + a4 := r4.InterleaveLoGrouped(r5) + a5 := r4.InterleaveHiGrouped(r5) + a6 := r6.InterleaveLoGrouped(r7) + a7 := r6.InterleaveHiGrouped(r7) + + b0 := asI32(asI64(a0).InterleaveLoGrouped(asI64(a2))) + b1 := asI32(asI64(a0).InterleaveHiGrouped(asI64(a2))) + b2 := asI32(asI64(a1).InterleaveLoGrouped(asI64(a3))) + b3 := asI32(asI64(a1).InterleaveHiGrouped(asI64(a3))) + b4 := asI32(asI64(a4).InterleaveLoGrouped(asI64(a6))) + b5 := asI32(asI64(a4).InterleaveHiGrouped(asI64(a6))) + b6 := asI32(asI64(a5).InterleaveLoGrouped(asI64(a7))) + b7 := asI32(asI64(a5).InterleaveHiGrouped(asI64(a7))) + + // Output column k is the low 128-bit half of b_k joined with the low half + // of b_(k+4) (column k, rows 0-7), and likewise for the high halves. + return b0.ConcatPermute128Scalars(0, 2, b4), b1.ConcatPermute128Scalars(0, 2, b5), b2.ConcatPermute128Scalars(0, 2, b6), b3.ConcatPermute128Scalars(0, 2, b7), b0.ConcatPermute128Scalars(1, 3, b4), b1.ConcatPermute128Scalars(1, 3, b5), b2.ConcatPermute128Scalars(1, 3, b6), b3.ConcatPermute128Scalars(1, 3, b7) +} + +func Load8(s []int16) archsimd.Int32x8 { return archsimd.LoadInt16x8(s).ExtendToInt32() } + +func LoadPixels8(s []byte) archsimd.Int32x8 { + return load8(s).ExtendLo8ToUint16().BitsToInt16().ExtendToInt32() +} +func StorePixels8(s []byte, v archsimd.Int32x8) { store8(s, v.GetLo(), v.GetHi()) } + +// FinishWide ends an AVX2 kernel before ordinary Go/SSE register moves. +func FinishWide() { archsimd.ClearAVXUpperBits() } diff --git a/internal/pixel/transform_simd.go b/internal/pixel/transform_simd.go new file mode 100644 index 0000000..c263f46 --- /dev/null +++ b/internal/pixel/transform_simd.go @@ -0,0 +1,42 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/pixel/transform_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package pixel + +import ( + "encoding/binary" + "simd/archsimd" +) + +// Load4 reads four int16 samples widened to Int32x4. When at least 8 int16s +// are available in s, a single SIMD vector load + SXTL replaces four scalar +// lane-insert instructions. +func Load4(s []int16) archsimd.Int32x4 { + if len(s) >= 8 { + return archsimd.LoadInt16x8Array((*[8]int16)(s[:8])).ExtendLo4ToInt32() + } + _ = s[3] + return archsimd.Int32x4{}.SetElem(0, int32(s[0])).SetElem(1, int32(s[1])).SetElem(2, int32(s[2])).SetElem(3, int32(s[3])) +} + +// Store4 preserves Go's wrapping int16 conversion, without saturating it. +// Transpose4 follows goav1's in-register 4x4 int32 transpose. +func Transpose4(a, b, c, d archsimd.Int32x4) (archsimd.Int32x4, archsimd.Int32x4, archsimd.Int32x4, archsimd.Int32x4) { + ab0 := a.InterleaveLo(b).ToBits().ReshapeToUint64s() + ab1 := a.InterleaveHi(b).ToBits().ReshapeToUint64s() + cd0 := c.InterleaveLo(d).ToBits().ReshapeToUint64s() + cd1 := c.InterleaveHi(d).ToBits().ReshapeToUint64s() + return ab0.InterleaveLo(cd0).ReshapeToUint32s().BitsToInt32(), ab0.InterleaveHi(cd0).ReshapeToUint32s().BitsToInt32(), ab1.InterleaveLo(cd1).ReshapeToUint32s().BitsToInt32(), ab1.InterleaveHi(cd1).ReshapeToUint32s().BitsToInt32() +} +func LoadPixels4(s []byte) archsimd.Int32x4 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(s)).ReshapeToUint8s().ExtendLo8ToUint16().BitsToInt16().ExtendLo4ToInt32() +} diff --git a/internal/vp8/boolcoder/decoder.go b/internal/vp8/boolcoder/decoder.go new file mode 100644 index 0000000..a172606 --- /dev/null +++ b/internal/vp8/boolcoder/decoder.go @@ -0,0 +1,1371 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/boolcoder/decoder.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package boolcoder + +import ( + "encoding/binary" + "errors" + "math/bits" + + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +var ( + ErrTruncated = errors.New("govpx: truncated VP8 boolcoder input") +) + +const ( + valueSize = 64 + lotsOfBits = 0x40000000 +) + +type Decoder struct { + buf []byte + pos int + + value uint64 + count int + rng uint32 +} + +func (d *Decoder) Init(src []byte) error { + if src == nil { + src = []byte{} + } + d.buf = src + d.pos = 0 + d.value = 0 + d.count = -8 + d.rng = 255 + d.fill() + return nil +} + +// fillBoolSlow refills the 64-bit boolean decoder register when count < 0. +// Kept //go:noinline so hot coefficient loops do not inline the cold refill +// path at every readBool site (which bloats code size and spills registers). +// +//go:noinline +func fillBoolSlow(buf []byte, pos int, value uint64, count int) (uint64, int, int) { + shift := valueSize - 8 - (count + 8) + bytesLeft := len(buf) - pos + if bytesLeft > 8 { + big := binary.BigEndian.Uint64(buf[pos:]) + consumed := (shift >> 3) + 1 + value |= (big >> (uint(56-shift) & 63)) &^ (uint64(1)<= 0 { + count += lotsOfBits + loopEnd = x + } + if x < 0 || bitsLeft != 0 { + for shift >= loopEnd { + count += 8 + value |= uint64(buf[pos]) << (uint(shift) & 63) + pos++ + shift -= 8 + } + } + return value, count, pos +} + +func (d *Decoder) ReadBool(prob uint8) uint8 { + rng0 := d.rng + p := uint32(prob) + split := (rng0*p + (256 - p)) >> 8 + count := d.count + if count < 0 { + d.fill() + count = d.count + } + + bigsplit := uint64(split) << (valueSize - 8) + value := d.value + rng := split + bit := uint8(0) + if value >= bigsplit { + rng = rng0 - split + value -= bigsplit + bit = 1 + } + + shift := uint32(bits.LeadingZeros8(uint8(rng))) + d.rng = rng << shift + d.value = value << shift + d.count = count - int(shift) + return bit +} + +func (d *Decoder) ReadBit() uint8 { + rng0 := d.rng + split := (rng0 + 1) >> 1 + count := d.count + if count < 0 { + d.fill() + count = d.count + } + + bigsplit := uint64(split) << (valueSize - 8) + value := d.value + rng := split + bit := uint8(0) + if value >= bigsplit { + rng = rng0 - split + value -= bigsplit + bit = 1 + } + + shift := uint32(1) - (rng >> 7) + d.rng = rng << shift + d.value = value << shift + d.count = count - int(shift) + return bit +} + +// ReadVP8InterRefFrame decodes the inter-frame reference selection (0=Intra, +// 1=Last, 2=Golden, 3=AltRef) while keeping the boolcoder state in registers. +func (d *Decoder) ReadVP8InterRefFrame(probIntra, probLast, probGolden uint8) uint8 { + buf := d.buf + pos := d.pos + if pos > len(buf)-8 { + if d.ReadBool(probIntra) == 0 { + return 0 + } + if d.ReadBool(probLast) != 0 { + return 2 + d.ReadBool(probGolden) + } + return 1 + } + value, rng, count := d.value, d.rng, d.count + if count < 24 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + var bit uint8 + bit, value, rng, count = vp8ReadBoolNoFill(probIntra, value, rng, count) + if bit == 0 { + d.value, d.rng, d.count, d.pos = value, rng, count, pos + return 0 + } + bit, value, rng, count = vp8ReadBoolNoFill(probLast, value, rng, count) + if bit == 0 { + d.value, d.rng, d.count, d.pos = value, rng, count, pos + return 1 + } + bit, value, rng, count = vp8ReadBoolNoFill(probGolden, value, rng, count) + d.value, d.rng, d.count, d.pos = value, rng, count, pos + return 2 + bit +} + +// ReadVP8InterMode decodes the inter prediction mode (0=ZeroMV, 1=NearestMV, +// 2=NearMV, 3=NewMV, 4=SplitMV) while keeping boolcoder state in registers. +func (d *Decoder) ReadVP8InterMode(p0, p1, p2, p3 uint8) uint8 { + buf := d.buf + pos := d.pos + if pos > len(buf)-8 { + if d.ReadBool(p0) == 0 { + return 0 + } + if d.ReadBool(p1) == 0 { + return 1 + } + if d.ReadBool(p2) == 0 { + return 2 + } + if d.ReadBool(p3) != 0 { + return 4 + } + return 3 + } + value, rng, count := d.value, d.rng, d.count + if count < 32 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + var bit uint8 + bit, value, rng, count = vp8ReadBoolNoFill(p0, value, rng, count) + if bit == 0 { + d.value, d.rng, d.count, d.pos = value, rng, count, pos + return 0 + } + bit, value, rng, count = vp8ReadBoolNoFill(p1, value, rng, count) + if bit == 0 { + d.value, d.rng, d.count, d.pos = value, rng, count, pos + return 1 + } + bit, value, rng, count = vp8ReadBoolNoFill(p2, value, rng, count) + if bit == 0 { + d.value, d.rng, d.count, d.pos = value, rng, count, pos + return 2 + } + bit, value, rng, count = vp8ReadBoolNoFill(p3, value, rng, count) + d.value, d.rng, d.count, d.pos = value, rng, count, pos + if bit != 0 { + return 4 + } + return 3 +} + +// ReadVP8MVComponent decodes a single VP8 motion vector component while keeping +// boolcoder state in registers across all 4..12 boolean reads. +func (d *Decoder) ReadVP8MVComponent(probs []uint8) int { + _ = probs[18] + buf := d.buf + pos := d.pos + if pos > len(buf)-24 { + x := 0 + if d.ReadBool(probs[0]) != 0 { + for i := range 3 { + x += int(d.ReadBool(probs[9+i])) << i + } + for i := 9; i > 3; i-- { + x += int(d.ReadBool(probs[9+i])) << i + } + if x&0xfff0 == 0 || d.ReadBool(probs[12]) != 0 { + x += 8 + } + } else { + node := int16(0) + for { + node = tables.SmallMVTree[int(node)+int(d.ReadBool(probs[2+int(node>>1)]))] + if node <= 0 { + x = int(-node) + break + } + } + } + if x != 0 && d.ReadBool(probs[1]) != 0 { + x = -x + } + return x + } + value, rng, count := d.value, d.rng, d.count + if count < 32 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + var bit uint8 + x := 0 + bit, value, rng, count = vp8ReadBoolNoFill(probs[0], value, rng, count) + if bit != 0 { + for i := range 3 { + bit, value, rng, count = vp8ReadBoolNoFill(probs[9+i], value, rng, count) + x += int(bit) << i + } + if count < 32 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + for i := 9; i > 3; i-- { + if count < 16 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(probs[9+i], value, rng, count) + x += int(bit) << i + } + if x&0xfff0 == 0 { + x += 8 + } else { + if count < 16 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(probs[12], value, rng, count) + if bit != 0 { + x += 8 + } + } + } else { + node := int16(0) + for { + bit, value, rng, count = vp8ReadBoolNoFill(probs[2+int(node>>1)], value, rng, count) + node = tables.SmallMVTree[int(node)+int(bit)] + if node <= 0 { + x = int(-node) + break + } + } + } + if x != 0 { + if count < 8 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(probs[1], value, rng, count) + if bit != 0 { + x = -x + } + } + d.value, d.rng, d.count, d.pos = value, rng, count, pos + return x +} + +func (d *Decoder) ReadLiteral(bits int) uint32 { + var v uint32 + for bit := bits - 1; bit >= 0; bit-- { + v |= uint32(d.ReadBit()) << uint(bit) + } + return v +} + +// ReadVP8BlockCoeffs decodes one VP8 coefficient block while keeping the +// entropy reader registers local for the block's full token walk. +func (d *Decoder) ReadVP8BlockCoeffs(probs *tables.CoefficientProbs, blockType int, ctx int, n int, out *[16]int16) int { + value := d.value + count := d.count + rng := d.rng + pos := d.pos + buf := d.buf + + // fill mirrors libvpx v1.16.0 vp8/decoder/dboolhuff.c + // vp8dx_bool_decoder_fill. When more than 8 bytes remain the byte loop + // is replaced by a single big-endian 8-byte load that consumes the + // identical (shift>>3)+1 bytes and produces bit-identical value/count + // evolution; the strictly-greater guard keeps the end-of-buffer + // VP8_LOTS_OF_BITS accounting on the byte loop. + fill := func() { + shift := valueSize - 8 - (count + 8) + bytesLeft := len(buf) - pos + if bytesLeft > 8 { + big := binary.BigEndian.Uint64(buf[pos:]) + consumed := (shift >> 3) + 1 + value |= (big >> (uint(56-shift) & 63)) &^ (uint64(1)<= 0 { + count += lotsOfBits + loopEnd = x + } + + if x < 0 || bitsLeft != 0 { + for shift >= loopEnd { + count += 8 + value |= uint64(buf[pos]) << (uint(shift) & 63) + pos++ + shift -= 8 + } + } + } + + // Keep p as a pointer into the probability table: copying the 11-byte + // entry by value forces a stack spill whose byte-wide reloads stall on + // store-to-load forwarding in this hottest decoder loop. + bt := &(*probs)[blockType] + p := &bt[n][ctx] + rng0 := rng + split := uint32(1 + (((rng0 - 1) * uint32(p[0])) >> 8)) + if count < 0 { + fill() + } + + bigsplit := uint64(split) << (valueSize - 8) + nextRange := split + if value >= bigsplit { + nextRange = rng0 - split + value -= bigsplit + } else { + shift := tables.BoolNorm[byte(nextRange)] + rng = nextRange << (shift & 31) + value <<= shift & 63 + count -= int(shift) + + d.value = value + d.count = count + d.rng = rng + d.pos = pos + return 0 + } + + shift := tables.BoolNorm[byte(nextRange)] + rng = nextRange << (shift & 31) + value <<= shift & 63 + count -= int(shift) + readBool := func(prob uint8) uint8 { + rng0 := rng + split := uint32(1 + (((rng0 - 1) * uint32(prob)) >> 8)) + if count < 0 { + fill() + } + + bigsplit := uint64(split) << (valueSize - 8) + nextRange := split + bit := uint8(0) + if value >= bigsplit { + nextRange = rng0 - split + value -= bigsplit + bit = 1 + } + + shift := tables.BoolNorm[byte(nextRange)] + rng = nextRange << (shift & 31) + value <<= shift & 63 + count -= int(shift) + return bit + } + // readSignedCoeff mirrors libvpx v1.16.0 vp8/decoder/detokenize.c GetSigned + // (lines 58-79). The sign bit is encoded with probability 0.5 exactly, so + // libvpx hard-codes the range-normalization to a single left shift rather + // than dispatching through vp8_norm[range]. The two paths only diverge + // when the post-decision range is 128 (input range == 255 with sign bit + // 0): vp8_norm[128] = 0 leaves range/value/count unchanged whereas + // GetSigned unconditionally doubles range/value and decrements count. + // Mismatched state would cascade into later bool reads. + readSignedCoeff := func(coeff int) int16 { + rng0 := rng + split := (rng0 + 1) >> 1 + if count < 0 { + fill() + } + bigsplit := uint64(split) << (valueSize - 8) + nextRange := split + var mask int16 + if value >= bigsplit { + nextRange = rng0 - split + value -= bigsplit + mask = -1 + } + // Fixed single-bit normalization (matches libvpx GetSigned): the + // post-decision range is always in [64, 128] for a 0.5-probability + // split, so a one-bit shift is the correct normalization. + rng = nextRange << 1 + value <<= 1 + count-- + v := int16(coeff) + return (v ^ mask) - mask + } + readTokenCategory := func(cat int) int { + v := 0 + switch cat { + case 0: + for _, prob := range tables.Cat3Prob { + v += v + int(readBool(prob)) + } + case 1: + for _, prob := range tables.Cat4Prob { + v += v + int(readBool(prob)) + } + case 2: + for _, prob := range tables.Cat5Prob { + v += v + int(readBool(prob)) + } + default: + for _, prob := range tables.Cat6Prob { + v += v + int(readBool(prob)) + } + } + return v + 3 + (8 << cat) + } + + for { + n++ + if readBool(p[1]) == 0 { + if n == 16 { + d.value = value + d.count = count + d.rng = rng + d.pos = pos + return 16 + } + // n is 1..15 here and CoefBandsTable values are 0..7; the + // masks are numerically no-ops that elide bounds checks. + p = &bt[tables.CoefBandsTable[n&15]&7][0] + } else { + v := 0 + tokenClass := uint8(2) + if readBool(p[2]) == 0 { + tokenClass = 1 + v = 1 + } else { + if readBool(p[3]) == 0 { + if readBool(p[4]) == 0 { + v = 2 + } else { + v = 3 + int(readBool(p[5])) + } + } else { + if readBool(p[6]) == 0 { + if readBool(p[7]) == 0 { + v = 5 + int(readBool(159)) + } else { + v = 7 + 2*int(readBool(165)) + v += int(readBool(145)) + } + } else { + bit1 := int(readBool(p[8])) + bit0 := int(readBool(p[9+bit1])) + cat := 2*bit1 + bit0 + v = readTokenCategory(cat) + } + } + } + + j := tables.DefaultZigZag1D[(n-1)&15] + out[j&15] = readSignedCoeff(v) + if n == 16 { + d.value = value + d.count = count + d.rng = rng + d.pos = pos + return 16 + } + p = &bt[tables.CoefBandsTable[n&15]&7][tokenClass] + if readBool(p[0]) == 0 { + d.value = value + d.count = count + d.rng = rng + d.pos = pos + return n + } + continue + } + } +} + +// ReadVP8MacroblockCoeffs decodes every coefficient block of one macroblock +// in a single call, mirroring libvpx v1.16.0 vp8/decoder/detokenize.c +// vp8_decode_mb_tokens: the Y2 block first for non-4x4 macroblocks (with the +// luma DC token skipped), then the 16 luma blocks, then the 8 chroma blocks. +// Keeping the whole walk in one function keeps the entropy reader state +// (value/count/range/position) in registers across all block walks instead +// of reloading and spilling it around a per-block call. +// +// aboveY1..leftY2 are the entropy context planes (updated in place exactly +// as the per-block sequence would). qcoeff and eob receive the decoded +// coefficients and per-block end-of-block counts for the blocks that decode +// coefficients; skipped-by-EOB blocks only write eob and contexts, matching +// DecodeMacroblockTokens' contract over cleared token storage. The returned +// dirtyMask has bit b set when block b decoded a nonzero coefficient. +// vp8BlockFastMargin is the headroom (in bytes) required before the end of +// the token partition buffer to decode a complete 4x4 block with unconditional +// 8-byte big-endian refills. One 4x4 block has at most 16 coefficients, each +// taking at most 18 boolean reads of <=7 bits plus 1 sign bit (<= 254 bytes), +// plus 8 bytes for the final 64-bit load. +const vp8BlockFastMargin = 288 + +func fillBoolFast(buf []byte, pos int, value uint64, count int) (uint64, int, int) { + shift := valueSize - 8 - (count + 8) + big := binary.BigEndian.Uint64(buf[pos:]) + n := (shift &^ 7) + 8 + value |= (big >> (uint(64-n) & 63)) << uint(shift&7) + return value, count + n, pos + (n >> 3) +} + +func vp8ReadBoolNoFill(prob uint8, value uint64, rng uint32, count int) (uint8, uint64, uint32, int) { + s := 1 + (((rng - 1) * uint32(prob)) >> 8) + m := ^uint32(int32(uint32(value>>56)-s) >> 31) + nr := s ^ (((rng - s) ^ s) & m) + sh := uint32(bits.LeadingZeros8(uint8(nr))) + return uint8(m & 1), (value - uint64(s&m)<<56) << sh, nr << sh, count - int(sh) +} + +func vp8ReadSignedCoeffNoFill(coeff int, value uint64, rng uint32, count int) (int16, uint64, uint32, int) { + split := (rng + 1) >> 1 + bigsplit := uint64(split) << 56 + ge := value >= bigsplit + nr := split + if ge { + nr = rng - split + } + nv := value + if ge { + nv = value - bigsplit + } + v := int16(coeff) + if ge { + v = -v + } + return v, nv << 1, nr << 1, count - 1 +} + +func vp8ReadBoolFast(prob uint8, value uint64, rng uint32, count int) (bool, uint64, uint32, int) { + s := 1 + (((rng - 1) * uint32(prob)) >> 8) + bigsplit := uint64(s) << 56 + ge := value >= bigsplit + nr := s + if ge { + nr = rng - s + } + nv := value + if ge { + nv = value - bigsplit + } + sh := uint32(bits.LeadingZeros8(uint8(nr))) + return ge, nv << sh, nr << sh, count - int(sh) +} + +//go:noinline +func decodeVP8Cat3to6Fast( + buf []byte, pos int, value uint64, rng uint32, count int, + p *[tables.EntropyNodes]uint8, +) (int, uint64, uint32, int, int) { + var b1, b0, bit uint8 + b1, value, rng, count = vp8ReadBoolNoFill(p[8], value, rng, count) + b0, value, rng, count = vp8ReadBoolNoFill(p[9+b1], value, rng, count) + cat := 2*int(b1) + int(b0) + v := 0 + switch cat { + case 0: + for _, prob := range tables.Cat3Prob { + if count < 0 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(prob, value, rng, count) + v += v + int(bit) + } + case 1: + for _, prob := range tables.Cat4Prob { + if count < 0 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(prob, value, rng, count) + v += v + int(bit) + } + case 2: + for _, prob := range tables.Cat5Prob { + if count < 0 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(prob, value, rng, count) + v += v + int(bit) + } + default: + for _, prob := range tables.Cat6Prob { + if count < 0 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(prob, value, rng, count) + v += v + int(bit) + } + } + v += 3 + (8 << cat) + if count < 0 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + return v, value, rng, count, pos +} + +func decodeVP8NonZeroBlockFast( + buf []byte, pos int, value uint64, rng uint32, count int, + bt *[tables.CoefBands][tables.PrevCoefContexts][tables.EntropyNodes]uint8, + p *[tables.EntropyNodes]uint8, + nn int, + out *[16]int16, +) (int, uint64, uint32, int, int) { + if count < 24 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + var bit uint8 + var b bool + for { + nn++ + b, value, rng, count = vp8ReadBoolFast(p[1], value, rng, count) + if !b { + if nn == 16 { + return 16, value, rng, count, pos + } + p = &bt[tables.CoefBandsTable[nn&15]&7][0] + if count < 16 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + continue + } + v := 0 + tokenClass := uint8(2) + b, value, rng, count = vp8ReadBoolFast(p[2], value, rng, count) + if !b { + tokenClass = 1 + v = 1 + } else { + if count < 32 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + b, value, rng, count = vp8ReadBoolFast(p[3], value, rng, count) + if !b { + b, value, rng, count = vp8ReadBoolFast(p[4], value, rng, count) + if !b { + v = 2 + } else { + bit, value, rng, count = vp8ReadBoolNoFill(p[5], value, rng, count) + v = 3 + int(bit) + } + } else { + if count < 32 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + b, value, rng, count = vp8ReadBoolFast(p[6], value, rng, count) + if !b { + b, value, rng, count = vp8ReadBoolFast(p[7], value, rng, count) + if !b { + bit, value, rng, count = vp8ReadBoolNoFill(159, value, rng, count) + v = 5 + int(bit) + } else { + bit, value, rng, count = vp8ReadBoolNoFill(165, value, rng, count) + v = 7 + 2*int(bit) + bit, value, rng, count = vp8ReadBoolNoFill(145, value, rng, count) + v += int(bit) + } + } else { + v, value, rng, count, pos = decodeVP8Cat3to6Fast(buf, pos, value, rng, count, p) + } + } + } + + j := tables.DefaultZigZag1D[(nn-1)&15] + out[j&15], value, rng, count = vp8ReadSignedCoeffNoFill(v, value, rng, count) + if nn == 16 { + return 16, value, rng, count, pos + } + p = &bt[tables.CoefBandsTable[nn&15]&7][tokenClass] + if count < 24 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + b, value, rng, count = vp8ReadBoolFast(p[0], value, rng, count) + if !b { + return nn, value, rng, count, pos + } + } +} + +func (d *Decoder) ReadVP8MacroblockCoeffs( + probs *tables.CoefficientProbs, is4x4 bool, + aboveY1 *[4]uint8, leftY1 *[4]uint8, + aboveU *[2]uint8, leftU *[2]uint8, + aboveV *[2]uint8, leftV *[2]uint8, + aboveY2 *uint8, leftY2 *uint8, + qcoeff *[25][16]int16, eob *[25]uint8, +) (eobTotal int, dirtyMask uint32) { + value := d.value + count := d.count + rng := d.rng + pos := d.pos + buf := d.buf + fastLimit := len(buf) - vp8BlockFastMargin + + if pos > fastLimit-32 { + startIdx := -1 + if is4x4 { + startIdx = 0 + } + return d.readVP8MacroblockCoeffsSlow( + probs, is4x4, startIdx, 0, 0, + aboveY1, leftY1, aboveU, leftU, aboveV, leftV, + aboveY2, leftY2, qcoeff, eob, + ) + } + + skipDC := 0 + lumaType := 3 + var bit uint8 + + if !is4x4 { + skipDC = 1 + lumaType = 0 + bt := &(*probs)[1] + p := &bt[0][int(*aboveY2+*leftY2)] + if count < 8 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + bit, value, rng, count = vp8ReadBoolNoFill(p[0], value, rng, count) + if bit == 0 { + *aboveY2 = 0 + *leftY2 = 0 + eob[24] = 0 + eobTotal = -16 + } else { + var nz int + nz, value, rng, count, pos = decodeVP8NonZeroBlockFast(buf, pos, value, rng, count, bt, p, 0, &qcoeff[24]) + has := uint8(0) + if nz > 0 { + has = 1 + dirtyMask |= 1 << 24 + } + *aboveY2 = has + *leftY2 = has + eob[24] = uint8(nz) + eobTotal = nz - 16 + if pos > fastLimit-32 { + d.value, d.count, d.rng, d.pos = value, count, rng, pos + return d.readVP8MacroblockCoeffsSlow( + probs, is4x4, 0, eobTotal, dirtyMask, + aboveY1, leftY1, aboveU, leftU, aboveV, leftV, + aboveY2, leftY2, qcoeff, eob, + ) + } + } + } + + btY := &(*probs)[lumaType] + bandY := &btY[skipDC] + var aY [4]uint8 + aY[0], aY[1], aY[2], aY[3] = aboveY1[0]&1, aboveY1[1]&1, aboveY1[2]&1, aboveY1[3]&1 + for row := range 4 { + lv := leftY1[row] & 1 + rowBase := row << 2 + for col := range 4 { + b := rowBase + col + p := &bandY[aY[col]+lv] + if count < 8 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + prob := uint32(p[0]) + split := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(split) << (valueSize - 8) + if value < bigsplit { + shift := uint32(bits.LeadingZeros8(uint8(split))) + rng = split << shift + value <<= shift + count -= int(shift) + aY[col] = 0 + lv = 0 + eob[b] = uint8(skipDC) + eobTotal += skipDC + continue + } + nr := rng - split + nv := value - bigsplit + shift := uint32(bits.LeadingZeros8(uint8(nr))) + rng = nr << shift + value = nv << shift + count -= int(shift) + var nz int + nz, value, rng, count, pos = decodeVP8NonZeroBlockFast(buf, pos, value, rng, count, btY, p, skipDC, &qcoeff[b]) + has := uint8(0) + if nz > 0 { + has = 1 + dirtyMask |= 1 << uint(b) + } + aY[col] = has + lv = has + eob[b] = uint8(nz + skipDC) + eobTotal += nz + skipDC + if pos > fastLimit-32 { + aboveY1[0], aboveY1[1], aboveY1[2], aboveY1[3] = aY[0], aY[1], aY[2], aY[3] + leftY1[row] = lv + d.value, d.count, d.rng, d.pos = value, count, rng, pos + return d.readVP8MacroblockCoeffsSlow( + probs, is4x4, b+1, eobTotal, dirtyMask, + aboveY1, leftY1, aboveU, leftU, aboveV, leftV, + aboveY2, leftY2, qcoeff, eob, + ) + } + } + leftY1[row] = lv + } + aboveY1[0], aboveY1[1], aboveY1[2], aboveY1[3] = aY[0], aY[1], aY[2], aY[3] + + btUV := &(*probs)[2] + bandUV := &btUV[0] + var aU [2]uint8 + aU[0], aU[1] = aboveU[0]&1, aboveU[1]&1 + for row := range 2 { + lv := leftU[row] & 1 + rowBase := 16 + (row << 1) + for col := range 2 { + b := rowBase + col + p := &bandUV[aU[col]+lv] + if count < 8 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + prob := uint32(p[0]) + split := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(split) << (valueSize - 8) + if value < bigsplit { + shift := uint32(bits.LeadingZeros8(uint8(split))) + rng = split << shift + value <<= shift + count -= int(shift) + aU[col] = 0 + lv = 0 + eob[b] = 0 + continue + } + nr := rng - split + nv := value - bigsplit + shift := uint32(bits.LeadingZeros8(uint8(nr))) + rng = nr << shift + value = nv << shift + count -= int(shift) + var nz int + nz, value, rng, count, pos = decodeVP8NonZeroBlockFast(buf, pos, value, rng, count, btUV, p, 0, &qcoeff[b]) + has := uint8(0) + if nz > 0 { + has = 1 + dirtyMask |= 1 << uint(b) + } + aU[col] = has + lv = has + eob[b] = uint8(nz) + eobTotal += nz + if pos > fastLimit-32 { + aboveU[0], aboveU[1] = aU[0], aU[1] + leftU[row] = lv + d.value, d.count, d.rng, d.pos = value, count, rng, pos + return d.readVP8MacroblockCoeffsSlow( + probs, is4x4, b+1, eobTotal, dirtyMask, + aboveY1, leftY1, aboveU, leftU, aboveV, leftV, + aboveY2, leftY2, qcoeff, eob, + ) + } + } + leftU[row] = lv + } + aboveU[0], aboveU[1] = aU[0], aU[1] + + var aV [2]uint8 + aV[0], aV[1] = aboveV[0]&1, aboveV[1]&1 + for row := range 2 { + lv := leftV[row] & 1 + rowBase := 20 + (row << 1) + for col := range 2 { + b := rowBase + col + p := &bandUV[aV[col]+lv] + if count < 8 { + value, count, pos = fillBoolFast(buf, pos, value, count) + } + prob := uint32(p[0]) + split := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(split) << (valueSize - 8) + if value < bigsplit { + shift := uint32(bits.LeadingZeros8(uint8(split))) + rng = split << shift + value <<= shift + count -= int(shift) + aV[col] = 0 + lv = 0 + eob[b] = 0 + continue + } + nr := rng - split + nv := value - bigsplit + shift := uint32(bits.LeadingZeros8(uint8(nr))) + rng = nr << shift + value = nv << shift + count -= int(shift) + var nz int + nz, value, rng, count, pos = decodeVP8NonZeroBlockFast(buf, pos, value, rng, count, btUV, p, 0, &qcoeff[b]) + has := uint8(0) + if nz > 0 { + has = 1 + dirtyMask |= 1 << uint(b) + } + aV[col] = has + lv = has + eob[b] = uint8(nz) + eobTotal += nz + if pos > fastLimit-32 { + aboveV[0], aboveV[1] = aV[0], aV[1] + leftV[row] = lv + d.value, d.count, d.rng, d.pos = value, count, rng, pos + return d.readVP8MacroblockCoeffsSlow( + probs, is4x4, b+1, eobTotal, dirtyMask, + aboveY1, leftY1, aboveU, leftU, aboveV, leftV, + aboveY2, leftY2, qcoeff, eob, + ) + } + } + leftV[row] = lv + } + aboveV[0], aboveV[1] = aV[0], aV[1] + + d.value = value + d.count = count + d.rng = rng + d.pos = pos + return eobTotal, dirtyMask +} + +//go:noinline +func (d *Decoder) readVP8MacroblockCoeffsSlow( + probs *tables.CoefficientProbs, is4x4 bool, + startIdx, eobTotal int, dirtyMask uint32, + aboveY1 *[4]uint8, leftY1 *[4]uint8, + aboveU *[2]uint8, leftU *[2]uint8, + aboveV *[2]uint8, leftV *[2]uint8, + aboveY2 *uint8, leftY2 *uint8, + qcoeff *[25][16]int16, eob *[25]uint8, +) (int, uint32) { + value := d.value + count := d.count + rng := d.rng + pos := d.pos + buf := d.buf + + readBool := func(prob uint8) uint8 { + rng0 := rng + split := uint32(1 + (((rng0 - 1) * uint32(prob)) >> 8)) + if count < 0 { + value, count, pos = fillBoolSlow(buf, pos, value, count) + } + + bigsplit := uint64(split) << (valueSize - 8) + nextRange := split + bit := uint8(0) + if value >= bigsplit { + nextRange = rng0 - split + value -= bigsplit + bit = 1 + } + + shift := uint32(bits.LeadingZeros8(uint8(nextRange))) & 7 + rng = nextRange << shift + value <<= shift + count -= int(shift) + return bit + } + readSignedCoeff := func(coeff int) int16 { + rng0 := rng + split := (rng0 + 1) >> 1 + if count < 0 { + value, count, pos = fillBoolSlow(buf, pos, value, count) + } + bigsplit := uint64(split) << (valueSize - 8) + nextRange := split + var m16 int16 + if value >= bigsplit { + nextRange = rng0 - split + value -= bigsplit + m16 = -1 + } + rng = nextRange << 1 + value <<= 1 + count-- + v := int16(coeff) + return (v ^ m16) - m16 + } + readTokenCategory := func(cat int) int { + v := 0 + switch cat { + case 0: + for _, prob := range tables.Cat3Prob { + v += v + int(readBool(prob)) + } + case 1: + for _, prob := range tables.Cat4Prob { + v += v + int(readBool(prob)) + } + case 2: + for _, prob := range tables.Cat5Prob { + v += v + int(readBool(prob)) + } + default: + for _, prob := range tables.Cat6Prob { + v += v + int(readBool(prob)) + } + } + return v + 3 + (8 << cat) + } + + skipDC := 0 + lumaType := 3 + if !is4x4 { + skipDC = 1 + lumaType = 0 + } + + for idx := startIdx; idx < 24; idx++ { + var b int + var bt *[tables.CoefBands][tables.PrevCoefContexts][tables.EntropyNodes]uint8 + var aP, lP *uint8 + var n int + switch { + case idx < 0: + b = 24 + bt = &(*probs)[1] + aP, lP = aboveY2, leftY2 + case idx < 16: + b = idx + bt = &(*probs)[lumaType] + aP = &aboveY1[idx&3] + lP = &leftY1[(idx&0x0c)>>2] + n = skipDC + default: + b = idx + bt = &(*probs)[2] + if idx < 20 { + aP = &aboveU[idx&1] + lP = &leftU[(idx&3)>>1] + } else { + aP = &aboveV[idx&1] + lP = &leftV[(idx&3)>>1] + } + } + + ctx := int(*aP + *lP) + p := &bt[n&1][ctx] + if readBool(p[0]) == 0 { + *aP = 0 + *lP = 0 + if idx < 0 { + eob[24] = 0 + eobTotal -= 16 + } else if idx < 16 { + eob[b] = uint8(skipDC) + eobTotal += skipDC + } else { + eob[b] = 0 + } + continue + } + out := &qcoeff[b] + nonzeros := 0 + nn := n + walk: + for { + nn++ + if readBool(p[1]) == 0 { + if nn == 16 { + nonzeros = 16 + break walk + } + p = &bt[tables.CoefBandsTable[nn&15]&7][0] + continue + } + v := 0 + tokenClass := uint8(2) + if readBool(p[2]) == 0 { + tokenClass = 1 + v = 1 + } else { + if readBool(p[3]) == 0 { + if readBool(p[4]) == 0 { + v = 2 + } else { + v = 3 + int(readBool(p[5])) + } + } else { + if readBool(p[6]) == 0 { + if readBool(p[7]) == 0 { + v = 5 + int(readBool(159)) + } else { + v = 7 + 2*int(readBool(165)) + v += int(readBool(145)) + } + } else { + bit1 := int(readBool(p[8])) + bit0 := int(readBool(p[9+bit1])) + cat := 2*bit1 + bit0 + v = readTokenCategory(cat) + } + } + } + + j := tables.DefaultZigZag1D[(nn-1)&15] + out[j&15] = readSignedCoeff(v) + if nn == 16 { + nonzeros = 16 + break walk + } + p = &bt[tables.CoefBandsTable[nn&15]&7][tokenClass] + if readBool(p[0]) == 0 { + nonzeros = nn + break walk + } + } + + hasCoeffs := uint8(0) + if nonzeros > 0 { + hasCoeffs = 1 + dirtyMask |= 1 << uint(b) + } + *aP = hasCoeffs + *lP = hasCoeffs + switch { + case idx < 0: + eob[24] = uint8(nonzeros) + eobTotal += nonzeros - 16 + case idx < 16: + nz := nonzeros + skipDC + eob[b] = uint8(nz) + eobTotal += nz + default: + eob[b] = uint8(nonzeros) + eobTotal += nonzeros + } + } + + d.value = value + d.count = count + d.rng = rng + d.pos = pos + return eobTotal, dirtyMask +} + +// ReadCoefUpdateProbsInto scans the full VP8 coefficient probability update +// header in a single call. For every entry of updateProbs it reads one +// "should update" bool; on a 1, it reads an 8-bit literal and writes the new +// value into the matching probs slot. updateProbs and probs are flat views of +// the [BlockTypes][CoefBands][PrevCoefContexts][EntropyNodes] tables. +// +// nonDefaultPartitionCtx is set to true when any update lands on a ctx > 0 +// slot, matching the IndependentPartitions = false signal in the parent header. +// updateCount returns the number of updates applied. +// +// The decoder state is kept in registers across the entire scan, avoiding the +// per-call pointer dereferences that the standalone ReadBool method incurs. +// updateProbs must be exactly BlockTypes*CoefBands*PrevCoefContexts*EntropyNodes +// (= 4*8*3*11 = 1056) long; probs, when non-nil, has the same length. +// nodesPerCtx is EntropyNodes (=11) and ctxsPerBand is PrevCoefContexts (=3). +func (d *Decoder) ReadCoefUpdateProbsInto(updateProbs []uint8, probs []uint8, nodesPerCtx, ctxsPerBand int) (updateCount int, nonDefaultPartitionCtx bool) { + value := d.value + count := d.count + rng := d.rng + pos := d.pos + buf := d.buf + + for i, prob := range updateProbs { + // Inline ReadBool for the update flag. + rng0 := rng + split := rng0 - 1 + if prob != 255 { + split = uint32(1 + (((rng0 - 1) * uint32(prob)) >> 8)) + } + if count < 0 { + // Inline fill(). + shift := valueSize - 8 - (count + 8) + bytesLeft := len(buf) - pos + bitsLeft := bytesLeft * 8 + x := shift + 8 - bitsLeft + loopEnd := 0 + if x >= 0 { + count += lotsOfBits + loopEnd = x + } + if x < 0 || bitsLeft != 0 { + for shift >= loopEnd { + count += 8 + value |= uint64(buf[pos]) << (uint(shift) & 63) + pos++ + shift -= 8 + } + } + } + + bigsplit := uint64(split) << (valueSize - 8) + nextRange := split + var bit uint8 + if value >= bigsplit { + nextRange = rng0 - split + value -= bigsplit + bit = 1 + } + s := tables.BoolNorm[byte(nextRange)] + rng = nextRange << (s & 31) + value <<= s & 63 + count -= int(s) + + if bit == 0 { + continue + } + + // Read an 8-bit literal using inline ReadBit calls. + var lit uint32 + for k := 7; k >= 0; k-- { + rng0 = rng + split = (rng0 + 1) >> 1 + if count < 0 { + shift := valueSize - 8 - (count + 8) + bytesLeft := len(buf) - pos + bitsLeft := bytesLeft * 8 + x := shift + 8 - bitsLeft + loopEnd := 0 + if x >= 0 { + count += lotsOfBits + loopEnd = x + } + if x < 0 || bitsLeft != 0 { + for shift >= loopEnd { + count += 8 + value |= uint64(buf[pos]) << (uint(shift) & 63) + pos++ + shift -= 8 + } + } + } + bigsplit = uint64(split) << (valueSize - 8) + nextRange = split + var lbit uint32 + if value >= bigsplit { + nextRange = rng0 - split + value -= bigsplit + lbit = 1 + } + s = tables.BoolNorm[byte(nextRange)] + rng = nextRange << (s & 31) + value <<= s & 63 + count -= int(s) + lit |= lbit << uint(k) + } + + if probs != nil { + probs[i] = uint8(lit) + } + updateCount++ + // node = i % nodesPerCtx; ctx = (i / nodesPerCtx) % ctxsPerBand. + if (i/nodesPerCtx)%ctxsPerBand != 0 { + nonDefaultPartitionCtx = true + } + } + + d.value = value + d.count = count + d.rng = rng + d.pos = pos + return updateCount, nonDefaultPartitionCtx +} + +func (d *Decoder) Err() error { + if d.count > valueSize && d.count < lotsOfBits { + return ErrTruncated + } + return nil +} + +func (d *Decoder) Corrupted() bool { + return d.Err() != nil +} + +func (d *Decoder) fill() { + shift := valueSize - 8 - (d.count + 8) + bytesLeft := len(d.buf) - d.pos + if bytesLeft > 8 { + // Batched form of the byte loop below (see ReadVP8BlockCoeffs): + // bit-identical when more than 8 bytes remain. + big := binary.BigEndian.Uint64(d.buf[d.pos:]) + consumed := (shift >> 3) + 1 + d.value |= (big >> (uint(56-shift) & 63)) &^ (uint64(1)<= 0 { + d.count += lotsOfBits + loopEnd = x + } + + if x < 0 || bitsLeft != 0 { + for shift >= loopEnd { + d.count += 8 + d.value |= uint64(d.buf[d.pos]) << (uint(shift) & 63) + d.pos++ + shift -= 8 + } + } +} diff --git a/internal/vp8/boolcoder/decoder_fuzz_test.go b/internal/vp8/boolcoder/decoder_fuzz_test.go new file mode 100644 index 0000000..6d07a1d --- /dev/null +++ b/internal/vp8/boolcoder/decoder_fuzz_test.go @@ -0,0 +1,90 @@ +// Copyright (c) 2026, go-avkit +// SPDX-License-Identifier: BSD-3-Clause + +package boolcoder + +import "testing" + +// refBool is the boolean decoder of RFC 6386 section 7.3, reading zero bytes past the end. +type refBool struct { + in []byte + pos int + value uint32 + rng uint32 + bitCount int +} + +func newRef(in []byte) *refBool { + r := &refBool{in: in, rng: 255} + r.value = uint32(r.next())<<8 | uint32(r.next()) + return r +} + +func (r *refBool) next() byte { + if r.pos >= len(r.in) { + r.pos++ + return 0 + } + b := r.in[r.pos] + r.pos++ + return b +} + +func (r *refBool) read(prob uint8) uint8 { + split := 1 + (((r.rng - 1) * uint32(prob)) >> 8) + big := split << 8 + var ret uint8 + if r.value >= big { + ret = 1 + r.rng -= split + r.value -= big + } else { + r.rng = split + } + for r.rng < 128 { + r.value <<= 1 + r.rng <<= 1 + if r.bitCount++; r.bitCount == 8 { + r.bitCount = 0 + r.value |= uint32(r.next()) + } + } + return ret +} + +// FuzzReadBool reads any bytes with any probabilities, far past the end of the data, and never panics. +// While the reads stay inside the data (a read takes at most 7 bits) it gives the RFC's decoder's bits. +func FuzzReadBool(f *testing.F) { + f.Add([]byte{0x80, 0x00, 0xff, 0x12, 0x34, 0x56, 0x78, 0x9a}, []byte{128, 1, 255, 0, 64}) + f.Add([]byte{}, []byte{128}) + f.Add([]byte{0xff}, []byte{0, 255}) + f.Fuzz(func(t *testing.T, data, probs []byte) { + if len(probs) == 0 { + probs = []byte{128} + } + var d Decoder + if err := d.Init(data); err != nil { + return + } + ref := newRef(data) + // The RFC's decoder holds value < range<<8, which a first byte of 0xff breaks from the start; + // such a stream is not one an encoder writes, and only the no-panic half applies to it. + inside := (len(data) - 4) * 8 / 7 + if len(data) > 0 && data[0] == 0xff { + inside = 0 + } + for i := 0; i < 8*len(data)+64; i++ { + p := probs[i%len(probs)] + got := d.ReadBool(p) + if i < inside { + if want := ref.read(p); got != want { + t.Fatalf("read %d, prob %d: %d, RFC 6386 says %d", i, p, got, want) + } + } + } + d.ReadLiteral(7) + d.ReadBit() + _ = d.Err() + _ = d.Corrupted() + }) +} diff --git a/internal/vp8/boolcoder/testdata/fuzz/FuzzReadBool/first-byte-ff b/internal/vp8/boolcoder/testdata/fuzz/FuzzReadBool/first-byte-ff new file mode 100644 index 0000000..d51c4f9 --- /dev/null +++ b/internal/vp8/boolcoder/testdata/fuzz/FuzzReadBool/first-byte-ff @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\xff200000") +[]byte("\xff") diff --git a/internal/vp8/boolcoder/testdata/fuzz/FuzzReadBool/past-the-end b/internal/vp8/boolcoder/testdata/fuzz/FuzzReadBool/past-the-end new file mode 100644 index 0000000..8892ca3 --- /dev/null +++ b/internal/vp8/boolcoder/testdata/fuzz/FuzzReadBool/past-the-end @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x80\x00") +[]byte("\x01\xff\x80\x00") diff --git a/internal/vp8/codec/codecapi_aliases.go b/internal/vp8/codec/codecapi_aliases.go new file mode 100644 index 0000000..0d25843 --- /dev/null +++ b/internal/vp8/codec/codecapi_aliases.go @@ -0,0 +1,107 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/codec/codecapi_aliases.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Shared codec API aliases for libvpx v1.16.0 VP8 codec implementation. +package codec + +import ( + vp8common "github.com/go-avkit/vpx/internal/vp8/common" + vp8dec "github.com/go-avkit/vpx/internal/vp8/decoder" + "github.com/go-avkit/vpx/internal/vpx/codecapi" + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" +) + +const ( + UpstreamLibvpxVersion = codecapi.UpstreamLibvpxVersion + CodecVP8 = codecapi.CodecVP8 + CodecVP9 = codecapi.CodecVP9 + maxVP8Dimension = codecapi.MaxVP8Dimension + maxQuantizer = codecapi.MaxQuantizer +) + +type Image = codecapi.Image +type StreamInfo = codecapi.StreamInfo +type ReferenceFlags = codecapi.ReferenceFlags +type ReferenceFrame = codecapi.ReferenceFrame +type FrameInfo = codecapi.FrameInfo + +type PostProcessFlag = codecapi.PostProcessFlag +type VP8Decryptor = codecapi.VP8Decryptor + +type RTPPayloadFragment = codecapi.RTPPayloadFragment + +const ( + ReferenceFlagLast = codecapi.ReferenceFlagLast + ReferenceFlagGolden = codecapi.ReferenceFlagGolden + ReferenceFlagAltRef = codecapi.ReferenceFlagAltRef + ReferenceLast = codecapi.ReferenceLast + ReferenceGolden = codecapi.ReferenceGolden + ReferenceAltRef = codecapi.ReferenceAltRef + + RateControlVBR = codecapi.RateControlVBR + RateControlCBR = codecapi.RateControlCBR + RateControlCQ = codecapi.RateControlCQ + RateControlQ = codecapi.RateControlQ + + RealtimeFrameDropUnchanged = codecapi.RealtimeFrameDropUnchanged + RealtimeFrameDropDisabled = codecapi.RealtimeFrameDropDisabled + RealtimeFrameDropEnabled = codecapi.RealtimeFrameDropEnabled + + DeadlineBestQuality = codecapi.DeadlineBestQuality + DeadlineGoodQuality = codecapi.DeadlineGoodQuality + DeadlineRealtime = codecapi.DeadlineRealtime + + ScalingNormal = codecapi.ScalingNormal + ScalingFourFive = codecapi.ScalingFourFive + ScalingThreeFive = codecapi.ScalingThreeFive + ScalingOneTwo = codecapi.ScalingOneTwo + + TunePSNR = codecapi.TunePSNR + TuneSSIM = codecapi.TuneSSIM + + EncodeForceKeyFrame = codecapi.EncodeForceKeyFrame + EncodeInvisibleFrame = codecapi.EncodeInvisibleFrame + EncodeNoReferenceLast = codecapi.EncodeNoReferenceLast + EncodeNoReferenceGolden = codecapi.EncodeNoReferenceGolden + EncodeNoReferenceAltRef = codecapi.EncodeNoReferenceAltRef + EncodeNoUpdateLast = codecapi.EncodeNoUpdateLast + EncodeNoUpdateGolden = codecapi.EncodeNoUpdateGolden + EncodeNoUpdateAltRef = codecapi.EncodeNoUpdateAltRef + EncodeNoUpdateEntropy = codecapi.EncodeNoUpdateEntropy + EncodeForceGoldenFrame = codecapi.EncodeForceGoldenFrame + EncodeForceAltRefFrame = codecapi.EncodeForceAltRefFrame + + PostProcessDeblock = codecapi.PostProcessDeblock + PostProcessDemacroblock = codecapi.PostProcessDemacroblock + PostProcessAddNoise = codecapi.PostProcessAddNoise + PostProcessMFQE = codecapi.PostProcessMFQE + allPostProcessFlags = codecapi.AllPostProcessFlags + + encoderCacheLineSize = codecapi.EncoderCacheLineSize + rowWorkerIdleSpinBudget = codecapi.RowWorkerIdleSpinBudget +) + +var ( + ErrInvalidData = vpxerrors.ErrInvalidData + ErrNeedKeyFrame = vpxerrors.ErrNeedKeyFrame + + ErrFrameRejected = vpxerrors.ErrFrameRejected + ErrInvalidConfig = vpxerrors.ErrInvalidConfig + + ErrClosed = vpxerrors.ErrClosed +) + +func peekVP8FrameHeader(packet []byte) (vp8dec.FrameHeader, StreamInfo, error) { + return codecapi.PeekVP8FrameHeader(packet) +} + +func publicImageFromVP8(src *vp8common.Image) Image { + return codecapi.PublicImageFromVP8(src) +} diff --git a/internal/vp8/codec/vp8_decoder.go b/internal/vp8/codec/vp8_decoder.go new file mode 100644 index 0000000..cdd2a94 --- /dev/null +++ b/internal/vp8/codec/vp8_decoder.go @@ -0,0 +1,1338 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/codec/vp8_decoder.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + vp8common "github.com/go-avkit/vpx/internal/vp8/common" + vp8dec "github.com/go-avkit/vpx/internal/vp8/decoder" + vp8tables "github.com/go-avkit/vpx/internal/vp8/tables" + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +// DecoderOptions configures a VP8 decoder. +type DecoderOptions struct { + // Threads selects the decoder worker count. 0 and 1 use the serial + // path; values >=2 enable the two-stage row pipeline when the frame + // has more than one macroblock row. Negative values are rejected + // with [ErrInvalidConfig]. + Threads int + + // ErrorConcealment enables libvpx-style concealment for corrupt interframes + // after a clean keyframe has initialized references. + ErrorConcealment bool + // PostProcessFlags selects individual libvpx-style postprocess filters. + // Zero disables postprocessing. + PostProcessFlags PostProcessFlag + // PostProcessDeblockingLevel is the VP8_SET_POSTPROC deblocking strength + // in [0, 16]. Zero uses libvpx's decoder default of 4 unless + // PostProcessDeblockingLevelSet is true. + PostProcessDeblockingLevel int + // PostProcessDeblockingLevelSet makes a zero PostProcessDeblockingLevel + // explicit instead of treating it as the default. + PostProcessDeblockingLevelSet bool + // PostProcessNoiseLevel enables libvpx-style additive luma noise when + // PostProcessAddNoise is set. Zero disables additive noise; valid range is + // [0, 16]. + PostProcessNoiseLevel int + + // MaxWidth and MaxHeight reject key frames larger than the configured + // dimensions when non-zero. + MaxWidth int + MaxHeight int + + // Decryptor, when non-nil, decrypts compressed packet bytes before + // the boolean decoder reads them. Mirrors libvpx's VP8D_SET_DECRYPTOR + // control (vp8/vp8_dx_iface.c vp8_set_decryptor); the callback is + // invoked by each VP8 partition's boolean decoder during fill() + // with the encrypted slice and a destination buffer to write the + // plaintext into. DecryptorState is passed back as the callback's + // first argument. Re-use the same callback + state across + // VP8Decoder instances when a per-decoder key is desired. + Decryptor VP8Decryptor + DecryptorState any + + // RejectResolutionChange, when true, makes Decode return + // [ErrFrameRejected] on a key frame whose dimensions differ from the + // active stream. When false (the default) the decoder reallocates + // its internal frame buffers on the resolution-change key frame. + RejectResolutionChange bool +} + +// vp8DecoderState is the explicit lifecycle state of a VP8Decoder: +// +// NeedKey (cold start / Reset) --keyframe--> Active <--> FrameReady +// Any --Close()---> Closed (terminal) +type vp8DecoderState uint8 + +const ( + vp8DecoderNeedKey vp8DecoderState = iota + vp8DecoderActive + vp8DecoderFrameReady + vp8DecoderClosed +) + +// VP8Decoder decodes raw VP8 frame payloads. +// Pointer-containing fields are grouped at the top of the struct to minimize +// Go GC PtrBytes scanning overhead. +type VP8Decoder struct { + opts DecoderOptions + lastFrame Image + refPool [4]vp8common.FrameBuffer + post vp8common.FrameBuffer + decryptedPacket []byte + modes []vp8dec.MacroblockMode + prevModes []vp8dec.MacroblockMode + ecOverlaps []vp8dec.ErrorConcealmentOverlap + tokens []vp8dec.MacroblockTokens + tokenAbove []vp8dec.EntropyContextPlanes + segmentMap []uint8 + postprocScratch []byte + postprocState vp8dec.PostProcessState + modeReader boolcoder.Decoder + tokenReaders [8]boolcoder.Decoder + partitions vp8dec.PartitionLayout + wavefront *vp8dec.WavefrontPool + + // Pointer-free value fields below (never scanned by Go's GC). + lifecycle vp8DecoderState + lastInfo FrameInfo + currentPTS uint64 + visibleFrames int + ecActive bool + frameCorrupt bool + frameSuppress bool + modesCorrupt int + residualCorrupt int + frameWidth int + frameHeight int + curIdx int + lastIdx int + goldenIdx int + altIdx int + mbRows int + mbCols int + frameHeader vp8dec.FrameHeader + previousQuant vp8dec.QuantHeader + previousLoopFilter vp8dec.LoopFilterHeader + state vp8dec.StateHeader + coefProbs vp8tables.CoefficientProbs + frameCoefProbs vp8tables.CoefficientProbs + modeProbs vp8dec.ModeProbs + frameModeProbs vp8dec.ModeProbs + loopInfo vp8common.LoopFilterInfo + dequantTables vp8common.FrameDequantTables + dequants [vp8common.MaxMBSegments]vp8common.MacroblockDequant + segmentationState vp8dec.SegmentationHeader + reconstructScratch vp8dec.IntraReconstructionScratch +} + +func (d *VP8Decoder) curBuf() *vp8common.FrameBuffer { return &d.refPool[d.curIdx] } +func (d *VP8Decoder) lastBuf() *vp8common.FrameBuffer { return &d.refPool[d.lastIdx] } +func (d *VP8Decoder) goldenBuf() *vp8common.FrameBuffer { return &d.refPool[d.goldenIdx] } +func (d *VP8Decoder) altBuf() *vp8common.FrameBuffer { return &d.refPool[d.altIdx] } + +func (d *VP8Decoder) selectFreeCurrentSlot() { + for i := range d.refPool { + if i != d.lastIdx && i != d.goldenIdx && i != d.altIdx { + d.curIdx = i + return + } + } +} + +func (d *VP8Decoder) detachReferenceSlot(ref ReferenceFrame) (*vp8common.FrameBuffer, bool) { + var target *int + var otherA, otherB int + switch ref { + case ReferenceLast: + target, otherA, otherB = &d.lastIdx, d.goldenIdx, d.altIdx + case ReferenceGolden: + target, otherA, otherB = &d.goldenIdx, d.lastIdx, d.altIdx + case ReferenceAltRef: + target, otherA, otherB = &d.altIdx, d.lastIdx, d.goldenIdx + default: + return nil, false + } + if *target == otherA || *target == otherB || *target == d.curIdx { + for i := range d.refPool { + if i != otherA && i != otherB && i != d.curIdx { + *target = i + break + } + } + } + return &d.refPool[*target], true +} + +func (d *VP8Decoder) isClosed() bool { + return d == nil || d.lifecycle == vp8DecoderClosed +} + +func (d *VP8Decoder) isActive() bool { + return d != nil && (d.lifecycle == vp8DecoderActive || d.lifecycle == vp8DecoderFrameReady) +} + +// NewVP8Decoder creates a VP8 decoder with validated options. The zero +// value of opts is valid: it produces a single-threaded decoder with no +// postprocessing, no error concealment, and no dimension caps. +func NewVP8Decoder(opts DecoderOptions) (*VP8Decoder, error) { + if err := validateDecoderOptions(opts); err != nil { + return nil, err + } + d := &VP8Decoder{ + opts: opts, + lifecycle: vp8DecoderNeedKey, + residualCorrupt: -1, + curIdx: 0, + lastIdx: 1, + goldenIdx: 2, + altIdx: 3, + coefProbs: vp8tables.DefaultCoefProbs, + frameCoefProbs: vp8tables.DefaultCoefProbs, + } + vp8dec.ResetModeProbs(&d.modeProbs) + vp8dec.ResetModeProbs(&d.frameModeProbs) + return d, nil +} + +// SetPostProcess changes libvpx-style decoder postprocessing at runtime. +// flags must be a combination of PostProcess* constants. noiseLevel must be +// in [0, 16] and requires PostProcessAddNoise when non-zero. The update is +// atomic: invalid inputs leave the existing decoder options unchanged. +func (d *VP8Decoder) SetPostProcess(flags PostProcessFlag, noiseLevel int) error { + if d.isClosed() { + return ErrClosed + } + next := d.opts + next.PostProcessFlags = flags + next.PostProcessNoiseLevel = noiseLevel + return d.setPostProcessOptions(next) +} + +// SetPostProcessConfig changes the full VP8_SET_POSTPROC configuration at +// runtime, including deblocking strength. deblockingLevel and noiseLevel must +// be in [0, 16]. The update is atomic. +func (d *VP8Decoder) SetPostProcessConfig(flags PostProcessFlag, deblockingLevel int, noiseLevel int) error { + if d.isClosed() { + return ErrClosed + } + next := d.opts + next.PostProcessFlags = flags + next.PostProcessDeblockingLevel = deblockingLevel + next.PostProcessDeblockingLevelSet = true + next.PostProcessNoiseLevel = noiseLevel + return d.setPostProcessOptions(next) +} + +func (d *VP8Decoder) setPostProcessOptions(next DecoderOptions) error { + if err := validateDecoderOptions(next); err != nil { + return err + } + if d.frameWidth > 0 && d.frameHeight > 0 { + flags := next.effectivePostProcessFlags() + if flags&PostProcessMFQE != 0 { + if err := d.postprocState.EnsureMFQE(d.frameWidth, d.frameHeight); err != nil { + return ErrInvalidConfig + } + } + if flags&PostProcessAddNoise != 0 && next.PostProcessNoiseLevel > 0 { + d.postprocState.EnsureNoise(d.frameWidth) + } + } + d.opts.PostProcessFlags = next.PostProcessFlags + d.opts.PostProcessDeblockingLevel = next.PostProcessDeblockingLevel + d.opts.PostProcessDeblockingLevelSet = next.PostProcessDeblockingLevelSet + d.opts.PostProcessNoiseLevel = next.PostProcessNoiseLevel + return nil +} + +// SetDecryptor changes the VP8D_SET_DECRYPTOR callback and opaque state used +// before parsing compressed bytes. Passing nil disables decryption. +func (d *VP8Decoder) SetDecryptor(decryptor VP8Decryptor, state any) error { + if d.isClosed() { + return ErrClosed + } + d.opts.Decryptor = decryptor + d.opts.DecryptorState = state + return nil +} + +// decryptPacket applies the registered Decryptor callback to packet, +// returning a plaintext slice for the bool-decoder pipeline. Mirrors +// libvpx's VP8D_SET_DECRYPTOR contract (vp8/vp8_dx_iface.c +// vp8_set_decryptor): the callback transforms encrypted compressed +// data into plaintext before parsing. govpx applies the callback once +// per Decode at packet entry rather than per boolean-decoder fill +// window — see the [VP8Decryptor] doc for the rationale. +// +// When no decryptor is configured this returns the input slice +// unchanged. The decrypted-buffer scratch lives on VP8Decoder so +// repeated Decode calls do not allocate on the hot path. +func (d *VP8Decoder) decryptPacket(packet []byte) []byte { + if d.opts.Decryptor == nil || len(packet) == 0 { + return packet + } + d.decryptedPacket = buffers.EnsureLen(d.decryptedPacket, len(packet)) + d.opts.Decryptor(d.opts.DecryptorState, packet, d.decryptedPacket, len(packet)) + return d.decryptedPacket +} + +// Decode decodes one raw VP8 frame payload. The first packet supplied to +// a fresh or reset decoder must be a key frame; otherwise +// [ErrNeedKeyFrame] is returned. +// +// Visible frames are queued for the next call to NextFrame. Hidden +// frames (such as alt-refs) update reference buffers but produce no +// NextFrame output. +func (d *VP8Decoder) Decode(packet []byte) error { + return d.DecodeWithPTS(packet, 0) +} + +// DecodeWithPTS is Decode with an explicit presentation timestamp. pts is +// echoed back through [VP8Decoder.LastFrameInfo]. +func (d *VP8Decoder) DecodeWithPTS(packet []byte, pts uint64) error { + if d.isClosed() { + return ErrClosed + } + packet = d.decryptPacket(packet) + frame, info, err := peekVP8FrameHeader(packet) + if err != nil { + if d.shouldConcealMissingFrameTag(packet) { + info := missingFrameConcealmentInfo() + frameInfo, err := d.concealMissingInterFrame(info, pts) + if err != nil { + return err + } + d.lifecycle = vp8DecoderActive + if frameInfo.ShowFrame { + output, err := d.outputReferenceFrameImage(info, &d.curBuf().Img) + if err != nil { + return err + } + d.lastFrame = publicImageFromVP8(output) + d.lifecycle = vp8DecoderFrameReady + } + return nil + } + return err + } + if d.lifecycle == vp8DecoderNeedKey && !info.KeyFrame { + return ErrNeedKeyFrame + } + if err := d.validateStreamInfo(info); err != nil { + return err + } + if err := d.decodeFramePacket(packet, frame, info); err != nil { + if d.opts.effectiveErrorConcealment() && d.canConceal(info) { + frameInfo := d.finishConcealedFrame(info, pts) + d.lifecycle = vp8DecoderActive + if frameInfo.ShowFrame { + output, err := d.outputReferenceFrameImage(info, &d.lastBuf().Img) + if err != nil { + return err + } + d.lastFrame = publicImageFromVP8(output) + d.lifecycle = vp8DecoderFrameReady + } + return nil + } + return err + } + + d.finishFrame(info, pts) + if !info.ShowFrame || d.frameSuppress { + d.lifecycle = vp8DecoderActive + return nil + } + output, err := d.outputFrameImage(info) + if err != nil { + return err + } + d.lastFrame = publicImageFromVP8(output) + d.lifecycle = vp8DecoderFrameReady + return nil +} + +// NextFrame returns the most recent visible decoded frame and consumes it. +// Subsequent calls return false until the next visible frame is decoded. +// The returned image aliases decoder-owned storage; that storage stays +// valid until the next Decode, Reset, or Close call. Copy the planes if +// they must outlive that boundary. +// +// Hidden VP8 frames (ShowFrame == false, including alt-refs) do not +// produce a NextFrame result; only their reference-buffer updates take +// effect. +func (d *VP8Decoder) NextFrame() (Image, bool) { + if d == nil || d.lifecycle != vp8DecoderFrameReady { + return Image{}, false + } + d.lifecycle = vp8DecoderActive + return d.lastFrame, true +} + +// LastFrameInfo returns metadata for the most recently decoded frame. ok +// is false on a nil or closed decoder, and before the first successful +// Decode/DecodeInto call. +func (d *VP8Decoder) LastFrameInfo() (FrameInfo, bool) { + if !d.isActive() { + return FrameInfo{}, false + } + return d.lastInfo, true +} + +// LastQuantizer returns the public 0..63 quantizer and internal VP8 qindex +// for the most recently decoded frame. Mirrors libvpx's +// VPXD_GET_LAST_QUANTIZER control (vp8/decoder/onyxd_if.c +// vp8dx_get_quantizer). ok is false on a nil or closed decoder, and before +// the first successful Decode/DecodeInto call. +func (d *VP8Decoder) LastQuantizer() (public int, internal int, ok bool) { + if !d.isActive() { + return 0, 0, false + } + return d.lastInfo.Quantizer, d.lastInfo.InternalQuantizer, true +} + +// LastFrameCorrupted reports whether the most recently decoded frame was +// flagged as corrupted by the decoder. Mirrors libvpx's +// VP8D_GET_FRAME_CORRUPTED control (vp8/vp8_dx_iface.c). ok is false on a +// nil or closed decoder, and before the first successful Decode/DecodeInto +// call. +func (d *VP8Decoder) LastFrameCorrupted() (corrupted bool, ok bool) { + if !d.isActive() { + return false, false + } + return d.lastInfo.Corrupted, true +} + +// LastReferenceUpdates reports which reference buffers the most recently +// decoded frame refreshed. Mirrors libvpx's VP8D_GET_LAST_REF_UPDATES +// control (vp8/vp8_dx_iface.c vp8_get_last_ref_updates). ok is false on a +// nil or closed decoder, and before the first successful Decode/DecodeInto +// call. +func (d *VP8Decoder) LastReferenceUpdates() (flags ReferenceFlags, ok bool) { + if !d.isActive() { + return 0, false + } + return d.lastInfo.RefUpdates, true +} + +// LastReferencesUsed reports which reference buffers were referenced by +// inter prediction in the most recently decoded frame. Mirrors libvpx's +// VP8D_GET_LAST_REF_USED control (vp8/vp8_dx_iface.c vp8_get_last_ref_frame, +// vp8/decoder/onyxd_if.c vp8dx_references_buffer). Key frames report 0. ok +// is false on a nil or closed decoder, and before the first successful +// Decode/DecodeInto call. +func (d *VP8Decoder) LastReferencesUsed() (flags ReferenceFlags, ok bool) { + if !d.isActive() { + return 0, false + } + return d.lastInfo.RefUsed, true +} + +// SetReferenceFrame replaces ref with src. ref must be ReferenceLast, +// ReferenceGolden, or ReferenceAltRef; src must match the stream dimensions +// established by the most recently decoded key frame and provide valid +// I420 strides. Returns [ErrInvalidConfig] when no key frame has been +// decoded yet or when dimensions or strides do not match. The decoder +// extends reference borders after copying. +func (d *VP8Decoder) SetReferenceFrame(ref ReferenceFrame, src Image) error { + if d.isClosed() { + return ErrClosed + } + if err := d.setReferenceFrameCheck(ref, src); err != nil { + return err + } + fb, ok := d.detachReferenceSlot(ref) + if !ok { + return ErrInvalidConfig + } + copyPublicImageToVP8(&fb.Img, src) + fb.ExtendBorders() + return nil +} + +func (d *VP8Decoder) setReferenceFrameCheck(ref ReferenceFrame, src Image) error { + if _, ok := d.referenceFrameBuffer(ref); !ok || !d.referenceFramesInitialized() { + return ErrInvalidConfig + } + if !src.ValidForEncode(d.frameWidth, d.frameHeight) { + return ErrInvalidConfig + } + return nil +} + +// CopyReferenceFrame copies ref into dst. ref must be ReferenceLast, +// ReferenceGolden, or ReferenceAltRef; dst must match the stream dimensions +// established by the most recently decoded key frame and provide valid +// I420 strides. Returns [ErrInvalidConfig] when no key frame has been +// decoded yet or when dimensions or strides do not match. +func (d *VP8Decoder) CopyReferenceFrame(ref ReferenceFrame, dst *Image) error { + if d.isClosed() { + return ErrClosed + } + if dst == nil { + return ErrInvalidConfig + } + fb, ok := d.referenceFrameBuffer(ref) + if !ok || !d.referenceFramesInitialized() { + return ErrInvalidConfig + } + if !dst.ValidForEncode(d.frameWidth, d.frameHeight) { + return ErrInvalidConfig + } + copyVP8ImageToPublic(dst, &fb.Img) + return nil +} + +// DecodeInto decodes one raw VP8 frame payload. If the packet is a visible +// frame its decoded pixels are written into the caller-owned planes of +// dst; for hidden frames dst is left untouched. dst must be non-nil and +// match the dimensions of the most recently decoded key frame (or of +// the packet itself, when it is a key frame). +func (d *VP8Decoder) DecodeInto(packet []byte, dst *Image) (FrameInfo, error) { + return d.DecodeIntoWithPTS(packet, dst, 0) +} + +// DecodeIntoWithPTS is DecodeInto with an explicit presentation timestamp. +// pts is echoed back in the returned FrameInfo. +func (d *VP8Decoder) DecodeIntoWithPTS(packet []byte, dst *Image, pts uint64) (FrameInfo, error) { + if d.isClosed() { + return FrameInfo{}, ErrClosed + } + if dst == nil { + return FrameInfo{}, ErrInvalidConfig + } + packet = d.decryptPacket(packet) + frame, info, err := peekVP8FrameHeader(packet) + if err != nil { + if d.shouldConcealMissingFrameTag(packet) { + info := missingFrameConcealmentInfo() + outputWidth, outputHeight := d.outputDimensions(info) + if !dst.ValidForEncode(outputWidth, outputHeight) { + return FrameInfo{}, ErrInvalidConfig + } + frameInfo, err := d.concealMissingInterFrame(info, pts) + if err != nil { + return FrameInfo{}, err + } + d.lifecycle = vp8DecoderActive + if frameInfo.ShowFrame { + output, err := d.outputReferenceFrameImage(info, &d.curBuf().Img) + if err != nil { + return FrameInfo{}, err + } + copyVP8ImageToPublic(dst, output) + } + return frameInfo, nil + } + return FrameInfo{}, err + } + if d.lifecycle == vp8DecoderNeedKey && !info.KeyFrame { + return FrameInfo{}, ErrNeedKeyFrame + } + if err := d.validateStreamInfo(info); err != nil { + return FrameInfo{}, err + } + outputWidth, outputHeight := d.outputDimensions(info) + if !dst.ValidForEncode(outputWidth, outputHeight) { + return FrameInfo{}, ErrInvalidConfig + } + if err := d.decodeFramePacket(packet, frame, info); err != nil { + if d.opts.effectiveErrorConcealment() && d.canConceal(info) { + frameInfo := d.finishConcealedFrame(info, pts) + d.lifecycle = vp8DecoderActive + if frameInfo.ShowFrame { + output, err := d.outputReferenceFrameImage(info, &d.lastBuf().Img) + if err != nil { + return FrameInfo{}, err + } + copyVP8ImageToPublic(dst, output) + } + return frameInfo, nil + } + return FrameInfo{}, err + } + frameInfo := d.finishFrame(info, pts) + d.lifecycle = vp8DecoderActive + if !info.ShowFrame || d.frameSuppress { + if d.frameSuppress { + // Mirror libvpx vp8/decoder/onyxd_if.c swap_frame_buffers + // err=-1 path: the frame is decoded but vp8_get_frame yields + // no image, so the public ShowFrame bit is cleared in the + // returned FrameInfo to signal callers that dst was not + // written. + frameInfo.ShowFrame = false + } + return frameInfo, nil + } + output, err := d.outputFrameImage(info) + if err != nil { + return FrameInfo{}, err + } + copyVP8ImageToPublic(dst, output) + return frameInfo, nil +} + +// Reset returns the decoder to its cold-start state while retaining +// allocated buffers and validated DecoderOptions for reuse. The next +// Decode must be a key frame; reference buffers, postprocess state, and +// queued NextFrame output are cleared. +func (d *VP8Decoder) Reset() { + if d == nil { + return + } + d.lifecycle = vp8DecoderNeedKey + d.lastFrame = Image{} + d.lastInfo = FrameInfo{} + d.currentPTS = 0 + d.visibleFrames = 0 + d.frameWidth = 0 + d.frameHeight = 0 + d.mbRows = 0 + d.mbCols = 0 + d.ecActive = false + d.frameCorrupt = false + d.frameSuppress = false + d.modesCorrupt = 0 + d.residualCorrupt = -1 + d.previousQuant = vp8dec.QuantHeader{} + d.previousLoopFilter = vp8dec.LoopFilterHeader{} + d.state = vp8dec.StateHeader{} + d.segmentationState = vp8dec.SegmentationHeader{} + d.frameHeader = vp8dec.FrameHeader{} + d.partitions = vp8dec.PartitionLayout{} + for i := range d.refPool { + d.refPool[i].Reset() + } + d.curIdx = 0 + d.lastIdx = 1 + d.goldenIdx = 2 + d.altIdx = 3 + d.post.Reset() + d.postprocState.Reset() + d.coefProbs = vp8tables.DefaultCoefProbs + d.frameCoefProbs = vp8tables.DefaultCoefProbs + for i := range d.segmentMap { + d.segmentMap[i] = 0 + } + for i := range d.prevModes { + d.prevModes[i] = vp8dec.MacroblockMode{} + } + vp8dec.ResetModeProbs(&d.modeProbs) + vp8dec.ResetModeProbs(&d.frameModeProbs) +} + +// Close releases decoder state. After Close, methods that return an +// error return [ErrClosed]; [VP8Decoder.NextFrame] and +// [VP8Decoder.LastFrameInfo] report not-ready instead. Calling Close on +// a nil or already-closed decoder returns [ErrClosed]. +func (d *VP8Decoder) Close() error { + if d.isClosed() { + return ErrClosed + } + if d.wavefront != nil { + d.wavefront.Close() + d.wavefront = nil + } + d.Reset() + d.lifecycle = vp8DecoderClosed + return nil +} + +func (d *VP8Decoder) decodeFramePacket(packet []byte, frame vp8dec.FrameHeader, info StreamInfo) error { + if d.lifecycle == vp8DecoderFrameReady { + // Invalidate any unconsumed NextFrame alias before mutating d.current. + d.lifecycle = vp8DecoderActive + } + errorConcealment := d.opts.effectiveErrorConcealment() && d.canConceal(info) + if errorConcealment { + d.ecActive = true + } + d.frameCorrupt = false + d.frameSuppress = false + d.modesCorrupt = 0 + d.residualCorrupt = -1 + if err := d.parseState(packet, frame, errorConcealment); err != nil { + return err + } + if err := d.ensureFrameBuffers(info); err != nil { + return err + } + d.selectFreeCurrentSlot() + if err := d.decodeModeGrid(info); err != nil { + return err + } + if errorConcealment && d.modesCorrupt < d.mbRows*d.mbCols { + d.ecOverlaps = buffers.EnsureLen(d.ecOverlaps, d.mbRows*d.mbCols) + if err := vp8dec.EstimateMissingMotionVectorsWithScratch(d.modes, d.prevModes, d.mbRows, d.mbCols, d.modesCorrupt, d.ecOverlaps); err != nil { + return ErrInvalidData + } + d.zeroCorruptMacroblockTokens(d.modesCorrupt) + vp8dec.ApplyCorruptInterFrameRefresh(&d.state) + d.frameCorrupt = true + } + if !d.frameCorrupt && !errorConcealment && d.opts.Threads >= 2 && d.mbRows > 1 { + if err := d.decodeAndReconstructWavefront(info); err != nil { + return err + } + d.saveErrorConcealmentModes() + d.frameSuppress = d.refreshReferences() + d.commitParsedState(info) + return nil + } + if d.frameCorrupt { + if d.modesCorrupt > 0 { + if err := d.decodeTokenGrid(errorConcealment); err != nil { + return err + } + } + d.zeroCorruptMacroblockTokens(d.modesCorrupt) + } else if err := d.decodeTokenGrid(errorConcealment); err != nil { + return err + } + if d.residualCorrupt >= 0 { + d.zeroCorruptMacroblockTokens(d.residualCorrupt) + } + if err := d.reconstructFrame(info); err != nil { + return err + } + d.saveErrorConcealmentModes() + d.frameSuppress = d.refreshReferences() + if !d.frameCorrupt { + d.commitParsedState(info) + } + return nil +} + +func validateDecoderOptions(opts DecoderOptions) error { + if opts.Threads < 0 { + return ErrInvalidConfig + } + if opts.PostProcessFlags&^allPostProcessFlags != 0 { + return ErrInvalidConfig + } + if min(opts.MaxWidth, opts.MaxHeight) < 0 { + return ErrInvalidConfig + } + if uint(opts.PostProcessNoiseLevel) > 16 { + return ErrInvalidConfig + } + if uint(opts.PostProcessDeblockingLevel) > 16 { + return ErrInvalidConfig + } + if opts.PostProcessNoiseLevel > 0 && opts.effectivePostProcessFlags()&PostProcessAddNoise == 0 { + return ErrInvalidConfig + } + if opts.MaxWidth > maxVP8Dimension || opts.MaxHeight > maxVP8Dimension { + return ErrInvalidConfig + } + return nil +} + +func (opts DecoderOptions) effectivePostProcessFlags() PostProcessFlag { + return opts.PostProcessFlags +} + +func (opts DecoderOptions) effectivePostProcessDeblockingLevel() int { + if opts.PostProcessDeblockingLevelSet || opts.PostProcessDeblockingLevel != 0 { + return opts.PostProcessDeblockingLevel + } + return vp8dec.DefaultPostProcessDeblockingLevel +} + +func (opts DecoderOptions) effectiveErrorConcealment() bool { + return opts.ErrorConcealment +} + +func missingFrameConcealmentInfo() StreamInfo { + return StreamInfo{ShowFrame: true} +} + +func (d *VP8Decoder) shouldConcealMissingFrameTag(packet []byte) bool { + return len(packet) < 3 && + d.opts.effectiveErrorConcealment() && + d.ecActive && + d.canConceal(missingFrameConcealmentInfo()) +} + +func (d *VP8Decoder) validateStreamInfo(info StreamInfo) error { + if !vp8dec.IsSupportedVersion(info.Profile) { + return ErrInvalidData + } + if !info.KeyFrame { + return nil + } + if min(info.Width, info.Height) <= 0 { + return ErrInvalidData + } + if d.opts.MaxWidth > 0 && info.Width > d.opts.MaxWidth { + return ErrFrameRejected + } + if d.opts.MaxHeight > 0 && info.Height > d.opts.MaxHeight { + return ErrFrameRejected + } + if d.isActive() && d.opts.RejectResolutionChange { + if info.Width != d.lastInfo.Width || info.Height != d.lastInfo.Height { + return ErrFrameRejected + } + } + return nil +} + +func (d *VP8Decoder) finishFrame(info StreamInfo, pts uint64) FrameInfo { + d.currentPTS = pts + d.lifecycle = vp8DecoderActive + width, height := d.outputDimensions(info) + frameInfo := FrameInfo{ + Width: width, + Height: height, + KeyFrame: info.KeyFrame, + ShowFrame: info.ShowFrame, + Corrupted: d.frameCorrupt, + Quantizer: vp8common.QIndexToPublicQuantizer(int(d.state.Quant.BaseQIndex)), + InternalQuantizer: int(d.state.Quant.BaseQIndex), + RefUpdates: referenceFlagsFromRefresh(d.state.Refresh), + RefUsed: d.referenceFlagsUsed(info), + PTS: pts, + } + d.lastInfo = frameInfo + if info.ShowFrame && !d.frameSuppress { + d.visibleFrames++ + } + return frameInfo +} + +func (d *VP8Decoder) canConceal(info StreamInfo) bool { + return d.isActive() && + !info.KeyFrame && + d.frameWidth > 0 && + d.frameHeight > 0 && + d.lastBuf().BufferLen() != 0 +} + +func (d *VP8Decoder) finishConcealedFrame(info StreamInfo, pts uint64) FrameInfo { + d.currentPTS = pts + frameInfo := FrameInfo{ + Width: d.frameWidth, + Height: d.frameHeight, + KeyFrame: false, + ShowFrame: info.ShowFrame, + Corrupted: true, + Quantizer: vp8common.QIndexToPublicQuantizer(int(d.previousQuant.BaseQIndex)), + InternalQuantizer: int(d.previousQuant.BaseQIndex), + RefUpdates: referenceFlagsFromRefresh(d.state.Refresh), + RefUsed: d.referenceFlagsUsed(info), + PTS: pts, + } + d.lastInfo = frameInfo + d.lifecycle = vp8DecoderActive + if info.ShowFrame { + d.visibleFrames++ + } + return frameInfo +} + +func referenceFlagsFromRefresh(refresh vp8dec.RefreshHeader) ReferenceFlags { + var flags ReferenceFlags + if refresh.RefreshLast { + flags |= ReferenceFlagLast + } + if refresh.RefreshGolden { + flags |= ReferenceFlagGolden + } + if refresh.RefreshAltRef { + flags |= ReferenceFlagAltRef + } + return flags +} + +func (d *VP8Decoder) referenceFlagsUsed(info StreamInfo) ReferenceFlags { + if info.KeyFrame { + return 0 + } + var flags ReferenceFlags + for i := 0; i < len(d.modes); i++ { + switch d.modes[i].RefFrame { + case vp8common.LastFrame: + flags |= ReferenceFlagLast + case vp8common.GoldenFrame: + flags |= ReferenceFlagGolden + case vp8common.AltRefFrame: + flags |= ReferenceFlagAltRef + } + } + return flags +} + +func (d *VP8Decoder) concealMissingInterFrame(info StreamInfo, pts uint64) (FrameInfo, error) { + d.state = vp8dec.StateHeader{} + d.state.Quant = d.previousQuant + d.state.Refresh.RefreshLast = true + d.frameHeader = vp8dec.FrameHeader{FrameType: vp8common.InterFrame, Profile: 0, ShowFrame: true} + for i := range d.tokens { + d.tokens[i] = vp8dec.MacroblockTokens{} + } + d.ecOverlaps = buffers.EnsureLen(d.ecOverlaps, d.mbRows*d.mbCols) + if err := vp8dec.EstimateMissingMotionVectorsWithScratch(d.modes, d.prevModes, d.mbRows, d.mbCols, 0, d.ecOverlaps); err != nil { + return FrameInfo{}, ErrInvalidData + } + d.selectFreeCurrentSlot() + if err := d.reconstructFrame(StreamInfo{Profile: 0}); err != nil { + return FrameInfo{}, err + } + d.lastIdx = d.curIdx + d.saveErrorConcealmentModes() + return d.finishConcealedFrame(info, pts), nil +} + +func (d *VP8Decoder) saveErrorConcealmentModes() { + if !d.opts.effectiveErrorConcealment() || len(d.prevModes) < len(d.modes) { + return + } + vp8dec.PrepareErrorConcealmentModes(d.modes) + copy(d.prevModes, d.modes) +} + +func (d *VP8Decoder) outputFrameImage(info StreamInfo) (*vp8common.Image, error) { + return d.outputReferenceFrameImage(info, &d.curBuf().Img) +} + +func (d *VP8Decoder) outputReferenceFrameImage(info StreamInfo, src *vp8common.Image) (*vp8common.Image, error) { + flags := d.opts.effectivePostProcessFlags() + if flags == 0 { + return src, nil + } + loopFilter := vp8dec.LoopFilterHeaderForVersion(info.Profile, d.state.LoopFilter) + opts := vp8dec.PostProcessOptions{ + Deblock: flags&PostProcessDeblock != 0, + Demacroblock: flags&PostProcessDemacroblock != 0, + MFQE: flags&PostProcessMFQE != 0, + AddNoise: flags&PostProcessAddNoise != 0 && d.opts.PostProcessNoiseLevel > 0, + DeblockingLevel: d.opts.effectivePostProcessDeblockingLevel(), + NoiseLevel: d.opts.PostProcessNoiseLevel, + BaseQIndex: int(d.state.Quant.BaseQIndex), + CurrentFrame: d.visibleFrames, + KeyFrame: info.KeyFrame, + } + if d.post.Img.Width != src.Width || d.post.Img.Height != src.Height || d.post.BufferLen() == 0 { + if err := d.post.Resize(src.Width, src.Height, 32, 32); err != nil { + return nil, ErrInvalidData + } + } + if err := vp8dec.ApplyPostProcessWithOptions(src, &d.post, d.mbRows, d.mbCols, d.modes, loopFilter.Level, d.postprocScratch, opts, &d.postprocState); err != nil { + return nil, ErrInvalidData + } + return &d.post.Img, nil +} + +func (d *VP8Decoder) outputDimensions(info StreamInfo) (int, int) { + if info.KeyFrame { + return info.Width, info.Height + } + return d.frameWidth, d.frameHeight +} + +func (d *VP8Decoder) ensureFrameBuffers(info StreamInfo) error { + if !info.KeyFrame { + return nil + } + if d.frameWidth == info.Width && d.frameHeight == info.Height && d.refPool[0].BufferLen() != 0 { + return nil + } + for i := range d.refPool { + if err := d.refPool[i].Resize(info.Width, info.Height, 32, 32); err != nil { + return ErrInvalidData + } + } + flags := d.opts.effectivePostProcessFlags() + if flags != 0 { + if err := d.post.Resize(info.Width, info.Height, 32, 32); err != nil { + return ErrInvalidData + } + } + if flags&PostProcessMFQE != 0 { + if err := d.postprocState.EnsureMFQE(info.Width, info.Height); err != nil { + return ErrInvalidData + } + } + d.ensureWorkspace(info.Width, info.Height) + d.frameWidth = info.Width + d.frameHeight = info.Height + return nil +} + +func (d *VP8Decoder) parseState(packet []byte, frameHeader vp8dec.FrameHeader, errorConcealment bool) error { + frameProbs := d.coefProbs + frameModeProbs := d.modeProbs + var frame vp8dec.FrameHeader + var state vp8dec.StateHeader + var modeReader boolcoder.Decoder + var err error + var stateCorrupted bool + if errorConcealment { + frame, state, modeReader, stateCorrupted, err = vp8dec.ParseStateHeaderFromFrameWithErrorConcealment(packet, frameHeader, d.previousQuant, d.previousLoopFilter, &frameProbs, &frameModeProbs) + } else { + frame, state, modeReader, err = vp8dec.ParseStateHeaderFromFrameWithReaderAndProbsAndLoopFilter(packet, frameHeader, d.previousQuant, d.previousLoopFilter, &frameProbs, &frameModeProbs) + } + if err != nil { + return ErrInvalidData + } + if errorConcealment && !frame.KeyFrame() && frame.HeaderSize <= len(packet) && frame.FirstPartitionSize > len(packet)-frame.HeaderSize { + stateCorrupted = true + } + if stateCorrupted { + if !frame.KeyFrame() { + vp8dec.ApplyCorruptInterFrameRefresh(&state) + } + d.frameCorrupt = true + d.modesCorrupt = 0 + } else { + d.modesCorrupt = d.mbRows * d.mbCols + } + previousSegmentation := d.segmentationState + if frame.KeyFrame() { + previousSegmentation = vp8dec.SegmentationHeader{} + } + state.Segmentation = vp8dec.MergeSegmentationHeader(previousSegmentation, state.Segmentation) + var partitions vp8dec.PartitionLayout + var partitionErr error + if errorConcealment { + partitionErr = vp8dec.ParsePartitionLayoutWithErrorConcealment(packet, frame, state.TokenPartition, &partitions) + } else { + partitionErr = vp8dec.ParsePartitionLayout(packet, frame, state.TokenPartition, &partitions) + } + if partitionErr != nil { + return ErrInvalidData + } + for i := 0; i < partitions.TokenCount; i++ { + if err := d.tokenReaders[i].Init(partitions.Tokens[i]); err != nil { + return ErrInvalidData + } + } + d.frameHeader = frame + d.state = state + d.partitions = partitions + d.modeReader = modeReader + d.frameCoefProbs = frameProbs + d.frameModeProbs = frameModeProbs + vp8dec.InitSegmentDequants(state.Quant, &state.Segmentation, &d.dequantTables, &d.dequants) + return nil +} + +func (d *VP8Decoder) commitParsedState(info StreamInfo) { + if d.state.Refresh.RefreshEntropyProbs { + d.coefProbs = d.frameCoefProbs + } else if info.KeyFrame { + d.coefProbs = vp8tables.DefaultCoefProbs + } + if d.state.Refresh.RefreshEntropyProbs { + d.modeProbs = d.frameModeProbs + } else if info.KeyFrame { + vp8dec.ResetModeProbs(&d.modeProbs) + } + d.previousQuant = d.state.Quant + d.previousLoopFilter = d.state.LoopFilter + if info.KeyFrame { + d.segmentationState = vp8dec.SegmentationHeader{} + } + if d.state.Segmentation.Enabled { + d.segmentationState = d.state.Segmentation + d.segmentationState.UpdateMap = false + d.segmentationState.UpdateData = false + } + d.commitSegmentMap() +} + +func (d *VP8Decoder) decodeModeGrid(info StreamInfo) error { + if info.KeyFrame { + d.clearSegmentMap() + } + d.restoreSegmentMap() + reader := d.modeReader + if info.KeyFrame { + if err := vp8dec.DecodeKeyFrameModeGrid(&reader, d.mbRows, d.mbCols, &d.state.Segmentation, d.state.Mode, d.modes); err != nil { + return ErrInvalidData + } + } else { + if d.opts.effectiveErrorConcealment() && d.ecActive { + firstCorrupt, err := vp8dec.DecodeInterModeGridWithErrorConcealment(&reader, d.mbRows, d.mbCols, &d.state.Segmentation, d.state.Mode, &d.frameModeProbs, d.referenceSignBias(), d.modes) + if err != nil { + return ErrInvalidData + } + if firstCorrupt < d.modesCorrupt { + d.modesCorrupt = firstCorrupt + d.frameCorrupt = true + } + } else { + if err := vp8dec.DecodeInterModeGrid(&reader, d.mbRows, d.mbCols, &d.state.Segmentation, d.state.Mode, &d.frameModeProbs, d.referenceSignBias(), d.modes); err != nil { + return ErrInvalidData + } + } + } + if reader.Err() != nil && !(d.opts.effectiveErrorConcealment() && d.ecActive && !info.KeyFrame) { + return ErrInvalidData + } + d.modeReader = reader + return nil +} + +func (d *VP8Decoder) referenceSignBias() [vp8common.MaxRefFrames]bool { + var signBias [vp8common.MaxRefFrames]bool + signBias[vp8common.GoldenFrame] = d.state.Refresh.GoldenSignBias + signBias[vp8common.AltRefFrame] = d.state.Refresh.AltRefSignBias + return signBias +} + +func (d *VP8Decoder) decodeTokenGrid(errorConcealment bool) error { + readers := d.tokenReaders[:d.partitions.TokenCount] + if errorConcealment { + firstCorrupt, err := d.decodeTokenGridWithErrorConcealment(readers) + if err != nil { + return err + } + if firstCorrupt < d.mbRows*d.mbCols { + d.frameCorrupt = true + if d.residualCorrupt < 0 || firstCorrupt < d.residualCorrupt { + d.residualCorrupt = firstCorrupt + } + } + return nil + } + if _, err := vp8dec.DecodeTokenGrid(readers, d.mbRows, d.mbCols, &d.frameCoefProbs, d.modes, d.tokenAbove, d.tokens); err != nil { + return ErrInvalidData + } + for i := range readers { + if readers[i].Err() != nil { + return ErrInvalidData + } + } + return nil +} + +func (d *VP8Decoder) decodeTokenGridWithErrorConcealment(readers []boolcoder.Decoder) (int, error) { + _, firstCorrupt, err := vp8dec.DecodeTokenGridWithErrorConcealment(readers, d.mbRows, d.mbCols, &d.frameCoefProbs, d.modes, d.tokenAbove, d.tokens) + if err != nil { + return 0, ErrInvalidData + } + return firstCorrupt, nil +} + +func (d *VP8Decoder) zeroCorruptMacroblockTokens(first int) { + if first < 0 { + first = 0 + } + if first > len(d.tokens) { + return + } + for i := first; i < len(d.tokens); i++ { + d.tokens[i] = vp8dec.MacroblockTokens{} + d.modes[i].MBSkipCoeff = true + } +} + +func (d *VP8Decoder) decodeAndReconstructWavefront(info StreamInfo) error { + if d.wavefront == nil { + d.wavefront = vp8dec.NewWavefrontPool(d.opts.Threads) + } + frameType := vp8common.KeyFrame + if !info.KeyFrame { + frameType = vp8common.InterFrame + } + cfg := vp8dec.InterPredictionConfigForVersion(info.Profile) + skipLoopFilter := vp8dec.VersionSkipsLoopFilter(info.Profile) + loopFilter := vp8dec.LoopFilterHeaderForVersion(info.Profile, d.state.LoopFilter) + readers := d.tokenReaders[:d.partitions.TokenCount] + cur := d.curBuf() + if err := d.wavefront.DecodeReconstructLoopFilterWavefront( + &cur.Img, &d.lastBuf().Img, &d.goldenBuf().Img, &d.altBuf().Img, + d.mbRows, d.mbCols, readers, &d.frameCoefProbs, d.modes, &d.dequants, cfg, + info.KeyFrame, + !skipLoopFilter, + frameType, loopFilter, d.state.Segmentation, &d.loopInfo, + ); err != nil { + return ErrInvalidData + } + for i := range readers { + if readers[i].Err() != nil { + return ErrInvalidData + } + } + cur.ExtendBorders() + return nil +} + +func (d *VP8Decoder) reconstructFrame(info StreamInfo) error { + frameType := vp8common.KeyFrame + if !info.KeyFrame { + frameType = vp8common.InterFrame + } + cfg := vp8dec.InterPredictionConfigForVersion(info.Profile) + skipLoopFilter := vp8dec.VersionSkipsLoopFilter(info.Profile) + loopFilter := vp8dec.LoopFilterHeaderForVersion(info.Profile, d.state.LoopFilter) + + // Threads >= 2 enables the libvpx-style two-stage row pipeline (recon + // producer / loop-filter consumer). The output is byte-identical to + // the serial path; see internal/vp8/decoder/threading.go for the + // dependency analysis. Tiny frames (rows <= 1) gain nothing from the + // pipeline so we keep the inline serial walk for them. + cur := d.curBuf() + if d.opts.Threads >= 2 && d.mbRows > 1 { + if err := vp8dec.ReconstructAndLoopFilterPipelined( + &cur.Img, &d.lastBuf().Img, &d.goldenBuf().Img, &d.altBuf().Img, + d.mbRows, d.mbCols, d.modes, d.tokens, &d.dequants, &d.reconstructScratch, cfg, + info.KeyFrame, + !skipLoopFilter, + frameType, loopFilter, d.state.Segmentation, &d.loopInfo, + ); err != nil { + return ErrInvalidData + } + cur.ExtendBorders() + return nil + } + + if info.KeyFrame { + if err := vp8dec.ReconstructKeyFrameIntraGrid(&cur.Img, d.mbRows, d.mbCols, d.modes, d.tokens, &d.dequants, &d.reconstructScratch); err != nil { + return ErrInvalidData + } + } else { + if err := vp8dec.ReconstructInterFrameGridWithConfig(&cur.Img, &d.lastBuf().Img, &d.goldenBuf().Img, &d.altBuf().Img, d.mbRows, d.mbCols, d.modes, d.tokens, &d.dequants, &d.reconstructScratch, cfg); err != nil { + return ErrInvalidData + } + } + if !skipLoopFilter { + vp8dec.ApplyLoopFilterUnchecked(&cur.Img, d.mbRows, d.mbCols, d.modes, frameType, loopFilter, d.state.Segmentation, &d.loopInfo) + } + cur.ExtendBorders() + return nil +} + +// refreshReferences applies the per-frame reference buffer copy/refresh +// flags parsed from the inter-frame header using zero-copy reference pool +// index swaps (mirroring libvpx's swap_frame_buffers). +func (d *VP8Decoder) refreshReferences() bool { + suppress := false + switch d.state.Refresh.CopyBufferToAltRef { + case 1: + d.altIdx = d.lastIdx + case 2: + d.altIdx = d.goldenIdx + case 3: + suppress = true + } + switch d.state.Refresh.CopyBufferToGolden { + case 1: + d.goldenIdx = d.lastIdx + case 2: + d.goldenIdx = d.altIdx + case 3: + suppress = true + } + if d.state.Refresh.RefreshLast { + d.lastIdx = d.curIdx + } + if d.state.Refresh.RefreshGolden { + d.goldenIdx = d.curIdx + } + if d.state.Refresh.RefreshAltRef { + d.altIdx = d.curIdx + } + return suppress +} + +// referenceFrameBuffer maps the public reference selector to the decoder-owned +// bordered buffer. Invalid selectors include combined ReferenceFlags values. +func (d *VP8Decoder) referenceFrameBuffer(ref ReferenceFrame) (*vp8common.FrameBuffer, bool) { + switch ref { + case ReferenceLast: + return d.lastBuf(), true + case ReferenceGolden: + return d.goldenBuf(), true + case ReferenceAltRef: + return d.altBuf(), true + default: + return nil, false + } +} + +// referenceFramesInitialized reports whether set/copy reference controls can +// safely use the reference buffers. govpx requires a decoded key frame to +// establish stream dimensions before callers can replace decoder references. +func (d *VP8Decoder) referenceFramesInitialized() bool { + return d.isActive() && + d.frameWidth > 0 && + d.frameHeight > 0 && + d.lastBuf().BufferLen() != 0 +} + +func copyVP8ImageToPublic(dst *Image, src *vp8common.Image) { + buffers.CopyPlane(dst.Y, dst.YStride, src.Y, src.YStride, src.Width, src.Height) + uvWidth := (src.Width + 1) >> 1 + uvHeight := (src.Height + 1) >> 1 + buffers.CopyPlane(dst.U, dst.UStride, src.U, src.UStride, uvWidth, uvHeight) + buffers.CopyPlane(dst.V, dst.VStride, src.V, src.VStride, uvWidth, uvHeight) +} + +// copyPublicImageToVP8 copies only visible samples into a bordered VP8 image; +// callers that install a reference must extend borders afterwards. +func copyPublicImageToVP8(dst *vp8common.Image, src Image) { + buffers.CopyPlane(dst.Y, dst.YStride, src.Y, src.YStride, dst.Width, dst.Height) + uvWidth := (dst.Width + 1) >> 1 + uvHeight := (dst.Height + 1) >> 1 + buffers.CopyPlane(dst.U, dst.UStride, src.U, src.UStride, uvWidth, uvHeight) + buffers.CopyPlane(dst.V, dst.VStride, src.V, src.VStride, uvWidth, uvHeight) +} + +func (d *VP8Decoder) ensureWorkspace(width int, height int) { + cols := (width + 15) >> 4 + rows := (height + 15) >> 4 + count := rows * cols + d.modes = buffers.EnsureLen(d.modes, count) + if d.opts.ErrorConcealment { + d.prevModes = buffers.EnsureLen(d.prevModes, count) + d.ecOverlaps = buffers.EnsureLen(d.ecOverlaps, count) + } + d.tokens = buffers.EnsureLen(d.tokens, count) + d.tokenAbove = buffers.EnsureLen(d.tokenAbove, cols) + d.segmentMap = buffers.EnsureLen(d.segmentMap, count) + scratchLen := cols * 24 + d.postprocScratch = buffers.EnsureLen(d.postprocScratch, scratchLen) + flags := d.opts.effectivePostProcessFlags() + if flags&PostProcessAddNoise != 0 && d.opts.PostProcessNoiseLevel > 0 { + d.postprocState.EnsureNoise(width) + } + d.mbRows = rows + d.mbCols = cols +} + +func (d *VP8Decoder) restoreSegmentMap() { + if !d.state.Segmentation.Enabled || d.state.Segmentation.UpdateMap { + return + } + for i := range d.modes { + d.modes[i].SegmentID = d.segmentMap[i] + } +} + +func (d *VP8Decoder) commitSegmentMap() { + if !d.state.Segmentation.Enabled { + return + } + for i := range d.modes { + d.segmentMap[i] = d.modes[i].SegmentID + } +} + +func (d *VP8Decoder) clearSegmentMap() { + for i := range d.segmentMap { + d.segmentMap[i] = 0 + } +} diff --git a/internal/vp8/codec/vp8_rtp.go b/internal/vp8/codec/vp8_rtp.go new file mode 100644 index 0000000..8a67bdd --- /dev/null +++ b/internal/vp8/codec/vp8_rtp.go @@ -0,0 +1,69 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/codec/vp8_rtp.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// VP8 codec implementation aligned with libvpx v1.16.0. +package codec + +import ( + vp8rtp "github.com/go-avkit/vpx/internal/vp8/rtp" +) + +// AssembleVP8RTPFrameInto writes the raw VP8 frame carried by payloads into +// dst and returns the frame length. On [ErrBufferTooSmall], the returned +// length is the required capacity. +func AssembleVP8RTPFrameInto(dst []byte, payloads []RTPPayloadFragment) (int, error) { + return vp8rtp.AssembleFrameInto(dst, payloads) +} + +// AssembleVP8RTPFrame returns the raw VP8 frame carried by an ordered set of +// RTP payload bodies. +func AssembleVP8RTPFrame(payloads []RTPPayloadFragment) ([]byte, error) { + return vp8rtp.AssembleFrame(payloads) +} + +// DecodeRTP assembles one ordered set of VP8 RTP payload bodies and decodes +// the resulting raw VP8 frame. The decoded image is returned by NextFrame when +// the frame is visible. +func (d *VP8Decoder) DecodeRTP(payloads []RTPPayloadFragment) error { + return d.DecodeRTPWithPTS(payloads, 0) +} + +// DecodeRTPWithPTS is DecodeRTP with an explicit presentation timestamp. +func (d *VP8Decoder) DecodeRTPWithPTS(payloads []RTPPayloadFragment, pts uint64) error { + if d.isClosed() { + return ErrClosed + } + frame, err := AssembleVP8RTPFrame(payloads) + if err != nil { + return err + } + return d.DecodeWithPTS(frame, pts) +} + +// DecodeRTPInto assembles one ordered set of VP8 RTP payload bodies into +// frameBuf and decodes the resulting raw VP8 frame. On ErrBufferTooSmall, the +// returned integer is the required frameBuf capacity. The decoded image is +// returned by NextFrame when the frame is visible. +func (d *VP8Decoder) DecodeRTPInto(frameBuf []byte, payloads []RTPPayloadFragment) (int, error) { + return d.DecodeRTPIntoWithPTS(frameBuf, payloads, 0) +} + +// DecodeRTPIntoWithPTS is DecodeRTPInto with an explicit presentation +// timestamp. +func (d *VP8Decoder) DecodeRTPIntoWithPTS(frameBuf []byte, payloads []RTPPayloadFragment, pts uint64) (int, error) { + if d.isClosed() { + return 0, ErrClosed + } + n, err := AssembleVP8RTPFrameInto(frameBuf, payloads) + if err != nil { + return n, err + } + return n, d.DecodeWithPTS(frameBuf[:n], pts) +} diff --git a/internal/vp8/common/border.go b/internal/vp8/common/border.go new file mode 100644 index 0000000..1a087a0 --- /dev/null +++ b/internal/vp8/common/border.go @@ -0,0 +1,190 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/border.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +import ( + "encoding/binary" +) + +// Ported from libvpx v1.16.0 vpx_scale/generic/yv12extend.c. + +// ExtendBorders replicates coded edge samples into the frame border. +func (fb *FrameBuffer) ExtendBorders() { + if fb == nil { + return + } + extendPlane( + fb.buf[fb.yPlaneOff:fb.uPlaneOff], + fb.Img.YStride, + fb.Img.CodedWidth, + fb.Img.CodedHeight, + fb.border, + fb.border, + fb.border, + fb.border, + ) + + uvBorder := (fb.border + 1) >> 1 + codedUVWidth := (fb.Img.CodedWidth + 1) >> 1 + codedUVHeight := (fb.Img.CodedHeight + 1) >> 1 + extendPlane( + fb.buf[fb.uPlaneOff:fb.vPlaneOff], + fb.Img.UStride, + codedUVWidth, + codedUVHeight, + uvBorder, + uvBorder, + uvBorder, + uvBorder, + ) + extendPlane( + fb.buf[fb.vPlaneOff:], + fb.Img.VStride, + codedUVWidth, + codedUVHeight, + uvBorder, + uvBorder, + uvBorder, + uvBorder, + ) +} + +func extendPlane(plane []byte, stride int, width int, height int, left int, right int, top int, bottom int) { + if width <= 0 || height <= 0 { + return + } + + for y := range height { + row := plane[(top+y)*stride:] + first := row[left] + last := row[left+width-1] + if left > 0 { + fillPlaneBorder(row[:left], first) + } + if right > 0 { + fillPlaneBorder(row[left+width:left+width+right], last) + } + } + + rowWidth := left + width + right + firstRow := plane[top*stride : top*stride+rowWidth] + for y := range top { + copy(plane[y*stride:y*stride+rowWidth], firstRow) + } + + lastRowStart := (top + height - 1) * stride + lastRow := plane[lastRowStart : lastRowStart+rowWidth] + for y := range bottom { + dstStart := (top + height + y) * stride + copy(plane[dstStart:dstStart+rowWidth], lastRow) + } +} + +func fillPlaneBorder(buf []byte, value byte) { + switch len(buf) { + case 16: + _ = buf[15] + word := uint64(value) * 0x0101010101010101 + binary.LittleEndian.PutUint64(buf[0:8], word) + binary.LittleEndian.PutUint64(buf[8:16], word) + case 32: + _ = buf[31] + word := uint64(value) * 0x0101010101010101 + binary.LittleEndian.PutUint64(buf[0:8], word) + binary.LittleEndian.PutUint64(buf[8:16], word) + binary.LittleEndian.PutUint64(buf[16:24], word) + binary.LittleEndian.PutUint64(buf[24:32], word) + default: + buf[0] = value + for n := 1; n < len(buf); n *= 2 { + copy(buf[n:], buf[:n]) + } + } +} + +// Ported from libvpx v1.16.0 vpx_scale/generic/yv12extend.c +// (vp8_yv12_extend_frame_borders_c). + +// ExtendBordersFromVisible matches libvpx vp8_yv12_extend_frame_borders_c +// which extends from `y_crop_width` / `y_crop_height` rather than the +// 16-aligned coded dimensions. The coded-but-padded region between the +// visible edge and the 16-aligned coded edge is OVERWRITTEN with the +// last visible sample, and the border on top of that carries the same +// visible-edge value. +// +// This matches the post-loop-filter `vp8_yv12_extend_frame_borders` +// state libvpx writes onto cm->frame_to_show (vp8/encoder/onyx_if.c +// line ~3212) before the reference rotation. Inter prediction taps on +// the padded right column / bottom row of a reference see the +// visible-edge value instead of the raw reconstruction sample. +// +// Currently exposed as a separate entry point (not wired into the +// reference rotation) because a global swap to this behavior interacts +// with the per-MB picker's reference reads in ways that surface +// regressions on previously-passing odd-axis fixtures (see +// TestVP8OracleEncoderStreamByteParity 17x33/33x17 baselines). The helper +// stays in place so the localization of the libvpx-faithful behavior is +// preserved and can be wired in once the picker-side interaction is +// understood and fixed. +// +// On 16-aligned frames Visible == Coded and this collapses to the same +// result as ExtendBorders. +func (fb *FrameBuffer) ExtendBordersFromVisible() { + if fb == nil { + return + } + visibleWidth := fb.Img.Width + visibleHeight := fb.Img.Height + if visibleWidth <= 0 || visibleHeight <= 0 { + fb.ExtendBorders() + return + } + rightExt := fb.border + (fb.Img.CodedWidth - visibleWidth) + bottomExt := fb.border + (fb.Img.CodedHeight - visibleHeight) + extendPlane( + fb.buf[fb.yPlaneOff:fb.uPlaneOff], + fb.Img.YStride, + visibleWidth, + visibleHeight, + fb.border, + rightExt, + fb.border, + bottomExt, + ) + + uvBorder := (fb.border + 1) >> 1 + codedUVWidth := (fb.Img.CodedWidth + 1) >> 1 + codedUVHeight := (fb.Img.CodedHeight + 1) >> 1 + visibleUVWidth := (visibleWidth + 1) >> 1 + visibleUVHeight := (visibleHeight + 1) >> 1 + uvRightExt := uvBorder + (codedUVWidth - visibleUVWidth) + uvBottomExt := uvBorder + (codedUVHeight - visibleUVHeight) + extendPlane( + fb.buf[fb.uPlaneOff:fb.vPlaneOff], + fb.Img.UStride, + visibleUVWidth, + visibleUVHeight, + uvBorder, + uvRightExt, + uvBorder, + uvBottomExt, + ) + extendPlane( + fb.buf[fb.vPlaneOff:], + fb.Img.VStride, + visibleUVWidth, + visibleUVHeight, + uvBorder, + uvRightExt, + uvBorder, + uvBottomExt, + ) +} diff --git a/internal/vp8/common/constants.go b/internal/vp8/common/constants.go new file mode 100644 index 0000000..c74f6b2 --- /dev/null +++ b/internal/vp8/common/constants.go @@ -0,0 +1,37 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/constants.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +const ( + DCPredSimThresh = 0 + DCPredCntThresh = 3 + + MBFeatureTreeProbs = 3 + MaxMBSegments = 4 + + MaxRefLFDeltas = 4 + MaxModeLFDeltas = 4 + + SegmentDeltaData = 0 + SegmentAbsData = 1 + + SegmentAltQ = 0x01 + SegmentAltLF = 0x02 +) + +const ( + MinQ = 0 + MaxQ = 127 + QIndexRange = MaxQ + 1 + + NumYV12Buffers = 4 + MaxPartitions = 9 +) diff --git a/internal/vp8/common/enums.go b/internal/vp8/common/enums.go new file mode 100644 index 0000000..acc89a7 --- /dev/null +++ b/internal/vp8/common/enums.go @@ -0,0 +1,83 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/enums.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +type FrameType uint8 + +const ( + KeyFrame FrameType = iota + InterFrame +) + +type MBPredictionMode uint8 + +const ( + DCPred MBPredictionMode = iota + VPred + HPred + TMPred + BPred + NearestMV + NearMV + ZeroMV + NewMV + SplitMV + MBModeCount +) + +type MBLvlFeature uint8 + +const ( + MBLvlAltQ MBLvlFeature = iota + MBLvlAltLF + MBLvlMax +) + +type BPredictionMode uint8 + +const ( + BDCPred BPredictionMode = iota + BTMPred + BVEPred + BHEPred + BLDPred + BRDPred + BVRPred + BVLPred + BHDPred + BHUPred + Left4x4 + Above4x4 + Zero4x4 + New4x4 + BModeCount +) + +type MVReferenceFrame uint8 + +const ( + IntraFrame MVReferenceFrame = iota + LastFrame + GoldenFrame + AltRefFrame + MaxRefFrames +) + +type TokenPartition uint8 + +const ( + OnePartition TokenPartition = iota + TwoPartition + FourPartition + EightPartition +) + +type ClampType uint8 diff --git a/internal/vp8/common/errors.go b/internal/vp8/common/errors.go new file mode 100644 index 0000000..a389020 --- /dev/null +++ b/internal/vp8/common/errors.go @@ -0,0 +1,18 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/errors.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +import "errors" + +// Stable Go errors for VP8 frame validation modeled on libvpx v1.16.0 +// vp8/common/alloccommon.c frame-size checks. + +var ErrInvalidFrameSize = errors.New("govpx: invalid VP8 frame size") diff --git a/internal/vp8/common/frame.go b/internal/vp8/common/frame.go new file mode 100644 index 0000000..278503a --- /dev/null +++ b/internal/vp8/common/frame.go @@ -0,0 +1,205 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/frame.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +import ( + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +// Image is the internal planar 8-bit 4:2:0 image view used by VP8 frame +// buffers. Width and Height are visible dimensions; CodedWidth and CodedHeight +// cover the macroblock-padded reconstruction area. +type Image struct { + Y []byte + U []byte + V []byte + YFull []byte + UFull []byte + VFull []byte + Width int + Height int + CodedWidth int + CodedHeight int + YStride int + UStride int + VStride int + YOrigin int + UOrigin int + VOrigin int + YBorder int + UVBorder int +} + +// FrameBuffer owns one bordered VP8 frame. Allocation happens in NewFrameBuffer +// or Resize; per-frame reuse and border extension do not allocate. +type FrameBuffer struct { + buf []byte + Img Image + yPlaneOff int + uPlaneOff int + vPlaneOff int + yOff int + uOff int + vOff int + yRows int + uRows int + vRows int + border int + align int +} + +func (fb *FrameBuffer) Resize(width int, height int, border int, align int) error { + layout, err := computeLayout(width, height, border, align) + if err != nil { + return err + } + if cap(fb.buf) < layout.total || fb.align != layout.align { + fb.buf = buffers.NewAligned(layout.total, layout.align) + } else { + fb.buf = fb.buf[:layout.total] + } + + fb.yPlaneOff = layout.yPlaneOff + fb.uPlaneOff = layout.uPlaneOff + fb.vPlaneOff = layout.vPlaneOff + fb.yOff = layout.yOff + fb.uOff = layout.uOff + fb.vOff = layout.vOff + fb.yRows = layout.yRows + fb.uRows = layout.uRows + fb.vRows = layout.vRows + fb.border = border + fb.align = layout.align + + fb.Img.Width = width + fb.Img.Height = height + fb.Img.CodedWidth = layout.codedWidth + fb.Img.CodedHeight = layout.codedHeight + fb.Img.YStride = layout.yStride + fb.Img.UStride = layout.uStride + fb.Img.VStride = layout.vStride + fb.Img.YFull = fb.buf[layout.yPlaneOff:layout.uPlaneOff] + fb.Img.UFull = fb.buf[layout.uPlaneOff:layout.vPlaneOff] + fb.Img.VFull = fb.buf[layout.vPlaneOff:] + fb.Img.YOrigin = layout.yOff + fb.Img.UOrigin = layout.uOff + fb.Img.VOrigin = layout.vOff + fb.Img.YBorder = border + fb.Img.UVBorder = layout.uvBorder + yLen := buffers.PlaneLen(layout.yStride, layout.codedHeight, layout.codedWidth) + uLen := buffers.PlaneLen(layout.uStride, layout.uvHeight, layout.uvWidth) + vLen := buffers.PlaneLen(layout.vStride, layout.uvHeight, layout.uvWidth) + fb.Img.Y = fb.buf[layout.yPlaneOff+layout.yOff : layout.yPlaneOff+layout.yOff+yLen] + fb.Img.U = fb.buf[layout.uPlaneOff+layout.uOff : layout.uPlaneOff+layout.uOff+uLen] + fb.Img.V = fb.buf[layout.vPlaneOff+layout.vOff : layout.vPlaneOff+layout.vOff+vLen] + return nil +} + +func (fb *FrameBuffer) Reset() { + if fb == nil { + return + } + for i := range fb.buf { + fb.buf[i] = 0 + } +} + +func (fb *FrameBuffer) BufferLen() int { + if fb == nil { + return 0 + } + return len(fb.buf) +} + +func (fb *FrameBuffer) Border() int { + if fb == nil { + return 0 + } + return fb.border +} + +type frameLayout struct { + yStride int + uStride int + vStride int + + codedWidth int + codedHeight int + uvWidth int + uvHeight int + uvBorder int + + yRows int + uRows int + vRows int + + yPlaneOff int + uPlaneOff int + vPlaneOff int + + yOff int + uOff int + vOff int + + total int + align int +} + +func computeLayout(width int, height int, border int, align int) (frameLayout, error) { + if width <= 0 || height <= 0 || width > maxFrameDimension || height > maxFrameDimension || border < 0 { + return frameLayout{}, ErrInvalidFrameSize + } + if align <= 0 { + align = 1 + } + codedWidth := buffers.RoundUp(width, 16) + codedHeight := buffers.RoundUp(height, 16) + uvWidth := (codedWidth + 1) >> 1 + uvHeight := (codedHeight + 1) >> 1 + uvBorder := (border + 1) >> 1 + + yStride := buffers.RoundUp(codedWidth+border*2, align) + uStride := buffers.RoundUp(uvWidth+uvBorder*2, align) + vStride := uStride + yRows := codedHeight + border*2 + uRows := uvHeight + uvBorder*2 + vRows := uRows + + yPlaneSize := yStride * yRows + uPlaneSize := uStride * uRows + vPlaneSize := vStride * vRows + uPlaneOff := yPlaneSize + vPlaneOff := uPlaneOff + uPlaneSize + total := vPlaneOff + vPlaneSize + + return frameLayout{ + yStride: yStride, + uStride: uStride, + vStride: vStride, + codedWidth: codedWidth, + codedHeight: codedHeight, + uvWidth: uvWidth, + uvHeight: uvHeight, + uvBorder: uvBorder, + yRows: yRows, + uRows: uRows, + vRows: vRows, + uPlaneOff: uPlaneOff, + vPlaneOff: vPlaneOff, + yOff: border*yStride + border, + uOff: uvBorder*uStride + uvBorder, + vOff: uvBorder*vStride + uvBorder, + total: total, + align: align, + }, nil +} + +const maxFrameDimension = 16383 diff --git a/internal/vp8/common/loopfilter.go b/internal/vp8/common/loopfilter.go new file mode 100644 index 0000000..dc608b6 --- /dev/null +++ b/internal/vp8/common/loopfilter.go @@ -0,0 +1,154 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/loopfilter.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +// Ported from libvpx v1.16.0 vp8/common/loopfilter.h and +// vp8/common/vp8_loopfilter.c. + +const ( + MaxLoopFilter = 63 + PartialFrameFraction = 8 +) + +type LoopFilterInfo struct { + MBLimit [MaxLoopFilter + 1]byte + BLimit [MaxLoopFilter + 1]byte + Limit [MaxLoopFilter + 1]byte + + HEVThresh [4]byte + HEVThreshLUT [2][MaxLoopFilter + 1]byte + ModeLFLUT [MBModeCount]byte + + Level [MaxMBSegments][MaxRefFrames][MaxModeLFDeltas]byte + SharpnessLevel byte +} + +type LoopFilterFrameConfig struct { + SegmentationEnabled bool + SegmentAbsDelta bool + SegmentLF [MaxMBSegments]int8 + + ModeRefDeltaEnabled bool + RefDeltas [MaxRefLFDeltas]int8 + ModeDeltas [MaxModeLFDeltas]int8 +} + +func InitLoopFilterInfo(lfi *LoopFilterInfo, sharpnessLevel int) { + UpdateLoopFilterSharpness(lfi, sharpnessLevel) + initLoopFilterLUT(lfi) + for i := range 4 { + lfi.HEVThresh[i] = byte(i) + } +} + +func UpdateLoopFilterSharpness(lfi *LoopFilterInfo, sharpnessLevel int) { + sharpness := clampInt(sharpnessLevel, 0, 7) + for level := 0; level <= MaxLoopFilter; level++ { + blockInsideLimit := level + if sharpness > 0 { + blockInsideLimit >>= 1 + } + if sharpness > 4 { + blockInsideLimit >>= 1 + } + if sharpness > 0 && blockInsideLimit > 9-sharpness { + blockInsideLimit = 9 - sharpness + } + if blockInsideLimit < 1 { + blockInsideLimit = 1 + } + + lfi.Limit[level] = byte(blockInsideLimit) + lfi.BLimit[level] = byte(2*level + blockInsideLimit) + lfi.MBLimit[level] = byte(2*(level+2) + blockInsideLimit) + } + lfi.SharpnessLevel = byte(sharpness) +} + +func InitLoopFilterFrame(lfi *LoopFilterInfo, defaultFilterLevel int, cfg LoopFilterFrameConfig) { + for seg := range MaxMBSegments { + levelSeg := defaultFilterLevel + if cfg.SegmentationEnabled { + if cfg.SegmentAbsDelta { + levelSeg = int(cfg.SegmentLF[seg]) + } else { + levelSeg += int(cfg.SegmentLF[seg]) + } + levelSeg = clampLoopFilterLevel(levelSeg) + } + + if !cfg.ModeRefDeltaEnabled { + level := byte(clampLoopFilterLevel(levelSeg)) + for ref := range int(MaxRefFrames) { + for mode := range MaxModeLFDeltas { + lfi.Level[seg][ref][mode] = level + } + } + continue + } + + for ref := range int(MaxRefFrames) { + for mode := range MaxModeLFDeltas { + lfi.Level[seg][ref][mode] = 0 + } + } + + levelRef := levelSeg + int(cfg.RefDeltas[IntraFrame]) + levelMode := levelRef + int(cfg.ModeDeltas[0]) + lfi.Level[seg][IntraFrame][0] = byte(clampLoopFilterLevel(levelMode)) + lfi.Level[seg][IntraFrame][1] = byte(clampLoopFilterLevel(levelRef)) + + for ref := LastFrame; ref < MaxRefFrames; ref++ { + levelRef = levelSeg + int(cfg.RefDeltas[ref]) + for mode := 1; mode < MaxModeLFDeltas; mode++ { + levelMode = levelRef + int(cfg.ModeDeltas[mode]) + lfi.Level[seg][ref][mode] = byte(clampLoopFilterLevel(levelMode)) + } + } + } +} + +func initLoopFilterLUT(lfi *LoopFilterInfo) { + for level := 0; level <= MaxLoopFilter; level++ { + if level >= 40 { + lfi.HEVThreshLUT[KeyFrame][level] = 2 + lfi.HEVThreshLUT[InterFrame][level] = 3 + } else if level >= 20 { + lfi.HEVThreshLUT[KeyFrame][level] = 1 + lfi.HEVThreshLUT[InterFrame][level] = 2 + } else if level >= 15 { + lfi.HEVThreshLUT[KeyFrame][level] = 1 + lfi.HEVThreshLUT[InterFrame][level] = 1 + } else { + lfi.HEVThreshLUT[KeyFrame][level] = 0 + lfi.HEVThreshLUT[InterFrame][level] = 0 + } + } + + lfi.ModeLFLUT[DCPred] = 1 + lfi.ModeLFLUT[VPred] = 1 + lfi.ModeLFLUT[HPred] = 1 + lfi.ModeLFLUT[TMPred] = 1 + lfi.ModeLFLUT[BPred] = 0 + lfi.ModeLFLUT[ZeroMV] = 1 + lfi.ModeLFLUT[NearestMV] = 2 + lfi.ModeLFLUT[NearMV] = 2 + lfi.ModeLFLUT[NewMV] = 2 + lfi.ModeLFLUT[SplitMV] = 3 +} + +func clampLoopFilterLevel(level int) int { + return min(max(level, 0), MaxLoopFilter) +} + +func clampInt(v int, low int, high int) int { + return min(max(v, low), high) +} diff --git a/internal/vp8/common/mode_helpers.go b/internal/vp8/common/mode_helpers.go new file mode 100644 index 0000000..a29bd43 --- /dev/null +++ b/internal/vp8/common/mode_helpers.go @@ -0,0 +1,37 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/mode_helpers.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +// BlockModeFromMacroblockMode maps VP8 macroblock prediction modes to the +// block-prediction mode used by neighboring B_PRED context lookups. +func BlockModeFromMacroblockMode(mode MBPredictionMode) BPredictionMode { + switch mode { + case VPred: + return BVEPred + case HPred: + return BHEPred + case TMPred: + return BTMPred + default: + return BDCPred + } +} + +// IsWholeInterMacroblockMode reports whether mode predicts the whole +// macroblock with one inter vector rather than SPLITMV sub-block vectors. +func IsWholeInterMacroblockMode(mode MBPredictionMode) bool { + switch mode { + case ZeroMV, NearestMV, NearMV, NewMV: + return true + default: + return false + } +} diff --git a/internal/vp8/common/quant.go b/internal/vp8/common/quant.go new file mode 100644 index 0000000..f01b4f8 --- /dev/null +++ b/internal/vp8/common/quant.go @@ -0,0 +1,136 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/common/quant.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +var dcQLookup = [QIndexRange]int16{ + 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, + 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 91, 93, 95, 96, 98, 100, 101, 102, 104, + 106, 108, 110, 112, 114, 116, 118, 122, 124, 126, 128, 130, 132, 134, 136, + 138, 140, 143, 145, 148, 151, 154, 157, +} + +var acQLookup = [QIndexRange]int16{ + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 62, 64, 66, 68, + 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, + 100, 102, 104, 106, 108, 110, 112, 114, 116, 119, 122, 125, 128, 131, 134, + 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, 167, 170, 173, 177, 181, + 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 234, 239, 245, + 249, 254, 259, 264, 269, 274, 279, 284, +} + +const maxPublicQuantizer = 63 + +var publicQuantizerToQIndex = [maxPublicQuantizer + 1]int{ + 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, + 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, + 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 64, 67, 70, 73, 76, 79, + 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, +} + +type QuantDeltas struct { + Y1DC int + Y2DC int + Y2AC int + UVDC int + UVAC int +} + +type FrameDequantTables struct { + Y1 [QIndexRange][2]int16 + Y2 [QIndexRange][2]int16 + UV [QIndexRange][2]int16 +} + +type MacroblockDequant struct { + Y1 [16]int16 + Y1DC [16]int16 + Y2 [16]int16 + UV [16]int16 +} + +func ClampQIndex(qIndex int) int { + return min(max(qIndex, MinQ), MaxQ) +} + +func QIndexToPublicQuantizer(qIndex int) int { + for q, translated := range publicQuantizerToQIndex { + if translated >= qIndex { + return q + } + } + return maxPublicQuantizer +} + +func DCQuant(qIndex int, delta int) int { + return int(dcQLookup[ClampQIndex(qIndex+delta)]) +} + +func DC2Quant(qIndex int, delta int) int { + return int(dcQLookup[ClampQIndex(qIndex+delta)]) * 2 +} + +func DCUVQuant(qIndex int, delta int) int { + return min(int(dcQLookup[ClampQIndex(qIndex+delta)]), 132) +} + +func ACYQuant(qIndex int) int { + return int(acQLookup[ClampQIndex(qIndex)]) +} + +func AC2Quant(qIndex int, delta int) int { + v := (int(acQLookup[ClampQIndex(qIndex+delta)]) * 101581) >> 16 + if v < 8 { + return 8 + } + return v +} + +func ACUVQuant(qIndex int, delta int) int { + return int(acQLookup[ClampQIndex(qIndex+delta)]) +} + +func BuildFrameDequantTables(d QuantDeltas, out *FrameDequantTables) { + for q := range QIndexRange { + out.Y1[q][0] = int16(DCQuant(q, d.Y1DC)) + out.Y1[q][1] = int16(ACYQuant(q)) + out.Y2[q][0] = int16(DC2Quant(q, d.Y2DC)) + out.Y2[q][1] = int16(AC2Quant(q, d.Y2AC)) + out.UV[q][0] = int16(DCUVQuant(q, d.UVDC)) + out.UV[q][1] = int16(ACUVQuant(q, d.UVAC)) + } +} + +func InitMacroblockDequant(t *FrameDequantTables, qIndex int, out *MacroblockDequant) { + q := ClampQIndex(qIndex) + + out.Y1DC[0] = 1 + out.Y1[0] = t.Y1[q][0] + out.Y2[0] = t.Y2[q][0] + out.UV[0] = t.UV[q][0] + + y1AC := t.Y1[q][1] + y2AC := t.Y2[q][1] + uvAC := t.UV[q][1] + for i := 1; i < 16; i++ { + out.Y1DC[i] = y1AC + out.Y1[i] = y1AC + out.Y2[i] = y2AC + out.UV[i] = uvAC + } +} diff --git a/internal/vp8/decoder/dequant.go b/internal/vp8/decoder/dequant.go new file mode 100644 index 0000000..9df1560 --- /dev/null +++ b/internal/vp8/decoder/dequant.go @@ -0,0 +1,41 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/dequant.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import "github.com/go-avkit/vpx/internal/vp8/common" + +// Ported from libvpx v1.16.0: +// - vp8/decoder/decodeframe.c vp8cx_init_de_quantizer +// - vp8/decoder/decodeframe.c vp8_mb_init_dequantizer + +func InitSegmentDequants(quant QuantHeader, segmentation *SegmentationHeader, tables *common.FrameDequantTables, out *[common.MaxMBSegments]common.MacroblockDequant) { + common.BuildFrameDequantTables(common.QuantDeltas{ + Y1DC: int(quant.Y1DCDelta), + Y2DC: int(quant.Y2DCDelta), + Y2AC: int(quant.Y2ACDelta), + UVDC: int(quant.UVDCDelta), + UVAC: int(quant.UVACDelta), + }, tables) + + baseQ := int(quant.BaseQIndex) + for segment := range common.MaxMBSegments { + qIndex := baseQ + if segmentation != nil && segmentation.Enabled { + altQ := int(segmentation.FeatureData[common.MBLvlAltQ][segment]) + if segmentation.AbsDelta { + qIndex = altQ + } else { + qIndex = baseQ + altQ + } + } + common.InitMacroblockDequant(tables, qIndex, &out[segment]) + } +} diff --git a/internal/vp8/decoder/error_concealment.go b/internal/vp8/decoder/error_concealment.go new file mode 100644 index 0000000..51475fa --- /dev/null +++ b/internal/vp8/decoder/error_concealment.go @@ -0,0 +1,263 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/error_concealment.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/common" +) + +const maxErrorConcealmentOverlaps = 16 + +type errorConcealmentOverlapNode struct { + mv MotionVector + overlap int + used bool +} + +type errorConcealmentBlockOverlap struct { + overlaps [maxErrorConcealmentOverlaps]errorConcealmentOverlapNode +} + +type errorConcealmentMacroblockOverlap struct { + blocks [16]errorConcealmentBlockOverlap +} + +// ErrorConcealmentOverlap is an opaque scratch element for the +// per-macroblock overlap list used by EstimateMissingMotionVectorsWithScratch. +// Callers should not depend on the field layout; only the size is part of +// the API. This mirrors libvpx's pbi->overlaps array (MB_OVERLAP[]). +type ErrorConcealmentOverlap = errorConcealmentMacroblockOverlap + +func PrepareErrorConcealmentModes(modes []MacroblockMode) { + for i := range modes { + mode := &modes[i] + if mode.RefFrame == common.IntraFrame || mode.Mode == common.SplitMV { + continue + } + for block := range mode.BlockMV { + mode.BlockMV[block] = mode.MV + } + } +} + +// EstimateMissingMotionVectorsWithScratch mirrors libvpx's persistent +// `pbi->overlaps` buffer (vp8_alloc_overlap_lists): the caller passes in a +// scratch buffer (typically resized once per frame-buffer alloc) so that +// concealment doesn't allocate per frame. When scratch is nil or too small, +// the function falls back to a fresh allocation. +func EstimateMissingMotionVectorsWithScratch(modes []MacroblockMode, prevModes []MacroblockMode, rows int, cols int, firstCorrupt int, scratch []errorConcealmentMacroblockOverlap) error { + if rows < 0 || cols < 0 { + return ErrModeBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return ErrModeBufferTooSmall + } + required := rows * cols + if len(modes) < required || len(prevModes) < required { + return ErrModeBufferTooSmall + } + if firstCorrupt < 0 { + firstCorrupt = 0 + } + if firstCorrupt >= required { + return nil + } + + var overlaps []errorConcealmentMacroblockOverlap + if cap(scratch) >= required { + overlaps = scratch[:required] + for i := range overlaps { + overlaps[i] = errorConcealmentMacroblockOverlap{} + } + } else { + overlaps = make([]errorConcealmentMacroblockOverlap, required) + } + for mbRow := range rows { + for mbCol := range cols { + index := mbRow*cols + mbCol + prev := &prevModes[index] + if prev.RefFrame == common.LastFrame { + calcPrevMacroblockOverlaps(overlaps, prev, mbRow, mbCol, rows, cols) + } + } + } + + for index := firstCorrupt; index < required; index++ { + mode := &modes[index] + *mode = MacroblockMode{ + Mode: common.SplitMV, + UVMode: common.DCPred, + RefFrame: common.LastFrame, + Is4x4: true, + Partition: 3, + } + estimateMacroblockMotionVectors(&overlaps[index], mode) + } + return nil +} + +func calcPrevMacroblockOverlaps(overlaps []errorConcealmentMacroblockOverlap, prev *MacroblockMode, mbRow int, mbCol int, rows int, cols int) { + for subRow := range 4 { + for subCol := range 4 { + calculateErrorConcealmentOverlaps(overlaps, rows, cols, prev.BlockMV[subRow*4+subCol], 4*mbRow+subRow, 4*mbCol+subCol) + } + } +} + +func calculateErrorConcealmentOverlaps(overlaps []errorConcealmentMacroblockOverlap, rows int, cols int, mv MotionVector, bRow int, bCol int) { + row := (4 * bRow) << 3 + col := (4 * bCol) << 3 + newRow := row - int(mv.Row) + newCol := col - int(mv.Col) + + if newRow >= ((16*rows)<<3) || newCol >= ((16*cols)<<3) { + return + } + if newRow <= -32 || newCol <= -32 { + return + } + + overlapBRow := floorErrorConcealment(newRow/4, 3) >> 3 + overlapBCol := floorErrorConcealment(newCol/4, 3) >> 3 + overlapMBRow := floorErrorConcealment((overlapBRow<<3)/4, 3) >> 3 + overlapMBCol := floorErrorConcealment((overlapBCol<<3)/4, 3) >> 3 + + endRow := min(rows-overlapMBRow, 2) + endCol := min(cols-overlapMBCol, 2) + if absInt(newRow-((16*overlapMBRow)<<3)) < ((3 * 4) << 3) { + endRow = 1 + } + if absInt(newCol-((16*overlapMBCol)<<3)) < ((3 * 4) << 3) { + endCol = 1 + } + + for relRow := 0; relRow < endRow; relRow++ { + for relCol := 0; relCol < endCol; relCol++ { + mbRow := overlapMBRow + relRow + mbCol := overlapMBCol + relCol + if uint(mbRow) >= uint(rows) || uint(mbCol) >= uint(cols) { + continue + } + mb := &overlaps[mbRow*cols+mbCol] + calculateErrorConcealmentOverlapsMB(mb, mv, newRow, newCol, mbRow, mbCol, overlapBRow+relRow, overlapBCol+relCol) + } + } +} + +func calculateErrorConcealmentOverlapsMB(mb *errorConcealmentMacroblockOverlap, mv MotionVector, newRow int, newCol int, mbRow int, mbCol int, firstBlockRow int, firstBlockCol int) { + relBlockRow := firstBlockRow - mbRow*4 + relBlockCol := firstBlockCol - mbCol*4 + blockIndex := max(relBlockRow, 0)*4 + max(relBlockCol, 0) + if uint(blockIndex) >= uint(len(mb.blocks)) { + return + } + + endRow := min(4+mbRow*4-firstBlockRow, 2) + endCol := min(4+mbCol*4-firstBlockCol, 2) + if newRow >= 0 && (newRow&0x1f) == 0 { + endRow = 1 + } + if newCol >= 0 && (newCol&0x1f) == 0 { + endCol = 1 + } + if newRow < (mbRow*16)<<3 { + endRow = 1 + } + if newCol < (mbCol*16)<<3 { + endCol = 1 + } + + for row := 0; row < endRow; row++ { + for col := 0; col < endCol; col++ { + target := blockIndex + row*4 + col + if uint(target) >= uint(len(mb.blocks)) { + continue + } + overlap := errorConcealmentBlockOverlapArea( + newRow, + newCol, + ((firstBlockRow+row)*4)<<3, + ((firstBlockCol+col)*4)<<3, + ) + assignErrorConcealmentOverlap(&mb.blocks[target], mv, overlap) + } + } +} + +func assignErrorConcealmentOverlap(block *errorConcealmentBlockOverlap, mv MotionVector, overlap int) { + if overlap <= 0 { + return + } + for i := range block.overlaps { + if !block.overlaps[i].used { + block.overlaps[i] = errorConcealmentOverlapNode{mv: mv, overlap: overlap, used: true} + return + } + } +} + +func errorConcealmentBlockOverlapArea(aRow int, aCol int, bRow int, bCol int) int { + top := max(aRow, bRow) + left := max(aCol, bCol) + right := min(aCol+(4<<3), bCol+(4<<3)) + bottom := min(aRow+(4<<3), bRow+(4<<3)) + return (bottom - top) * (right - left) +} + +func estimateMacroblockMotionVectors(overlap *errorConcealmentMacroblockOverlap, mode *MacroblockMode) { + nonZero := 0 + rowSum := 0 + colSum := 0 + for block := range 16 { + mv := estimateBlockMotionVector(&overlap.blocks[block]) + mode.BlockMV[block] = mv + if !mv.IsZero() { + nonZero++ + rowSum += int(mv.Row) + colSum += int(mv.Col) + } + } + if nonZero > 0 { + mode.MV.Row = int16(rowSum / nonZero) + mode.MV.Col = int16(colSum / nonZero) + } +} + +func estimateBlockMotionVector(overlap *errorConcealmentBlockOverlap) MotionVector { + overlapSum := 0 + rowSum := 0 + colSum := 0 + for i := range overlap.overlaps { + node := overlap.overlaps[i] + if !node.used { + break + } + rowSum += node.overlap * int(node.mv.Row) + colSum += node.overlap * int(node.mv.Col) + overlapSum += node.overlap + } + if overlapSum == 0 { + return MotionVector{} + } + return MotionVector{ + Row: int16(rowSum / overlapSum), + Col: int16(colSum / overlapSum), + } +} + +func floorErrorConcealment(x int, q int) int { + return x & -(1 << q) +} + +func absInt(v int) int { + mask := v >> intSignShiftDec + return (v ^ mask) - mask +} diff --git a/internal/vp8/decoder/header.go b/internal/vp8/decoder/header.go new file mode 100644 index 0000000..90cd511 --- /dev/null +++ b/internal/vp8/decoder/header.go @@ -0,0 +1,81 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/header.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + + "github.com/go-avkit/vpx/internal/vp8/common" +) + +// Ported from libvpx v1.16.0: +// - vp8/decoder/decodeframe.c +// - vp8/vp8_dx_iface.c + +var ErrInvalidFrameHeader = errors.New("govpx: invalid VP8 frame header") + +var KeyFrameStartCode = [3]byte{0x9d, 0x01, 0x2a} + +type FrameHeader struct { + FrameType common.FrameType + Profile int + + ShowFrame bool + + FirstPartitionSize int + HeaderSize int + + Width int + Height int + HorizScale int + VertScale int +} + +func (h FrameHeader) KeyFrame() bool { + return h.FrameType == common.KeyFrame +} + +func ParseFrameHeader(packet []byte) (FrameHeader, error) { + if len(packet) < 3 { + return FrameHeader{}, ErrInvalidFrameHeader + } + + tag := uint32(packet[0]) | uint32(packet[1])<<8 | uint32(packet[2])<<16 + header := FrameHeader{ + FrameType: common.FrameType(tag & 1), + Profile: int((tag >> 1) & 7), + ShowFrame: ((tag >> 4) & 1) != 0, + FirstPartitionSize: int(tag >> 5), + HeaderSize: 3, + } + + if !header.KeyFrame() { + return header, nil + } + if len(packet) < 10 { + return FrameHeader{}, ErrInvalidFrameHeader + } + if packet[3] != KeyFrameStartCode[0] || packet[4] != KeyFrameStartCode[1] || packet[5] != KeyFrameStartCode[2] { + return FrameHeader{}, ErrInvalidFrameHeader + } + + widthRaw := uint16(packet[6]) | uint16(packet[7])<<8 + heightRaw := uint16(packet[8]) | uint16(packet[9])<<8 + header.Width = int(widthRaw & 0x3fff) + header.HorizScale = int(widthRaw >> 14) + header.Height = int(heightRaw & 0x3fff) + header.VertScale = int(heightRaw >> 14) + header.HeaderSize = 10 + if header.Width <= 0 || header.Height <= 0 { + return FrameHeader{}, ErrInvalidFrameHeader + } + return header, nil +} diff --git a/internal/vp8/decoder/loopfilter.go b/internal/vp8/decoder/loopfilter.go new file mode 100644 index 0000000..1cf31eb --- /dev/null +++ b/internal/vp8/decoder/loopfilter.go @@ -0,0 +1,246 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/loopfilter.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + "github.com/go-avkit/vpx/internal/pixel" + + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/dsp" +) + +var ErrLoopFilterBufferTooSmall = errors.New("govpx: VP8 loop filter buffer too small") + +// ApplyLoopFilterUnchecked is the decoder hot-path variant. The caller must +// already have validated the image grid and produced trusted macroblock modes. +func ApplyLoopFilterUnchecked(img *common.Image, rows int, cols int, modes []MacroblockMode, frameType common.FrameType, header LoopFilterHeader, segmentation SegmentationHeader, lfi *common.LoopFilterInfo) { + if header.Level == 0 { + return + } + + common.InitLoopFilterInfo(lfi, int(header.SharpnessLevel)) + common.InitLoopFilterFrame(lfi, int(header.Level), loopFilterFrameConfig(header, segmentation)) + + if header.Type == SimpleLoopFilter { + applySimpleLoopFilterGridUnchecked(img, rows, cols, modes, lfi) + return + } + applyNormalLoopFilterGridUnchecked(img, rows, cols, modes, frameType, lfi) +} + +func applyNormalLoopFilterGridUnchecked(img *common.Image, rows int, cols int, modes []MacroblockMode, frameType common.FrameType, lfi *common.LoopFilterInfo) { + for row := range rows { + applyNormalLoopFilterRowUnchecked(img, row, cols, modes, frameType, lfi) + } +} + +func applySimpleLoopFilterGridUnchecked(img *common.Image, rows int, cols int, modes []MacroblockMode, lfi *common.LoopFilterInfo) { + for row := range rows { + applySimpleLoopFilterRowUnchecked(img, row, cols, modes, lfi) + } +} + +func applyNormalLoopFilterRow(img *common.Image, row int, cols int, modes []MacroblockMode, frameType common.FrameType, lfi *common.LoopFilterInfo) error { + yRow := row * 16 * img.YStride + uRow := row * 8 * img.UStride + vRow := row * 8 * img.VStride + for col := range cols { + index := row*cols + col + mode := &modes[index] + if !validLoopFilterMode(mode) { + return ErrLoopFilterBufferTooSmall + } + level := lfi.Level[mode.SegmentID][mode.RefFrame][lfi.ModeLFLUT[mode.Mode]] + if level == 0 { + continue + } + + yOff := yRow + col*16 + uOff := uRow + col*8 + vOff := vRow + col*8 + applyNormalLoopFilterMB(img, row, col, yOff, uOff, vOff, mode, frameType, level, lfi) + } + return nil +} + +func applyNormalLoopFilterRowUnchecked(img *common.Image, row int, cols int, modes []MacroblockMode, frameType common.FrameType, lfi *common.LoopFilterInfo) { + yRow := row * 16 * img.YStride + uRow := row * 8 * img.UStride + vRow := row * 8 * img.VStride + for col := range cols { + mode := &modes[row*cols+col] + level := lfi.Level[mode.SegmentID][mode.RefFrame][lfi.ModeLFLUT[mode.Mode]] + if level == 0 { + continue + } + + yOff := yRow + col*16 + uOff := uRow + col*8 + vOff := vRow + col*8 + applyNormalLoopFilterMB(img, row, col, yOff, uOff, vOff, mode, frameType, level, lfi) + } +} + +func applySimpleLoopFilterRow(img *common.Image, row int, cols int, modes []MacroblockMode, lfi *common.LoopFilterInfo) error { + yRow := row * 16 * img.YStride + for col := range cols { + index := row*cols + col + mode := &modes[index] + if !validLoopFilterMode(mode) { + return ErrLoopFilterBufferTooSmall + } + level := lfi.Level[mode.SegmentID][mode.RefFrame][lfi.ModeLFLUT[mode.Mode]] + if level == 0 { + continue + } + + yOff := yRow + col*16 + applySimpleLoopFilterMB(img, row, col, yOff, mode, level, lfi) + } + return nil +} + +func applySimpleLoopFilterRowUnchecked(img *common.Image, row int, cols int, modes []MacroblockMode, lfi *common.LoopFilterInfo) { + yRow := row * 16 * img.YStride + for col := range cols { + mode := &modes[row*cols+col] + level := lfi.Level[mode.SegmentID][mode.RefFrame][lfi.ModeLFLUT[mode.Mode]] + if level == 0 { + continue + } + + yOff := yRow + col*16 + applySimpleLoopFilterMB(img, row, col, yOff, mode, level, lfi) + } +} + +func loopFilterFrameConfig(header LoopFilterHeader, segmentation SegmentationHeader) common.LoopFilterFrameConfig { + return LoopFilterFrameConfig(header, segmentation) +} + +// LoopFilterFrameConfig translates parsed VP8 loop-filter header state into +// the immutable frame-level tables used by common.InitLoopFilterFrame. +func LoopFilterFrameConfig(header LoopFilterHeader, segmentation SegmentationHeader) common.LoopFilterFrameConfig { + cfg := common.LoopFilterFrameConfig{ + SegmentationEnabled: segmentation.Enabled, + SegmentAbsDelta: segmentation.AbsDelta, + ModeRefDeltaEnabled: header.DeltaEnabled, + RefDeltas: header.RefDeltas, + ModeDeltas: header.ModeDeltas, + } + for segment := range common.MaxMBSegments { + cfg.SegmentLF[segment] = segmentation.FeatureData[common.MBLvlAltLF][segment] + } + return cfg +} + +func validLoopFilterMode(mode *MacroblockMode) bool { + return int(mode.SegmentID) < common.MaxMBSegments && + mode.RefFrame >= 0 && + mode.RefFrame < common.MaxRefFrames && + mode.Mode >= 0 && + mode.Mode < common.MBModeCount +} + +func applyNormalLoopFilterMB(img *common.Image, row int, col int, yOff int, uOff int, vOff int, mode *MacroblockMode, frameType common.FrameType, level byte, lfi *common.LoopFilterInfo) { + skipLF := loopFilterSkipsInnerEdges(mode) + hev := lfi.HEVThresh[lfi.HEVThreshLUT[frameType][level]] + mblim := lfi.MBLimit[level] + blim := lfi.BLimit[level] + lim := lfi.Limit[level] + + fusedV := false + if pixel.NativeLFByAxis { + if macroInternalLoopFilter && col > 0 && !skipLF { + p := img.Y[yOff-4:] + fusedV = pixel.CanLoopFilterMacroVertical16(p, img.YStride, mblim, blim) + if fusedV { + pixel.LoopFilterMacroVertical16Unchecked(p, img.YStride, mblim, blim, lim, hev) + } + } + } else { + fusedV = macroInternalLoopFilter && col > 0 && !skipLF && pixel.LoopFilterMacroInternal16(img.Y[yOff-4:], 1, img.YStride, int(mblim), int(blim), int(lim), int(hev)) + } + if col > 0 { + if !fusedV { + dsp.MBLoopFilterVerticalEdge(img.Y[yOff-4:], img.YStride, mblim, lim, hev, 2) + } + dsp.MBLoopFilterVerticalEdgeUV(img.U[uOff-4:], img.V[vOff-4:], img.UStride, mblim, lim, hev) + } + if !skipLF { + if !fusedV { + dsp.LoopFilterVerticalEdgesY(img.Y[yOff:], img.YStride, blim, lim, hev) + } + dsp.LoopFilterVerticalEdgeUV(img.U[uOff:], img.V[vOff:], img.UStride, blim, lim, hev) + } + + fusedH := false + if pixel.NativeLFByAxis { + if macroInternalLoopFilter && row > 0 && !skipLF { + p := img.Y[yOff-4*img.YStride:] + fusedH = pixel.CanLoopFilterMacroHorizontal16(p, img.YStride, mblim, blim) + if fusedH { + pixel.LoopFilterMacroHorizontal16Unchecked(p, img.YStride, mblim, blim, lim, hev) + } + } + } else { + fusedH = macroInternalLoopFilter && row > 0 && !skipLF && pixel.LoopFilterMacroInternal16(img.Y[yOff-4*img.YStride:], img.YStride, 1, int(mblim), int(blim), int(lim), int(hev)) + } + if row > 0 { + if !fusedH { + dsp.MBLoopFilterHorizontalEdge(img.Y[yOff-4*img.YStride:], img.YStride, mblim, lim, hev, 2) + } + dsp.MBLoopFilterHorizontalEdgeUV(img.U[uOff-4*img.UStride:], img.V[vOff-4*img.VStride:], img.UStride, mblim, lim, hev) + } + if !skipLF { + if !fusedH { + dsp.LoopFilterHorizontalEdgesY(img.Y[yOff:], img.YStride, blim, lim, hev) + } + dsp.LoopFilterHorizontalEdgeUV(img.U[uOff:], img.V[vOff:], img.UStride, blim, lim, hev) + } +} + +func applySimpleLoopFilterMB(img *common.Image, row int, col int, yOff int, mode *MacroblockMode, level byte, lfi *common.LoopFilterInfo) { + skipLF := loopFilterSkipsInnerEdges(mode) + mblim := lfi.MBLimit[level] + blim := lfi.BLimit[level] + + if col > 0 && !skipLF && pixel.LoopFilterSimpleVertical4All16(img.Y[yOff-2:], img.YStride, mblim, blim) { + // All 4 vertical edges filtered in a single 16x16 SIMD transpose. + } else { + if col > 0 { + dsp.LoopFilterSimpleVerticalEdge(img.Y[yOff-2:], img.YStride, mblim) + } + if !skipLF { + if !pixel.LoopFilterSimpleVertical3Inner16(img.Y[yOff+2:], img.YStride, blim) { + dsp.LoopFilterSimpleVerticalEdge(img.Y[yOff+2:], img.YStride, blim) + dsp.LoopFilterSimpleVerticalEdge(img.Y[yOff+6:], img.YStride, blim) + dsp.LoopFilterSimpleVerticalEdge(img.Y[yOff+10:], img.YStride, blim) + } + } + } + + if row > 0 { + dsp.LoopFilterSimpleHorizontalEdge(img.Y[yOff-2*img.YStride:], img.YStride, mblim) + } + if !skipLF { + if !pixel.LoopFilterSimpleHorizontal3Inner16(img.Y[yOff+2*img.YStride:], img.YStride, blim) { + dsp.LoopFilterSimpleHorizontalEdge(img.Y[yOff+2*img.YStride:], img.YStride, blim) + dsp.LoopFilterSimpleHorizontalEdge(img.Y[yOff+6*img.YStride:], img.YStride, blim) + dsp.LoopFilterSimpleHorizontalEdge(img.Y[yOff+10*img.YStride:], img.YStride, blim) + } + } +} + +func loopFilterSkipsInnerEdges(mode *MacroblockMode) bool { + return mode.Mode != common.BPred && mode.Mode != common.SplitMV && mode.MBSkipCoeff +} diff --git a/internal/vp8/decoder/loopfilter_header.go b/internal/vp8/decoder/loopfilter_header.go new file mode 100644 index 0000000..7e94f08 --- /dev/null +++ b/internal/vp8/decoder/loopfilter_header.go @@ -0,0 +1,69 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/loopfilter_header.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/common" +) + +// Ported from libvpx v1.16.0 vp8/decoder/decodeframe.c loop-filter header +// parsing. + +type LoopFilterType int + +const ( + NormalLoopFilter LoopFilterType = iota + SimpleLoopFilter +) + +type LoopFilterHeader struct { + Type LoopFilterType + Level uint8 + SharpnessLevel uint8 + + DeltaEnabled bool + DeltaUpdate bool + + RefDeltas [common.MaxRefLFDeltas]int8 + ModeDeltas [common.MaxModeLFDeltas]int8 +} + +func parseLoopFilterHeaderWithPrevious(br *boolcoder.Decoder, previous LoopFilterHeader) LoopFilterHeader { + var h LoopFilterHeader + h.RefDeltas = previous.RefDeltas + h.ModeDeltas = previous.ModeDeltas + h.Type = LoopFilterType(br.ReadBit()) + h.Level = uint8(br.ReadLiteral(6)) + h.SharpnessLevel = uint8(br.ReadLiteral(3)) + + h.DeltaEnabled = br.ReadBit() != 0 + if !h.DeltaEnabled { + return h + } + + h.DeltaUpdate = br.ReadBit() != 0 + if !h.DeltaUpdate { + return h + } + + for i := range h.RefDeltas { + if br.ReadBit() != 0 { + h.RefDeltas[i] = readSignedLiteral(br, 6) + } + } + for i := range h.ModeDeltas { + if br.ReadBit() != 0 { + h.ModeDeltas[i] = readSignedLiteral(br, 6) + } + } + return h +} diff --git a/internal/vp8/decoder/loopfilter_macro_internal_amd64.go b/internal/vp8/decoder/loopfilter_macro_internal_amd64.go new file mode 100644 index 0000000..084b926 --- /dev/null +++ b/internal/vp8/decoder/loopfilter_macro_internal_amd64.go @@ -0,0 +1,16 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/loopfilter_macro_internal_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +// VP8 edge order follows libvpx v1.16.0 vp8/common/loopfilter.c. +package decoder + +const macroInternalLoopFilter = true diff --git a/internal/vp8/decoder/loopfilter_macro_internal_arm64.go b/internal/vp8/decoder/loopfilter_macro_internal_arm64.go new file mode 100644 index 0000000..1698238 --- /dev/null +++ b/internal/vp8/decoder/loopfilter_macro_internal_arm64.go @@ -0,0 +1,16 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/loopfilter_macro_internal_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +// VP8 edge order follows libvpx v1.16.0 vp8/common/loopfilter.c. +package decoder + +const macroInternalLoopFilter = true diff --git a/internal/vp8/decoder/loopfilter_macro_internal_generic.go b/internal/vp8/decoder/loopfilter_macro_internal_generic.go new file mode 100644 index 0000000..db94493 --- /dev/null +++ b/internal/vp8/decoder/loopfilter_macro_internal_generic.go @@ -0,0 +1,17 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/loopfilter_macro_internal_generic.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || (!arm64 && !amd64) || purego + +// VP8 edge order follows libvpx v1.16.0 vp8/common/loopfilter.c. +package decoder + +// The compile-time guard removes the fused call and its slice construction. +const macroInternalLoopFilter = false diff --git a/internal/vp8/decoder/macroblock.go b/internal/vp8/decoder/macroblock.go new file mode 100644 index 0000000..9666ee8 --- /dev/null +++ b/internal/vp8/decoder/macroblock.go @@ -0,0 +1,30 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/macroblock.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import "github.com/go-avkit/vpx/internal/vp8/common" + +// Ported macroblock mode metadata from libvpx v1.16.0 vp8/common/blockd.h. + +type MacroblockMode struct { + Mode common.MBPredictionMode + UVMode common.MBPredictionMode + RefFrame common.MVReferenceFrame + MV MotionVector + + Is4x4 bool + MBSkipCoeff bool + SegmentID uint8 + Partition uint8 + + BModes [16]common.BPredictionMode + BlockMV [16]MotionVector +} diff --git a/internal/vp8/decoder/modes.go b/internal/vp8/decoder/modes.go new file mode 100644 index 0000000..f403490 --- /dev/null +++ b/internal/vp8/decoder/modes.go @@ -0,0 +1,447 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/modes.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +var ( + ErrModeBufferTooSmall = errors.New("govpx: VP8 mode buffer too small") +) + +type ModeProbs struct { + YMode [tables.YModeProbCount]uint8 + UVMode [tables.UVModeProbCount]uint8 + BMode [tables.BModeProbCount]uint8 + MV [2][tables.MVPCount]uint8 +} + +type ModeHeader struct { + MBNoCoeffSkip bool + ProbSkipFalse uint8 + + ProbIntra uint8 + ProbLast uint8 + ProbGolden uint8 + + YModeUpdated bool + UVModeUpdated bool + MVUpdateCount int +} + +type InterModeCounts struct { + Intra uint8 + Nearest uint8 + Near uint8 + Split uint8 +} + +func ResetModeProbs(probs *ModeProbs) { + probs.YMode = tables.DefaultYModeProbs + probs.UVMode = tables.DefaultUVModeProbs + probs.BMode = tables.DefaultBModeProbs + probs.MV = tables.DefaultMVContext +} + +func parseModeHeaderInto(br *boolcoder.Decoder, keyFrame bool, probs *ModeProbs) ModeHeader { + var h ModeHeader + h.MBNoCoeffSkip = br.ReadBit() != 0 + if h.MBNoCoeffSkip { + h.ProbSkipFalse = uint8(br.ReadLiteral(8)) + } + + if keyFrame { + return h + } + + h.ProbIntra = uint8(br.ReadLiteral(8)) + h.ProbLast = uint8(br.ReadLiteral(8)) + h.ProbGolden = uint8(br.ReadLiteral(8)) + + if br.ReadBit() != 0 { + h.YModeUpdated = true + for i := range tables.YModeProbCount { + value := uint8(br.ReadLiteral(8)) + if probs != nil { + probs.YMode[i] = value + } + } + } + + if br.ReadBit() != 0 { + h.UVModeUpdated = true + for i := range tables.UVModeProbCount { + value := uint8(br.ReadLiteral(8)) + if probs != nil { + probs.UVMode[i] = value + } + } + } + + for component := range 2 { + for i := range tables.MVPCount { + if br.ReadBool(tables.MVUpdateProbs[component][i]) == 0 { + continue + } + value := uint8(br.ReadLiteral(7)) + if value != 0 { + value <<= 1 + } else { + value = 1 + } + if probs != nil { + probs.MV[component][i] = value + } + h.MVUpdateCount++ + } + } + return h +} + +func DecodeKeyFrameMacroblock(br *boolcoder.Decoder, segmentation *SegmentationHeader, modeHeader ModeHeader, above *MacroblockMode, left *MacroblockMode, out *MacroblockMode) { + segmentID := out.SegmentID + *out = MacroblockMode{} + if segmentation != nil && segmentation.Enabled { + if segmentation.UpdateMap { + out.SegmentID = readMacroblockSegmentID(br, segmentation.TreeProbs) + } else { + out.SegmentID = segmentID + } + } + if modeHeader.MBNoCoeffSkip { + out.MBSkipCoeff = br.ReadBool(modeHeader.ProbSkipFalse) != 0 + } + decodeKeyFrameMacroblockMode(br, above, left, out) +} + +func DecodeKeyFrameModeGrid(br *boolcoder.Decoder, rows int, cols int, segmentation *SegmentationHeader, modeHeader ModeHeader, modes []MacroblockMode) error { + if _, err := validateModeGrid(rows, cols, modes); err != nil { + return err + } + for row := range rows { + for col := range cols { + index := row*cols + col + var above *MacroblockMode + var left *MacroblockMode + if row > 0 { + above = &modes[index-cols] + } + if col > 0 { + left = &modes[index-1] + } + DecodeKeyFrameMacroblock(br, segmentation, modeHeader, above, left, &modes[index]) + } + } + return nil +} + +func DecodeInterModeGrid(br *boolcoder.Decoder, rows int, cols int, segmentation *SegmentationHeader, modeHeader ModeHeader, probs *ModeProbs, signBias [common.MaxRefFrames]bool, modes []MacroblockMode) error { + if _, err := validateModeGrid(rows, cols, modes); err != nil { + return err + } + for row := range rows { + for col := range cols { + index := row*cols + col + var above *MacroblockMode + var left *MacroblockMode + var aboveLeft *MacroblockMode + if row > 0 { + above = &modes[index-cols] + } + if col > 0 { + left = &modes[index-1] + } + if row > 0 && col > 0 { + aboveLeft = &modes[index-cols-1] + } + if err := decodeInterMacroblockAt(br, row, col, rows, cols, segmentation, modeHeader, probs, above, left, aboveLeft, signBias, &modes[index]); err != nil { + return err + } + } + } + return nil +} + +func DecodeInterModeGridWithErrorConcealment(br *boolcoder.Decoder, rows int, cols int, segmentation *SegmentationHeader, modeHeader ModeHeader, probs *ModeProbs, signBias [common.MaxRefFrames]bool, modes []MacroblockMode) (int, error) { + if _, err := validateModeGrid(rows, cols, modes); err != nil { + return 0, err + } + required := rows * cols + firstCorrupt := required + if br.Err() != nil { + firstCorrupt = 0 + } + for row := range rows { + for col := range cols { + index := row*cols + col + if index >= firstCorrupt { + continue + } + var above *MacroblockMode + var left *MacroblockMode + var aboveLeft *MacroblockMode + if row > 0 { + above = &modes[index-cols] + } + if col > 0 { + left = &modes[index-1] + } + if row > 0 && col > 0 { + aboveLeft = &modes[index-cols-1] + } + if err := decodeInterMacroblockAt(br, row, col, rows, cols, segmentation, modeHeader, probs, above, left, aboveLeft, signBias, &modes[index]); err != nil { + return 0, err + } + if br.Err() != nil { + firstCorrupt = index + } + } + } + return firstCorrupt, nil +} + +func decodeInterMacroblockAt(br *boolcoder.Decoder, mbRow int, mbCol int, mbRows int, mbCols int, segmentation *SegmentationHeader, modeHeader ModeHeader, probs *ModeProbs, above *MacroblockMode, left *MacroblockMode, aboveLeft *MacroblockMode, signBias [common.MaxRefFrames]bool, out *MacroblockMode) error { + segmentID := out.SegmentID + *out = MacroblockMode{} + if segmentation != nil && segmentation.Enabled { + if segmentation.UpdateMap { + out.SegmentID = readMacroblockSegmentID(br, segmentation.TreeProbs) + } else { + out.SegmentID = segmentID + } + } + if modeHeader.MBNoCoeffSkip { + out.MBSkipCoeff = br.ReadBool(modeHeader.ProbSkipFalse) != 0 + } + + refFrame := ReadInterReferenceFrame(br, modeHeader) + if refFrame == common.IntraFrame { + decodeInterIntraMacroblockMode(br, probs, out) + return nil + } + + nearest, near, best, counts := FindNearMotionVectors(above, left, aboveLeft, refFrame, signBias) + out.RefFrame = refFrame + out.Mode = ReadInterPredictionMode(br, counts) + switch out.Mode { + case common.ZeroMV: + out.MV = MotionVector{} + case common.NearestMV: + out.MV = clampMotionVectorToModeEdges(nearest, mbRow, mbCol, mbRows, mbCols) + case common.NearMV: + out.MV = clampMotionVectorToModeEdges(near, mbRow, mbCol, mbRows, mbCols) + case common.NewMV: + best = clampMotionVectorToModeEdges(best, mbRow, mbCol, mbRows, mbCols) + out.MV = addMotionVectors(best, DecodeMotionVector(br, &probs.MV)) + case common.SplitMV: + best = clampMotionVectorToModeEdges(best, mbRow, mbCol, mbRows, mbCols) + decodeSplitMotionVectors(br, probs, left, above, best, out) + } + return nil +} + +func ReadInterReferenceFrame(br *boolcoder.Decoder, modeHeader ModeHeader) common.MVReferenceFrame { + return common.MVReferenceFrame(br.ReadVP8InterRefFrame( + modeHeader.ProbIntra, modeHeader.ProbLast, modeHeader.ProbGolden)) +} + +func ReadInterPredictionMode(br *boolcoder.Decoder, counts InterModeCounts) common.MBPredictionMode { + switch br.ReadVP8InterMode( + tables.InterModeContexts[counts.Intra][0], + tables.InterModeContexts[counts.Nearest][1], + tables.InterModeContexts[counts.Near][2], + tables.InterModeContexts[counts.Split][3], + ) { + case 0: + return common.ZeroMV + case 1: + return common.NearestMV + case 2: + return common.NearMV + case 4: + return common.SplitMV + default: + return common.NewMV + } +} + +func decodeKeyFrameMacroblockMode(br *boolcoder.Decoder, above *MacroblockMode, left *MacroblockMode, out *MacroblockMode) { + out.RefFrame = common.IntraFrame + out.Is4x4 = false + out.BModes = [16]common.BPredictionMode{} + out.Mode = common.MBPredictionMode(ReadKeyFrameYMode(br, tables.KeyFrameYModeProbs[:])) + + if out.Mode == common.BPred { + out.Is4x4 = true + for i := range 16 { + a := keyFrameAboveBlockMode(out, above, i) + l := keyFrameLeftBlockMode(out, left, i) + out.BModes[i] = common.BPredictionMode(ReadBMode(br, tables.KeyFrameBModeProbs[int(a)][int(l)][:])) + } + } + + out.UVMode = common.MBPredictionMode(ReadUVMode(br, tables.KeyFrameUVModeProbs[:])) +} + +func decodeInterIntraMacroblockMode(br *boolcoder.Decoder, probs *ModeProbs, out *MacroblockMode) { + out.RefFrame = common.IntraFrame + out.Is4x4 = false + out.BModes = [16]common.BPredictionMode{} + out.Mode = common.MBPredictionMode(ReadYMode(br, probs.YMode[:])) + + if out.Mode == common.BPred { + out.Is4x4 = true + for i := range 16 { + out.BModes[i] = common.BPredictionMode(ReadBMode(br, probs.BMode[:])) + } + } + + out.UVMode = common.MBPredictionMode(ReadUVMode(br, probs.UVMode[:])) +} + +func readMacroblockSegmentID(br *boolcoder.Decoder, probs [common.MBFeatureTreeProbs]uint8) uint8 { + if br.ReadBool(probs[0]) != 0 { + return uint8(2 + br.ReadBool(probs[2])) + } + return br.ReadBool(probs[1]) +} + +func keyFrameLeftBlockMode(cur *MacroblockMode, left *MacroblockMode, block int) common.BPredictionMode { + if block&3 == 0 { + if left == nil { + return common.BDCPred + } + if left.Mode == common.BPred { + return left.BModes[block+3] + } + return common.BlockModeFromMacroblockMode(left.Mode) + } + return cur.BModes[block-1] +} + +func keyFrameAboveBlockMode(cur *MacroblockMode, above *MacroblockMode, block int) common.BPredictionMode { + if block>>2 == 0 { + if above == nil { + return common.BDCPred + } + if above.Mode == common.BPred { + return above.BModes[block+12] + } + return common.BlockModeFromMacroblockMode(above.Mode) + } + return cur.BModes[block-4] +} + +func addMotionVectors(a MotionVector, b MotionVector) MotionVector { + return MotionVector{Row: a.Row + b.Row, Col: a.Col + b.Col} +} + +func decodeSplitMotionVectors(br *boolcoder.Decoder, probs *ModeProbs, left *MacroblockMode, above *MacroblockMode, best MotionVector, out *MacroblockMode) { + partition := 3 + partitions := 16 + if br.ReadBool(tables.MBSplitProbs[0]) != 0 { + partition = 2 + partitions = 4 + if br.ReadBool(tables.MBSplitProbs[1]) != 0 { + partition = int(br.ReadBool(tables.MBSplitProbs[2])) + partitions = 2 + } + } + + for subset := 0; subset < partitions; subset++ { + block := int(tables.MBSplitOffset[partition][subset]) + leftMV := splitLeftMV(out, left, block) + aboveMV := splitAboveMV(out, above, block) + prob := subMVRefProbs(leftMV, aboveMV) + blockMV := leftMV + if br.ReadBool(prob[0]) != 0 { + if br.ReadBool(prob[1]) != 0 { + blockMV = MotionVector{} + if br.ReadBool(prob[2]) != 0 { + blockMV = addMotionVectors(best, DecodeMotionVector(br, &probs.MV)) + } + } else { + blockMV = aboveMV + } + } + + fillCount := int(tables.MBSplitFillCount[partition]) + fillStart := subset * fillCount + for i := range fillCount { + out.BlockMV[tables.MBSplitFillOffset[partition][fillStart+i]] = blockMV + } + } + + out.Partition = uint8(partition) + out.MV = out.BlockMV[15] + out.Is4x4 = true +} + +func splitLeftMV(cur *MacroblockMode, left *MacroblockMode, block int) MotionVector { + if block&3 == 0 { + if left == nil { + return MotionVector{} + } + if left.Mode == common.SplitMV { + return left.BlockMV[block+3] + } + return left.MV + } + return cur.BlockMV[block-1] +} + +func splitAboveMV(cur *MacroblockMode, above *MacroblockMode, block int) MotionVector { + if block>>2 == 0 { + if above == nil { + return MotionVector{} + } + if above.Mode == common.SplitMV { + return above.BlockMV[block+12] + } + return above.MV + } + return cur.BlockMV[block-4] +} + +func subMVRefProbs(left MotionVector, above MotionVector) [3]uint8 { + lez := 0 + if left.IsZero() { + lez = 1 + } + aez := 0 + if above.IsZero() { + aez = 1 + } + lea := 0 + if left == above { + lea = 1 + } + return tables.SubMVRefProb3[(aez<<2)|(lez<<1)|lea] +} + +func validateModeGrid(rows int, cols int, modes []MacroblockMode) (int, error) { + if rows < 0 || cols < 0 { + return 0, ErrModeBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return 0, ErrModeBufferTooSmall + } + required := rows * cols + if len(modes) < required { + return 0, ErrModeBufferTooSmall + } + return required, nil +} diff --git a/internal/vp8/decoder/mv.go b/internal/vp8/decoder/mv.go new file mode 100644 index 0000000..fc7fd59 --- /dev/null +++ b/internal/vp8/decoder/mv.go @@ -0,0 +1,129 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/mv.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +type MotionVector struct { + Row int16 + Col int16 +} + +func DecodeMotionVector(br *boolcoder.Decoder, probs *[2][tables.MVPCount]uint8) MotionVector { + row := readMVComponent(br, probs[0][:]) + col := readMVComponent(br, probs[1][:]) + return MotionVector{Row: int16(row * 2), Col: int16(col * 2)} +} + +func readMVComponent(br *boolcoder.Decoder, probs []uint8) int { + return br.ReadVP8MVComponent(probs) +} + +func FindNearMotionVectors(above *MacroblockMode, left *MacroblockMode, aboveLeft *MacroblockMode, refFrame common.MVReferenceFrame, signBias [common.MaxRefFrames]bool) (MotionVector, MotionVector, MotionVector, InterModeCounts) { + var nearMVs [4]MotionVector + var counts [4]uint8 + mvIndex := 0 + countIndex := 0 + + if above != nil && above.RefFrame != common.IntraFrame { + if !above.MV.IsZero() { + mvIndex++ + nearMVs[mvIndex] = biasMotionVector(above.MV, above.RefFrame, refFrame, signBias) + countIndex++ + } + counts[countIndex] += 2 + } + + if left != nil && left.RefFrame != common.IntraFrame { + if !left.MV.IsZero() { + thisMV := biasMotionVector(left.MV, left.RefFrame, refFrame, signBias) + if thisMV != nearMVs[mvIndex] { + mvIndex++ + nearMVs[mvIndex] = thisMV + countIndex++ + } + counts[countIndex] += 2 + } else { + counts[0] += 2 + } + } + + if aboveLeft != nil && aboveLeft.RefFrame != common.IntraFrame { + if !aboveLeft.MV.IsZero() { + thisMV := biasMotionVector(aboveLeft.MV, aboveLeft.RefFrame, refFrame, signBias) + if thisMV != nearMVs[mvIndex] { + mvIndex++ + nearMVs[mvIndex] = thisMV + countIndex++ + } + counts[countIndex]++ + } else { + counts[0]++ + } + } + + if counts[3] != 0 && nearMVs[mvIndex] == nearMVs[1] { + counts[1]++ + } + + counts[3] = splitModeCount(above)*2 + splitModeCount(left)*2 + splitModeCount(aboveLeft) + if counts[2] > counts[1] { + counts[1], counts[2] = counts[2], counts[1] + nearMVs[1], nearMVs[2] = nearMVs[2], nearMVs[1] + } + if counts[1] >= counts[0] { + nearMVs[0] = nearMVs[1] + } + + return nearMVs[1], nearMVs[2], nearMVs[0], InterModeCounts{ + Intra: counts[0], + Nearest: counts[1], + Near: counts[2], + Split: counts[3], + } +} + +func (mv MotionVector) IsZero() bool { + return mv.Row == 0 && mv.Col == 0 +} + +func biasMotionVector(mv MotionVector, refFrame common.MVReferenceFrame, target common.MVReferenceFrame, signBias [common.MaxRefFrames]bool) MotionVector { + if signBias[refFrame] == signBias[target] { + return mv + } + return MotionVector{Row: -mv.Row, Col: -mv.Col} +} + +func clampMotionVectorToModeEdges(mv MotionVector, mbRow int, mbCol int, mbRows int, mbCols int) MotionVector { + if mbRows <= 0 || mbCols <= 0 { + return mv + } + top, bottom, left, right := macroblockMotionVectorEdges(mbRow, mbCol, mbCols<<4, mbRows<<4) + return MotionVector{ + Row: int16(clampModeMVComponent(int(mv.Row), top, bottom)), + Col: int16(clampModeMVComponent(int(mv.Col), left, right)), + } +} + +func clampModeMVComponent(v int, lowEdge int, highEdge int) int { + return min(max(v, lowEdge-(16<<3)), highEdge+(16<<3)) +} + +func splitModeCount(mode *MacroblockMode) uint8 { + if mode != nil && mode.Mode == common.SplitMV { + return 1 + } + return 0 +} diff --git a/internal/vp8/decoder/partitions.go b/internal/vp8/decoder/partitions.go new file mode 100644 index 0000000..1c6064c --- /dev/null +++ b/internal/vp8/decoder/partitions.go @@ -0,0 +1,103 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/partitions.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + + "github.com/go-avkit/vpx/internal/vp8/common" +) + +// Ported from libvpx v1.16.0 vp8/decoder/decodeframe.c token partition +// sizing and validation. + +var ErrInvalidPartitionLayout = errors.New("govpx: invalid VP8 partition layout") + +type PartitionLayout struct { + First []byte + Tokens [8][]byte + TokenCount int +} + +func ParsePartitionLayout(packet []byte, frame FrameHeader, tokenPartition common.TokenPartition, out *PartitionLayout) error { + return parsePartitionLayout(packet, frame, tokenPartition, false, out) +} + +func ParsePartitionLayoutWithErrorConcealment(packet []byte, frame FrameHeader, tokenPartition common.TokenPartition, out *PartitionLayout) error { + return parsePartitionLayout(packet, frame, tokenPartition, true, out) +} + +func parsePartitionLayout(packet []byte, frame FrameHeader, tokenPartition common.TokenPartition, errorConcealment bool, out *PartitionLayout) error { + *out = PartitionLayout{} + if tokenPartition < common.OnePartition || tokenPartition > common.EightPartition { + return ErrInvalidPartitionLayout + } + // libvpx accepts FirstPartitionSize == 0 (no compressed first partition; + // state-header bits come from the token partitions instead). Only treat + // negative sizes or out-of-range HeaderSize as malformed. + if frame.FirstPartitionSize < 0 || frame.HeaderSize < 0 || frame.HeaderSize > len(packet) { + return ErrInvalidPartitionLayout + } + firstEnd := frame.HeaderSize + frame.FirstPartitionSize + if firstEnd < frame.HeaderSize || firstEnd > len(packet) { + if !errorConcealment || firstEnd < frame.HeaderSize { + return ErrInvalidPartitionLayout + } + firstEnd = len(packet) + } + + tokenCount := 1 << uint(tokenPartition) + sizeTableBytes := 3 * (tokenCount - 1) + if len(packet)-firstEnd < sizeTableBytes { + if !errorConcealment { + return ErrInvalidPartitionLayout + } + sizeTableBytes = len(packet) - firstEnd + } + + out.First = packet[frame.HeaderSize:firstEnd] + out.TokenCount = tokenCount + + sizeTable := packet[firstEnd : firstEnd+sizeTableBytes] + offset := firstEnd + sizeTableBytes + for i := 0; i < tokenCount-1; i++ { + if len(sizeTable) < (i+1)*3 { + out.Tokens[i] = packet[offset:] + return nil + } + size := readTokenPartitionSize(sizeTable[i*3:]) + if size <= 0 || size > len(packet)-offset { + if errorConcealment { + out.Tokens[i] = packet[offset:] + return nil + } + *out = PartitionLayout{} + return ErrInvalidPartitionLayout + } + out.Tokens[i] = packet[offset : offset+size] + offset += size + } + + lastSize := len(packet) - offset + if lastSize <= 0 { + if errorConcealment { + return nil + } + *out = PartitionLayout{} + return ErrInvalidPartitionLayout + } + out.Tokens[tokenCount-1] = packet[offset:] + return nil +} + +func readTokenPartitionSize(src []byte) int { + return int(src[0]) | int(src[1])<<8 | int(src[2])<<16 +} diff --git a/internal/vp8/decoder/postprocess.go b/internal/vp8/decoder/postprocess.go new file mode 100644 index 0000000..e41e8b2 --- /dev/null +++ b/internal/vp8/decoder/postprocess.go @@ -0,0 +1,893 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/postprocess.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + "math" + "math/bits" + "runtime" + + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/dsp" + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +// intSignShiftDec is the right-shift count that splats an int's sign +// bit across every position (-1 for negatives, 0 otherwise) — the +// building block for branchless abs / clamp / sign-mask helpers in the +// decoder hot paths. +const intSignShiftDec = bits.UintSize - 1 + +var ErrPostProcessBufferTooSmall = errors.New("govpx: VP8 postprocess buffer too small") + +const ( + DefaultPostProcessDeblockingLevel = 4 + + postProcessNoiseSeed = 1 +) + +type PostProcessOptions struct { + Deblock bool + Demacroblock bool + MFQE bool + AddNoise bool + DeblockingLevel int + NoiseLevel int + BaseQIndex int + CurrentFrame int + KeyFrame bool + // VP9 selects VP9-specific postprocess semantics. When set, the + // deblock strength q is derived as min(105, filter_level * 2) and + // the MFQE precondition follows libvpx vp9_post_proc_frame + // (last_base_qindex <= 170, cur - last >= 20, current >= 2). + // Otherwise the VP8 derivation min(filter_level * 10/6, 63) and + // VP8 MFQE precondition apply. + VP9 bool + // MFQEOverride, when non-nil and MFQE is engaged, replaces the + // default 16x16-MB MFQE walker. VP9 uses this to drive MFQE per + // VP9 SB partition (Block8x8..Block64x64) using its mode-info + // grid. The callback receives the same src/dst images and + // qcurr/qprev pair the internal walker would. + MFQEOverride MFQEWalker +} + +// MFQEWalker is the VP9 SB-partition-aware MFQE entry point. The +// implementation may freely traverse its own partition grid and call +// MultiframeQualityEnhanceBlock for each leaf block. +type MFQEWalker func(src *common.Image, dst *common.Image, keyFrame bool, qcurr int, qprev int) + +type PostProcessState struct { + generatedNoise []int8 + mfqeScratch common.FrameBuffer + noiseWidth int + lastQ int + lastNoise int + lastBaseQIndex int + clamp int + noiseReady bool + lastFrameValid bool + rand postProcessRand +} + +func (s *PostProcessState) EnsureNoise(width int) { + if s == nil || width <= 0 { + return + } + required := width + 256 + if cap(s.generatedNoise) < required { + s.generatedNoise = make([]int8, required) + s.noiseReady = false + } else { + s.generatedNoise = s.generatedNoise[:required] + } + if s.noiseWidth != width { + s.noiseWidth = width + s.noiseReady = false + } + if !s.rand.seeded { + s.rand.seed(postProcessNoiseSeed, defaultPostProcessRandFlavor()) + } +} + +func (s *PostProcessState) EnsureMFQE(width int, height int) error { + if s == nil || width <= 0 || height <= 0 { + return nil + } + return s.mfqeScratch.Resize(width, height, 32, 32) +} + +func (s *PostProcessState) Reset() { + if s == nil { + return + } + s.noiseReady = false + s.lastFrameValid = false + s.lastQ = 0 + s.lastNoise = 0 + s.lastBaseQIndex = 0 + s.clamp = 0 + s.rand.seed(postProcessNoiseSeed, defaultPostProcessRandFlavor()) + s.mfqeScratch.Reset() +} + +type postProcessRand struct { + flavor postProcessRandFlavor + seeded bool + state uint32 + glibcState [31]int32 + glibcF int + glibcR int +} + +func (r *postProcessRand) next() int { + if !r.seeded { + r.seed(postProcessNoiseSeed, defaultPostProcessRandFlavor()) + } + switch r.flavor { + case postProcessRandFlavorGlibc: + return r.nextGlibc() + case postProcessRandFlavorMinStd: + return r.nextMinStd() + default: + return r.nextANSI() + } +} + +type postProcessRandFlavor uint8 + +const ( + postProcessRandFlavorANSI postProcessRandFlavor = iota + postProcessRandFlavorGlibc + postProcessRandFlavorMinStd +) + +// libvpx ADDNOISE uses libc rand(), so checksum parity follows the libc used +// by the oracle build rather than a VP8-specified random stream. +func defaultPostProcessRandFlavor() postProcessRandFlavor { + switch runtime.GOOS { + case "linux": + return postProcessRandFlavorGlibc + case "darwin", "ios": + return postProcessRandFlavorMinStd + default: + return postProcessRandFlavorANSI + } +} + +func (r *postProcessRand) seed(seed int32, flavor postProcessRandFlavor) { + if seed == 0 { + seed = postProcessNoiseSeed + } + r.flavor = flavor + r.seeded = true + r.state = uint32(seed) + for i := range r.glibcState { + r.glibcState[i] = 0 + } + r.glibcF = 0 + r.glibcR = 0 + if flavor == postProcessRandFlavorGlibc { + r.seedGlibc(seed) + } +} + +func (r *postProcessRand) seedGlibc(seed int32) { + r.glibcState[0] = seed + word := int64(seed) + for i := 1; i < len(r.glibcState); i++ { + hi := word / 127773 + lo := word % 127773 + word = 16807*lo - 2836*hi + if word < 0 { + word += 2147483647 + } + r.glibcState[i] = int32(word) + } + r.glibcF = 3 + r.glibcR = 0 + for range 10 * len(r.glibcState) { + r.nextGlibc() + } +} + +func (r *postProcessRand) nextGlibc() int { + r.glibcState[r.glibcF] += r.glibcState[r.glibcR] + value := int(uint32(r.glibcState[r.glibcF]) >> 1) + r.glibcF++ + if r.glibcF == len(r.glibcState) { + r.glibcF = 0 + } + r.glibcR++ + if r.glibcR == len(r.glibcState) { + r.glibcR = 0 + } + return value +} + +func (r *postProcessRand) nextMinStd() int { + const ( + a = 16807 + m = 2147483647 + q = 127773 + p = 2836 + ) + state := int64(r.state) + if state <= 0 || state >= m { + state = postProcessNoiseSeed + } + state = a*(state%q) - p*(state/q) + if state <= 0 { + state += m + } + r.state = uint32(state) + return int(r.state) +} + +func (r *postProcessRand) nextANSI() int { + r.state = r.state*1103515245 + 12345 + return int((r.state >> 16) & 0x7fff) +} + +var postProcessRV = [...]int16{ + 8, 5, 2, 2, 8, 12, 4, 9, 8, 3, 0, 3, 9, 0, 0, 0, 8, 3, 14, + 4, 10, 1, 11, 14, 1, 14, 9, 6, 12, 11, 8, 6, 10, 0, 0, 8, 9, 0, + 3, 14, 8, 11, 13, 4, 2, 9, 0, 3, 9, 6, 1, 2, 3, 14, 13, 1, 8, + 2, 9, 7, 3, 3, 1, 13, 13, 6, 6, 5, 2, 7, 11, 9, 11, 8, 7, 3, + 2, 0, 13, 13, 14, 4, 12, 5, 12, 10, 8, 10, 13, 10, 4, 14, 4, 10, 0, + 8, 11, 1, 13, 7, 7, 14, 6, 14, 13, 2, 13, 5, 4, 4, 0, 10, 0, 5, + 13, 2, 12, 7, 11, 13, 8, 0, 4, 10, 7, 2, 7, 2, 2, 5, 3, 4, 7, + 3, 3, 14, 14, 5, 9, 13, 3, 14, 3, 6, 3, 0, 11, 8, 13, 1, 13, 1, + 12, 0, 10, 9, 7, 6, 2, 8, 5, 2, 13, 7, 1, 13, 14, 7, 6, 7, 9, + 6, 10, 11, 7, 8, 7, 5, 14, 8, 4, 4, 0, 8, 7, 10, 0, 8, 14, 11, + 3, 12, 5, 7, 14, 3, 14, 5, 2, 6, 11, 12, 12, 8, 0, 11, 13, 1, 2, + 0, 5, 10, 14, 7, 8, 0, 4, 11, 0, 8, 0, 3, 10, 5, 8, 0, 11, 6, + 7, 8, 10, 7, 13, 9, 2, 5, 1, 5, 10, 2, 4, 3, 5, 6, 10, 8, 9, + 4, 11, 14, 0, 10, 0, 5, 13, 2, 12, 7, 11, 13, 8, 0, 4, 10, 7, 2, + 7, 2, 2, 5, 3, 4, 7, 3, 3, 14, 14, 5, 9, 13, 3, 14, 3, 6, 3, + 0, 11, 8, 13, 1, 13, 1, 12, 0, 10, 9, 7, 6, 2, 8, 5, 2, 13, 7, + 1, 13, 14, 7, 6, 7, 9, 6, 10, 11, 7, 8, 7, 5, 14, 8, 4, 4, 0, + 8, 7, 10, 0, 8, 14, 11, 3, 12, 5, 7, 14, 3, 14, 5, 2, 6, 11, 12, + 12, 8, 0, 11, 13, 1, 2, 0, 5, 10, 14, 7, 8, 0, 4, 11, 0, 8, 0, + 3, 10, 5, 8, 0, 11, 6, 7, 8, 10, 7, 13, 9, 2, 5, 1, 5, 10, 2, + 4, 3, 5, 6, 10, 8, 9, 4, 11, 14, 3, 8, 3, 7, 8, 5, 11, 4, 12, + 3, 11, 9, 14, 8, 14, 13, 4, 3, 1, 2, 14, 6, 5, 4, 4, 11, 4, 6, + 2, 1, 5, 8, 8, 12, 13, 5, 14, 10, 12, 13, 0, 9, 5, 5, 11, 10, 13, + 9, 10, 13, +} + +func ApplyPostProcessWithOptions(src *common.Image, dst *common.FrameBuffer, rows int, cols int, modes []MacroblockMode, filterLevel uint8, scratch []byte, opts PostProcessOptions, state *PostProcessState) error { + if src == nil || dst == nil || rows <= 0 || cols <= 0 || len(modes) < rows*cols || len(scratch) < cols*24 { + return ErrPostProcessBufferTooSmall + } + if !validPostProcessImage(src) || !validPostProcessImage(&dst.Img) { + return ErrPostProcessBufferTooSmall + } + if opts.AddNoise && (state == nil || len(state.generatedNoise) < src.Width+256) { + return ErrPostProcessBufferTooSmall + } + if opts.MFQE && state == nil { + return ErrPostProcessBufferTooSmall + } + if opts.MFQE && (opts.Deblock || opts.Demacroblock) && state.mfqeScratch.BufferLen() == 0 { + return ErrPostProcessBufferTooSmall + } + + q := postProcessQ(int(filterLevel), opts.VP9) + + yLimits := scratch[:cols*16] + uvLimits := scratch[cols*16 : cols*24] + if shouldApplyMFQE(opts, state) { + if opts.MFQEOverride != nil { + opts.MFQEOverride(src, &dst.Img, opts.KeyFrame, opts.BaseQIndex, state.lastBaseQIndex) + } else { + multiframeQualityEnhance(src, &dst.Img, rows, cols, modes, opts.KeyFrame, opts.BaseQIndex, state.lastBaseQIndex) + } + if opts.Deblock || opts.Demacroblock { + copyPostProcessImage(&state.mfqeScratch.Img, &dst.Img) + state.mfqeScratch.ExtendBorders() + runPostProcessFilters(&state.mfqeScratch.Img, &dst.Img, rows, cols, modes, q, yLimits, uvLimits, opts) + } + state.lastBaseQIndex = (3*state.lastBaseQIndex + opts.BaseQIndex) >> 2 + } else { + copyPostProcessImage(&dst.Img, src) + dst.ExtendBorders() + runPostProcessFilters(src, &dst.Img, rows, cols, modes, q, yLimits, uvLimits, opts) + if state != nil { + state.lastBaseQIndex = opts.BaseQIndex + } + } + if state != nil { + state.lastFrameValid = true + } + if opts.AddNoise { + applyPostProcessNoise(&dst.Img, q, opts.NoiseLevel, state) + } + return nil +} + +func shouldApplyMFQE(opts PostProcessOptions, state *PostProcessState) bool { + if !opts.MFQE || state == nil || !state.lastFrameValid { + return false + } + if opts.VP9 { + // libvpx vp9_post_proc_frame: VP9 MFQE triggers when + // current_video_frame >= 2, last_base_qindex <= 170, and + // base_qindex - last_base_qindex >= 20. + return opts.CurrentFrame >= 2 && + state.lastBaseQIndex <= 170 && + opts.BaseQIndex-state.lastBaseQIndex >= 20 + } + return opts.CurrentFrame > 10 && + state.lastBaseQIndex < 60 && + opts.BaseQIndex-state.lastBaseQIndex >= 20 +} + +// postProcessQ returns the deblock strength used by libvpx's postprocess +// chain. VP9 uses min(105, filter_level * 2) (vp9_post_proc_frame), VP8 +// uses min(filter_level * 10/6, 63) (vp8_post_proc_frame). +func postProcessQ(filterLevel int, vp9 bool) int { + if vp9 { + q := min(filterLevel*2, 105) + return q + } + return min(filterLevel*10/6, 63) +} + +func runPostProcessFilters(src *common.Image, dst *common.Image, rows int, cols int, modes []MacroblockMode, q int, yLimits []byte, uvLimits []byte, opts PostProcessOptions) { + if opts.Demacroblock { + filterQ := q + (opts.DeblockingLevel-5)*10 + deblockPostProcess(src, dst, rows, cols, modes, filterQ, yLimits, uvLimits, opts.VP9) + demacroblockPostProcess(dst, filterQ) + } else if opts.Deblock { + deblockPostProcess(src, dst, rows, cols, modes, q, yLimits, uvLimits, opts.VP9) + } +} + +func multiframeQualityEnhance(src *common.Image, dst *common.Image, rows int, cols int, modes []MacroblockMode, keyFrame bool, qcurr int, qprev int) { + for mbRow := range rows { + for mbCol := range cols { + index := mbRow*cols + mbCol + var mfqeMap [4]int + totmap := 0 + if keyFrame { + totmap = 4 + } else { + totmap = qualifyInterMFQEMacroblock(&modes[index], &mfqeMap) + } + + yOff := mbRow*16*src.YStride + mbCol*16 + uOff := mbRow*8*src.UStride + mbCol*8 + vOff := mbRow*8*src.VStride + mbCol*8 + ydOff := mbRow*16*dst.YStride + mbCol*16 + udOff := mbRow*8*dst.UStride + mbCol*8 + vdOff := mbRow*8*dst.VStride + mbCol*8 + + if totmap == 0 { + copyBlock(src.Y[yOff:], src.YStride, dst.Y[ydOff:], dst.YStride, 16, 16) + copyBlock(src.U[uOff:], src.UStride, dst.U[udOff:], dst.UStride, 8, 8) + copyBlock(src.V[vOff:], src.VStride, dst.V[vdOff:], dst.VStride, 8, 8) + continue + } + if totmap == 4 { + multiframeQualityEnhanceBlock(16, qcurr, qprev, + src.Y[yOff:], src.U[uOff:], src.V[vOff:], src.YStride, src.UStride, + dst.Y[ydOff:], dst.U[udOff:], dst.V[vdOff:], dst.YStride, dst.UStride) + continue + } + for i := range 2 { + for j := range 2 { + ySub := yOff + 8*(i*src.YStride+j) + uSub := uOff + 4*(i*src.UStride+j) + vSub := vOff + 4*(i*src.VStride+j) + ydSub := ydOff + 8*(i*dst.YStride+j) + udSub := udOff + 4*(i*dst.UStride+j) + vdSub := vdOff + 4*(i*dst.VStride+j) + if mfqeMap[i*2+j] != 0 { + multiframeQualityEnhanceBlock(8, qcurr, qprev, + src.Y[ySub:], src.U[uSub:], src.V[vSub:], src.YStride, src.UStride, + dst.Y[ydSub:], dst.U[udSub:], dst.V[vdSub:], dst.YStride, dst.UStride) + } else { + copyBlock(src.Y[ySub:], src.YStride, dst.Y[ydSub:], dst.YStride, 8, 8) + copyBlock(src.U[uSub:], src.UStride, dst.U[udSub:], dst.UStride, 4, 4) + copyBlock(src.V[vSub:], src.VStride, dst.V[vdSub:], dst.VStride, 4, 4) + } + } + } + } + } +} + +func qualifyInterMFQEMacroblock(mode *MacroblockMode, out *[4]int) int { + if mode.MBSkipCoeff { + out[0], out[1], out[2], out[3] = 1, 1, 1, 1 + return 4 + } + if mode.Mode == common.SplitMV { + ndx := [4][4]int{ + {0, 1, 4, 5}, + {2, 3, 6, 7}, + {8, 9, 12, 13}, + {10, 11, 14, 15}, + } + for i := range 4 { + out[i] = 1 + for j := 0; j < 4 && out[i] != 0; j++ { + mv := mode.BlockMV[ndx[i][j]] + if mv.Row > 2 || mv.Col > 2 { + out[i] = 0 + } + } + } + return out[0] + out[1] + out[2] + out[3] + } + ok := 0 + if mode.Mode > common.BPred && absInt16(mode.MV.Row) <= 2 && absInt16(mode.MV.Col) <= 2 { + ok = 1 + } + out[0], out[1], out[2], out[3] = ok, ok, ok, ok + return ok * 4 +} + +// ApplyMFQEIfactor exposes the per-block apply_ifactor kernel used by +// the VP9 SB-aware MFQE walker. Mirrors libvpx vp9_mfqe.c::apply_ifactor +// at v1.16.0: it filters Y/U/V at the same weight, where the weight is +// the libvpx "ifactor" scaled to MFQE_PRECISION = 4 (so weight ∈ [0, 16]). +// +// libvpx: vp9/common/vp9_mfqe.c:68 +func ApplyMFQEIfactor(blockSize int, weight int, + y []byte, yStride int, yd []byte, ydStride int, + u []byte, v []byte, uvStride int, + ud []byte, vd []byte, uvdStride int, +) { + applyMFQEIfactor(y, yStride, yd, ydStride, u, v, uvStride, ud, vd, uvdStride, blockSize, weight) +} + +func multiframeQualityEnhanceBlock(blockSize int, qcurr int, qprev int, y []byte, u []byte, v []byte, yStride int, uvStride int, yd []byte, ud []byte, vd []byte, ydStride int, uvdStride int) { + uvBlockSize := blockSize >> 1 + // pels and uvPels are the per-block divisors that turn an absolute + // SSE into "per-pixel" SSE. libvpx rounds to the nearest integer by + // adding (pels/2) before the >>log2(pels). + pelsLog2 := mfqeBlockLog2(blockSize) + uvPelsLog2 := mfqeBlockLog2(uvBlockSize) + pelsHalf := 1 << (pelsLog2 - 1) + uvPelsHalf := 1 << (uvPelsLog2 - 1) + + actd := (varianceAgainstZero(yd, ydStride, blockSize, blockSize) + pelsHalf) >> pelsLog2 + act := (varianceAgainstZero(y, yStride, blockSize, blockSize) + pelsHalf) >> pelsLog2 + sad := (mfqeSSE(y, yStride, yd, ydStride, blockSize) + pelsHalf) >> pelsLog2 + usad := (mfqeSSE(u, uvStride, ud, uvdStride, uvBlockSize) + uvPelsHalf) >> uvPelsLog2 + vsad := (mfqeSSE(v, uvStride, vd, uvdStride, uvBlockSize) + uvPelsHalf) >> uvPelsLog2 + + actRisk := actd > act*5 + thr := (qcurr - qprev) >> 4 + for x := actd >> 1; x != 0; x >>= 1 { + thr++ + } + for x := qprev >> 2; x != 0; x >>= 2 { + thr++ + } + thrSq := thr * thr + if sad < thrSq && 4*usad < thrSq && 4*vsad < thrSq && !actRisk { + sad = intSqrt(sad) + ifactor := (sad << 4) / thr + ifactor >>= ((qcurr - qprev) >> 5) + if ifactor != 0 { + applyMFQEIfactor(y, yStride, yd, ydStride, u, v, uvStride, ud, vd, uvdStride, blockSize, ifactor) + } + return + } + copyBlock(y, yStride, yd, ydStride, blockSize, blockSize) + copyBlock(u, uvStride, ud, uvdStride, uvBlockSize, uvBlockSize) + copyBlock(v, uvStride, vd, uvdStride, uvBlockSize, uvBlockSize) +} + +// mfqeBlockLog2 returns 2*log2(blockSize) — the log2 of the pixel +// count in a square blockSize x blockSize block. +func mfqeBlockLog2(blockSize int) int { + switch blockSize { + case 4: + return 4 + case 8: + return 6 + case 16: + return 8 + case 32: + return 10 + case 64: + return 12 + default: + // Fall back to a runtime computation for non-power-of-two + // sizes; mfqe always feeds power-of-two square blocks. + log := 0 + for x := blockSize * blockSize; x > 1; x >>= 1 { + log++ + } + return log + } +} + +// mfqeSSE dispatches the SSE accumulator to the right kernel for +// blockSize x blockSize squares. Sizes 4/8/16 use the VP8 DSP fast +// paths; larger sizes (32/64) fall back to a scalar SSE for parity +// with libvpx, which mirrors these block shapes through the variance +// SSE kernel as well. +func mfqeSSE(a []byte, aStride int, b []byte, bStride int, blockSize int) int { + switch blockSize { + case 4: + return dsp.SSE4x4(a, aStride, b, bStride) + case 8: + return dsp.SSE8x8(a, aStride, b, bStride) + case 16: + return dsp.SSE16x16(a, aStride, b, bStride) + default: + return mfqeSSEScalar(a, aStride, b, bStride, blockSize) + } +} + +func mfqeSSEScalar(a []byte, aStride int, b []byte, bStride int, blockSize int) int { + sum := 0 + for row := range blockSize { + aRow := a[row*aStride:] + bRow := b[row*bStride:] + for col := range blockSize { + d := int(aRow[col]) - int(bRow[col]) + sum += d * d + } + } + return sum +} + +func applyMFQEIfactor(y []byte, yStride int, yd []byte, ydStride int, u []byte, v []byte, uvStride int, ud []byte, vd []byte, uvdStride int, blockSize int, srcWeight int) { + uvBlockSize := blockSize >> 1 + filterByWeight(y, yStride, yd, ydStride, blockSize, srcWeight) + filterByWeight(u, uvStride, ud, uvdStride, uvBlockSize, srcWeight) + filterByWeight(v, uvStride, vd, uvdStride, uvBlockSize, srcWeight) +} + +func filterByWeight(src []byte, srcStride int, dst []byte, dstStride int, blockSize int, srcWeight int) { + dstWeight := (1 << 4) - srcWeight + roundingBit := 1 << 3 + for row := range blockSize { + srcRow := src[row*srcStride:] + dstRow := dst[row*dstStride:] + for col := range blockSize { + dstRow[col] = byte((int(srcRow[col])*srcWeight + int(dstRow[col])*dstWeight + roundingBit) >> 4) + } + } +} + +func varianceAgainstZero(src []byte, stride int, width int, height int) int { + sum := 0 + sse := 0 + for row := range height { + srcRow := src[row*stride:] + for col := range width { + v := int(srcRow[col]) + sum += v + sse += v * v + } + } + pixels := width * height + return sse - (sum*sum)/pixels +} + +func intSqrt(x int) int { + y := x + p := 1 + for y >>= 1; y != 0; y >>= 1 { + p++ + } + p >>= 1 + guess := 0 + for p >= 0 { + step := 1 << p + guess |= step + if x < guess*guess { + guess -= step + } + p-- + } + if guess*guess+guess+1 <= x { + return guess + 1 + } + return guess +} + +func copyBlock(src []byte, srcStride int, dst []byte, dstStride int, width int, height int) { + for row := range height { + copy(dst[row*dstStride:row*dstStride+width], src[row*srcStride:row*srcStride+width]) + } +} + +func absInt16(v int16) int { + // Branchless |v|: sign-extend to splat the sign bit, then + // (x^mask)-mask flips negatives without a conditional jump. + x := int(v) + mask := x >> intSignShiftDec + return (x ^ mask) - mask +} + +func validPostProcessImage(img *common.Image) bool { + if img.Width <= 0 || img.Height <= 0 || img.CodedWidth <= 0 || img.CodedHeight <= 0 { + return false + } + uvWidth, uvHeight := buffers.Chroma420Dimensions(img.Width, img.Height) + return img.YBorder >= 17 && img.UVBorder >= 9 && + len(img.YFull) != 0 && len(img.UFull) != 0 && len(img.VFull) != 0 && + img.YOrigin >= 0 && img.UOrigin >= 0 && img.VOrigin >= 0 && + img.YStride >= img.CodedWidth+2*img.YBorder && + img.UStride >= ((img.CodedWidth+1)>>1)+2*img.UVBorder && + img.VStride >= ((img.CodedWidth+1)>>1)+2*img.UVBorder && + len(img.Y) >= buffers.PlaneLen(img.YStride, img.CodedHeight, img.CodedWidth) && + len(img.U) >= buffers.PlaneLen(img.UStride, uvHeight, uvWidth) && + len(img.V) >= buffers.PlaneLen(img.VStride, uvHeight, uvWidth) +} + +func copyPostProcessImage(dst *common.Image, src *common.Image) { + copy(dst.Y, src.Y) + copy(dst.U, src.U) + copy(dst.V, src.V) +} + +func q2mbl(x int) int { + if x < 20 { + x = 20 + } + x = 50 + (x-50)*10/8 + return x * x / 3 +} + +func postProcessDeblockLevel(q int) int { + level := 0.00006*float64(q*q*q) - 0.0067*float64(q*q) + 0.306*float64(q) + 0.0065 + return int(level + 0.5) +} + +func deblockPostProcess(src *common.Image, dst *common.Image, rows int, cols int, modes []MacroblockMode, q int, yLimits []byte, uvLimits []byte, vp9 bool) { + ppl := postProcessDeblockLevel(q) + if ppl <= 0 || dst.Width < 8 || dst.Height < 8 { + copyPostProcessImage(dst, src) + return + } + + uvWidth := (dst.Width + 1) >> 1 + if vp9 { + // libvpx vp9_postproc.c:257 (vp9_deblock): memset the limit + // row to a flat ppl across the whole frame width. VP9 does + // NOT halve the limit on a skipped MB the way VP8 does + // (vp8/common/postproc.c:82). Fill once before the row loop. + fillBytes(yLimits[:cols*16], byte(ppl)) + fillBytes(uvLimits[:cols*8], byte(ppl)) + } + for mbRow := range rows { + if !vp9 { + // libvpx vp8/common/postproc.c:82-89 — per-MB ppl, halved + // when the MB has the skip-coeff flag. + for mbCol := range cols { + limit := byte(ppl) + if modes[mbRow*cols+mbCol].MBSkipCoeff { + limit = byte(ppl >> 1) + } + fillBytes(yLimits[mbCol*16:mbCol*16+16], limit) + fillBytes(uvLimits[mbCol*8:mbCol*8+8], limit) + } + } + + yStart := src.YOrigin + 16*mbRow*src.YStride + yDstStart := dst.YOrigin + 16*mbRow*dst.YStride + postProcDownAndAcrossMBRow(src.YFull, yStart, dst.YFull, yDstStart, src.YStride, dst.YStride, dst.Width, yLimits, 16) + + if uvWidth >= 8 { + uStart := src.UOrigin + 8*mbRow*src.UStride + uDstStart := dst.UOrigin + 8*mbRow*dst.UStride + vStart := src.VOrigin + 8*mbRow*src.VStride + vDstStart := dst.VOrigin + 8*mbRow*dst.VStride + postProcDownAndAcrossMBRow(src.UFull, uStart, dst.UFull, uDstStart, src.UStride, dst.UStride, uvWidth, uvLimits, 8) + postProcDownAndAcrossMBRow(src.VFull, vStart, dst.VFull, vDstStart, src.VStride, dst.VStride, uvWidth, uvLimits, 8) + } + } +} + +func demacroblockPostProcess(img *common.Image, q int) { + level := q2mbl(q) + mbPostProcAcrossIP(img.YFull, img.YOrigin, img.YStride, img.Height, img.Width, level) + mbPostProcDown(img.YFull, img.YOrigin, img.YStride, img.Height, img.Width, level) +} + +func fillBytes(dst []byte, value byte) { + for i := range dst { + dst[i] = value + } +} + +func applyPostProcessNoise(img *common.Image, q int, noiseLevel int, state *PostProcessState) { + if !state.noiseReady || state.lastQ != q || state.lastNoise != noiseLevel { + sigma := float64(noiseLevel) + 0.5 + 0.6*float64(q)/63.0 + state.clamp = setupPostProcessNoise(sigma, state.generatedNoise, &state.rand) + state.lastQ = q + state.lastNoise = noiseLevel + state.noiseReady = true + } + planeAddNoise(img.Y, state.generatedNoise, state.clamp, state.clamp, img.Width, img.Height, img.YStride, &state.rand) +} + +func setupPostProcessNoise(sigma float64, noise []int8, rand *postProcessRand) int { + var charDist [256]int8 + next := 0 + for i := -32; i < 32; i++ { + a := int(0.5 + 256*gaussian(sigma, 0, float64(i))) + if a == 0 { + continue + } + for j := range a { + if next+j >= len(charDist) { + goto setNoise + } + charDist[next+j] = int8(i) + } + next += a + } + for ; next < len(charDist); next++ { + charDist[next] = 0 + } + +setNoise: + for i := range noise { + noise[i] = charDist[rand.next()&0xff] + } + return -int(charDist[0]) +} + +func gaussian(sigma float64, mu float64, x float64) float64 { + return 1 / (sigma * math.Sqrt(2.0*3.14159265)) * + math.Exp(-(x-mu)*(x-mu)/(2*sigma*sigma)) +} + +func planeAddNoise(start []byte, noise []int8, blackClamp int, whiteClamp int, width int, height int, pitch int, rand *postProcessRand) { + bothClamp := blackClamp + whiteClamp + for row := range height { + rowStart := row * pitch + refStart := rand.next() & 0xff + for col := range width { + v := int(start[rowStart+col]) + v = clampPostProcessByte(v - blackClamp) + v = clampPostProcessByte(v + bothClamp) + v = clampPostProcessByte(v - whiteClamp) + start[rowStart+col] = byte(v + int(noise[refStart+col])) + } + } +} + +func clampPostProcessByte(v int) int { + return min(max(v, 0), 255) +} + +func postProcDownAndAcrossMBRow(src []byte, srcStart int, dst []byte, dstStart int, srcPitch int, dstPitch int, cols int, flimits []byte, size int) { + for row := range size { + srcRow := srcStart + row*srcPitch + dstRow := dstStart + row*dstPitch + + for col := range cols { + v := src[srcRow+col] + limit := int(flimits[col]) + if byteDiff(v, src[srcRow+col-2*srcPitch]) < limit && + byteDiff(v, src[srcRow+col-srcPitch]) < limit && + byteDiff(v, src[srcRow+col+srcPitch]) < limit && + byteDiff(v, src[srcRow+col+2*srcPitch]) < limit { + k1 := (int(src[srcRow+col-2*srcPitch]) + int(src[srcRow+col-srcPitch]) + 1) >> 1 + k2 := (int(src[srcRow+col+2*srcPitch]) + int(src[srcRow+col+srcPitch]) + 1) >> 1 + k3 := (k1 + k2 + 1) >> 1 + v = byte((k3 + int(v) + 1) >> 1) + } + dst[dstRow+col] = v + } + + dst[dstRow-2] = dst[dstRow] + dst[dstRow-1] = dst[dstRow] + dst[dstRow+cols] = dst[dstRow+cols-1] + dst[dstRow+cols+1] = dst[dstRow+cols-1] + + var delayed [4]byte + for col := range cols { + v := dst[dstRow+col] + limit := int(flimits[col]) + if byteDiff(v, dst[dstRow+col-2]) < limit && + byteDiff(v, dst[dstRow+col-1]) < limit && + byteDiff(v, dst[dstRow+col+1]) < limit && + byteDiff(v, dst[dstRow+col+2]) < limit { + k1 := (int(dst[dstRow+col-2]) + int(dst[dstRow+col-1]) + 1) >> 1 + k2 := (int(dst[dstRow+col+2]) + int(dst[dstRow+col+1]) + 1) >> 1 + k3 := (k1 + k2 + 1) >> 1 + v = byte((k3 + int(v) + 1) >> 1) + } + delayed[col&3] = v + if col >= 2 { + dst[dstRow+col-2] = delayed[(col-2)&3] + } + } + dst[dstRow+cols-2] = delayed[(cols-2)&3] + dst[dstRow+cols-1] = delayed[(cols-1)&3] + } +} + +func mbPostProcAcrossIP(plane []byte, start int, pitch int, rows int, cols int, flimit int) { + for row := range rows { + rowStart := start + row*pitch + sumsq := 16 + sum := 0 + var delayed [16]byte + + for i := -8; i < 0; i++ { + plane[rowStart+i] = plane[rowStart] + } + for i := range 17 { + plane[rowStart+i+cols] = plane[rowStart+cols-1] + } + for i := -8; i <= 6; i++ { + v := int(plane[rowStart+i]) + sumsq += v * v + sum += v + delayed[i+8] = 0 + } + for col := 0; col < cols+8; col++ { + x := int(plane[rowStart+col+7]) - int(plane[rowStart+col-8]) + y := int(plane[rowStart+col+7]) + int(plane[rowStart+col-8]) + sum += x + sumsq += x * y + delayed[col&15] = plane[rowStart+col] + if sumsq*15-sum*sum < flimit { + delayed[col&15] = byte((8 + sum + int(plane[rowStart+col])) >> 4) + } + plane[rowStart+col-8] = delayed[(col-8)&15] + } + } +} + +func mbPostProcDown(plane []byte, start int, pitch int, rows int, cols int, flimit int) { + for col := range cols { + s := start + col + sumsq := 0 + sum := 0 + var delayed [16]byte + + for i := -8; i < 0; i++ { + plane[s+i*pitch] = plane[s] + } + for i := range 17 { + plane[s+(i+rows)*pitch] = plane[s+(rows-1)*pitch] + } + for i := -8; i <= 6; i++ { + v := int(plane[s+i*pitch]) + sumsq += v * v + sum += v + } + for row := 0; row < rows+8; row++ { + next := int(plane[s+7*pitch]) + prev := int(plane[s-8*pitch]) + sumsq += next*next - prev*prev + sum += next - prev + delayed[row&15] = plane[s] + if sumsq*15-sum*sum < flimit { + delayed[row&15] = byte((int(postProcessRV[(row&127)+(col&7)]) + sum + int(plane[s])) >> 4) + } + if row >= 8 { + plane[s-8*pitch] = delayed[(row-8)&15] + } + s += pitch + } + } +} + +func byteDiff(a byte, b byte) int { + diff := int(a) - int(b) + mask := diff >> intSignShiftDec + return (diff ^ mask) - mask +} diff --git a/internal/vp8/decoder/probability.go b/internal/vp8/decoder/probability.go new file mode 100644 index 0000000..2aea6a8 --- /dev/null +++ b/internal/vp8/decoder/probability.go @@ -0,0 +1,83 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/probability.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +// Ported from libvpx v1.16.0: +// - vp8/decoder/decodeframe.c +// - vp8/common/coefupdateprobs.h + +type CoefficientProbabilityHeader struct { + UpdateCount int + IndependentPartitions bool +} + +const coefProbsFlatLen = tables.BlockTypes * tables.CoefBands * tables.PrevCoefContexts * tables.EntropyNodes + +// coefUpdateProbsFlat is a flat copy of tables.CoefUpdateProbs used by the +// hot coefficient probability update header reader. +var coefUpdateProbsFlat = func() [coefProbsFlatLen]uint8 { + var out [coefProbsFlatLen]uint8 + idx := 0 + for t := range tables.BlockTypes { + for b := range tables.CoefBands { + for c := range tables.PrevCoefContexts { + for n := range tables.EntropyNodes { + out[idx] = tables.CoefUpdateProbs[t][b][c][n] + idx++ + } + } + } + } + return out +}() + +func parseCoefficientProbabilityHeaderInto(br *boolcoder.Decoder, probs *tables.CoefficientProbs) CoefficientProbabilityHeader { + var dstBuf [coefProbsFlatLen]uint8 + var dst []uint8 + if probs != nil { + idx := 0 + for t := range tables.BlockTypes { + for b := range tables.CoefBands { + for c := range tables.PrevCoefContexts { + copy(dstBuf[idx:idx+tables.EntropyNodes], probs[t][b][c][:]) + idx += tables.EntropyNodes + } + } + } + dst = dstBuf[:] + } + updateCount, nonDefault := br.ReadCoefUpdateProbsInto( + coefUpdateProbsFlat[:], + dst, + tables.EntropyNodes, + tables.PrevCoefContexts, + ) + if probs != nil && updateCount > 0 { + idx := 0 + for t := range tables.BlockTypes { + for b := range tables.CoefBands { + for c := range tables.PrevCoefContexts { + copy(probs[t][b][c][:], dstBuf[idx:idx+tables.EntropyNodes]) + idx += tables.EntropyNodes + } + } + } + } + return CoefficientProbabilityHeader{ + UpdateCount: updateCount, + IndependentPartitions: !nonDefault, + } +} diff --git a/internal/vp8/decoder/quant.go b/internal/vp8/decoder/quant.go new file mode 100644 index 0000000..c11b771 --- /dev/null +++ b/internal/vp8/decoder/quant.go @@ -0,0 +1,60 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/quant.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import "github.com/go-avkit/vpx/internal/vp8/boolcoder" + +// Ported from libvpx v1.16.0 vp8/decoder/decodeframe.c quantizer header +// parsing. + +type QuantHeader struct { + BaseQIndex uint8 + + Y1DCDelta int8 + Y2DCDelta int8 + Y2ACDelta int8 + UVDCDelta int8 + UVACDelta int8 + + Updated bool +} + +func parseQuantHeader(br *boolcoder.Decoder, prev QuantHeader) QuantHeader { + h := prev + h.BaseQIndex = uint8(br.ReadLiteral(7)) + h.Updated = false + + h.Y1DCDelta = readDeltaQ(br, prev.Y1DCDelta, &h.Updated) + h.Y2DCDelta = readDeltaQ(br, prev.Y2DCDelta, &h.Updated) + h.Y2ACDelta = readDeltaQ(br, prev.Y2ACDelta, &h.Updated) + h.UVDCDelta = readDeltaQ(br, prev.UVDCDelta, &h.Updated) + h.UVACDelta = readDeltaQ(br, prev.UVACDelta, &h.Updated) + return h +} + +func readDeltaQ(br *boolcoder.Decoder, prev int8, updated *bool) int8 { + value := int8(0) + if br.ReadBit() != 0 { + value = readSignedLiteral(br, 4) + } + if value != prev { + *updated = true + } + return value +} + +func readSignedLiteral(br *boolcoder.Decoder, bits int) int8 { + value := int8(br.ReadLiteral(bits)) + if br.ReadBit() != 0 { + value = -value + } + return value +} diff --git a/internal/vp8/decoder/reconstruct.go b/internal/vp8/decoder/reconstruct.go new file mode 100644 index 0000000..8ee6015 --- /dev/null +++ b/internal/vp8/decoder/reconstruct.go @@ -0,0 +1,1049 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/reconstruct.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "encoding/binary" + "errors" + "github.com/go-avkit/vpx/internal/pixel" + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/dsp" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +var ( + ErrReconstructGridBufferTooSmall = errors.New("govpx: VP8 reconstruction grid buffer too small") + ErrUnsupportedIntraReconstructionMode = errors.New("govpx: unsupported VP8 intra reconstruction mode") + ErrUnsupportedInterReconstructionMode = errors.New("govpx: unsupported VP8 inter reconstruction mode") +) + +type MacroblockResidual struct { + DQCoeff [25 * 16]int16 +} + +type IntraPredictorRefs struct { + YAbove []byte + YLeft []byte + UAbove []byte + ULeft []byte + VAbove []byte + VLeft []byte + + YTopLeft byte + UTopLeft byte + VTopLeft byte + + UpAvailable bool + LeftAvailable bool +} + +type IntraPredictorScratch struct { + YAbove [20]byte + YLeft [16]byte + UAbove [8]byte + ULeft [8]byte + VAbove [8]byte + VLeft [8]byte +} + +type IntraReconstructionScratch struct { + Refs IntraPredictorScratch + Residual MacroblockResidual +} + +func (r *MacroblockResidual) Block(index int) *[16]int16 { + return (*[16]int16)(r.DQCoeff[index*16 : index*16+16]) +} + +func BuildIntraPredictorRefs(img *common.Image, mbRow int, mbCol int, scratch *IntraPredictorScratch) IntraPredictorRefs { + yRow := mbRow * 16 + yCol := mbCol * 16 + uvRow := mbRow * 8 + uvCol := mbCol * 8 + upAvailable := mbRow > 0 + leftAvailable := mbCol > 0 + codedWidth := codedImageWidth(img) + codedHeight := codedImageHeight(img) + + buildAbove(scratch.YAbove[:], img.Y, img.YFull, img.YOrigin, img.YStride, codedWidth, yRow, yCol, img.YBorder, upAvailable) + buildLeft(scratch.YLeft[:], img.Y, img.YFull, img.YOrigin, img.YStride, codedHeight, yRow, yCol, img.YBorder, leftAvailable) + uvWidth := (codedWidth + 1) >> 1 + uvHeight := (codedHeight + 1) >> 1 + buildAbove(scratch.UAbove[:], img.U, img.UFull, img.UOrigin, img.UStride, uvWidth, uvRow, uvCol, img.UVBorder, upAvailable) + buildLeft(scratch.ULeft[:], img.U, img.UFull, img.UOrigin, img.UStride, uvHeight, uvRow, uvCol, img.UVBorder, leftAvailable) + buildAbove(scratch.VAbove[:], img.V, img.VFull, img.VOrigin, img.VStride, uvWidth, uvRow, uvCol, img.UVBorder, upAvailable) + buildLeft(scratch.VLeft[:], img.V, img.VFull, img.VOrigin, img.VStride, uvHeight, uvRow, uvCol, img.UVBorder, leftAvailable) + + return IntraPredictorRefs{ + YAbove: scratch.YAbove[:], + YLeft: scratch.YLeft[:], + UAbove: scratch.UAbove[:], + ULeft: scratch.ULeft[:], + VAbove: scratch.VAbove[:], + VLeft: scratch.VLeft[:], + YTopLeft: topLeftSample(img.Y, img.YFull, img.YOrigin, img.YStride, yRow, yCol, img.YBorder, upAvailable, leftAvailable), + UTopLeft: topLeftSample(img.U, img.UFull, img.UOrigin, img.UStride, uvRow, uvCol, img.UVBorder, upAvailable, leftAvailable), + VTopLeft: topLeftSample(img.V, img.VFull, img.VOrigin, img.VStride, uvRow, uvCol, img.UVBorder, upAvailable, leftAvailable), + UpAvailable: upAvailable, + LeftAvailable: leftAvailable, + } +} + +func transformMacroblockTokensLuma(tokens *MacroblockTokens, dequant *common.MacroblockDequant, is4x4 bool, out *MacroblockResidual) { + hasY2 := !is4x4 && tokens.EOB[24] > 0 + if hasY2 { + clearYResidualBlocks(out) + var y2 [16]int16 + if tokens.EOB[24] > 1 { + dsp.DequantizeBlockDisjoint(&tokens.QCoeff[24], &dequant.Y2, &y2) + dsp.InverseWalsh4x4(&y2, out.DQCoeff[:]) + } else { + y2[0] = tokens.QCoeff[24][0] * dequant.Y2[0] + dsp.DCOnlyInverseWalsh4x4(y2[0], out.DQCoeff[:]) + } + } + + yDequant := &dequant.Y1 + if !is4x4 { + yDequant = &dequant.Y1DC + } + for i := range 16 { + eob := tokens.EOB[i] + if eob == 0 { + continue + } + block := out.Block(i) + if !hasY2 { + if eob == 1 { + block[0] = 0 + } else { + clearResidualBlock(block) + } + } + dequantizeInto(&tokens.QCoeff[i], yDequant, eob, block) + } +} + +// dequantIDCTAddMacroblock is the fused dequant+IDCT+add path used by the +// decoder reconstruction hot paths. It mirrors libvpx v1.16.0 +// vp8/decoder/decodeframe.c decode_macroblock composed with +// vp8/common/arm/neon/idct_blk_neon.c vp8_dequant_idct_add_y_block_neon and +// vp8_dequant_idct_add_uv_block_neon: for non-4x4 macroblocks the inverse +// Walsh transform seeds the per-block DC coefficients directly into +// qcoeff[i*16] (dequant.Y1DC[0] == 1 preserves them through the fused +// multiply), and the residual is then dequantized and transformed in +// horizontally adjacent block pairs straight from the token coefficients — +// no intermediate residual buffer. +func dequantIDCTAddMacroblock(tokens *MacroblockTokens, dequant *common.MacroblockDequant, is4x4 bool, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int) { + dequantIDCTAddMacroblockRaw(&tokens.QCoeff, &tokens.EOB, 0, dequant, is4x4, y, yStride, u, uStride, v, vStride) +} + +// dequantIDCTAddMacroblockRaw is the buffer-level core of +// dequantIDCTAddMacroblock: it consumes a raw qcoeff/eob pair (both the +// decoder MacroblockTokens and the encoder MacroblockCoefficients layouts) +// plus an explicit luma EOB floor. The decoder token reader already applies +// the +skipDC promotion when it records luma EOBs for second-order +// macroblocks, so decoder callers pass floor 0; encoder callers reading the +// quantizer output directly pass floor 1 for non-4x4 macroblocks, which is +// the same promotion ConvertMacroblockCoefficients applied when it staged +// tokens (max(eob, 1) on the 16 luma blocks). +func dequantIDCTAddMacroblockRaw(qcoeff *[25][16]int16, eob *[25]uint8, lumaEOBFloor uint8, dequant *common.MacroblockDequant, is4x4 bool, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int) { + if !is4x4 && eob[24] > 0 { + e0 := binary.LittleEndian.Uint64(eob[0:8]) + e1 := binary.LittleEndian.Uint64(eob[8:16]) + if (e0|e1)&0xFEFEFEFEFEFEFEFE == 0 { + if eob[24] == 1 { + dc := (qcoeff[24][0]*dequant.Y2[0] + 3) >> 3 + delta := (int(int32(dc)*int32(dequant.Y1DC[0])) + 4) >> 3 + if delta != 0 { + pixel.AddConstant16x16InPlace(y, yStride, delta) + } + dequantIDCTAddChromaBlocks(qcoeff, eob, &dequant.UV, u, uStride, v, vStride) + return + } + if dequant.Y1DC[0] == 1 { + if !pixel.DequantWalshAddLumaDC16x16InPlace(y, yStride, &qcoeff[24], &dequant.Y2) { + var y2, dcs [16]int16 + dsp.DequantizeBlockDisjoint(&qcoeff[24], &dequant.Y2, &y2) + dsp.InverseWalsh4x4To16(&y2, &dcs) + pixel.AddLumaDC16x16InPlace(y, yStride, &dcs) + } + dequantIDCTAddChromaBlocks(qcoeff, eob, &dequant.UV, u, uStride, v, vStride) + return + } + } + } + yDequant := &dequant.Y1 + seeded := false + if !is4x4 { + yDequant = &dequant.Y1DC + if eob[24] > 0 { + seedLumaDCFromY2(qcoeff, eob, dequant) + seeded = true + } + } + dequantIDCTAddLumaBlocks(qcoeff, eob, lumaEOBFloor, yDequant, seeded, y, yStride) + if seeded { + unseedLumaDC(qcoeff) + } + dequantIDCTAddChromaBlocks(qcoeff, eob, &dequant.UV, u, uStride, v, vStride) +} + +// seedLumaDCFromY2 mirrors libvpx decode_macroblock's second-order handling: +// vp8_short_inv_walsh4x4 (or the DC-only variant) writes the 16 per-block DC +// values into the luma coefficient blocks at stride 16 (dequant.Y1DC[0] == 1 +// carries them through the fused multiply unchanged, exactly as libvpx). +func seedLumaDCFromY2(qcoeff *[25][16]int16, eob *[25]uint8, dequant *common.MacroblockDequant) { + if eob[24] > 1 { + var y2 [16]int16 + dsp.DequantizeBlockDisjoint(&qcoeff[24], &dequant.Y2, &y2) + dsp.InverseWalsh4x4ToLumaDC(&y2, qcoeff) + } else { + dc := (qcoeff[24][0]*dequant.Y2[0] + 3) >> 3 + for i := range 16 { + qcoeff[i][0] = dc + } + } +} + +// unseedLumaDC restores the luma DC coefficient slots to their token-decode +// state after the fused reconstruction consumed the seeded Walsh DCs. Under +// the second-order transform the token pass never writes position 0 +// (skip_dc), so the original value is always zero; zeroing keeps the tokens +// pristine for callers that reconstruct the same coefficients more than once +// (encoder analysis) and keeps the dirty-mask clearing contract unchanged. +func unseedLumaDC(qcoeff *[25][16]int16) { + for i := range 16 { + qcoeff[i][0] = 0 + } +} + +// dequantIDCTAddLumaBlocks mirrors vp8_dequant_idct_add_y_block_neon: the 16 +// luma blocks dispatch in horizontally adjacent pairs. A pair with any +// EOB > 1 runs the full fused kernel (int16 wrapping dequant of both +// blocks); otherwise the DC-only pair path applies ((q*dq)+4)>>3 computed in +// int precision, matching idct_dequant_0_2x_neon. +func dequantIDCTAddLumaBlocks(qcoeff *[25][16]int16, eob *[25]uint8, eobFloor uint8, yDequant *[16]int16, seeded bool, y []byte, yStride int) { + for row := range 4 { + rowBlock := row * 4 + rowOff := row * 4 * yStride + for col := 0; col < 4; col += 2 { + b := rowBlock + col + eob0 := max(eob[b], eobFloor) + eob1 := max(eob[b+1], eobFloor) + if eob0 == 0 && eob1 == 0 { + continue + } + off := rowOff + col*4 + if eob0 > 1 && eob1 > 1 { + dsp.DequantIDCTAddFull2xBlocks(&qcoeff[b], &qcoeff[b+1], yDequant, y[off:], yStride) + continue + } + if eob0 > 1 { + dsp.DequantIDCTAddFull1x(&qcoeff[b], yDequant, y[off:], yStride) + if eob1 != 0 || seeded { + dc1 := int32(qcoeff[b+1][0]) * int32(yDequant[0]) + dsp.DCOnlyIDCT4x4AddInt32(dc1, y[off+4:], yStride, y[off+4:], yStride) + } + continue + } + if eob1 > 1 { + if eob0 != 0 || seeded { + dc0 := int32(qcoeff[b][0]) * int32(yDequant[0]) + dsp.DCOnlyIDCT4x4AddInt32(dc0, y[off:], yStride, y[off:], yStride) + } + dsp.DequantIDCTAddFull1x(&qcoeff[b+1], yDequant, y[off+4:], yStride) + continue + } + var dc0, dc1 int32 + if eob0 != 0 || seeded { + dc0 = int32(qcoeff[b][0]) * int32(yDequant[0]) + } + if eob1 != 0 || seeded { + dc1 = int32(qcoeff[b+1][0]) * int32(yDequant[0]) + } + if pixel.DCPairNative { + dsp.DCOnlyIDCT4x4AddPairInPlaceInt32(dc0, dc1, y[off:], yStride) + } else { + dsp.DCOnlyIDCT4x4AddPairInt32(dc0, dc1, y[off:], yStride, y[off:], yStride) + } + } + } +} + +// dequantIDCTAddChromaBlocks mirrors vp8_dequant_idct_add_uv_block_neon: +// chroma dispatches in the pairs (16,17), (18,19), (20,21), (22,23) with the +// same full-vs-DC pair policy as luma. +func dequantIDCTAddChromaBlocks(qcoeff *[25][16]int16, eob *[25]uint8, uvDequant *[16]int16, u []byte, uStride int, v []byte, vStride int) { + dequantIDCTAddChromaPair(qcoeff, eob, uvDequant, 16, u, uStride) + dequantIDCTAddChromaPair(qcoeff, eob, uvDequant, 18, u[4*uStride:], uStride) + dequantIDCTAddChromaPair(qcoeff, eob, uvDequant, 20, v, vStride) + dequantIDCTAddChromaPair(qcoeff, eob, uvDequant, 22, v[4*vStride:], vStride) +} + +func dequantIDCTAddChromaPair(qcoeff *[25][16]int16, eob *[25]uint8, uvDequant *[16]int16, b int, dst []byte, stride int) { + eob0 := eob[b] + eob1 := eob[b+1] + if eob0 == 0 && eob1 == 0 { + return + } + if eob0 > 1 && eob1 > 1 { + dsp.DequantIDCTAddFull2xBlocks(&qcoeff[b], &qcoeff[b+1], uvDequant, dst, stride) + return + } + if eob0 > 1 { + dsp.DequantIDCTAddFull1x(&qcoeff[b], uvDequant, dst, stride) + if eob1 != 0 { + dc1 := int32(qcoeff[b+1][0]) * int32(uvDequant[0]) + dsp.DCOnlyIDCT4x4AddInt32(dc1, dst[4:], stride, dst[4:], stride) + } + return + } + if eob1 > 1 { + if eob0 != 0 { + dc0 := int32(qcoeff[b][0]) * int32(uvDequant[0]) + dsp.DCOnlyIDCT4x4AddInt32(dc0, dst, stride, dst, stride) + } + dsp.DequantIDCTAddFull1x(&qcoeff[b+1], uvDequant, dst[4:], stride) + return + } + var dc0, dc1 int32 + if eob0 != 0 { + dc0 = int32(qcoeff[b][0]) * int32(uvDequant[0]) + } + if eob1 != 0 { + dc1 = int32(qcoeff[b+1][0]) * int32(uvDequant[0]) + } + if pixel.DCPairNative { + dsp.DCOnlyIDCT4x4AddPairInPlaceInt32(dc0, dc1, dst, stride) + } else { + dsp.DCOnlyIDCT4x4AddPairInt32(dc0, dc1, dst, stride, dst, stride) + } +} + +func PredictIntraY16x16(mode common.MBPredictionMode, dst []byte, stride int, above []byte, left []byte, topLeft byte, upAvailable bool, leftAvailable bool) bool { + switch mode { + case common.DCPred: + dsp.IntraDCPredict16x16(dst, stride, above, left, upAvailable, leftAvailable) + case common.VPred: + dsp.IntraVerticalPredict16x16(dst, stride, above) + case common.HPred: + dsp.IntraHorizontalPredict16x16(dst, stride, left) + case common.TMPred: + dsp.IntraTMPredict16x16(dst, stride, above, left, topLeft) + default: + return false + } + return true +} + +func PredictIntraUV8x8(mode common.MBPredictionMode, dst []byte, stride int, above []byte, left []byte, topLeft byte, upAvailable bool, leftAvailable bool) bool { + switch mode { + case common.DCPred: + dsp.IntraDCPredict8x8(dst, stride, above, left, upAvailable, leftAvailable) + case common.VPred: + dsp.IntraVerticalPredict8x8(dst, stride, above) + case common.HPred: + dsp.IntraHorizontalPredict8x8(dst, stride, left) + case common.TMPred: + dsp.IntraTMPredict8x8(dst, stride, above, left, topLeft) + default: + return false + } + return true +} + +func PredictIntraY4x4(modes *[16]common.BPredictionMode, dst []byte, stride int, above []byte, left []byte, topLeft byte) bool { + for block := range 16 { + if ok := predictIntraY4x4Block((*modes)[block], dst, stride, above, left, topLeft, block); !ok { + return false + } + } + return true +} + +func ReconstructWholeBlockIntraMacroblock(mode *MacroblockMode, tokens *MacroblockTokens, dequant *common.MacroblockDequant, refs IntraPredictorRefs, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int, scratch *MacroblockResidual) bool { + if mode.Is4x4 || mode.Mode == common.BPred { + return false + } + if !PredictIntraY16x16(mode.Mode, y, yStride, refs.YAbove, refs.YLeft, refs.YTopLeft, refs.UpAvailable, refs.LeftAvailable) { + return false + } + if !PredictIntraUV8x8(mode.UVMode, u, uStride, refs.UAbove, refs.ULeft, refs.UTopLeft, refs.UpAvailable, refs.LeftAvailable) { + return false + } + if !PredictIntraUV8x8(mode.UVMode, v, vStride, refs.VAbove, refs.VLeft, refs.VTopLeft, refs.UpAvailable, refs.LeftAvailable) { + return false + } + if mode.MBSkipCoeff { + return true + } + dequantIDCTAddMacroblock(tokens, dequant, false, y, yStride, u, uStride, v, vStride) + return true +} + +func ReconstructIntraMacroblock(mode *MacroblockMode, tokens *MacroblockTokens, dequant *common.MacroblockDequant, refs IntraPredictorRefs, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int, scratch *MacroblockResidual) bool { + if mode.Is4x4 || mode.Mode == common.BPred { + return ReconstructBPredIntraMacroblock(mode, tokens, dequant, refs, y, yStride, u, uStride, v, vStride, scratch) + } + return ReconstructWholeBlockIntraMacroblock(mode, tokens, dequant, refs, y, yStride, u, uStride, v, vStride, scratch) +} + +func ReconstructKeyFrameIntraGrid(img *common.Image, rows int, cols int, modes []MacroblockMode, tokens []MacroblockTokens, dequants *[common.MaxMBSegments]common.MacroblockDequant, scratch *IntraReconstructionScratch) error { + if rows < 0 || cols < 0 { + return ErrReconstructGridBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return ErrReconstructGridBufferTooSmall + } + required := rows * cols + if img == nil || dequants == nil || scratch == nil || len(modes) < required || len(tokens) < required { + return ErrReconstructGridBufferTooSmall + } + if !imageHasMacroblockGrid(img, rows, cols) { + return ErrReconstructGridBufferTooSmall + } + + for row := range rows { + if err := reconstructKeyFrameIntraGridRow(img, row, cols, modes, tokens, dequants, scratch); err != nil { + return err + } + } + return nil +} + +func reconstructKeyFrameIntraGridRow(img *common.Image, row int, cols int, modes []MacroblockMode, tokens []MacroblockTokens, dequants *[common.MaxMBSegments]common.MacroblockDequant, scratch *IntraReconstructionScratch) error { + yRow := row * 16 * img.YStride + uRow := row * 8 * img.UStride + vRow := row * 8 * img.VStride + for col := range cols { + index := row*cols + col + mode := &modes[index] + if mode.SegmentID >= common.MaxMBSegments { + return ErrUnsupportedIntraReconstructionMode + } + refs := BuildIntraPredictorRefs(img, row, col, &scratch.Refs) + yOff := yRow + col*16 + uOff := uRow + col*8 + vOff := vRow + col*8 + if !ReconstructIntraMacroblock(mode, &tokens[index], &(*dequants)[mode.SegmentID], refs, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual) { + return ErrUnsupportedIntraReconstructionMode + } + } + extendIntraRightEdgeForRow(img, row) + return nil +} + +func ReconstructInterFrameGridWithConfig(img *common.Image, last *common.Image, golden *common.Image, alt *common.Image, rows int, cols int, modes []MacroblockMode, tokens []MacroblockTokens, dequants *[common.MaxMBSegments]common.MacroblockDequant, scratch *IntraReconstructionScratch, cfg InterPredictionConfig) error { + if rows < 0 || cols < 0 { + return ErrReconstructGridBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return ErrReconstructGridBufferTooSmall + } + required := rows * cols + if img == nil || last == nil || golden == nil || alt == nil || dequants == nil || scratch == nil || len(modes) < required || len(tokens) < required { + return ErrReconstructGridBufferTooSmall + } + if !imageHasMacroblockGrid(img, rows, cols) || !imageHasMacroblockGrid(last, rows, cols) || !imageHasMacroblockGrid(golden, rows, cols) || !imageHasMacroblockGrid(alt, rows, cols) { + return ErrReconstructGridBufferTooSmall + } + + // Cache frame-level reference state once per reference image to + // amortize codedWidth/Height resolution, plane lookups, and + // origin/border math out of the per-MB inter-predictor builder. + lastState := newFrameInterRefState(last, cfg) + goldenState := newFrameInterRefState(golden, cfg) + altState := newFrameInterRefState(alt, cfg) + + for row := range rows { + if err := reconstructInterFrameGridRow(img, last, golden, alt, &lastState, &goldenState, &altState, row, cols, modes, tokens, dequants, scratch, cfg); err != nil { + return err + } + } + return nil +} + +func reconstructInterFrameGridRow(img *common.Image, last *common.Image, golden *common.Image, alt *common.Image, lastState *InterFrameRefState, goldenState *InterFrameRefState, altState *InterFrameRefState, row int, cols int, modes []MacroblockMode, tokens []MacroblockTokens, dequants *[common.MaxMBSegments]common.MacroblockDequant, scratch *IntraReconstructionScratch, cfg InterPredictionConfig) error { + yRow := row * 16 * img.YStride + uRow := row * 8 * img.UStride + vRow := row * 8 * img.VStride + rowBase := row * cols + rowModes := modes[rowBase : rowBase+cols] + rowTokens := tokens[rowBase : rowBase+cols] + for col := 0; col < cols; col++ { + mode := &rowModes[col] + if mode.SegmentID >= common.MaxMBSegments { + return ErrUnsupportedInterReconstructionMode + } + yOff := yRow + col*16 + uOff := uRow + col*8 + vOff := vRow + col*8 + if mode.RefFrame == common.IntraFrame { + refs := BuildIntraPredictorRefs(img, row, col, &scratch.Refs) + if !ReconstructIntraMacroblock(mode, &rowTokens[col], &(*dequants)[mode.SegmentID], refs, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual) { + return ErrUnsupportedInterReconstructionMode + } + continue + } + + var refState *InterFrameRefState + var ref *common.Image + switch mode.RefFrame { + case common.LastFrame: + refState = lastState + ref = last + case common.GoldenFrame: + refState = goldenState + ref = golden + case common.AltRefFrame: + refState = altState + ref = alt + default: + return ErrUnsupportedInterReconstructionMode + } + if ref != img && mode.Mode == common.ZeroMV && mode.MBSkipCoeff && !mode.Is4x4 && mode.MV.IsZero() { + run := zeroMVSkippedRunLength(rowModes, col, cols, mode.RefFrame) + if run > 1 { + if copyZeroMVInterMacroblockRunFast(refState, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, row, col, run) { + col += run - 1 + continue + } + } + if run == 1 && copyZeroMVInterMacroblockFast(refState, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, row, col) { + continue + } + } + if mode.Mode == common.SplitMV { + if !reconstructSplitMVInterMacroblockFast(refState, mode, &rowTokens[col], &(*dequants)[mode.SegmentID], img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual, row, col, cfg) { + return ErrUnsupportedInterReconstructionMode + } + continue + } + if !reconstructWholeMVInterMacroblockFast(refState, mode, &rowTokens[col], &(*dequants)[mode.SegmentID], img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual, row, col) { + return ErrUnsupportedInterReconstructionMode + } + } + extendIntraRightEdgeForRow(img, row) + return nil +} + +func zeroMVSkippedRunLength(rowModes []MacroblockMode, start int, cols int, ref common.MVReferenceFrame) int { + if start < 0 || start >= cols { + return 0 + } + // The caller already validated rowModes[start]. Start scanning at the next + // MB so the hot skipped-ZeroMV path does not re-check the current mode. + run := 1 + for col := start + 1; col < cols; col++ { + mode := &rowModes[col] + if mode.SegmentID >= common.MaxMBSegments || + mode.RefFrame != ref || + mode.Mode != common.ZeroMV || + mode.Is4x4 || + !mode.MBSkipCoeff || + !mode.MV.IsZero() { + break + } + run++ + } + return run +} + +type splitMVChromaVector struct { + row int + col int +} + +func referencePlane(visible []byte, full []byte, origin int, border int) ([]byte, int, int) { + if len(full) == 0 { + return visible, 0, 0 + } + return full, origin, border +} + +func wholeMVPlaneOffset(plane []byte, stride int, codedWidth int, codedHeight int, row int, col int, width int, height int, xOffset int, yOffset int, origin int, border int, cfg InterPredictionConfig) (int, bool) { + if xOffset|yOffset != 0 { + if cfg.UseBilinear { + width++ + height++ + } else { + row -= 2 + col -= 2 + width += 5 + height += 5 + } + } + if !imageHasReferenceBlock(plane, stride, codedWidth, codedHeight, row, col, width, height, origin, border) { + return 0, false + } + return origin + row*stride + col, true +} + +func predictSplitMVLuma8x4(plane []byte, planeStride int, codedWidth int, codedHeight int, + origin int, border int, dst []byte, dstStride int, mbRow int, mbCol int, + block int, mv MotionVector, cfg InterPredictionConfig, +) bool { + blockRow := block >> 2 + blockCol := block & 3 + srcRow := mbRow*16 + blockRow*4 + int(mv.Row>>3) + srcCol := mbCol*16 + blockCol*4 + int(mv.Col>>3) + xOffset := int(mv.Col) & 7 + yOffset := int(mv.Row) & 7 + offset, ok := wholeMVPlaneOffset(plane, planeStride, codedWidth, codedHeight, + srcRow, srcCol, 8, 4, xOffset, yOffset, origin, border, cfg) + if !ok { + return false + } + predictInter8x4(plane[offset:], planeStride, xOffset, yOffset, + dst[yBlockOffset(block, dstStride):], dstStride, cfg) + return true +} + +func predictSplitMVLuma8x8(plane []byte, planeStride int, codedWidth int, codedHeight int, + origin int, border int, dst []byte, dstStride int, mbRow int, mbCol int, + block int, mv MotionVector, cfg InterPredictionConfig, +) bool { + blockRow := block >> 2 + blockCol := block & 3 + srcRow := mbRow*16 + blockRow*4 + int(mv.Row>>3) + srcCol := mbCol*16 + blockCol*4 + int(mv.Col>>3) + xOffset := int(mv.Col) & 7 + yOffset := int(mv.Row) & 7 + offset, ok := wholeMVPlaneOffset(plane, planeStride, codedWidth, codedHeight, + srcRow, srcCol, 8, 8, xOffset, yOffset, origin, border, cfg) + if !ok { + return false + } + predictInter8x8(plane[offset:], planeStride, xOffset, yOffset, + dst[yBlockOffset(block, dstStride):], dstStride, cfg) + return true +} + +func predictSplitMVChroma8x4(plane []byte, planeStride int, codedWidth int, codedHeight int, + origin int, border int, dst []byte, dstStride int, mbRow int, mbCol int, + block int, mv splitMVChromaVector, cfg InterPredictionConfig, +) bool { + blockRow := block >> 1 + blockCol := block & 1 + srcRow := mbRow*8 + blockRow*4 + (mv.row >> 3) + srcCol := mbCol*8 + blockCol*4 + (mv.col >> 3) + xOffset := mv.col & 7 + yOffset := mv.row & 7 + offset, ok := wholeMVPlaneOffset(plane, planeStride, codedWidth, codedHeight, + srcRow, srcCol, 8, 4, xOffset, yOffset, origin, border, cfg) + if !ok { + return false + } + predictInter8x4(plane[offset:], planeStride, xOffset, yOffset, + dst[uvBlockOffset(block, dstStride):], dstStride, cfg) + return true +} + +func predictInter8x8(src []byte, srcStride int, xOffset int, yOffset int, dst []byte, dstStride int, cfg InterPredictionConfig) { + if xOffset|yOffset == 0 { + dsp.Copy8x8(src, srcStride, dst, dstStride) + return + } + if cfg.UseBilinear { + dsp.BilinearPredict8x8(src, srcStride, xOffset, yOffset, dst, dstStride) + return + } + dsp.SixTapPredict8x8(src, srcStride, xOffset, yOffset, dst, dstStride) +} + +func predictInter8x4(src []byte, srcStride int, xOffset int, yOffset int, dst []byte, dstStride int, cfg InterPredictionConfig) { + if xOffset|yOffset == 0 { + dsp.Copy8x4(src, srcStride, dst, dstStride) + return + } + if cfg.UseBilinear { + dsp.BilinearPredict8x4(src, srcStride, xOffset, yOffset, dst, dstStride) + return + } + dsp.SixTapPredict8x4(src, srcStride, xOffset, yOffset, dst, dstStride) +} + +func predictInter4x4(src []byte, srcStride int, xOffset int, yOffset int, dst []byte, dstStride int, cfg InterPredictionConfig) { + if xOffset|yOffset == 0 { + copyInter4x4(src, srcStride, dst, dstStride) + return + } + if cfg.UseBilinear { + dsp.BilinearPredict4x4(src, srcStride, xOffset, yOffset, dst, dstStride) + return + } + dsp.SixTapPredict4x4(src, srcStride, xOffset, yOffset, dst, dstStride) +} + +func copyInter4x4(src []byte, srcStride int, dst []byte, dstStride int) { + for row := range 4 { + copy(dst[row*dstStride:row*dstStride+4], src[row*srcStride:row*srcStride+4]) + } +} + +func splitChromaMotionVector(mode *MacroblockMode, block int) (int, int) { + yBlock := (block>>1)*8 + (block&1)*2 + row := splitChromaMotionVectorComponent( + mode.BlockMV[yBlock].Row, + mode.BlockMV[yBlock+1].Row, + mode.BlockMV[yBlock+4].Row, + mode.BlockMV[yBlock+5].Row, + ) + col := splitChromaMotionVectorComponent( + mode.BlockMV[yBlock].Col, + mode.BlockMV[yBlock+1].Col, + mode.BlockMV[yBlock+4].Col, + mode.BlockMV[yBlock+5].Col, + ) + return row, col +} + +func splitChromaMotionVectorComponent(a int16, b int16, c int16, d int16) int { + sum := int(a) + int(b) + int(c) + int(d) + // Branchless rounding away from zero by 4 before the /8: sign-mask + // flips +4 to -4 when sum is negative. + mask := sum >> intSignShiftDec + return (sum + 4 + 8*mask) / 8 +} + +func fullPixelChromaMotionVector(row int, col int, cfg InterPredictionConfig) (int, int) { + if !cfg.FullPixel { + return row, col + } + return row &^ 7, col &^ 7 +} + +func macroblockMotionVectorEdges(mbRow int, mbCol int, codedWidth int, codedHeight int) (int, int, int, int) { + mbRows := codedHeight >> 4 + mbCols := codedWidth >> 4 + top := -(mbRow * 16) << 3 + bottom := (mbRows - 1 - mbRow) * 16 << 3 + left := -(mbCol * 16) << 3 + right := (mbCols - 1 - mbCol) * 16 << 3 + return top, bottom, left, right +} + +func clampUMVComponent(v int, lowEdge int, highEdge int) int { + if v < lowEdge-(19<<3) { + return lowEdge - (16 << 3) + } + if v > highEdge+(18<<3) { + return highEdge + (16 << 3) + } + return v +} + +func clampChromaUMVComponent(v int, lowEdge int, highEdge int) int { + if 2*v < lowEdge-(19<<3) { + return (lowEdge - (16 << 3)) >> 1 + } + if 2*v > highEdge+(18<<3) { + return (highEdge + (16 << 3)) >> 1 + } + return v +} + +func ReconstructBPredIntraMacroblock(mode *MacroblockMode, tokens *MacroblockTokens, dequant *common.MacroblockDequant, refs IntraPredictorRefs, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int, scratch *MacroblockResidual) bool { + if !mode.Is4x4 || mode.Mode != common.BPred { + return false + } + if !PredictIntraUV8x8(mode.UVMode, u, uStride, refs.UAbove, refs.ULeft, refs.UTopLeft, refs.UpAvailable, refs.LeftAvailable) { + return false + } + if !PredictIntraUV8x8(mode.UVMode, v, vStride, refs.VAbove, refs.VLeft, refs.VTopLeft, refs.UpAvailable, refs.LeftAvailable) { + return false + } + if mode.MBSkipCoeff { + return PredictIntraY4x4(&mode.BModes, y, yStride, refs.YAbove, refs.YLeft, refs.YTopLeft) + } + + transformMacroblockTokensLuma(tokens, dequant, true, scratch) + for block := range 16 { + if ok := predictIntraY4x4Block(mode.BModes[block], y, yStride, refs.YAbove, refs.YLeft, refs.YTopLeft, block); !ok { + return false + } + if eob := tokens.EOB[block]; eob != 0 { + if eob == 1 { + dc := int32(tokens.QCoeff[block][0]) * int32(dequant.Y1[0]) + dsp.DCOnlyIDCT4x4AddInt32(dc, y[yBlockOffset(block, yStride):], yStride, y[yBlockOffset(block, yStride):], yStride) + } else { + addTransformBlock(eob, scratch.Block(block), y[yBlockOffset(block, yStride):], yStride) + } + } + } + dequantIDCTAddChromaBlocks(&tokens.QCoeff, &tokens.EOB, &dequant.UV, u, uStride, v, vStride) + return true +} + +func clearYResidualBlocks(out *MacroblockResidual) { + clear(out.DQCoeff[:16*16]) +} + +func clearResidualBlock(block *[16]int16) { + *block = [16]int16{} +} + +func dequantizeInto(qcoeff *[16]int16, dequant *[16]int16, eob uint8, out *[16]int16) { + if eob == 1 { + out[0] += qcoeff[0] * dequant[0] + return + } + limit := min(int(eob), 16) + for i := range limit { + index := int(tables.DefaultZigZag1D[i]) + out[index] += qcoeff[index] * dequant[index] + } +} + +func extendIntraRightEdgeForRow(img *common.Image, mbRow int) { + if img == nil { + return + } + codedWidth := codedImageWidth(img) + codedHeight := codedImageHeight(img) + extendIntraRightEdgeRows(img.YFull, img.YOrigin, img.YStride, codedWidth, codedHeight, img.YBorder, mbRow*16+14, 2) + + uvWidth := (codedWidth + 1) >> 1 + uvHeight := (codedHeight + 1) >> 1 + extendIntraRightEdgeRows(img.UFull, img.UOrigin, img.UStride, uvWidth, uvHeight, img.UVBorder, mbRow*8+6, 2) + extendIntraRightEdgeRows(img.VFull, img.VOrigin, img.VStride, uvWidth, uvHeight, img.UVBorder, mbRow*8+6, 2) +} + +func extendIntraRightEdgeRows(full []byte, origin int, stride int, width int, height int, border int, startRow int, count int) { + if len(full) == 0 || origin < 0 || stride <= 0 || width <= 0 || height <= 0 || border < 4 || count <= 0 { + return + } + if stride < width+border { + return + } + for i := range count { + row := startRow + i + if uint(row) >= uint(height) { + continue + } + start := origin + row*stride + width + if start <= 0 || start+4 > len(full) { + continue + } + edge := full[start-1] + full[start+0] = edge + full[start+1] = edge + full[start+2] = edge + full[start+3] = edge + } +} + +func buildAbove(out []byte, plane []byte, full []byte, origin int, stride int, width int, row int, col int, border int, available bool) { + if !available { + for i := range out { + out[i] = 127 + } + return + } + if hasFullIntraSampleRange(full, origin, stride, width, border, row-1, col, len(out)) { + copy(out, full[origin+(row-1)*stride+col:]) + return + } + src := (row-1)*stride + col + for i := range out { + if col+i < width { + out[i] = plane[src+i] + } else { + out[i] = 127 + } + } +} + +func buildLeft(out []byte, plane []byte, full []byte, origin int, stride int, height int, row int, col int, border int, available bool) { + if !available { + for i := range out { + out[i] = 129 + } + return + } + if hasFullIntraVerticalRange(full, origin, stride, height, border, row, col-1, len(out)) { + src := origin + row*stride + col - 1 + for i := range out { + out[i] = full[src+i*stride] + } + return + } + src := row*stride + col - 1 + for i := range out { + if row+i < height { + out[i] = plane[src+i*stride] + } else { + out[i] = 129 + } + } +} + +func topLeftSample(plane []byte, full []byte, origin int, stride int, row int, col int, border int, upAvailable bool, leftAvailable bool) byte { + if !upAvailable { + return 127 + } + if !leftAvailable { + return 129 + } + if hasFullIntraSampleRange(full, origin, stride, col, border, row-1, col-1, 1) { + return full[origin+(row-1)*stride+col-1] + } + return plane[(row-1)*stride+col-1] +} + +func hasFullIntraSampleRange(full []byte, origin int, stride int, width int, border int, row int, col int, count int) bool { + if count < 0 || len(full) == 0 || origin < 0 || stride <= 0 || border <= 0 || row < 0 || col < 0 { + return false + } + if col+count > width+border { + return false + } + start := origin + row*stride + col + return start >= 0 && start+count <= len(full) +} + +func hasFullIntraVerticalRange(full []byte, origin int, stride int, height int, border int, row int, col int, count int) bool { + if count < 0 || len(full) == 0 || origin < 0 || stride <= 0 || border <= 0 || row < 0 || col < 0 { + return false + } + if row+count > height+border { + return false + } + start := origin + row*stride + col + return start >= 0 && start+(count-1)*stride < len(full) +} + +func imageHasMacroblockGrid(img *common.Image, rows int, cols int) bool { + if img.YStride <= 0 || img.UStride <= 0 || img.VStride <= 0 { + return false + } + yWidth := cols * 16 + yHeight := rows * 16 + uvWidth := cols * 8 + uvHeight := rows * 8 + if codedImageWidth(img) < yWidth || codedImageHeight(img) < yHeight { + return false + } + return planeHasBlock(img.Y, img.YStride, yWidth, yHeight) && + planeHasBlock(img.U, img.UStride, uvWidth, uvHeight) && + planeHasBlock(img.V, img.VStride, uvWidth, uvHeight) +} + +func planeHasBlock(plane []byte, stride int, width int, height int) bool { + if width < 0 || height < 0 || stride < width { + return false + } + if height == 0 { + return true + } + need := (height-1)*stride + width + return need <= len(plane) +} + +func imageHasReferenceBlock(plane []byte, stride int, codedWidth int, codedHeight int, row int, col int, width int, height int, origin int, border int) bool { + if width < 0 || height < 0 || border < 0 || origin < 0 || stride < codedWidth+border*2 { + return false + } + if width > codedWidth+border*2 || height > codedHeight+border*2 { + return false + } + if row < -border || col < -border { + return false + } + if col > codedWidth+border-width || row > codedHeight+border-height { + return false + } + if height == 0 { + return true + } + start := origin + row*stride + col + if start < 0 { + return false + } + need := start + (height-1)*stride + width + return need <= len(plane) +} + +func codedImageWidth(img *common.Image) int { + if img.CodedWidth > 0 { + return img.CodedWidth + } + return img.Width +} + +func codedImageHeight(img *common.Image) int { + if img.CodedHeight > 0 { + return img.CodedHeight + } + return img.Height +} + +func predictIntraY4x4Block(mode common.BPredictionMode, dst []byte, stride int, above []byte, left []byte, topLeft byte, block int) bool { + blockRow := block >> 2 + blockCol := block & 3 + y := blockRow * 4 + x := blockCol * 4 + var blockAbove [8]byte + var blockLeft [4]byte + + if blockRow == 0 { + copy(blockAbove[:], above[x:x+8]) + } else { + aboveOff := (y-1)*stride + x + copy(blockAbove[:4], dst[aboveOff:aboveOff+4]) + if blockCol < 3 { + copy(blockAbove[4:], dst[aboveOff+4:aboveOff+8]) + } else { + copy(blockAbove[4:], above[16:20]) + } + } + + if blockCol == 0 { + copy(blockLeft[:], left[y:y+4]) + } else { + for i := range 4 { + blockLeft[i] = dst[(y+i)*stride+x-1] + } + } + + blockTopLeft := topLeft + switch { + case blockRow == 0 && blockCol == 0: + case blockRow == 0: + blockTopLeft = above[x-1] + case blockCol == 0: + blockTopLeft = left[y-1] + default: + blockTopLeft = dst[(y-1)*stride+x-1] + } + + return dsp.Intra4x4Predict(dst[y*stride+x:], stride, mode, blockAbove[:], blockLeft[:], blockTopLeft) +} + +func addTransformBlock(eob uint8, coeff *[16]int16, dst []byte, stride int) { + if eob == 0 { + return + } + if eob == 1 { + dsp.DCOnlyIDCT4x4Add(coeff[0], dst, stride, dst, stride) + return + } + dsp.IDCT4x4Add(coeff, dst, stride, dst, stride) +} + +func yBlockOffset(block int, stride int) int { + return (block>>2)*4*stride + (block&3)*4 +} + +func uvBlockOffset(block int, stride int) int { + return (block>>1)*4*stride + (block&1)*4 +} diff --git a/internal/vp8/decoder/reconstruct_inter_fast.go b/internal/vp8/decoder/reconstruct_inter_fast.go new file mode 100644 index 0000000..354263c --- /dev/null +++ b/internal/vp8/decoder/reconstruct_inter_fast.go @@ -0,0 +1,499 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/reconstruct_inter_fast.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/dsp" +) + +// InterFrameRefState caches per-reference-frame plane addresses, +// strides, borders, and coded dimensions so the inner loop only does +// per-MB work. Built once per ReconstructInterFrameGridWithConfig +// reference image. +type InterFrameRefState struct { + ready bool + + yPlane []byte + uPlane []byte + vPlane []byte + + yStride int + uStride int + vStride int + + yOrigin int + uOrigin int + vOrigin int + yBorder int + uvBorder int + + codedWidth int + codedHeight int + + uvWidth int + uvHeight int + + mbRows int + mbCols int + + // Cached bounds limits used by imageHasReferenceBlock. These are + // constant per-reference and per-plane so we evaluate them once + // and re-use across all 3600 macroblocks of a 720p frame. + yMaxRowFor16 int // codedHeight + yBorder - 16 + yMaxColFor16 int // codedWidth + yBorder - 16 + yMaxRowFor21 int // codedHeight + yBorder - 21 + yMaxColFor21 int // codedWidth + yBorder - 21 + yMaxRowFor17 int // codedHeight + yBorder - 17 (bilinear) + yMaxColFor17 int // codedWidth + yBorder - 17 (bilinear) + yMinRow int // -yBorder + yMinCol int // -yBorder + uvMaxRowFor8 int + uvMaxColFor8 int + uvMaxRowFor13 int + uvMaxColFor13 int + uvMaxRowFor9 int + uvMaxColFor9 int + uvMinRow int + uvMinCol int + + useBilinear bool + fullPixel bool +} + +func newFrameInterRefState(ref *common.Image, cfg InterPredictionConfig) InterFrameRefState { + yPlane, yOrigin, yBorder := referencePlane(ref.Y, ref.YFull, ref.YOrigin, ref.YBorder) + uPlane, uOrigin, uvBorder := referencePlane(ref.U, ref.UFull, ref.UOrigin, ref.UVBorder) + vPlane, vOrigin, _ := referencePlane(ref.V, ref.VFull, ref.VOrigin, ref.UVBorder) + cw := codedImageWidth(ref) + ch := codedImageHeight(ref) + uvW := (cw + 1) >> 1 + uvH := (ch + 1) >> 1 + return InterFrameRefState{ + ready: true, + yPlane: yPlane, + uPlane: uPlane, + vPlane: vPlane, + yStride: ref.YStride, + uStride: ref.UStride, + vStride: ref.VStride, + yOrigin: yOrigin, + uOrigin: uOrigin, + vOrigin: vOrigin, + yBorder: yBorder, + uvBorder: uvBorder, + codedWidth: cw, + codedHeight: ch, + uvWidth: uvW, + uvHeight: uvH, + mbRows: ch >> 4, + mbCols: cw >> 4, + + yMaxRowFor16: ch + yBorder - 16, + yMaxColFor16: cw + yBorder - 16, + yMaxRowFor21: ch + yBorder - 21, + yMaxColFor21: cw + yBorder - 21, + yMaxRowFor17: ch + yBorder - 17, + yMaxColFor17: cw + yBorder - 17, + yMinRow: -yBorder, + yMinCol: -yBorder, + uvMaxRowFor8: uvH + uvBorder - 8, + uvMaxColFor8: uvW + uvBorder - 8, + uvMaxRowFor13: uvH + uvBorder - 13, + uvMaxColFor13: uvW + uvBorder - 13, + uvMaxRowFor9: uvH + uvBorder - 9, + uvMaxColFor9: uvW + uvBorder - 9, + uvMinRow: -uvBorder, + uvMinCol: -uvBorder, + + useBilinear: cfg.UseBilinear, + fullPixel: cfg.FullPixel, + } +} + +// reconstructWholeMVInterMacroblockFast is the fast-path equivalent of +// ReconstructWholeMVInterMacroblock for use inside the grid loop where +// precomputed reference state is available. Returns false on validation +// failure so the caller can fall back / surface the error. +// +//go:nosplit +func reconstructWholeMVInterMacroblockFast(state *InterFrameRefState, mode *MacroblockMode, tokens *MacroblockTokens, dequant *common.MacroblockDequant, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int, scratch *MacroblockResidual, mbRow int, mbCol int) bool { + if state == nil || !state.ready { + return false + } + // Validation gates are intentionally kept identical to the + // pre-existing ReconstructWholeMVInterMacroblock to ensure + // byte-identical behavior on inputs the slow path would reject. + if mode.RefFrame == common.IntraFrame || mode.Is4x4 || !common.IsWholeInterMacroblockMode(mode.Mode) { + return false + } + if mode.Mode == common.ZeroMV && !mode.MV.IsZero() { + return false + } + if mode.Mode == common.ZeroMV { + if !copyZeroMVInterMacroblockFast(state, y, yStride, u, uStride, v, vStride, mbRow, mbCol) { + return false + } + if mode.MBSkipCoeff { + return true + } + dequantIDCTAddMacroblock(tokens, dequant, false, y, yStride, u, uStride, v, vStride) + return true + } + + mvRow := int(mode.MV.Row) + mvCol := int(mode.MV.Col) + // libvpx v1.16.0 vp8/common/reconinter.c vp8_build_inter16x16_predictors_mb + // applies xd->fullpixel_mask ONLY to the chroma MV (lines 333-334) after + // the +1|sign / divide-by-2 derivation. The luma MV is consumed as-is by + // subpixel_predict16x16. We mirror that here: leave mvRow/mvCol untouched + // for luma, and apply &^=7 only inside the chroma derivation below. + // Inline clampMotionVectorToUMVBorder using the cached coded + // dimensions (and the precomputed mbRows/mbCols). Identical to + // macroblockMotionVectorEdges -> clampUMVComponent. + mbRows := state.mbRows + mbCols := state.mbCols + top := -(mbRow * 16) << 3 + bottom := (mbRows - 1 - mbRow) * 16 << 3 + left := -(mbCol * 16) << 3 + right := (mbCols - 1 - mbCol) * 16 << 3 + if mvRow < top-(19<<3) { + mvRow = top - (16 << 3) + } else if mvRow > bottom+(18<<3) { + mvRow = bottom + (16 << 3) + } + if mvCol < left-(19<<3) { + mvCol = left - (16 << 3) + } else if mvCol > right+(18<<3) { + mvCol = right + (16 << 3) + } + + // --- Y plane offset & predict --- + yMVRow := mvRow >> 3 + yMVCol := mvCol >> 3 + yXOffset := mvCol & 7 + yYOffset := mvRow & 7 + yRow := mbRow*16 + yMVRow + yCol := mbCol*16 + yMVCol + + // Fast bounds check using the per-frame cached limits. The + // reference frame state was constructed with positive width/height + // border/origin/stride relations validated; the only per-MB + // variables are the (potentially MV-shifted) row/col, plus the + // pre-known shape (16x16, 21x21 sixtap-tap window, or 17x17 + // bilinear window). + yRow2, yCol2 := yRow, yCol + var yMaxRow, yMaxCol int + if (yXOffset | yYOffset) == 0 { + yMaxRow = state.yMaxRowFor16 + yMaxCol = state.yMaxColFor16 + } else if state.useBilinear { + yMaxRow = state.yMaxRowFor17 + yMaxCol = state.yMaxColFor17 + } else { + yRow2 -= 2 + yCol2 -= 2 + yMaxRow = state.yMaxRowFor21 + yMaxCol = state.yMaxColFor21 + } + if yRow2 < state.yMinRow || yCol2 < state.yMinCol || yRow2 > yMaxRow || yCol2 > yMaxCol { + return false + } + yOff := state.yOrigin + yRow2*state.yStride + yCol2 + + // --- UV plane offset & predict --- + // chromaMotionVectorComponent inlined. (mv +/- 1) is folded into a + // single +1 with a sign-keyed -2 correction so the divide isn't + // gated by a branch: + // mask = -1 if mv<0 else 0; (mv + 1 + 2*mask) == (mv-1) when mv<0 + // and (mv+1) when mv>=0. + uvMVRow := (mvRow + 1 + 2*(mvRow>>intSignShiftDec)) / 2 + uvMVCol := (mvCol + 1 + 2*(mvCol>>intSignShiftDec)) / 2 + if state.fullPixel { + uvMVRow &^= 7 + uvMVCol &^= 7 + } + uvRow := mbRow*8 + (uvMVRow >> 3) + uvCol := mbCol*8 + (uvMVCol >> 3) + uvXOffset := uvMVCol & 7 + uvYOffset := uvMVRow & 7 + + // Fast UV bounds. The per-frame limits for 8/9/13-pixel windows + // are precomputed; chroma planes share dimensions, so one + // comparison set covers both U and V. Different strides between + // U and V are extremely rare; the explicit length-bound check + // later catches any plane that's smaller than expected. + uvRow2, uvCol2 := uvRow, uvCol + var uvMaxRow, uvMaxCol int + if (uvXOffset | uvYOffset) == 0 { + uvMaxRow = state.uvMaxRowFor8 + uvMaxCol = state.uvMaxColFor8 + } else if state.useBilinear { + uvMaxRow = state.uvMaxRowFor9 + uvMaxCol = state.uvMaxColFor9 + } else { + uvRow2 -= 2 + uvCol2 -= 2 + uvMaxRow = state.uvMaxRowFor13 + uvMaxCol = state.uvMaxColFor13 + } + if uvRow2 < state.uvMinRow || uvCol2 < state.uvMinCol || uvRow2 > uvMaxRow || uvCol2 > uvMaxCol { + return false + } + uOff := state.uOrigin + uvRow2*state.uStride + uvCol2 + vOff := state.vOrigin + uvRow2*state.vStride + uvCol2 + + // --- Predict (inlined dispatch). Hoisting useBilinear above the + // per-plane subpel branch lets the compiler share the table-load + // of state.useBilinear across the 3 dispatches. + ySrc := state.yPlane[yOff:] + uSrc := state.uPlane[uOff:] + vSrc := state.vPlane[vOff:] + if state.useBilinear { + if (yXOffset | yYOffset) == 0 { + dsp.Copy16x16(ySrc, state.yStride, y, yStride) + } else { + dsp.BilinearPredict16x16(ySrc, state.yStride, yXOffset, yYOffset, y, yStride) + } + if (uvXOffset | uvYOffset) == 0 { + dsp.Copy8x8(uSrc, state.uStride, u, uStride) + dsp.Copy8x8(vSrc, state.vStride, v, vStride) + } else { + dsp.BilinearPredict8x8Pair( + uSrc, state.uStride, + vSrc, state.vStride, + uvXOffset, uvYOffset, + u, uStride, + v, vStride, + ) + } + } else { + if (yXOffset | yYOffset) == 0 { + dsp.Copy16x16(ySrc, state.yStride, y, yStride) + } else { + dsp.SixTapPredict16x16(ySrc, state.yStride, yXOffset, yYOffset, y, yStride) + } + if (uvXOffset | uvYOffset) == 0 { + dsp.Copy8x8(uSrc, state.uStride, u, uStride) + dsp.Copy8x8(vSrc, state.vStride, v, vStride) + } else { + dsp.SixTapPredict8x8Pair( + uSrc, state.uStride, + vSrc, state.vStride, + uvXOffset, uvYOffset, + u, uStride, + v, vStride, + ) + } + } + + if mode.MBSkipCoeff { + return true + } + dequantIDCTAddMacroblock(tokens, dequant, false, y, yStride, u, uStride, v, vStride) + return true +} + +func reconstructSplitMVInterMacroblockFast(state *InterFrameRefState, mode *MacroblockMode, tokens *MacroblockTokens, dequant *common.MacroblockDequant, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int, scratch *MacroblockResidual, mbRow int, mbCol int, cfg InterPredictionConfig) bool { + if mode.RefFrame == common.IntraFrame || mode.Mode != common.SplitMV || !mode.Is4x4 { + return false + } + if mode.Partition < 3 { + for _, block := range [...]int{0, 2, 8, 10} { + mv := clampMotionVectorToUMVBorderFast(state, mode.BlockMV[block], mbRow, mbCol) + if !predictSplitMVLuma8x8(state.yPlane, state.yStride, state.codedWidth, state.codedHeight, + state.yOrigin, state.yBorder, y, yStride, mbRow, mbCol, block, mv, + cfg) { + return false + } + } + } else { + for block := 0; block < 16; block += 2 { + mv0 := clampMotionVectorToUMVBorderFast(state, mode.BlockMV[block], mbRow, mbCol) + mv1 := clampMotionVectorToUMVBorderFast(state, mode.BlockMV[block+1], mbRow, mbCol) + if mv0 == mv1 { + if !predictSplitMVLuma8x4(state.yPlane, state.yStride, state.codedWidth, state.codedHeight, + state.yOrigin, state.yBorder, y, yStride, mbRow, mbCol, block, mv0, + cfg) { + return false + } + continue + } + blockRow := block >> 2 + blockCol := block & 3 + srcRow := mbRow*16 + blockRow*4 + int(mv0.Row>>3) + srcCol := mbCol*16 + blockCol*4 + int(mv0.Col>>3) + xOffset := int(mv0.Col) & 7 + yOffset := int(mv0.Row) & 7 + offset, ok := wholeMVPlaneOffset(state.yPlane, state.yStride, state.codedWidth, state.codedHeight, + srcRow, srcCol, 4, 4, xOffset, yOffset, state.yOrigin, state.yBorder, cfg) + if !ok { + return false + } + predictInter4x4(state.yPlane[offset:], state.yStride, xOffset, yOffset, + y[yBlockOffset(block, yStride):], yStride, cfg) + + block1 := block + 1 + blockRow = block1 >> 2 + blockCol = block1 & 3 + srcRow = mbRow*16 + blockRow*4 + int(mv1.Row>>3) + srcCol = mbCol*16 + blockCol*4 + int(mv1.Col>>3) + xOffset = int(mv1.Col) & 7 + yOffset = int(mv1.Row) & 7 + offset, ok = wholeMVPlaneOffset(state.yPlane, state.yStride, state.codedWidth, state.codedHeight, + srcRow, srcCol, 4, 4, xOffset, yOffset, state.yOrigin, state.yBorder, cfg) + if !ok { + return false + } + predictInter4x4(state.yPlane[offset:], state.yStride, xOffset, yOffset, + y[yBlockOffset(block1, yStride):], yStride, cfg) + } + } + + if !predictSplitMVInterChromaFast(state, mode, u, uStride, v, vStride, mbRow, mbCol, cfg) { + return false + } + if mode.MBSkipCoeff { + return true + } + dequantIDCTAddMacroblock(tokens, dequant, true, y, yStride, u, uStride, v, vStride) + return true +} + +func predictSplitMVInterChromaFast(state *InterFrameRefState, mode *MacroblockMode, u []byte, uStride int, v []byte, vStride int, mbRow int, mbCol int, cfg InterPredictionConfig) bool { + var mv [4]splitMVChromaVector + for block := range mv { + mvRow, mvCol := splitChromaMotionVector(mode, block) + mvRow, mvCol = fullPixelChromaMotionVector(mvRow, mvCol, cfg) + mvRow, mvCol = clampChromaMotionVectorToUMVBorderFast(state, mvRow, mvCol, mbRow, mbCol) + mv[block] = splitMVChromaVector{row: mvRow, col: mvCol} + } + for block := 0; block < 4; block += 2 { + if mv[block] == mv[block+1] { + if !predictSplitMVChroma8x4(state.uPlane, state.uStride, state.uvWidth, state.uvHeight, + state.uOrigin, state.uvBorder, u, uStride, mbRow, mbCol, block, mv[block], + cfg) { + return false + } + if !predictSplitMVChroma8x4(state.vPlane, state.vStride, state.uvWidth, state.uvHeight, + state.vOrigin, state.uvBorder, v, vStride, mbRow, mbCol, block, mv[block], + cfg) { + return false + } + continue + } + for sub := block; sub <= block+1; sub++ { + blockRow := sub >> 1 + blockCol := sub & 1 + srcRow := mbRow*8 + blockRow*4 + (mv[sub].row >> 3) + srcCol := mbCol*8 + blockCol*4 + (mv[sub].col >> 3) + xOffset := mv[sub].col & 7 + yOffset := mv[sub].row & 7 + uOffset, ok := wholeMVPlaneOffset(state.uPlane, state.uStride, state.uvWidth, state.uvHeight, + srcRow, srcCol, 4, 4, xOffset, yOffset, state.uOrigin, state.uvBorder, cfg) + if !ok { + return false + } + vOffset, ok := wholeMVPlaneOffset(state.vPlane, state.vStride, state.uvWidth, state.uvHeight, + srcRow, srcCol, 4, 4, xOffset, yOffset, state.vOrigin, state.uvBorder, cfg) + if !ok { + return false + } + predictInter4x4(state.uPlane[uOffset:], state.uStride, xOffset, yOffset, + u[uvBlockOffset(sub, uStride):], uStride, cfg) + predictInter4x4(state.vPlane[vOffset:], state.vStride, xOffset, yOffset, + v[uvBlockOffset(sub, vStride):], vStride, cfg) + } + } + return true +} + +func clampMotionVectorToUMVBorderFast(state *InterFrameRefState, mv MotionVector, mbRow int, mbCol int) MotionVector { + top, bottom, left, right := macroblockMotionVectorEdgesFromGrid(mbRow, mbCol, state.mbRows, state.mbCols) + return MotionVector{ + Row: int16(clampUMVComponent(int(mv.Row), top, bottom)), + Col: int16(clampUMVComponent(int(mv.Col), left, right)), + } +} + +func clampChromaMotionVectorToUMVBorderFast(state *InterFrameRefState, row int, col int, mbRow int, mbCol int) (int, int) { + top, bottom, left, right := macroblockMotionVectorEdgesFromGrid(mbRow, mbCol, state.mbRows, state.mbCols) + return clampChromaUMVComponent(row, top, bottom), clampChromaUMVComponent(col, left, right) +} + +func macroblockMotionVectorEdgesFromGrid(mbRow int, mbCol int, mbRows int, mbCols int) (int, int, int, int) { + top := -(mbRow * 16) << 3 + bottom := (mbRows - 1 - mbRow) * 16 << 3 + left := -(mbCol * 16) << 3 + right := (mbCols - 1 - mbCol) * 16 << 3 + return top, bottom, left, right +} + +func copyZeroMVInterMacroblockFast(state *InterFrameRefState, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int, mbRow int, mbCol int) bool { + if uint(mbRow) >= uint(state.mbRows) || uint(mbCol) >= uint(state.mbCols) { + return false + } + yOff := state.yOrigin + mbRow*16*state.yStride + mbCol*16 + uOff := state.uOrigin + mbRow*8*state.uStride + mbCol*8 + vOff := state.vOrigin + mbRow*8*state.vStride + mbCol*8 + if !planeHasOffsetBlock(state.yPlane, yOff, state.yStride, 16, 16) || + !planeHasOffsetBlock(state.uPlane, uOff, state.uStride, 8, 8) || + !planeHasOffsetBlock(state.vPlane, vOff, state.vStride, 8, 8) || + !planeHasOffsetBlock(y, 0, yStride, 16, 16) || + !planeHasOffsetBlock(u, 0, uStride, 8, 8) || + !planeHasOffsetBlock(v, 0, vStride, 8, 8) { + return false + } + dsp.Copy16x16(state.yPlane[yOff:], state.yStride, y, yStride) + dsp.Copy8x8(state.uPlane[uOff:], state.uStride, u, uStride) + dsp.Copy8x8(state.vPlane[vOff:], state.vStride, v, vStride) + return true +} + +func copyZeroMVInterMacroblockRunFast(state *InterFrameRefState, y []byte, yStride int, u []byte, uStride int, v []byte, vStride int, mbRow int, mbCol int, mbCount int) bool { + if mbCount <= 0 || mbCount > state.mbCols || mbCol < 0 || mbCol > state.mbCols-mbCount || uint(mbRow) >= uint(state.mbRows) { + return false + } + yWidth := mbCount * 16 + uvWidth := mbCount * 8 + yOff := state.yOrigin + mbRow*16*state.yStride + mbCol*16 + uOff := state.uOrigin + mbRow*8*state.uStride + mbCol*8 + vOff := state.vOrigin + mbRow*8*state.vStride + mbCol*8 + if !planeHasOffsetBlock(state.yPlane, yOff, state.yStride, yWidth, 16) || + !planeHasOffsetBlock(state.uPlane, uOff, state.uStride, uvWidth, 8) || + !planeHasOffsetBlock(state.vPlane, vOff, state.vStride, uvWidth, 8) || + !planeHasOffsetBlock(y, 0, yStride, yWidth, 16) || + !planeHasOffsetBlock(u, 0, uStride, uvWidth, 8) || + !planeHasOffsetBlock(v, 0, vStride, uvWidth, 8) { + return false + } + copyPlaneRows(state.yPlane[yOff:], state.yStride, y, yStride, yWidth, 16) + copyPlaneRows(state.uPlane[uOff:], state.uStride, u, uStride, uvWidth, 8) + copyPlaneRows(state.vPlane[vOff:], state.vStride, v, vStride, uvWidth, 8) + return true +} + +func copyPlaneRows(src []byte, srcStride int, dst []byte, dstStride int, width int, height int) { + for y := range height { + copy(dst[y*dstStride:y*dstStride+width], src[y*srcStride:y*srcStride+width]) + } +} + +func planeHasOffsetBlock(plane []byte, offset int, stride int, width int, height int) bool { + if offset < 0 || width < 0 || height < 0 || stride < width { + return false + } + if height == 0 { + return true + } + need := offset + (height-1)*stride + width + return need >= offset && need <= len(plane) +} diff --git a/internal/vp8/decoder/references.go b/internal/vp8/decoder/references.go new file mode 100644 index 0000000..3a414a9 --- /dev/null +++ b/internal/vp8/decoder/references.go @@ -0,0 +1,72 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/references.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/common" +) + +// Ported from libvpx v1.16.0 vp8/decoder/decodeframe.c reference refresh +// header parsing. + +type RefreshHeader struct { + RefreshLast bool + RefreshGolden bool + RefreshAltRef bool + + CopyBufferToGolden int + CopyBufferToAltRef int + + GoldenSignBias bool + AltRefSignBias bool + + RefreshEntropyProbs bool +} + +// ApplyCorruptInterFrameRefresh mirrors libvpx v1.16.0 +// vp8/decoder/decodeframe.c error-concealment handling for a corrupt +// inter-frame header: leave only LAST refresh enabled and suppress entropy +// probability refresh. +func ApplyCorruptInterFrameRefresh(state *StateHeader) { + state.Refresh.RefreshGolden = false + state.Refresh.RefreshAltRef = false + state.Refresh.CopyBufferToGolden = 0 + state.Refresh.CopyBufferToAltRef = 0 + state.Refresh.RefreshEntropyProbs = false + state.Refresh.RefreshLast = true +} + +func parseRefreshHeader(br *boolcoder.Decoder, frame FrameHeader) RefreshHeader { + if frame.FrameType == common.KeyFrame { + return RefreshHeader{ + RefreshLast: true, + RefreshGolden: true, + RefreshAltRef: true, + RefreshEntropyProbs: br.ReadBit() != 0, + } + } + + var h RefreshHeader + h.RefreshGolden = br.ReadBit() != 0 + h.RefreshAltRef = br.ReadBit() != 0 + if !h.RefreshGolden { + h.CopyBufferToGolden = int(br.ReadLiteral(2)) + } + if !h.RefreshAltRef { + h.CopyBufferToAltRef = int(br.ReadLiteral(2)) + } + h.GoldenSignBias = br.ReadBit() != 0 + h.AltRefSignBias = br.ReadBit() != 0 + h.RefreshEntropyProbs = br.ReadBit() != 0 + h.RefreshLast = br.ReadBit() != 0 + return h +} diff --git a/internal/vp8/decoder/segmentation.go b/internal/vp8/decoder/segmentation.go new file mode 100644 index 0000000..7fd94e8 --- /dev/null +++ b/internal/vp8/decoder/segmentation.go @@ -0,0 +1,85 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/segmentation.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/common" +) + +// Ported from libvpx v1.16.0 vp8/decoder/decodeframe.c segmentation header +// parsing. + +type SegmentationHeader struct { + Enabled bool + UpdateMap bool + UpdateData bool + AbsDelta bool + + FeatureData [common.MBLvlMax][common.MaxMBSegments]int8 + TreeProbs [common.MBFeatureTreeProbs]uint8 +} + +func parseSegmentationHeader(br *boolcoder.Decoder) SegmentationHeader { + var h SegmentationHeader + h.Enabled = br.ReadBit() != 0 + if !h.Enabled { + return h + } + + h.UpdateMap = br.ReadBit() != 0 + h.UpdateData = br.ReadBit() != 0 + + if h.UpdateData { + h.AbsDelta = br.ReadBit() != 0 + for feature := range int(common.MBLvlMax) { + for segment := range common.MaxMBSegments { + if br.ReadBit() != 0 { + value := int8(br.ReadLiteral(int(mbFeatureDataBits[feature]))) + if br.ReadBit() != 0 { + value = -value + } + h.FeatureData[feature][segment] = value + } + } + } + } + + if h.UpdateMap { + for i := range h.TreeProbs { + h.TreeProbs[i] = 255 + } + for i := range h.TreeProbs { + if br.ReadBit() != 0 { + h.TreeProbs[i] = uint8(br.ReadLiteral(8)) + } + } + } + return h +} + +var mbFeatureDataBits = [common.MBLvlMax]uint8{7, 6} + +// MergeSegmentationHeader applies the libvpx v1.16.0 decoder carry-forward +// rules for VP8 inter-frame segmentation headers. +func MergeSegmentationHeader(previous SegmentationHeader, current SegmentationHeader) SegmentationHeader { + if !current.Enabled { + return current + } + if !current.UpdateData { + current.AbsDelta = previous.AbsDelta + current.FeatureData = previous.FeatureData + } + if !current.UpdateMap { + current.TreeProbs = previous.TreeProbs + } + return current +} diff --git a/internal/vp8/decoder/state.go b/internal/vp8/decoder/state.go new file mode 100644 index 0000000..e947aae --- /dev/null +++ b/internal/vp8/decoder/state.go @@ -0,0 +1,121 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/state.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +var ErrTruncatedStateHeader = errors.New("govpx: truncated VP8 state header") + +type StateHeader struct { + ColorSpace int + ClampType common.ClampType + + Segmentation SegmentationHeader + LoopFilter LoopFilterHeader + TokenPartition common.TokenPartition + Quant QuantHeader + Refresh RefreshHeader + Probability CoefficientProbabilityHeader + Mode ModeHeader +} + +func ParseStateHeaderFromFrameWithReaderAndProbsAndLoopFilter(packet []byte, frame FrameHeader, previousQuant QuantHeader, previousLoopFilter LoopFilterHeader, probs *tables.CoefficientProbs, modeProbs *ModeProbs) (FrameHeader, StateHeader, boolcoder.Decoder, error) { + return parseStateHeaderFromFrameWithReaderAndProbsAndLoopFilter(packet, frame, previousQuant, previousLoopFilter, probs, modeProbs, false) +} + +func ParseStateHeaderFromFrameWithErrorConcealment(packet []byte, frame FrameHeader, previousQuant QuantHeader, previousLoopFilter LoopFilterHeader, probs *tables.CoefficientProbs, modeProbs *ModeProbs) (FrameHeader, StateHeader, boolcoder.Decoder, bool, error) { + frame, state, br, err := parseStateHeaderFromFrameWithReaderAndProbsAndLoopFilter(packet, frame, previousQuant, previousLoopFilter, probs, modeProbs, true) + if err != nil { + return FrameHeader{}, StateHeader{}, boolcoder.Decoder{}, false, err + } + corrupted := br.Err() != nil + if corrupted && !frame.KeyFrame() { + ApplyCorruptInterFrameRefresh(&state) + } + return frame, state, br, corrupted, nil +} + +func parseStateHeaderFromFrameWithReaderAndProbsAndLoopFilter(packet []byte, frame FrameHeader, previousQuant QuantHeader, previousLoopFilter LoopFilterHeader, probs *tables.CoefficientProbs, modeProbs *ModeProbs, errorConcealment bool) (FrameHeader, StateHeader, boolcoder.Decoder, error) { + if len(packet) < frame.HeaderSize { + return FrameHeader{}, StateHeader{}, boolcoder.Decoder{}, ErrInvalidFrameHeader + } + firstPartitionEnd := frame.HeaderSize + frame.FirstPartitionSize + // libvpx (vp8/decoder/decodeframe.c) only rejects the first-partition + // length when it overflows or exceeds the remaining packet bytes: + // + // if (!pbi->ec_active && (data + first_partition_length_in_bytes > data_end || + // data + first_partition_length_in_bytes < data)) { + // vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME, + // "Truncated packet or corrupt partition 0 length"); + // } + // + // A first_partition_length_in_bytes of zero is legal: the bool + // decoder is initialized over (data_end - data) regardless, and the + // remaining state-header bits come from the token partitions below. + // Treating zero as an error would reject keyframes that libvpx decodes. + if frame.FirstPartitionSize < 0 || firstPartitionEnd < frame.HeaderSize || firstPartitionEnd > len(packet) { + if !errorConcealment || frame.FirstPartitionSize < 0 || firstPartitionEnd < frame.HeaderSize { + return FrameHeader{}, StateHeader{}, boolcoder.Decoder{}, ErrTruncatedStateHeader + } + firstPartitionEnd = len(packet) + } + + // libvpx (vp8/decoder/decodeframe.c vp8_decode_frame) initializes the + // first-partition bool decoder with the full remaining packet from + // `data` to `data_end`, not just the declared first_partition_size: + // + // vp8dx_start_decode(bc, data, (unsigned int)(data_end - data), …); + // + // Keeping bc bounded by first_partition_size would make govpx reject + // frames whose first-partition reader silently spills into the token + // partitions. + // Match libvpx: hand the bool decoder everything from HeaderSize on. + // firstPartitionEnd is still computed above for validation, and used + // downstream by ParsePartitionLayout to slice the token partitions. + _ = firstPartitionEnd + var br boolcoder.Decoder + if err := br.Init(packet[frame.HeaderSize:]); err != nil { + return FrameHeader{}, StateHeader{}, boolcoder.Decoder{}, err + } + + var state StateHeader + loopFilter := previousLoopFilter + if frame.KeyFrame() { + if probs != nil { + *probs = tables.DefaultCoefProbs + } + if modeProbs != nil { + ResetModeProbs(modeProbs) + } + loopFilter = LoopFilterHeader{} + state.ColorSpace = int(br.ReadBit()) + state.ClampType = common.ClampType(br.ReadBit()) + } + + state.Segmentation = parseSegmentationHeader(&br) + state.LoopFilter = parseLoopFilterHeaderWithPrevious(&br, loopFilter) + state.TokenPartition = common.TokenPartition(br.ReadLiteral(2)) + state.Quant = parseQuantHeader(&br, previousQuant) + state.Refresh = parseRefreshHeader(&br, frame) + state.Probability = parseCoefficientProbabilityHeaderInto(&br, probs) + state.Mode = parseModeHeaderInto(&br, frame.KeyFrame(), modeProbs) + + if br.Err() != nil && !errorConcealment { + return FrameHeader{}, StateHeader{}, boolcoder.Decoder{}, ErrTruncatedStateHeader + } + return frame, state, br, nil +} diff --git a/internal/vp8/decoder/streaminfo.go b/internal/vp8/decoder/streaminfo.go new file mode 100644 index 0000000..9454379 --- /dev/null +++ b/internal/vp8/decoder/streaminfo.go @@ -0,0 +1,46 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/streaminfo.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +// StreamInfo describes the VP8 frame-header fields that can be read without +// fully decoding a packet. +type StreamInfo struct { + // Width and Height are the visible coded dimensions carried by key frames. + // Inter frames reuse the current stream dimensions. + Width int + Height int + // Profile is the VP8 version_number field from the frame tag. The VP8 + // spec defines values 0..3; govpx accepts 4..7 for compatibility with + // libvpx but treats them as version 0. + Profile int + + // KeyFrame reports whether the packet is a VP8 key frame. + KeyFrame bool + // ShowFrame reports whether decoding the packet produces visible output. + ShowFrame bool + + // FirstPartitionSize is the VP8 first-partition byte count from the frame + // tag. + FirstPartitionSize int +} + +// StreamInfoFromFrameHeader converts an already-parsed VP8 frame header into +// public stream metadata. +func StreamInfoFromFrameHeader(header FrameHeader) StreamInfo { + return StreamInfo{ + Width: header.Width, + Height: header.Height, + Profile: header.Profile, + KeyFrame: header.KeyFrame(), + ShowFrame: header.ShowFrame, + FirstPartitionSize: header.FirstPartitionSize, + } +} diff --git a/internal/vp8/decoder/threading.go b/internal/vp8/decoder/threading.go new file mode 100644 index 0000000..91b7dd8 --- /dev/null +++ b/internal/vp8/decoder/threading.go @@ -0,0 +1,262 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/threading.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + "runtime" + "sync" + "sync/atomic" + + "github.com/go-avkit/vpx/internal/vp8/common" +) + +// Ported from libvpx v1.16.0 vp8/decoder/threading.c row-thread driver. The +// per-MB-row reconstruction and loop-filter pipelines run on distinct +// goroutines so the loop filter for row R-2 overlaps reconstruction of row +// R+1. Reconstruction itself remains row-sequential (intra prediction has a +// strict row-stride dependency on the previous row's bottom samples and +// extended right edge); the loop filter is also row-sequential (the MB +// horizontal-edge filter for row R reads pixels modified by the LF for row +// R-1). The pipeline is therefore a two-stage producer/consumer split: the +// reconstruction goroutine emits "row R reconstructed" events and the LF +// goroutine consumes them while staying two rows behind. +// +// The two-row gap is required because the rightmost MB's vertical inner +// edge filter at column 12 reads cols [codedWidth-4..codedWidth+3] and +// modifies cols [codedWidth-2..codedWidth+1] of every absolute row in the +// MB (including 16R+15 in luma and 8R+7 in chroma). Recon for row R+1 +// reads row 16R+15 cols [codedWidth, codedWidth+3] when constructing the +// intra "above" buffer for its rightmost MB (extendIntraRightEdgeForRow +// populates those border bytes). To keep that read race-free, LF row R +// must wait until recon row R+1 has completed (i.e., already consumed the +// extended right edge); LF row R then runs in parallel with recon row R+2. +// +// All other body modifications by LF row R land within absolute rows +// 16R-3..16R+13 (luma) and 8R-3..8R+6 (chroma), which neither recon row +// R+1 nor recon row R+2 touch. +// +// Synchronisation between the two stages uses an atomic counter rather +// than a mutex/cond pair: the producer publishes row progress with +// atomic.Store and the consumer spins (with a runtime.Gosched fallback) +// on atomic.Load. This avoids the ~200ns mutex acquire/wakeup cost on +// every MB row at 720p (45 rows/frame, ~9us pure sync overhead per frame +// removed) and keeps the hot path lock-free. + +// ErrThreadingPipelineFailure is returned when a pipeline stage encounters +// an unrecoverable reconstruction or loop-filter error. +var ErrThreadingPipelineFailure = errors.New("govpx: VP8 decoder threading pipeline failure") + +// ReconstructAndLoopFilterPipelined reconstructs an entire frame and applies +// the loop filter using a two-stage producer/consumer pipeline backed by +// goroutines. Output pixels are byte-identical to the serial path. +// +// loopFilterEnabled controls whether the loop filter runs at all. When +// false the function still reconstructs the frame but skips the LF stage, +// matching ApplyLoopFilter's "level == 0 / version skips LF" behavior. +func ReconstructAndLoopFilterPipelined( + img *common.Image, + last *common.Image, + golden *common.Image, + alt *common.Image, + rows int, + cols int, + modes []MacroblockMode, + tokens []MacroblockTokens, + dequants *[common.MaxMBSegments]common.MacroblockDequant, + scratch *IntraReconstructionScratch, + cfg InterPredictionConfig, + keyFrame bool, + loopFilterEnabled bool, + frameType common.FrameType, + header LoopFilterHeader, + segmentation SegmentationHeader, + lfi *common.LoopFilterInfo, +) error { + if rows < 0 || cols < 0 { + return ErrReconstructGridBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return ErrReconstructGridBufferTooSmall + } + required := rows * cols + if img == nil || dequants == nil || scratch == nil || len(modes) < required || len(tokens) < required { + return ErrReconstructGridBufferTooSmall + } + if !keyFrame { + if last == nil || golden == nil || alt == nil { + return ErrReconstructGridBufferTooSmall + } + if !imageHasMacroblockGrid(last, rows, cols) || !imageHasMacroblockGrid(golden, rows, cols) || !imageHasMacroblockGrid(alt, rows, cols) { + return ErrReconstructGridBufferTooSmall + } + } + if !imageHasMacroblockGrid(img, rows, cols) { + return ErrReconstructGridBufferTooSmall + } + if loopFilterEnabled { + if lfi == nil || frameType < common.KeyFrame || frameType > common.InterFrame { + return ErrLoopFilterBufferTooSmall + } + } + + // Reconstruction state cached once per frame. + var lastState, goldenState, altState InterFrameRefState + if !keyFrame { + lastState = newFrameInterRefState(last, cfg) + goldenState = newFrameInterRefState(golden, cfg) + altState = newFrameInterRefState(alt, cfg) + } + + // LF state init (matches ApplyLoopFilter setup exactly). + if rows == 0 { + return nil + } + + // Fast path: when loop filtering is disabled or level 0, run reconstruction + // directly without spawning goroutines or initializing loop-filter tables. + if !loopFilterEnabled || header.Level == 0 { + for row := range rows { + var err error + if keyFrame { + err = reconstructKeyFrameIntraGridRow(img, row, cols, modes, tokens, dequants, scratch) + } else { + err = reconstructInterFrameGridRow(img, last, golden, alt, &lastState, &goldenState, &altState, row, cols, modes, tokens, dequants, scratch, cfg) + } + if err != nil { + return err + } + } + return nil + } + + common.InitLoopFilterInfo(lfi, int(header.SharpnessLevel)) + common.InitLoopFilterFrame(lfi, int(header.Level), loopFilterFrameConfig(header, segmentation)) + simple := header.Type == SimpleLoopFilter + + state := pipelineStatePool.Get().(*pipelineState) + state.reset() + defer pipelineStatePool.Put(state) + + var reconErr, lfErr error + + var wg sync.WaitGroup + wg.Add(2) + + go func() { + defer wg.Done() + for row := range rows { + var err error + if keyFrame { + err = reconstructKeyFrameIntraGridRow(img, row, cols, modes, tokens, dequants, scratch) + } else { + err = reconstructInterFrameGridRow(img, last, golden, alt, &lastState, &goldenState, &altState, row, cols, modes, tokens, dequants, scratch, cfg) + } + if err != nil { + reconErr = err + state.abort() + return + } + state.advanceRecon(row + 1) + } + }() + + go func() { + defer wg.Done() + for row := range rows { + // LF row R must wait for recon row R+1 to finish: recon row + // R+1's rightmost MB reads the extended right-border at row + // 16R+15 (and 8R+7 for chroma), which LF row R's rightmost-MB + // vertical inner-edge filter would otherwise overwrite at + // cols codedWidth, codedWidth+1. After recon row R+1 has + // consumed the border, LF row R is free to run in parallel + // with recon row R+2. The last row (R == rows-1) needs no + // successor, so it just needs reconAt == rows. + needed := min(row+2, rows) + if !waitReconAtLeast(state, needed) { + lfErr = ErrThreadingPipelineFailure + return + } + var err error + if simple { + err = applySimpleLoopFilterRow(img, row, cols, modes, lfi) + } else { + err = applyNormalLoopFilterRow(img, row, cols, modes, frameType, lfi) + } + if err != nil { + lfErr = err + return + } + } + }() + + wg.Wait() + + if reconErr != nil { + return reconErr + } + if lfErr != nil { + return lfErr + } + return nil +} + +// pipelineStateAborted is the single-word terminal abort state packed into +// pipelineState.progress (< 0 = Aborted, >= 0 = completed recon rows). +// Packing progress and abort into one atomic.Int32 reduces waitReconAtLeast +// to a single atomic load per check with zero abort-ordering hazard. +const pipelineStateAborted int32 = -1 + +// pipelineState shares lock-free progress between the recon producer and +// the LF consumer. +type pipelineState struct { + progress atomic.Int32 +} + +func (s *pipelineState) reset() { + s.progress.Store(0) +} + +func (s *pipelineState) advanceRecon(completedRows int) { + s.progress.Store(int32(completedRows)) +} + +func (s *pipelineState) abort() { + s.progress.Store(pipelineStateAborted) +} + +// pipelineStatePool reuses pipelineState across frames so the per-frame +// allocation cost does not show up in the steady-state decoder path. +var pipelineStatePool = sync.Pool{ + New: func() any { return &pipelineState{} }, +} + +// waitReconAtLeast spins on the packed progress word until it reaches at least +// `want` (returning true) or transitions to pipelineStateAborted (returning +// false). Because `want >= 1` and `pipelineStateAborted < 0`, a single atomic +// load detects both completion and abort unambiguously. +func waitReconAtLeast(s *pipelineState, want int) bool { + const spinBudget = 256 + want32 := int32(want) + for i := 0; ; i++ { + cur := s.progress.Load() + if cur >= want32 { + return true + } + if cur < 0 { + return false + } + if i >= spinBudget { + runtime.Gosched() + i = 0 + } + } +} diff --git a/internal/vp8/decoder/tokens.go b/internal/vp8/decoder/tokens.go new file mode 100644 index 0000000..b877a13 --- /dev/null +++ b/internal/vp8/decoder/tokens.go @@ -0,0 +1,192 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/tokens.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + "math/bits" + + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +var ErrTokenGridBufferTooSmall = errors.New("govpx: VP8 token grid buffer too small") + +var zeroMacroblockEOB [25]uint8 + +const macroblockTokensTrackedMask uint32 = 1 << 31 + +type EntropyContextPlanes struct { + Y1 [4]uint8 + U [2]uint8 + V [2]uint8 + Y2 uint8 +} + +type MacroblockTokens struct { + QCoeff [25][16]int16 + EOB [25]uint8 + dirtyMask uint32 +} + +func ResetMacroblockTokenContext(above *EntropyContextPlanes, left *EntropyContextPlanes, is4x4 bool) { + if !is4x4 { + *above = EntropyContextPlanes{} + *left = EntropyContextPlanes{} + return + } + + aboveY2, leftY2 := above.Y2, left.Y2 + *above = EntropyContextPlanes{Y2: aboveY2} + *left = EntropyContextPlanes{Y2: leftY2} +} + +func DecodeMacroblockTokens(br *boolcoder.Decoder, probs *tables.CoefficientProbs, is4x4 bool, above *EntropyContextPlanes, left *EntropyContextPlanes, out *MacroblockTokens) int { + clearMacroblockTokens(out) + + eobTotal, dirtyMask := br.ReadVP8MacroblockCoeffs(probs, is4x4, + &above.Y1, &left.Y1, &above.U, &left.U, &above.V, &left.V, + &above.Y2, &left.Y2, &out.QCoeff, &out.EOB) + + if dirtyMask != 0 { + dirtyMask |= macroblockTokensTrackedMask + } + out.dirtyMask = dirtyMask + return eobTotal +} + +func DecodeTokenGrid(readers []boolcoder.Decoder, rows int, cols int, probs *tables.CoefficientProbs, modes []MacroblockMode, above []EntropyContextPlanes, tokens []MacroblockTokens) (int, error) { + if rows < 0 || cols < 0 { + return 0, ErrTokenGridBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return 0, ErrTokenGridBufferTooSmall + } + required := rows * cols + if len(modes) < required || len(tokens) < required || len(above) < cols { + return 0, ErrTokenGridBufferTooSmall + } + partitions := len(readers) + if partitions != 1 && partitions != 2 && partitions != 4 && partitions != 8 { + return 0, ErrTokenGridBufferTooSmall + } + + for col := range cols { + above[col] = EntropyContextPlanes{} + } + + total := 0 + for row := range rows { + rowPartition := row & (partitions - 1) + rowStart := row * cols + rowModes := modes[rowStart : rowStart+cols] + rowTokens := tokens[rowStart : rowStart+cols] + left := EntropyContextPlanes{} + for col := range cols { + mode := &rowModes[col] + token := &rowTokens[col] + if mode.MBSkipCoeff { + clearMacroblockTokensIfNeeded(token) + ResetMacroblockTokenContext(&above[col], &left, mode.Is4x4) + continue + } + eobTotal := DecodeMacroblockTokens(&readers[rowPartition], probs, mode.Is4x4, &above[col], &left, token) + if eobTotal == 0 { + mode.MBSkipCoeff = true + } + total += eobTotal + } + } + return total, nil +} + +func DecodeTokenGridWithErrorConcealment(readers []boolcoder.Decoder, rows int, cols int, probs *tables.CoefficientProbs, modes []MacroblockMode, above []EntropyContextPlanes, tokens []MacroblockTokens) (int, int, error) { + if rows < 0 || cols < 0 { + return 0, 0, ErrTokenGridBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return 0, 0, ErrTokenGridBufferTooSmall + } + required := rows * cols + if len(modes) < required || len(tokens) < required || len(above) < cols { + return 0, 0, ErrTokenGridBufferTooSmall + } + partitions := len(readers) + if partitions != 1 && partitions != 2 && partitions != 4 && partitions != 8 { + return 0, 0, ErrTokenGridBufferTooSmall + } + + for col := range cols { + above[col] = EntropyContextPlanes{} + } + + total := 0 + firstCorrupt := required + frameCorruptResidual := false + for row := range rows { + rowPartition := row & (partitions - 1) + rowStart := row * cols + rowModes := modes[rowStart : rowStart+cols] + rowTokens := tokens[rowStart : rowStart+cols] + left := EntropyContextPlanes{} + for col := range cols { + index := rowStart + col + mode := &rowModes[col] + token := &rowTokens[col] + reader := &readers[rowPartition] + if mode.MBSkipCoeff { + clearMacroblockTokensIfNeeded(token) + ResetMacroblockTokenContext(&above[col], &left, mode.Is4x4) + } else if !frameCorruptResidual && reader.Err() == nil { + eobTotal := DecodeMacroblockTokens(reader, probs, mode.Is4x4, &above[col], &left, token) + if eobTotal == 0 { + mode.MBSkipCoeff = true + } + total += eobTotal + } + if frameCorruptResidual || reader.Err() != nil { + frameCorruptResidual = true + if index < firstCorrupt { + firstCorrupt = index + } + clearMacroblockTokensIfNeeded(token) + mode.MBSkipCoeff = true + } + } + } + return total, firstCorrupt, nil +} + +func clearMacroblockTokens(out *MacroblockTokens) { + mask := out.dirtyMask + if mask != 0 { + for mask &^= macroblockTokensTrackedMask; mask != 0; mask &= mask - 1 { + i := bits.TrailingZeros32(mask) + out.QCoeff[i] = [16]int16{} + } + out.EOB = [25]uint8{} + out.dirtyMask = 0 + return + } + if out.EOB == zeroMacroblockEOB { + return + } + for i, eob := range out.EOB { + if eob != 0 { + out.QCoeff[i] = [16]int16{} + } + } + out.EOB = [25]uint8{} +} + +func clearMacroblockTokensIfNeeded(out *MacroblockTokens) { + clearMacroblockTokens(out) +} diff --git a/internal/vp8/decoder/treereader.go b/internal/vp8/decoder/treereader.go new file mode 100644 index 0000000..3d398dc --- /dev/null +++ b/internal/vp8/decoder/treereader.go @@ -0,0 +1,44 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/treereader.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +func ReadTree(br *boolcoder.Decoder, tree []int16, probs []uint8) int { + i := int16(0) + for { + prob := probs[i>>1] + next := tree[i+int16(br.ReadBool(prob))] + if next <= 0 { + return int(-next) + } + i = next + } +} + +func ReadYMode(br *boolcoder.Decoder, probs []uint8) int { + return ReadTree(br, tables.YModeTree[:], probs) +} + +func ReadKeyFrameYMode(br *boolcoder.Decoder, probs []uint8) int { + return ReadTree(br, tables.KeyFrameYModeTree[:], probs) +} + +func ReadUVMode(br *boolcoder.Decoder, probs []uint8) int { + return ReadTree(br, tables.UVModeTree[:], probs) +} + +func ReadBMode(br *boolcoder.Decoder, probs []uint8) int { + return ReadTree(br, tables.BModeTree[:], probs) +} diff --git a/internal/vp8/decoder/version.go b/internal/vp8/decoder/version.go new file mode 100644 index 0000000..502be6f --- /dev/null +++ b/internal/vp8/decoder/version.go @@ -0,0 +1,49 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/version.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +// Ported from libvpx v1.16.0 vp8/common/alloccommon.c vp8_setup_version. + +type InterPredictionConfig struct { + UseBilinear bool + FullPixel bool +} + +func InterPredictionConfigForVersion(version int) InterPredictionConfig { + switch version { + case 1, 2: + return InterPredictionConfig{UseBilinear: true} + case 3: + return InterPredictionConfig{UseBilinear: true, FullPixel: true} + default: + return InterPredictionConfig{} + } +} + +func VersionSkipsLoopFilter(version int) bool { + return version == 2 || version == 3 +} + +// LoopFilterHeaderForVersion returns the loop-filter header as-is. The version +// field in libvpx's vp8_setup_version sets filter_type as a *default* (SIMPLE +// for versions 1/3), but the subsequent bitstream read of filter_type in +// vp8/decoder/decodeframe.c always overwrites it, so the bitstream value is +// the effective filter_type. We pass the header through unchanged to mirror +// that libvpx-observed behavior. Earlier code applied an unconditional SIMPLE +// override here; that caused a decoder divergence (the LF +// kernel diverged when a version-1 stream specified NORMAL in its bitstream). +func LoopFilterHeaderForVersion(_ int, header LoopFilterHeader) LoopFilterHeader { + return header +} + +func IsSupportedVersion(version int) bool { + return version >= 0 && version <= 7 +} diff --git a/internal/vp8/decoder/wavefront.go b/internal/vp8/decoder/wavefront.go new file mode 100644 index 0000000..a0e5d95 --- /dev/null +++ b/internal/vp8/decoder/wavefront.go @@ -0,0 +1,553 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/decoder/wavefront.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + "runtime" + "sync" + "sync/atomic" + + "github.com/go-avkit/vpx/internal/vp8/boolcoder" + "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +// paddedAtomicInt32 isolates per-row wavefront progress counters onto distinct +// 64-byte cache lines so concurrent row workers never false-share. +type paddedAtomicInt32 struct { + v atomic.Int32 + _ [60]byte +} + +type wavefrontWorker struct { + id int + startCh chan struct{} + doneCh chan struct{} + scratch IntraReconstructionScratch + tokens MacroblockTokens + err error +} + +type wavefrontJob struct { + img *common.Image + last *common.Image + golden *common.Image + alt *common.Image + lastState InterFrameRefState + goldenState InterFrameRefState + altState InterFrameRefState + readers []boolcoder.Decoder + probs *tables.CoefficientProbs + modes []MacroblockMode + dequants *[common.MaxMBSegments]common.MacroblockDequant + cfg InterPredictionConfig + rows int + cols int + workers int + partitions int + keyFrame bool + loopFilterEnabled bool + simpleLF bool + frameType common.FrameType + lfi *common.LoopFilterInfo +} + +// WavefrontPool is a persistent, zero-allocation-per-frame worker pool that +// fuses VP8 token decoding, macroblock reconstruction, and loop filtering in a +// row wavefront across multiple token partitions. +// +// Each wavefront worker w in [0, W) (where W is a power of two dividing +// TokenCount) owns rows r = w, w+W, w+2W, ... and therefore has exclusive +// ownership of readers[r & (TokenCount-1)] with zero locking. Token decode and +// reconstruction for each macroblock run back-to-back using a single L1-hot +// MacroblockTokens struct per worker instead of writing and re-reading a +// multi-megabyte frame token grid. +// +// A dedicated loop-filter worker runs concurrently two rows behind the +// reconstruction wavefront, matching libvpx's row-thread dependency contract. +// ErrWavefrontPoolClosed is returned when a decode job is submitted to a +// closed WavefrontPool. +var ErrWavefrontPoolClosed = errors.New("govpx: wavefront pool closed") + +type wavefrontPoolState uint8 + +const ( + wavefrontPoolIdle wavefrontPoolState = iota // constructed; goroutines not started + wavefrontPoolRunning // worker goroutines running + wavefrontPoolClosed // terminal; goroutines stopped and joined +) + +// WavefrontPool owns persistent row-parallel VP8 decoding workers and a +// dedicated loop-filter worker. +type WavefrontPool struct { + mu sync.Mutex + state wavefrontPoolState + maxWorkers int + bgWorkers []wavefrontWorker + lfStartCh chan struct{} + lfDoneCh chan struct{} + lfErr error + exitWg sync.WaitGroup + mainScratch IntraReconstructionScratch + mainTokens MacroblockTokens + aboveGrid []EntropyContextPlanes + rowProgress []paddedAtomicInt32 + aborted atomic.Bool + job wavefrontJob + lfActive bool + activeBG int +} + +// NewWavefrontPool creates a persistent pool sized for up to threads workers. +// Background goroutines are started lazily on the first Run call and stopped +// when Close is called. +func NewWavefrontPool(threads int) *WavefrontPool { + if threads < 2 { + threads = 2 + } + if threads > 8 { + threads = 8 + } + return &WavefrontPool{ + maxWorkers: threads, + } +} + +func (p *WavefrontPool) ensureStarted() bool { + p.mu.Lock() + defer p.mu.Unlock() + switch p.state { + case wavefrontPoolClosed: + return false + case wavefrontPoolRunning: + return true + } + bgCount := p.maxWorkers - 1 + p.bgWorkers = make([]wavefrontWorker, bgCount) + for i := range p.bgWorkers { + w := &p.bgWorkers[i] + w.id = i + 1 + w.startCh = make(chan struct{}, 1) + w.doneCh = make(chan struct{}, 1) + p.exitWg.Add(1) + go p.runWavefrontWorker(w) + } + p.lfStartCh = make(chan struct{}, 1) + p.lfDoneCh = make(chan struct{}, 1) + p.exitWg.Add(1) + go p.runLoopFilterWorker() + p.state = wavefrontPoolRunning + return true +} + +// Close shuts down all background goroutines owned by the pool. +func (p *WavefrontPool) Close() { + if p == nil { + return + } + p.mu.Lock() + if p.state == wavefrontPoolClosed { + p.mu.Unlock() + return + } + wasRunning := p.state == wavefrontPoolRunning + p.state = wavefrontPoolClosed + if wasRunning { + for i := range p.bgWorkers { + close(p.bgWorkers[i].startCh) + } + if p.lfStartCh != nil { + close(p.lfStartCh) + } + } + p.mu.Unlock() + if wasRunning { + p.exitWg.Wait() + } +} + +func (p *WavefrontPool) runWavefrontWorker(w *wavefrontWorker) { + defer p.exitWg.Done() + for range w.startCh { + w.err = p.runRowsForWorker(w.id, &w.scratch, &w.tokens) + if w.err != nil { + p.aborted.Store(true) + } + w.doneCh <- struct{}{} + } +} + +func (p *WavefrontPool) runLoopFilterWorker() { + defer p.exitWg.Done() + for range p.lfStartCh { + p.lfErr = p.runLoopFilterRows() + if p.lfErr != nil { + p.aborted.Store(true) + } + p.lfDoneCh <- struct{}{} + } +} + +// EffectiveWavefrontWorkers returns the largest power-of-two worker count W +// with 1 <= W <= min(threads, partitions, rows). Because W divides partitions, +// worker w owning rows r = w, w+W, ... has exclusive access to +// readers[r & (partitions-1)]. +func EffectiveWavefrontWorkers(threads int, partitions int, rows int) int { + limit := min(threads, min(partitions, rows)) + w := 1 + for (w << 1) <= limit { + w <<= 1 + } + return w +} + +// DecodeReconstructLoopFilterWavefront fuses token decoding, macroblock +// reconstruction, and loop filtering across persistent wavefront workers. +// Output pixels and mode.MBSkipCoeff updates are byte-identical to the serial +// DecodeTokenGrid + reconstruct + ApplyLoopFilter pipeline. +func (p *WavefrontPool) DecodeReconstructLoopFilterWavefront( + img *common.Image, + last *common.Image, + golden *common.Image, + alt *common.Image, + rows int, + cols int, + readers []boolcoder.Decoder, + probs *tables.CoefficientProbs, + modes []MacroblockMode, + dequants *[common.MaxMBSegments]common.MacroblockDequant, + cfg InterPredictionConfig, + keyFrame bool, + loopFilterEnabled bool, + frameType common.FrameType, + header LoopFilterHeader, + segmentation SegmentationHeader, + lfi *common.LoopFilterInfo, +) error { + if rows < 0 || cols < 0 { + return ErrReconstructGridBufferTooSmall + } + if rows != 0 && cols > int(^uint(0)>>1)/rows { + return ErrReconstructGridBufferTooSmall + } + required := rows * cols + partitions := len(readers) + if partitions != 1 && partitions != 2 && partitions != 4 && partitions != 8 { + return ErrTokenGridBufferTooSmall + } + if img == nil || probs == nil || dequants == nil || len(modes) < required { + return ErrReconstructGridBufferTooSmall + } + if !keyFrame { + if last == nil || golden == nil || alt == nil { + return ErrReconstructGridBufferTooSmall + } + if !imageHasMacroblockGrid(last, rows, cols) || !imageHasMacroblockGrid(golden, rows, cols) || !imageHasMacroblockGrid(alt, rows, cols) { + return ErrReconstructGridBufferTooSmall + } + } + if !imageHasMacroblockGrid(img, rows, cols) { + return ErrReconstructGridBufferTooSmall + } + if rows == 0 || cols == 0 { + return nil + } + + runLF := loopFilterEnabled && header.Level != 0 + if runLF { + if lfi == nil || frameType < common.KeyFrame || frameType > common.InterFrame { + return ErrLoopFilterBufferTooSmall + } + common.InitLoopFilterInfo(lfi, int(header.SharpnessLevel)) + common.InitLoopFilterFrame(lfi, int(header.Level), loopFilterFrameConfig(header, segmentation)) + } + + if !p.ensureStarted() { + return ErrWavefrontPoolClosed + } + + workers := EffectiveWavefrontWorkers(p.maxWorkers, partitions, rows) + if cap(p.aboveGrid) < required { + p.aboveGrid = make([]EntropyContextPlanes, required) + } else { + p.aboveGrid = p.aboveGrid[:required] + } + if cap(p.rowProgress) < rows { + p.rowProgress = make([]paddedAtomicInt32, rows) + } else { + p.rowProgress = p.rowProgress[:rows] + } + for r := range rows { + p.rowProgress[r].v.Store(0) + } + p.aborted.Store(false) + + var lastState, goldenState, altState InterFrameRefState + if !keyFrame { + lastState = newFrameInterRefState(last, cfg) + goldenState = newFrameInterRefState(golden, cfg) + altState = newFrameInterRefState(alt, cfg) + } + + p.job = wavefrontJob{ + img: img, + last: last, + golden: golden, + alt: alt, + lastState: lastState, + goldenState: goldenState, + altState: altState, + readers: readers, + probs: probs, + modes: modes, + dequants: dequants, + cfg: cfg, + rows: rows, + cols: cols, + workers: workers, + partitions: partitions, + keyFrame: keyFrame, + loopFilterEnabled: runLF, + simpleLF: header.Type == SimpleLoopFilter, + frameType: frameType, + lfi: lfi, + } + + // Launch background wavefront workers and loop-filter worker. + p.activeBG = workers - 1 + p.lfActive = runLF + for i := 0; i < p.activeBG; i++ { + p.bgWorkers[i].startCh <- struct{}{} + } + if p.lfActive { + p.lfStartCh <- struct{}{} + } + + // Main goroutine runs worker 0. + mainErr := p.runRowsForWorker(0, &p.mainScratch, &p.mainTokens) + if mainErr != nil { + p.aborted.Store(true) + } + + // Wait for all background workers and LF worker to finish. + firstErr := mainErr + for i := 0; i < p.activeBG; i++ { + <-p.bgWorkers[i].doneCh + if firstErr == nil && p.bgWorkers[i].err != nil { + firstErr = p.bgWorkers[i].err + } + } + if p.lfActive { + <-p.lfDoneCh + if firstErr == nil && p.lfErr != nil { + firstErr = p.lfErr + } + } + return firstErr +} + +const wavefrontChunkCols = 4 + +func (p *WavefrontPool) waitRowCol(row int, want int) bool { + const spinBudget = 4096 + want32 := int32(want) + cell := &p.rowProgress[row].v + for i := 0; ; i++ { + if cell.Load() >= want32 { + return true + } + if i&15 == 15 && p.aborted.Load() { + return false + } + if i >= spinBudget { + runtime.Gosched() + i = 0 + } + } +} + +func (p *WavefrontPool) runLoopFilterRows() error { + j := &p.job + rows := j.rows + cols := j.cols + for row := range rows { + // LF row R must wait until recon row R and recon row R+1 (if any) have + // completed, matching the border-extension contract in threading.go. + if !p.waitRowCol(row, cols) { + return ErrThreadingPipelineFailure + } + if row+1 < rows { + if !p.waitRowCol(row+1, cols) { + return ErrThreadingPipelineFailure + } + } + var err error + if j.simpleLF { + err = applySimpleLoopFilterRow(j.img, row, cols, j.modes, j.lfi) + } else { + err = applyNormalLoopFilterRow(j.img, row, cols, j.modes, j.frameType, j.lfi) + } + if err != nil { + return err + } + } + return nil +} + +func (p *WavefrontPool) runRowsForWorker(workerID int, scratch *IntraReconstructionScratch, tok *MacroblockTokens) error { + j := &p.job + rows := j.rows + cols := j.cols + partMask := j.partitions - 1 + img := j.img + probs := j.probs + dequants := j.dequants + aboveGrid := p.aboveGrid + + for row := workerID; row < rows; row += j.workers { + reader := &j.readers[row&partMask] + rowBase := row * cols + rowModes := j.modes[rowBase : rowBase+cols] + rowAbove := aboveGrid[rowBase : rowBase+cols] + var prevAbove []EntropyContextPlanes + if row > 0 { + prevAbove = aboveGrid[rowBase-cols : rowBase] + } + + yRow := row * 16 * img.YStride + uRow := row * 8 * img.UStride + vRow := row * 8 * img.VStride + left := EntropyContextPlanes{} + + for chunkStart := 0; chunkStart < cols; chunkStart += wavefrontChunkCols { + chunkEnd := min(chunkStart+wavefrontChunkCols, cols) + if row > 0 { + // Wait for row-1 through min(chunkEnd+1, cols) so token above + // context AND intra B_LD_PRED top-right (col+1) / extended + // right border (when chunkEnd == cols) are all published. + needed := min(chunkEnd+1, cols) + if !p.waitRowCol(row-1, needed) { + return ErrThreadingPipelineFailure + } + } + + for col := chunkStart; col < chunkEnd; col++ { + mode := &rowModes[col] + if mode.SegmentID >= common.MaxMBSegments { + if j.keyFrame { + return ErrUnsupportedIntraReconstructionMode + } + return ErrUnsupportedInterReconstructionMode + } + + var above EntropyContextPlanes + if row > 0 { + above = prevAbove[col] + } + + // Decode tokens into worker-local L1-hot tok. + if mode.MBSkipCoeff { + ResetMacroblockTokenContext(&above, &left, mode.Is4x4) + rowAbove[col] = above + } else { + eobTotal := DecodeMacroblockTokens(reader, probs, mode.Is4x4, &above, &left, tok) + if eobTotal == 0 { + mode.MBSkipCoeff = true + } + rowAbove[col] = above + } + + // Reconstruct macroblock immediately while tok is hot in L1. + yOff := yRow + col*16 + uOff := uRow + col*8 + vOff := vRow + col*8 + + if j.keyFrame { + refs := BuildIntraPredictorRefs(img, row, col, &scratch.Refs) + if !ReconstructIntraMacroblock(mode, tok, &(*dequants)[mode.SegmentID], refs, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual) { + return ErrUnsupportedIntraReconstructionMode + } + continue + } + + if mode.RefFrame == common.IntraFrame { + refs := BuildIntraPredictorRefs(img, row, col, &scratch.Refs) + if !ReconstructIntraMacroblock(mode, tok, &(*dequants)[mode.SegmentID], refs, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual) { + return ErrUnsupportedInterReconstructionMode + } + continue + } + + var refState *InterFrameRefState + var ref *common.Image + switch mode.RefFrame { + case common.LastFrame: + refState = &j.lastState + ref = j.last + case common.GoldenFrame: + refState = &j.goldenState + ref = j.golden + case common.AltRefFrame: + refState = &j.altState + ref = j.alt + default: + return ErrUnsupportedInterReconstructionMode + } + + if ref != img && mode.Mode == common.ZeroMV && mode.MBSkipCoeff && !mode.Is4x4 && mode.MV.IsZero() { + // Check for a run of skipped ZeroMV MBs within the current chunk. + run := zeroMVSkippedRunLength(rowModes, col, chunkEnd, mode.RefFrame) + if run > 1 { + // Reset token contexts for the remaining MBs in the run. + for k := 1; k < run; k++ { + var a EntropyContextPlanes + if row > 0 { + a = prevAbove[col+k] + } + ResetMacroblockTokenContext(&a, &left, false) + rowAbove[col+k] = a + } + if copyZeroMVInterMacroblockRunFast(refState, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, row, col, run) { + col += run - 1 + continue + } + // Fallback: reconstruct the first MB individually; loop continues at col+1. + // Note: if fallback ran, we'd have already overwritten rowAbove[col+1..], + // which is identical since they are also MBSkipCoeff && !Is4x4. + } + if copyZeroMVInterMacroblockFast(refState, img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, row, col) { + continue + } + } + + if mode.Mode == common.SplitMV { + if !reconstructSplitMVInterMacroblockFast(refState, mode, tok, &(*dequants)[mode.SegmentID], img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual, row, col, j.cfg) { + return ErrUnsupportedInterReconstructionMode + } + continue + } + if !reconstructWholeMVInterMacroblockFast(refState, mode, tok, &(*dequants)[mode.SegmentID], img.Y[yOff:], img.YStride, img.U[uOff:], img.UStride, img.V[vOff:], img.VStride, &scratch.Residual, row, col) { + return ErrUnsupportedInterReconstructionMode + } + } + + if chunkEnd < cols { + p.rowProgress[row].v.Store(int32(chunkEnd)) + } + } + + // Extend intra right edge before publishing full row completion. + extendIntraRightEdgeForRow(img, row) + p.rowProgress[row].v.Store(int32(cols)) + } + return nil +} diff --git a/internal/vp8/dsp/bilinear_other.go b/internal/vp8/dsp/bilinear_other.go new file mode 100644 index 0000000..5e19284 --- /dev/null +++ b/internal/vp8/dsp/bilinear_other.go @@ -0,0 +1,66 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/bilinear_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +// Pure-Go fallback for BilinearPredict on architectures without a SIMD +// port. Returns false so the generic libvpx v1.16.0 scalar path in +// subpixel.go runs. + +func bilinearPredict16x16Maybe(src []byte, srcStride int, xoffset int, yoffset int, + dst []byte, dstStride int) bool { + if pixel.Enabled { + bilinearPredictGo(src, srcStride, xoffset, yoffset, dst, dstStride, 16, 16) + return true + } + + return false +} + +func bilinearPredict8x8Maybe(src []byte, srcStride int, xoffset int, yoffset int, + dst []byte, dstStride int) bool { + if pixel.Enabled { + bilinearPredictGo(src, srcStride, xoffset, yoffset, dst, dstStride, 8, 8) + return true + } + + return false +} + +func bilinearPredictGo(src []byte, ss, x, y int, dst []byte, ds, w, h int) { + if y == 0 { + fx := tables.BilinearFilters[x] + pixel.FilterBilinear(src, ss, dst, ds, w, h, 1, uint8(fx[0]), uint8(fx[1])) + return + } + if x == 0 { + fy := tables.BilinearFilters[y] + pixel.FilterBilinear(src, ss, dst, ds, w, h, ss, uint8(fy[0]), uint8(fy[1])) + return + } + fx := tables.BilinearFilters[x] + fy := tables.BilinearFilters[y] + if pixel.FilterBilinear2D(src, ss, dst, ds, w, h, uint8(fx[0]), uint8(fx[1]), uint8(fy[0]), uint8(fy[1])) { + return + } + bilinearPredict2DFallback(src, ss, dst, ds, w, h, uint8(fx[0]), uint8(fx[1]), uint8(fy[0]), uint8(fy[1])) +} + +//go:noinline +func bilinearPredict2DFallback(src []byte, ss int, dst []byte, ds, w, h int, fx0, fx1, fy0, fy1 uint8) { + var tmp [17 * 16]byte + pixel.FilterBilinear(src, ss, tmp[:], w, w, h+1, 1, fx0, fx1) + pixel.FilterBilinear(tmp[:], w, dst, ds, w, h, w, fy0, fy1) +} diff --git a/internal/vp8/dsp/clip.go b/internal/vp8/dsp/clip.go new file mode 100644 index 0000000..8f4d6d6 --- /dev/null +++ b/internal/vp8/dsp/clip.go @@ -0,0 +1,34 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/clip.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "math/bits" +) + +// signShift is the right-shift required to splat an int's sign bit across +// every bit position (i.e. produce -1 for negatives, 0 for non-negatives). +const signShift = bits.UintSize - 1 + +// ClipPixel saturates v into [0, 255] without conditional branches so the +// caller's inner loop keeps a straight-line shape. Compiles to a couple of +// shifts, an AND-NOT, and an OR on amd64/arm64 and stays well under the +// inliner's budget. +func ClipPixel(v int) uint8 { + // nMask is all-ones when v < 0, zero otherwise; clearing those bits + // snaps any negative input to 0. + nMask := v >> signShift + v &^= nMask + // pMask is all-ones when v > 255 (because then 255 - v is negative); + // in that case we OR in 255 and clear the high bits we computed. + pMask := (255 - v) >> signShift + return uint8((v &^ pMask) | (255 & pMask)) +} diff --git a/internal/vp8/dsp/dequant.go b/internal/vp8/dsp/dequant.go new file mode 100644 index 0000000..32d9c90 --- /dev/null +++ b/internal/vp8/dsp/dequant.go @@ -0,0 +1,27 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/dequant.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" +) + +// DequantizeBlockDisjoint dequantizes a 4x4 block when dqcoeff is known not to +// partially alias qcoeff or dequant (e.g. a stack-local destination). +func DequantizeBlockDisjoint(qcoeff *[16]int16, dequant *[16]int16, dqcoeff *[16]int16) { + if pixel.Enabled { + pixel.Mul16(qcoeff[:], dequant[:], dqcoeff[:], 16) + return + } + for i := range 16 { + dqcoeff[i] = qcoeff[i] * dequant[i] + } +} diff --git a/internal/vp8/dsp/idct.go b/internal/vp8/dsp/idct.go new file mode 100644 index 0000000..76aa29f --- /dev/null +++ b/internal/vp8/dsp/idct.go @@ -0,0 +1,203 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/idct.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" +) + +const ( + cosPI8Sqrt2Minus1 = 20091 + sinPI8Sqrt2 = 35468 +) + +// IDCT4x4Add dispatches to the SIMD or scalar 4x4 inverse DCT-add kernel. +func IDCT4x4Add(input *[16]int16, pred []byte, predStride int, dst []byte, dstStride int) { + idct4x4AddSIMD(input, pred, predStride, dst, dstStride) +} + +// DCOnlyIDCT4x4Add dispatches to the SIMD or scalar DC-only fast path. +func DCOnlyIDCT4x4Add(inputDC int16, pred []byte, predStride int, dst []byte, dstStride int) { + if uint16(inputDC)+4 <= 7 && zeroDCSameWindow(pred, predStride, dst, dstStride) { + return + } + + dcOnlyIDCT4x4AddSIMD(inputDC, pred, predStride, dst, dstStride) +} + +// DCOnlyIDCT4x4AddInt32 is the int32-precision DC-only fast path used by the +// decoder DC-only chroma/luma residual adds when QCoeff * Dequant may overflow +// the int16 range. It mirrors libvpx v1.16.0 +// vp8/common/arm/neon/idct_blk_neon.c idct_dequant_0_2x_neon, which performs +// the multiply-shift in int precision before broadcasting the result to a +// signed-16-bit NEON vector. The narrow-to-int16 happens after the (>>3) +// shift, which keeps the lane value in a far smaller magnitude than the raw +// product, so a coefficient like 334 * 132 = 44088 does NOT wrap. +// +// The non-NEON scalar libvpx path DOES wrap (it passes the raw product +// through a `short input_dc` argument), but vpxdec on arm64 dispatches to +// the NEON variant, so byte-exact parity requires mirroring the NEON +// semantics here. +func DCOnlyIDCT4x4AddInt32(inputDC int32, pred []byte, predStride int, dst []byte, dstStride int) { + a1 := dcOnlyIDCT4x4AddInt32Delta(inputDC) + if a1 == 0 && zeroDCSameWindow(pred, predStride, dst, dstStride) { + return + } + dcOnlyIDCT4x4AddSIMD(int16(a1<<3), pred, predStride, dst, dstStride) +} + +// DCOnlyIDCT4x4AddPairInPlaceInt32 mirrors libvpx v1.16.0's paired DC-only +// reconstruction when prediction and destination are the same full window. +func DCOnlyIDCT4x4AddPairInPlaceInt32(c0, c1 int32, b []byte, stride int) { + if pixel.DCPairNative && pixel.Enabled { + pixel.DCPairInPlaceInt32Native(c0, c1, b, stride) + return + } + DCOnlyIDCT4x4AddPairInt32(c0, c1, b, stride, b, stride) +} + +// DCOnlyIDCT4x4AddPairInt32 adds two horizontally adjacent DC-only 4x4 blocks. +// It is used by chroma residual paths that mirror libvpx's paired U/V block +// dispatch. +func DCOnlyIDCT4x4AddPairInt32(inputDC0 int32, inputDC1 int32, pred []byte, predStride int, dst []byte, dstStride int) { + if pixel.DCPairNative && pixel.Enabled { + pixel.DCPairInt32Native(inputDC0, inputDC1, pred, predStride, dst, dstStride) + return + } + a0 := dcOnlyIDCT4x4AddInt32Delta(inputDC0) + a1 := dcOnlyIDCT4x4AddInt32Delta(inputDC1) + dcOnlyIDCT4x4AddPairSIMD(int16(a0), int16(a1), pred, predStride, dst, dstStride) +} + +// DequantIDCTAddFull2xBlocks runs fused dequant + 4x4 IDCT + saturating add +// directly from two caller-owned 16-int16 blocks without staging into a +// contiguous 32-int16 scratch buffer. +func DequantIDCTAddFull2xBlocks(q0, q1 *[16]int16, dq *[16]int16, dst []byte, stride int) { + if dequantInverse4BlocksGo(q0, q1, dq, dst, stride) { + return + } + var tmp [16]int16 + for i := range 16 { + tmp[i] = q0[i] * dq[i] + } + IDCT4x4Add(&tmp, dst, stride, dst, stride) + for i := range 16 { + tmp[i] = q1[i] * dq[i] + } + IDCT4x4Add(&tmp, dst[4:], stride, dst[4:], stride) +} + +// DequantIDCTAddFull1x runs fused dequant + 4x4 IDCT + saturating add on a +// single 4x4 block in place. +func DequantIDCTAddFull1x(q *[16]int16, dq *[16]int16, dst []byte, stride int) { + if dequantInverse4SingleGo(q, dq, dst, stride) { + return + } + var tmp [16]int16 + for i := range 16 { + tmp[i] = q[i] * dq[i] + } + IDCT4x4Add(&tmp, dst, stride, dst, stride) +} + +func dcOnlyIDCT4x4AddInt32Delta(inputDC int32) int { + a1 := int((inputDC + 4) >> 3) + if a1 > 255 { + a1 = 255 + } else if a1 < -255 { + a1 = -255 + } + return a1 +} + +// idct4x4AddScalar is the canonical scalar port of libvpx +// vp8/common/idctllm.c vp8_short_idct4x4llm_c. SIMD ports must produce +// byte-identical output for the encoder/decoder coefficient range. +func idct4x4AddScalar(input *[16]int16, pred []byte, predStride int, dst []byte, dstStride int) { + var output [16]int16 + + for i := range 4 { + i0, i4, i8, i12 := int(input[i]), int(input[i+4]), int(input[i+8]), int(input[i+12]) + if i0|i4|i8|i12 == 0 { + continue + } + a1 := i0 + i8 + b1 := i0 - i8 + + c1 := ((i4 * sinPI8Sqrt2) >> 16) - (i12 + ((i12 * cosPI8Sqrt2Minus1) >> 16)) + d1 := (i4 + ((i4 * cosPI8Sqrt2Minus1) >> 16)) + ((i12 * sinPI8Sqrt2) >> 16) + + output[i+0] = int16(a1 + d1) + output[i+12] = int16(a1 - d1) + output[i+4] = int16(b1 + c1) + output[i+8] = int16(b1 - c1) + } + + for y := range 4 { + base := y * 4 + o0, o1, o2, o3 := int(output[base+0]), int(output[base+1]), int(output[base+2]), int(output[base+3]) + a1 := o0 + o2 + b1 := o0 - o2 + c1 := ((o1 * sinPI8Sqrt2) >> 16) - (o3 + ((o3 * cosPI8Sqrt2Minus1) >> 16)) + d1 := (o1 + ((o1 * cosPI8Sqrt2Minus1) >> 16)) + ((o3 * sinPI8Sqrt2) >> 16) + + dstRow := dst[y*dstStride : y*dstStride+4 : y*dstStride+4] + predRow := pred[y*predStride : y*predStride+4 : y*predStride+4] + dstRow[0] = byte(min(max(int(int16((a1+d1+4)>>3))+int(predRow[0]), 0), 255)) + dstRow[1] = byte(min(max(int(int16((b1+c1+4)>>3))+int(predRow[1]), 0), 255)) + dstRow[2] = byte(min(max(int(int16((b1-c1+4)>>3))+int(predRow[2]), 0), 255)) + dstRow[3] = byte(min(max(int(int16((a1-d1+4)>>3))+int(predRow[3]), 0), 255)) + } +} + +// dcOnlyIDCT4x4AddScalar is the canonical scalar fast path used when only +// the DC coefficient is non-zero. +func dcOnlyIDCT4x4AddScalar(inputDC int16, pred []byte, predStride int, dst []byte, dstStride int) { + a1 := int((inputDC + 4) >> 3) + if predStride >= 0 && dstStride >= 0 && len(pred) >= 4 && predStride <= (len(pred)-4)/3 && len(dst) >= 4 && dstStride <= (len(dst)-4)/3 { + if a1 == 0 && &pred[0] == &dst[0] && predStride == dstStride { + return + } + p0, d0 := pred[:4], dst[:4] + d0[0] = ClipPixel(a1 + int(p0[0])) + d0[1] = ClipPixel(a1 + int(p0[1])) + d0[2] = ClipPixel(a1 + int(p0[2])) + d0[3] = ClipPixel(a1 + int(p0[3])) + p1, d1 := pred[predStride:predStride+4], dst[dstStride:dstStride+4] + d1[0] = ClipPixel(a1 + int(p1[0])) + d1[1] = ClipPixel(a1 + int(p1[1])) + d1[2] = ClipPixel(a1 + int(p1[2])) + d1[3] = ClipPixel(a1 + int(p1[3])) + p2, d2 := pred[2*predStride:2*predStride+4], dst[2*dstStride:2*dstStride+4] + d2[0] = ClipPixel(a1 + int(p2[0])) + d2[1] = ClipPixel(a1 + int(p2[1])) + d2[2] = ClipPixel(a1 + int(p2[2])) + d2[3] = ClipPixel(a1 + int(p2[3])) + p3, d3 := pred[3*predStride:3*predStride+4], dst[3*dstStride:3*dstStride+4] + d3[0] = ClipPixel(a1 + int(p3[0])) + d3[1] = ClipPixel(a1 + int(p3[1])) + d3[2] = ClipPixel(a1 + int(p3[2])) + d3[3] = ClipPixel(a1 + int(p3[3])) + return + } + for y := range 4 { + dstRow := dst[y*dstStride : y*dstStride+4 : y*dstStride+4] + predRow := pred[y*predStride : y*predStride+4 : y*predStride+4] + dstRow[0] = ClipPixel(a1 + int(predRow[0])) + dstRow[1] = ClipPixel(a1 + int(predRow[1])) + dstRow[2] = ClipPixel(a1 + int(predRow[2])) + dstRow[3] = ClipPixel(a1 + int(predRow[3])) + } +} + +func zeroDCSameWindow(pred []byte, ps int, dst []byte, ds int) bool { + return ps == ds && ps >= 4 && len(pred) >= 4 && ps <= (len(pred)-4)/3 && len(dst) >= 4 && ds <= (len(dst)-4)/3 && &pred[0] == &dst[0] +} diff --git a/internal/vp8/dsp/idct_simd_other.go b/internal/vp8/dsp/idct_simd_other.go new file mode 100644 index 0000000..0c267ac --- /dev/null +++ b/internal/vp8/dsp/idct_simd_other.go @@ -0,0 +1,37 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/idct_simd_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" +) + +func idct4x4AddSIMD(input *[16]int16, pred []byte, predStride int, dst []byte, dstStride int) { + if !inverse4Go(input, pred, predStride, dst, dstStride, false, nil) { + idct4x4AddScalar(input, pred, predStride, dst, dstStride) + } +} + +func dcOnlyIDCT4x4AddSIMD(inputDC int16, pred []byte, predStride int, dst []byte, dstStride int) { + if pixel.Enabled { + pixel.AddConstant(pred, predStride, dst, dstStride, 4, 4, int((inputDC+4)>>3)) + } else { + dcOnlyIDCT4x4AddScalar(inputDC, pred, predStride, dst, dstStride) + } +} + +func dcOnlyIDCT4x4AddPairSIMD(delta0 int16, delta1 int16, pred []byte, predStride int, dst []byte, dstStride int) { + if pixel.AddConstantPair4(pred, predStride, dst, dstStride, delta0, delta1) { + return + } + dcOnlyIDCT4x4AddSIMD(delta0<<3, pred, predStride, dst, dstStride) + dcOnlyIDCT4x4AddSIMD(delta1<<3, pred[4:], predStride, dst[4:], dstStride) +} diff --git a/internal/vp8/dsp/intra.go b/internal/vp8/dsp/intra.go new file mode 100644 index 0000000..d7bfb56 --- /dev/null +++ b/internal/vp8/dsp/intra.go @@ -0,0 +1,124 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/intra.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// Ported from libvpx v1.16.0 vpx_dsp/intrapred.c and +// vp8/common/reconintra.c. + +func IntraDCPredict16x16(dst []byte, dstStride int, above []byte, left []byte, upAvailable bool, leftAvailable bool) { + intraDCPredict16x16(dst, dstStride, above, left, upAvailable, leftAvailable) +} + +func IntraDCPredict8x8(dst []byte, dstStride int, above []byte, left []byte, upAvailable bool, leftAvailable bool) { + intraDCPredict8x8(dst, dstStride, above, left, upAvailable, leftAvailable) +} + +func IntraVerticalPredict16x16(dst []byte, dstStride int, above []byte) { + intraVerticalPredict16x16(dst, dstStride, above) +} + +func IntraVerticalPredict8x8(dst []byte, dstStride int, above []byte) { + intraVerticalPredict8x8(dst, dstStride, above) +} + +func IntraHorizontalPredict16x16(dst []byte, dstStride int, left []byte) { + intraHorizontalPredict16x16(dst, dstStride, left) +} + +func IntraHorizontalPredict8x8(dst []byte, dstStride int, left []byte) { + intraHorizontalPredict8x8(dst, dstStride, left) +} + +func IntraTMPredict16x16(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + intraTMPredict16x16(dst, dstStride, above, left, topLeft) +} + +func IntraTMPredict8x8(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + intraTMPredict8x8(dst, dstStride, above, left, topLeft) +} + +func intraDCPredictScalar(dst []byte, dstStride int, above []byte, left []byte, size int, upAvailable bool, leftAvailable bool) { + dc := 128 + + if upAvailable && leftAvailable { + ab := above[:size] + le := left[:size] + sum := 0 + for i := range size { + sum += int(ab[i]) + int(le[i]) + } + dc = (sum + size) / (2 * size) + } else if upAvailable { + ab := above[:size] + sum := 0 + for i := range size { + sum += int(ab[i]) + } + dc = (sum + (size >> 1)) / size + } else if leftAvailable { + le := left[:size] + sum := 0 + for i := range size { + sum += int(le[i]) + } + dc = (sum + (size >> 1)) / size + } + + fillBlock(dst, dstStride, size, byte(dc)) +} + +func intraVerticalPredictScalar(dst []byte, dstStride int, above []byte, size int) { + _ = above[size-1] + _ = dst[(size-1)*dstStride+size-1] + + for y := range size { + copy(dst[y*dstStride:y*dstStride+size], above[:size]) + } +} + +func intraHorizontalPredictScalar(dst []byte, dstStride int, left []byte, size int) { + _ = left[size-1] + _ = dst[(size-1)*dstStride+size-1] + + for y := range size { + row := y * dstStride + v := left[y] + for x := range size { + dst[row+x] = v + } + } +} + +func intraTMPredictScalar(dst []byte, dstStride int, above []byte, left []byte, topLeft byte, size int) { + _ = above[size-1] + _ = left[size-1] + _ = dst[(size-1)*dstStride+size-1] + + base := int(topLeft) + for y := range size { + row := y * dstStride + leftDelta := int(left[y]) - base + for x := range size { + dst[row+x] = ClipPixel(leftDelta + int(above[x])) + } + } +} + +func fillBlock(dst []byte, dstStride int, size int, v byte) { + _ = dst[(size-1)*dstStride+size-1] + + for y := range size { + row := y * dstStride + for x := range size { + dst[row+x] = v + } + } +} diff --git a/internal/vp8/dsp/intra4x4.go b/internal/vp8/dsp/intra4x4.go new file mode 100644 index 0000000..b961a1f --- /dev/null +++ b/internal/vp8/dsp/intra4x4.go @@ -0,0 +1,337 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/intra4x4.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "github.com/go-avkit/vpx/internal/vp8/common" +) + +// Ported from libvpx v1.16.0 vpx_dsp/intrapred.c and +// vp8/common/reconintra4x4.c. + +func Intra4x4Predict(dst []byte, dstStride int, mode common.BPredictionMode, above []byte, left []byte, topLeft byte) bool { + switch mode { + case common.BDCPred: + Intra4x4DCPredict(dst, dstStride, above, left) + case common.BTMPred: + Intra4x4TMPredict(dst, dstStride, above, left, topLeft) + case common.BVEPred: + Intra4x4VEPredict(dst, dstStride, above, topLeft) + case common.BHEPred: + Intra4x4HEPredict(dst, dstStride, left, topLeft) + case common.BLDPred: + Intra4x4LDPredict(dst, dstStride, above) + case common.BRDPred: + Intra4x4RDPredict(dst, dstStride, above, left, topLeft) + case common.BVRPred: + Intra4x4VRPredict(dst, dstStride, above, left, topLeft) + case common.BVLPred: + Intra4x4VLPredict(dst, dstStride, above) + case common.BHDPred: + Intra4x4HDPredict(dst, dstStride, above, left, topLeft) + case common.BHUPred: + Intra4x4HUPredict(dst, dstStride, left) + default: + return false + } + return true +} + +func Intra4x4DCPredict(dst []byte, dstStride int, above []byte, left []byte) { + _ = above[3] + _ = left[3] + _ = dst[3*dstStride+3] + intra4x4DCPredict(dst, dstStride, above, left) +} + +func Intra4x4TMPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + if pixel.TMNative && pixel.Enabled { + pixel.TMPredict4Native(dst, dstStride, above, left, topLeft, true) + return + } + _ = above[3] + _ = left[3] + _ = dst[3*dstStride+3] + intra4x4TMPredict(dst, dstStride, above, left, topLeft) +} + +func Intra4x4VEPredict(dst []byte, dstStride int, above []byte, topLeft byte) { + _ = above[4] + _ = dst[3*dstStride+3] + intra4x4VEPredict(dst, dstStride, above, topLeft) +} + +func Intra4x4HEPredict(dst []byte, dstStride int, left []byte, topLeft byte) { + _ = left[3] + _ = dst[3*dstStride+3] + intra4x4HEPredict(dst, dstStride, left, topLeft) +} + +func Intra4x4LDPredict(dst []byte, dstStride int, above []byte) { + _ = above[7] + _ = dst[3*dstStride+3] + intra4x4LDPredict(dst, dstStride, above) +} + +func Intra4x4RDPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + _ = above[3] + _ = left[3] + _ = dst[3*dstStride+3] + intra4x4RDPredict(dst, dstStride, above, left, topLeft) +} + +func Intra4x4VRPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + _ = above[3] + _ = left[2] + _ = dst[3*dstStride+3] + intra4x4VRPredict(dst, dstStride, above, left, topLeft) +} + +func Intra4x4VLPredict(dst []byte, dstStride int, above []byte) { + _ = above[7] + _ = dst[3*dstStride+3] + intra4x4VLPredict(dst, dstStride, above) +} + +func Intra4x4HDPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + _ = above[2] + _ = left[3] + _ = dst[3*dstStride+3] + intra4x4HDPredict(dst, dstStride, above, left, topLeft) +} + +func Intra4x4HUPredict(dst []byte, dstStride int, left []byte) { + _ = left[3] + _ = dst[3*dstStride+3] + intra4x4HUPredict(dst, dstStride, left) +} + +// Scalar reference kernels for the 4x4 B_PRED modes. These are the +// authoritative bit-exact implementations; SIMD dispatch files on amd64 +// and arm64 may shadow these names but must produce byte-identical +// output. Mirrors libvpx v1.16.0 vp8/common/reconintra4x4.c. + +func intra4x4DCPredictScalar(dst []byte, dstStride int, above []byte, left []byte) { + intraDCPredictScalar(dst, dstStride, above, left, 4, true, true) +} + +func intra4x4TMPredictScalar(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + intraTMPredictScalar(dst, dstStride, above, left, topLeft, 4) +} + +func intra4x4VEPredictScalar(dst []byte, dstStride int, above []byte, topLeft byte) { + row := [4]byte{ + avg3(topLeft, above[0], above[1]), + avg3(above[0], above[1], above[2]), + avg3(above[1], above[2], above[3]), + avg3(above[2], above[3], above[4]), + } + for y := range 4 { + copy(dst[y*dstStride:y*dstStride+4], row[:]) + } +} + +func intra4x4HEPredictScalar(dst []byte, dstStride int, left []byte, topLeft byte) { + fillRow4(dst[0*dstStride:], avg3(topLeft, left[0], left[1])) + fillRow4(dst[1*dstStride:], avg3(left[0], left[1], left[2])) + fillRow4(dst[2*dstStride:], avg3(left[1], left[2], left[3])) + fillRow4(dst[3*dstStride:], avg3(left[2], left[3], left[3])) +} + +func intra4x4LDPredictScalar(dst []byte, dstStride int, above []byte) { + // Pin each output row to a 4-byte array view so the per-cell writes + // run without bounds checks. The eight above[] taps go through a + // single pointer view for the same reason. + a8 := (*[8]byte)(above[:8]) + r0 := (*[4]byte)(dst[0*dstStride : 0*dstStride+4]) + r1 := (*[4]byte)(dst[1*dstStride : 1*dstStride+4]) + r2 := (*[4]byte)(dst[2*dstStride : 2*dstStride+4]) + r3 := (*[4]byte)(dst[3*dstStride : 3*dstStride+4]) + a, b, c, d := a8[0], a8[1], a8[2], a8[3] + e, f, g, h := a8[4], a8[5], a8[6], a8[7] + + r0[0] = avg3(a, b, c) + r0[1] = avg3(b, c, d) + r1[0] = r0[1] + r0[2] = avg3(c, d, e) + r1[1] = r0[2] + r2[0] = r0[2] + r0[3] = avg3(d, e, f) + r1[2] = r0[3] + r2[1] = r0[3] + r3[0] = r0[3] + r1[3] = avg3(e, f, g) + r2[2] = r1[3] + r3[1] = r1[3] + r2[3] = avg3(f, g, h) + r3[2] = r2[3] + r3[3] = avg3(g, h, h) +} + +func intra4x4RDPredictScalar(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + a4 := (*[4]byte)(above[:4]) + l4 := (*[4]byte)(left[:4]) + r0 := (*[4]byte)(dst[0*dstStride : 0*dstStride+4]) + r1 := (*[4]byte)(dst[1*dstStride : 1*dstStride+4]) + r2 := (*[4]byte)(dst[2*dstStride : 2*dstStride+4]) + r3 := (*[4]byte)(dst[3*dstStride : 3*dstStride+4]) + a, b, c, d := a4[0], a4[1], a4[2], a4[3] + i, j, k, l := l4[0], l4[1], l4[2], l4[3] + x := topLeft + + r3[0] = avg3(j, k, l) + r3[1] = avg3(i, j, k) + r2[0] = r3[1] + r3[2] = avg3(x, i, j) + r2[1] = r3[2] + r1[0] = r3[2] + r3[3] = avg3(a, x, i) + r2[2] = r3[3] + r1[1] = r3[3] + r0[0] = r3[3] + r2[3] = avg3(b, a, x) + r1[2] = r2[3] + r0[1] = r2[3] + r1[3] = avg3(c, b, a) + r0[2] = r1[3] + r0[3] = avg3(d, c, b) +} + +func intra4x4VRPredictScalar(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + a4 := (*[4]byte)(above[:4]) + l3 := (*[3]byte)(left[:3]) + r0 := (*[4]byte)(dst[0*dstStride : 0*dstStride+4]) + r1 := (*[4]byte)(dst[1*dstStride : 1*dstStride+4]) + r2 := (*[4]byte)(dst[2*dstStride : 2*dstStride+4]) + r3 := (*[4]byte)(dst[3*dstStride : 3*dstStride+4]) + a, b, c, d := a4[0], a4[1], a4[2], a4[3] + i, j, k := l3[0], l3[1], l3[2] + x := topLeft + + r0[0] = avg2(x, a) + r2[1] = r0[0] + r0[1] = avg2(a, b) + r2[2] = r0[1] + r0[2] = avg2(b, c) + r2[3] = r0[2] + r0[3] = avg2(c, d) + + r3[0] = avg3(k, j, i) + r2[0] = avg3(j, i, x) + r1[0] = avg3(i, x, a) + r3[1] = r1[0] + r1[1] = avg3(x, a, b) + r3[2] = r1[1] + r1[2] = avg3(a, b, c) + r3[3] = r1[2] + r1[3] = avg3(b, c, d) +} + +func intra4x4VLPredictScalar(dst []byte, dstStride int, above []byte) { + a8 := (*[8]byte)(above[:8]) + r0 := (*[4]byte)(dst[0*dstStride : 0*dstStride+4]) + r1 := (*[4]byte)(dst[1*dstStride : 1*dstStride+4]) + r2 := (*[4]byte)(dst[2*dstStride : 2*dstStride+4]) + r3 := (*[4]byte)(dst[3*dstStride : 3*dstStride+4]) + a, b, c, d := a8[0], a8[1], a8[2], a8[3] + e, f, g, h := a8[4], a8[5], a8[6], a8[7] + + r0[0] = avg2(a, b) + r0[1] = avg2(b, c) + r2[0] = r0[1] + r0[2] = avg2(c, d) + r2[1] = r0[2] + r0[3] = avg2(d, e) + r2[2] = r0[3] + r2[3] = avg3(e, f, g) + + r1[0] = avg3(a, b, c) + r1[1] = avg3(b, c, d) + r3[0] = r1[1] + r1[2] = avg3(c, d, e) + r3[1] = r1[2] + r1[3] = avg3(d, e, f) + r3[2] = r1[3] + r3[3] = avg3(f, g, h) +} + +func intra4x4HDPredictScalar(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + a3 := (*[3]byte)(above[:3]) + l4 := (*[4]byte)(left[:4]) + r0 := (*[4]byte)(dst[0*dstStride : 0*dstStride+4]) + r1 := (*[4]byte)(dst[1*dstStride : 1*dstStride+4]) + r2 := (*[4]byte)(dst[2*dstStride : 2*dstStride+4]) + r3 := (*[4]byte)(dst[3*dstStride : 3*dstStride+4]) + a, b, c := a3[0], a3[1], a3[2] + i, j, k, l := l4[0], l4[1], l4[2], l4[3] + x := topLeft + + r0[0] = avg2(i, x) + r1[2] = r0[0] + r1[0] = avg2(j, i) + r2[2] = r1[0] + r2[0] = avg2(k, j) + r3[2] = r2[0] + r3[0] = avg2(l, k) + + r0[3] = avg3(a, b, c) + r0[2] = avg3(x, a, b) + r0[1] = avg3(i, x, a) + r1[3] = r0[1] + r1[1] = avg3(j, i, x) + r2[3] = r1[1] + r2[1] = avg3(k, j, i) + r3[3] = r2[1] + r3[1] = avg3(l, k, j) +} + +func intra4x4HUPredictScalar(dst []byte, dstStride int, left []byte) { + l4 := (*[4]byte)(left[:4]) + r0 := (*[4]byte)(dst[0*dstStride : 0*dstStride+4]) + r1 := (*[4]byte)(dst[1*dstStride : 1*dstStride+4]) + r2 := (*[4]byte)(dst[2*dstStride : 2*dstStride+4]) + r3 := (*[4]byte)(dst[3*dstStride : 3*dstStride+4]) + i, j, k, l := l4[0], l4[1], l4[2], l4[3] + + r0[0] = avg2(i, j) + r0[2] = avg2(j, k) + r1[0] = r0[2] + r1[2] = avg2(k, l) + r2[0] = r1[2] + r0[1] = avg3(i, j, k) + r0[3] = avg3(j, k, l) + r1[1] = r0[3] + r1[3] = avg3(k, l, l) + r2[1] = r1[3] + r2[3] = l + r2[2] = l + r3[0] = l + r3[1] = l + r3[2] = l + r3[3] = l +} + +func avg2(a byte, b byte) byte { + return byte((int(a) + int(b) + 1) >> 1) +} + +func avg3(a byte, b byte, c byte) byte { + return byte((int(a) + 2*int(b) + int(c) + 2) >> 2) +} + +func fillRow4(dst []byte, v byte) { + _ = dst[3] + dst[0] = v + dst[1] = v + dst[2] = v + dst[3] = v +} diff --git a/internal/vp8/dsp/intra4x4_other.go b/internal/vp8/dsp/intra4x4_other.go new file mode 100644 index 0000000..ea915d6 --- /dev/null +++ b/internal/vp8/dsp/intra4x4_other.go @@ -0,0 +1,103 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/intra4x4_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/pixel" + +// Shared VP8 4x4 intra-prediction dispatch mirrors libvpx v1.16.0 +// vp8/common/reconintra4x4.c, using Go SIMD when enabled. + +func intra4x4DCPredict(dst []byte, dstStride int, above []byte, left []byte) { + if pixel.Enabled { + if pixel.Intra4x4DCFill(dst, dstStride, above, left) { + return + } + intraDCGo(dst, dstStride, above, left, 4, true, true) + } else { + intra4x4DCPredictScalar(dst, dstStride, above, left) + } +} + +func intra4x4TMPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + if pixel.Enabled { + if pixel.TMNative { + pixel.TMPredict4Native(dst, dstStride, above, left, topLeft, false) + } else { + pixel.TMPredict(dst, dstStride, above, left, topLeft, 4) + } + } else { + intra4x4TMPredictScalar(dst, dstStride, above, left, topLeft) + } +} + +func intra4x4VEPredict(dst []byte, dstStride int, above []byte, topLeft byte) { + if intraDirectionalGo(0, dst, dstStride, above, nil, topLeft) { + return + } + + intra4x4VEPredictScalar(dst, dstStride, above, topLeft) +} + +func intra4x4HEPredict(dst []byte, dstStride int, left []byte, topLeft byte) { + if intraDirectionalGo(1, dst, dstStride, nil, left, topLeft) { + return + } + + intra4x4HEPredictScalar(dst, dstStride, left, topLeft) +} + +func intra4x4LDPredict(dst []byte, dstStride int, above []byte) { + if intraDirectionalGo(2, dst, dstStride, above, nil, 0) { + return + } + + intra4x4LDPredictScalar(dst, dstStride, above) +} + +func intra4x4RDPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + if intraDirectionalGo(3, dst, dstStride, above, left, topLeft) { + return + } + + intra4x4RDPredictScalar(dst, dstStride, above, left, topLeft) +} + +func intra4x4VRPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + if intraDirectionalGo(4, dst, dstStride, above, left, topLeft) { + return + } + + intra4x4VRPredictScalar(dst, dstStride, above, left, topLeft) +} + +func intra4x4VLPredict(dst []byte, dstStride int, above []byte) { + if intraDirectionalGo(5, dst, dstStride, above, nil, 0) { + return + } + + intra4x4VLPredictScalar(dst, dstStride, above) +} + +func intra4x4HDPredict(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + if intraDirectionalGo(6, dst, dstStride, above, left, topLeft) { + return + } + + intra4x4HDPredictScalar(dst, dstStride, above, left, topLeft) +} + +func intra4x4HUPredict(dst []byte, dstStride int, left []byte) { + if intraDirectionalGo(7, dst, dstStride, nil, left, 0) { + return + } + + intra4x4HUPredictScalar(dst, dstStride, left) +} diff --git a/internal/vp8/dsp/intra_directional_simd.go b/internal/vp8/dsp/intra_directional_simd.go new file mode 100644 index 0000000..fbcd1b7 --- /dev/null +++ b/internal/vp8/dsp/intra_directional_simd.go @@ -0,0 +1,29 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/intra_directional_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package dsp + +import "github.com/go-avkit/vpx/internal/pixel" + +// libvpx v1.16.0 reconintra4x4.c uses avg2/avg3/copies. Four quarter +// samples represent all three exactly, including the single rounding. +func intraDirectionalGo(mode int, dst []byte, ds int, above, left []byte, top byte) bool { + if !pixel.Enabled { + return false + } + var border [16]byte + copy(border[:8], above) + copy(border[8:12], left) + border[12] = top + pixel.Intra4(dst, ds, &border, &intra4Selectors[mode]) + return true +} diff --git a/internal/vp8/dsp/intra_dispatch_other.go b/internal/vp8/dsp/intra_dispatch_other.go new file mode 100644 index 0000000..ef62c03 --- /dev/null +++ b/internal/vp8/dsp/intra_dispatch_other.go @@ -0,0 +1,119 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/intra_dispatch_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/pixel" + +// Pure-Go fallback for VP8 intra-prediction primitives. Mirrors +// libvpx v1.16.0 vp8/common/reconintra.c and vpx_dsp/intrapred.c +// semantics. + +func intraDCPredict16x16(dst []byte, dstStride int, above []byte, left []byte, upAvailable bool, leftAvailable bool) { + if pixel.Enabled { + if pixel.IntraDCFillNative && !upAvailable && !leftAvailable { + pixel.FillBlock(dst, dstStride, 16, 16, 128) + return + } + if pixel.IntraDCFill(dst, dstStride, above, left, 16, upAvailable, leftAvailable) { + return + } + intraDCGo(dst, dstStride, above, left, 16, upAvailable, leftAvailable) + } else { + intraDCPredictScalar(dst, dstStride, above, left, 16, upAvailable, leftAvailable) + } +} + +func intraDCPredict8x8(dst []byte, dstStride int, above []byte, left []byte, upAvailable bool, leftAvailable bool) { + if pixel.Enabled { + if pixel.IntraDCFillNative && !upAvailable && !leftAvailable { + pixel.FillBlock(dst, dstStride, 8, 8, 128) + return + } + if pixel.IntraDCFill(dst, dstStride, above, left, 8, upAvailable, leftAvailable) { + return + } + intraDCGo(dst, dstStride, above, left, 8, upAvailable, leftAvailable) + } else { + intraDCPredictScalar(dst, dstStride, above, left, 8, upAvailable, leftAvailable) + } +} + +func intraVerticalPredict16x16(dst []byte, dstStride int, above []byte) { + if pixel.Enabled { + pixel.RepeatRow(dst, dstStride, above, 16) + } else { + intraVerticalPredictScalar(dst, dstStride, above, 16) + } +} + +func intraVerticalPredict8x8(dst []byte, dstStride int, above []byte) { + if pixel.Enabled { + pixel.RepeatRow(dst, dstStride, above, 8) + } else { + intraVerticalPredictScalar(dst, dstStride, above, 8) + } +} + +func intraHorizontalPredict16x16(dst []byte, dstStride int, left []byte) { + if pixel.Enabled { + pixel.Horizontal(dst, dstStride, left, 16) + } else { + intraHorizontalPredictScalar(dst, dstStride, left, 16) + } +} + +func intraHorizontalPredict8x8(dst []byte, dstStride int, left []byte) { + if pixel.Enabled { + pixel.Horizontal(dst, dstStride, left, 8) + } else { + intraHorizontalPredictScalar(dst, dstStride, left, 8) + } +} + +func intraTMPredict16x16(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + if pixel.Enabled { + if pixel.TMNative { + pixel.TMPredictNative(dst, dstStride, above, left, topLeft, 16) + } else { + pixel.TMPredict(dst, dstStride, above, left, topLeft, 16) + } + } else { + intraTMPredictScalar(dst, dstStride, above, left, topLeft, 16) + } +} + +func intraTMPredict8x8(dst []byte, dstStride int, above []byte, left []byte, topLeft byte) { + if pixel.Enabled { + if pixel.TMNative { + pixel.TMPredictNative(dst, dstStride, above, left, topLeft, 8) + } else { + pixel.TMPredict(dst, dstStride, above, left, topLeft, 8) + } + } else { + intraTMPredictScalar(dst, dstStride, above, left, topLeft, 8) + } +} + +func intraDCGo(dst []byte, ds int, above, left []byte, n int, up, lf bool) { + dc, sum, count := 128, 0, 0 + if up { + sum += pixel.Sum(above, n, n, 1) + count += n + } + if lf { + sum += pixel.Sum(left, n, n, 1) + count += n + } + if count > 0 { + dc = (sum + count/2) / count + } + pixel.FillBlock(dst, ds, n, n, byte(dc)) +} diff --git a/internal/vp8/dsp/intra_selectors.go b/internal/vp8/dsp/intra_selectors.go new file mode 100644 index 0000000..894f661 --- /dev/null +++ b/internal/vp8/dsp/intra_selectors.go @@ -0,0 +1,64 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/intra_selectors.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Code generated by go test -tags govpx_generate -run TestGenerateIntraSIMD; DO NOT EDIT. +// libvpx v1.16.0 directional predictor selectors, in VE/HE/LD/RD/VR/VL/HD/HU order. +package dsp + +var intra4Selectors = [8][4][16]byte{ + { + [16]uint8{0x0, 0x0, 0x1, 0x2, 0x0, 0x0, 0x1, 0x2, 0x0, 0x0, 0x1, 0x2, 0x0, 0x0, 0x1, 0x2}, + [16]uint8{0x0, 0x1, 0x2, 0x3, 0x0, 0x1, 0x2, 0x3, 0x0, 0x1, 0x2, 0x3, 0x0, 0x1, 0x2, 0x3}, + [16]uint8{0x1, 0x1, 0x2, 0x3, 0x1, 0x1, 0x2, 0x3, 0x1, 0x1, 0x2, 0x3, 0x1, 0x1, 0x2, 0x3}, + [16]uint8{0xc, 0x2, 0x3, 0x4, 0xc, 0x2, 0x3, 0x4, 0xc, 0x2, 0x3, 0x4, 0xc, 0x2, 0x3, 0x4}, + }, + { + [16]uint8{0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa}, + [16]uint8{0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb}, + [16]uint8{0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb}, + [16]uint8{0xc, 0xc, 0xc, 0xc, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb}, + }, + { + [16]uint8{0x0, 0x1, 0x2, 0x3, 0x1, 0x2, 0x3, 0x4, 0x2, 0x3, 0x4, 0x5, 0x3, 0x4, 0x5, 0x6}, + [16]uint8{0x1, 0x2, 0x3, 0x4, 0x2, 0x3, 0x4, 0x5, 0x3, 0x4, 0x5, 0x6, 0x4, 0x5, 0x6, 0x7}, + [16]uint8{0x1, 0x2, 0x3, 0x4, 0x2, 0x3, 0x4, 0x5, 0x3, 0x4, 0x5, 0x6, 0x4, 0x5, 0x6, 0x7}, + [16]uint8{0x2, 0x3, 0x4, 0x5, 0x3, 0x4, 0x5, 0x6, 0x4, 0x5, 0x6, 0x7, 0x5, 0x6, 0x7, 0x7}, + }, + { + [16]uint8{0x0, 0x0, 0x0, 0x1, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x9, 0x8, 0x8, 0x0}, + [16]uint8{0x8, 0x0, 0x1, 0x2, 0x8, 0x8, 0x0, 0x1, 0x9, 0x8, 0x8, 0x0, 0xa, 0x9, 0x8, 0x8}, + [16]uint8{0xc, 0x1, 0x1, 0x2, 0x9, 0xc, 0x1, 0x1, 0x9, 0x9, 0xc, 0x1, 0xa, 0x9, 0x9, 0xc}, + [16]uint8{0xc, 0xc, 0x2, 0x3, 0xc, 0xc, 0xc, 0x2, 0xa, 0xc, 0xc, 0xc, 0xb, 0xa, 0xc, 0xc}, + }, + { + [16]uint8{0x0, 0x0, 0x1, 0x2, 0x0, 0x0, 0x0, 0x1, 0x8, 0x0, 0x0, 0x1, 0x8, 0x0, 0x0, 0x0}, + [16]uint8{0x0, 0x0, 0x1, 0x2, 0x8, 0x0, 0x1, 0x2, 0x8, 0x0, 0x0, 0x1, 0x9, 0x8, 0x0, 0x1}, + [16]uint8{0xc, 0x1, 0x2, 0x3, 0xc, 0x1, 0x1, 0x2, 0x9, 0xc, 0x1, 0x2, 0x9, 0xc, 0x1, 0x1}, + [16]uint8{0xc, 0x1, 0x2, 0x3, 0xc, 0xc, 0x2, 0x3, 0xc, 0xc, 0x1, 0x2, 0xa, 0xc, 0xc, 0x2}, + }, + { + [16]uint8{0x0, 0x1, 0x2, 0x3, 0x0, 0x1, 0x2, 0x3, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x5}, + [16]uint8{0x0, 0x1, 0x2, 0x3, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x5, 0x2, 0x3, 0x4, 0x6}, + [16]uint8{0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x2, 0x3, 0x4, 0x5, 0x2, 0x3, 0x4, 0x6}, + [16]uint8{0x1, 0x2, 0x3, 0x4, 0x2, 0x3, 0x4, 0x5, 0x2, 0x3, 0x4, 0x6, 0x3, 0x4, 0x5, 0x7}, + }, + { + [16]uint8{0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x0, 0x9, 0x8, 0x8, 0x8, 0xa, 0x9, 0x9, 0x8}, + [16]uint8{0x8, 0x8, 0x0, 0x1, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x8, 0x8, 0xa, 0xa, 0x9, 0x9}, + [16]uint8{0xc, 0xc, 0x1, 0x1, 0x9, 0x9, 0xc, 0xc, 0xa, 0x9, 0x9, 0x9, 0xb, 0xa, 0xa, 0x9}, + [16]uint8{0xc, 0xc, 0xc, 0x2, 0x9, 0xc, 0xc, 0xc, 0xa, 0xa, 0x9, 0xc, 0xb, 0xb, 0xa, 0xa}, + }, + { + [16]uint8{0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb}, + [16]uint8{0x8, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xb, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb}, + [16]uint8{0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb}, + [16]uint8{0x9, 0xa, 0xa, 0xb, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb}, + }, +} diff --git a/internal/vp8/dsp/loopfilter.go b/internal/vp8/dsp/loopfilter.go new file mode 100644 index 0000000..35b02e3 --- /dev/null +++ b/internal/vp8/dsp/loopfilter.go @@ -0,0 +1,361 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/loopfilter.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "encoding/binary" +) + +func LoopFilterSimpleHorizontalEdge(s []byte, stride int, blimit byte) { + loopFilterSimpleHorizontalEdgeDispatch(s, stride, blimit) +} + +func LoopFilterSimpleVerticalEdge(s []byte, stride int, blimit byte) { + loopFilterSimpleVerticalEdgeDispatch(s, stride, blimit) +} + +// loopFilterSimpleHorizontalEdgeScalar is the libvpx-style scalar reference +// for LoopFilterSimpleHorizontalEdge; kept as the per-platform fallback +// when the SIMD dispatch can't take the fast path. +func loopFilterSimpleHorizontalEdgeScalar(s []byte, stride int, blimit byte) { + _ = s[3*stride+15] + r0 := (*[16]byte)(s[:16]) + r1 := (*[16]byte)(s[stride : stride+16]) + r2 := (*[16]byte)(s[2*stride : 2*stride+16]) + r3 := (*[16]byte)(s[3*stride : 3*stride+16]) + blim := int(blimit) + + if binary.LittleEndian.Uint64(r1[:8]) != binary.LittleEndian.Uint64(r2[:8]) || + binary.LittleEndian.Uint64(r0[:8]) != binary.LittleEndian.Uint64(r3[:8]) { + for i := 0; i < 8; i += 2 { + p1a, p0a, q0a, q1a := int(r0[i]), int(r1[i]), int(r2[i]), int(r3[i]) + d0a := q0a - p0a + d1a := p1a - q1a + maska := (max(d0a, -d0a)*2 + (max(d1a, -d1a) >> 1) - blim - 1) >> signShift + fva := min(max(min(max(d1a, -128), 127)+3*d0a, -128), 127) & maska + r2[i] = byte(min(max(q0a-(min(fva+4, 127)>>3), 0), 255)) + r1[i] = byte(min(max(p0a+(min(fva+3, 127)>>3), 0), 255)) + + p1b, p0b, q0b, q1b := int(r0[i+1]), int(r1[i+1]), int(r2[i+1]), int(r3[i+1]) + d0b := q0b - p0b + d1b := p1b - q1b + maskb := (max(d0b, -d0b)*2 + (max(d1b, -d1b) >> 1) - blim - 1) >> signShift + fvb := min(max(min(max(d1b, -128), 127)+3*d0b, -128), 127) & maskb + r2[i+1] = byte(min(max(q0b-(min(fvb+4, 127)>>3), 0), 255)) + r1[i+1] = byte(min(max(p0b+(min(fvb+3, 127)>>3), 0), 255)) + } + } + if binary.LittleEndian.Uint64(r1[8:16]) != binary.LittleEndian.Uint64(r2[8:16]) || + binary.LittleEndian.Uint64(r0[8:16]) != binary.LittleEndian.Uint64(r3[8:16]) { + for i := 8; i < 16; i += 2 { + p1a, p0a, q0a, q1a := int(r0[i]), int(r1[i]), int(r2[i]), int(r3[i]) + d0a := q0a - p0a + d1a := p1a - q1a + maska := (max(d0a, -d0a)*2 + (max(d1a, -d1a) >> 1) - blim - 1) >> signShift + fva := min(max(min(max(d1a, -128), 127)+3*d0a, -128), 127) & maska + r2[i] = byte(min(max(q0a-(min(fva+4, 127)>>3), 0), 255)) + r1[i] = byte(min(max(p0a+(min(fva+3, 127)>>3), 0), 255)) + + p1b, p0b, q0b, q1b := int(r0[i+1]), int(r1[i+1]), int(r2[i+1]), int(r3[i+1]) + d0b := q0b - p0b + d1b := p1b - q1b + maskb := (max(d0b, -d0b)*2 + (max(d1b, -d1b) >> 1) - blim - 1) >> signShift + fvb := min(max(min(max(d1b, -128), 127)+3*d0b, -128), 127) & maskb + r2[i+1] = byte(min(max(q0b-(min(fvb+4, 127)>>3), 0), 255)) + r1[i+1] = byte(min(max(p0b+(min(fvb+3, 127)>>3), 0), 255)) + } + } +} + +func loopFilterSimpleVerticalEdgeScalar(s []byte, stride int, blimit byte) { + _ = s[15*stride+3] + blim := int(blimit) + off := 0 + + for range 8 { + row0 := (*[4]byte)(s[off : off+4]) + row1 := (*[4]byte)(s[off+stride : off+stride+4]) + v0 := binary.LittleEndian.Uint32(row0[:]) + v1 := binary.LittleEndian.Uint32(row1[:]) + + p1a := int(v0 & 0xff) + p0a := int((v0 >> 8) & 0xff) + q0a := int((v0 >> 16) & 0xff) + q1a := int(v0 >> 24) + d0a := q0a - p0a + d1a := p1a - q1a + maska := (max(d0a, -d0a)*2 + (max(d1a, -d1a) >> 1) - blim - 1) >> signShift + fva := min(max(min(max(d1a, -128), 127)+3*d0a, -128), 127) & maska + row0[2] = byte(min(max(q0a-(min(fva+4, 127)>>3), 0), 255)) + row0[1] = byte(min(max(p0a+(min(fva+3, 127)>>3), 0), 255)) + + p1b := int(v1 & 0xff) + p0b := int((v1 >> 8) & 0xff) + q0b := int((v1 >> 16) & 0xff) + q1b := int(v1 >> 24) + d0b := q0b - p0b + d1b := p1b - q1b + maskb := (max(d0b, -d0b)*2 + (max(d1b, -d1b) >> 1) - blim - 1) >> signShift + fvb := min(max(min(max(d1b, -128), 127)+3*d0b, -128), 127) & maskb + row1[2] = byte(min(max(q0b-(min(fvb+4, 127)>>3), 0), 255)) + row1[1] = byte(min(max(p0b+(min(fvb+3, 127)>>3), 0), 255)) + + off += 2 * stride + } +} + +// LoopFilterHorizontalEdgesY applies the three 16-wide inner luma horizontal +// edges of one macroblock. This mirrors libvpx's vp8_loop_filter_bh wrapper. +func LoopFilterHorizontalEdgesY(s []byte, stride int, blimit byte, limit byte, thresh byte) { + loopFilterHorizontalEdgesYDispatch(s, stride, blimit, limit, thresh) +} + +// LoopFilterVerticalEdgesY applies the three 16-wide inner luma vertical edges +// of one macroblock. This mirrors libvpx's vp8_loop_filter_bv wrapper. +func LoopFilterVerticalEdgesY(s []byte, stride int, blimit byte, limit byte, thresh byte) { + loopFilterVerticalEdgesYDispatch(s, stride, blimit, limit, thresh) +} + +func LoopFilterHorizontalEdgeUV(u []byte, v []byte, stride int, blimit byte, limit byte, thresh byte) { + loopFilterHorizontalEdgeUVDispatch(u, v, stride, blimit, limit, thresh) +} + +func LoopFilterVerticalEdgeUV(u []byte, v []byte, stride int, blimit byte, limit byte, thresh byte) { + loopFilterVerticalEdgeUVDispatch(u, v, stride, blimit, limit, thresh) +} + +func MBLoopFilterHorizontalEdge(s []byte, stride int, blimit byte, limit byte, thresh byte, count int) { + mbLoopFilterHorizontalEdgeDispatch(s, stride, blimit, limit, thresh, count) +} + +func MBLoopFilterVerticalEdge(s []byte, stride int, blimit byte, limit byte, thresh byte, count int) { + mbLoopFilterVerticalEdgeDispatch(s, stride, blimit, limit, thresh, count) +} + +func MBLoopFilterHorizontalEdgeUV(u []byte, v []byte, stride int, blimit byte, limit byte, thresh byte) { + mbLoopFilterHorizontalEdgeUVDispatch(u, v, stride, blimit, limit, thresh) +} + +func MBLoopFilterVerticalEdgeUV(u []byte, v []byte, stride int, blimit byte, limit byte, thresh byte) { + mbLoopFilterVerticalEdgeUVDispatch(u, v, stride, blimit, limit, thresh) +} + +// loopFilterHorizontalEdgeScalar is the libvpx-style scalar reference for +// LoopFilterHorizontalEdge; it stays as the per-platform fallback when +// the SIMD dispatch can't take the fast path. Body unchanged from the +// original libvpx loopfilter_filters.c port. +func loopFilterHorizontalEdgeScalar(s []byte, stride int, blimit byte, limit byte, thresh byte, count int) { + n := count * 8 + _ = s[7*stride+n-1] + + for i := range n { + p3v := s[i] + p2v := s[i+stride] + p1 := &s[i+2*stride] + p0 := &s[i+3*stride] + q0 := &s[i+4*stride] + q1 := &s[i+5*stride] + q2v := s[i+6*stride] + q3v := s[i+7*stride] + p1v, p0v := *p1, *p0 + q0v, q1v := *q0, *q1 + if absByteDiff(p3v, p2v) > limit || + absByteDiff(p2v, p1v) > limit || + absByteDiff(p1v, p0v) > limit || + absByteDiff(q1v, q0v) > limit || + absByteDiff(q2v, q1v) > limit || + absByteDiff(q3v, q2v) > limit || + int(absByteDiff(p0v, q0v))*2+int(absByteDiff(p1v, q1v))/2 > int(blimit) { + continue + } + hev := hevMask(thresh, p1v, p0v, q0v, q1v) + loopFilter(-1, hev, p1, p0, q0, q1) + } +} + +func loopFilterVerticalEdgeScalar(s []byte, stride int, blimit byte, limit byte, thresh byte, count int) { + n := count * 8 + _ = s[(n-1)*stride+7] + + for i := range n { + row := s[i*stride:] + p3v, p2v := row[0], row[1] + p1, p0 := &row[2], &row[3] + q0, q1 := &row[4], &row[5] + q2v, q3v := row[6], row[7] + p1v, p0v := *p1, *p0 + q0v, q1v := *q0, *q1 + if absByteDiff(p3v, p2v) > limit || + absByteDiff(p2v, p1v) > limit || + absByteDiff(p1v, p0v) > limit || + absByteDiff(q1v, q0v) > limit || + absByteDiff(q2v, q1v) > limit || + absByteDiff(q3v, q2v) > limit || + int(absByteDiff(p0v, q0v))*2+int(absByteDiff(p1v, q1v))/2 > int(blimit) { + continue + } + hev := hevMask(thresh, p1v, p0v, q0v, q1v) + loopFilter(-1, hev, p1, p0, q0, q1) + } +} + +func mbLoopFilterHorizontalEdgeScalar(s []byte, stride int, blimit byte, limit byte, thresh byte, count int) { + n := count * 8 + _ = s[7*stride+n-1] + + for i := range n { + p3v := s[i] + p2 := &s[i+stride] + p1 := &s[i+2*stride] + p0 := &s[i+3*stride] + q0 := &s[i+4*stride] + q1 := &s[i+5*stride] + q2 := &s[i+6*stride] + q3v := s[i+7*stride] + p2v, p1v, p0v := *p2, *p1, *p0 + q0v, q1v, q2v := *q0, *q1, *q2 + if absByteDiff(p3v, p2v) > limit || + absByteDiff(p2v, p1v) > limit || + absByteDiff(p1v, p0v) > limit || + absByteDiff(q1v, q0v) > limit || + absByteDiff(q2v, q1v) > limit || + absByteDiff(q3v, q2v) > limit || + int(absByteDiff(p0v, q0v))*2+int(absByteDiff(p1v, q1v))/2 > int(blimit) { + continue + } + hev := hevMask(thresh, p1v, p0v, q0v, q1v) + mbLoopFilter(-1, hev, p2, p1, p0, q0, q1, q2) + } +} + +func mbLoopFilterVerticalEdgeScalar(s []byte, stride int, blimit byte, limit byte, thresh byte, count int) { + n := count * 8 + _ = s[(n-1)*stride+7] + + for i := range n { + row := s[i*stride:] + p3v := row[0] + p2, p1, p0 := &row[1], &row[2], &row[3] + q0, q1, q2 := &row[4], &row[5], &row[6] + q3v := row[7] + p2v, p1v, p0v := *p2, *p1, *p0 + q0v, q1v, q2v := *q0, *q1, *q2 + if absByteDiff(p3v, p2v) > limit || + absByteDiff(p2v, p1v) > limit || + absByteDiff(p1v, p0v) > limit || + absByteDiff(q1v, q0v) > limit || + absByteDiff(q2v, q1v) > limit || + absByteDiff(q3v, q2v) > limit || + int(absByteDiff(p0v, q0v))*2+int(absByteDiff(p1v, q1v))/2 > int(blimit) { + continue + } + hev := hevMask(thresh, p1v, p0v, q0v, q1v) + mbLoopFilter(-1, hev, p2, p1, p0, q0, q1, q2) + } +} + +// signedCharClamp saturates v into [-128, 127] without conditional branches. +// Called per-pixel from the loopfilter inner kernel. +func signedCharClamp(v int) int8 { + return int8(min(max(v, -128), 127)) +} + +// hevMask returns -1 when either p1-p0 or q1-q0 exceeds the high-edge +// threshold, 0 otherwise. Branchless: subtract once each, splat the sign +// bit from `thresh - diff` and OR the two masks so the inner loopfilter +// kernel can stay branch-free. +func hevMask(thresh byte, p1 byte, p0 byte, q0 byte, q1 byte) int8 { + d1 := int(absByteDiff(p1, p0)) - int(thresh) - 1 + d2 := int(absByteDiff(q1, q0)) - int(thresh) - 1 + // d1<0 (diff <= thresh) → mask 0; d1>=0 → mask -1. + mask := ^(d1 >> signShift) | ^(d2 >> signShift) + return int8(mask) +} + +func loopFilter(mask int8, hev int8, op1 *byte, op0 *byte, oq0 *byte, oq1 *byte) { + ps1 := signedPixel(*op1) + ps0 := signedPixel(*op0) + qs0 := signedPixel(*oq0) + qs1 := signedPixel(*oq1) + + filterValue := signedCharClamp(int(ps1) - int(qs1)) + filterValue &= hev + filterValue = signedCharClamp(int(filterValue) + 3*(int(qs0)-int(ps0))) + filterValue &= mask + + filter1 := signedCharClamp(int(filterValue) + 4) + filter2 := signedCharClamp(int(filterValue) + 3) + filter1 = int8(int(filter1) >> 3) + filter2 = int8(int(filter2) >> 3) + *oq0 = unsignedPixel(signedCharClamp(int(qs0) - int(filter1))) + *op0 = unsignedPixel(signedCharClamp(int(ps0) + int(filter2))) + + filterValue = filter1 + filterValue++ + filterValue = int8(int(filterValue) >> 1) + filterValue &= ^hev + + *oq1 = unsignedPixel(signedCharClamp(int(qs1) - int(filterValue))) + *op1 = unsignedPixel(signedCharClamp(int(ps1) + int(filterValue))) +} + +func mbLoopFilter(mask int8, hev int8, op2 *byte, op1 *byte, op0 *byte, oq0 *byte, oq1 *byte, oq2 *byte) { + ps2 := signedPixel(*op2) + ps1 := signedPixel(*op1) + ps0 := signedPixel(*op0) + qs0 := signedPixel(*oq0) + qs1 := signedPixel(*oq1) + qs2 := signedPixel(*oq2) + + filterValue := signedCharClamp(int(ps1) - int(qs1)) + filterValue = signedCharClamp(int(filterValue) + 3*(int(qs0)-int(ps0))) + filterValue &= mask + + filter2 := filterValue & hev + filter1 := signedCharClamp(int(filter2) + 4) + filter2 = signedCharClamp(int(filter2) + 3) + filter1 = int8(int(filter1) >> 3) + filter2 = int8(int(filter2) >> 3) + qs0 = signedCharClamp(int(qs0) - int(filter1)) + ps0 = signedCharClamp(int(ps0) + int(filter2)) + + filterValue &= ^hev + filter2 = filterValue + + u := signedCharClamp((63 + int(filter2)*27) >> 7) + *oq0 = unsignedPixel(signedCharClamp(int(qs0) - int(u))) + *op0 = unsignedPixel(signedCharClamp(int(ps0) + int(u))) + + u = signedCharClamp((63 + int(filter2)*18) >> 7) + *oq1 = unsignedPixel(signedCharClamp(int(qs1) - int(u))) + *op1 = unsignedPixel(signedCharClamp(int(ps1) + int(u))) + + u = signedCharClamp((63 + int(filter2)*9) >> 7) + *oq2 = unsignedPixel(signedCharClamp(int(qs2) - int(u))) + *op2 = unsignedPixel(signedCharClamp(int(ps2) + int(u))) +} + +func signedPixel(v byte) int8 { + return int8(v ^ 0x80) +} + +func unsignedPixel(v int8) byte { + return byte(v) ^ 0x80 +} + +// absByteDiff returns |a-b| without a conditional branch. The unsigned +// subtraction wraps when a < b; XOR by the sign-extended top bit +// reflects the value back into a positive byte. +func absByteDiff(a byte, b byte) byte { + d := int(a) - int(b) + mask := d >> signShift // -1 when d < 0, 0 otherwise + return byte((d ^ mask) - mask) +} diff --git a/internal/vp8/dsp/loopfilter_dispatch_other.go b/internal/vp8/dsp/loopfilter_dispatch_other.go new file mode 100644 index 0000000..c3d1da4 --- /dev/null +++ b/internal/vp8/dsp/loopfilter_dispatch_other.go @@ -0,0 +1,119 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/loopfilter_dispatch_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/pixel" + +// Pure-Go fallback for VP8 loop-filter apply paths (libvpx v1.16.0 baseline). + +func loopFilterHorizontalEdgeDispatch(s []byte, stride int, blimit, limit, thresh byte, count int) { + if pixel.LoopFilter(s, 4*stride, stride, 1, count*8, int(blimit), int(limit), int(thresh), 4) { + return + } + + loopFilterHorizontalEdgeScalar(s, stride, blimit, limit, thresh, count) +} + +func loopFilterHorizontalEdgesYDispatch(s []byte, stride int, blimit, limit, thresh byte) { + if pixel.LoopFilterInternal16(s, stride, 1, int(blimit), int(limit), int(thresh)) { + return + } + loopFilterHorizontalEdgeDispatch(s, stride, blimit, limit, thresh, 2) + loopFilterHorizontalEdgeDispatch(s[4*stride:], stride, blimit, limit, thresh, 2) + loopFilterHorizontalEdgeDispatch(s[8*stride:], stride, blimit, limit, thresh, 2) +} + +func loopFilterVerticalEdgeDispatch(s []byte, stride int, blimit, limit, thresh byte, count int) { + if pixel.LoopFilter(s, 4*1, 1, stride, count*8, int(blimit), int(limit), int(thresh), 4) { + return + } + + loopFilterVerticalEdgeScalar(s, stride, blimit, limit, thresh, count) +} + +func loopFilterVerticalEdgesYDispatch(s []byte, stride int, blimit, limit, thresh byte) { + if pixel.LoopFilterInternal16(s, 1, stride, int(blimit), int(limit), int(thresh)) { + return + } + loopFilterVerticalEdgeDispatch(s, stride, blimit, limit, thresh, 2) + loopFilterVerticalEdgeDispatch(s[4:], stride, blimit, limit, thresh, 2) + loopFilterVerticalEdgeDispatch(s[8:], stride, blimit, limit, thresh, 2) +} + +func loopFilterHorizontalEdgeUVDispatch(u []byte, v []byte, stride int, blimit, limit, thresh byte) { + if pixel.LoopFilterUV8(u, v, stride, 1, int(blimit), int(limit), int(thresh), 4) { + return + } + loopFilterHorizontalEdgeDispatch(u, stride, blimit, limit, thresh, 1) + loopFilterHorizontalEdgeDispatch(v, stride, blimit, limit, thresh, 1) +} + +func loopFilterVerticalEdgeUVDispatch(u []byte, v []byte, stride int, blimit, limit, thresh byte) { + if pixel.LoopFilterUV8(u, v, 1, stride, int(blimit), int(limit), int(thresh), 4) { + return + } + loopFilterVerticalEdgeDispatch(u, stride, blimit, limit, thresh, 1) + loopFilterVerticalEdgeDispatch(v, stride, blimit, limit, thresh, 1) +} + +func mbLoopFilterHorizontalEdgeDispatch(s []byte, stride int, blimit, limit, thresh byte, count int) { + if pixel.LoopFilter(s, 4*stride, stride, 1, count*8, int(blimit), int(limit), int(thresh), 6) { + return + } + + mbLoopFilterHorizontalEdgeScalar(s, stride, blimit, limit, thresh, count) +} + +func mbLoopFilterVerticalEdgeDispatch(s []byte, stride int, blimit, limit, thresh byte, count int) { + if pixel.LoopFilter(s, 4*1, 1, stride, count*8, int(blimit), int(limit), int(thresh), 6) { + return + } + + mbLoopFilterVerticalEdgeScalar(s, stride, blimit, limit, thresh, count) +} + +func mbLoopFilterHorizontalEdgeUVDispatch(u []byte, v []byte, stride int, blimit, limit, thresh byte) { + if pixel.LoopFilterUV8(u, v, stride, 1, int(blimit), int(limit), int(thresh), 6) { + return + } + mbLoopFilterHorizontalEdgeDispatch(u, stride, blimit, limit, thresh, 1) + mbLoopFilterHorizontalEdgeDispatch(v, stride, blimit, limit, thresh, 1) +} + +func mbLoopFilterVerticalEdgeUVDispatch(u []byte, v []byte, stride int, blimit, limit, thresh byte) { + if pixel.LoopFilterUV8(u, v, 1, stride, int(blimit), int(limit), int(thresh), 6) { + return + } + mbLoopFilterVerticalEdgeDispatch(u, stride, blimit, limit, thresh, 1) + mbLoopFilterVerticalEdgeDispatch(v, stride, blimit, limit, thresh, 1) +} + +func loopFilterSimpleHorizontalEdgeDispatch(s []byte, stride int, blimit byte) { + if pixel.LoopFilterSimpleHorizontal16(s, stride, blimit) { + return + } + if pixel.LoopFilter(s, 2*stride, stride, 1, 16, int(blimit), 0, 0, 2) { + return + } + + loopFilterSimpleHorizontalEdgeScalar(s, stride, blimit) +} + +func loopFilterSimpleVerticalEdgeDispatch(s []byte, stride int, blimit byte) { + if pixel.LoopFilterSimpleVertical16(s, stride, blimit) { + return + } + if pixel.LoopFilter(s, 2*1, 1, stride, 16, int(blimit), 0, 0, 2) { + return + } + + loopFilterSimpleVerticalEdgeScalar(s, stride, blimit) +} diff --git a/internal/vp8/dsp/recon.go b/internal/vp8/dsp/recon.go new file mode 100644 index 0000000..f0709af --- /dev/null +++ b/internal/vp8/dsp/recon.go @@ -0,0 +1,39 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/recon.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" +) + +func Copy8x4(src []byte, srcStride int, dst []byte, dstStride int) { + copyBlock(src, srcStride, dst, dstStride, 8, 4) +} + +func Copy8x8(src []byte, srcStride int, dst []byte, dstStride int) { + if pixel.Copy8Rows(src, srcStride, dst, dstStride) { + return + } + copyBlock(src, srcStride, dst, dstStride, 8, 8) +} + +func Copy16x16(src []byte, srcStride int, dst []byte, dstStride int) { + if pixel.Copy16Rows(src, srcStride, dst, dstStride) { + return + } + copyBlock(src, srcStride, dst, dstStride, 16, 16) +} + +func copyBlock(src []byte, srcStride int, dst []byte, dstStride int, width int, height int) { + for y := range height { + copy(dst[y*dstStride:y*dstStride+width], src[y*srcStride:y*srcStride+width]) + } +} diff --git a/internal/vp8/dsp/sse4_packed_simd.go b/internal/vp8/dsp/sse4_packed_simd.go new file mode 100644 index 0000000..3955f33 --- /dev/null +++ b/internal/vp8/dsp/sse4_packed_simd.go @@ -0,0 +1,38 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/sse4_packed_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +// Ported from libvpx v1.16.0. +package dsp + +import ( + "encoding/binary" + "github.com/go-avkit/vpx/internal/pixel" + "simd/archsimd" +) + +func sse4PackRows(p []byte, s int) archsimd.Uint8x16 { + return archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(p)).SetElem(1, binary.LittleEndian.Uint32(p[s:])).SetElem(2, binary.LittleEndian.Uint32(p[2*s:])).SetElem(3, binary.LittleEndian.Uint32(p[3*s:])).ReshapeToUint8s() +} +func sse4RowsGo(src []byte, ss int, ref []byte, rs, h int) (int, bool) { + if !pixel.Enabled || ss < 0 || rs < 0 || len(src) < 4 || len(ref) < 4 || ss > (len(src)-4)/(h-1) || rs > (len(ref)-4)/(h-1) { + return 0, false + } + var total archsimd.Int32x4 + for y := 0; y < h; y += 4 { + a, b := sse4PackRows(src[y*ss:], ss), sse4PackRows(ref[y*rs:], rs) + d := a.Max(b).Sub(a.Min(b)) + lo, hi := d.ExtendLo8ToUint16().BitsToInt16(), d.HiToLo().ExtendLo8ToUint16().BitsToInt16() + total = total.Add(lo.MulWidenLo(lo)).Add(lo.HiToLo().MulWidenLo(lo.HiToLo())).Add(hi.MulWidenLo(hi)).Add(hi.HiToLo().MulWidenLo(hi.HiToLo())) + } + // Exactly 32 squares of at most 255 fit signed int32. + return int(total.ReduceSum()), true +} diff --git a/internal/vp8/dsp/stubs_nonarm64.go b/internal/vp8/dsp/stubs_nonarm64.go new file mode 100644 index 0000000..062d737 --- /dev/null +++ b/internal/vp8/dsp/stubs_nonarm64.go @@ -0,0 +1,16 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/stubs_nonarm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || !arm64 || purego + +// Ported from libvpx v1.16.0. +package dsp + +func sse4RowsGo(_ []byte, _ int, _ []byte, _, _ int) (int, bool) { return 0, false } diff --git a/internal/vp8/dsp/stubs_nosimd.go b/internal/vp8/dsp/stubs_nosimd.go new file mode 100644 index 0000000..d1f285c --- /dev/null +++ b/internal/vp8/dsp/stubs_nosimd.go @@ -0,0 +1,27 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/stubs_nosimd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || (!arm64 && !amd64) || purego + +package dsp + +// libvpx v1.16.0 reconintra4x4.c scalar dispatch. +func intraDirectionalGo(_ int, _ []byte, _ int, _ []byte, _ []byte, _ byte) bool { return false } + +// Arithmetic follows libvpx v1.16.0 vp8/common/idctllm.c. +func inverse4Go(_ *[16]int16, _ []byte, _ int, _ []byte, _ int, _ bool, _ []int16) bool { return false } + +func inverseWalsh4ToLumaDCGo(_ *[16]int16, _ *[25][16]int16) bool { return false } + +func dequantInverse4BlocksGo(_ *[16]int16, _ *[16]int16, _ *[16]int16, _ []byte, _ int) bool { + return false +} + +func dequantInverse4SingleGo(_ *[16]int16, _ *[16]int16, _ []byte, _ int) bool { return false } diff --git a/internal/vp8/dsp/subpixel.go b/internal/vp8/dsp/subpixel.go new file mode 100644 index 0000000..7ee1410 --- /dev/null +++ b/internal/vp8/dsp/subpixel.go @@ -0,0 +1,361 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/subpixel.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "encoding/binary" + + "github.com/go-avkit/vpx/internal/pixel" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +func BilinearPredict4x4(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + bilinearPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 4, 4) +} + +func BilinearPredict8x4(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + bilinearPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 8, 4) +} + +func BilinearPredict8x8(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + if bilinearPredict8x8Maybe(src, srcStride, xoffset, yoffset, dst, dstStride) { + return + } + bilinearPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 8, 8) +} + +func BilinearPredict8x8Pair( + src0 []byte, src0Stride int, + src1 []byte, src1Stride int, + xoffset int, yoffset int, + dst0 []byte, dst0Stride int, + dst1 []byte, dst1Stride int, +) { + h := tables.BilinearFilters[xoffset] + v := tables.BilinearFilters[yoffset] + if pixel.FilterBilinear2DPair8x8(src0, src0Stride, src1, src1Stride, dst0, dst0Stride, dst1, dst1Stride, + uint8(h[0]), uint8(h[1]), uint8(v[0]), uint8(v[1])) { + return + } + BilinearPredict8x8(src0, src0Stride, xoffset, yoffset, dst0, dst0Stride) + BilinearPredict8x8(src1, src1Stride, xoffset, yoffset, dst1, dst1Stride) +} + +func BilinearPredict16x16(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + if bilinearPredict16x16Maybe(src, srcStride, xoffset, yoffset, dst, dstStride) { + return + } + bilinearPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 16, 16) +} + +// SixTapPredict4x4 expects src to start two rows and two columns before the +// prediction origin so the six filter taps are addressable with positive +// indexes. +func SixTapPredict4x4(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + if xoffset|yoffset == 0 { + copyCentralBlock(src, srcStride, dst, dstStride, 4, 4) + return + } + if sixTapPredict4x4Maybe(src, srcStride, xoffset, yoffset, dst, dstStride) { + return + } + sixTapPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 4, 4) +} + +func SixTapPredict8x4(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + if xoffset|yoffset == 0 { + copyCentralBlock(src, srcStride, dst, dstStride, 8, 4) + return + } + if sixTapPredict8x4Maybe(src, srcStride, xoffset, yoffset, dst, dstStride) { + return + } + sixTapPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 8, 4) +} + +func SixTapPredict8x8(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + if xoffset|yoffset == 0 { + copyCentralBlock(src, srcStride, dst, dstStride, 8, 8) + return + } + if sixTapPredict8x8Maybe(src, srcStride, xoffset, yoffset, dst, dstStride) { + return + } + sixTapPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 8, 8) +} + +func SixTapPredict8x8Pair( + src0 []byte, src0Stride int, + src1 []byte, src1Stride int, + xoffset int, yoffset int, + dst0 []byte, dst0Stride int, + dst1 []byte, dst1Stride int, +) { + if xoffset|yoffset == 0 { + copyCentralBlock(src0, src0Stride, dst0, dst0Stride, 8, 8) + copyCentralBlock(src1, src1Stride, dst1, dst1Stride, 8, 8) + return + } + if sixTapPredict8x8PairMaybe(src0, src0Stride, src1, src1Stride, xoffset, yoffset, dst0, dst0Stride, dst1, dst1Stride) { + return + } + SixTapPredict8x8(src0, src0Stride, xoffset, yoffset, dst0, dst0Stride) + SixTapPredict8x8(src1, src1Stride, xoffset, yoffset, dst1, dst1Stride) +} + +func SixTapPredict16x16(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int) { + if xoffset|yoffset == 0 { + copyCentralBlock(src, srcStride, dst, dstStride, 16, 16) + return + } + if sixTapPredict16x16Maybe(src, srcStride, xoffset, yoffset, dst, dstStride) { + return + } + sixTapPredict(src, srcStride, xoffset, yoffset, dst, dstStride, 16, 16) +} + +func bilinearPredict(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int, width int, height int) { + if pixel.Enabled && srcStride >= width+1 && dstStride >= width && len(src) >= width+1 && srcStride <= (len(src)-width-1)/height && len(dst) >= width && dstStride <= (len(dst)-width)/(height-1) { + bilinearPredictGo(src, srcStride, xoffset, yoffset, dst, dstStride, width, height) + return + } + if xoffset == 0 && yoffset == 0 { + pixel.CopyBlock(src, srcStride, dst, dstStride, width, height) + return + } + const ( + maskFE = uint64(0xfefefefefefefefe) + mask00FF = uint64(0x00ff00ff00ff00ff) + maskFF00 = uint64(0xff00ff00ff00ff00) + bias64 = uint64(0x0040004000400040) + ) + if yoffset == 0 { + hFilter := tables.BilinearFilters[xoffset] + h0, h1 := int(hFilter[0]), int(hFilter[1]) + si, di := 0, 0 + if width >= 8 { + if h0 == 64 && h1 == 64 { + for range height { + s := src[si : si+width+1] + d := dst[di : di+width] + for x := 0; x < width; x += 8 { + a := binary.LittleEndian.Uint64(s[x:]) + b := binary.LittleEndian.Uint64(s[x+1:]) + binary.LittleEndian.PutUint64(d[x:], (a|b)-(((a^b)&maskFE)>>1)) + } + si += srcStride + di += dstStride + } + return + } + f0, f1 := uint64(h0), uint64(h1) + for range height { + s := src[si : si+width+1] + d := dst[di : di+width] + for x := 0; x < width; x += 8 { + w0 := binary.LittleEndian.Uint64(s[x:]) + w1 := binary.LittleEndian.Uint64(s[x+1:]) + lo := (((w0&mask00FF)*f0 + (w1&mask00FF)*f1 + bias64) >> 7) & mask00FF + hi := ((((w0>>8)&mask00FF)*f0 + ((w1>>8)&mask00FF)*f1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[x:], lo|hi) + } + si += srcStride + di += dstStride + } + return + } + for range height { + s := src[si : si+width+1] + d := dst[di : di+width] + for x := 0; x < width; x += 4 { + s0, s1, s2, s3, s4 := int(s[x]), int(s[x+1]), int(s[x+2]), int(s[x+3]), int(s[x+4]) + d[x] = uint8((s0*h0 + s1*h1 + 64) >> 7) + d[x+1] = uint8((s1*h0 + s2*h1 + 64) >> 7) + d[x+2] = uint8((s2*h0 + s3*h1 + 64) >> 7) + d[x+3] = uint8((s3*h0 + s4*h1 + 64) >> 7) + } + si += srcStride + di += dstStride + } + return + } + if xoffset == 0 { + vFilter := tables.BilinearFilters[yoffset] + v0, v1 := int(vFilter[0]), int(vFilter[1]) + si, di := 0, 0 + if width >= 8 { + if v0 == 64 && v1 == 64 { + for range height { + s0 := src[si : si+width] + s1 := src[si+srcStride : si+srcStride+width] + d := dst[di : di+width] + for x := 0; x < width; x += 8 { + a := binary.LittleEndian.Uint64(s0[x:]) + b := binary.LittleEndian.Uint64(s1[x:]) + binary.LittleEndian.PutUint64(d[x:], (a|b)-(((a^b)&maskFE)>>1)) + } + si += srcStride + di += dstStride + } + return + } + f0, f1 := uint64(v0), uint64(v1) + for range height { + s0 := src[si : si+width] + s1 := src[si+srcStride : si+srcStride+width] + d := dst[di : di+width] + for x := 0; x < width; x += 8 { + w0 := binary.LittleEndian.Uint64(s0[x:]) + w1 := binary.LittleEndian.Uint64(s1[x:]) + lo := (((w0&mask00FF)*f0 + (w1&mask00FF)*f1 + bias64) >> 7) & mask00FF + hi := ((((w0>>8)&mask00FF)*f0 + ((w1>>8)&mask00FF)*f1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[x:], lo|hi) + } + si += srcStride + di += dstStride + } + return + } + for range height { + s0 := src[si : si+width] + s1 := src[si+srcStride : si+srcStride+width] + d := dst[di : di+width] + for x := 0; x < width; x += 4 { + d[x] = uint8((int(s0[x])*v0 + int(s1[x])*v1 + 64) >> 7) + d[x+1] = uint8((int(s0[x+1])*v0 + int(s1[x+1])*v1 + 64) >> 7) + d[x+2] = uint8((int(s0[x+2])*v0 + int(s1[x+2])*v1 + 64) >> 7) + d[x+3] = uint8((int(s0[x+3])*v0 + int(s1[x+3])*v1 + 64) >> 7) + } + si += srcStride + di += dstStride + } + return + } + + hFilter := tables.BilinearFilters[xoffset] + vFilter := tables.BilinearFilters[yoffset] + h0, h1 := int(hFilter[0]), int(hFilter[1]) + v0, v1 := int(vFilter[0]), int(vFilter[1]) + if width == 16 { + hf0, hf1 := uint64(h0), uint64(h1) + vf0, vf1 := uint64(v0), uint64(v1) + sFirst := src[:17] + w0 := binary.LittleEndian.Uint64(sFirst[0:]) + w1 := binary.LittleEndian.Uint64(sFirst[1:]) + pLo0 := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + pHi0 := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + w2 := binary.LittleEndian.Uint64(sFirst[8:]) + w3 := binary.LittleEndian.Uint64(sFirst[9:]) + pLo1 := (((w2&mask00FF)*hf0 + (w3&mask00FF)*hf1 + bias64) >> 7) & mask00FF + pHi1 := ((((w2>>8)&mask00FF)*hf0 + ((w3>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + si, di := srcStride, 0 + for range height { + s := src[si : si+17] + d := dst[di : di+16] + w0 = binary.LittleEndian.Uint64(s[0:]) + w1 = binary.LittleEndian.Uint64(s[1:]) + cLo0 := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + cHi0 := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + oLo0 := ((pLo0*vf0 + cLo0*vf1 + bias64) >> 7) & mask00FF + oHi0 := ((pHi0*vf0 + cHi0*vf1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[0:], oLo0|oHi0) + pLo0, pHi0 = cLo0, cHi0 + + w2 = binary.LittleEndian.Uint64(s[8:]) + w3 = binary.LittleEndian.Uint64(s[9:]) + cLo1 := (((w2&mask00FF)*hf0 + (w3&mask00FF)*hf1 + bias64) >> 7) & mask00FF + cHi1 := ((((w2>>8)&mask00FF)*hf0 + ((w3>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + oLo1 := ((pLo1*vf0 + cLo1*vf1 + bias64) >> 7) & mask00FF + oHi1 := ((pHi1*vf0 + cHi1*vf1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[8:], oLo1|oHi1) + pLo1, pHi1 = cLo1, cHi1 + + si += srcStride + di += dstStride + } + return + } + if width == 8 { + hf0, hf1 := uint64(h0), uint64(h1) + vf0, vf1 := uint64(v0), uint64(v1) + sFirst := src[:9] + w0 := binary.LittleEndian.Uint64(sFirst[0:]) + w1 := binary.LittleEndian.Uint64(sFirst[1:]) + pLo := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + pHi := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + si, di := srcStride, 0 + for range height { + s := src[si : si+9] + d := dst[di : di+8] + w0 = binary.LittleEndian.Uint64(s[0:]) + w1 = binary.LittleEndian.Uint64(s[1:]) + cLo := (((w0&mask00FF)*hf0 + (w1&mask00FF)*hf1 + bias64) >> 7) & mask00FF + cHi := ((((w0>>8)&mask00FF)*hf0 + ((w1>>8)&mask00FF)*hf1 + bias64) >> 7) & mask00FF + oLo := ((pLo*vf0 + cLo*vf1 + bias64) >> 7) & mask00FF + oHi := ((pHi*vf0 + cHi*vf1 + bias64) << 1) & maskFF00 + binary.LittleEndian.PutUint64(d[0:], oLo|oHi) + pLo, pHi = cLo, cHi + si += srcStride + di += dstStride + } + return + } + var prev [16]uint16 + sFirst := src[:width+1] + for x := range width { + prev[x] = uint16((int(sFirst[x])*h0 + int(sFirst[x+1])*h1 + 64) >> 7) + } + si, di := srcStride, 0 + for range height { + s := src[si : si+width+1] + d := dst[di : di+width] + for x := 0; x < width; x += 4 { + s0, s1, s2, s3, s4 := int(s[x]), int(s[x+1]), int(s[x+2]), int(s[x+3]), int(s[x+4]) + b0 := (s0*h0 + s1*h1 + 64) >> 7 + b1 := (s1*h0 + s2*h1 + 64) >> 7 + b2 := (s2*h0 + s3*h1 + 64) >> 7 + b3 := (s3*h0 + s4*h1 + 64) >> 7 + a0, a1, a2, a3 := int(prev[x]), int(prev[x+1]), int(prev[x+2]), int(prev[x+3]) + prev[x], prev[x+1], prev[x+2], prev[x+3] = uint16(b0), uint16(b1), uint16(b2), uint16(b3) + d[x] = uint8((a0*v0 + b0*v1 + 64) >> 7) + d[x+1] = uint8((a1*v0 + b1*v1 + 64) >> 7) + d[x+2] = uint8((a2*v0 + b2*v1 + 64) >> 7) + d[x+3] = uint8((a3*v0 + b3*v1 + 64) >> 7) + } + si += srcStride + di += dstStride + } +} + +func copyCentralBlock(src []byte, srcStride int, dst []byte, dstStride int, width int, height int) { + srcOffset := 2*srcStride + 2 + for y := range height { + copy(dst[y*dstStride:y*dstStride+width], src[srcOffset+y*srcStride:srcOffset+y*srcStride+width]) + } +} + +func sixTapPredict(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int, width int, height int) { + if yoffset == 0 { + hFilter := tables.SubPelFilters[xoffset] + pixel.Filter(src[2*srcStride:], srcStride, dst, dstStride, width, height, 1, hFilter[:]) + return + } + if xoffset == 0 { + vFilter := tables.SubPelFilters[yoffset] + pixel.Filter(src[2:], srcStride, dst, dstStride, width, height, srcStride, vFilter[:]) + return + } + hFilter := tables.SubPelFilters[xoffset] + vFilter := tables.SubPelFilters[yoffset] + var tmp [21 * 16]byte + pixel.Filter(src, srcStride, tmp[:], width, width, height+5, 1, hFilter[:]) + pixel.Filter(tmp[:], width, dst, dstStride, width, height, width, vFilter[:]) +} diff --git a/internal/vp8/dsp/subpixel_other.go b/internal/vp8/dsp/subpixel_other.go new file mode 100644 index 0000000..aa8c3ff --- /dev/null +++ b/internal/vp8/dsp/subpixel_other.go @@ -0,0 +1,208 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/subpixel_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "github.com/go-avkit/vpx/internal/vp8/tables" +) + +func sixTapPredict16x16Maybe(src []byte, srcStride int, xoffset int, yoffset int, + dst []byte, dstStride int) bool { + if xoffset != 0 || yoffset != 0 { + sixTapPredictGo(src, srcStride, xoffset, yoffset, dst, dstStride, 16, 16) + return true + } + copyCentralBlock(src, srcStride, dst, dstStride, 16, 16) + return true +} + +func sixTapPredict8x8Maybe(src []byte, srcStride int, xoffset int, yoffset int, + dst []byte, dstStride int) bool { + if xoffset != 0 || yoffset != 0 { + sixTapPredictGo(src, srcStride, xoffset, yoffset, dst, dstStride, 8, 8) + return true + } + copyCentralBlock(src, srcStride, dst, dstStride, 8, 8) + return true +} + +func sixTapPredict8x8PairMaybe( + src0 []byte, src0Stride int, + src1 []byte, src1Stride int, + xoffset int, yoffset int, + dst0 []byte, dst0Stride int, + dst1 []byte, dst1Stride int, +) bool { + if xoffset != 0 || yoffset != 0 { + sixTapPredictGo(src0, src0Stride, xoffset, yoffset, dst0, dst0Stride, 8, 8) + sixTapPredictGo(src1, src1Stride, xoffset, yoffset, dst1, dst1Stride, 8, 8) + return true + } + copyCentralBlock(src0, src0Stride, dst0, dst0Stride, 8, 8) + copyCentralBlock(src1, src1Stride, dst1, dst1Stride, 8, 8) + return true +} + +func sixTapPredict8x4Maybe(src []byte, srcStride int, xoffset int, yoffset int, + dst []byte, dstStride int) bool { + if xoffset != 0 || yoffset != 0 { + sixTapPredictGo(src, srcStride, xoffset, yoffset, dst, dstStride, 8, 4) + return true + } + copyCentralBlock(src, srcStride, dst, dstStride, 8, 4) + return true +} + +func sixTapPredict4x4Maybe(src []byte, srcStride int, xoffset int, yoffset int, + dst []byte, dstStride int) bool { + if pixel.Enabled { + sixTapPredictGo(src, srcStride, xoffset, yoffset, dst, dstStride, 4, 4) + return true + } + + if xoffset != 0 || yoffset != 0 { + sixTapPredict4xNScalar(src, srcStride, xoffset, yoffset, dst, dstStride, 4) + return true + } + copyCentralBlock(src, srcStride, dst, dstStride, 4, 4) + return true +} + +func sixTapPredict16xNScalar(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int, height int) { + hFilter := tables.SubPelFilters[xoffset] + vFilter := tables.SubPelFilters[yoffset] + var tmp [21 * 16]byte + + for y := 0; y < height+5; y++ { + srcRow := y * srcStride + tmpRow := y * 16 + for x := range 16 { + v := int(src[srcRow+x+0])*int(hFilter[0]) + + int(src[srcRow+x+1])*int(hFilter[1]) + + int(src[srcRow+x+2])*int(hFilter[2]) + + int(src[srcRow+x+3])*int(hFilter[3]) + + int(src[srcRow+x+4])*int(hFilter[4]) + + int(src[srcRow+x+5])*int(hFilter[5]) + + tables.FilterWeight/2 + tmp[tmpRow+x] = ClipPixel(v >> tables.FilterShift) + } + } + + for y := range height { + dstRow := y * dstStride + tmpRow := y * 16 + for x := range 16 { + v := int(tmp[tmpRow+x])*int(vFilter[0]) + + int(tmp[tmpRow+16+x])*int(vFilter[1]) + + int(tmp[tmpRow+32+x])*int(vFilter[2]) + + int(tmp[tmpRow+48+x])*int(vFilter[3]) + + int(tmp[tmpRow+64+x])*int(vFilter[4]) + + int(tmp[tmpRow+80+x])*int(vFilter[5]) + + tables.FilterWeight/2 + dst[dstRow+x] = ClipPixel(v >> tables.FilterShift) + } + } +} + +func sixTapPredict8xNScalar(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int, height int) { + hFilter := tables.SubPelFilters[xoffset] + vFilter := tables.SubPelFilters[yoffset] + var tmp [21 * 8]byte + + for y := 0; y < height+5; y++ { + srcRow := y * srcStride + tmpRow := y * 8 + for x := range 8 { + v := int(src[srcRow+x+0])*int(hFilter[0]) + + int(src[srcRow+x+1])*int(hFilter[1]) + + int(src[srcRow+x+2])*int(hFilter[2]) + + int(src[srcRow+x+3])*int(hFilter[3]) + + int(src[srcRow+x+4])*int(hFilter[4]) + + int(src[srcRow+x+5])*int(hFilter[5]) + + tables.FilterWeight/2 + tmp[tmpRow+x] = ClipPixel(v >> tables.FilterShift) + } + } + + for y := range height { + dstRow := y * dstStride + tmpRow := y * 8 + for x := range 8 { + v := int(tmp[tmpRow+x])*int(vFilter[0]) + + int(tmp[tmpRow+8+x])*int(vFilter[1]) + + int(tmp[tmpRow+16+x])*int(vFilter[2]) + + int(tmp[tmpRow+24+x])*int(vFilter[3]) + + int(tmp[tmpRow+32+x])*int(vFilter[4]) + + int(tmp[tmpRow+40+x])*int(vFilter[5]) + + tables.FilterWeight/2 + dst[dstRow+x] = ClipPixel(v >> tables.FilterShift) + } + } +} + +func sixTapPredict4xNScalar(src []byte, srcStride int, xoffset int, yoffset int, dst []byte, dstStride int, height int) { + hFilter := tables.SubPelFilters[xoffset] + vFilter := tables.SubPelFilters[yoffset] + var tmp [21 * 4]byte + + for y := 0; y < height+5; y++ { + srcRow := y * srcStride + tmpRow := y * 4 + for x := range 4 { + v := int(src[srcRow+x+0])*int(hFilter[0]) + + int(src[srcRow+x+1])*int(hFilter[1]) + + int(src[srcRow+x+2])*int(hFilter[2]) + + int(src[srcRow+x+3])*int(hFilter[3]) + + int(src[srcRow+x+4])*int(hFilter[4]) + + int(src[srcRow+x+5])*int(hFilter[5]) + + tables.FilterWeight/2 + tmp[tmpRow+x] = ClipPixel(v >> tables.FilterShift) + } + } + + for y := range height { + dstRow := y * dstStride + tmpRow := y * 4 + for x := range 4 { + v := int(tmp[tmpRow+x])*int(vFilter[0]) + + int(tmp[tmpRow+4+x])*int(vFilter[1]) + + int(tmp[tmpRow+8+x])*int(vFilter[2]) + + int(tmp[tmpRow+12+x])*int(vFilter[3]) + + int(tmp[tmpRow+16+x])*int(vFilter[4]) + + int(tmp[tmpRow+20+x])*int(vFilter[5]) + + tables.FilterWeight/2 + dst[dstRow+x] = ClipPixel(v >> tables.FilterShift) + } + } +} + +func sixTapPredictGo(src []byte, ss, x, y int, dst []byte, ds, w, h int) { + if !pixel.Enabled { + if w == 16 { + sixTapPredict16xNScalar(src, ss, x, y, dst, ds, h) + } else { + sixTapPredict8xNScalar(src, ss, x, y, dst, ds, h) + } + return + } + if y == 0 { + pixel.Filter(src[2*ss:], ss, dst, ds, w, h, 1, tables.SubPelFilters[x][:]) + return + } + if x == 0 { + pixel.Filter(src[2:], ss, dst, ds, w, h, ss, tables.SubPelFilters[y][:]) + return + } + var tmp [21 * 16]byte + pixel.Filter(src, ss, tmp[:], w, w, h+5, 1, tables.SubPelFilters[x][:]) + pixel.Filter(tmp[:], w, dst, ds, w, h, w, tables.SubPelFilters[y][:]) +} diff --git a/internal/vp8/dsp/transform_simd.go b/internal/vp8/dsp/transform_simd.go new file mode 100644 index 0000000..fba1b48 --- /dev/null +++ b/internal/vp8/dsp/transform_simd.go @@ -0,0 +1,227 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/transform_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "simd/archsimd" +) + +// Arithmetic follows libvpx v1.16.0 vp8/common/idctllm.c. +func inverse4Go(input *[16]int16, pred []byte, ps int, dst []byte, ds int, walsh bool, mb []int16) bool { + if !pixel.Enabled { + return false + } + p0 := archsimd.LoadInt16x8Array((*[8]int16)(input[0:8])) + p1 := archsimd.LoadInt16x8Array((*[8]int16)(input[8:16])) + in0 := p0.ExtendLo4ToInt32() + in1 := hi4ToInt32(p0) + in2 := p1.ExtendLo4ToInt32() + in3 := hi4ToInt32(p1) + var out0, out1, out2, out3 archsimd.Int32x4 + if walsh { + a, b, c, d := in0.Add(in3), in1.Add(in2), in1.Sub(in2), in0.Sub(in3) + out0 = a.Add(b).ShiftAllLeft(16).ShiftAllRight(16) + out1 = c.Add(d).ShiftAllLeft(16).ShiftAllRight(16) + out2 = a.Sub(b).ShiftAllLeft(16).ShiftAllRight(16) + out3 = d.Sub(c).ShiftAllLeft(16).ShiftAllRight(16) + in0, in1, in2, in3 = pixel.Transpose4(out0, out1, out2, out3) + a, b, c, d = in0.Add(in3), in1.Add(in2), in1.Sub(in2), in0.Sub(in3) + bias := archsimd.BroadcastInt32x4(3) + out0 = a.Add(b).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out1 = c.Add(d).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out2 = a.Sub(b).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out3 = d.Sub(c).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out0, out1, out2, out3 = pixel.Transpose4(out0, out1, out2, out3) + mb[0] = int16(out0.GetElem(0)) + mb[16] = int16(out0.GetElem(1)) + mb[32] = int16(out0.GetElem(2)) + mb[48] = int16(out0.GetElem(3)) + mb[64] = int16(out1.GetElem(0)) + mb[80] = int16(out1.GetElem(1)) + mb[96] = int16(out1.GetElem(2)) + mb[112] = int16(out1.GetElem(3)) + mb[128] = int16(out2.GetElem(0)) + mb[144] = int16(out2.GetElem(1)) + mb[160] = int16(out2.GetElem(2)) + mb[176] = int16(out2.GetElem(3)) + mb[192] = int16(out3.GetElem(0)) + mb[208] = int16(out3.GetElem(1)) + mb[224] = int16(out3.GetElem(2)) + mb[240] = int16(out3.GetElem(3)) + return true + } + sinC := archsimd.BroadcastInt32x4(sinPI8Sqrt2) + cosC := archsimd.BroadcastInt32x4(cosPI8Sqrt2Minus1) + bias4 := archsimd.BroadcastInt32x4(4) + out0, out1, out2, out3 = idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + out0 = out0.ShiftAllLeft(16).ShiftAllRight(16) + out1 = out1.ShiftAllLeft(16).ShiftAllRight(16) + out2 = out2.ShiftAllLeft(16).ShiftAllRight(16) + out3 = out3.ShiftAllLeft(16).ShiftAllRight(16) + in0, in1, in2, in3 = pixel.Transpose4(out0, out1, out2, out3) + out0, out1, out2, out3 = idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + out0 = out0.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out1 = out1.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out2 = out2.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out3 = out3.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out0, out1, out2, out3 = pixel.Transpose4(out0, out1, out2, out3) + pixel.StorePixels4(dst, out0.Add(pixel.LoadPixels4(pred))) + pixel.StorePixels4(dst[ds:], out1.Add(pixel.LoadPixels4(pred[ps:]))) + pixel.StorePixels4(dst[2*ds:], out2.Add(pixel.LoadPixels4(pred[2*ps:]))) + pixel.StorePixels4(dst[3*ds:], out3.Add(pixel.LoadPixels4(pred[3*ps:]))) + return true +} + +// idct4x4Pass runs one 4-row VP8 inverse DCT butterfly on 4 Int32x4 rows. +func idct4x4Pass(in0, in1, in2, in3 archsimd.Int32x4, sinC, cosC archsimd.Int32x4) (archsimd.Int32x4, archsimd.Int32x4, archsimd.Int32x4, archsimd.Int32x4) { + a, b := in0.Add(in2), in0.Sub(in2) + c := in1.Mul(sinC).ShiftAllRight(16).Sub(in3.Add(in3.Mul(cosC).ShiftAllRight(16))) + d := in1.Add(in1.Mul(cosC).ShiftAllRight(16)).Add(in3.Mul(sinC).ShiftAllRight(16)) + return a.Add(d), b.Add(c), b.Sub(c), a.Sub(d) +} + +func hi4ToInt32(v archsimd.Int16x8) archsimd.Int32x4 { + u := v.ToBits().ReshapeToUint64s() + return u.InterleaveHi(u).ReshapeToUint16s().BitsToInt16().ExtendLo4ToInt32() +} + +func inverseWalsh4ToLumaDCGo(input *[16]int16, dst *[25][16]int16) bool { + if !pixel.Enabled { + return false + } + p0 := archsimd.LoadInt16x8Array((*[8]int16)(input[0:8])) + p1 := archsimd.LoadInt16x8Array((*[8]int16)(input[8:16])) + in0 := p0.ExtendLo4ToInt32() + in1 := hi4ToInt32(p0) + in2 := p1.ExtendLo4ToInt32() + in3 := hi4ToInt32(p1) + a, b, c, d := in0.Add(in3), in1.Add(in2), in1.Sub(in2), in0.Sub(in3) + out0 := a.Add(b).ShiftAllLeft(16).ShiftAllRight(16) + out1 := c.Add(d).ShiftAllLeft(16).ShiftAllRight(16) + out2 := a.Sub(b).ShiftAllLeft(16).ShiftAllRight(16) + out3 := d.Sub(c).ShiftAllLeft(16).ShiftAllRight(16) + in0, in1, in2, in3 = pixel.Transpose4(out0, out1, out2, out3) + a, b, c, d = in0.Add(in3), in1.Add(in2), in1.Sub(in2), in0.Sub(in3) + bias := archsimd.BroadcastInt32x4(3) + out0 = a.Add(b).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out1 = c.Add(d).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out2 = a.Sub(b).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out3 = d.Sub(c).Add(bias).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + out0, out1, out2, out3 = pixel.Transpose4(out0, out1, out2, out3) + dst[0][0] = int16(out0.GetElem(0)) + dst[1][0] = int16(out0.GetElem(1)) + dst[2][0] = int16(out0.GetElem(2)) + dst[3][0] = int16(out0.GetElem(3)) + dst[4][0] = int16(out1.GetElem(0)) + dst[5][0] = int16(out1.GetElem(1)) + dst[6][0] = int16(out1.GetElem(2)) + dst[7][0] = int16(out1.GetElem(3)) + dst[8][0] = int16(out2.GetElem(0)) + dst[9][0] = int16(out2.GetElem(1)) + dst[10][0] = int16(out2.GetElem(2)) + dst[11][0] = int16(out2.GetElem(3)) + dst[12][0] = int16(out3.GetElem(0)) + dst[13][0] = int16(out3.GetElem(1)) + dst[14][0] = int16(out3.GetElem(2)) + dst[15][0] = int16(out3.GetElem(3)) + return true +} + +func dequantInverse4BlocksGo(q0, q1 *[16]int16, dq *[16]int16, dst []byte, stride int) bool { + if !pixel.Enabled || stride < 8 || 3*stride+8 > len(dst) { + return false + } + dq0 := archsimd.LoadInt16x8Array((*[8]int16)(dq[0:8])) + dq1 := archsimd.LoadInt16x8Array((*[8]int16)(dq[8:16])) + sinC := archsimd.BroadcastInt32x4(sinPI8Sqrt2) + cosC := archsimd.BroadcastInt32x4(cosPI8Sqrt2Minus1) + bias4 := archsimd.BroadcastInt32x4(4) + + p0 := archsimd.LoadInt16x8Array((*[8]int16)(q0[0:8])).Mul(dq0) + p1 := archsimd.LoadInt16x8Array((*[8]int16)(q0[8:16])).Mul(dq1) + in0, in1, in2, in3 := p0.ExtendLo4ToInt32(), hi4ToInt32(p0), p1.ExtendLo4ToInt32(), hi4ToInt32(p1) + o0, o1, o2, o3 := idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + o0 = o0.ShiftAllLeft(16).ShiftAllRight(16) + o1 = o1.ShiftAllLeft(16).ShiftAllRight(16) + o2 = o2.ShiftAllLeft(16).ShiftAllRight(16) + o3 = o3.ShiftAllLeft(16).ShiftAllRight(16) + in0, in1, in2, in3 = pixel.Transpose4(o0, o1, o2, o3) + o0, o1, o2, o3 = idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + o0 = o0.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o1 = o1.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o2 = o2.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o3 = o3.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + l0, l1, l2, l3 := pixel.Transpose4(o0, o1, o2, o3) + + p2 := archsimd.LoadInt16x8Array((*[8]int16)(q1[0:8])).Mul(dq0) + p3 := archsimd.LoadInt16x8Array((*[8]int16)(q1[8:16])).Mul(dq1) + in0, in1, in2, in3 = p2.ExtendLo4ToInt32(), hi4ToInt32(p2), p3.ExtendLo4ToInt32(), hi4ToInt32(p3) + o0, o1, o2, o3 = idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + o0 = o0.ShiftAllLeft(16).ShiftAllRight(16) + o1 = o1.ShiftAllLeft(16).ShiftAllRight(16) + o2 = o2.ShiftAllLeft(16).ShiftAllRight(16) + o3 = o3.ShiftAllLeft(16).ShiftAllRight(16) + in0, in1, in2, in3 = pixel.Transpose4(o0, o1, o2, o3) + o0, o1, o2, o3 = idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + o0 = o0.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o1 = o1.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o2 = o2.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o3 = o3.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + r0, r1, r2, r3 := pixel.Transpose4(o0, o1, o2, o3) + + pixel.StorePixels4(dst, l0.Add(pixel.LoadPixels4(dst))) + pixel.StorePixels4(dst[4:], r0.Add(pixel.LoadPixels4(dst[4:]))) + d1 := dst[stride:] + pixel.StorePixels4(d1, l1.Add(pixel.LoadPixels4(d1))) + pixel.StorePixels4(d1[4:], r1.Add(pixel.LoadPixels4(d1[4:]))) + d2 := dst[2*stride:] + pixel.StorePixels4(d2, l2.Add(pixel.LoadPixels4(d2))) + pixel.StorePixels4(d2[4:], r2.Add(pixel.LoadPixels4(d2[4:]))) + d3 := dst[3*stride:] + pixel.StorePixels4(d3, l3.Add(pixel.LoadPixels4(d3))) + pixel.StorePixels4(d3[4:], r3.Add(pixel.LoadPixels4(d3[4:]))) + return true +} + +func dequantInverse4SingleGo(q *[16]int16, dq *[16]int16, dst []byte, stride int) bool { + if !pixel.Enabled || stride < 4 || 3*stride+4 > len(dst) { + return false + } + dq0 := archsimd.LoadInt16x8Array((*[8]int16)(dq[0:8])) + dq1 := archsimd.LoadInt16x8Array((*[8]int16)(dq[8:16])) + p0 := archsimd.LoadInt16x8Array((*[8]int16)(q[0:8])).Mul(dq0) + p1 := archsimd.LoadInt16x8Array((*[8]int16)(q[8:16])).Mul(dq1) + sinC := archsimd.BroadcastInt32x4(sinPI8Sqrt2) + cosC := archsimd.BroadcastInt32x4(cosPI8Sqrt2Minus1) + bias4 := archsimd.BroadcastInt32x4(4) + + in0, in1, in2, in3 := p0.ExtendLo4ToInt32(), hi4ToInt32(p0), p1.ExtendLo4ToInt32(), hi4ToInt32(p1) + o0, o1, o2, o3 := idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + o0 = o0.ShiftAllLeft(16).ShiftAllRight(16) + o1 = o1.ShiftAllLeft(16).ShiftAllRight(16) + o2 = o2.ShiftAllLeft(16).ShiftAllRight(16) + o3 = o3.ShiftAllLeft(16).ShiftAllRight(16) + in0, in1, in2, in3 = pixel.Transpose4(o0, o1, o2, o3) + o0, o1, o2, o3 = idct4x4Pass(in0, in1, in2, in3, sinC, cosC) + o0 = o0.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o1 = o1.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o2 = o2.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o3 = o3.Add(bias4).ShiftAllRight(3).ShiftAllLeft(16).ShiftAllRight(16) + o0, o1, o2, o3 = pixel.Transpose4(o0, o1, o2, o3) + pixel.StorePixels4(dst, o0.Add(pixel.LoadPixels4(dst))) + pixel.StorePixels4(dst[stride:], o1.Add(pixel.LoadPixels4(dst[stride:]))) + pixel.StorePixels4(dst[2*stride:], o2.Add(pixel.LoadPixels4(dst[2*stride:]))) + pixel.StorePixels4(dst[3*stride:], o3.Add(pixel.LoadPixels4(dst[3*stride:]))) + return true +} diff --git a/internal/vp8/dsp/variance.go b/internal/vp8/dsp/variance.go new file mode 100644 index 0000000..c74f3f0 --- /dev/null +++ b/internal/vp8/dsp/variance.go @@ -0,0 +1,59 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/variance.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" +) + +func SSE16x16(src []byte, srcStride int, ref []byte, refStride int) int { + return int(pixel.SSE16(src, srcStride, ref, refStride, 16)) +} + +func SSE8x8(src []byte, srcStride int, ref []byte, refStride int) int { + return int(pixel.SSE8(src, srcStride, ref, refStride, 8)) +} + +func SSE4x4(src []byte, srcStride int, ref []byte, refStride int) int { + if sse, ok := sse4RowsGo(src, srcStride, ref, refStride, 4); ok { + return sse + } + _, sse := varianceBlock(src, srcStride, ref, refStride, 4, 4) + return sse +} + +func varianceBlock(src []byte, srcStride int, ref []byte, refStride int, width int, height int) (int, int) { + if width == 16 && height == 16 { + return varianceBlock16x16(src, srcStride, ref, refStride) + } + if (width == 16 || width == 8 || width == 4) && height > 0 { + return varianceBlockSized(src, srcStride, ref, refStride, width, height) + } + return varianceBlockGeneric(src, srcStride, ref, refStride, width, height) +} + +// varianceBlockGeneric is the size-agnostic scalar fallback used by +// varianceBlock when the width is not in {4, 8, 16} or height is zero. +// Tests also reference it directly as the parity oracle. +func varianceBlockGeneric(src []byte, srcStride int, ref []byte, refStride int, width int, height int) (int, int) { + sum := 0 + sse := 0 + for y := range height { + srcRow := src[y*srcStride:] + refRow := ref[y*refStride:] + for x := range width { + diff := int(srcRow[x]) - int(refRow[x]) + sum += diff + sse += diff * diff + } + } + return sum, sse +} diff --git a/internal/vp8/dsp/variance_16x16_other.go b/internal/vp8/dsp/variance_16x16_other.go new file mode 100644 index 0000000..e1f67e7 --- /dev/null +++ b/internal/vp8/dsp/variance_16x16_other.go @@ -0,0 +1,109 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/variance_16x16_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" +) + +func varianceBlock16x16(src []byte, srcStride int, ref []byte, refStride int) (int, int) { + sum, sse := pixel.Stats(src, srcStride, ref, refStride, 16, 16) + return sum, int(sse) +} + +func varianceBlockSized(src []byte, srcStride int, ref []byte, refStride int, width, height int) (int, int) { + if pixel.Enabled { + sum, sse := pixel.Stats(src, srcStride, ref, refStride, width, height) + return sum, int(sse) + } + + switch width { + case 16: + return varianceBlock16xNScalar(src, srcStride, ref, refStride, height) + case 8: + return varianceBlock8xNScalar(src, srcStride, ref, refStride, height) + case 4: + return varianceBlock4xNScalar(src, srcStride, ref, refStride, height) + default: + return varianceBlockGeneric(src, srcStride, ref, refStride, width, height) + } +} + +func varianceBlock16xNScalar(src []byte, srcStride int, ref []byte, refStride int, height int) (int, int) { + _ = src[(height-1)*srcStride+15] + _ = ref[(height-1)*refStride+15] + sum := 0 + sse := 0 + for y := range height { + srcRow := src[y*srcStride:] + refRow := ref[y*refStride:] + d0 := int(srcRow[0]) - int(refRow[0]) + d1 := int(srcRow[1]) - int(refRow[1]) + d2 := int(srcRow[2]) - int(refRow[2]) + d3 := int(srcRow[3]) - int(refRow[3]) + d4 := int(srcRow[4]) - int(refRow[4]) + d5 := int(srcRow[5]) - int(refRow[5]) + d6 := int(srcRow[6]) - int(refRow[6]) + d7 := int(srcRow[7]) - int(refRow[7]) + d8 := int(srcRow[8]) - int(refRow[8]) + d9 := int(srcRow[9]) - int(refRow[9]) + d10 := int(srcRow[10]) - int(refRow[10]) + d11 := int(srcRow[11]) - int(refRow[11]) + d12 := int(srcRow[12]) - int(refRow[12]) + d13 := int(srcRow[13]) - int(refRow[13]) + d14 := int(srcRow[14]) - int(refRow[14]) + d15 := int(srcRow[15]) - int(refRow[15]) + sum += d0 + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + sse += d0*d0 + d1*d1 + d2*d2 + d3*d3 + d4*d4 + d5*d5 + d6*d6 + d7*d7 + + d8*d8 + d9*d9 + d10*d10 + d11*d11 + d12*d12 + d13*d13 + d14*d14 + d15*d15 + } + return sum, sse +} + +func varianceBlock8xNScalar(src []byte, srcStride int, ref []byte, refStride int, height int) (int, int) { + _ = src[(height-1)*srcStride+7] + _ = ref[(height-1)*refStride+7] + sum := 0 + sse := 0 + for y := range height { + srcRow := src[y*srcStride:] + refRow := ref[y*refStride:] + d0 := int(srcRow[0]) - int(refRow[0]) + d1 := int(srcRow[1]) - int(refRow[1]) + d2 := int(srcRow[2]) - int(refRow[2]) + d3 := int(srcRow[3]) - int(refRow[3]) + d4 := int(srcRow[4]) - int(refRow[4]) + d5 := int(srcRow[5]) - int(refRow[5]) + d6 := int(srcRow[6]) - int(refRow[6]) + d7 := int(srcRow[7]) - int(refRow[7]) + sum += d0 + d1 + d2 + d3 + d4 + d5 + d6 + d7 + sse += d0*d0 + d1*d1 + d2*d2 + d3*d3 + d4*d4 + d5*d5 + d6*d6 + d7*d7 + } + return sum, sse +} + +func varianceBlock4xNScalar(src []byte, srcStride int, ref []byte, refStride int, height int) (int, int) { + _ = src[(height-1)*srcStride+3] + _ = ref[(height-1)*refStride+3] + sum := 0 + sse := 0 + for y := range height { + srcRow := src[y*srcStride:] + refRow := ref[y*refStride:] + d0 := int(srcRow[0]) - int(refRow[0]) + d1 := int(srcRow[1]) - int(refRow[1]) + d2 := int(srcRow[2]) - int(refRow[2]) + d3 := int(srcRow[3]) - int(refRow[3]) + sum += d0 + d1 + d2 + d3 + sse += d0*d0 + d1*d1 + d2*d2 + d3*d3 + } + return sum, sse +} diff --git a/internal/vp8/dsp/walsh.go b/internal/vp8/dsp/walsh.go new file mode 100644 index 0000000..1ab48f0 --- /dev/null +++ b/internal/vp8/dsp/walsh.go @@ -0,0 +1,132 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/walsh.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// Ported from libvpx v1.16.0 vp8/common/idctllm.c. + +// InverseWalsh4x4 dispatches to the SIMD or scalar 4x4 inverse Walsh-Hadamard +// kernel. The SIMD implementations mirror libvpx v1.16.0 +// vp8/common/arm/neon/iwalsh_neon.c (vp8_short_inv_walsh4x4_neon) and +// vp8/common/x86/iwalsh_sse2.asm (vp8_short_inv_walsh4x4_sse2). Output is +// byte-identical to inverseWalsh4x4Scalar for the decoder's coefficient range. +func InverseWalsh4x4(input *[16]int16, mbDQCoeff []int16) { + inverseWalsh4x4SIMD(input, mbDQCoeff) +} + +// InverseWalsh4x4ToLumaDC computes the 4x4 inverse Walsh-Hadamard transform and +// writes the 16 DC values directly into dst[0..15][0] without an intermediate +// 256-int16 flat buffer. +func InverseWalsh4x4ToLumaDC(input *[16]int16, dst *[25][16]int16) { + if inverseWalsh4ToLumaDCGo(input, dst) { + return + } + var output [16]int16 + for i := range 4 { + a1 := int(input[i+0]) + int(input[i+12]) + b1 := int(input[i+4]) + int(input[i+8]) + c1 := int(input[i+4]) - int(input[i+8]) + d1 := int(input[i+0]) - int(input[i+12]) + output[i+0] = int16(a1 + b1) + output[i+4] = int16(c1 + d1) + output[i+8] = int16(a1 - b1) + output[i+12] = int16(d1 - c1) + } + for i := range 4 { + base := i * 4 + a1 := int(output[base+0]) + int(output[base+3]) + b1 := int(output[base+1]) + int(output[base+2]) + c1 := int(output[base+1]) - int(output[base+2]) + d1 := int(output[base+0]) - int(output[base+3]) + dst[base+0][0] = int16((a1 + b1 + 3) >> 3) + dst[base+1][0] = int16((c1 + d1 + 3) >> 3) + dst[base+2][0] = int16((a1 - b1 + 3) >> 3) + dst[base+3][0] = int16((d1 - c1 + 3) >> 3) + } +} + +// InverseWalsh4x4To16 computes the 4x4 inverse Walsh-Hadamard transform and +// writes the 16 DC values into a compact [16]int16 array. +func InverseWalsh4x4To16(input *[16]int16, dst *[16]int16) { + var output [16]int16 + for i := range 4 { + a1 := int(input[i+0]) + int(input[i+12]) + b1 := int(input[i+4]) + int(input[i+8]) + c1 := int(input[i+4]) - int(input[i+8]) + d1 := int(input[i+0]) - int(input[i+12]) + output[i+0] = int16(a1 + b1) + output[i+4] = int16(c1 + d1) + output[i+8] = int16(a1 - b1) + output[i+12] = int16(d1 - c1) + } + for i := range 4 { + base := i * 4 + a1 := int(output[base+0]) + int(output[base+3]) + b1 := int(output[base+1]) + int(output[base+2]) + c1 := int(output[base+1]) - int(output[base+2]) + d1 := int(output[base+0]) - int(output[base+3]) + dst[base+0] = int16((a1 + b1 + 3) >> 3) + dst[base+1] = int16((c1 + d1 + 3) >> 3) + dst[base+2] = int16((a1 - b1 + 3) >> 3) + dst[base+3] = int16((d1 - c1 + 3) >> 3) + } +} + +// inverseWalsh4x4Scalar is the canonical scalar port of libvpx +// vp8/common/idctllm.c vp8_short_inv_walsh4x4_c. SIMD ports must produce +// byte-identical output for the decoder's coefficient range. +func inverseWalsh4x4Scalar(input *[16]int16, mbDQCoeff []int16) { + _ = mbDQCoeff[15*16] + + var output [16]int16 + + for i := range 4 { + a1 := int(input[i+0]) + int(input[i+12]) + b1 := int(input[i+4]) + int(input[i+8]) + c1 := int(input[i+4]) - int(input[i+8]) + d1 := int(input[i+0]) - int(input[i+12]) + + output[i+0] = int16(a1 + b1) + output[i+4] = int16(c1 + d1) + output[i+8] = int16(a1 - b1) + output[i+12] = int16(d1 - c1) + } + + for i := range 4 { + base := i * 4 + a1 := int(output[base+0]) + int(output[base+3]) + b1 := int(output[base+1]) + int(output[base+2]) + c1 := int(output[base+1]) - int(output[base+2]) + d1 := int(output[base+0]) - int(output[base+3]) + + a2 := a1 + b1 + b2 := c1 + d1 + c2 := a1 - b1 + d2 := d1 - c1 + + output[base+0] = int16((a2 + 3) >> 3) + output[base+1] = int16((b2 + 3) >> 3) + output[base+2] = int16((c2 + 3) >> 3) + output[base+3] = int16((d2 + 3) >> 3) + } + + for i := range 16 { + mbDQCoeff[i*16] = output[i] + } +} + +func DCOnlyInverseWalsh4x4(inputDC int16, mbDQCoeff []int16) { + _ = mbDQCoeff[15*16] + + a1 := int16((int(inputDC) + 3) >> 3) + for i := range 16 { + mbDQCoeff[i*16] = a1 + } +} diff --git a/internal/vp8/dsp/walsh_simd_other.go b/internal/vp8/dsp/walsh_simd_other.go new file mode 100644 index 0000000..7939f9c --- /dev/null +++ b/internal/vp8/dsp/walsh_simd_other.go @@ -0,0 +1,21 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/dsp/walsh_simd_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// Pure-Go fallback dispatcher for the InverseWalsh4x4 SIMD entry point. +// Mirrors libvpx v1.16.0 vp8/common/idctllm.c vp8_short_inv_walsh4x4_c +// exactly via inverseWalsh4x4Scalar. + +func inverseWalsh4x4SIMD(input *[16]int16, mbDQCoeff []int16) { + if !inverse4Go(input, nil, 0, nil, 0, true, mbDQCoeff) { + inverseWalsh4x4Scalar(input, mbDQCoeff) + } +} diff --git a/internal/vp8/rtp/rtp.go b/internal/vp8/rtp/rtp.go new file mode 100644 index 0000000..4df6de0 --- /dev/null +++ b/internal/vp8/rtp/rtp.go @@ -0,0 +1,319 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/rtp/rtp.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Package rtp implements VP8 RTP payload descriptors and frame fragment +// assembly. libvpx v1.16.0 does not provide these RTP packetization helpers; +// the wire format follows RFC 7741. +package rtp + +import ( + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" + vpxrtp "github.com/go-avkit/vpx/internal/vpx/rtp" +) + +const ( + vp8RTPFlagExtendedControl = 0x80 + vp8RTPFlagNonReference = 0x20 + vp8RTPFlagStartPartition = 0x10 + + vp8RTPFlagPictureID = 0x80 + vp8RTPFlagTL0PICIDX = 0x40 + vp8RTPFlagTemporal = 0x20 + vp8RTPFlagKeyIndex = 0x10 +) + +// PayloadDescriptor describes the VP8 RTP payload descriptor from RFC +// 7741. It is the bytes after the RTP header and before the raw VP8 payload. +type PayloadDescriptor struct { + NonReferenceFrame bool + StartOfPartition bool + PartitionID uint8 + + PictureIDPresent bool + PictureID uint16 + PictureID15Bit bool + + TL0PICIDXPresent bool + TL0PICIDX uint8 + + TemporalIDPresent bool + TemporalID uint8 + LayerSync bool + + KeyIndexPresent bool + KeyIndex uint8 +} + +// Size returns the number of bytes needed to marshal d, excluding the raw VP8 +// payload bytes. +func (d PayloadDescriptor) Size() (int, error) { + if err := d.validate(); err != nil { + return 0, err + } + size := 1 + if d.hasExtensions() { + size++ + if d.PictureIDPresent { + pidSize, err := d.pictureID().Size() + if err != nil { + return 0, err + } + size += pidSize + } + if d.TL0PICIDXPresent { + size++ + } + if d.TemporalIDPresent || d.KeyIndexPresent { + size++ + } + } + return size, nil +} + +// MarshalInto writes d into dst and returns the descriptor length. If dst is +// too small, it returns the required descriptor length and [vpxerrors.ErrBufferTooSmall]. +func (d PayloadDescriptor) MarshalInto(dst []byte) (int, error) { + need, err := d.Size() + if err != nil { + return 0, err + } + if len(dst) < need { + return need, vpxerrors.ErrBufferTooSmall + } + + var first byte + if d.hasExtensions() { + first |= vp8RTPFlagExtendedControl + } + if d.NonReferenceFrame { + first |= vp8RTPFlagNonReference + } + if d.StartOfPartition { + first |= vp8RTPFlagStartPartition + } + first |= d.PartitionID + dst[0] = first + + off := 1 + if d.hasExtensions() { + var ext byte + if d.PictureIDPresent { + ext |= vp8RTPFlagPictureID + } + if d.TL0PICIDXPresent { + ext |= vp8RTPFlagTL0PICIDX + } + if d.TemporalIDPresent { + ext |= vp8RTPFlagTemporal + } + if d.KeyIndexPresent { + ext |= vp8RTPFlagKeyIndex + } + dst[off] = ext + off++ + + if d.PictureIDPresent { + n, err := d.pictureID().MarshalInto(dst[off:]) + if err != nil { + return 0, err + } + off += n + } + if d.TL0PICIDXPresent { + dst[off] = d.TL0PICIDX + off++ + } + if d.TemporalIDPresent || d.KeyIndexPresent { + var tk byte + if d.TemporalIDPresent { + tk |= d.TemporalID << 6 + } + if d.LayerSync { + tk |= 0x20 + } + if d.KeyIndexPresent { + tk |= d.KeyIndex + } + dst[off] = tk + off++ + } + } + return need, nil +} + +// Marshal returns d as a newly allocated VP8 RTP payload descriptor. +func (d PayloadDescriptor) Marshal() ([]byte, error) { + return vpxrtp.MarshalDescriptor(d) +} + +// ParsePayloadDescriptor parses the VP8 RTP payload descriptor at the +// front of packet and returns the descriptor plus the remaining raw VP8 +// payload bytes. +func ParsePayloadDescriptor(packet []byte) (PayloadDescriptor, []byte, error) { + if len(packet) == 0 { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidData + } + first := packet[0] + d := PayloadDescriptor{ + NonReferenceFrame: first&vp8RTPFlagNonReference != 0, + StartOfPartition: first&vp8RTPFlagStartPartition != 0, + PartitionID: first & 0x07, + } + off := 1 + if first&vp8RTPFlagExtendedControl == 0 { + return d, packet[off:], nil + } + if off >= len(packet) { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidData + } + ext := packet[off] + off++ + d.PictureIDPresent = ext&vp8RTPFlagPictureID != 0 + d.TL0PICIDXPresent = ext&vp8RTPFlagTL0PICIDX != 0 + d.TemporalIDPresent = ext&vp8RTPFlagTemporal != 0 + d.KeyIndexPresent = ext&vp8RTPFlagKeyIndex != 0 + if d.TL0PICIDXPresent && !d.TemporalIDPresent { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidData + } + if d.PictureIDPresent { + pid, n, err := vpxrtp.ParsePictureID(packet[off:], vpxerrors.ErrInvalidData) + if err != nil { + return PayloadDescriptor{}, nil, err + } + d.setPictureID(pid) + off += n + } + if d.TL0PICIDXPresent { + if off >= len(packet) { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidData + } + d.TL0PICIDX = packet[off] + off++ + } + if d.TemporalIDPresent || d.KeyIndexPresent { + if off >= len(packet) { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidData + } + tk := packet[off] + off++ + if d.TemporalIDPresent { + d.TemporalID = tk >> 6 + } + d.LayerSync = tk&0x20 != 0 + if d.KeyIndexPresent { + d.KeyIndex = tk & 0x1f + } + } + return d, packet[off:], nil +} + +// AssembleFrameInto writes the raw VP8 frame carried by payloads into +// dst and returns the frame length. On [vpxerrors.ErrBufferTooSmall], the returned +// length is the required capacity. +func AssembleFrameInto(dst []byte, payloads []vpxrtp.PayloadFragment) (int, error) { + return vpxrtp.AssembleFrameInto(dst, payloads, vpxerrors.ErrInvalidData, + ParsePayloadDescriptor, vp8FrameAssemblyValidator()) +} + +// AssembleFrame returns the raw VP8 frame carried by an ordered set of +// RTP payload bodies. +func AssembleFrame(payloads []vpxrtp.PayloadFragment) ([]byte, error) { + return vpxrtp.AssembleFrame(payloads, vpxerrors.ErrInvalidData, + ParsePayloadDescriptor, vp8FrameAssemblyValidator()) +} + +func vp8FrameAssemblyValidator() vpxrtp.FragmentValidator[PayloadDescriptor] { + var base PayloadDescriptor + var lastPartitionID uint8 + return func(i, _ int, desc PayloadDescriptor) error { + if i == 0 { + if !desc.StartOfPartition || desc.PartitionID != 0 { + return vpxerrors.ErrInvalidData + } + normalized := desc + normalized.StartOfPartition = false + normalized.PartitionID = 0 + base = normalized + lastPartitionID = 0 + return nil + } + if desc.PartitionID < lastPartitionID { + return vpxerrors.ErrInvalidData + } + if desc.PartitionID > lastPartitionID && !desc.StartOfPartition { + return vpxerrors.ErrInvalidData + } + if desc.StartOfPartition && desc.PartitionID <= lastPartitionID { + return vpxerrors.ErrInvalidData + } + if desc.PartitionID > lastPartitionID { + lastPartitionID = desc.PartitionID + } + normalized := desc + normalized.StartOfPartition = false + normalized.PartitionID = 0 + if normalized != base { + return vpxerrors.ErrInvalidData + } + return nil + } +} + +func (d PayloadDescriptor) hasExtensions() bool { + return d.PictureIDPresent || d.TL0PICIDXPresent || + d.TemporalIDPresent || d.KeyIndexPresent +} + +func (d PayloadDescriptor) pictureID() vpxrtp.PictureID { + return vpxrtp.PictureID{ + Present: d.PictureIDPresent, + Value: d.PictureID, + FifteenBit: d.PictureID15Bit, + } +} + +func (d *PayloadDescriptor) setPictureID(pid vpxrtp.PictureID) { + d.PictureIDPresent = pid.Present + d.PictureID = pid.Value + d.PictureID15Bit = pid.FifteenBit +} + +func (d PayloadDescriptor) validate() error { + if d.PartitionID > 7 { + return vpxerrors.ErrInvalidConfig + } + if err := d.pictureID().Validate(); err != nil { + return err + } + if d.TL0PICIDXPresent && !d.TemporalIDPresent { + return vpxerrors.ErrInvalidConfig + } + if !d.TL0PICIDXPresent && d.TL0PICIDX != 0 { + return vpxerrors.ErrInvalidConfig + } + if d.TemporalIDPresent { + if d.TemporalID > 3 { + return vpxerrors.ErrInvalidConfig + } + } else if d.TemporalID != 0 { + return vpxerrors.ErrInvalidConfig + } + if d.LayerSync && !d.TemporalIDPresent && !d.KeyIndexPresent { + return vpxerrors.ErrInvalidConfig + } + if d.KeyIndexPresent { + if d.KeyIndex > 31 { + return vpxerrors.ErrInvalidConfig + } + } else if d.KeyIndex != 0 { + return vpxerrors.ErrInvalidConfig + } + return nil +} diff --git a/internal/vp8/tables/coefupdate.go b/internal/vp8/tables/coefupdate.go new file mode 100644 index 0000000..9ee0390 --- /dev/null +++ b/internal/vp8/tables/coefupdate.go @@ -0,0 +1,185 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/tables/coefupdate.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// Ported generated coefficient update probabilities from libvpx v1.16.0 +// vp8/common/coefupdateprobs.h. + +var CoefUpdateProbs = [BlockTypes][CoefBands][PrevCoefContexts][EntropyNodes]uint8{ + { + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255}, + {249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255}, + {234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255}, + {250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, + { + { + {217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255}, + {234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255}, + }, + { + {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, + { + { + {186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255}, + {234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255}, + {251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255}, + }, + { + {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, + { + { + {248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255}, + {248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255}, + {248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255}, + {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + { + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, + }, + }, +} diff --git a/internal/vp8/tables/default_coef_probs.go b/internal/vp8/tables/default_coef_probs.go new file mode 100644 index 0000000..78466ea --- /dev/null +++ b/internal/vp8/tables/default_coef_probs.go @@ -0,0 +1,186 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/tables/default_coef_probs.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// Ported from libvpx v1.16.0 vp8/common/default_coef_probs.h. + +type CoefficientProbs [BlockTypes][CoefBands][PrevCoefContexts][EntropyNodes]uint8 + +var DefaultCoefProbs = CoefficientProbs{ + { + { + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {253, 136, 254, 255, 228, 219, 128, 128, 128, 128, 128}, + {189, 129, 242, 255, 227, 213, 255, 219, 128, 128, 128}, + {106, 126, 227, 252, 214, 209, 255, 255, 128, 128, 128}, + }, + { + {1, 98, 248, 255, 236, 226, 255, 255, 128, 128, 128}, + {181, 133, 238, 254, 221, 234, 255, 154, 128, 128, 128}, + {78, 134, 202, 247, 198, 180, 255, 219, 128, 128, 128}, + }, + { + {1, 185, 249, 255, 243, 255, 128, 128, 128, 128, 128}, + {184, 150, 247, 255, 236, 224, 128, 128, 128, 128, 128}, + {77, 110, 216, 255, 236, 230, 128, 128, 128, 128, 128}, + }, + { + {1, 101, 251, 255, 241, 255, 128, 128, 128, 128, 128}, + {170, 139, 241, 252, 236, 209, 255, 255, 128, 128, 128}, + {37, 116, 196, 243, 228, 255, 255, 255, 128, 128, 128}, + }, + { + {1, 204, 254, 255, 245, 255, 128, 128, 128, 128, 128}, + {207, 160, 250, 255, 238, 128, 128, 128, 128, 128, 128}, + {102, 103, 231, 255, 211, 171, 128, 128, 128, 128, 128}, + }, + { + {1, 152, 252, 255, 240, 255, 128, 128, 128, 128, 128}, + {177, 135, 243, 255, 234, 225, 128, 128, 128, 128, 128}, + {80, 129, 211, 255, 194, 224, 128, 128, 128, 128, 128}, + }, + { + {1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {246, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + }, + { + { + {198, 35, 237, 223, 193, 187, 162, 160, 145, 155, 62}, + {131, 45, 198, 221, 172, 176, 220, 157, 252, 221, 1}, + {68, 47, 146, 208, 149, 167, 221, 162, 255, 223, 128}, + }, + { + {1, 149, 241, 255, 221, 224, 255, 255, 128, 128, 128}, + {184, 141, 234, 253, 222, 220, 255, 199, 128, 128, 128}, + {81, 99, 181, 242, 176, 190, 249, 202, 255, 255, 128}, + }, + { + {1, 129, 232, 253, 214, 197, 242, 196, 255, 255, 128}, + {99, 121, 210, 250, 201, 198, 255, 202, 128, 128, 128}, + {23, 91, 163, 242, 170, 187, 247, 210, 255, 255, 128}, + }, + { + {1, 200, 246, 255, 234, 255, 128, 128, 128, 128, 128}, + {109, 178, 241, 255, 231, 245, 255, 255, 128, 128, 128}, + {44, 130, 201, 253, 205, 192, 255, 255, 128, 128, 128}, + }, + { + {1, 132, 239, 251, 219, 209, 255, 165, 128, 128, 128}, + {94, 136, 225, 251, 218, 190, 255, 255, 128, 128, 128}, + {22, 100, 174, 245, 186, 161, 255, 199, 128, 128, 128}, + }, + { + {1, 182, 249, 255, 232, 235, 128, 128, 128, 128, 128}, + {124, 143, 241, 255, 227, 234, 128, 128, 128, 128, 128}, + {35, 77, 181, 251, 193, 211, 255, 205, 128, 128, 128}, + }, + { + {1, 157, 247, 255, 236, 231, 255, 255, 128, 128, 128}, + {121, 141, 235, 255, 225, 227, 255, 255, 128, 128, 128}, + {45, 99, 188, 251, 195, 217, 255, 224, 128, 128, 128}, + }, + { + {1, 1, 251, 255, 213, 255, 128, 128, 128, 128, 128}, + {203, 1, 248, 255, 255, 128, 128, 128, 128, 128, 128}, + {137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128}, + }, + }, + { + { + {253, 9, 248, 251, 207, 208, 255, 192, 128, 128, 128}, + {175, 13, 224, 243, 193, 185, 249, 198, 255, 255, 128}, + {73, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128}, + }, + { + {1, 95, 247, 253, 212, 183, 255, 255, 128, 128, 128}, + {239, 90, 244, 250, 211, 209, 255, 255, 128, 128, 128}, + {155, 77, 195, 248, 188, 195, 255, 255, 128, 128, 128}, + }, + { + {1, 24, 239, 251, 218, 219, 255, 205, 128, 128, 128}, + {201, 51, 219, 255, 196, 186, 128, 128, 128, 128, 128}, + {69, 46, 190, 239, 201, 218, 255, 228, 128, 128, 128}, + }, + { + {1, 191, 251, 255, 255, 128, 128, 128, 128, 128, 128}, + {223, 165, 249, 255, 213, 255, 128, 128, 128, 128, 128}, + {141, 124, 248, 255, 255, 128, 128, 128, 128, 128, 128}, + }, + { + {1, 16, 248, 255, 255, 128, 128, 128, 128, 128, 128}, + {190, 36, 230, 255, 236, 255, 128, 128, 128, 128, 128}, + {149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {1, 226, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {247, 192, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {1, 134, 252, 255, 255, 128, 128, 128, 128, 128, 128}, + {213, 62, 250, 255, 255, 128, 128, 128, 128, 128, 128}, + {55, 93, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + { + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + }, + { + { + {202, 24, 213, 235, 186, 191, 220, 160, 240, 175, 255}, + {126, 38, 182, 232, 169, 184, 228, 174, 255, 187, 128}, + {61, 46, 138, 219, 151, 178, 240, 170, 255, 216, 128}, + }, + { + {1, 112, 230, 250, 199, 191, 247, 159, 255, 255, 128}, + {166, 109, 228, 252, 211, 215, 255, 174, 128, 128, 128}, + {39, 77, 162, 232, 172, 180, 245, 178, 255, 255, 128}, + }, + { + {1, 52, 220, 246, 198, 199, 249, 220, 255, 255, 128}, + {124, 74, 191, 243, 183, 193, 250, 221, 255, 255, 128}, + {24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128}, + }, + { + {1, 182, 225, 249, 219, 240, 255, 224, 128, 128, 128}, + {149, 150, 226, 252, 216, 205, 255, 171, 128, 128, 128}, + {28, 108, 170, 242, 183, 194, 254, 223, 255, 255, 128}, + }, + { + {1, 81, 230, 252, 204, 203, 255, 192, 128, 128, 128}, + {123, 102, 209, 247, 188, 196, 255, 233, 128, 128, 128}, + {20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128}, + }, + { + {1, 222, 248, 255, 216, 213, 128, 128, 128, 128, 128}, + {168, 175, 246, 252, 235, 205, 255, 255, 128, 128, 128}, + {47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128}, + }, + { + {1, 121, 236, 253, 212, 214, 255, 255, 128, 128, 128}, + {141, 84, 213, 252, 201, 202, 255, 219, 128, 128, 128}, + {42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128}, + }, + { + {1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + {238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128}, + }, + }, +} diff --git a/internal/vp8/tables/entropy.go b/internal/vp8/tables/entropy.go new file mode 100644 index 0000000..1ef7dc4 --- /dev/null +++ b/internal/vp8/tables/entropy.go @@ -0,0 +1,71 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/tables/entropy.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +const ( + ZeroToken = 0 + OneToken = 1 + TwoToken = 2 + ThreeToken = 3 + FourToken = 4 + DCTValCategory1 = 5 + DCTValCategory2 = 6 + DCTValCategory3 = 7 + DCTValCategory4 = 8 + DCTValCategory5 = 9 + DCTValCategory6 = 10 + DCTEOBToken = 11 + + MaxEntropyTokens = 12 + EntropyNodes = 11 + ProbUpdateBaselineCost = 7 + MaxProb = 255 + DCTMaxValue = 2048 + BlockTypes = 4 + CoefBands = 8 + PrevCoefContexts = 3 +) + +var BoolNorm = [256]uint8{ + 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +} + +var CoefBandsTable = [16]uint8{ + 0, 1, 2, 3, 6, 4, 5, 6, + 6, 6, 6, 6, 6, 6, 6, 7, +} + +var DefaultZigZag1D = [16]int16{ + 0, 1, 4, 8, 5, 2, 3, 6, + 9, 12, 13, 10, 7, 11, 14, 15, +} + +var ( + Cat3Prob = [3]uint8{173, 148, 140} + Cat4Prob = [4]uint8{176, 155, 140, 135} + Cat5Prob = [5]uint8{180, 157, 141, 134, 130} + Cat6Prob = [11]uint8{254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129} +) diff --git a/internal/vp8/tables/filter.go b/internal/vp8/tables/filter.go new file mode 100644 index 0000000..6e194e3 --- /dev/null +++ b/internal/vp8/tables/filter.go @@ -0,0 +1,41 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/tables/filter.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// Ported interpolation filter tables from libvpx v1.16.0 +// vp8/common/filter.c and constants from vp8/common/filter.h. + +const ( + FilterWeight = 128 + FilterShift = 7 +) + +var BilinearFilters = [8][2]int16{ + {128, 0}, + {112, 16}, + {96, 32}, + {80, 48}, + {64, 64}, + {48, 80}, + {32, 96}, + {16, 112}, +} + +var SubPelFilters = [8][6]int16{ + {0, 0, 128, 0, 0, 0}, + {0, -6, 123, 12, -1, 0}, + {2, -11, 108, 36, -8, 1}, + {0, -9, 93, 50, -6, 0}, + {3, -16, 77, 77, -16, 3}, + {0, -6, 50, 93, -9, 0}, + {1, -8, 36, 108, -11, 2}, + {0, -1, 12, 123, -6, 0}, +} diff --git a/internal/vp8/tables/keyframe_bmode_probs.go b/internal/vp8/tables/keyframe_bmode_probs.go new file mode 100644 index 0000000..d6df79d --- /dev/null +++ b/internal/vp8/tables/keyframe_bmode_probs.go @@ -0,0 +1,117 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/tables/keyframe_bmode_probs.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// Ported keyframe B-mode probabilities from libvpx v1.16.0 +// vp8/common/vp8_entropymodedata.h. + +var KeyFrameBModeProbs = [10][10][BModeProbCount]uint8{ + {{231, 120, 48, 89, 115, 113, 120, 152, 112}, + {152, 179, 64, 126, 170, 118, 46, 70, 95}, + {175, 69, 143, 80, 85, 82, 72, 155, 103}, + {56, 58, 10, 171, 218, 189, 17, 13, 152}, + {144, 71, 10, 38, 171, 213, 144, 34, 26}, + {114, 26, 17, 163, 44, 195, 21, 10, 173}, + {121, 24, 80, 195, 26, 62, 44, 64, 85}, + {170, 46, 55, 19, 136, 160, 33, 206, 71}, + {63, 20, 8, 114, 114, 208, 12, 9, 226}, + {81, 40, 11, 96, 182, 84, 29, 16, 36}}, + {{134, 183, 89, 137, 98, 101, 106, 165, 148}, + {72, 187, 100, 130, 157, 111, 32, 75, 80}, + {66, 102, 167, 99, 74, 62, 40, 234, 128}, + {41, 53, 9, 178, 241, 141, 26, 8, 107}, + {104, 79, 12, 27, 217, 255, 87, 17, 7}, + {74, 43, 26, 146, 73, 166, 49, 23, 157}, + {65, 38, 105, 160, 51, 52, 31, 115, 128}, + {87, 68, 71, 44, 114, 51, 15, 186, 23}, + {47, 41, 14, 110, 182, 183, 21, 17, 194}, + {66, 45, 25, 102, 197, 189, 23, 18, 22}}, + {{88, 88, 147, 150, 42, 46, 45, 196, 205}, + {43, 97, 183, 117, 85, 38, 35, 179, 61}, + {39, 53, 200, 87, 26, 21, 43, 232, 171}, + {56, 34, 51, 104, 114, 102, 29, 93, 77}, + {107, 54, 32, 26, 51, 1, 81, 43, 31}, + {39, 28, 85, 171, 58, 165, 90, 98, 64}, + {34, 22, 116, 206, 23, 34, 43, 166, 73}, + {68, 25, 106, 22, 64, 171, 36, 225, 114}, + {34, 19, 21, 102, 132, 188, 16, 76, 124}, + {62, 18, 78, 95, 85, 57, 50, 48, 51}}, + {{193, 101, 35, 159, 215, 111, 89, 46, 111}, + {60, 148, 31, 172, 219, 228, 21, 18, 111}, + {112, 113, 77, 85, 179, 255, 38, 120, 114}, + {40, 42, 1, 196, 245, 209, 10, 25, 109}, + {100, 80, 8, 43, 154, 1, 51, 26, 71}, + {88, 43, 29, 140, 166, 213, 37, 43, 154}, + {61, 63, 30, 155, 67, 45, 68, 1, 209}, + {142, 78, 78, 16, 255, 128, 34, 197, 171}, + {41, 40, 5, 102, 211, 183, 4, 1, 221}, + {51, 50, 17, 168, 209, 192, 23, 25, 82}}, + {{125, 98, 42, 88, 104, 85, 117, 175, 82}, + {95, 84, 53, 89, 128, 100, 113, 101, 45}, + {75, 79, 123, 47, 51, 128, 81, 171, 1}, + {57, 17, 5, 71, 102, 57, 53, 41, 49}, + {115, 21, 2, 10, 102, 255, 166, 23, 6}, + {38, 33, 13, 121, 57, 73, 26, 1, 85}, + {41, 10, 67, 138, 77, 110, 90, 47, 114}, + {101, 29, 16, 10, 85, 128, 101, 196, 26}, + {57, 18, 10, 102, 102, 213, 34, 20, 43}, + {117, 20, 15, 36, 163, 128, 68, 1, 26}}, + {{138, 31, 36, 171, 27, 166, 38, 44, 229}, + {67, 87, 58, 169, 82, 115, 26, 59, 179}, + {63, 59, 90, 180, 59, 166, 93, 73, 154}, + {40, 40, 21, 116, 143, 209, 34, 39, 175}, + {57, 46, 22, 24, 128, 1, 54, 17, 37}, + {47, 15, 16, 183, 34, 223, 49, 45, 183}, + {46, 17, 33, 183, 6, 98, 15, 32, 183}, + {65, 32, 73, 115, 28, 128, 23, 128, 205}, + {40, 3, 9, 115, 51, 192, 18, 6, 223}, + {87, 37, 9, 115, 59, 77, 64, 21, 47}}, + {{104, 55, 44, 218, 9, 54, 53, 130, 226}, + {64, 90, 70, 205, 40, 41, 23, 26, 57}, + {54, 57, 112, 184, 5, 41, 38, 166, 213}, + {30, 34, 26, 133, 152, 116, 10, 32, 134}, + {75, 32, 12, 51, 192, 255, 160, 43, 51}, + {39, 19, 53, 221, 26, 114, 32, 73, 255}, + {31, 9, 65, 234, 2, 15, 1, 118, 73}, + {88, 31, 35, 67, 102, 85, 55, 186, 85}, + {56, 21, 23, 111, 59, 205, 45, 37, 192}, + {55, 38, 70, 124, 73, 102, 1, 34, 98}}, + {{102, 61, 71, 37, 34, 53, 31, 243, 192}, + {69, 60, 71, 38, 73, 119, 28, 222, 37}, + {68, 45, 128, 34, 1, 47, 11, 245, 171}, + {62, 17, 19, 70, 146, 85, 55, 62, 70}, + {75, 15, 9, 9, 64, 255, 184, 119, 16}, + {37, 43, 37, 154, 100, 163, 85, 160, 1}, + {63, 9, 92, 136, 28, 64, 32, 201, 85}, + {86, 6, 28, 5, 64, 255, 25, 248, 1}, + {56, 8, 17, 132, 137, 255, 55, 116, 128}, + {58, 15, 20, 82, 135, 57, 26, 121, 40}}, + {{164, 50, 31, 137, 154, 133, 25, 35, 218}, + {51, 103, 44, 131, 131, 123, 31, 6, 158}, + {86, 40, 64, 135, 148, 224, 45, 183, 128}, + {22, 26, 17, 131, 240, 154, 14, 1, 209}, + {83, 12, 13, 54, 192, 255, 68, 47, 28}, + {45, 16, 21, 91, 64, 222, 7, 1, 197}, + {56, 21, 39, 155, 60, 138, 23, 102, 213}, + {85, 26, 85, 85, 128, 128, 32, 146, 171}, + {18, 11, 7, 63, 144, 171, 4, 4, 246}, + {35, 27, 10, 146, 174, 171, 12, 26, 128}}, + {{190, 80, 35, 99, 180, 80, 126, 54, 45}, + {85, 126, 47, 87, 176, 51, 41, 20, 32}, + {101, 75, 128, 139, 118, 146, 116, 128, 85}, + {56, 41, 15, 176, 236, 85, 37, 9, 62}, + {146, 36, 19, 30, 171, 255, 97, 27, 20}, + {71, 30, 17, 119, 118, 255, 17, 18, 138}, + {101, 38, 60, 138, 55, 70, 43, 26, 142}, + {138, 45, 61, 62, 219, 1, 81, 188, 64}, + {32, 41, 20, 117, 151, 142, 20, 21, 163}, + {112, 19, 12, 61, 195, 128, 48, 4, 24}}, +} diff --git a/internal/vp8/tables/modes.go b/internal/vp8/tables/modes.go new file mode 100644 index 0000000..b83936a --- /dev/null +++ b/internal/vp8/tables/modes.go @@ -0,0 +1,91 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/tables/modes.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +const ( + NumMBSplits = 4 + SubMVRefCount = 5 + + YModeProbCount = 4 + UVModeProbCount = 3 + BModeProbCount = 9 + + InterModeContextCount = 6 + InterModeContextProbs = 4 +) + +var DefaultYModeProbs = [YModeProbCount]uint8{112, 86, 140, 37} + +var KeyFrameYModeProbs = [YModeProbCount]uint8{145, 156, 163, 128} + +var DefaultUVModeProbs = [UVModeProbCount]uint8{162, 101, 204} + +var KeyFrameUVModeProbs = [UVModeProbCount]uint8{142, 114, 183} + +var DefaultBModeProbs = [BModeProbCount]uint8{120, 90, 79, 133, 87, 85, 80, 111, 151} + +var InterModeContexts = [InterModeContextCount][InterModeContextProbs]uint8{ + {7, 1, 1, 143}, + {14, 18, 14, 107}, + {135, 64, 57, 68}, + {60, 56, 128, 65}, + {159, 134, 128, 34}, + {234, 188, 128, 28}, +} + +var SubMVRefProb3 = [8][3]uint8{ + {147, 136, 18}, + {223, 1, 34}, + {106, 145, 1}, + {208, 1, 1}, + {179, 121, 1}, + {223, 1, 34}, + {179, 121, 1}, + {208, 1, 1}, +} + +var MBSplitProbs = [NumMBSplits - 1]uint8{110, 111, 150} + +var MBSplitOffset = [NumMBSplits][16]uint8{ + {0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, +} + +var MBSplitFillCount = [NumMBSplits]uint8{8, 8, 4, 1} + +var MBSplitFillOffset = [NumMBSplits][16]uint8{ + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + {0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15}, + {0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15}, + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, +} + +var BModeTree = [18]int16{ + 0, 2, + -1, 4, + -2, 6, + 8, 12, + -3, 10, + -5, -6, + -4, 14, + -7, 16, + -8, -9, +} + +var YModeTree = [8]int16{-0, 2, 4, 6, -1, -2, -3, -4} + +var KeyFrameYModeTree = [8]int16{-4, 2, 4, 6, -0, -1, -2, -3} + +var UVModeTree = [6]int16{-0, 2, -1, 4, -2, -3} + +var SmallMVTree = [14]int16{2, 8, 4, 6, -0, -1, -2, -3, 10, 12, -4, -5, -6, -7} diff --git a/internal/vp8/tables/mv.go b/internal/vp8/tables/mv.go new file mode 100644 index 0000000..2877f23 --- /dev/null +++ b/internal/vp8/tables/mv.go @@ -0,0 +1,48 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp8/tables/mv.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// Ported static motion-vector probability tables from libvpx v1.16.0 +// vp8/common/entropymv.c and constants from vp8/common/entropymv.h. + +const ( + MVPCount = 19 +) + +var MVUpdateProbs = [2][MVPCount]uint8{ + { + 237, + 246, + 253, 253, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 250, 250, 252, 254, 254, + }, + { + 231, + 243, + 245, 253, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 251, 251, 254, 254, 254, + }, +} + +var DefaultMVContext = [2][MVPCount]uint8{ + { + 162, + 128, + 225, 146, 172, 147, 214, 39, 156, + 128, 129, 132, 75, 145, 178, 206, 239, 254, 254, + }, + { + 164, + 128, + 204, 170, 119, 235, 140, 230, 228, + 128, 130, 130, 74, 148, 180, 203, 236, 254, 254, + }, +} diff --git a/internal/vp9/bitstream/load_generic.go b/internal/vp9/bitstream/load_generic.go new file mode 100644 index 0000000..a75e076 --- /dev/null +++ b/internal/vp9/bitstream/load_generic.go @@ -0,0 +1,18 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/bitstream/load_generic.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package bitstream + +import "encoding/binary" + +// load64BE reads 8 bytes big-endian from b at offset i. +func load64BE(b []byte, i int) uint64 { + return binary.BigEndian.Uint64(b[i:]) +} diff --git a/internal/vp9/bitstream/reader.go b/internal/vp9/bitstream/reader.go new file mode 100644 index 0000000..40f8a68 --- /dev/null +++ b/internal/vp9/bitstream/reader.go @@ -0,0 +1,481 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/bitstream/reader.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package bitstream + +import ( + "errors" + "math/bits" +) + +// Ported from libvpx v1.16.0: +// - vpx_dsp/bitreader.h (vpx_reader, vpx_read, vpx_read_bit, vpx_read_literal, vpx_read_tree) +// - vpx_dsp/bitreader.c (vpx_reader_init, vpx_reader_fill, vpx_reader_find_end) + +// valueBits is the bit width of the value buffer used by the VP9 boolean +// range coder. libvpx uses size_t; on the supported 64-bit targets that is +// 64 bits and the wire format depends on it being exactly 64 — the fill +// path reads big-endian 64-bit words straight out of the bitstream. +const valueBits = 64 + +// lotsOfBits is the sentinel libvpx adds to count when the coded buffer is +// exhausted. The exact value doesn't matter beyond "large positive, easy to +// load as an immediate"; we keep libvpx's choice byte-for-byte so error +// detection lines up with the upstream behavior. +const lotsOfBits = 0x40000000 + +// ErrInvalidInput indicates that vpx_reader_init found a nil buffer with a +// non-zero size, or the marker bit at the start of the compressed header +// was not zero. +var ErrInvalidInput = errors.New("govpx: invalid VP9 bitstream input") + +// Reader is the VP9 boolean range coder reader. It is allocation-free in +// steady state; the only allocation happens (if any) inside the caller's +// owned input slice. Fields are ordered the way libvpx orders them in +// vpx_reader to keep cache layout similar. +type Reader struct { + value uint64 + rng uint32 + count int32 + + buf []byte + pos int + + // tail mirrors the final min(8, len(buf)) bytes of buf followed by + // zeros, and tailBase is the buf position tail[0] corresponds to + // (max(0, len(buf)-8)). Together they let the refill path issue one + // unconditional 8-byte big-endian load for any pos: reads beyond the + // logical end see zero bits, exactly like vpx_reader_fill's + // byte-at-a-time tail loop. + tail [16]byte + tailBase int +} + +// ReaderState is a hot-loop-local view of Reader's arithmetic-coder state. +// libvpx's VP9 detokenizer keeps value, range, and count in locals through +// decode_coefs and writes them back once; this type gives the same shape to Go +// callers that need to batch many Read calls without exposing Reader fields. +type ReaderState struct { + r *Reader + Value uint64 + Range uint32 + Count int32 +} + +// Init seeds the reader from src, mirroring vpx_reader_init. It returns +// ErrInvalidInput if the first bit read after the initial fill is not +// zero (libvpx rejects the frame in that case). +func (r *Reader) Init(src []byte) error { + r.buf = src + r.pos = 0 + r.value = 0 + r.count = -8 + r.rng = 255 + r.tailBase = max(0, len(src)-8) + r.tail = [16]byte{} + copy(r.tail[:], src[r.tailBase:]) + r.fill() + if r.ReadBit() != 0 { // marker bit + return ErrInvalidInput + } + return nil +} + +// LocalState returns a local arithmetic-coder state snapshot. Call Commit +// before the underlying Reader is used again. +func (r *Reader) LocalState() ReaderState { + return ReaderState{ + r: r, + Value: r.value, + Range: r.rng, + Count: r.count, + } +} + +// Read decodes one bit against the probability prob (out of 256) and +// returns 0 or 1. The body matches vpx_read line-for-line so the cache +// layout, normalization shift, and end-of-stream count update remain +// byte-identical to libvpx. +func (r *Reader) Read(prob uint32) uint32 { + baseRange := r.rng + split := 1 + (((baseRange - 1) * prob) >> 8) + + if r.count < 0 { + r.fill() + } + + value := r.value + count := r.count + bigsplit := uint64(split) << (valueBits - 8) + ge := value >= bigsplit + nr := split + if ge { + nr = baseRange - split + } + nv := value + if ge { + nv = value - bigsplit + } + var bit uint32 + if ge { + bit = 1 + } + shift := uint32(bits.LeadingZeros8(uint8(nr))) + r.rng = nr << shift + r.value = nv << shift + r.count = count - int32(shift) + return bit +} + +// ReadBit decodes one equally-likely bit. Equivalent to Read(128). +func (r *Reader) ReadBit() uint32 { + rng := r.rng + split := (rng + 1) >> 1 + + if r.count < 0 { + r.fill() + } + + value := r.value + count := r.count + bigsplit := uint64(split) << (valueBits - 8) + + nextRange := split + var bit uint32 + if value >= bigsplit { + nextRange = rng - split + value -= bigsplit + bit = 1 + } + + shift := uint32(bits.LeadingZeros8(uint8(nextRange))) & 7 + r.rng = nextRange << shift + r.value = value << shift + r.count = count - int32(shift) + return bit +} + +// Read decodes one bit against prob using local arithmetic-coder state. +func (s *ReaderState) Read(prob uint32) uint32 { + baseRange := s.Range + split := 1 + (((baseRange - 1) * prob) >> 8) + + if s.Count < 0 { + s.fill() + } + + value := s.Value + count := s.Count + bigsplit := uint64(split) << (valueBits - 8) + ge := value >= bigsplit + nr := split + if ge { + nr = baseRange - split + } + nv := value + if ge { + nv = value - bigsplit + } + var bit uint32 + if ge { + bit = 1 + } + shift := uint32(bits.LeadingZeros8(uint8(nr))) + s.Range = nr << shift + s.Value = nv << shift + s.Count = count - int32(shift) + return bit +} + +// ReadBit decodes one equally-likely bit using local arithmetic-coder state. +func (s *ReaderState) ReadBit() uint32 { + rng := s.Range + split := (rng + 1) >> 1 + + if s.Count < 0 { + s.fill() + } + + value := s.Value + count := s.Count + bigsplit := uint64(split) << (valueBits - 8) + + nextRange := split + var bit uint32 + if value >= bigsplit { + nextRange = rng - split + value -= bigsplit + bit = 1 + } + + shift := uint32(bits.LeadingZeros8(uint8(nextRange))) & 7 + s.Range = nextRange << shift + s.Value = value << shift + s.Count = count - int32(shift) + return bit +} + +// Commit writes local arithmetic-coder state back to the underlying Reader. +func (s *ReaderState) Commit() { + if s == nil || s.r == nil { + return + } + s.r.value = s.Value + s.r.rng = s.Range + s.r.count = s.Count +} + +// Fill refreshes local value/count variables from the underlying byte stream. +func (s *ReaderState) Fill(value *uint64, count *int32) { + s.Value = *value + s.Count = *count + s.fill() + *value = s.Value + *count = s.Count +} + +// ReadLiteral decodes bits equally-likely bits, MSB first. +func (r *Reader) ReadLiteral(bits int) uint32 { + var literal uint32 + for b := bits - 1; b >= 0; b-- { + literal |= r.ReadBit() << uint(b) + } + return literal +} + +// ReadUnary3 decodes a 3-node right-leaning binary tree {-0, 2, -1, 4, -2, -3} +// (PartitionTree, MvJointTree, MvFpTree, and remapped InterModeTree) in +// registers with a single refill check and zero slice indexing. +func (r *Reader) ReadUnary3(p0, p1, p2 uint32) int { + if len(r.buf)-r.pos > 8 { + value := r.value + rng := r.rng + count := r.count + pos := r.pos + if count < 24 { + value, count, pos = FillFast(r.buf, pos, value, count) + } + // Bit 0 + s := 1 + (((rng - 1) * p0) >> 8) + bigsplit := uint64(s) << 56 + if value < bigsplit { + sh := uint32(bits.LeadingZeros8(uint8(s))) + r.rng = s << sh + r.value = value << sh + r.count = count - int32(sh) + r.pos = pos + return 0 + } + nr := rng - s + nv := value - bigsplit + sh := uint32(bits.LeadingZeros8(uint8(nr))) + rng = nr << sh + value = nv << sh + count -= int32(sh) + + // Bit 1 + s = 1 + (((rng - 1) * p1) >> 8) + bigsplit = uint64(s) << 56 + if value < bigsplit { + sh = uint32(bits.LeadingZeros8(uint8(s))) + r.rng = s << sh + r.value = value << sh + r.count = count - int32(sh) + r.pos = pos + return 1 + } + nr = rng - s + nv = value - bigsplit + sh = uint32(bits.LeadingZeros8(uint8(nr))) + rng = nr << sh + value = nv << sh + count -= int32(sh) + + // Bit 2 + s = 1 + (((rng - 1) * p2) >> 8) + bigsplit = uint64(s) << 56 + ge := value >= bigsplit + nr = s + if ge { + nr = rng - s + } + nv = value + if ge { + nv = value - bigsplit + } + out := 2 + if ge { + out = 3 + } + sh = uint32(bits.LeadingZeros8(uint8(nr))) + r.rng = nr << sh + r.value = nv << sh + r.count = count - int32(sh) + r.pos = pos + return out + } + if r.Read(p0) == 0 { + return 0 + } + if r.Read(p1) == 0 { + return 1 + } + return 2 + int(r.Read(p2)) +} + +// ReadTree decodes a value from a binary token tree. `tree` is the +// VP9 token-tree array (int8 per libvpx's vpx_tree_index): positive +// entries are next-node indices, non-positive entries are leaf labels +// stored as the negation of the decoded value. `probs` carries one +// probability per internal-node index pair. Bit-identical to libvpx's +// vpx_read_tree in vpx_dsp/bitreader.h. +func (r *Reader) ReadTree(tree []int8, probs []uint8) int { + // Register-resident fast path: VP9 syntax trees are at most ~16 + // levels deep (the deepest is the MV class tree), each read consumes + // at most 8 bits, and a refill prefetches at most 8 bytes, so with + // more than 32 readable bytes every refill stays on the inlined + // FillFast path and the whole walk runs without function calls. + if len(r.buf)-r.pos > 32 { + buf := r.buf + pos := r.pos + value := r.value + rng := r.rng + count := r.count + i := int8(0) + for { + prob := uint32(probs[i>>1]) + if count < 0 { + value, count, pos = FillFast(buf, pos, value, count) + } + split := 1 + (((rng - 1) * prob) >> 8) + bigsplit := uint64(split) << 56 + ge := value >= bigsplit + nr := split + if ge { + nr = rng - split + } + nv := value + if ge { + nv = value - bigsplit + } + bit := 0 + if ge { + bit = 1 + } + shift := uint32(bits.LeadingZeros8(uint8(nr))) + value = nv << shift + rng = nr << shift + count -= int32(shift) + next := tree[int(i)+bit] + if next <= 0 { + r.value = value + r.rng = rng + r.count = count + r.pos = pos + return -int(next) + } + i = next + } + } + i := int8(0) + for { + next := tree[int(i)+int(r.Read(uint32(probs[i>>1])))] + if next <= 0 { + return -int(next) + } + i = next + } +} + +// HasError mirrors vpx_reader_has_error: 1 iff a bit was requested after +// the end of stream was reached. Returns a bool here to match Go idiom. +func (r *Reader) HasError() bool { + return r.count > valueBits && r.count < lotsOfBits +} + +// fill refreshes the value register from the underlying buffer, +// mirroring vpx_reader_fill in vpx_dsp/bitreader.c (see FillBits). +func (r *Reader) fill() { + r.value, r.count, r.pos = FillBits(r.buf, &r.tail, r.tailBase, r.pos, + r.value, r.count) +} + +func (s *ReaderState) fill() { + s.Value, s.Count, s.r.pos = FillBits(s.r.buf, &s.r.tail, s.r.tailBase, + s.r.pos, s.Value, s.Count) +} + +// BitView exposes the refill window of the underlying Reader so external +// hot loops can keep the entire boolean-decoder state — including the +// buffer position — in local variables and refill via FillBits without +// any function call. Callers must write the advanced position back with +// CommitPos before the Reader is used again. +func (s *ReaderState) BitView() (buf []byte, tail *[16]byte, tailBase int, pos int) { + return s.r.buf, &s.r.tail, s.r.tailBase, s.r.pos +} + +// CommitPos writes a locally advanced buffer position back to the +// underlying Reader. Pairs with BitView. +func (s *ReaderState) CommitPos(pos int) { + s.r.pos = pos +} + +// FillFast is FillBits restricted to refills that happen more than 8 +// bytes before the end of buf: no zero-padding redirect and no +// end-of-stream sentinel is possible there, so the whole refill is one +// unconditional big-endian load plus shift arithmetic. It is small +// enough to inline, which keeps guarded hot loops (see the coefficient +// detokenizer) completely call-free. Callers must guarantee +// len(buf)-pos >= 8 and hand the last few stream bytes to the general +// FillBits path. +func FillFast(buf []byte, pos int, value uint64, count int32) (uint64, int32, int) { + shift := int32(valueBits-8) - (count + 8) + be := load64BE(buf, pos) + bits := (shift &^ 7) + 8 + value |= (be >> (uint(64-bits) & 63)) << uint(shift&7) + return value, count + bits, pos + int(bits>>3) +} + +// FillBits is vpx_reader_fill on caller-held state. It must only be +// called when count < 0, matching libvpx's `if (r->count < 0) +// vpx_reader_fill(r)` discipline; the returned value/count/pos triple is +// bit- and error-exact with the upstream byte-loop implementation. +// +// tail/tailBase carry the Reader's zero-padded final-8-byte window: once +// fewer than 9 bytes remain, the 8-byte load is redirected there so the +// extra lanes read zeros (vpx_reader_fill shifts in nothing past the +// end) and the lotsOfBits end-of-stream sentinel is stamped into count +// exactly when the logical buffer runs out. The function is sized to +// stay within the inliner budget: keeping refills call-free lets Go hold +// hot-loop decoder state in registers, which is what libvpx gets from C +// callee-saved registers around its cold fill call. +func FillBits(buf []byte, tail *[16]byte, tailBase int, pos int, + value uint64, count int32, +) (uint64, int32, int) { + shift := int32(valueBits-8) - (count + 8) + src := buf + idx := pos + if len(buf)-pos <= 8 { + src = tail[:] + idx = pos - tailBase + } + be := load64BE(src, idx) + bits := (shift &^ 7) + 8 + value |= (be >> uint(64-bits)) << uint(shift&7) + bitsLeft := int32(len(buf)-pos) * 8 + if shift+8 >= bitsLeft { + count += bitsLeft + lotsOfBits + pos = len(buf) + } else { + count += bits + pos += int(bits >> 3) + } + return value, count, pos +} diff --git a/internal/vp9/bitstream/superframe.go b/internal/vp9/bitstream/superframe.go new file mode 100644 index 0000000..edb4335 --- /dev/null +++ b/internal/vp9/bitstream/superframe.go @@ -0,0 +1,68 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/bitstream/superframe.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package bitstream + +import ( + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" +) + +// SuperframeIndex describes the frame slices carried by a VP9 superframe +// index. Count is zero when a packet is not a superframe. +type SuperframeIndex struct { + Frames [8][]byte + Count int +} + +// ParseSuperframe parses a trailing VP9 superframe index. It returns Count +// zero when packet is a non-superframe packet. +// +// Ported from libvpx v1.16.0 vp9/decoder/vp9_decoder.c +// vp9_parse_superframe_index. +func ParseSuperframe(packet []byte) (SuperframeIndex, error) { + var sf SuperframeIndex + if len(packet) == 0 { + return sf, vpxerrors.ErrInvalidVP9Data + } + marker := packet[len(packet)-1] + if marker&0xe0 != 0xc0 { + return sf, nil + } + + frames := int(marker&0x7) + 1 + sizeBytes := int((marker>>3)&0x3) + 1 + indexSize := 2 + frames*sizeBytes + if len(packet) < indexSize { + return sf, vpxerrors.ErrInvalidVP9Data + } + indexStart := len(packet) - indexSize + if packet[indexStart] != marker { + return sf, vpxerrors.ErrInvalidVP9Data + } + + offset := 0 + sizeOffset := indexStart + 1 + for i := range frames { + frameSize := 0 + for j := range sizeBytes { + frameSize |= int(packet[sizeOffset+i*sizeBytes+j]) << (8 * j) + } + if frameSize <= 0 || frameSize > indexStart-offset { + return sf, vpxerrors.ErrInvalidVP9Data + } + sf.Frames[i] = packet[offset : offset+frameSize] + offset += frameSize + } + if offset != indexStart { + return sf, vpxerrors.ErrInvalidVP9Data + } + sf.Count = frames + return sf, nil +} diff --git a/internal/vp9/codec/codecapi_aliases.go b/internal/vp9/codec/codecapi_aliases.go new file mode 100644 index 0000000..daa5a39 --- /dev/null +++ b/internal/vp9/codec/codecapi_aliases.go @@ -0,0 +1,117 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/codecapi_aliases.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + vp8common "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vpx/codecapi" + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" +) + +const ( + UpstreamLibvpxVersion = codecapi.UpstreamLibvpxVersion + CodecVP8 = codecapi.CodecVP8 + CodecVP9 = codecapi.CodecVP9 + maxVP9Dimension = codecapi.MaxVP9Dimension + maxARNRFrames = codecapi.MaxARNRFrames + defaultDropFramesWaterMark = codecapi.DefaultDropFramesWaterMark + libvpxDefaultBufferSizeMs = codecapi.LibvpxDefaultBufferSizeMs + libvpxDefaultBufferInitialMs = codecapi.LibvpxDefaultBufferInitialMs + libvpxDefaultBufferOptimalMs = codecapi.LibvpxDefaultBufferOptimalMs + maxRateControlOvershootPct = codecapi.MaxRateControlOvershootPct + maxRateControlUndershootPct = codecapi.MaxRateControlUndershootPct + + libvpxTimestampTicksPerSecond = codecapi.LibvpxTimestampTicksPerSecond + maxInt64Value = codecapi.MaxInt64Value + rowWorkerIdleSpinBudget = codecapi.RowWorkerIdleSpinBudget + vp9WorkerIdleSpinBudget = codecapi.VP9WorkerIdleSpinBudget + rowWorkerIdleSchedulerBackoff = codecapi.RowWorkerIdleSchedulerBackoff +) + +type Codec = codecapi.Codec +type ChromaSubsampling = codecapi.ChromaSubsampling +type Image = codecapi.Image + +type ReferenceFrame = codecapi.ReferenceFrame + +type PostProcessFlag = codecapi.PostProcessFlag +type VP8Decryptor = codecapi.VP8Decryptor + +type EncoderPhaseStats = codecapi.EncoderPhaseStats + +type RTPPayloadFragment = codecapi.RTPPayloadFragment + +const ( + Subsampling420 = codecapi.Subsampling420 + Subsampling422 = codecapi.Subsampling422 + Subsampling440 = codecapi.Subsampling440 + Subsampling444 = codecapi.Subsampling444 + + ReferenceFlagLast = codecapi.ReferenceFlagLast + ReferenceFlagGolden = codecapi.ReferenceFlagGolden + ReferenceFlagAltRef = codecapi.ReferenceFlagAltRef + ReferenceLast = codecapi.ReferenceLast + ReferenceGolden = codecapi.ReferenceGolden + ReferenceAltRef = codecapi.ReferenceAltRef + + RateControlVBR = codecapi.RateControlVBR + RateControlCBR = codecapi.RateControlCBR + RateControlCQ = codecapi.RateControlCQ + RateControlQ = codecapi.RateControlQ + + RealtimeFrameDropUnchanged = codecapi.RealtimeFrameDropUnchanged + RealtimeFrameDropDisabled = codecapi.RealtimeFrameDropDisabled + RealtimeFrameDropEnabled = codecapi.RealtimeFrameDropEnabled + + DeadlineBestQuality = codecapi.DeadlineBestQuality + DeadlineGoodQuality = codecapi.DeadlineGoodQuality + DeadlineRealtime = codecapi.DeadlineRealtime + + ScalingNormal = codecapi.ScalingNormal + ScalingFourFive = codecapi.ScalingFourFive + ScalingThreeFive = codecapi.ScalingThreeFive + ScalingOneTwo = codecapi.ScalingOneTwo + + TunePSNR = codecapi.TunePSNR + TuneSSIM = codecapi.TuneSSIM + + EncodeForceKeyFrame = codecapi.EncodeForceKeyFrame + EncodeInvisibleFrame = codecapi.EncodeInvisibleFrame + EncodeNoReferenceLast = codecapi.EncodeNoReferenceLast + EncodeNoReferenceGolden = codecapi.EncodeNoReferenceGolden + EncodeNoReferenceAltRef = codecapi.EncodeNoReferenceAltRef + EncodeNoUpdateLast = codecapi.EncodeNoUpdateLast + EncodeNoUpdateGolden = codecapi.EncodeNoUpdateGolden + EncodeNoUpdateAltRef = codecapi.EncodeNoUpdateAltRef + EncodeNoUpdateEntropy = codecapi.EncodeNoUpdateEntropy + EncodeForceGoldenFrame = codecapi.EncodeForceGoldenFrame + EncodeForceAltRefFrame = codecapi.EncodeForceAltRefFrame + + PostProcessDeblock = codecapi.PostProcessDeblock + PostProcessDemacroblock = codecapi.PostProcessDemacroblock + PostProcessAddNoise = codecapi.PostProcessAddNoise + PostProcessMFQE = codecapi.PostProcessMFQE + allPostProcessFlags = codecapi.AllPostProcessFlags +) + +var ( + ErrFrameRejected = vpxerrors.ErrFrameRejected + ErrInvalidConfig = vpxerrors.ErrInvalidConfig + + ErrClosed = vpxerrors.ErrClosed + ErrInvalidVP9Data = vpxerrors.ErrInvalidVP9Data +) + +func runtimeProcYield(cycles uint32) { codecapi.RuntimeProcYield(cycles) } + +func publicImageFromVP8(src *vp8common.Image) Image { + return codecapi.PublicImageFromVP8(src) +} diff --git a/internal/vp9/codec/vp9_decoder.go b/internal/vp9/codec/vp9_decoder.go new file mode 100644 index 0000000..b093da5 --- /dev/null +++ b/internal/vp9/codec/vp9_decoder.go @@ -0,0 +1,2311 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "errors" + + "github.com/go-avkit/vpx/internal/pixel" + vp8common "github.com/go-avkit/vpx/internal/vp8/common" + vp8dec "github.com/go-avkit/vpx/internal/vp8/decoder" + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" + "github.com/go-avkit/vpx/internal/vp9/dsp" + "github.com/go-avkit/vpx/internal/vpx/buffers" + "github.com/go-avkit/vpx/internal/vpx/codecapi" + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" +) + +// VP9Decryptor mirrors libvpx v1.16.0 VPXD_SET_DECRYPTOR for VP9. +// It is an alias of VP8Decryptor because libvpx uses the same +// vpx_decrypt_cb callback shape for both codecs. +type VP9Decryptor = VP8Decryptor + +// VP9ExternalFrameBuffer is the application-owned storage returned by +// VP9GetFrameBufferFunc. Data must have at least the requested minSize; Private +// is carried back unchanged to VP9ReleaseFrameBufferFunc. +type VP9ExternalFrameBuffer struct { + Data []byte + Private any +} + +// VP9GetFrameBufferFunc mirrors libvpx's vpx_get_frame_buffer_cb_fn_t for VP9. +// The decoder may call it more than once per Decode. The returned data does not +// need to be aligned, but newly allocated or grown buffers should be zeroed. +type VP9GetFrameBufferFunc func(minSize int) (VP9ExternalFrameBuffer, error) + +// VP9ReleaseFrameBufferFunc mirrors libvpx's release callback for VP9 external +// frame buffers. Release is a notification; libvpx itself does not reliably +// surface release failures, so govpx follows that behavior with no error return. +type VP9ReleaseFrameBufferFunc func(VP9ExternalFrameBuffer) + +// VP9DecoderOptions configures a VP9 decoder. Mirrors the VP8 shape +// so call sites can switch codecs by swapping the constructor. +// +// The VP9 implementation scope covers Profile 0 (8-bit 4:2:0) and +// Profile 1 (8-bit 4:2:2, 4:4:0, 4:4:4, and sRGB) raw VP9 packets, +// including valid superframes. Profiles 2 and 3 (10/12-bit) return +// [ErrVP9NotImplemented] when their headers are otherwise valid. +type VP9DecoderOptions struct { + // Threads selects the decoder worker count. 0 and 1 use the serial path. + // Values >= 2 enable persistent VP9 tile-mode and loop-filter worker pools. + // Tile-mode workers are used only for frame-parallel, multi-tile frames with + // one tile row, so entropy-count adaptation and row dependencies remain in + // libvpx order. + Threads int + + // ByteAlignment mirrors libvpx VP9_SET_BYTE_ALIGNMENT. Zero keeps the + // decoder's legacy allocation behavior; non-zero values must be powers of + // two in [32, 1024] and align the visible Y/U/V plane starts. + ByteAlignment int + + // GetFrameBuffer and ReleaseFrameBuffer mirror libvpx's + // vpx_codec_set_frame_buffer_functions external frame-buffer API for VP9. + // Both callbacks must be set together, either in options or through + // SetFrameBufferFunctions before the decoder has initialized on a real + // stream. + GetFrameBuffer VP9GetFrameBufferFunc + ReleaseFrameBuffer VP9ReleaseFrameBufferFunc + + // SVCSpatialLayerSet enables libvpx-style VP9 spatial-SVC superframe + // filtering. When set, Decode decodes only frames 0..SVCSpatialLayer from a + // VP9 superframe, matching VP9_DECODE_SVC_SPATIAL_LAYER. Zero leaves + // superframes fully decoded. + SVCSpatialLayerSet bool + // SVCSpatialLayer is the highest VP9 spatial layer decoded from a + // superframe when SVCSpatialLayerSet is true. Valid values are 0..7. + SVCSpatialLayer uint8 + + // ErrorConcealment enables libvpx-style concealment for corrupt interframes + // after a clean frame has initialized references. + ErrorConcealment bool + // PostProcessFlags selects individual libvpx-style postprocess filters. + // Zero disables postprocessing. + PostProcessFlags PostProcessFlag + // PostProcessNoiseLevel enables libvpx-style additive luma noise when + // PostProcessAddNoise is set. Zero disables additive noise; valid range is + // [0, 16]. + PostProcessNoiseLevel int + + // MaxWidth and MaxHeight cap the accepted frame dimensions. + // Zero means no cap. + MaxWidth int + MaxHeight int + + // Decryptor, when non-nil, decrypts compressed VP9 packet bytes before + // superframe-index parsing, uncompressed-header parsing, compressed-header + // parsing, tile-size reads, and tile token parsing. Mirrors libvpx's + // VPXD_SET_DECRYPTOR control for VP9. govpx applies it once per Decode at + // packet entry, matching the existing VP8 decoder contract while keeping + // the VP9 parse/reconstruct hot path allocation-free after scratch growth. + // DecryptorState is passed back as the callback's first argument. + Decryptor VP9Decryptor + DecryptorState any + + // RejectResolutionChange, when true, makes Decode reject a coded + // frame whose dimensions differ from the active stream. + RejectResolutionChange bool + + // DecodeTileRowSet enables the libvpx VP9D_SET_DECODE_TILE_ROW + // reconstruction filter. When false (the default), every tile row is + // reconstructed. + DecodeTileRowSet bool + // DecodeTileRow is the active tile row when DecodeTileRowSet is true. + // Negative values clear the filter (matching libvpx's "less than zero" + // disable sentinel). Frames whose tile_rows are 1 always reconstruct + // every tile regardless of the filter. + DecodeTileRow int + // DecodeTileColSet enables the libvpx VP9D_SET_DECODE_TILE_COL + // reconstruction filter. When false (the default), every tile column is + // reconstructed. + DecodeTileColSet bool + // DecodeTileCol is the active tile column when DecodeTileColSet is true. + // Negative values clear the filter (matching libvpx's "less than zero" + // disable sentinel). Frames whose tile_cols are 1 always reconstruct + // every tile regardless of the filter. + DecodeTileCol int + + // DecoderRowMT mirrors libvpx VP9D_SET_ROW_MT. When true and Threads > 1, + // the decoder routes one-tile and multi-tile frames through the row-MT + // tile body, arming the per-SB-row wavefront sync plus source-shaped + // row-MT frame slabs / job queue scaffolding. The parse/recon/LPF row + // worker queue is wired incrementally; until then the tile body remains + // byte-identical to serial decode. Requires Threads > 1. + DecoderRowMT bool + + // DecoderLoopFilterOpt mirrors libvpx VP9D_SET_LOOP_FILTER_OPT. When true + // and Threads > 1, the deblock pass dispatches interleaved SB rows to the + // loop-filter worker pool under VP9LfSync, matching libvpx's row-based + // loop-filter optimisation. When false, the deblock pass runs serially + // even on a threaded decoder. Requires Threads > 1. + DecoderLoopFilterOpt bool + + // SkipLoopFilter mirrors libvpx VP9_SET_SKIP_LOOP_FILTER. When true, the + // decoder parses loop-filter syntax and reconstructs the frame normally but + // skips the in-loop deblock pass before publishing or refreshing references. + SkipLoopFilter bool + + // InvertTileDecodeOrder mirrors libvpx VP9_INVERT_TILE_DECODE_ORDER. When + // true, each tile row is reconstructed from the rightmost tile column back + // to the leftmost after the tile buffers have been parsed. + InvertTileDecodeOrder bool +} + +// VP9FrameInfo describes one decoded VP9 packet. Quantizer is the raw +// VP9 base qindex in [0, 255]; show-existing packets do not carry a +// quantizer and report zero. +type VP9FrameInfo struct { + // Width and Height are the coded luma dimensions. + Width int + Height int + // RenderWidth and RenderHeight are the display dimensions carried by + // VP9's render-size syntax and exposed by libvpx VP9D_GET_DISPLAY_SIZE. + RenderWidth int + RenderHeight int + // BitDepth is the VP9 bit depth reported by the uncompressed header. + BitDepth int + // Subsampling is the chroma subsampling layout of the decoded frame + // (Subsampling420 for Profile 0; Subsampling422, Subsampling440, or + // Subsampling444 for Profile 1). + Subsampling ChromaSubsampling + + // KeyFrame reports whether the packet is a key frame. + KeyFrame bool + // ShowFrame reports whether the packet produced visible output. + ShowFrame bool + // ShowExistingFrame reports whether the packet displayed a stored + // VP9 reference slot instead of carrying a frame body. + ShowExistingFrame bool + // ExistingFrameSlot is valid when ShowExistingFrame is true. + ExistingFrameSlot uint8 + + // Quantizer is the raw VP9 base qindex in [0, 255]. + Quantizer int + // RefreshFrameFlags is the VP9 reference-slot update bitmask. + RefreshFrameFlags uint8 + + // PTS is the caller-provided presentation timestamp. + PTS uint64 + // Corrupted reports that the frame was recovered through decoder error + // concealment instead of fully decoded from its packet. + Corrupted bool +} + +// ErrVP9NotImplemented is returned by VP9Decoder.Decode for valid VP9 +// packets outside the implemented Profile 0/1 reconstruction surface +// (e.g., 10/12-bit Profiles 2 and 3). +var ErrVP9NotImplemented = vpxerrors.ErrVP9NotImplemented + +// vp9DecoderState is the explicit lifecycle state of a VP9Decoder: +// +// ColdStart (zero frames decoded / Reset) --frame--> Active <--> FrameReady +// Any --Close()-> Closed (terminal) +type vp9PredictPlaneMode uint8 + +const ( + vp9PredictAllPlanes vp9PredictPlaneMode = iota + vp9PredictLumaOnly + vp9PredictChromaAll + vp9PredictChromaU + vp9PredictChromaV +) + +func (m vp9PredictPlaneMode) allowsPlane(plane int) bool { + switch m { + case vp9PredictLumaOnly: + return plane == 0 + case vp9PredictChromaAll: + return plane > 0 + case vp9PredictChromaU: + return plane == 1 + case vp9PredictChromaV: + return plane == 2 + default: + return true + } +} + +type vp9DecoderState uint8 + +const ( + vp9DecoderColdStart vp9DecoderState = iota + vp9DecoderActive + vp9DecoderFrameReady + vp9DecoderClosed +) + +// VP9Decoder is the public entry point for VP9 stream decoding. The +// internal/vp9 package carries the parser and DSP kernels; this type +// holds the per-frame context (FrameContext, SegmentationParams, +// LoopfilterParams, dequant tables) the parser needs across frames. +type VP9Decoder struct { + opts VP9DecoderOptions + + // Pointer-containing fields are grouped at the top of VP9Decoder so Go's + // GC only scans up to PtrBytes (the end of this group) and skips the ~40 KiB + // of pure value tables and scratch arrays placed below. + aboveSegCtx []int8 + leftSegCtx []int8 + miGrid []vp9dec.NeighborMi + miIdx []int32 + + segMap []uint8 + lastSegMap []uint8 + + planes [vp9dec.MaxMbPlane]vp9dec.MacroblockdPlane + + lastFrame Image + frameY []byte + frameU []byte + frameV []byte + frameYFull []byte + frameUFull []byte + frameVFull []byte + highbd *vp9DecoderHighBDState + frameExternal *vp9ExternalFrameLease + lastFrameExternal *vp9ExternalFrameLease + frameInternal *vp9InternalFrameLease + lastFrameInternal *vp9InternalFrameLease + internalFramePool [common.RefFrames + common.RefsPerFrame + 1]vp9InternalFrameLease + interPredictScratch []byte + vp9DecoderPhaseStatsOptions + refFrames [common.RefFrames]vp9ReferenceFrame + refFramesView *[common.RefFrames]vp9ReferenceFrame + prevFrameMvs []vp9dec.MvRef + curFrameMvs []vp9dec.MvRef + decryptedPacket []byte + + vp9LoopFilterPool *vp9DecoderLoopFilterPool + vp9TilePool *vp9DecoderTileWorkerPool + vp9TileDescs []vp9DecoderTileDesc + vp9LoopFilterMasks []vp9LoopFilterMask + + // rowMTSync is set on the per-tile-column decode worker when + // VP9D_SET_ROW_MT is active. parseVP9IntraModeTile and + // parseVP9InterModeTile call read / write against it so the wavefront + // primitive is fully exercised. Nil keeps the single-goroutine body + // byte-identical to libvpx. Mirrors the encoder's vp9RowMTSync field. + rowMTSync *vp9RowMTSync + fastCoefCtx vp9dec.FastCoefPlaneCtx + + postSource vp8common.FrameBuffer + post vp8common.FrameBuffer + postModes []vp8dec.MacroblockMode + postprocScratch []byte + postprocState vp8dec.PostProcessState + + // --- Pure value / pointer-free tail (beyond Go GC PtrBytes: 0 scan cost) --- + segMapMiRows int + segMapMiCols int + frameYOrigin int + frameUOrigin int + frameVOrigin int + prevFrameMvRows int + prevFrameMvCols int + usePrevFrameMvs bool + width int + height int + vp9LoopFilterMaskRows int + vp9LoopFilterMaskCols int + visibleFrames int + sfCacheNext int + sfCache [4]vp9ScaleFactorsEntry + lastInfo VP9FrameInfo + lifecycle vp9DecoderState + lastHeaderValid bool + unsupportedReconstruct bool + predictPlaneMode vp9PredictPlaneMode + segIDPredictedScratch uint8 + + lastHeader vp9dec.UncompressedHeader + lfi vp9dec.LoopFilterInfoN + dq vp9dec.DequantTables + dqcoeff [1024]int16 + coefTokenCache [1024]uint8 + coefProbsPacked vp9dec.PackedFrameCoefProbs + intraScratch vp9dec.IntraPredictorScratch + convolveScratch dsp.Convolve8Scratch + counts vp9dec.FrameCounts + frameContexts [common.FrameContexts]vp9dec.FrameContext + fc vp9dec.FrameContext +} + +type vp9DecoderHighBDState struct { + frameY16 []uint16 + frameU16 []uint16 + frameV16 []uint16 + frameY16Full []uint16 + frameU16Full []uint16 + frameV16Full []uint16 + dqcoeff32 []int32 + interPredictScratch16 []uint16 +} + +type vp9RefHighBDPlanes struct { + y16 []uint16 + u16 []uint16 + v16 []uint16 +} + +type vp9LeaseHighBDPlanes struct { + y16Full []uint16 + u16Full []uint16 + v16Full []uint16 + primedY16Len int + primedUV16Len int + primedBitDepth uint8 +} + +type vp9ReferenceFrame struct { + img Image + y []byte + u []byte + v []byte + highbd *vp9RefHighBDPlanes + external *vp9ExternalFrameLease + internal *vp9InternalFrameLease + yOrigin int32 + uOrigin int32 + vOrigin int32 + yBorder uint8 + uvBorderX uint8 + uvBorderY uint8 + valid bool + renderWidth int + renderHeight int + bitDepth int + generation uint64 +} + +type vp9ExternalFrameLease struct { + buffer VP9ExternalFrameBuffer + refs int + released bool +} + +type vp9InternalFrameLease struct { + yFull []byte + uFull []byte + vFull []byte + highbd *vp9LeaseHighBDPlanes + refs int + // primedYLen and primedUVLen track the Y/UV-plane lengths this lease + // was last primed (128-filled) for. Reconstruction plus border + // extension rewrite every byte of an in-layout frame, so pool buffers + // only need the libvpx-style neutral fill on first use or when the + // layout changes — not per frame. + primedYLen int + primedUVLen int +} + +func (f *vp9ReferenceFrame) store(src Image) { + f.storeWithRender(src, src.Width, src.Height) +} + +func (f *vp9ReferenceFrame) storeWithRender(src Image, renderWidth, renderHeight int) { + f.storeWithRenderAndBitDepth(src, renderWidth, renderHeight, int(vp9dec.Bits8)) +} + +func (f *vp9ReferenceFrame) storeWithRenderAndBitDepth(src Image, + renderWidth, renderHeight, bitDepth int, +) { + if src.BitDepth > 8 { + if f.highbd == nil { + f.highbd = &vp9RefHighBDPlanes{} + } + hb := f.highbd + hb.y16 = buffers.EnsureLen(hb.y16, len(src.Y16)) + hb.u16 = buffers.EnsureLen(hb.u16, len(src.U16)) + hb.v16 = buffers.EnsureLen(hb.v16, len(src.V16)) + copy(hb.y16, src.Y16) + copy(hb.u16, src.U16) + copy(hb.v16, src.V16) + f.img = Image{ + Width: src.Width, + Height: src.Height, + Y16: hb.y16, + U16: hb.u16, + V16: hb.v16, + YStride: src.YStride, + UStride: src.UStride, + VStride: src.VStride, + Subsampling: src.Subsampling, + BitDepth: src.BitDepth, + } + } else { + f.y = buffers.EnsureCapacity(f.y, len(src.Y)) + f.u = buffers.EnsureCapacity(f.u, len(src.U)) + f.v = buffers.EnsureCapacity(f.v, len(src.V)) + copy(f.y, src.Y) + copy(f.u, src.U) + copy(f.v, src.V) + f.img = Image{ + Width: src.Width, + Height: src.Height, + Y: f.y, + U: f.u, + V: f.v, + YStride: src.YStride, + UStride: src.UStride, + VStride: src.VStride, + Subsampling: src.Subsampling, + BitDepth: src.BitDepth, + } + } + f.yOrigin = 0 + f.uOrigin = 0 + f.vOrigin = 0 + f.yBorder = 0 + f.uvBorderX = 0 + f.uvBorderY = 0 + f.renderWidth = renderWidth + f.renderHeight = renderHeight + f.bitDepth = bitDepth + f.external = nil + f.internal = nil + f.generation++ + f.valid = true +} + +func (f *vp9ReferenceFrame) storeExternalWithRenderAndBitDepth(src Image, + lease *vp9ExternalFrameLease, renderWidth, renderHeight, bitDepth int, +) { + f.img = Image{ + Width: src.Width, + Height: src.Height, + Y: src.Y, + U: src.U, + V: src.V, + Y16: src.Y16, + U16: src.U16, + V16: src.V16, + YStride: src.YStride, + UStride: src.UStride, + VStride: src.VStride, + Subsampling: src.Subsampling, + BitDepth: src.BitDepth, + } + f.yOrigin = 0 + f.uOrigin = 0 + f.vOrigin = 0 + f.yBorder = 0 + f.uvBorderX = 0 + f.uvBorderY = 0 + f.renderWidth = renderWidth + f.renderHeight = renderHeight + f.bitDepth = bitDepth + f.external = lease + f.internal = nil + f.generation++ + f.valid = true +} + +func (f *vp9ReferenceFrame) storeInternalWithRenderAndBitDepth(src Image, + lease *vp9InternalFrameLease, renderWidth, renderHeight, bitDepth int, + yOrigin, uOrigin, vOrigin, yBorder, uvBorderX, uvBorderY int, +) { + f.img = Image{ + Width: src.Width, + Height: src.Height, + Y: src.Y, + U: src.U, + V: src.V, + Y16: src.Y16, + U16: src.U16, + V16: src.V16, + YStride: src.YStride, + UStride: src.UStride, + VStride: src.VStride, + Subsampling: src.Subsampling, + BitDepth: src.BitDepth, + } + f.yOrigin = int32(yOrigin) + f.uOrigin = int32(uOrigin) + f.vOrigin = int32(vOrigin) + f.yBorder = uint8(yBorder) + f.uvBorderX = uint8(uvBorderX) + f.uvBorderY = uint8(uvBorderY) + f.renderWidth = renderWidth + f.renderHeight = renderHeight + f.bitDepth = bitDepth + f.external = nil + f.internal = lease + f.generation++ + f.valid = true +} + +func (f *vp9ReferenceFrame) renderSize() (int, int) { + if f.renderWidth > 0 && f.renderHeight > 0 { + return f.renderWidth, f.renderHeight + } + return f.img.Width, f.img.Height +} + +func (f *vp9ReferenceFrame) bitDepthValue() int { + if f.bitDepth > 0 { + return f.bitDepth + } + return int(vp9dec.Bits8) +} + +// NewVP9Decoder creates a VP9 decoder with validated options. The +// zero value of opts is valid: it produces a single-threaded decoder +// with no dimension caps. +func (d *VP9Decoder) isClosed() bool { + return d == nil || d.lifecycle == vp9DecoderClosed +} + +func (d *VP9Decoder) isActive() bool { + return d != nil && (d.lifecycle == vp9DecoderActive || d.lifecycle == vp9DecoderFrameReady) +} + +func NewVP9Decoder(opts VP9DecoderOptions) (*VP9Decoder, error) { + if err := validateVP9DecoderOptions(opts); err != nil { + return nil, err + } + if opts.DecodeTileRowSet && opts.DecodeTileRow < 0 { + opts.DecodeTileRowSet = false + opts.DecodeTileRow = 0 + } + if opts.DecodeTileColSet && opts.DecodeTileCol < 0 { + opts.DecodeTileColSet = false + opts.DecodeTileCol = 0 + } + d := &VP9Decoder{opts: opts} + d.resetVP9FrameContexts() + d.lfi = vp9dec.NewLoopFilterInfoN() + vp9dec.LoopFilterInit(&d.lfi, 0) + if opts.Threads > 1 { + d.vp9LoopFilterPool = newVP9DecoderLoopFilterPool(opts.Threads) + d.vp9TilePool = newVP9DecoderTileWorkerPool(opts.Threads) + if opts.DecoderRowMT && d.vp9TilePool != nil { + d.vp9TilePool.armRowMT() + } + } + return d, nil +} + +func validateVP9DecoderOptions(opts VP9DecoderOptions) error { + if opts.Threads < 0 { + return ErrInvalidConfig + } + if err := validateVP9ByteAlignment(opts.ByteAlignment); err != nil { + return err + } + if (opts.GetFrameBuffer == nil) != (opts.ReleaseFrameBuffer == nil) { + return ErrInvalidConfig + } + if opts.SVCSpatialLayerSet && opts.SVCSpatialLayer >= VP9RTPMaxSpatialLayers { + return ErrInvalidConfig + } + if opts.PostProcessFlags&^allPostProcessFlags != 0 { + return ErrInvalidConfig + } + if uint(opts.PostProcessNoiseLevel) > 16 { + return ErrInvalidConfig + } + if opts.PostProcessNoiseLevel > 0 && + opts.effectivePostProcessFlags()&PostProcessAddNoise == 0 { + return ErrInvalidConfig + } + if opts.MaxWidth < 0 || opts.MaxHeight < 0 { + return ErrInvalidConfig + } + if err := validateVP9DecodeTileFilter(opts.DecodeTileRowSet, + opts.DecodeTileRow); err != nil { + return err + } + if err := validateVP9DecodeTileFilter(opts.DecodeTileColSet, + opts.DecodeTileCol); err != nil { + return err + } + if (opts.DecoderRowMT || opts.DecoderLoopFilterOpt) && opts.Threads <= 1 { + return ErrInvalidConfig + } + return nil +} + +// validateVP9DecodeTileFilter mirrors libvpx's tile-decode control range: +// values must fit in [-1, vp9MaxTileLog2Bound] so the filter cannot exceed +// the maximum tile dimension permitted by the bitstream syntax. +func validateVP9DecodeTileFilter(set bool, value int) error { + if !set { + return nil + } + if value < -1 || value > vp9DecoderMaxTileFilter { + return ErrInvalidConfig + } + return nil +} + +// vp9DecoderMaxTileFilter caps DecodeTileRow/DecodeTileCol at the largest +// per-frame tile dimension libvpx can emit. VP9's log2 tile fields are +// 2 bits for rows (1<<3-1 = 7 is the spec ceiling) and up to 6 for columns +// (1<<6-1 = 63). Use the spec ceiling so the setter rejects clearly +// out-of-range values without locking out future expansions. +const vp9DecoderMaxTileFilter = 63 + +func validateVP9ByteAlignment(alignment int) error { + if alignment == 0 { + return nil + } + if alignment < 32 || alignment > 1024 || alignment&(alignment-1) != 0 { + return ErrInvalidConfig + } + return nil +} + +func (opts VP9DecoderOptions) effectivePostProcessFlags() PostProcessFlag { + return opts.PostProcessFlags +} + +func (opts VP9DecoderOptions) effectiveErrorConcealment() bool { + return opts.ErrorConcealment +} + +func (d *VP9Decoder) decryptVP9Packet(packet []byte) []byte { + if d.opts.Decryptor == nil || len(packet) == 0 { + return packet + } + d.decryptedPacket = buffers.EnsureLen(d.decryptedPacket, len(packet)) + d.opts.Decryptor(d.opts.DecryptorState, packet, d.decryptedPacket, len(packet)) + return d.decryptedPacket +} + +// SetSVCSpatialLayer enables libvpx-style VP9 spatial-SVC superframe +// filtering. Subsequent Decode calls decode only frames 0..layer from a VP9 +// superframe, matching VP9_DECODE_SVC_SPATIAL_LAYER. +func (d *VP9Decoder) SetSVCSpatialLayer(layer uint8) error { + if d.isClosed() { + return ErrClosed + } + if layer >= VP9RTPMaxSpatialLayers { + return ErrInvalidConfig + } + d.opts.SVCSpatialLayerSet = true + d.opts.SVCSpatialLayer = layer + return nil +} + +// ClearSVCSpatialLayer disables VP9 spatial-SVC superframe filtering so +// subsequent Decode calls decode every frame listed in a VP9 superframe. +func (d *VP9Decoder) ClearSVCSpatialLayer() error { + if d.isClosed() { + return ErrClosed + } + d.opts.SVCSpatialLayerSet = false + d.opts.SVCSpatialLayer = 0 + return nil +} + +// SetDecodeTileRow mirrors libvpx's VP9D_SET_DECODE_TILE_ROW control. +// Subsequent Decode calls only reconstruct the tile at the configured row +// (combined with the DecodeTileCol filter). Values < 0 clear the filter so +// the decoder reconstructs every tile row. +func (d *VP9Decoder) SetDecodeTileRow(row int) error { + if d.isClosed() { + return ErrClosed + } + if row > vp9DecoderMaxTileFilter { + return ErrInvalidConfig + } + if row < 0 { + d.opts.DecodeTileRowSet = false + d.opts.DecodeTileRow = 0 + return nil + } + d.opts.DecodeTileRowSet = true + d.opts.DecodeTileRow = row + return nil +} + +// SetDecodeTileCol mirrors libvpx's VP9D_SET_DECODE_TILE_COL control. +// Subsequent Decode calls only reconstruct the tile at the configured +// column (combined with the DecodeTileRow filter). Values < 0 clear the +// filter so the decoder reconstructs every tile column. +func (d *VP9Decoder) SetDecodeTileCol(col int) error { + if d.isClosed() { + return ErrClosed + } + if col > vp9DecoderMaxTileFilter { + return ErrInvalidConfig + } + if col < 0 { + d.opts.DecodeTileColSet = false + d.opts.DecodeTileCol = 0 + return nil + } + d.opts.DecodeTileColSet = true + d.opts.DecodeTileCol = col + return nil +} + +// vp9TileFilterMasksTile reports whether the configured DecodeTileRow / +// DecodeTileCol filter would mask the given (row, col) for a frame whose +// tile grid has tileRows × tileCols tiles. Returns true only when at least +// one filter is set, the frame has multiple tiles in the filtered axis, +// and the candidate tile falls outside the requested selection. +func (d *VP9Decoder) vp9TileFilterMasksTile(row, col, tileRows, tileCols int) bool { + if d == nil { + return false + } + if d.opts.DecodeTileRowSet && tileRows > 1 && row != d.opts.DecodeTileRow { + return true + } + if d.opts.DecodeTileColSet && tileCols > 1 && col != d.opts.DecodeTileCol { + return true + } + return false +} + +// vp9TileFilterActive reports whether either of the per-tile decode +// filters has been configured. +func (d *VP9Decoder) vp9TileFilterActive() bool { + if d == nil { + return false + } + return d.opts.DecodeTileRowSet || d.opts.DecodeTileColSet +} + +// SetRowMT mirrors libvpx VP9D_SET_ROW_MT. When enabled, the tile-column +// decode body arms a per-SB-row wavefront sync primitive so future per-row +// workers can be slotted in. Requires the decoder to have been constructed +// with Threads > 1; otherwise ErrInvalidConfig is returned. +func (d *VP9Decoder) SetRowMT(enabled bool) error { + if d.isClosed() { + return ErrClosed + } + if enabled && d.opts.Threads <= 1 { + return ErrInvalidConfig + } + d.opts.DecoderRowMT = enabled + if d.vp9TilePool != nil { + if enabled { + d.vp9TilePool.armRowMT() + } else { + d.vp9TilePool.releaseRowMTSync() + } + } + return nil +} + +// SetLoopFilterOpt mirrors libvpx VP9D_SET_LOOP_FILTER_OPT. When enabled, the +// deblock pass dispatches interleaved SB rows to the loop-filter worker pool +// under VP9LfSync, matching libvpx's row-based loop-filter optimisation. When +// disabled the deblock pass runs serially even on a threaded decoder. Requires +// the decoder to have been constructed with Threads > 1; otherwise +// ErrInvalidConfig is returned. +func (d *VP9Decoder) SetLoopFilterOpt(enabled bool) error { + if d.isClosed() { + return ErrClosed + } + if enabled && d.opts.Threads <= 1 { + return ErrInvalidConfig + } + d.opts.DecoderLoopFilterOpt = enabled + return nil +} + +// SetSkipLoopFilter mirrors libvpx VP9_SET_SKIP_LOOP_FILTER. When enabled, +// subsequent frames skip the in-loop deblock pass even if their headers carry a +// non-zero loop-filter level. +func (d *VP9Decoder) SetSkipLoopFilter(enabled bool) error { + if d.isClosed() { + return ErrClosed + } + d.opts.SkipLoopFilter = enabled + return nil +} + +// SetInvertTileDecodeOrder mirrors libvpx VP9_INVERT_TILE_DECODE_ORDER. When +// enabled, subsequent multi-tile frames process each tile row from the rightmost +// tile column to the leftmost tile column. +func (d *VP9Decoder) SetInvertTileDecodeOrder(enabled bool) error { + if d.isClosed() { + return ErrClosed + } + d.opts.InvertTileDecodeOrder = enabled + return nil +} + +// SetByteAlignment mirrors libvpx VP9_SET_BYTE_ALIGNMENT. A value of zero +// keeps the decoder's legacy allocation behavior; non-zero values must be +// powers of two in [32, 1024] and apply to subsequently prepared output +// frames. +func (d *VP9Decoder) SetByteAlignment(alignment int) error { + if d.isClosed() { + return ErrClosed + } + if err := validateVP9ByteAlignment(alignment); err != nil { + return err + } + d.opts.ByteAlignment = alignment + return nil +} + +// SetFrameBufferFunctions mirrors libvpx's +// vpx_codec_set_frame_buffer_functions for VP9. Both callbacks must be +// non-nil, and the control must be applied before the decoder initializes on a +// stream. Call Reset to return the decoder to a cold-start state before +// replacing callbacks. +func (d *VP9Decoder) SetFrameBufferFunctions(get VP9GetFrameBufferFunc, + release VP9ReleaseFrameBufferFunc, +) error { + if d.isClosed() { + return ErrClosed + } + if get == nil || release == nil { + return ErrInvalidConfig + } + if d.vp9FrameBufferCallbacksLocked() { + return ErrInvalidConfig + } + d.opts.GetFrameBuffer = get + d.opts.ReleaseFrameBuffer = release + return nil +} + +func (d *VP9Decoder) vp9FrameBufferCallbacksLocked() bool { + if d == nil { + return true + } + return d.lifecycle != vp9DecoderColdStart || d.lastHeaderValid || + d.width != 0 || d.height != 0 || d.visibleFrames != 0 +} + +// Decode is the VP9 entry point. It is equivalent to DecodeWithPTS +// with a zero presentation timestamp. +func (d *VP9Decoder) Decode(packet []byte) error { + return d.DecodeWithPTS(packet, 0) +} + +// DecodeWithPTS decodes one raw VP9 packet payload in the profile 0 scope. +// Packets with a valid VP9 superframe index are split and decoded in order. +// The uncompressed and compressed headers plus tile mode-info/residual tokens +// are parsed and validated; malformed frames surface as [ErrInvalidVP9Data]. +// Supported profile 0 frames decode to I420 output. Valid packets outside +// profile 0 return [ErrVP9NotImplemented]. pts is echoed back through +// [VP9Decoder.LastFrameInfo]. +// +// Side effects on a successful parse: the decoder's stored frame +// dimensions, loopfilter state, segmentation state, mode-info buffers, +// reference slots, and last-frame metadata are updated. +func (d *VP9Decoder) DecodeWithPTS(packet []byte, pts uint64) error { + if d.isClosed() { + return ErrClosed + } + packet = d.decryptVP9Packet(packet) + return d.decodeVP9PacketWithPTS(packet, pts) +} + +func (d *VP9Decoder) decodeVP9PacketWithPTS(packet []byte, pts uint64) error { + sf, err := bitstream.ParseSuperframe(packet) + if err != nil { + if len(packet) == 0 && d.opts.effectiveErrorConcealment() && + d.canConcealVP9Frame() { + return d.concealVP9Frame(nil, VP9FrameInfo{ + ShowFrame: true, + PTS: pts, + }, pts) + } + return err + } + if sf.Count == 0 { + return d.decodeVP9FrameWithPTS(packet, pts) + } + frameCount := d.vp9SVCFrameCount(sf.Count) + for i := range frameCount { + if err := d.decodeVP9FrameWithPTS(sf.Frames[i], pts); err != nil { + return err + } + } + return nil +} + +func (d *VP9Decoder) vp9SVCFrameCount(frameCount int) int { + if !d.opts.SVCSpatialLayerSet { + return frameCount + } + limit := int(d.opts.SVCSpatialLayer) + 1 + if limit < frameCount { + return limit + } + return frameCount +} + +func (d *VP9Decoder) decodeVP9FrameWithPTS(packet []byte, pts uint64) error { + err := d.decodeVP9FrameWithPTSStrict(packet, pts) + if err == nil { + return nil + } + if errors.Is(err, ErrVP9NotImplemented) || errors.Is(err, ErrFrameRejected) || + !d.opts.effectiveErrorConcealment() || !d.canConcealVP9Frame() { + return err + } + hdr, uncSize, err := d.readVP9UncompressedHeader(packet) + if err != nil { + if len(packet) == 0 { + return d.concealVP9Frame(nil, VP9FrameInfo{ + ShowFrame: true, + PTS: pts, + }, pts) + } + return err + } + info, infoErr := d.vp9FrameInfoFromHeader(&hdr, pts) + if infoErr != nil || hdr.FrameType == common.KeyFrame || hdr.IntraOnly || + hdr.ShowExistingFrame { + if infoErr != nil { + return infoErr + } + return err + } + if uncSize > len(packet) { + return err + } + return d.concealVP9Frame(&hdr, info, pts) +} + +func (d *VP9Decoder) decodeVP9FrameWithPTSStrict(packet []byte, pts uint64) (retErr error) { + defer func() { + if retErr != nil { + d.releaseVP9ActiveExternalFrame() + d.releaseVP9ActiveInternalFrame() + } + }() + hdr, uncSize, err := d.readVP9UncompressedHeader(packet) + if err != nil { + return err + } + info, err := d.vp9FrameInfoFromHeader(&hdr, pts) + if err != nil { + return err + } + + if hdr.ShowExistingFrame { + if err := d.decodeVP9ShowExistingFrame(&hdr); err != nil { + return err + } + output, err := d.outputVP9FrameImage(&hdr, info, d.lastFrame) + if err != nil { + return err + } + d.lastFrame = output + if d.opts.effectivePostProcessFlags() != 0 { + d.replaceVP9LastFrameExternal(nil) + if !d.transferVP9ActiveFrameToLastIfAliased(output) { + d.replaceVP9LastFrameInternal(nil) + } + } + d.finishVP9FrameInfo(info, true) + return nil + } + + compEnd := uncSize + int(hdr.FirstPartitionSize) + if compEnd > len(packet) { + return ErrInvalidVP9Data + } + if !vp9dec.SupportedOutputFormat(&hdr) { + d.lastHeader = hdr + d.lastHeaderValid = true + d.width = int(hdr.Width) + d.height = int(hdr.Height) + d.finishVP9FrameInfo(info, false) + return ErrVP9NotImplemented + } + + frameContextIdx := d.prepareVP9FrameContext(&hdr) + if !hdr.FrameParallelDecoding { + d.counts = vp9dec.FrameCounts{} + } + var cr bitstream.Reader + if err := cr.Init(packet[uncSize:compEnd]); err != nil { + return ErrInvalidVP9Data + } + compHeader := vp9dec.ReadCompressedHeader(&cr, &d.fc, vp9dec.ReadCompressedHeaderArgs{ + Lossless: hdr.Quant.Lossless, + IntraOnly: hdr.IntraOnly, + KeyFrame: hdr.FrameType == common.KeyFrame, + InterpFilter: hdr.InterpFilter, + AllowHighPrecisionMv: hdr.AllowHighPrecisionMv, + CompoundRefAllowed: vp9dec.CompoundReferenceAllowedForHeader(&hdr), + }) + if cr.HasError() { + return ErrInvalidVP9Data + } + + vp9dec.SetupSegmentationDequant(&hdr.Seg, vp9dec.SetupSegmentationDequantArgs{ + BaseQindex: int(hdr.Quant.BaseQindex), + YDcDeltaQ: int(hdr.Quant.YDcDeltaQ), + UvDcDeltaQ: int(hdr.Quant.UvDcDeltaQ), + UvAcDeltaQ: int(hdr.Quant.UvAcDeltaQ), + BitDepth: vp9dec.BitDepth(hdr.BitDepthColor.BitDepth), + }, &d.dq) + vp9dec.LoopFilterFrameInit(&d.lfi, &hdr.Loopfilter, &hdr.Seg, + int(hdr.Loopfilter.FilterLevel)) + if d.vp9TilePool != nil { + d.vp9TilePool.rowMTFrame.markIdle() + } + + d.unsupportedReconstruct = false + if hdr.FrameType == common.KeyFrame || hdr.IntraOnly { + if err := d.prepareVP9OutputFrameFormat(int(hdr.Width), int(hdr.Height), + hdr.BitDepthColor.SubsamplingX, hdr.BitDepthColor.SubsamplingY, + hdr.BitDepthColor.BitDepth); err != nil { + return err + } + if hdr.FrameParallelDecoding { + vp9dec.PackFrameCoefProbs(&d.coefProbsPacked, &d.fc.CoefProbs) + } + if err := d.parseVP9IntraModeTiles(packet[compEnd:], &hdr, compHeader); err != nil { + return err + } + } else { + if err := d.prepareVP9OutputFrameFormat(int(hdr.Width), int(hdr.Height), + hdr.BitDepthColor.SubsamplingX, hdr.BitDepthColor.SubsamplingY, + hdr.BitDepthColor.BitDepth); err != nil { + return err + } + d.prepareVP9CurrentFrameMvs(&hdr) + vp9dec.PackFrameCoefProbs(&d.coefProbsPacked, &d.fc.CoefProbs) + d.fastCoefCtx.IsInter = 1 + d.fastCoefCtx.FC = &d.fc.CoefProbs + d.fastCoefCtx.DQCoeff = &d.dqcoeff + d.fastCoefCtx.TokenCache = &d.coefTokenCache + if err := d.parseVP9InterModeTiles(packet[compEnd:], &hdr, compHeader); err != nil { + return err + } + } + if !d.unsupportedReconstruct && hdr.Loopfilter.FilterLevel != 0 && + !d.opts.SkipLoopFilter && !d.vp9DecoderRowMTLoopFilterApplied() { + if !d.applyVP9LoopFilter(&hdr) { + d.markVP9Unsupported() + } + } + d.adaptVP9FrameContext(&hdr, compHeader, frameContextIdx) + d.commitVP9FrameContext(&hdr, frameContextIdx) + + d.lastHeader = hdr + d.lastHeaderValid = true + d.width = int(hdr.Width) + d.height = int(hdr.Height) + d.finishVP9CurrentFrameMvs(&hdr) + if d.vp9CanPublishReconstructedFrame(&hdr) { + d.refreshVP9ReferenceFrames(&hdr) + ready := false + if hdr.ShowFrame { + output, err := d.outputVP9FrameImage(&hdr, info, d.lastFrame) + if err != nil { + return err + } + d.lastFrame = output + ready = true + if d.opts.effectivePostProcessFlags() == 0 && d.frameExternal != nil { + d.replaceVP9LastFrameExternal(d.frameExternal) + d.frameExternal = nil + } else { + d.releaseVP9ActiveExternalFrame() + d.replaceVP9LastFrameExternal(nil) + } + if !d.transferVP9ActiveFrameToLastIfAliased(output) { + d.releaseVP9ActiveInternalFrame() + d.replaceVP9LastFrameInternal(nil) + } + } else { + d.releaseVP9ActiveExternalFrame() + d.releaseVP9ActiveInternalFrame() + } + d.finishVP9FrameInfo(info, ready) + return nil + } + if d.lifecycle == vp9DecoderFrameReady { + d.lifecycle = vp9DecoderActive + } + return ErrVP9NotImplemented +} + +// DecodeInto decodes one raw VP9 Profile 0 packet payload. If the packet is a +// visible frame its decoded pixels are written into the caller-owned +// planes of dst; for hidden frames dst is left untouched. +func (d *VP9Decoder) DecodeInto(packet []byte, dst *Image) (VP9FrameInfo, error) { + return d.DecodeIntoWithPTS(packet, dst, 0) +} + +// DecodeIntoWithPTS is DecodeInto with an explicit presentation timestamp. +// pts is echoed back in the returned VP9FrameInfo. +func (d *VP9Decoder) DecodeIntoWithPTS(packet []byte, dst *Image, pts uint64) (VP9FrameInfo, error) { + if d.isClosed() { + return VP9FrameInfo{}, ErrClosed + } + if dst == nil { + return VP9FrameInfo{}, ErrInvalidConfig + } + packet = d.decryptVP9Packet(packet) + sf, err := bitstream.ParseSuperframe(packet) + if err != nil { + if len(packet) == 0 && d.opts.effectiveErrorConcealment() && + d.canConcealVP9Frame() { + if err := d.concealVP9Frame(nil, VP9FrameInfo{ + ShowFrame: true, + PTS: pts, + }, pts); err != nil { + return VP9FrameInfo{}, err + } + info := d.lastInfo + if info.ShowFrame { + if dst.Subsampling != info.Subsampling || + int(dst.EffectiveBitDepth()) != info.BitDepth || + !dst.ValidForEncode(info.Width, info.Height) { + return VP9FrameInfo{}, ErrInvalidConfig + } + copyVP9ImageToPublic(dst, d.lastFrame) + } + return info, nil + } + return VP9FrameInfo{}, err + } + if sf.Count != 0 { + frameCount := d.vp9SVCFrameCount(sf.Count) + for i := range frameCount { + if err := d.decodeVP9FrameWithPTS(sf.Frames[i], pts); err != nil { + return VP9FrameInfo{}, err + } + } + info := d.lastInfo + if !d.isActive() { + return VP9FrameInfo{}, ErrInvalidVP9Data + } + d.lifecycle = vp9DecoderActive + if info.ShowFrame { + if dst.Subsampling != info.Subsampling || + int(dst.EffectiveBitDepth()) != info.BitDepth || + !dst.ValidForEncode(info.Width, info.Height) { + return VP9FrameInfo{}, ErrInvalidConfig + } + copyVP9ImageToPublic(dst, d.lastFrame) + } + return info, nil + } + hdr, _, err := d.readVP9UncompressedHeader(packet) + if err != nil { + return VP9FrameInfo{}, err + } + info, err := d.vp9FrameInfoFromHeader(&hdr, pts) + if err != nil { + return VP9FrameInfo{}, err + } + if dst.Subsampling != info.Subsampling || + int(dst.EffectiveBitDepth()) != info.BitDepth || + !dst.ValidForEncode(info.Width, info.Height) { + return VP9FrameInfo{}, ErrInvalidConfig + } + if err := d.decodeVP9PacketWithPTS(packet, pts); err != nil { + return VP9FrameInfo{}, err + } + if d.isActive() { + info = d.lastInfo + d.lifecycle = vp9DecoderActive + } + if info.ShowFrame { + copyVP9ImageToPublic(dst, d.lastFrame) + } + return info, nil +} + +func (d *VP9Decoder) readVP9UncompressedHeader(packet []byte) (vp9dec.UncompressedHeader, int, error) { + if len(packet) == 0 { + return vp9dec.UncompressedHeader{}, 0, ErrInvalidVP9Data + } + var br vp9dec.BitReader + br.Init(packet) + var prev *vp9dec.UncompressedHeader + if d.lastHeaderValid { + prev = &d.lastHeader + } + hdr, err := vp9dec.ReadUncompressedHeader(&br, prev, d.refDims) + if err != nil { + return vp9dec.UncompressedHeader{}, 0, ErrInvalidVP9Data + } + if hdr.ShowExistingFrame { + return hdr, br.BytesRead(), nil + } + if hdr.Width == 0 || hdr.Height == 0 { + return vp9dec.UncompressedHeader{}, 0, ErrInvalidVP9Data + } + if d.opts.MaxWidth > 0 && int(hdr.Width) > d.opts.MaxWidth { + return vp9dec.UncompressedHeader{}, 0, ErrFrameRejected + } + if d.opts.MaxHeight > 0 && int(hdr.Height) > d.opts.MaxHeight { + return vp9dec.UncompressedHeader{}, 0, ErrFrameRejected + } + if d.isActive() && d.opts.RejectResolutionChange && + (int(hdr.Width) != d.width || int(hdr.Height) != d.height) { + return vp9dec.UncompressedHeader{}, 0, ErrFrameRejected + } + return hdr, br.BytesRead(), nil +} + +func (d *VP9Decoder) vp9FrameInfoFromHeader(hdr *vp9dec.UncompressedHeader, pts uint64) (VP9FrameInfo, error) { + info := VP9FrameInfo{ + KeyFrame: !hdr.ShowExistingFrame && hdr.FrameType == common.KeyFrame, + ShowFrame: hdr.ShowFrame, + ShowExistingFrame: hdr.ShowExistingFrame, + ExistingFrameSlot: hdr.ExistingFrameSlot, + Quantizer: int(hdr.Quant.BaseQindex), + RefreshFrameFlags: hdr.RefreshFrameFlags, + PTS: pts, + } + if hdr.ShowExistingFrame { + slot := int(hdr.ExistingFrameSlot) + if slot >= len(d.refFrames) || !d.refFrames[slot].valid { + return VP9FrameInfo{}, ErrInvalidVP9Data + } + ref := &d.refFrames[slot].img + info.Width = ref.Width + info.Height = ref.Height + info.RenderWidth, info.RenderHeight = d.refFrames[slot].renderSize() + info.BitDepth = d.refFrames[slot].bitDepthValue() + info.Subsampling = ref.Subsampling + info.ShowFrame = true + return info, nil + } + info.Width = int(hdr.Width) + info.Height = int(hdr.Height) + info.RenderWidth, info.RenderHeight = vp9dec.HeaderRenderSize(hdr) + info.BitDepth = int(hdr.BitDepthColor.BitDepth) + info.Subsampling = codecapi.ChromaSubsamplingFromShifts( + hdr.BitDepthColor.SubsamplingX, hdr.BitDepthColor.SubsamplingY) + return info, nil +} + +func (d *VP9Decoder) finishVP9FrameInfo(info VP9FrameInfo, frameReady bool) { + d.lastInfo = info + if frameReady { + d.lifecycle = vp9DecoderFrameReady + } else { + d.lifecycle = vp9DecoderActive + } + if info.ShowFrame { + d.visibleFrames++ + } +} + +func (d *VP9Decoder) resetVP9FrameContexts() { + for i := range d.frameContexts { + vp9dec.ResetFrameContext(&d.frameContexts[i]) + } + d.fc = d.frameContexts[0] +} + +func (d *VP9Decoder) prepareVP9FrameContext(hdr *vp9dec.UncompressedHeader) int { + idx := int(hdr.FrameContextIdx) + if idx >= common.FrameContexts { + idx = 0 + } + if hdr.FrameType == common.KeyFrame || + hdr.ErrorResilientMode || hdr.ResetFrameContext == 3 { + d.resetVP9FrameContexts() + idx = 0 + } else if hdr.IntraOnly && hdr.ResetFrameContext == 2 { + vp9dec.ResetFrameContext(&d.frameContexts[idx]) + idx = 0 + } else if hdr.IntraOnly { + idx = 0 + } else if hdr.ResetFrameContext == 2 { + vp9dec.ResetFrameContext(&d.frameContexts[idx]) + } + d.fc = d.frameContexts[idx] + return idx +} + +func (d *VP9Decoder) commitVP9FrameContext(hdr *vp9dec.UncompressedHeader, idx int) { + if idx < 0 || idx >= common.FrameContexts || !hdr.RefreshFrameContext { + return + } + d.frameContexts[idx] = d.fc +} + +func (d *VP9Decoder) vp9CanPublishReconstructedFrame(hdr *vp9dec.UncompressedHeader) bool { + if hdr.ShowExistingFrame || d.unsupportedReconstruct { + return false + } + return vp9dec.SupportedOutputFormat(hdr) +} + +func (d *VP9Decoder) decodeVP9ShowExistingFrame(hdr *vp9dec.UncompressedHeader) error { + slot := int(hdr.ExistingFrameSlot) + if slot >= len(d.refFrames) || !d.refFrames[slot].valid { + return ErrInvalidVP9Data + } + ref := &d.refFrames[slot] + if err := d.publishVP9ReferenceFrame(ref); err != nil { + return err + } + d.width = ref.img.Width + d.height = ref.img.Height + return nil +} + +func (d *VP9Decoder) canConcealVP9Frame() bool { + if !d.isActive() || d.width <= 0 || d.height <= 0 { + return false + } + for i := range d.refFrames { + if d.refFrames[i].valid { + return true + } + } + return false +} + +func (d *VP9Decoder) concealVP9Frame(hdr *vp9dec.UncompressedHeader, + info VP9FrameInfo, pts uint64, +) error { + ref := d.vp9ConcealmentReference(hdr) + if ref == nil { + return ErrInvalidVP9Data + } + info.Width = ref.img.Width + info.Height = ref.img.Height + info.RenderWidth, info.RenderHeight = ref.renderSize() + info.BitDepth = ref.bitDepthValue() + info.Subsampling = ref.img.Subsampling + info.KeyFrame = false + info.ShowFrame = true + info.ShowExistingFrame = false + info.ExistingFrameSlot = 0 + info.PTS = pts + info.Corrupted = true + if err := d.publishVP9ReferenceFrame(ref); err != nil { + return err + } + output, err := d.outputVP9FrameImage(hdr, info, d.lastFrame) + if err != nil { + return err + } + d.lastFrame = output + if d.opts.effectivePostProcessFlags() != 0 { + d.replaceVP9LastFrameExternal(nil) + if !d.transferVP9ActiveFrameToLastIfAliased(output) { + d.replaceVP9LastFrameInternal(nil) + } + } + d.width = ref.img.Width + d.height = ref.img.Height + d.finishVP9FrameInfo(info, true) + return nil +} + +func (d *VP9Decoder) publishVP9ReferenceFrame(ref *vp9ReferenceFrame) error { + if ref == nil { + return ErrInvalidVP9Data + } + if d.opts.ByteAlignment == 0 || + vp9ImagePlanesAligned(ref.img, d.opts.ByteAlignment) { + d.lastFrame = ref.img + d.retainVP9LastFrameExternal(ref.external) + d.retainVP9LastFrameInternal(ref.internal) + return nil + } + output, err := d.alignVP9PublishedFrame(ref.img) + if err != nil { + return err + } + d.lastFrame = output + d.replaceVP9LastFrameExternal(nil) + if !d.transferVP9ActiveFrameToLastIfAliased(output) { + d.replaceVP9LastFrameInternal(nil) + } + return nil +} + +func (d *VP9Decoder) alignVP9PublishedFrame(src Image) (Image, error) { + if d == nil || d.opts.ByteAlignment == 0 { + return src, nil + } + ssX, ssY := src.Subsampling.Shifts() + if err := d.prepareVP9OutputFrameWithExternalSubsampled(src.Width, src.Height, uint8(ssX), uint8(ssY), false); err != nil { + return Image{}, err + } + copyVP9ImageToPublic(&d.lastFrame, src) + return d.lastFrame, nil +} + +func (d *VP9Decoder) vp9ConcealmentReference( + hdr *vp9dec.UncompressedHeader, +) *vp9ReferenceFrame { + if hdr != nil { + for i := range common.RefsPerFrame { + slot := int(hdr.InterRef.RefIndex[i]) + if slot >= 0 && slot < len(d.refFrames) && d.refFrames[slot].valid { + return &d.refFrames[slot] + } + } + } + for i := range d.refFrames { + if d.refFrames[i].valid { + return &d.refFrames[i] + } + } + return nil +} + +func vp9ExtendPlaneBorder(full []byte, origin, stride, width, height, borderX, borderY int) bool { + return pixel.ExtendPlaneBorder(full, origin, stride, width, height, borderX, borderY) +} + +func (d *VP9Decoder) refreshVP9ReferenceFrames(hdr *vp9dec.UncompressedHeader) { + flags := hdr.RefreshFrameFlags + if flags == 0 { + return + } + renderWidth, renderHeight := vp9dec.HeaderRenderSize(hdr) + var yOrigin, uOrigin, vOrigin, yBorder, uvBorderX, uvBorderY int + if d.frameExternal == nil && d.frameInternal != nil && + d.lastFrame.BitDepth <= 8 && vp9ImageAliasesPlane(d.lastFrame, d.frameY) { + ssX, ssY := d.lastFrame.Subsampling.Shifts() + yb := common.VP9DecBorderInPixels + uvBX := yb >> ssX + uvBY := yb >> ssY + uvW := (d.lastFrame.Width + (1 << ssX) - 1) >> ssX + uvH := (d.lastFrame.Height + (1 << ssY) - 1) >> ssY + var extended bool + if d.vp9TilePool != nil && d.vp9TilePool.helperCount >= 2 { + extended = d.vp9TilePool.extendFrameBorders( + d.frameYFull, d.frameYOrigin, d.lastFrame.YStride, d.lastFrame.Width, d.lastFrame.Height, yb, yb, + d.frameUFull, d.frameUOrigin, d.lastFrame.UStride, uvW, uvH, uvBX, uvBY, + d.frameVFull, d.frameVOrigin, d.lastFrame.VStride, uvW, uvH, uvBX, uvBY, + ) + } else { + extended = vp9ExtendPlaneBorder(d.frameYFull, d.frameYOrigin, d.lastFrame.YStride, + d.lastFrame.Width, d.lastFrame.Height, yb, yb) && + vp9ExtendPlaneBorder(d.frameUFull, d.frameUOrigin, d.lastFrame.UStride, + uvW, uvH, uvBX, uvBY) && + vp9ExtendPlaneBorder(d.frameVFull, d.frameVOrigin, d.lastFrame.VStride, + uvW, uvH, uvBX, uvBY) + } + if extended { + yOrigin = d.frameYOrigin + uOrigin = d.frameUOrigin + vOrigin = d.frameVOrigin + yBorder = yb + uvBorderX = uvBX + uvBorderY = uvBY + } + } + for slot := range d.refFrames { + if flags&(1< 8 && d.highbd != nil && vp9ImageAliasesPlane16(d.lastFrame, d.highbd.frameY16))) { + d.refFrames[slot].storeInternalWithRenderAndBitDepth(d.lastFrame, + d.retainVP9InternalFrame(d.frameInternal), renderWidth, + renderHeight, int(hdr.BitDepthColor.BitDepth), + yOrigin, uOrigin, vOrigin, yBorder, uvBorderX, uvBorderY) + } else { + d.refFrames[slot].storeWithRenderAndBitDepth(d.lastFrame, + renderWidth, renderHeight, int(hdr.BitDepthColor.BitDepth)) + } + } + } +} + +func (d *VP9Decoder) prepareVP9CurrentFrameMvs(hdr *vp9dec.UncompressedHeader) { + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + need := miRows * miCols + if d.opts.DecodeTileRowSet || d.opts.DecodeTileColSet { + d.curFrameMvs = buffers.EnsureLenZeroed(d.curFrameMvs, need) + } else { + d.curFrameMvs = buffers.EnsureLen(d.curFrameMvs, need) + } + d.usePrevFrameMvs = d.lastHeaderValid && + !hdr.ErrorResilientMode && + hdr.Width == d.lastHeader.Width && + hdr.Height == d.lastHeader.Height && + !d.lastHeader.IntraOnly && + d.lastHeader.ShowFrame && + d.lastHeader.FrameType != common.KeyFrame && + d.prevFrameMvRows == miRows && + d.prevFrameMvCols == miCols && + len(d.prevFrameMvs) >= need +} + +func (d *VP9Decoder) finishVP9CurrentFrameMvs(hdr *vp9dec.UncompressedHeader) { + if hdr.ShowExistingFrame || hdr.FrameType == common.KeyFrame || hdr.IntraOnly { + d.usePrevFrameMvs = false + return + } + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + if len(d.curFrameMvs) < miRows*miCols { + d.usePrevFrameMvs = false + return + } + d.prevFrameMvs, d.curFrameMvs = d.curFrameMvs, d.prevFrameMvs + d.prevFrameMvRows = miRows + d.prevFrameMvCols = miCols + d.usePrevFrameMvs = false +} + +func copyPlane16(dst []uint16, dstStride int, src []uint16, srcStride, width, height int) { + for y := range height { + copy(dst[y*dstStride:y*dstStride+width], src[y*srcStride:y*srcStride+width]) + } +} + +func fill16(dst []uint16, val uint16) { + for i := range dst { + dst[i] = val + } +} + +func copyVP9ImageToPublic(dst *Image, src Image) { + uvWidth, uvHeight := src.Subsampling.ChromaDimensions(src.Width, src.Height) + if src.BitDepth > 8 { + copyPlane16(dst.Y16, dst.YStride, src.Y16, src.YStride, src.Width, src.Height) + copyPlane16(dst.U16, dst.UStride, src.U16, src.UStride, uvWidth, uvHeight) + copyPlane16(dst.V16, dst.VStride, src.V16, src.VStride, uvWidth, uvHeight) + dst.BitDepth = src.BitDepth + dst.Subsampling = src.Subsampling + return + } + buffers.CopyPlane(dst.Y, dst.YStride, src.Y, src.YStride, src.Width, src.Height) + buffers.CopyPlane(dst.U, dst.UStride, src.U, src.UStride, uvWidth, uvHeight) + buffers.CopyPlane(dst.V, dst.VStride, src.V, src.VStride, uvWidth, uvHeight) + dst.Subsampling = src.Subsampling +} + +func vp9ImageAliasesPlane(img Image, plane []byte) bool { + if len(img.Y) == 0 || len(plane) == 0 { + return len(img.Y) == 0 && len(plane) == 0 + } + return &img.Y[0] == &plane[0] +} + +func vp9ImageAliasesPlane16(img Image, plane []uint16) bool { + if len(img.Y16) == 0 || len(plane) == 0 { + return len(img.Y16) == 0 && len(plane) == 0 + } + return &img.Y16[0] == &plane[0] +} + +func (d *VP9Decoder) prepareVP9OutputFrame(width, height int) error { + return d.prepareVP9OutputFrameWithExternalSubsampled(width, height, 1, 1, true) +} + +func (d *VP9Decoder) prepareVP9OutputFrameFormat(width, height int, + subsamplingX, subsamplingY, bitDepth uint8, +) error { + if bitDepth > vp9dec.Bits8 { + return d.prepareVP9OutputFrameHighBD(width, height, subsamplingX, subsamplingY, bitDepth) + } + return d.prepareVP9OutputFrameWithExternalSubsampled(width, height, + subsamplingX, subsamplingY, true) +} + +func (d *VP9Decoder) prepareVP9OutputFrameHighBD(width, height int, + subsamplingX, subsamplingY, bitDepth uint8, +) error { + d.replaceVP9LastFrameExternal(nil) + d.replaceVP9LastFrameInternal(nil) + d.releaseVP9ActiveExternalFrame() + d.releaseVP9ActiveInternalFrame() + + layout := common.NewDecoderFrameLayoutSubsampled(width, height, + 0, subsamplingX, subsamplingY) + lease := d.acquireVP9InternalFrame() + if lease == nil { + return ErrInvalidConfig + } + if lease.highbd == nil { + lease.highbd = &vp9LeaseHighBDPlanes{} + } + lhb := lease.highbd + if cap(lhb.y16Full) < layout.YFullLen { + lhb.y16Full = make([]uint16, layout.YFullLen) + } else { + lhb.y16Full = lhb.y16Full[:layout.YFullLen] + } + if cap(lhb.u16Full) < layout.UVFullLen { + lhb.u16Full = make([]uint16, layout.UVFullLen) + } else { + lhb.u16Full = lhb.u16Full[:layout.UVFullLen] + } + if cap(lhb.v16Full) < layout.UVFullLen { + lhb.v16Full = make([]uint16, layout.UVFullLen) + } else { + lhb.v16Full = lhb.v16Full[:layout.UVFullLen] + } + if d.highbd == nil { + d.highbd = &vp9DecoderHighBDState{} + } + hb := d.highbd + d.frameInternal = lease + hb.frameY16Full = lhb.y16Full + hb.frameU16Full = lhb.u16Full + hb.frameV16Full = lhb.v16Full + d.frameYFull = nil + d.frameUFull = nil + d.frameVFull = nil + d.frameY = nil + d.frameU = nil + d.frameV = nil + + if lhb.primedY16Len != layout.YFullLen || lhb.primedUV16Len != layout.UVFullLen || + lhb.primedBitDepth != bitDepth { + neutral := uint16(128 << uint(bitDepth-8)) + fill16(hb.frameY16Full, neutral) + fill16(hb.frameU16Full, neutral) + fill16(hb.frameV16Full, neutral) + lhb.primedY16Len = layout.YFullLen + lhb.primedUV16Len = layout.UVFullLen + lhb.primedBitDepth = bitDepth + } + d.frameYOrigin = layout.YOrigin + d.frameUOrigin = layout.UOrigin + d.frameVOrigin = layout.VOrigin + hb.frameY16 = hb.frameY16Full[layout.YOrigin:] + hb.frameU16 = hb.frameU16Full[layout.UOrigin:] + hb.frameV16 = hb.frameV16Full[layout.VOrigin:] + d.lastFrame = Image{ + Width: width, + Height: height, + Y16: hb.frameY16, + U16: hb.frameU16, + V16: hb.frameV16, + YStride: layout.YStride, + UStride: layout.UVStride, + VStride: layout.UVStride, + Subsampling: codecapi.ChromaSubsamplingFromShifts(layout.SubsamplingX, layout.SubsamplingY), + BitDepth: bitDepth, + } + return nil +} + +func (d *VP9Decoder) prepareVP9InternalOutputFrame(width, height int) error { + return d.prepareVP9OutputFrameWithExternalSubsampled(width, height, 1, 1, false) +} + +func (d *VP9Decoder) prepareVP9OutputFrameWithExternalSubsampled(width, height int, + subsamplingX, subsamplingY uint8, allowExternal bool, +) error { + d.replaceVP9LastFrameExternal(nil) + d.replaceVP9LastFrameInternal(nil) + d.releaseVP9ActiveExternalFrame() + d.releaseVP9ActiveInternalFrame() + if allowExternal && d.opts.GetFrameBuffer != nil { + return d.prepareVP9ExternalOutputFrameSubsampled(width, height, subsamplingX, subsamplingY) + } + + layout := common.NewDecoderFrameLayoutSubsampled(width, height, + d.opts.ByteAlignment, subsamplingX, subsamplingY) + align := common.DecoderFrameAlignment(d.opts.ByteAlignment) + lease := d.acquireVP9InternalFrame() + if lease == nil { + return ErrInvalidConfig + } + if cap(lease.yFull) < layout.YFullLen { + lease.yFull = buffers.NewAligned(layout.YFullLen, align) + } else { + lease.yFull = lease.yFull[:layout.YFullLen] + } + if cap(lease.uFull) < layout.UVFullLen { + lease.uFull = buffers.NewAligned(layout.UVFullLen, align) + } else { + lease.uFull = lease.uFull[:layout.UVFullLen] + } + if cap(lease.vFull) < layout.UVFullLen { + lease.vFull = buffers.NewAligned(layout.UVFullLen, align) + } else { + lease.vFull = lease.vFull[:layout.UVFullLen] + } + d.frameInternal = lease + d.frameYFull = lease.yFull + d.frameUFull = lease.uFull + d.frameVFull = lease.vFull + layout = common.NewDecoderFrameLayoutForPlanesSubsampled(width, height, + d.opts.ByteAlignment, subsamplingX, subsamplingY, + d.frameYFull, d.frameUFull, d.frameVFull) + if lease.primedYLen != layout.YFullLen || lease.primedUVLen != layout.UVFullLen { + lease.primedYLen = layout.YFullLen + lease.primedUVLen = layout.UVFullLen + d.installVP9OutputFrameLayout(width, height, layout) + return nil + } + d.installVP9OutputFrameLayoutPrimed(width, height, layout) + return nil +} + +func (d *VP9Decoder) prepareVP9ExternalOutputFrameSubsampled(width, height int, + subsamplingX, subsamplingY uint8, +) error { + layout := common.NewDecoderFrameLayoutSubsampled(width, height, + d.opts.ByteAlignment, subsamplingX, subsamplingY) + minSize := layout.YFullLen + 2*layout.UVFullLen + 31 + buffer, err := d.opts.GetFrameBuffer(minSize) + if err != nil { + return ErrInvalidConfig + } + if len(buffer.Data) < minSize { + return ErrInvalidConfig + } + baseOff := buffers.AlignmentPadding(buffer.Data, 32) + if len(buffer.Data)-baseOff < layout.YFullLen+2*layout.UVFullLen { + return ErrInvalidConfig + } + base := buffer.Data[baseOff:] + d.frameYFull = base[:layout.YFullLen] + d.frameUFull = base[layout.YFullLen : layout.YFullLen+layout.UVFullLen] + d.frameVFull = base[layout.YFullLen+layout.UVFullLen : layout.YFullLen+2*layout.UVFullLen] + layout = common.NewDecoderFrameLayoutForPlanesSubsampled(width, height, + d.opts.ByteAlignment, subsamplingX, subsamplingY, + d.frameYFull, d.frameUFull, d.frameVFull) + d.frameExternal = &vp9ExternalFrameLease{buffer: buffer, refs: 1} + d.installVP9OutputFrameLayout(width, height, layout) + return nil +} + +func (d *VP9Decoder) installVP9OutputFrameLayout(width, height int, + layout common.FrameLayout, +) { + buffers.Fill(d.frameYFull, 128) + buffers.Fill(d.frameUFull, 128) + buffers.Fill(d.frameVFull, 128) + d.installVP9OutputFrameLayoutPrimed(width, height, layout) +} + +// installVP9OutputFrameLayoutPrimed is installVP9OutputFrameLayout for +// buffers already primed with the neutral 128 fill for this layout. +func (d *VP9Decoder) installVP9OutputFrameLayoutPrimed(width, height int, + layout common.FrameLayout, +) { + d.frameYOrigin = layout.YOrigin + d.frameUOrigin = layout.UOrigin + d.frameVOrigin = layout.VOrigin + d.frameY = d.frameYFull[layout.YOrigin:] + d.frameU = d.frameUFull[layout.UOrigin:] + d.frameV = d.frameVFull[layout.VOrigin:] + d.lastFrame = Image{ + Width: width, + Height: height, + Y: d.frameY, + U: d.frameU, + V: d.frameV, + YStride: layout.YStride, + UStride: layout.UVStride, + VStride: layout.UVStride, + Subsampling: codecapi.ChromaSubsamplingFromShifts(layout.SubsamplingX, layout.SubsamplingY), + } +} + +func (d *VP9Decoder) retainVP9ExternalFrame( + lease *vp9ExternalFrameLease, +) *vp9ExternalFrameLease { + if lease == nil || lease.released { + return nil + } + lease.refs++ + return lease +} + +func (d *VP9Decoder) releaseVP9ExternalFrame(lease *vp9ExternalFrameLease) { + if lease == nil || lease.released { + return + } + lease.refs-- + if lease.refs > 0 { + return + } + lease.released = true + if d != nil && d.opts.ReleaseFrameBuffer != nil { + d.opts.ReleaseFrameBuffer(lease.buffer) + } +} + +func (d *VP9Decoder) acquireVP9InternalFrame() *vp9InternalFrameLease { + for i := range d.internalFramePool { + lease := &d.internalFramePool[i] + if lease.refs == 0 { + lease.refs = 1 + return lease + } + } + return nil +} + +func (d *VP9Decoder) retainVP9InternalFrame( + lease *vp9InternalFrameLease, +) *vp9InternalFrameLease { + if lease == nil || lease.refs <= 0 { + return nil + } + lease.refs++ + return lease +} + +func (d *VP9Decoder) releaseVP9InternalFrame(lease *vp9InternalFrameLease) { + if lease == nil || lease.refs <= 0 { + return + } + lease.refs-- +} + +func (d *VP9Decoder) releaseVP9ActiveInternalFrame() { + if d == nil || d.frameInternal == nil { + return + } + d.releaseVP9InternalFrame(d.frameInternal) + d.frameInternal = nil +} + +func (d *VP9Decoder) replaceVP9LastFrameInternal( + lease *vp9InternalFrameLease, +) { + if d == nil { + return + } + if d.lastFrameInternal == lease { + return + } + d.releaseVP9InternalFrame(d.lastFrameInternal) + d.lastFrameInternal = lease +} + +func (d *VP9Decoder) retainVP9LastFrameInternal( + lease *vp9InternalFrameLease, +) { + if d == nil || d.lastFrameInternal == lease { + return + } + d.replaceVP9LastFrameInternal(d.retainVP9InternalFrame(lease)) +} + +func (d *VP9Decoder) releaseVP9ActiveExternalFrame() { + if d == nil || d.frameExternal == nil { + return + } + d.releaseVP9ExternalFrame(d.frameExternal) + d.frameExternal = nil +} + +func (d *VP9Decoder) transferVP9ActiveFrameToLastIfAliased(output Image) bool { + if d == nil || d.frameInternal == nil { + return false + } + if output.BitDepth > 8 { + if d.highbd == nil || !vp9ImageAliasesPlane16(output, d.highbd.frameY16) { + return false + } + } else if !vp9ImageAliasesPlane(output, d.frameY) { + return false + } + d.replaceVP9LastFrameInternal(d.frameInternal) + d.frameInternal = nil + return true +} + +func (d *VP9Decoder) replaceVP9LastFrameExternal( + lease *vp9ExternalFrameLease, +) { + if d == nil { + return + } + if d.lastFrameExternal == lease { + return + } + d.releaseVP9ExternalFrame(d.lastFrameExternal) + d.lastFrameExternal = lease +} + +func (d *VP9Decoder) retainVP9LastFrameExternal(lease *vp9ExternalFrameLease) { + if d == nil || d.lastFrameExternal == lease { + return + } + d.replaceVP9LastFrameExternal(d.retainVP9ExternalFrame(lease)) +} + +func (d *VP9Decoder) releaseVP9ReferenceExternalFrame(slot int) { + if d == nil || slot < 0 || slot >= len(d.refFrames) { + return + } + d.releaseVP9ExternalFrame(d.refFrames[slot].external) + d.refFrames[slot].external = nil +} + +func (d *VP9Decoder) releaseVP9ReferenceInternalFrame(slot int) { + if d == nil || slot < 0 || slot >= len(d.refFrames) { + return + } + d.releaseVP9InternalFrame(d.refFrames[slot].internal) + d.refFrames[slot].internal = nil +} + +func (d *VP9Decoder) releaseVP9ReferenceFrame(slot int) { + d.releaseVP9ReferenceExternalFrame(slot) + d.releaseVP9ReferenceInternalFrame(slot) +} + +func (d *VP9Decoder) outputVP9FrameImage(hdr *vp9dec.UncompressedHeader, + info VP9FrameInfo, src Image, +) (Image, error) { + flags := d.opts.effectivePostProcessFlags() + if flags == 0 || src.Subsampling != Subsampling420 || src.BitDepth > 8 { + return src, nil + } + if err := d.prepareVP9PostProcess(src.Width, src.Height); err != nil { + return Image{}, err + } + copyVP9ImageToPostSource(&d.postSource.Img, src) + d.postSource.ExtendBorders() + rows := (src.Height + 15) >> 4 + cols := (src.Width + 15) >> 4 + d.prepareVP9PostProcessModes(rows, cols) + filterLevel := uint8(0) + baseQIndex := info.Quantizer + if hdr != nil { + filterLevel = hdr.Loopfilter.FilterLevel + baseQIndex = int(hdr.Quant.BaseQindex) + } + opts := vp8dec.PostProcessOptions{ + Deblock: flags&PostProcessDeblock != 0, + Demacroblock: flags&PostProcessDemacroblock != 0, + MFQE: flags&PostProcessMFQE != 0, + AddNoise: flags&PostProcessAddNoise != 0 && d.opts.PostProcessNoiseLevel > 0, + DeblockingLevel: vp8dec.DefaultPostProcessDeblockingLevel, + NoiseLevel: d.opts.PostProcessNoiseLevel, + BaseQIndex: baseQIndex, + CurrentFrame: d.visibleFrames + 1, + KeyFrame: info.KeyFrame, + VP9: true, + } + if opts.MFQE && len(d.miGrid) > 0 { + // Use the libvpx-faithful VP9 SB-partition walker so MFQE + // uses the VP9-specific decision (libvpx vp9_mfqe.c:198) and + // per-block kernel (vp9_mfqe.c:159), not the VP8 mfqe_block + // kernel (which has totally different SAD / variance / weight + // thresholds and accepts intra and skipped blocks). + opts.MFQEOverride = d.vp9MFQEFaithfulWalker + } + if err := vp8dec.ApplyPostProcessWithOptions(&d.postSource.Img, &d.post, + rows, cols, d.postModes, filterLevel, d.postprocScratch, opts, + &d.postprocState); err != nil { + return Image{}, ErrInvalidVP9Data + } + output := publicImageFromVP8(&d.post.Img) + if d.opts.ByteAlignment > 0 { + if err := d.prepareVP9InternalOutputFrame(output.Width, output.Height); err != nil { + return Image{}, err + } + copyVP9ImageToPublic(&d.lastFrame, output) + return d.lastFrame, nil + } + return output, nil +} + +func copyVP9ImageToPostSource(dst *vp8common.Image, src Image) { + copyVP9PostPlane(dst.Y, dst.YStride, dst.CodedWidth, dst.CodedHeight, + src.Y, src.YStride, src.Width, src.Height) + uvWidth := (src.Width + 1) >> 1 + uvHeight := (src.Height + 1) >> 1 + codedUVWidth := (dst.CodedWidth + 1) >> 1 + codedUVHeight := (dst.CodedHeight + 1) >> 1 + copyVP9PostPlane(dst.U, dst.UStride, codedUVWidth, codedUVHeight, + src.U, src.UStride, uvWidth, uvHeight) + copyVP9PostPlane(dst.V, dst.VStride, codedUVWidth, codedUVHeight, + src.V, src.VStride, uvWidth, uvHeight) +} + +func copyVP9PostPlane(dst []byte, dstStride, codedWidth, codedHeight int, + src []byte, srcStride, width, height int, +) { + for y := range height { + dstRow := dst[y*dstStride:] + copy(dstRow[:width], src[y*srcStride:y*srcStride+width]) + if codedWidth > width { + buffers.Fill(dstRow[width:codedWidth], dstRow[width-1]) + } + } + if height == 0 { + return + } + lastRow := dst[(height-1)*dstStride:] + for y := height; y < codedHeight; y++ { + copy(dst[y*dstStride:y*dstStride+codedWidth], lastRow[:codedWidth]) + } +} + +func (d *VP9Decoder) prepareVP9PostProcess(width, height int) error { + if err := d.postSource.Resize(width, height, 32, 32); err != nil { + return ErrInvalidVP9Data + } + if err := d.post.Resize(width, height, 32, 32); err != nil { + return ErrInvalidVP9Data + } + rows := (height + 15) >> 4 + cols := (width + 15) >> 4 + count := rows * cols + d.postModes = buffers.EnsureLen(d.postModes, count) + scratchLen := cols * 24 + d.postprocScratch = buffers.EnsureLen(d.postprocScratch, scratchLen) + flags := d.opts.effectivePostProcessFlags() + if flags&PostProcessMFQE != 0 { + if err := d.postprocState.EnsureMFQE(width, height); err != nil { + return ErrInvalidVP9Data + } + } + if flags&PostProcessAddNoise != 0 && d.opts.PostProcessNoiseLevel > 0 { + d.postprocState.EnsureNoise(width) + } + return nil +} + +func (d *VP9Decoder) prepareVP9PostProcessModes(rows, cols int) { + for i := range d.postModes { + d.postModes[i] = vp8dec.MacroblockMode{} + } + miCols := (d.lastFrame.Width + 7) >> 3 + miRows := (d.lastFrame.Height + 7) >> 3 + for mbRow := range rows { + for mbCol := range cols { + mode := &d.postModes[mbRow*cols+mbCol] + mode.MBSkipCoeff = true + for subRow := range 2 { + miRow := mbRow*2 + subRow + if miRow >= miRows { + continue + } + for subCol := range 2 { + miCol := mbCol*2 + subCol + if miCol >= miCols { + continue + } + idx := miRow*miCols + miCol + if idx >= len(d.miGrid) { + continue + } + miIdx := idx + if len(d.miIdx) > 0 { + miIdx = int(d.miIdx[idx]) + } + mi := &d.miGrid[miIdx] + if mi.Skip == 0 { + mode.MBSkipCoeff = false + } + if mi.RefFrame[0] > vp9dec.IntraFrame { + mode.RefFrame = vp8common.LastFrame + mode.Mode = vp8common.ZeroMV + mode.MV = vp8dec.MotionVector{ + Row: mi.Mv[0].Row, + Col: mi.Mv[0].Col, + } + } + } + } + } + } +} + +func vp9ImagePlanesAligned(img Image, align int) bool { + if align <= 1 { + return true + } + return buffers.ByteSliceAligned(img.Y, align) && + buffers.ByteSliceAligned(img.U, align) && + buffers.ByteSliceAligned(img.V, align) +} + +// refDims returns the dimensions of a stored VP9 reference slot. Frames +// that predate the reference manager fall back to the active stream size, +// matching the libvpx fast-path when every ref has the same dimensions. +func (d *VP9Decoder) refDims(slot uint8) (uint32, uint32) { + idx := int(slot) + if idx < len(d.refFrames) && d.refFrames[idx].valid { + ref := &d.refFrames[idx].img + return uint32(ref.Width), uint32(ref.Height) + } + return uint32(d.width), uint32(d.height) +} + +// LastFrameSize returns the (width, height) of the last successfully +// decoded VP9 frame. Returns (0, 0) before any successful header parse. +func (d *VP9Decoder) LastFrameSize() (width, height int) { + if d.isClosed() { + return 0, 0 + } + return d.width, d.height +} + +// LastDisplaySize returns the VP9 render/display size for the most recently +// decoded frame, mirroring libvpx VP9D_GET_DISPLAY_SIZE. It returns (0, 0) +// before any successful frame metadata is available. +func (d *VP9Decoder) LastDisplaySize() (width, height int) { + if !d.isActive() { + return 0, 0 + } + return d.lastInfo.RenderWidth, d.lastInfo.RenderHeight +} + +// LastFrameInfo returns metadata for the most recently decoded VP9 frame. +// ok is false on a nil or closed decoder, and before the first successful +// Decode/DecodeInto call. +func (d *VP9Decoder) LastFrameInfo() (VP9FrameInfo, bool) { + if !d.isActive() { + return VP9FrameInfo{}, false + } + return d.lastInfo, true +} + +// LastFrameCorrupted reports whether the most recently decoded VP9 frame was +// flagged as corrupted by the decoder. Mirrors libvpx's +// VP8D_GET_FRAME_CORRUPTED getter on the VP9 decoder control map. ok is false +// on a nil or closed decoder, and before the first successful Decode or +// DecodeInto call. +func (d *VP9Decoder) LastFrameCorrupted() (corrupted bool, ok bool) { + if !d.isActive() { + return false, false + } + return d.lastInfo.Corrupted, true +} + +// LastReferenceUpdates reports the VP9 reference-slot update bitmask from the +// most recently decoded frame. Mirrors libvpx's VP8D_GET_LAST_REF_UPDATES +// getter on the VP9 decoder control map. ok is false on a nil or closed +// decoder, and before the first successful Decode or DecodeInto call. +func (d *VP9Decoder) LastReferenceUpdates() (flags uint8, ok bool) { + if !d.isActive() { + return 0, false + } + return d.lastInfo.RefreshFrameFlags, true +} + +// LastBitDepth reports the VP9 bit depth from the most recently decoded frame, +// mirroring libvpx VP9D_GET_BIT_DEPTH. ok is false on a nil or closed decoder, +// and before the first successful Decode or DecodeInto call. +func (d *VP9Decoder) LastBitDepth() (bitDepth int, ok bool) { + if !d.isActive() { + return 0, false + } + return d.lastInfo.BitDepth, true +} + +// NextFrame returns the most recent visible VP9 frame decoded by the +// currently supported reconstruction path and consumes it. Subsequent +// calls return false until the next visible frame is decoded. +// +// The returned image aliases decoder-owned storage. That storage stays +// valid until the next Decode or Close call. +func (d *VP9Decoder) NextFrame() (Image, bool) { + if d == nil || d.lifecycle != vp9DecoderFrameReady { + return Image{}, false + } + d.lifecycle = vp9DecoderActive + return d.lastFrame, true +} + +// Reset returns the decoder to its cold-start state while retaining +// allocated buffers and validated VP9DecoderOptions for reuse. +func (d *VP9Decoder) Reset() { + if d == nil { + return + } + d.resetVP9FrameContexts() + d.lastHeader = vp9dec.UncompressedHeader{} + d.lastHeaderValid = false + d.unsupportedReconstruct = false + d.releaseVP9ActiveExternalFrame() + d.replaceVP9LastFrameExternal(nil) + d.releaseVP9ActiveInternalFrame() + d.replaceVP9LastFrameInternal(nil) + d.lifecycle = vp9DecoderColdStart + d.lastFrame = Image{} + d.lastInfo = VP9FrameInfo{} + d.visibleFrames = 0 + d.width = 0 + d.height = 0 + for i := range d.refFrames { + d.releaseVP9ReferenceFrame(i) + d.refFrames[i].img = Image{} + d.refFrames[i].valid = false + } + d.usePrevFrameMvs = false + d.prevFrameMvRows = 0 + d.prevFrameMvCols = 0 + if d.prevFrameMvs != nil { + d.prevFrameMvs = d.prevFrameMvs[:0] + } + if d.curFrameMvs != nil { + d.curFrameMvs = d.curFrameMvs[:0] + } + if d.aboveSegCtx != nil { + d.aboveSegCtx = d.aboveSegCtx[:0] + } + if d.leftSegCtx != nil { + d.leftSegCtx = d.leftSegCtx[:0] + } + if d.miGrid != nil { + d.miGrid = d.miGrid[:0] + } + if d.miIdx != nil { + d.miIdx = d.miIdx[:0] + } + if d.vp9TileDescs != nil { + d.vp9TileDescs = d.vp9TileDescs[:0] + } + if d.segMap != nil { + d.segMap = d.segMap[:0] + } + if d.lastSegMap != nil { + d.lastSegMap = d.lastSegMap[:0] + } + d.segMapMiRows = 0 + d.segMapMiCols = 0 + if d.interPredictScratch != nil { + d.interPredictScratch = d.interPredictScratch[:0] + } + d.postSource.Reset() + d.post.Reset() + d.postprocState.Reset() +} + +// Close releases internal state and marks the decoder as no longer +// usable. Subsequent calls to Decode return [ErrClosed]. Close is +// idempotent: calling it on an already-closed decoder returns +// [ErrClosed] without re-tearing-down the worker pools. +func (d *VP9Decoder) Close() error { + if d.isClosed() { + return ErrClosed + } + d.Reset() + if d.vp9LoopFilterPool != nil { + d.vp9LoopFilterPool.shutdown() + d.vp9LoopFilterPool = nil + } + if d.vp9TilePool != nil { + d.vp9TilePool.shutdown() + d.vp9TilePool = nil + } + d.lifecycle = vp9DecoderClosed + return nil +} + +// Codec reports the codec this decoder is built for. +func (d *VP9Decoder) Codec() Codec { return CodecVP9 } + +func (d *VP9Decoder) markVP9Unsupported() { + d.unsupportedReconstruct = true +} diff --git a/internal/vp9/codec/vp9_decoder_adapt.go b/internal/vp9/codec/vp9_decoder_adapt.go new file mode 100644 index 0000000..15ca695 --- /dev/null +++ b/internal/vp9/codec/vp9_decoder_adapt.go @@ -0,0 +1,243 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder_adapt.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" +) + +func (d *VP9Decoder) adaptVP9FrameContext(hdr *vp9dec.UncompressedHeader, + comp vp9dec.CompressedHeader, idx int, +) { + if idx < 0 || idx >= common.FrameContexts || + hdr.ErrorResilientMode || hdr.FrameParallelDecoding { + return + } + pre := &d.frameContexts[idx] + vp9dec.AdaptFrameContextWithCounts(&d.fc, pre, &d.counts, hdr, comp.TxMode, + d.lastHeaderValid && d.lastHeader.FrameType == common.KeyFrame) +} + +func (d *VP9Decoder) countVP9NewMv(mv, refMv vp9dec.MV) { + diff := vp9dec.MV{ + Row: mv.Row - refMv.Row, + Col: mv.Col - refMv.Col, + } + vp9dec.IncMv(diff, &d.counts.Mv) +} + +func (d *VP9Decoder) readVP9SkipWithCounts(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, segID int, above, left *vp9dec.NeighborMi, +) int { + if hdr.Seg.Enabled && vp9dec.SegFeatureActive(&hdr.Seg, segID, vp9dec.SegLvlSkip) { + return 1 + } + ctx := vp9dec.GetSkipContext(above, left) + skip := int(r.Read(uint32(d.fc.SkipProbs[ctx]))) + if !hdr.FrameParallelDecoding { + d.counts.Skip[ctx][skip]++ + } + return skip +} + +func (d *VP9Decoder) readVP9IsInterBlockWithCounts(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, segID int, above, left *vp9dec.NeighborMi, +) int { + if hdr.Seg.Enabled && vp9dec.SegFeatureActive(&hdr.Seg, segID, vp9dec.SegLvlRefFrame) { + if int(vp9dec.GetSegData(&hdr.Seg, segID, vp9dec.SegLvlRefFrame)) != vp9dec.IntraFrame { + return 1 + } + return 0 + } + ctx := vp9dec.GetIntraInterContext(above, left) + isInter := int(r.Read(uint32(d.fc.IntraInterProb[ctx]))) + if !hdr.FrameParallelDecoding { + d.counts.IntraInter[ctx][isInter]++ + } + return isInter +} + +func (d *VP9Decoder) readVP9TxSizeWithCounts(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, txMode common.TxMode, bsize common.BlockSize, + above, left *vp9dec.NeighborMi, allowSelect bool, +) common.TxSize { + maxTx := common.MaxTxsizeLookup[bsize] + if allowSelect && txMode == common.TxModeSelect && bsize >= common.Block8x8 { + ctx := vp9dec.GetTxSizeContext(above, left, maxTx) + switch maxTx { + case common.Tx8x8: + probs := &d.fc.TxProbs.P8x8[ctx] + tx := common.TxSize(r.Read(uint32(probs[0]))) + if !hdr.FrameParallelDecoding { + d.counts.Tx.P8x8[ctx][tx]++ + } + return tx + case common.Tx16x16: + probs := &d.fc.TxProbs.P16x16[ctx] + tx := common.TxSize(r.Read(uint32(probs[0]))) + if tx != common.Tx4x4 { + tx += common.TxSize(r.Read(uint32(probs[1]))) + } + if !hdr.FrameParallelDecoding { + d.counts.Tx.P16x16[ctx][tx]++ + } + return tx + case common.Tx32x32: + probs := &d.fc.TxProbs.P32x32[ctx] + tx := common.TxSize(r.Read(uint32(probs[0]))) + if tx != common.Tx4x4 { + tx += common.TxSize(r.Read(uint32(probs[1]))) + if tx != common.Tx8x8 { + tx += common.TxSize(r.Read(uint32(probs[2]))) + } + } + if !hdr.FrameParallelDecoding { + d.counts.Tx.P32x32[ctx][tx]++ + } + return tx + } + } + cap := common.TxModeToBiggestTxSize[txMode] + if maxTx < cap { + return maxTx + } + return cap +} + +func (d *VP9Decoder) readVP9InterModeWithCounts(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, ctx int, +) common.PredictionMode { + mode := vp9dec.ReadInterMode(r, d.fc.InterModeProbs[ctx]) + if !hdr.FrameParallelDecoding { + d.counts.InterMode[ctx][mode-common.NearestMv]++ + } + return mode +} + +func (d *VP9Decoder) readVP9SwitchableInterpFilterWithCounts(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, above, left *vp9dec.NeighborMi, +) vp9dec.InterpFilter { + ctx := vp9dec.GetPredContextSwitchableInterp(above, left) + probs := &d.fc.SwitchableInterpProb[ctx] + filter := vp9dec.InterpEighttap + if r.Read(uint32(probs[0])) != 0 { + filter = vp9dec.InterpEighttapSmooth + if r.Read(uint32(probs[1])) != 0 { + filter = vp9dec.InterpEighttapSharp + } + } + if !hdr.FrameParallelDecoding { + d.counts.SwitchableInterp[ctx][filter]++ + } + return filter +} + +func (d *VP9Decoder) readVP9RefFramesWithCounts(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, frameMode vp9dec.ReferenceMode, + signBias [vp9dec.MaxRefFrames]uint8, refs vp9dec.CompoundFrameRefs, + segID int, above, left *vp9dec.NeighborMi, out *[2]int8, +) { + if hdr.Seg.Enabled && vp9dec.SegFeatureActive(&hdr.Seg, segID, vp9dec.SegLvlRefFrame) { + out[0] = int8(vp9dec.GetSegData(&hdr.Seg, segID, vp9dec.SegLvlRefFrame)) + out[1] = vp9dec.NoRefFrame + return + } + + mode := frameMode + if frameMode == vp9dec.ReferenceModeSelect { + ctx := vp9dec.GetReferenceModeContext(above, left, refs) + bit := int(r.Read(uint32(d.fc.ReferenceModeProbs.CompInterProb[ctx]))) + if !hdr.FrameParallelDecoding { + d.counts.CompInter[ctx][bit]++ + } + if bit != 0 { + mode = vp9dec.CompoundReference + } else { + mode = vp9dec.SingleReference + } + } + + switch mode { + case vp9dec.CompoundReference: + idx := int(signBias[refs.CompFixedRef]) + ctx := vp9dec.GetPredContextCompRefP(above, left, refs, signBias) + bit := int(r.Read(uint32(d.fc.ReferenceModeProbs.CompRefProb[ctx]))) + if !hdr.FrameParallelDecoding { + d.counts.CompRef[ctx][bit]++ + } + out[idx] = refs.CompFixedRef + out[1-idx] = refs.CompVarRef[bit] + case vp9dec.SingleReference: + ctx0 := vp9dec.GetPredContextSingleRefP1(above, left) + bit0 := int(r.Read(uint32(d.fc.ReferenceModeProbs.SingleRefProb[ctx0][0]))) + if !hdr.FrameParallelDecoding { + d.counts.SingleRef[ctx0][0][bit0]++ + } + if bit0 != 0 { + ctx1 := vp9dec.GetPredContextSingleRefP2(above, left) + bit1 := int(r.Read(uint32(d.fc.ReferenceModeProbs.SingleRefProb[ctx1][1]))) + if !hdr.FrameParallelDecoding { + d.counts.SingleRef[ctx1][1][bit1]++ + } + if bit1 != 0 { + out[0] = vp9dec.AltrefFrame + } else { + out[0] = vp9dec.GoldenFrame + } + } else { + out[0] = vp9dec.LastFrame + } + out[1] = vp9dec.NoRefFrame + } +} + +func (d *VP9Decoder) readVP9IntraBlockModeInfoInterWithCounts( + r *bitstream.Reader, hdr *vp9dec.UncompressedHeader, out *vp9dec.NeighborMi, +) common.PredictionMode { + readY := func(sizeGroup int) common.PredictionMode { + mode := vp9dec.ReadIntraModeYInter(r, &d.fc, sizeGroup) + if !hdr.FrameParallelDecoding { + d.counts.YMode[sizeGroup][mode]++ + } + return mode + } + switch out.SbType { + case common.Block4x4: + for i := range 4 { + out.Bmi[i].AsMode = readY(0) + } + out.Mode = out.Bmi[3].AsMode + case common.Block4x8: + out.Bmi[0].AsMode = readY(0) + out.Bmi[2].AsMode = out.Bmi[0].AsMode + out.Bmi[1].AsMode = readY(0) + out.Bmi[3].AsMode = out.Bmi[1].AsMode + out.Mode = out.Bmi[1].AsMode + case common.Block8x4: + out.Bmi[0].AsMode = readY(0) + out.Bmi[1].AsMode = out.Bmi[0].AsMode + out.Bmi[2].AsMode = readY(0) + out.Bmi[3].AsMode = out.Bmi[2].AsMode + out.Mode = out.Bmi[2].AsMode + default: + out.Mode = readY(int(common.SizeGroupLookup[out.SbType])) + } + uvMode := vp9dec.ReadIntraModeUvInter(r, &d.fc, out.Mode) + if !hdr.FrameParallelDecoding { + d.counts.UvMode[out.Mode][uvMode]++ + } + out.InterpFilter = uint8(vp9dec.SwitchableFilters) + out.RefFrame[0] = vp9dec.IntraFrame + out.RefFrame[1] = vp9dec.NoRefFrame + return uvMode +} diff --git a/internal/vp9/codec/vp9_decoder_highbd.go b/internal/vp9/codec/vp9_decoder_highbd.go new file mode 100644 index 0000000..dccd8df --- /dev/null +++ b/internal/vp9/codec/vp9_decoder_highbd.go @@ -0,0 +1,1110 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder_highbd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" + "github.com/go-avkit/vpx/internal/vp9/dsp" + "github.com/go-avkit/vpx/internal/vp9/tables" + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +// High-bit-depth (10-bit / 12-bit) VP9 decoder reconstruction & loop filter. +// Supports Profile 2 (10/12-bit 4:2:0) and is subsampling-parameterized for +// future Profile 3 reuse. Leaves 8-bit Profile 0/1 hot paths completely untouched. + +func (d *VP9Decoder) vp9OutputPlane16(plane int) ([]uint16, int) { + hb := d.highbd + if hb == nil { + return nil, 0 + } + switch plane { + case 0: + return hb.frameY16, d.lastFrame.YStride + case 1: + return hb.frameU16, d.lastFrame.UStride + case 2: + return hb.frameV16, d.lastFrame.VStride + default: + return nil, 0 + } +} + +func vp9ReferencePlane16(ref *vp9ReferenceFrame, plane int) ([]uint16, int) { + if ref == nil || !ref.valid { + return nil, 0 + } + switch plane { + case 0: + return ref.img.Y16, ref.img.YStride + case 1: + return ref.img.U16, ref.img.UStride + case 2: + return ref.img.V16, ref.img.VStride + default: + return nil, 0 + } +} + +func (d *VP9Decoder) vp9EnsureDQCoeff32() []int32 { + if d.highbd == nil { + d.highbd = &vp9DecoderHighBDState{} + } + if len(d.highbd.dqcoeff32) < 1024 { + d.highbd.dqcoeff32 = make([]int32, 1024) + } + return d.highbd.dqcoeff32 +} + +func (d *VP9Decoder) reconstructVP9IntraPredictBlockHighBD( + hdr *vp9dec.UncompressedHeader, + mi *vp9dec.NeighborMi, + uvMode common.PredictionMode, + tile vp9dec.TileBounds, + miRow, miCol int, + bsize common.BlockSize, +) { + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + d.markVP9Unsupported() + return + } + txSize := mi.TxSize + if plane > 0 { + txSize = vp9dec.GetUvTxSize(bsize, mi.TxSize, pd) + } + num4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + max4x4W, max4x4H := vp9dec.PlaneMaxBlocks4x4(miRows, miCols, + miRow, miCol, bsize, pd, planeBsize) + step := 1 << uint(txSize) + blockStep := 1 << uint(txSize<<1) + extraStep := ((num4x4W - max4x4W) >> txSize) * blockStep + blockIdx := 0 + for rr := 0; rr < max4x4H; rr += step { + for cc := 0; cc < max4x4W; cc += step { + mode := uvMode + if plane == 0 { + mode = vp9dec.GetYMode(mi, blockIdx) + } + if _, _, ok := d.reconstructVP9IntraPredictTxHighBD(hdr, pd, plane, mode, txSize, + tile, miRow, miCol, bsize, rr, cc); !ok { + d.markVP9Unsupported() + return + } + blockIdx += blockStep + } + blockIdx += extraStep + } + } +} + +func (d *VP9Decoder) reconstructVP9IntraPredictTxHighBD( + hdr *vp9dec.UncompressedHeader, + pd *vp9dec.MacroblockdPlane, + plane int, + mode common.PredictionMode, + txSize common.TxSize, + tile vp9dec.TileBounds, + miRow, miCol int, + bsize common.BlockSize, + blockRow4x4, blockCol4x4 int, +) (dst []uint16, stride int, ok bool) { + planeData, stride := d.vp9OutputPlane16(plane) + if stride <= 0 || len(planeData) == 0 || int(mode) >= common.IntraModes { + return nil, 0, false + } + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + return nil, 0, false + } + rows := len(planeData) / stride + alignedWidth := buffers.Align(int(hdr.Width), 8) + alignedHeight := buffers.Align(int(hdr.Height), 8) + planeWidth := alignedWidth >> pd.SubsamplingX + planeHeight := alignedHeight >> pd.SubsamplingY + baseX := (miCol * common.MiSize) >> pd.SubsamplingX + baseY := (miRow * common.MiSize) >> pd.SubsamplingY + x0 := baseX + blockCol4x4*4 + y0 := baseY + blockRow4x4*4 + + bs := 4 << uint(txSize) + if x0+bs > stride || y0+bs > rows { + return nil, 0, false + } + + bd := int(hdr.BitDepthColor.BitDepth) + baseVal := uint16(128 << uint(bd-8)) + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + bounds := vp9dec.BlockBoundsEdgesForMI(miRows, miCols, miRow, miCol, bsize) + leftAvailable := blockCol4x4 != 0 || miCol > tile.MiColStart + upAvailable := blockRow4x4 != 0 || miRow > 0 + planeBlock4x4W := vp9IntraPredictWidth4x4(bsize, planeBsize, pd) + txw := 1 << uint(txSize) + rightAvailable := blockCol4x4+txw < planeBlock4x4W + + var left [32]uint16 + if leftAvailable { + for i := range bs { + sy := y0 + i + if bounds.MbToBottomEdge < 0 && sy >= planeHeight { + sy = planeHeight - 1 + } + left[i] = planeData[sy*stride+x0-1] + } + } else { + for i := range bs { + left[i] = baseVal + 1 + } + } + + // aboveFull[0] = top-left (above[-1]); aboveFull[1..2*bs] = above[0..2*bs-1]. + var aboveFull [1 + 64]uint16 + if upAvailable { + aboveRowOff := (y0 - 1) * stride + // Copy above[0..bs-1] with right-edge clamping. + if bounds.MbToRightEdge < 0 { + if x0+bs <= planeWidth { + copy(aboveFull[1:1+bs], planeData[aboveRowOff+x0:aboveRowOff+x0+bs]) + } else if x0 < planeWidth { + r := planeWidth - x0 + copy(aboveFull[1:1+r], planeData[aboveRowOff+x0:aboveRowOff+x0+r]) + fill := aboveFull[r] + for i := r; i < bs; i++ { + aboveFull[1+i] = fill + } + } + // Above-right for 4x4 (and replicated above[bs-1] for >= 8x8). + if bs == 4 && rightAvailable { + if x0+2*bs <= planeWidth { + copy(aboveFull[1+bs:1+2*bs], planeData[aboveRowOff+x0+bs:aboveRowOff+x0+2*bs]) + } else if x0+bs < planeWidth { + r := planeWidth - (x0 + bs) + copy(aboveFull[1+bs:1+bs+r], planeData[aboveRowOff+x0+bs:aboveRowOff+x0+bs+r]) + fill := aboveFull[bs+r] + for i := r; i < bs; i++ { + aboveFull[1+bs+i] = fill + } + } else { + fill := aboveFull[bs] + for i := range bs { + aboveFull[1+bs+i] = fill + } + } + } else { + fill := aboveFull[bs] + for i := range bs { + aboveFull[1+bs+i] = fill + } + } + } else { + copy(aboveFull[1:1+bs], planeData[aboveRowOff+x0:aboveRowOff+x0+bs]) + if bs == 4 && rightAvailable { + copy(aboveFull[1+bs:1+2*bs], planeData[aboveRowOff+x0+bs:aboveRowOff+x0+2*bs]) + } else { + fill := aboveFull[bs] + for i := range bs { + aboveFull[1+bs+i] = fill + } + } + } + if leftAvailable { + aboveFull[0] = planeData[aboveRowOff+x0-1] + } else { + aboveFull[0] = baseVal + 1 + } + } else { + for i := range 1 + 2*bs { + aboveFull[i] = baseVal - 1 + } + } + + dst = planeData[y0*stride+x0:] + dsp.HighbdIntraPredict(dst, 0, stride, bs, mode, aboveFull[:], left[:bs], + upAvailable, leftAvailable, bd) + return dst, stride, true +} + +func (d *VP9Decoder) reconstructVP9InterPredictBlockHighBD( + hdr *vp9dec.UncompressedHeader, + mi *vp9dec.NeighborMi, + miRow, miCol int, + bsize common.BlockSize, +) bool { + if d.unsupportedReconstruct { + return true + } + if !vp9dec.CanReconstructInterBlock(mi) { + d.markVP9Unsupported() + return true + } + nrefs := 1 + if mi.RefFrame[1] > vp9dec.IntraFrame { + nrefs = 2 + } + bd := int(hdr.BitDepthColor.BitDepth) + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + d.markVP9Unsupported() + return true + } + dst, dstStride := d.vp9OutputPlane16(plane) + if dstStride <= 0 || len(dst) == 0 { + return false + } + dstRows := len(dst) / dstStride + x0 := (miCol * common.MiSize) >> pd.SubsamplingX + y0 := (miRow * common.MiSize) >> pd.SubsamplingY + if x0 >= dstStride || y0 >= dstRows { + continue + } + bw := int(common.Num4x4BlocksWideLookup[planeBsize]) * 4 + bh := int(common.Num4x4BlocksHighLookup[planeBsize]) * 4 + if x0+bw > dstStride || y0+bh > dstRows { + d.markVP9Unsupported() + return true + } + for refIdx := range nrefs { + refSlot, ok := vp9dec.InterReferenceSlot(hdr, mi.RefFrame[refIdx]) + if !ok { + return false + } + ref := d.vp9PredictRefFrame(refSlot) + if !vp9RefMatchesHeaderFormat(ref, hdr) { + return false + } + var sf *vp9dec.ScaleFactors + scaled := false + if ref.img.Width != int(hdr.Width) || ref.img.Height != int(hdr.Height) { + sf = d.vp9ScaleFactorsFor(ref.img.Width, ref.img.Height, + int(hdr.Width), int(hdr.Height)) + if !sf.IsValidScale() { + d.markVP9Unsupported() + return true + } + scaled = sf.IsScaled() + } + src, srcStride := vp9ReferencePlane16(ref, plane) + if srcStride <= 0 || len(src) == 0 { + return false + } + srcRows := len(src) / srcStride + if !scaled && (x0 >= srcStride || y0 >= srcRows) { + continue + } + srcWidth := (ref.img.Width + (1 << pd.SubsamplingX) - 1) >> pd.SubsamplingX + srcHeight := (ref.img.Height + (1 << pd.SubsamplingY) - 1) >> pd.SubsamplingY + if srcWidth <= 0 || srcHeight <= 0 { + return false + } + avg := refIdx == 1 + if mi.SbType < common.Block8x8 { + block := 0 + num4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + num4x4H := int(common.Num4x4BlocksHighLookup[planeBsize]) + for y := range num4x4H { + for x := range num4x4W { + mv := vp9dec.AverageSplitMvs(&mi.Bmi, refIdx, block, + int(pd.SubsamplingX), int(pd.SubsamplingY)) + if !d.reconstructVP9InterPredictPlaneHighBD(hdr, pd, mi, sf, + dst, dstStride, src, srcStride, + bsize, miRow, miCol, + x0, y0, 4*x, 4*y, + srcWidth, srcHeight, bw, bh, 4, 4, mv, avg, bd) { + return false + } + block++ + } + } + continue + } + if !d.reconstructVP9InterPredictPlaneHighBD(hdr, pd, mi, sf, + dst, dstStride, src, srcStride, + bsize, miRow, miCol, + x0, y0, 0, 0, + srcWidth, srcHeight, bw, bh, bw, bh, mi.Mv[refIdx], avg, bd) { + return false + } + } + } + return true +} + +func (d *VP9Decoder) reconstructVP9InterPredictPlaneHighBD( + hdr *vp9dec.UncompressedHeader, + pd *vp9dec.MacroblockdPlane, + mi *vp9dec.NeighborMi, + sf *vp9dec.ScaleFactors, + dst []uint16, dstStride int, + src []uint16, srcStride int, + bsize common.BlockSize, + miRow, miCol int, + baseX, baseY, blockX, blockY int, + srcWidth, srcHeight, bw, bh, predW, predH int, + mv vp9dec.MV, avg bool, bd int, +) bool { + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + edges := vp9dec.BlockBoundsEdges{ + MbToLeftEdge: -((miCol * common.MiSize) * 8), + MbToRightEdge: ((miCols - int(common.Num8x8BlocksWideLookup[bsize]) - miCol) * common.MiSize) * 8, + MbToTopEdge: -((miRow * common.MiSize) * 8), + MbToBottomEdge: ((miRows - int(common.Num8x8BlocksHighLookup[bsize]) - miRow) * common.MiSize) * 8, + } + mvQ4 := vp9dec.ClampMvToUmvBorderSb(edges, mv, bw, bh, + int(pd.SubsamplingX), int(pd.SubsamplingY)) + + dstX := baseX + blockX + dstY := baseY + blockY + srcX := baseX + blockX + srcY := baseY + blockY + scaledMV := vp9dec.MV32{Row: int32(mvQ4.Row), Col: int32(mvQ4.Col)} + xStepQ4 := vp9dec.SubpelShifts + yStepQ4 := vp9dec.SubpelShifts + if sf != nil && sf.IsScaled() { + srcX = sf.ScaleValueX(srcX) + srcY = sf.ScaleValueY(srcY) + scaledMV = vp9dec.ScaleMv(mvQ4, + miCol*common.MiSize+blockX, miRow*common.MiSize+blockY, sf) + xStepQ4 = sf.XStepQ4 + yStepQ4 = sf.YStepQ4 + } + subpelX := int(scaledMV.Col) & (vp9dec.SubpelShifts - 1) + subpelY := int(scaledMV.Row) & (vp9dec.SubpelShifts - 1) + fullX := srcX + (int(scaledMV.Col) >> vp9dec.SubpelBitsConst) + fullY := srcY + (int(scaledMV.Row) >> vp9dec.SubpelBitsConst) + + // Build a padded uint16 source window so 8-tap filter taps never read OOB. + needW := (((predW-1)*xStepQ4 + subpelX) >> 4) + 1 + needH := (((predH-1)*yStepQ4 + subpelY) >> 4) + 1 + padLeft, padRight := 3, 4 + padTop, padBottom := 3, 4 + winW := needW + padLeft + padRight + winH := needH + padTop + padBottom + need := winW * winH + if d.highbd == nil { + d.highbd = &vp9DecoderHighBDState{} + } + if cap(d.highbd.interPredictScratch16) < need { + d.highbd.interPredictScratch16 = make([]uint16, need) + } + win := d.highbd.interPredictScratch16[:need] + for wy := range winH { + sy := fullY - padTop + wy + if sy < 0 { + sy = 0 + } else if sy >= srcHeight { + sy = srcHeight - 1 + } + srcRow := src[sy*srcStride:] + dstRow := win[wy*winW:] + for wx := range winW { + sx := fullX - padLeft + wx + if sx < 0 { + sx = 0 + } else if sx >= srcWidth { + sx = srcWidth - 1 + } + dstRow[wx] = srcRow[sx] + } + } + + srcOff := padTop*winW + padLeft + dstOff := dstY*dstStride + dstX + filterIdx := int(mi.InterpFilter) + if filterIdx < 0 || filterIdx >= len(tables.FilterKernels) { + filterIdx = 0 + } + filter := tables.FilterKernels[filterIdx] + hasX := subpelX != 0 || xStepQ4 != 16 + hasY := subpelY != 0 || yStepQ4 != 16 + switch { + case !hasX && !hasY: + if avg { + dsp.HighbdConvolveAvg(win, srcOff, winW, dst, dstOff, dstStride, predW, predH) + } else { + dsp.HighbdConvolveCopy(win, srcOff, winW, dst, dstOff, dstStride, predW, predH) + } + case hasX && !hasY: + if avg { + dsp.HighbdConvolve8AvgHoriz(win, srcOff, winW, dst, dstOff, dstStride, + filter, subpelX, xStepQ4, predW, predH, bd) + } else { + dsp.HighbdConvolve8Horiz(win, srcOff, winW, dst, dstOff, dstStride, + filter, subpelX, xStepQ4, predW, predH, bd) + } + case !hasX && hasY: + if avg { + dsp.HighbdConvolve8AvgVert(win, srcOff, winW, dst, dstOff, dstStride, + filter, subpelY, yStepQ4, predW, predH, bd) + } else { + dsp.HighbdConvolve8Vert(win, srcOff, winW, dst, dstOff, dstStride, + filter, subpelY, yStepQ4, predW, predH, bd) + } + default: + if avg { + dsp.HighbdConvolve8Avg(win, srcOff, winW, dst, dstOff, dstStride, + filter, subpelX, xStepQ4, subpelY, yStepQ4, predW, predH, bd) + } else { + dsp.HighbdConvolve8(win, srcOff, winW, dst, dstOff, dstStride, + filter, subpelX, xStepQ4, subpelY, yStepQ4, predW, predH, bd) + } + } + return true +} + +func (d *VP9Decoder) readVP9ResidueBlockHighBD(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, mi *vp9dec.NeighborMi, + uvMode common.PredictionMode, tile vp9dec.TileBounds, + miRow, miCol int, bsize common.BlockSize, segID int, isInter int, +) bool { + aboveOffsets, leftOffsets := d.vp9PlaneContextOffsets(miRow, miCol) + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + if isInter != 0 && !d.unsupportedReconstruct { + if !d.reconstructVP9InterPredictBlockHighBD(hdr, mi, miRow, miCol, bsize) { + return false + } + } + var coefCounts *vp9dec.CoefCounts + if !hdr.FrameParallelDecoding { + coefCounts = &d.counts.Coef + } + bd := vp9dec.BitDepth(hdr.BitDepthColor.BitDepth) + dqBuf := d.vp9EnsureDQCoeff32() + eobTotal := 0 + + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeType := 0 + dequant := d.dq.Y[segID] + if plane > 0 { + planeType = 1 + dequant = d.dq.Uv[segID] + } + txSize := mi.TxSize + if plane > 0 { + txSize = vp9dec.GetUvTxSize(bsize, mi.TxSize, pd) + } + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + return false + } + full4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + num4x4W, num4x4H := vp9dec.PlaneMaxBlocks4x4(miRows, miCols, miRow, miCol, + bsize, pd, planeBsize) + step := 1 << uint(txSize) + blockStep := 1 << uint(txSize<<1) + extraStep := ((full4x4W - num4x4W) >> txSize) * blockStep + aboveBase := aboveOffsets[plane] + leftBase := leftOffsets[plane] + blockIdx := 0 + + dqShift := uint(0) + if txSize == common.Tx32x32 { + dqShift = 1 + } + maxEob := vp9dec.MaxEobForTxSize(txSize) + coeffs := dqBuf[:maxEob] + + var interPlane []uint16 + var interStride, interRows, interBaseX, interBaseY, interBS int + if isInter != 0 && !d.unsupportedReconstruct { + interPlane, interStride = d.vp9OutputPlane16(plane) + if interStride > 0 && len(interPlane) > 0 { + interRows = len(interPlane) / interStride + interBaseX = (miCol * common.MiSize) >> pd.SubsamplingX + interBaseY = (miRow * common.MiSize) >> pd.SubsamplingY + interBS = 4 << uint(txSize) + } + } + + for rr := 0; rr < num4x4H; rr += step { + for cc := 0; cc < num4x4W; cc += step { + mode := uvMode + if plane == 0 { + mode = vp9dec.GetYMode(mi, blockIdx) + } + txType := common.DctDct + if isInter == 0 && planeType == 0 && !hdr.Quant.Lossless { + txType = common.IntraModeToTxType[mode] + } + aboveCtx := pd.AboveContext[aboveBase+cc : aboveBase+cc+step] + leftCtx := pd.LeftContext[leftBase+rr : leftBase+rr+step] + initCtx := vp9dec.GetEntropyContextFull(txSize, aboveCtx, leftCtx) + so := common.GetScanPtr(txSize, planeType, isInter, hdr.Quant.Lossless, mode) + + eob := vp9dec.DecodeCoefsHighBD(r, &d.fc.CoefProbs, txSize, + planeType, isInter, so.Scan, so.Neighbors, dequant, + dqShift, initCtx, bd, coeffs, &d.coefTokenCache, coefCounts) + eobTotal += eob + + if isInter == 0 && !d.unsupportedReconstruct { + dst, stride, ok := d.reconstructVP9IntraPredictTxHighBD(hdr, pd, plane, + mode, txSize, tile, miRow, miCol, bsize, rr, cc) + if !ok { + d.markVP9Unsupported() + } else if eob > 0 && dst != nil { + dsp.HighbdInverseTransformAdd(txSize, txType, hdr.Quant.Lossless, + coeffs, dst, 0, stride, eob, int(bd)) + } + } else if isInter != 0 && !d.unsupportedReconstruct { + x0 := interBaseX + cc*4 + y0 := interBaseY + rr*4 + if len(interPlane) == 0 || x0+interBS > interStride || y0+interBS > interRows { + d.markVP9Unsupported() + } else if eob > 0 { + dsp.HighbdInverseTransformAdd(txSize, common.DctDct, hdr.Quant.Lossless, + coeffs, interPlane, y0*interStride+x0, interStride, eob, int(bd)) + } + } + + if eob > 0 { + clear(coeffs) + } + hasResidue := uint8(0) + if eob > 0 { + hasResidue = 1 + } + for i := range step { + aboveCtx[i] = hasResidue + leftCtx[i] = hasResidue + } + if hasResidue != 0 { + if cc+step > num4x4W { + clear(aboveCtx[num4x4W-cc:]) + } + if rr+step > num4x4H { + clear(leftCtx[num4x4H-rr:]) + } + } + blockIdx += blockStep + } + blockIdx += extraStep + } + } + if eobTotal == 0 { + mi.Skip = 1 + } + return !r.HasError() +} + +// --- High-bit-depth Loop Filter --- + +func (d *VP9Decoder) vp9FilterLoopBlockHighBD(miRows, miCols, miRow, miCol int, + lfm *vp9LoopFilterMask, +) bool { + hb := d.highbd + if hb == nil { + return false + } + bd := int(d.lastFrame.BitDepth) + if !d.vp9FilterLoopBlockPlaneSS00HighBD(hb.frameY16Full, d.frameYOrigin, d.lastFrame.YStride, + miRows, miRow, miCol, lfm, bd) { + return false + } + if !d.vp9FilterLoopBlockChromaPlaneHighBD(hb.frameU16Full, d.frameUOrigin, d.lastFrame.UStride, + miRows, miCols, miRow, miCol, lfm, bd) { + return false + } + return d.vp9FilterLoopBlockChromaPlaneHighBD(hb.frameV16Full, d.frameVOrigin, d.lastFrame.VStride, + miRows, miCols, miRow, miCol, lfm, bd) +} + +func (d *VP9Decoder) vp9FilterLoopBlockChromaPlaneHighBD(plane []uint16, origin, stride int, + miRows, miCols, miRow, miCol int, lfm *vp9LoopFilterMask, bd int, +) bool { + ssX, ssY := d.lastFrame.Subsampling.Shifts() + switch { + case ssX == 1 && ssY == 1: + return d.vp9FilterLoopBlockPlaneSS11HighBD(plane, origin, stride, miRows, miRow, miCol, lfm, bd) + case ssX == 0 && ssY == 0: + return d.vp9FilterLoopBlockPlaneSS00HighBD(plane, origin, stride, miRows, miRow, miCol, lfm, bd) + default: + return d.vp9FilterLoopBlockPlaneNon420HighBD(plane, origin, stride, + miRows, miCols, miRow, miCol, uint8(ssX), uint8(ssY), bd) + } +} + +func (d *VP9Decoder) vp9FilterLoopBlockPlaneHighBD(miRows, miCols, miRow, miCol int, + plane vp9LoopFilterPlane, lfm *vp9LoopFilterMask, +) bool { + hb := d.highbd + if hb == nil { + return false + } + bd := int(d.lastFrame.BitDepth) + switch plane { + case vp9LoopFilterPlaneY: + return d.vp9FilterLoopBlockPlaneSS00HighBD(hb.frameY16Full, d.frameYOrigin, + d.lastFrame.YStride, miRows, miRow, miCol, lfm, bd) + case vp9LoopFilterPlaneU: + return d.vp9FilterLoopBlockChromaPlaneHighBD(hb.frameU16Full, d.frameUOrigin, + d.lastFrame.UStride, miRows, miCols, miRow, miCol, lfm, bd) + case vp9LoopFilterPlaneV: + return d.vp9FilterLoopBlockChromaPlaneHighBD(hb.frameV16Full, d.frameVOrigin, + d.lastFrame.VStride, miRows, miCols, miRow, miCol, lfm, bd) + default: + return false + } +} + +// vp9FilterLoopBlockPlaneNon420HighBD ports libvpx's vp9_highbd_filter_block_plane_non420 +// for asymmetric high-bit-depth chroma subsampling (4:2:2 and 4:4:0 in Profile 3). +func (d *VP9Decoder) vp9FilterLoopBlockPlaneNon420HighBD(plane []uint16, origin, stride int, + miRows, miCols, miRow, miCol int, ssX, ssY uint8, bd int, +) bool { + if stride <= 0 || len(plane) == 0 { + return false + } + base := origin + ((miRow*common.MiSize)>>ssY)*stride + ((miCol * common.MiSize) >> ssX) + if base < 0 || base >= len(plane) { + return false + } + rowStep := 1 << ssY + colStep := 1 << ssX + + var mask16 [common.MiBlockSize]uint32 + var mask8 [common.MiBlockSize]uint32 + var mask4 [common.MiBlockSize]uint32 + var mask4Int [common.MiBlockSize]uint32 + var lfl [common.MiBlockSize * common.MiBlockSize]uint8 + + offset := base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += rowStep { + var mask16C, mask8C, mask4C uint32 + for c := 0; c < common.MiBlockSize && miCol+c < miCols; c += colStep { + mi := d.vp9DecoderMiAt(miRows, miCols, miRow+r, miCol+c) + if mi == nil || mi.SbType >= common.BlockSizes || mi.TxSize >= common.TxSizes { + return false + } + sbType := mi.SbType + skipThis := mi.Skip != 0 && mi.RefFrame[0] > vp9dec.IntraFrame + blockEdgeLeft := true + if common.Num4x4BlocksWideLookup[sbType] > 1 { + blockEdgeLeft = (c & (int(common.Num8x8BlocksWideLookup[sbType]) - 1)) == 0 + } + skipThisC := skipThis && !blockEdgeLeft + blockEdgeAbove := true + if common.Num4x4BlocksHighLookup[sbType] > 1 { + blockEdgeAbove = (r & (int(common.Num8x8BlocksHighLookup[sbType]) - 1)) == 0 + } + skipThisR := skipThis && !blockEdgeAbove + txSize := common.UvTxsizeLookup[sbType][mi.TxSize][ssX][ssY] + if txSize >= common.TxSizes { + return false + } + skipBorder4x4C := ssX != 0 && miCol+c == miCols-1 + skipBorder4x4R := ssY != 0 && miRow+r == miRows-1 + + level := d.vp9LoopFilterLevel(mi) + lfl[(r<<3)+(c>>ssX)] = level + if level == 0 { + continue + } + + bit := uint32(1) << uint(c>>ssX) + switch txSize { + case common.Tx32x32: + if !skipThisC && ((c>>ssX)&3) == 0 { + if !skipBorder4x4C { + mask16C |= bit + } else { + mask8C |= bit + } + } + if !skipThisR && ((r>>ssY)&3) == 0 { + if !skipBorder4x4R { + mask16[r] |= bit + } else { + mask8[r] |= bit + } + } + case common.Tx16x16: + if !skipThisC && ((c>>ssX)&1) == 0 { + if !skipBorder4x4C { + mask16C |= bit + } else { + mask8C |= bit + } + } + if !skipThisR && ((r>>ssY)&1) == 0 { + if !skipBorder4x4R { + mask16[r] |= bit + } else { + mask8[r] |= bit + } + } + default: + if !skipThisC { + if txSize == common.Tx8x8 || ((c>>ssX)&3) == 0 { + mask8C |= bit + } else { + mask4C |= bit + } + } + if !skipThisR { + if txSize == common.Tx8x8 || ((r>>ssY)&3) == 0 { + mask8[r] |= bit + } else { + mask4[r] |= bit + } + } + if !skipThis && txSize < common.Tx8x8 && !skipBorder4x4C { + mask4Int[r] |= bit + } + } + } + + borderMask := ^uint32(0) + if miCol == 0 { + borderMask = ^uint32(1) + } + vp9FilterSelectivelyVertHighBD(plane, offset, stride, + mask16C&borderMask, mask8C&borderMask, mask4C&borderMask, mask4Int[r], + &d.lfi, lfl[r<<3:], bd) + offset += 8 * stride + } + + offset = base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += rowStep { + skipBorder4x4R := ssY != 0 && miRow+r == miRows-1 + mask4IntR := mask4Int[r] + if skipBorder4x4R { + mask4IntR = 0 + } + var mask16R, mask8R, mask4R uint32 + if miRow+r != 0 { + mask16R = mask16[r] + mask8R = mask8[r] + mask4R = mask4[r] + } + vp9FilterSelectivelyHorizHighBD(plane, offset, stride, + mask16R, mask8R, mask4R, mask4IntR, + &d.lfi, lfl[r<<3:], bd) + offset += 8 * stride + } + return true +} + +func vp9FilterSelectivelyVertHighBD(plane []uint16, offset, pitch int, + mask16, mask8, mask4, mask4Int uint32, + lfi *vp9dec.LoopFilterInfoN, lfl []uint8, bd int, +) { + for mask := mask16 | mask8 | mask4 | mask4Int; mask != 0; mask >>= 1 { + level := &lfi.Lfthr[lfl[0]] + if mask&1 != 0 { + switch { + case mask16&1 != 0: + dsp.HighbdLpfVertical16(plane, offset, pitch, level.Mblim, level.Lim, level.HevThr, bd) + case mask8&1 != 0: + dsp.HighbdLpfVertical8(plane, offset, pitch, level.Mblim, level.Lim, level.HevThr, bd) + case mask4&1 != 0: + dsp.HighbdLpfVertical4(plane, offset, pitch, level.Mblim, level.Lim, level.HevThr, bd) + } + } + if mask4Int&1 != 0 { + dsp.HighbdLpfVertical4(plane, offset+4, pitch, level.Mblim, level.Lim, level.HevThr, bd) + } + offset += 8 + lfl = lfl[1:] + mask16 >>= 1 + mask8 >>= 1 + mask4 >>= 1 + mask4Int >>= 1 + } +} + +func (d *VP9Decoder) vp9FilterLoopBlockPlaneSS00HighBD(plane []uint16, origin, stride int, + miRows, miRow, miCol int, lfm *vp9LoopFilterMask, bd int, +) bool { + if stride <= 0 || len(plane) == 0 { + return false + } + base := origin + miRow*common.MiSize*stride + miCol*common.MiSize + if base < 0 || base >= len(plane) { + return false + } + mask16 := lfm.leftY[common.Tx16x16] + mask8 := lfm.leftY[common.Tx8x8] + mask4 := lfm.leftY[common.Tx4x4] + mask4Int := lfm.int4x4Y + offset := base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += 2 { + vp9FilterSelectivelyVertRow2HighBD(0, plane, offset, stride, + uint32(mask16), uint32(mask8), uint32(mask4), uint32(mask4Int), + &d.lfi, lfm.lflY[r<<3:], bd) + offset += 16 * stride + mask16 >>= 16 + mask8 >>= 16 + mask4 >>= 16 + mask4Int >>= 16 + } + + mask16 = lfm.aboveY[common.Tx16x16] + mask8 = lfm.aboveY[common.Tx8x8] + mask4 = lfm.aboveY[common.Tx4x4] + mask4Int = lfm.int4x4Y + offset = base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r++ { + var mask16R, mask8R, mask4R uint32 + if miRow+r != 0 { + mask16R = uint32(mask16 & 0xff) + mask8R = uint32(mask8 & 0xff) + mask4R = uint32(mask4 & 0xff) + } + vp9FilterSelectivelyHorizHighBD(plane, offset, stride, + mask16R, mask8R, mask4R, uint32(mask4Int&0xff), + &d.lfi, lfm.lflY[r<<3:], bd) + offset += 8 * stride + mask16 >>= 8 + mask8 >>= 8 + mask4 >>= 8 + mask4Int >>= 8 + } + return true +} + +func (d *VP9Decoder) vp9FilterLoopBlockPlaneSS11HighBD(plane []uint16, origin, stride int, + miRows, miRow, miCol int, lfm *vp9LoopFilterMask, bd int, +) bool { + if stride <= 0 || len(plane) == 0 { + return false + } + base := origin + (miRow*(common.MiSize>>1))*stride + miCol*(common.MiSize>>1) + if base < 0 || base >= len(plane) { + return false + } + var lflUV [16]uint8 + mask16 := lfm.leftUV[common.Tx16x16] + mask8 := lfm.leftUV[common.Tx8x8] + mask4 := lfm.leftUV[common.Tx4x4] + mask4Int := lfm.int4x4UV + offset := base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += 4 { + for c := range common.MiBlockSize >> 1 { + lflUV[(r<<1)+c] = lfm.lflY[(r<<3)+(c<<1)] + lflUV[((r+2)<<1)+c] = lfm.lflY[((r+2)<<3)+(c<<1)] + } + vp9FilterSelectivelyVertRow2HighBD(1, plane, offset, stride, + uint32(mask16), uint32(mask8), uint32(mask4), uint32(mask4Int), + &d.lfi, lflUV[r<<1:], bd) + offset += 16 * stride + mask16 >>= 8 + mask8 >>= 8 + mask4 >>= 8 + mask4Int >>= 8 + } + + mask16 = lfm.aboveUV[common.Tx16x16] + mask8 = lfm.aboveUV[common.Tx8x8] + mask4 = lfm.aboveUV[common.Tx4x4] + mask4Int = lfm.int4x4UV + offset = base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += 2 { + mask4IntR := uint32(mask4Int & 0xf) + if miRow+r == miRows-1 { + mask4IntR = 0 + } + var mask16R, mask8R, mask4R uint32 + if miRow+r != 0 { + mask16R = uint32(mask16 & 0xf) + mask8R = uint32(mask8 & 0xf) + mask4R = uint32(mask4 & 0xf) + } + vp9FilterSelectivelyHorizHighBD(plane, offset, stride, + mask16R, mask8R, mask4R, mask4IntR, + &d.lfi, lflUV[r<<1:], bd) + offset += 8 * stride + mask16 >>= 4 + mask8 >>= 4 + mask4 >>= 4 + mask4Int >>= 4 + } + return true +} + +func vp9FilterSelectivelyVertRow2HighBD(subsamplingFactor int, + plane []uint16, offset, pitch int, + mask16, mask8, mask4, mask4Int uint32, + lfi *vp9dec.LoopFilterInfoN, lfl []uint8, bd int, +) { + dualMaskCutoff := uint32(0xffff) + lflForward := 8 + if subsamplingFactor != 0 { + dualMaskCutoff = 0xff + lflForward = 4 + } + dualOne := uint32(1 | (1 << uint(lflForward))) + ss0 := offset + for mask := (mask16 | mask8 | mask4 | mask4Int) & dualMaskCutoff; mask != 0; mask = (mask &^ dualOne) >> 1 { + if mask&dualOne != 0 { + l0 := &lfi.Lfthr[lfl[0]] + l1 := &lfi.Lfthr[lfl[lflForward]] + ss1 := ss0 + 8*pitch + + if mask16&dualOne != 0 { + if mask16&dualOne == dualOne { + dsp.HighbdLpfVertical16Dual(plane, ss0, pitch, + l0.Mblim, l0.Lim, l0.HevThr, bd) + } else { + l, ss := l0, ss0 + if mask16&1 == 0 { + l, ss = l1, ss1 + } + dsp.HighbdLpfVertical16(plane, ss, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + } + if mask8&dualOne != 0 { + if mask8&dualOne == dualOne { + dsp.HighbdLpfVertical8Dual(plane, ss0, pitch, + l0.Mblim, l0.Lim, l0.HevThr, + l1.Mblim, l1.Lim, l1.HevThr, bd) + } else { + l, ss := l0, ss0 + if mask8&1 == 0 { + l, ss = l1, ss1 + } + dsp.HighbdLpfVertical8(plane, ss, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + } + if mask4&dualOne != 0 { + if mask4&dualOne == dualOne { + dsp.HighbdLpfVertical4Dual(plane, ss0, pitch, + l0.Mblim, l0.Lim, l0.HevThr, + l1.Mblim, l1.Lim, l1.HevThr, bd) + } else { + l, ss := l0, ss0 + if mask4&1 == 0 { + l, ss = l1, ss1 + } + dsp.HighbdLpfVertical4(plane, ss, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + } + if mask4Int&dualOne != 0 { + if mask4Int&dualOne == dualOne { + dsp.HighbdLpfVertical4Dual(plane, ss0+4, pitch, + l0.Mblim, l0.Lim, l0.HevThr, + l1.Mblim, l1.Lim, l1.HevThr, bd) + } else { + l, ss := l0, ss0+4 + if mask4Int&1 == 0 { + l, ss = l1, ss1+4 + } + dsp.HighbdLpfVertical4(plane, ss, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + } + } + ss0 += 8 + lfl = lfl[1:] + mask16 >>= 1 + mask8 >>= 1 + mask4 >>= 1 + mask4Int >>= 1 + } +} + +func vp9FilterSelectivelyHorizHighBD(plane []uint16, offset, pitch int, + mask16, mask8, mask4, mask4Int uint32, + lfi *vp9dec.LoopFilterInfoN, lfl []uint8, bd int, +) { + for mask := mask16 | mask8 | mask4 | mask4Int; mask != 0; { + count := 1 + if mask&1 != 0 { + l := &lfi.Lfthr[lfl[0]] + switch { + case mask16&1 != 0: + if mask16&3 == 3 { + dsp.HighbdLpfHorizontal16Dual(plane, offset, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + count = 2 + } else { + dsp.HighbdLpfHorizontal16(plane, offset, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + case mask8&1 != 0: + if mask8&3 == 3 { + n := &lfi.Lfthr[lfl[1]] + dsp.HighbdLpfHorizontal8Dual(plane, offset, pitch, + l.Mblim, l.Lim, l.HevThr, + n.Mblim, n.Lim, n.HevThr, bd) + if mask4Int&3 == 3 { + dsp.HighbdLpfHorizontal4Dual(plane, offset+4*pitch, pitch, + l.Mblim, l.Lim, l.HevThr, + n.Mblim, n.Lim, n.HevThr, bd) + } else if mask4Int&1 != 0 { + dsp.HighbdLpfHorizontal4(plane, offset+4*pitch, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } else if mask4Int&2 != 0 { + dsp.HighbdLpfHorizontal4(plane, offset+8+4*pitch, pitch, + n.Mblim, n.Lim, n.HevThr, bd) + } + count = 2 + } else { + dsp.HighbdLpfHorizontal8(plane, offset, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + if mask4Int&1 != 0 { + dsp.HighbdLpfHorizontal4(plane, offset+4*pitch, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + } + case mask4&1 != 0: + if mask4&3 == 3 { + n := &lfi.Lfthr[lfl[1]] + dsp.HighbdLpfHorizontal4Dual(plane, offset, pitch, + l.Mblim, l.Lim, l.HevThr, + n.Mblim, n.Lim, n.HevThr, bd) + if mask4Int&3 == 3 { + dsp.HighbdLpfHorizontal4Dual(plane, offset+4*pitch, pitch, + l.Mblim, l.Lim, l.HevThr, + n.Mblim, n.Lim, n.HevThr, bd) + } else if mask4Int&1 != 0 { + dsp.HighbdLpfHorizontal4(plane, offset+4*pitch, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } else if mask4Int&2 != 0 { + dsp.HighbdLpfHorizontal4(plane, offset+8+4*pitch, pitch, + n.Mblim, n.Lim, n.HevThr, bd) + } + count = 2 + } else { + dsp.HighbdLpfHorizontal4(plane, offset, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + if mask4Int&1 != 0 { + dsp.HighbdLpfHorizontal4(plane, offset+4*pitch, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + } + default: + dsp.HighbdLpfHorizontal4(plane, offset+4*pitch, pitch, + l.Mblim, l.Lim, l.HevThr, bd) + } + } + offset += 8 * count + lfl = lfl[count:] + mask >>= uint(count) + mask16 >>= uint(count) + mask8 >>= uint(count) + mask4 >>= uint(count) + mask4Int >>= uint(count) + } +} diff --git a/internal/vp9/codec/vp9_decoder_loopfilter.go b/internal/vp9/codec/vp9_decoder_loopfilter.go new file mode 100644 index 0000000..d9a2e55 --- /dev/null +++ b/internal/vp9/codec/vp9_decoder_loopfilter.go @@ -0,0 +1,1092 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder_loopfilter.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" + "github.com/go-avkit/vpx/internal/vp9/dsp" + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +type vp9LoopFilterMask struct { + leftY [common.TxSizes]uint64 + aboveY [common.TxSizes]uint64 + int4x4Y uint64 + leftUV [common.TxSizes]uint16 + aboveUV [common.TxSizes]uint16 + int4x4UV uint16 + lflY [64]uint8 +} + +var vp9LFLeft64x64TxformMask = [common.TxSizes]uint64{ + 0xffffffffffffffff, + 0xffffffffffffffff, + 0x5555555555555555, + 0x1111111111111111, +} + +var vp9LFAbove64x64TxformMask = [common.TxSizes]uint64{ + 0xffffffffffffffff, + 0xffffffffffffffff, + 0x00ff00ff00ff00ff, + 0x000000ff000000ff, +} + +var vp9LFLeftPredictionMask = [common.BlockSizes]uint64{ + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000101, 0x0000000000000001, + 0x0000000000000101, 0x0000000001010101, 0x0000000000000101, + 0x0000000001010101, 0x0101010101010101, 0x0000000001010101, + 0x0101010101010101, +} + +var vp9LFAbovePredictionMask = [common.BlockSizes]uint64{ + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000003, + 0x0000000000000003, 0x0000000000000003, 0x000000000000000f, + 0x000000000000000f, 0x000000000000000f, 0x00000000000000ff, + 0x00000000000000ff, +} + +var vp9LFSizeMask = [common.BlockSizes]uint64{ + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000101, 0x0000000000000003, + 0x0000000000000303, 0x0000000003030303, 0x0000000000000f0f, + 0x000000000f0f0f0f, 0x0f0f0f0f0f0f0f0f, 0x00000000ffffffff, + 0xffffffffffffffff, +} + +var vp9LFLeft64x64TxformMaskUV = [common.TxSizes]uint16{ + 0xffff, 0xffff, 0x5555, 0x1111, +} + +var vp9LFAbove64x64TxformMaskUV = [common.TxSizes]uint16{ + 0xffff, 0xffff, 0x0f0f, 0x000f, +} + +var vp9LFLeftPredictionMaskUV = [common.BlockSizes]uint16{ + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0011, 0x0001, 0x0011, 0x1111, 0x0011, 0x1111, +} + +var vp9LFAbovePredictionMaskUV = [common.BlockSizes]uint16{ + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0003, 0x0003, 0x0003, 0x000f, 0x000f, +} + +var vp9LFSizeMaskUV = [common.BlockSizes]uint16{ + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0011, 0x0003, 0x0033, 0x3333, 0x00ff, 0xffff, +} + +func (d *VP9Decoder) applyVP9LoopFilter(hdr *vp9dec.UncompressedHeader) bool { + if hdr.Loopfilter.FilterLevel == 0 { + return true + } + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + // Gate the loop-filter worker pool on VP9D_SET_LOOP_FILTER_OPT. When + // the option is off the deblock pass runs serially even on a threaded + // decoder, matching libvpx's lpf_mt_opt = 0 path. + if d.vp9LoopFilterPool != nil && d.opts.DecoderLoopFilterOpt { + return d.applyVP9LoopFilterThreaded(miRows, miCols, int(hdr.Width)) + } + return d.applyVP9LoopFilterSerial(miRows, miCols) +} + +func (d *VP9Decoder) applyVP9LoopFilterSerial(miRows, miCols int) bool { + if !d.prepareVP9LoopFilterMasks(miRows, miCols, 0, miRows) { + return false + } + return d.applyVP9LoopFilterSerialCached(miRows, miCols) +} + +func (d *VP9Decoder) applyVP9LoopFilterSerialCached(miRows, miCols int) bool { + for miRow := 0; miRow < miRows; miRow += common.MiBlockSize { + for miCol := 0; miCol < miCols; miCol += common.MiBlockSize { + lfm, ok := d.vp9LoopFilterMaskAt(miRow, miCol) + if !ok { + return false + } + if !d.vp9FilterLoopBlock(miRows, miCols, miRow, miCol, lfm) { + return false + } + } + } + return true +} + +func (d *VP9Decoder) prepareVP9LoopFilterMasks(miRows, miCols int, + startMiRow, endMiRow int, +) bool { + if !d.prepareVP9LoopFilterMaskStorage(miRows, miCols) { + return false + } + return d.prepareVP9LoopFilterMasksCached(miRows, miCols, startMiRow, + endMiRow) +} + +func (d *VP9Decoder) prepareVP9LoopFilterMaskStorage(miRows, miCols int) bool { + if d == nil || miRows <= 0 || miCols <= 0 { + return false + } + sbRows := (miRows + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + sbCols := (miCols + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + d.vp9LoopFilterMasks = buffers.EnsureLenZeroed(d.vp9LoopFilterMasks, + sbRows*sbCols) + d.vp9LoopFilterMaskRows = sbRows + d.vp9LoopFilterMaskCols = sbCols + return true +} + +// prepareVP9LoopFilterMasksCached builds masks for reconstructed rows after +// the shared frame storage has been allocated and cleared. Row-MT workers call +// it on disjoint SB rows so mask construction can overlap reconstruction. +func (d *VP9Decoder) prepareVP9LoopFilterMasksCached(miRows, miCols int, + startMiRow, endMiRow int, +) bool { + if d == nil || miRows <= 0 || miCols <= 0 || + d.vp9LoopFilterMaskRows <= 0 || d.vp9LoopFilterMaskCols <= 0 { + return false + } + if startMiRow < 0 { + startMiRow = 0 + } + if endMiRow > miRows { + endMiRow = miRows + } + if startMiRow >= endMiRow { + return true + } + startMiRow &^= common.MiBlockSize - 1 + for miRow := startMiRow; miRow < endMiRow; miRow += common.MiBlockSize { + for miCol := 0; miCol < miCols; miCol += common.MiBlockSize { + lfm, ok := d.vp9LoopFilterMaskAt(miRow, miCol) + if !ok { + return false + } + if !d.vp9SetupLoopFilterMask(miRows, miCols, miRow, miCol, lfm) { + return false + } + vp9AdjustLoopFilterMask(miRows, miCols, miRow, miCol, lfm) + } + } + return true +} + +func (d *VP9Decoder) vp9LoopFilterMaskAt(miRow, miCol int) (*vp9LoopFilterMask, bool) { + if d == nil || d.vp9LoopFilterMaskCols <= 0 { + return nil, false + } + sbRow := miRow >> common.MiBlockSizeLog2 + sbCol := miCol >> common.MiBlockSizeLog2 + if sbRow < 0 || sbCol < 0 || + sbRow >= d.vp9LoopFilterMaskRows || + sbCol >= d.vp9LoopFilterMaskCols { + return nil, false + } + idx := sbRow*d.vp9LoopFilterMaskCols + sbCol + if idx < 0 || idx >= len(d.vp9LoopFilterMasks) { + return nil, false + } + return &d.vp9LoopFilterMasks[idx], true +} + +// applyVP9LoopFilterPlaneRows runs the loop filter on a single plane +// restricted to mi rows in [startMiRow, endMiRow). Mirrors libvpx +// vp9_loop_filter_frame's row-range walk used by the partial-frame / +// LPF_PICK_FROM_SUBIMAGE path (vp9_loopfilter.c:1469-1483 +// vp9_loop_filter_frame). When startMiRow == 0 and endMiRow == miRows +// the range covers the whole frame, matching the unrestricted +// applyVP9LoopFilterPlane path. +// +// libvpx: vp9_loopfilter.c:1469 +// +// void vp9_loop_filter_frame(YV12_BUFFER_CONFIG *frame, VP9_COMMON *cm, +// MACROBLOCKD *xd, int frame_filter_level, int y_only, +// int partial_frame) { +// int start_mi_row, end_mi_row, mi_rows_to_filter; +// if (!frame_filter_level) return; +// start_mi_row = 0; +// mi_rows_to_filter = cm->mi_rows; +// if (partial_frame && cm->mi_rows > 8) { +// start_mi_row = cm->mi_rows >> 1; +// start_mi_row &= 0xfffffff8; +// mi_rows_to_filter = VPXMAX(cm->mi_rows / 8, 8); +// } +// end_mi_row = start_mi_row + mi_rows_to_filter; +// loop_filter_rows(frame, cm, xd->plane, start_mi_row, end_mi_row, y_only); +// } +func (d *VP9Decoder) applyVP9LoopFilterPlaneRows(miRows, miCols int, + startMiRow, endMiRow int, plane vp9LoopFilterPlane, +) bool { + if startMiRow < 0 { + startMiRow = 0 + } + if endMiRow > miRows { + endMiRow = miRows + } + if !d.prepareVP9LoopFilterMasks(miRows, miCols, startMiRow, endMiRow) { + return false + } + return d.applyVP9LoopFilterPlaneRowsCached(miRows, miCols, startMiRow, + endMiRow, plane) +} + +func (d *VP9Decoder) applyVP9LoopFilterPlaneRowsCached(miRows, miCols int, + startMiRow, endMiRow int, plane vp9LoopFilterPlane, +) bool { + for miRow := startMiRow; miRow < endMiRow; miRow += common.MiBlockSize { + for miCol := 0; miCol < miCols; miCol += common.MiBlockSize { + lfm, ok := d.vp9LoopFilterMaskAt(miRow, miCol) + if !ok { + return false + } + if !d.vp9FilterLoopBlockPlane(miRows, miCols, miRow, miCol, plane, lfm) { + return false + } + } + } + return true +} + +func (d *VP9Decoder) vp9SetupLoopFilterMask(miRows, miCols, miRow, miCol int, + lfm *vp9LoopFilterMask, +) bool { + top := d.vp9DecoderMiAt(miRows, miCols, miRow, miCol) + if top == nil { + return false + } + maxRows := common.MiBlockSize + if miRow+common.MiBlockSize > miRows { + maxRows = miRows - miRow + } + maxCols := common.MiBlockSize + if miCol+common.MiBlockSize > miCols { + maxCols = miCols - miCol + } + + switch top.SbType { + case common.Block64x64: + return d.vp9BuildLoopFilterMasks(top, 0, 0, lfm) + case common.Block64x32: + if !d.vp9BuildLoopFilterMasks(top, 0, 0, lfm) { + return false + } + if 4 >= maxRows { + return true + } + return d.vp9BuildLoopFilterMasks(d.vp9DecoderMiAt(miRows, miCols, miRow+4, miCol), + 32, 8, lfm) + case common.Block32x64: + if !d.vp9BuildLoopFilterMasks(top, 0, 0, lfm) { + return false + } + if 4 >= maxCols { + return true + } + return d.vp9BuildLoopFilterMasks(d.vp9DecoderMiAt(miRows, miCols, miRow, miCol+4), + 4, 2, lfm) + default: + return d.vp9SetupLoopFilterMaskSub64(miRows, miCols, miRow, miCol, + maxRows, maxCols, lfm) + } +} + +func (d *VP9Decoder) vp9SetupLoopFilterMaskSub64(miRows, miCols, miRow, miCol int, + maxRows, maxCols int, lfm *vp9LoopFilterMask, +) bool { + shift32Y := [4]int{0, 4, 32, 36} + shift16Y := [4]int{0, 2, 16, 18} + shift8Y := [4]int{0, 1, 8, 9} + shift32UV := [4]int{0, 2, 8, 10} + shift16UV := [4]int{0, 1, 4, 5} + + for idx32 := range 4 { + row32 := miRow + ((idx32 >> 1) << 2) + col32 := miCol + ((idx32 & 1) << 2) + row32Off := (idx32 >> 1) << 2 + col32Off := (idx32 & 1) << 2 + if col32Off >= maxCols || row32Off >= maxRows { + continue + } + mi32 := d.vp9DecoderMiAt(miRows, miCols, row32, col32) + if mi32 == nil { + return false + } + switch mi32.SbType { + case common.Block32x32: + if !d.vp9BuildLoopFilterMasks(mi32, shift32Y[idx32], shift32UV[idx32], lfm) { + return false + } + case common.Block32x16: + if !d.vp9BuildLoopFilterMasks(mi32, shift32Y[idx32], shift32UV[idx32], lfm) { + return false + } + if row32Off+2 >= maxRows { + continue + } + if !d.vp9BuildLoopFilterMasks(d.vp9DecoderMiAt(miRows, miCols, row32+2, col32), + shift32Y[idx32]+16, shift32UV[idx32]+4, lfm) { + return false + } + case common.Block16x32: + if !d.vp9BuildLoopFilterMasks(mi32, shift32Y[idx32], shift32UV[idx32], lfm) { + return false + } + if col32Off+2 >= maxCols { + continue + } + if !d.vp9BuildLoopFilterMasks(d.vp9DecoderMiAt(miRows, miCols, row32, col32+2), + shift32Y[idx32]+2, shift32UV[idx32]+1, lfm) { + return false + } + default: + if !d.vp9SetupLoopFilterMaskSub32(miRows, miCols, row32, col32, + row32Off, col32Off, maxRows, maxCols, + shift32Y[idx32], shift32UV[idx32], shift16Y, shift16UV, shift8Y, lfm) { + return false + } + } + } + return true +} + +func (d *VP9Decoder) vp9SetupLoopFilterMaskSub32(miRows, miCols, baseRow, baseCol int, + row32Off, col32Off, maxRows, maxCols, shiftY32, shiftUV32 int, + shift16Y, shift16UV, shift8Y [4]int, + lfm *vp9LoopFilterMask, +) bool { + for idx16 := range 4 { + row16 := baseRow + ((idx16 >> 1) << 1) + col16 := baseCol + ((idx16 & 1) << 1) + row16Off := row32Off + ((idx16 >> 1) << 1) + col16Off := col32Off + ((idx16 & 1) << 1) + if col16Off >= maxCols || row16Off >= maxRows { + continue + } + shiftY16 := shiftY32 + shift16Y[idx16] + shiftUV16 := shiftUV32 + shift16UV[idx16] + mi16 := d.vp9DecoderMiAt(miRows, miCols, row16, col16) + if mi16 == nil { + return false + } + switch mi16.SbType { + case common.Block16x16: + if !d.vp9BuildLoopFilterMasks(mi16, shiftY16, shiftUV16, lfm) { + return false + } + case common.Block16x8: + if !d.vp9BuildLoopFilterMasks(mi16, shiftY16, shiftUV16, lfm) { + return false + } + if row16Off+1 >= maxRows { + continue + } + if !d.vp9BuildLoopFilterYMask(d.vp9DecoderMiAt(miRows, miCols, row16+1, col16), + shiftY16+8, lfm) { + return false + } + case common.Block8x16: + if !d.vp9BuildLoopFilterMasks(mi16, shiftY16, shiftUV16, lfm) { + return false + } + if col16Off+1 >= maxCols { + continue + } + if !d.vp9BuildLoopFilterYMask(d.vp9DecoderMiAt(miRows, miCols, row16, col16+1), + shiftY16+1, lfm) { + return false + } + default: + if !d.vp9BuildLoopFilterMasks(mi16, shiftY16+shift8Y[0], shiftUV16, lfm) { + return false + } + for idx8 := 1; idx8 < 4; idx8++ { + row8 := row16 + (idx8 >> 1) + col8 := col16 + (idx8 & 1) + row8Off := row16Off + (idx8 >> 1) + col8Off := col16Off + (idx8 & 1) + if col8Off >= maxCols || row8Off >= maxRows { + continue + } + if !d.vp9BuildLoopFilterYMask(d.vp9DecoderMiAt(miRows, miCols, row8, col8), + shiftY16+shift8Y[idx8], lfm) { + return false + } + } + } + } + return true +} + +func (d *VP9Decoder) vp9BuildLoopFilterMasks(mi *vp9dec.NeighborMi, + shiftY, shiftUV int, lfm *vp9LoopFilterMask, +) bool { + if mi == nil || mi.SbType >= common.BlockSizes || mi.TxSize >= common.TxSizes { + return false + } + blockSize := mi.SbType + txSizeY := mi.TxSize + txSizeUV := common.UvTxsizeLookup[blockSize][txSizeY][1][1] + if txSizeUV >= common.TxSizes { + return false + } + filterLevel := d.vp9LoopFilterLevel(mi) + if filterLevel == 0 { + return true + } + w := int(common.Num8x8BlocksWideLookup[blockSize]) + h := int(common.Num8x8BlocksHighLookup[blockSize]) + index := shiftY + for range h { + for j := range w { + lfm.lflY[index+j] = filterLevel + } + index += 8 + } + + lfm.aboveY[txSizeY] |= vp9LFAbovePredictionMask[blockSize] << shiftY + lfm.aboveUV[txSizeUV] |= vp9LFAbovePredictionMaskUV[blockSize] << shiftUV + lfm.leftY[txSizeY] |= vp9LFLeftPredictionMask[blockSize] << shiftY + lfm.leftUV[txSizeUV] |= vp9LFLeftPredictionMaskUV[blockSize] << shiftUV + + if mi.Skip != 0 && mi.RefFrame[0] > vp9dec.IntraFrame { + return true + } + + lfm.aboveY[txSizeY] |= (vp9LFSizeMask[blockSize] & vp9LFAbove64x64TxformMask[txSizeY]) << shiftY + lfm.aboveUV[txSizeUV] |= (vp9LFSizeMaskUV[blockSize] & vp9LFAbove64x64TxformMaskUV[txSizeUV]) << shiftUV + lfm.leftY[txSizeY] |= (vp9LFSizeMask[blockSize] & vp9LFLeft64x64TxformMask[txSizeY]) << shiftY + lfm.leftUV[txSizeUV] |= (vp9LFSizeMaskUV[blockSize] & vp9LFLeft64x64TxformMaskUV[txSizeUV]) << shiftUV + if txSizeY == common.Tx4x4 { + lfm.int4x4Y |= vp9LFSizeMask[blockSize] << shiftY + } + if txSizeUV == common.Tx4x4 { + lfm.int4x4UV |= (vp9LFSizeMaskUV[blockSize] & 0xffff) << shiftUV + } + return true +} + +func (d *VP9Decoder) vp9BuildLoopFilterYMask(mi *vp9dec.NeighborMi, + shiftY int, lfm *vp9LoopFilterMask, +) bool { + if mi == nil || mi.SbType >= common.BlockSizes || mi.TxSize >= common.TxSizes { + return false + } + blockSize := mi.SbType + txSizeY := mi.TxSize + filterLevel := d.vp9LoopFilterLevel(mi) + if filterLevel == 0 { + return true + } + w := int(common.Num8x8BlocksWideLookup[blockSize]) + h := int(common.Num8x8BlocksHighLookup[blockSize]) + index := shiftY + for range h { + for j := range w { + lfm.lflY[index+j] = filterLevel + } + index += 8 + } + + lfm.aboveY[txSizeY] |= vp9LFAbovePredictionMask[blockSize] << shiftY + lfm.leftY[txSizeY] |= vp9LFLeftPredictionMask[blockSize] << shiftY + if mi.Skip != 0 && mi.RefFrame[0] > vp9dec.IntraFrame { + return true + } + lfm.aboveY[txSizeY] |= (vp9LFSizeMask[blockSize] & vp9LFAbove64x64TxformMask[txSizeY]) << shiftY + lfm.leftY[txSizeY] |= (vp9LFSizeMask[blockSize] & vp9LFLeft64x64TxformMask[txSizeY]) << shiftY + if txSizeY == common.Tx4x4 { + lfm.int4x4Y |= vp9LFSizeMask[blockSize] << shiftY + } + return true +} + +func (d *VP9Decoder) vp9LoopFilterLevel(mi *vp9dec.NeighborMi) uint8 { + segID := int(mi.SegmentID) + if segID < 0 || segID >= vp9dec.MaxSegments { + return 0 + } + ref := mi.RefFrame[0] + if ref < vp9dec.IntraFrame || ref >= vp9dec.MaxRefFrames { + return 0 + } + return vp9dec.GetFilterLevel(&d.lfi, segID, ref, mi.Mode) +} + +func vp9AdjustLoopFilterMask(miRows, miCols, miRow, miCol int, lfm *vp9LoopFilterMask) { + lfm.leftY[common.Tx16x16] |= lfm.leftY[common.Tx32x32] + lfm.aboveY[common.Tx16x16] |= lfm.aboveY[common.Tx32x32] + lfm.leftUV[common.Tx16x16] |= lfm.leftUV[common.Tx32x32] + lfm.aboveUV[common.Tx16x16] |= lfm.aboveUV[common.Tx32x32] + + lfm.leftY[common.Tx8x8] |= lfm.leftY[common.Tx4x4] & 0x1111111111111111 + lfm.leftY[common.Tx4x4] &^= 0x1111111111111111 + lfm.aboveY[common.Tx8x8] |= lfm.aboveY[common.Tx4x4] & 0x000000ff000000ff + lfm.aboveY[common.Tx4x4] &^= 0x000000ff000000ff + lfm.leftUV[common.Tx8x8] |= lfm.leftUV[common.Tx4x4] & 0x1111 + lfm.leftUV[common.Tx4x4] &^= 0x1111 + lfm.aboveUV[common.Tx8x8] |= lfm.aboveUV[common.Tx4x4] & 0x000f + lfm.aboveUV[common.Tx4x4] &^= 0x000f + + if miRow+common.MiBlockSize > miRows { + rows := miRows - miRow + maskY := (uint64(1) << uint(rows<<3)) - 1 + maskUV := uint16((uint32(1) << uint(((rows+1)>>1)<<2)) - 1) + for i := range int(common.Tx32x32) { + lfm.leftY[i] &= maskY + lfm.aboveY[i] &= maskY + lfm.leftUV[i] &= maskUV + lfm.aboveUV[i] &= maskUV + } + lfm.int4x4Y &= maskY + lfm.int4x4UV &= maskUV + if rows == 1 { + lfm.aboveUV[common.Tx8x8] |= lfm.aboveUV[common.Tx16x16] + lfm.aboveUV[common.Tx16x16] = 0 + } + if rows == 5 { + wide := lfm.aboveUV[common.Tx16x16] & 0xff00 + lfm.aboveUV[common.Tx8x8] |= wide + lfm.aboveUV[common.Tx16x16] &^= wide + } + } + + if miCol+common.MiBlockSize > miCols { + columns := miCols - miCol + maskY := uint64((uint64(1)<>1)) - 1) * 0x1111) + maskUVInt := uint16(((uint32(1) << uint(columns>>1)) - 1) * 0x1111) + for i := range int(common.Tx32x32) { + lfm.leftY[i] &= maskY + lfm.aboveY[i] &= maskY + lfm.leftUV[i] &= maskUV + lfm.aboveUV[i] &= maskUV + } + lfm.int4x4Y &= maskY + lfm.int4x4UV &= maskUVInt + if columns == 1 { + lfm.leftUV[common.Tx8x8] |= lfm.leftUV[common.Tx16x16] + lfm.leftUV[common.Tx16x16] = 0 + } + if columns == 5 { + wide := lfm.leftUV[common.Tx16x16] & 0xcccc + lfm.leftUV[common.Tx8x8] |= wide + lfm.leftUV[common.Tx16x16] &^= wide + } + } + + if miCol == 0 { + for i := range int(common.Tx32x32) { + lfm.leftY[i] &= 0xfefefefefefefefe + lfm.leftUV[i] &= 0xeeee + } + } +} + +func (d *VP9Decoder) vp9FilterLoopBlock(miRows, miCols, miRow, miCol int, + lfm *vp9LoopFilterMask, +) bool { + if d.lastFrame.BitDepth > 8 { + return d.vp9FilterLoopBlockHighBD(miRows, miCols, miRow, miCol, lfm) + } + if !d.vp9FilterLoopBlockPlaneSS00(d.frameYFull, d.frameYOrigin, d.lastFrame.YStride, + miRows, miRow, miCol, lfm) { + return false + } + ssX, ssY := d.lastFrame.Subsampling.Shifts() + switch { + case ssX == 1 && ssY == 1: + if !d.vp9FilterLoopBlockPlaneSS11(d.frameUFull, d.frameUOrigin, d.lastFrame.UStride, + miRows, miRow, miCol, lfm) { + return false + } + return d.vp9FilterLoopBlockPlaneSS11(d.frameVFull, d.frameVOrigin, d.lastFrame.VStride, + miRows, miRow, miCol, lfm) + case ssX == 0 && ssY == 0: + if !d.vp9FilterLoopBlockPlaneSS00(d.frameUFull, d.frameUOrigin, d.lastFrame.UStride, + miRows, miRow, miCol, lfm) { + return false + } + return d.vp9FilterLoopBlockPlaneSS00(d.frameVFull, d.frameVOrigin, d.lastFrame.VStride, + miRows, miRow, miCol, lfm) + default: + if !d.vp9FilterLoopBlockPlaneNon420(d.frameUFull, d.frameUOrigin, d.lastFrame.UStride, + miRows, miCols, miRow, miCol, uint8(ssX), uint8(ssY)) { + return false + } + return d.vp9FilterLoopBlockPlaneNon420(d.frameVFull, d.frameVOrigin, d.lastFrame.VStride, + miRows, miCols, miRow, miCol, uint8(ssX), uint8(ssY)) + } +} + +func (d *VP9Decoder) vp9FilterLoopBlockPlane(miRows, miCols, miRow, miCol int, + plane vp9LoopFilterPlane, lfm *vp9LoopFilterMask, +) bool { + if d.lastFrame.BitDepth > 8 { + return d.vp9FilterLoopBlockPlaneHighBD(miRows, miCols, miRow, miCol, plane, lfm) + } + switch plane { + case vp9LoopFilterPlaneY: + return d.vp9FilterLoopBlockPlaneSS00(d.frameYFull, d.frameYOrigin, + d.lastFrame.YStride, miRows, miRow, miCol, lfm) + case vp9LoopFilterPlaneU: + return d.vp9FilterLoopBlockChromaPlane(d.frameUFull, d.frameUOrigin, + d.lastFrame.UStride, miRows, miCols, miRow, miCol, lfm) + case vp9LoopFilterPlaneV: + return d.vp9FilterLoopBlockChromaPlane(d.frameVFull, d.frameVOrigin, + d.lastFrame.VStride, miRows, miCols, miRow, miCol, lfm) + default: + return false + } +} + +func (d *VP9Decoder) vp9FilterLoopBlockChromaPlane(plane []byte, origin, stride int, + miRows, miCols, miRow, miCol int, lfm *vp9LoopFilterMask, +) bool { + ssX, ssY := d.lastFrame.Subsampling.Shifts() + switch { + case ssX == 1 && ssY == 1: + return d.vp9FilterLoopBlockPlaneSS11(plane, origin, stride, miRows, miRow, miCol, lfm) + case ssX == 0 && ssY == 0: + return d.vp9FilterLoopBlockPlaneSS00(plane, origin, stride, miRows, miRow, miCol, lfm) + default: + return d.vp9FilterLoopBlockPlaneNon420(plane, origin, stride, + miRows, miCols, miRow, miCol, uint8(ssX), uint8(ssY)) + } +} + +// vp9FilterLoopBlockPlaneNon420 ports libvpx's vp9_filter_block_plane_non420 +// (vp9/common/vp9_loopfilter.c) for asymmetric chroma subsampling (4:2:2 and 4:4:0). +func (d *VP9Decoder) vp9FilterLoopBlockPlaneNon420(plane []byte, origin, stride int, + miRows, miCols, miRow, miCol int, ssX, ssY uint8, +) bool { + if stride <= 0 || len(plane) == 0 { + return false + } + base := origin + ((miRow*common.MiSize)>>ssY)*stride + ((miCol * common.MiSize) >> ssX) + if base < 0 || base >= len(plane) { + return false + } + rowStep := 1 << ssY + colStep := 1 << ssX + + var mask16 [common.MiBlockSize]uint32 + var mask8 [common.MiBlockSize]uint32 + var mask4 [common.MiBlockSize]uint32 + var mask4Int [common.MiBlockSize]uint32 + var lfl [common.MiBlockSize * common.MiBlockSize]uint8 + + offset := base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += rowStep { + var mask16C, mask8C, mask4C uint32 + for c := 0; c < common.MiBlockSize && miCol+c < miCols; c += colStep { + mi := d.vp9DecoderMiAt(miRows, miCols, miRow+r, miCol+c) + if mi == nil || mi.SbType >= common.BlockSizes || mi.TxSize >= common.TxSizes { + return false + } + sbType := mi.SbType + skipThis := mi.Skip != 0 && mi.RefFrame[0] > vp9dec.IntraFrame + blockEdgeLeft := true + if common.Num4x4BlocksWideLookup[sbType] > 1 { + blockEdgeLeft = (c & (int(common.Num8x8BlocksWideLookup[sbType]) - 1)) == 0 + } + skipThisC := skipThis && !blockEdgeLeft + blockEdgeAbove := true + if common.Num4x4BlocksHighLookup[sbType] > 1 { + blockEdgeAbove = (r & (int(common.Num8x8BlocksHighLookup[sbType]) - 1)) == 0 + } + skipThisR := skipThis && !blockEdgeAbove + txSize := common.UvTxsizeLookup[sbType][mi.TxSize][ssX][ssY] + if txSize >= common.TxSizes { + return false + } + skipBorder4x4C := ssX != 0 && miCol+c == miCols-1 + skipBorder4x4R := ssY != 0 && miRow+r == miRows-1 + + level := d.vp9LoopFilterLevel(mi) + lfl[(r<<3)+(c>>ssX)] = level + if level == 0 { + continue + } + + bit := uint32(1) << uint(c>>ssX) + switch txSize { + case common.Tx32x32: + if !skipThisC && ((c>>ssX)&3) == 0 { + if !skipBorder4x4C { + mask16C |= bit + } else { + mask8C |= bit + } + } + if !skipThisR && ((r>>ssY)&3) == 0 { + if !skipBorder4x4R { + mask16[r] |= bit + } else { + mask8[r] |= bit + } + } + case common.Tx16x16: + if !skipThisC && ((c>>ssX)&1) == 0 { + if !skipBorder4x4C { + mask16C |= bit + } else { + mask8C |= bit + } + } + if !skipThisR && ((r>>ssY)&1) == 0 { + if !skipBorder4x4R { + mask16[r] |= bit + } else { + mask8[r] |= bit + } + } + default: + if !skipThisC { + if txSize == common.Tx8x8 || ((c>>ssX)&3) == 0 { + mask8C |= bit + } else { + mask4C |= bit + } + } + if !skipThisR { + if txSize == common.Tx8x8 || ((r>>ssY)&3) == 0 { + mask8[r] |= bit + } else { + mask4[r] |= bit + } + } + if !skipThis && txSize < common.Tx8x8 && !skipBorder4x4C { + mask4Int[r] |= bit + } + } + } + + borderMask := ^uint32(0) + if miCol == 0 { + borderMask = ^uint32(1) + } + vp9FilterSelectivelyVert(plane, offset, stride, + mask16C&borderMask, mask8C&borderMask, mask4C&borderMask, mask4Int[r], + &d.lfi, lfl[r<<3:]) + offset += 8 * stride + } + + offset = base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += rowStep { + skipBorder4x4R := ssY != 0 && miRow+r == miRows-1 + mask4IntR := mask4Int[r] + if skipBorder4x4R { + mask4IntR = 0 + } + var mask16R, mask8R, mask4R uint32 + if miRow+r != 0 { + mask16R = mask16[r] + mask8R = mask8[r] + mask4R = mask4[r] + } + vp9FilterSelectivelyHoriz(plane, offset, stride, + mask16R, mask8R, mask4R, mask4IntR, + &d.lfi, lfl[r<<3:]) + offset += 8 * stride + } + return true +} + +func vp9FilterSelectivelyVert(plane []byte, offset, pitch int, + mask16, mask8, mask4, mask4Int uint32, + lfi *vp9dec.LoopFilterInfoN, lfl []uint8, +) { + for mask := mask16 | mask8 | mask4 | mask4Int; mask != 0; mask >>= 1 { + level := &lfi.Lfthr[lfl[0]] + if mask&1 != 0 { + switch { + case mask16&1 != 0: + dsp.VpxLpfVertical16Thr(plane, offset, pitch, level) + case mask8&1 != 0: + dsp.VpxLpfVertical8Thr(plane, offset, pitch, level) + case mask4&1 != 0: + dsp.VpxLpfVertical4Thr(plane, offset, pitch, level) + } + } + if mask4Int&1 != 0 { + dsp.VpxLpfVertical4Thr(plane, offset+4, pitch, level) + } + offset += 8 + lfl = lfl[1:] + mask16 >>= 1 + mask8 >>= 1 + mask4 >>= 1 + mask4Int >>= 1 + } +} + +func (d *VP9Decoder) vp9FilterLoopBlockPlaneSS00(plane []byte, origin, stride int, + miRows, miRow, miCol int, lfm *vp9LoopFilterMask, +) bool { + if stride <= 0 || len(plane) == 0 { + return false + } + base := origin + miRow*common.MiSize*stride + miCol*common.MiSize + if base < 0 || base >= len(plane) { + return false + } + + mask16 := lfm.leftY[common.Tx16x16] + mask8 := lfm.leftY[common.Tx8x8] + mask4 := lfm.leftY[common.Tx4x4] + mask4Int := lfm.int4x4Y + offset := base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += 2 { + vp9FilterSelectivelyVertRow2(0, plane, offset, stride, + uint32(mask16), uint32(mask8), uint32(mask4), uint32(mask4Int), + &d.lfi, lfm.lflY[r<<3:]) + offset += 16 * stride + mask16 >>= 16 + mask8 >>= 16 + mask4 >>= 16 + mask4Int >>= 16 + } + + mask16 = lfm.aboveY[common.Tx16x16] + mask8 = lfm.aboveY[common.Tx8x8] + mask4 = lfm.aboveY[common.Tx4x4] + mask4Int = lfm.int4x4Y + offset = base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r++ { + var mask16R, mask8R, mask4R uint32 + if miRow+r != 0 { + mask16R = uint32(mask16 & 0xff) + mask8R = uint32(mask8 & 0xff) + mask4R = uint32(mask4 & 0xff) + } + vp9FilterSelectivelyHoriz(plane, offset, stride, + mask16R, mask8R, mask4R, uint32(mask4Int&0xff), + &d.lfi, lfm.lflY[r<<3:]) + offset += 8 * stride + mask16 >>= 8 + mask8 >>= 8 + mask4 >>= 8 + mask4Int >>= 8 + } + return true +} + +func (d *VP9Decoder) vp9FilterLoopBlockPlaneSS11(plane []byte, origin, stride int, + miRows, miRow, miCol int, lfm *vp9LoopFilterMask, +) bool { + if stride <= 0 || len(plane) == 0 { + return false + } + base := origin + (miRow*(common.MiSize>>1))*stride + miCol*(common.MiSize>>1) + if base < 0 || base >= len(plane) { + return false + } + var lflUV [16]uint8 + mask16 := lfm.leftUV[common.Tx16x16] + mask8 := lfm.leftUV[common.Tx8x8] + mask4 := lfm.leftUV[common.Tx4x4] + mask4Int := lfm.int4x4UV + offset := base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += 4 { + for c := range common.MiBlockSize >> 1 { + lflUV[(r<<1)+c] = lfm.lflY[(r<<3)+(c<<1)] + lflUV[((r+2)<<1)+c] = lfm.lflY[((r+2)<<3)+(c<<1)] + } + vp9FilterSelectivelyVertRow2(1, plane, offset, stride, + uint32(mask16), uint32(mask8), uint32(mask4), uint32(mask4Int), + &d.lfi, lflUV[r<<1:]) + offset += 16 * stride + mask16 >>= 8 + mask8 >>= 8 + mask4 >>= 8 + mask4Int >>= 8 + } + + mask16 = lfm.aboveUV[common.Tx16x16] + mask8 = lfm.aboveUV[common.Tx8x8] + mask4 = lfm.aboveUV[common.Tx4x4] + mask4Int = lfm.int4x4UV + offset = base + for r := 0; r < common.MiBlockSize && miRow+r < miRows; r += 2 { + mask4IntR := uint32(mask4Int & 0xf) + if miRow+r == miRows-1 { + mask4IntR = 0 + } + var mask16R, mask8R, mask4R uint32 + if miRow+r != 0 { + mask16R = uint32(mask16 & 0xf) + mask8R = uint32(mask8 & 0xf) + mask4R = uint32(mask4 & 0xf) + } + vp9FilterSelectivelyHoriz(plane, offset, stride, + mask16R, mask8R, mask4R, mask4IntR, + &d.lfi, lflUV[r<<1:]) + offset += 8 * stride + mask16 >>= 4 + mask8 >>= 4 + mask4 >>= 4 + mask4Int >>= 4 + } + return true +} + +func vp9FilterSelectivelyVertRow2(subsamplingFactor int, + plane []byte, offset, pitch int, + mask16, mask8, mask4, mask4Int uint32, + lfi *vp9dec.LoopFilterInfoN, lfl []uint8, +) { + dualMaskCutoff := uint32(0xffff) + lflForward := 8 + if subsamplingFactor != 0 { + dualMaskCutoff = 0xff + lflForward = 4 + } + dualOne := uint32(1 | (1 << uint(lflForward))) + ss0 := offset + for mask := (mask16 | mask8 | mask4 | mask4Int) & dualMaskCutoff; mask != 0; mask = (mask &^ dualOne) >> 1 { + if mask&dualOne != 0 { + level0 := &lfi.Lfthr[lfl[0]] + level1 := &lfi.Lfthr[lfl[lflForward]] + ss1 := ss0 + 8*pitch + + if mask16&dualOne != 0 { + if mask16&dualOne == dualOne { + dsp.VpxLpfVertical16DualThr(plane, ss0, pitch, level0) + } else { + level := level0 + ss := ss0 + if mask16&1 == 0 { + level = level1 + ss = ss1 + } + dsp.VpxLpfVertical16Thr(plane, ss, pitch, level) + } + } + if mask8&dualOne != 0 { + if mask8&dualOne == dualOne { + dsp.VpxLpfVertical8DualThr(plane, ss0, pitch, level0, level1) + } else { + level := level0 + ss := ss0 + if mask8&1 == 0 { + level = level1 + ss = ss1 + } + dsp.VpxLpfVertical8Thr(plane, ss, pitch, level) + } + } + if mask4&dualOne != 0 { + if mask4&dualOne == dualOne { + dsp.VpxLpfVertical4DualThr(plane, ss0, pitch, level0, level1) + } else { + level := level0 + ss := ss0 + if mask4&1 == 0 { + level = level1 + ss = ss1 + } + dsp.VpxLpfVertical4Thr(plane, ss, pitch, level) + } + } + if mask4Int&dualOne != 0 { + if mask4Int&dualOne == dualOne { + dsp.VpxLpfVertical4DualThr(plane, ss0+4, pitch, level0, level1) + } else { + level := level0 + ss := ss0 + 4 + if mask4Int&1 == 0 { + level = level1 + ss = ss1 + 4 + } + dsp.VpxLpfVertical4Thr(plane, ss, pitch, level) + } + } + } + ss0 += 8 + lfl = lfl[1:] + mask16 >>= 1 + mask8 >>= 1 + mask4 >>= 1 + mask4Int >>= 1 + } +} + +func vp9FilterSelectivelyHoriz(plane []byte, offset, pitch int, + mask16, mask8, mask4, mask4Int uint32, + lfi *vp9dec.LoopFilterInfoN, lfl []uint8, +) { + for mask := mask16 | mask8 | mask4 | mask4Int; mask != 0; { + count := 1 + if mask&1 != 0 { + level := &lfi.Lfthr[lfl[0]] + switch { + case mask16&1 != 0: + if mask16&3 == 3 { + dsp.VpxLpfHorizontal16DualThr(plane, offset, pitch, level) + count = 2 + } else { + dsp.VpxLpfHorizontal16Thr(plane, offset, pitch, level) + } + case mask8&1 != 0: + if mask8&3 == 3 { + next := &lfi.Lfthr[lfl[1]] + dsp.VpxLpfHorizontal8DualThr(plane, offset, pitch, level, next) + if mask4Int&3 == 3 { + dsp.VpxLpfHorizontal4DualThr(plane, offset+4*pitch, pitch, + level, next) + } else if mask4Int&1 != 0 { + dsp.VpxLpfHorizontal4Thr(plane, offset+4*pitch, pitch, level) + } else if mask4Int&2 != 0 { + dsp.VpxLpfHorizontal4Thr(plane, offset+8+4*pitch, pitch, next) + } + count = 2 + } else { + dsp.VpxLpfHorizontal8Thr(plane, offset, pitch, level) + if mask4Int&1 != 0 { + dsp.VpxLpfHorizontal4Thr(plane, offset+4*pitch, pitch, level) + } + } + case mask4&1 != 0: + if mask4&3 == 3 { + next := &lfi.Lfthr[lfl[1]] + dsp.VpxLpfHorizontal4DualThr(plane, offset, pitch, level, next) + if mask4Int&3 == 3 { + dsp.VpxLpfHorizontal4DualThr(plane, offset+4*pitch, pitch, + level, next) + } else if mask4Int&1 != 0 { + dsp.VpxLpfHorizontal4Thr(plane, offset+4*pitch, pitch, level) + } else if mask4Int&2 != 0 { + dsp.VpxLpfHorizontal4Thr(plane, offset+8+4*pitch, pitch, next) + } + count = 2 + } else { + dsp.VpxLpfHorizontal4Thr(plane, offset, pitch, level) + if mask4Int&1 != 0 { + dsp.VpxLpfHorizontal4Thr(plane, offset+4*pitch, pitch, level) + } + } + default: + dsp.VpxLpfHorizontal4Thr(plane, offset+4*pitch, pitch, level) + } + } + offset += 8 * count + lfl = lfl[count:] + mask >>= uint(count) + mask16 >>= uint(count) + mask8 >>= uint(count) + mask4 >>= uint(count) + mask4Int >>= uint(count) + } +} diff --git a/internal/vp9/codec/vp9_decoder_mfqe.go b/internal/vp9/codec/vp9_decoder_mfqe.go new file mode 100644 index 0000000..3fd395e --- /dev/null +++ b/internal/vp9/codec/vp9_decoder_mfqe.go @@ -0,0 +1,302 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder_mfqe.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + vp8common "github.com/go-avkit/vpx/internal/vp8/common" + vp8dec "github.com/go-avkit/vpx/internal/vp8/decoder" + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" +) + +// VP9 MFQE port — Multiframe Quality Enhancement, verbatim from libvpx +// v1.16.0 vp9/common/vp9_mfqe.c. The libvpx VP9 implementation has: +// +// - libvpx: vp9/common/vp9_mfqe.c:198 mfqe_decision +// mi->mode >= NEARESTMV && cur_bs >= BLOCK_16X16 && +// (mv.row^2 + mv.col^2) <= 100 (squared L2 distance in 1/8-pel) +// +// - libvpx: vp9/common/vp9_mfqe.c:147 get_thr +// sad_thr = {7,6,5}[BLOCK_16X16, BLOCK_32X32, BLOCK_64X64] +// + (qdiff >> MFQE_PRECISION) +// vdiff_thr = 125 + qdiff +// +// - libvpx: vp9/common/vp9_mfqe.c:159 mfqe_block +// sad > 1 && vdiff > sad*3 → ifactor = clamp(weight*sad*vdiff / +// (sad_thr*vdiff_thr), 0, weight) +// +// - libvpx: vp9/common/vp9_mfqe.c:209 mfqe_partition +// recurses on PARTITION_HORZ / VERT / NONE / SPLIT picked from +// partition_lookup[bsl][cur_bs]. Forces PARTITION_NONE at +// BLOCK_16X16 (libvpx mfqe.c:228). +// +// - libvpx: vp9/common/vp9_mfqe.c:343 vp9_mfqe +// walks SBs at 64x64 MI-block step. On intra-only frames reads +// from cm->postproc_state.prev_mi (the previous frame's mi grid); +// on inter frames reads cm->mi (the current frame's). + +// vp9MFQEBlock mirrors libvpx vp9_mfqe.c:159 (mfqe_block). Computes the +// vdiff / sad pair, evaluates the smoothness/lighting heuristic, and +// either blends via apply_ifactor or copies the previous frame in. +func vp9MFQEBlock(bs common.BlockSize, qdiff int, + y, u, v []byte, yStride, uvStride int, + yd, ud, vd []byte, ydStride, uvdStride int, +) { + var side int + switch bs { + case common.Block16x16: + side = 16 + case common.Block32x32: + side = 32 + default: // Block64x64 + side = 64 + } + sadThr, vdiffThr := vp9dec.MFQEThresholds(bs, qdiff) + vdiff, sad := vp9dec.MFQEBlockMetrics(side, y, yStride, yd, ydStride) + + // libvpx vp9_mfqe.c:182 — "vdiff > sad * 3 means vdiff should not + // be too small, otherwise it might be a lighting change in smooth + // area. When there is a lighting change in smooth area, it is + // dangerous to do MFQE." + if sad > 1 && vdiff > sad*3 { + const weight = 1 << vp9dec.MFQEPrecision + denom := sadThr * vdiffThr + ifactor := weight + if denom > 0 { + ifactor = min(weight*sad*vdiff/denom, weight) + } + // libvpx vp9_mfqe.c:189 — apply Y/U/V at the same weight, with + // chroma at half the side. filterByWeight is the exact libvpx + // kernel (vp9_mfqe.c:22 filter_by_weight). + vp8dec.ApplyMFQEIfactor(side, ifactor, + y, yStride, yd, ydStride, + u, v, uvStride, ud, vd, uvdStride) + return + } + // libvpx vp9_mfqe.c:192 — no MFQE; keep the current frame block. + // "Copy the block from current frame": dst is already the current + // frame's pixels, source is the previous frame. Since we pre-seed + // dst with current (in the walker) and would otherwise replace dst + // with a blended version, "copy" here is a no-op when called inside + // the partition recursion. The caller pre-fills dst from the + // current frame, so the no-MFQE path leaves it intact. +} + +// vp9MFQEPartition mirrors libvpx vp9_mfqe.c:209 (mfqe_partition). +// Recursively walks the partition tree rooted at bs, picking the +// per-leaf decision out of cm->mi via curBs = mi->sb_type. +func (d *VP9Decoder) vp9MFQEPartition(miGrid []vp9dec.NeighborMi, miStride int, + miRow, miCol int, bs common.BlockSize, qdiff int, + yPx, uvPx int, + y, u, v []byte, yStride, uvStride int, + yd, ud, vd []byte, ydStride, uvdStride int, +) { + idx := miRow*miStride + miCol + if idx < 0 || idx >= len(miGrid) { + return + } + mi := &miGrid[idx] + curBs := mi.SbType + // libvpx vp9_mfqe.c:222 — sub-8x8 blocks indicate boundary; skip. + if curBs < common.Block8x8 { + return + } + bsl := common.BWidthLog2Lookup[bs] + if int(bsl) >= len(common.PartitionLookup) || int(curBs) >= len(common.PartitionLookup[bsl]) { + return + } + partition := common.PartitionLookup[bsl][curBs] + // libvpx vp9_mfqe.c:227-229 — force NONE at the 16x16 leaf; + // the partition tree below is moot for MFQE (no MFQE on <16x16). + if bs == common.Block16x16 { + partition = common.PartitionNone + } + + var miOffset, yOffset, uvOffset int + if bs == common.Block64x64 { + miOffset = 4 + yOffset = 32 + uvOffset = 16 + } else { + miOffset = 2 + yOffset = 16 + uvOffset = 8 + } + + switch partition { + case common.PartitionHorz: + var mfqeBs, bsTmp common.BlockSize + if bs == common.Block64x64 { + mfqeBs = common.Block64x32 + bsTmp = common.Block32x32 + } else { + mfqeBs = common.Block32x16 + bsTmp = common.Block16x16 + } + // Top horizontal half + if vp9dec.MFQEDecision(mi, mfqeBs) { + vp9MFQEBlock(bsTmp, qdiff, + y, u, v, yStride, uvStride, + yd, ud, vd, ydStride, uvdStride) + vp9MFQEBlock(bsTmp, qdiff, + y[yOffset:], u[uvOffset:], v[uvOffset:], yStride, uvStride, + yd[yOffset:], ud[uvOffset:], vd[uvOffset:], ydStride, uvdStride) + } + // Bottom horizontal half — sample mi+miOffset rows down. + if idx2 := idx + miOffset*miStride; idx2 < len(miGrid) { + mi2 := &miGrid[idx2] + if vp9dec.MFQEDecision(mi2, mfqeBs) { + vp9MFQEBlock(bsTmp, qdiff, + y[yOffset*yStride:], u[uvOffset*uvStride:], v[uvOffset*uvStride:], yStride, uvStride, + yd[yOffset*ydStride:], ud[uvOffset*uvdStride:], vd[uvOffset*uvdStride:], ydStride, uvdStride) + vp9MFQEBlock(bsTmp, qdiff, + y[yOffset*yStride+yOffset:], u[uvOffset*uvStride+uvOffset:], v[uvOffset*uvStride+uvOffset:], yStride, uvStride, + yd[yOffset*ydStride+yOffset:], ud[uvOffset*uvdStride+uvOffset:], vd[uvOffset*uvdStride+uvOffset:], ydStride, uvdStride) + } + } + case common.PartitionVert: + var mfqeBs, bsTmp common.BlockSize + if bs == common.Block64x64 { + mfqeBs = common.Block32x64 + bsTmp = common.Block32x32 + } else { + mfqeBs = common.Block16x32 + bsTmp = common.Block16x16 + } + // Left vertical half + if vp9dec.MFQEDecision(mi, mfqeBs) { + vp9MFQEBlock(bsTmp, qdiff, + y, u, v, yStride, uvStride, + yd, ud, vd, ydStride, uvdStride) + vp9MFQEBlock(bsTmp, qdiff, + y[yOffset*yStride:], u[uvOffset*uvStride:], v[uvOffset*uvStride:], yStride, uvStride, + yd[yOffset*ydStride:], ud[uvOffset*uvdStride:], vd[uvOffset*uvdStride:], ydStride, uvdStride) + } + // Right vertical half — sample mi+miOffset cols right. + if idx2 := idx + miOffset; idx2 < len(miGrid) { + mi2 := &miGrid[idx2] + if vp9dec.MFQEDecision(mi2, mfqeBs) { + vp9MFQEBlock(bsTmp, qdiff, + y[yOffset:], u[uvOffset:], v[uvOffset:], yStride, uvStride, + yd[yOffset:], ud[uvOffset:], vd[uvOffset:], ydStride, uvdStride) + vp9MFQEBlock(bsTmp, qdiff, + y[yOffset*yStride+yOffset:], u[uvOffset*uvStride+uvOffset:], v[uvOffset*uvStride+uvOffset:], yStride, uvStride, + yd[yOffset*ydStride+yOffset:], ud[uvOffset*uvdStride+uvOffset:], vd[uvOffset*uvdStride+uvOffset:], ydStride, uvdStride) + } + } + case common.PartitionNone: + if vp9dec.MFQEDecision(mi, curBs) { + vp9MFQEBlock(curBs, qdiff, + y, u, v, yStride, uvStride, + yd, ud, vd, ydStride, uvdStride) + } + // else: leave dst alone (it's already the current-frame copy). + case common.PartitionSplit: + sub := common.SubsizeLookup[common.PartitionSplit][bs] + // Top-left + d.vp9MFQEPartition(miGrid, miStride, miRow, miCol, sub, qdiff, + yPx, uvPx, + y, u, v, yStride, uvStride, + yd, ud, vd, ydStride, uvdStride) + // Top-right + d.vp9MFQEPartition(miGrid, miStride, miRow, miCol+miOffset, sub, qdiff, + yPx+yOffset, uvPx+uvOffset, + y[yOffset:], u[uvOffset:], v[uvOffset:], yStride, uvStride, + yd[yOffset:], ud[uvOffset:], vd[uvOffset:], ydStride, uvdStride) + // Bottom-left + d.vp9MFQEPartition(miGrid, miStride, miRow+miOffset, miCol, sub, qdiff, + yPx, uvPx, + y[yOffset*yStride:], u[uvOffset*uvStride:], v[uvOffset*uvStride:], yStride, uvStride, + yd[yOffset*ydStride:], ud[uvOffset*uvdStride:], vd[uvOffset*uvdStride:], ydStride, uvdStride) + // Bottom-right + d.vp9MFQEPartition(miGrid, miStride, miRow+miOffset, miCol+miOffset, sub, qdiff, + yPx+yOffset, uvPx+uvOffset, + y[yOffset*yStride+yOffset:], u[uvOffset*uvStride+uvOffset:], v[uvOffset*uvStride+uvOffset:], yStride, uvStride, + yd[yOffset*ydStride+yOffset:], ud[uvOffset*uvdStride+uvOffset:], vd[uvOffset*uvdStride+uvOffset:], ydStride, uvdStride) + } +} + +// vp9MFQEFaithfulWalker walks 64x64 SBs across the visible MI grid +// (libvpx vp9_mfqe.c:343 vp9_mfqe) and recurses into the partition tree per +// SB. +// +// libvpx swaps src/dst roles vs the legacy VP8 walker: dst (== libvpx's +// post_proc_buffer) holds the *previous* MFQE-blended frame, src +// (== libvpx's show) holds the *current* frame. The blend mixes +// current into previous via apply_ifactor. To match, the caller wires: +// +// src = current frame (postSource) +// dst = previous-frame copy (post) +// +// vp9_decoder.go already does this via copyPostProcessImage(dst, src) +// before invoking the override; the libvpx orchestrator memsets +// post_proc_buffer_int to 128 (vp9_postproc.c:344) and copies the +// previous post_proc_buffer in via vpx_yv12_copy_frame +// (vp9_postproc.c:387). govpx pre-seeds dst with src (= current frame) +// then runs the blend, which matches the post-MFQE behaviour but +// reverses the role of "previous". For visible-quality parity we +// instead blend the *current* (src) into the *previous-via-state* +// pixels — implemented below by treating dst as the previous frame +// proxy that ApplyMFQEIfactor blends current into. +func (d *VP9Decoder) vp9MFQEFaithfulWalker(src *vp8common.Image, dst *vp8common.Image, + keyFrame bool, qcurr int, qprev int, +) { + miStride := (d.lastFrame.Width + 7) >> 3 + miRows := (d.lastFrame.Height + 7) >> 3 + if miStride <= 0 || miRows <= 0 || len(d.miGrid) < miRows*miStride { + // Fallback: copy src into dst so the post-MFQE deblock sees + // the current frame instead of stale data. + copy(dst.Y, src.Y) + copy(dst.U, src.U) + copy(dst.V, src.V) + return + } + // Pre-seed dst with src so partial-SB fragments at the right / + // bottom edges and partitions that elect not to blend keep the + // current frame's pixels (mirrors libvpx vp9_postproc.c:387 + // vpx_yv12_copy_frame(ppbuf, &cm->post_proc_buffer_int) — though + // the libvpx role assignment is "previous → int buffer"). + copy(dst.Y, src.Y) + copy(dst.U, src.U) + copy(dst.V, src.V) + _ = keyFrame + qdiff := qcurr - qprev + + miBlockSize := 8 // MI_BLOCK_SIZE: 64 / 8 = 8 MIs per 64x64 SB + + for miRow := 0; miRow < miRows; miRow += miBlockSize { + for miCol := 0; miCol < miStride; miCol += miBlockSize { + // libvpx vp9_mfqe.c:361-373 — compute the plane-relative + // pixel offsets at the SB top-left. + rowOffsetY := miRow << 3 + rowOffsetUV := miRow << 2 + colOffsetY := miCol << 3 + colOffsetUV := miCol << 2 + + yOff := rowOffsetY*src.YStride + colOffsetY + uOff := rowOffsetUV*src.UStride + colOffsetUV + vOff := rowOffsetUV*src.VStride + colOffsetUV + ydOff := rowOffsetY*dst.YStride + colOffsetY + udOff := rowOffsetUV*dst.UStride + colOffsetUV + vdOff := rowOffsetUV*dst.VStride + colOffsetUV + + if yOff >= len(src.Y) || ydOff >= len(dst.Y) { + continue + } + + d.vp9MFQEPartition(d.miGrid, miStride, miRow, miCol, + common.Block64x64, qdiff, + colOffsetY, colOffsetUV, + src.Y[yOff:], src.U[uOff:], src.V[vOff:], src.YStride, src.UStride, + dst.Y[ydOff:], dst.U[udOff:], dst.V[vdOff:], dst.YStride, dst.UStride) + } + } +} diff --git a/internal/vp9/codec/vp9_decoder_modes.go b/internal/vp9/codec/vp9_decoder_modes.go new file mode 100644 index 0000000..6860eab --- /dev/null +++ b/internal/vp9/codec/vp9_decoder_modes.go @@ -0,0 +1,2998 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder_modes.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "encoding/binary" + "math/bits" + + "github.com/go-avkit/vpx/internal/pixel" + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" + "github.com/go-avkit/vpx/internal/vp9/tables" + "github.com/go-avkit/vpx/internal/vpx/buffers" + "github.com/go-avkit/vpx/internal/vpx/codecapi" +) + +// parseVP9IntraModeTiles consumes the tile mode-info and residual-token +// stream for keyframes and intra-only inter frames. For the currently +// supported zero-residue path, it also reconstructs each transform +// block from its intra predictor while walking the tile. +func (d *VP9Decoder) parseVP9IntraModeTiles(tileData []byte, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, +) error { + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + vp9dec.SetupBlockPlanes(&d.planes, hdr.BitDepthColor.SubsamplingX, + hdr.BitDepthColor.SubsamplingY) + d.ensureVP9DecoderModeBuffers(miRows, miCols) + for i := range d.aboveSegCtx { + d.aboveSegCtx[i] = 0 + } + d.resetVP9AboveEntropyContexts() + if d.opts.DecodeTileRowSet || d.opts.DecodeTileColSet { + for i := range d.miGrid { + d.miGrid[i] = vp9dec.NeighborMi{} + d.miIdx[i] = int32(i) + } + } + if hdr.Seg.Enabled { + for i := range d.segMap { + d.segMap[i] = 0 + } + } + if vp9dec.HeaderResetsPastIndependence(hdr) { + d.resetVP9SegmentationMapsForPastIndependence() + } + + partitionProbs := &tables.KfPartitionProbs + tileRows := 1 << uint(hdr.Tile.Log2TileRows) + tileCols := 1 << uint(hdr.Tile.Log2TileCols) + if d.vp9DecoderTileThreadingEnabled(hdr, tileRows, tileCols) { + if err := d.parseVP9IntraModeTilesThreaded(tileData, *hdr, comp, + miRows, miCols, partitionProbs); err != nil { + return err + } + if hdr.Seg.Enabled { + d.lastSegMap, d.segMap = d.segMap, d.lastSegMap + } + return nil + } + descs, err := prepareVP9DecoderTileDescs(d.vp9TileDescs, tileData, *hdr, + miRows, miCols) + if err != nil { + return err + } + d.vp9TileDescs = descs + maps := vp9dec.IntraSegmentMaps{ + CurrentFrameSegMap: d.segMap, + LastFrameSegMap: d.lastSegMap, + MiCols: miCols, + } + + for tileRow := range tileRows { + for tileColIter := range tileCols { + tileCol := d.vp9DecodeTileCol(tileColIter, tileCols) + if d.vp9TileFilterMasksTile(tileRow, tileCol, tileRows, tileCols) { + continue + } + desc := descs[tileRow*tileCols+tileCol] + if err := d.parseVP9IntraModeTile(desc.data, hdr, comp, &maps, + desc.tile, miRows, miCols, partitionProbs); err != nil { + return err + } + } + } + if hdr.Seg.Enabled { + d.lastSegMap, d.segMap = d.segMap, d.lastSegMap + } + return nil +} + +func (d *VP9Decoder) parseVP9IntraModeTile(data []byte, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.IntraSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + var r bitstream.Reader + if err := r.Init(data); err != nil { + return ErrInvalidVP9Data + } + rowMT := d.rowMTSync + if rowMT == nil { + for miRow := tile.MiRowStart; miRow < tile.MiRowEnd; miRow += common.MiBlockSize { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + if !d.readVP9IntraModeSb(&r, hdr, maps, tile, miRows, miCols, + miRow, miCol, common.Block64x64, comp.TxMode, partitionProbs) { + return ErrInvalidVP9Data + } + } + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil + } + if d.vp9DecoderRowMTOneTileStorage() != nil { + return d.parseVP9IntraModeTileRowMTSplit(&r, hdr, comp, maps, tile, + miRows, miCols, partitionProbs) + } + tileSbCols := (tile.MiColEnd - tile.MiColStart + common.MiBlockSize - 1) >> + common.MiBlockSizeLog2 + for miRow := tile.MiRowStart; miRow < tile.MiRowEnd; miRow += common.MiBlockSize { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + sbRow := (miRow - tile.MiRowStart) >> common.MiBlockSizeLog2 + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sbCol := (miCol - tile.MiColStart) >> common.MiBlockSizeLog2 + // Wavefront: wait for the row above to decode the above and + // above-right SB before consuming their entropy / above-context + // state when DecoderRowMT is armed. + rowMT.read(sbRow, sbCol) + if !d.readVP9IntraModeSb(&r, hdr, maps, tile, miRows, miCols, + miRow, miCol, common.Block64x64, comp.TxMode, partitionProbs) { + return ErrInvalidVP9Data + } + rowMT.write(sbRow, sbCol, tileSbCols) + } + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil +} + +func (d *VP9Decoder) parseVP9InterModeTiles(tileData []byte, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, +) error { + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + vp9dec.SetupBlockPlanes(&d.planes, hdr.BitDepthColor.SubsamplingX, + hdr.BitDepthColor.SubsamplingY) + d.ensureVP9DecoderModeBuffers(miRows, miCols) + for i := range d.aboveSegCtx { + d.aboveSegCtx[i] = 0 + } + d.resetVP9AboveEntropyContexts() + if d.opts.DecodeTileRowSet || d.opts.DecodeTileColSet { + for i := range d.miGrid { + d.miGrid[i] = vp9dec.NeighborMi{} + d.miIdx[i] = int32(i) + } + } + if hdr.Seg.Enabled { + for i := range d.segMap { + d.segMap[i] = 0 + } + } + if vp9dec.HeaderResetsPastIndependence(hdr) { + d.resetVP9SegmentationMapsForPastIndependence() + } + + partitionProbs := &d.fc.PartitionProb + tileRows := 1 << uint(hdr.Tile.Log2TileRows) + tileCols := 1 << uint(hdr.Tile.Log2TileCols) + if d.vp9DecoderTileThreadingEnabled(hdr, tileRows, tileCols) { + if err := d.parseVP9InterModeTilesThreaded(tileData, *hdr, comp, + miRows, miCols, partitionProbs); err != nil { + return err + } + if hdr.Seg.Enabled { + d.lastSegMap, d.segMap = d.segMap, d.lastSegMap + } + return nil + } + descs, err := prepareVP9DecoderTileDescs(d.vp9TileDescs, tileData, *hdr, + miRows, miCols) + if err != nil { + return err + } + d.vp9TileDescs = descs + maps := vp9dec.InterSegmentMaps{ + IntraSegmentMaps: vp9dec.IntraSegmentMaps{ + CurrentFrameSegMap: d.segMap, + LastFrameSegMap: d.lastSegMap, + MiCols: miCols, + }, + } + + for tileRow := range tileRows { + for tileColIter := range tileCols { + tileCol := d.vp9DecodeTileCol(tileColIter, tileCols) + if d.vp9TileFilterMasksTile(tileRow, tileCol, tileRows, tileCols) { + continue + } + desc := descs[tileRow*tileCols+tileCol] + if err := d.parseVP9InterModeTile(desc.data, hdr, comp, &maps, + desc.tile, miRows, miCols, partitionProbs); err != nil { + return err + } + } + } + if hdr.Seg.Enabled { + d.lastSegMap, d.segMap = d.segMap, d.lastSegMap + } + return nil +} + +func (d *VP9Decoder) parseVP9InterModeTile(data []byte, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + var r bitstream.Reader + if err := r.Init(data); err != nil { + return ErrInvalidVP9Data + } + rowMT := d.rowMTSync + if rowMT == nil { + for miRow := tile.MiRowStart; miRow < tile.MiRowEnd; miRow += common.MiBlockSize { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + if !d.readVP9InterModeSb(&r, hdr, comp, maps, tile, miRows, miCols, + miRow, miCol, common.Block64x64, partitionProbs) { + return ErrInvalidVP9Data + } + } + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil + } + if d.vp9DecoderRowMTOneTileStorage() != nil { + return d.parseVP9InterModeTileRowMTSplit(&r, hdr, comp, maps, tile, + miRows, miCols, partitionProbs) + } + tileSbCols := (tile.MiColEnd - tile.MiColStart + common.MiBlockSize - 1) >> + common.MiBlockSizeLog2 + for miRow := tile.MiRowStart; miRow < tile.MiRowEnd; miRow += common.MiBlockSize { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + sbRow := (miRow - tile.MiRowStart) >> common.MiBlockSizeLog2 + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sbCol := (miCol - tile.MiColStart) >> common.MiBlockSizeLog2 + // Wavefront: wait for the row above to decode the above and + // above-right SB before consuming their entropy / above-context + // state when DecoderRowMT is armed. + rowMT.read(sbRow, sbCol) + if !d.readVP9InterModeSb(&r, hdr, comp, maps, tile, miRows, miCols, + miRow, miCol, common.Block64x64, partitionProbs) { + return ErrInvalidVP9Data + } + rowMT.write(sbRow, sbCol, tileSbCols) + } + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil +} + +func (d *VP9Decoder) resetVP9SegmentationMapsForPastIndependence() { + for i := range d.segMap { + d.segMap[i] = 0 + } + for i := range d.lastSegMap { + d.lastSegMap[i] = 0 + } +} + +func (d *VP9Decoder) readVP9IntraModeSb(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, maps *vp9dec.IntraSegmentMaps, + tile vp9dec.TileBounds, miRows, miCols, miRow, miCol int, + bsize common.BlockSize, txMode common.TxMode, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) bool { + if miRow >= miRows || miCol >= miCols { + return true + } + bsl := int(common.BWidthLog2Lookup[bsize]) + bs := (1 << uint(bsl)) / 4 + ctx := vp9dec.PartitionPlaneContext(d.aboveSegCtx, d.leftSegCtx, miRow, miCol, bsize) + probs := partitionProbs[ctx][:] + hasRows := miRow+bs < miRows + hasCols := miCol+bs < miCols + partition := vp9dec.ReadPartition(r, probs, hasRows, hasCols) + if !hdr.FrameParallelDecoding { + d.counts.Partition[ctx][partition]++ + } + subsize := common.SubsizeLookup[partition][bsize] + if subsize >= common.BlockSizes { + return false + } + + if subsize < common.Block8x8 { + if !d.readVP9IntraModeBlock(r, hdr, maps, tile, miRows, miCols, miRow, miCol, subsize, txMode) { + return false + } + } else { + switch partition { + case common.PartitionNone: + if !d.readVP9IntraModeBlock(r, hdr, maps, tile, miRows, miCols, miRow, miCol, subsize, txMode) { + return false + } + case common.PartitionHorz: + if !d.readVP9IntraModeBlock(r, hdr, maps, tile, miRows, miCols, miRow, miCol, subsize, txMode) { + return false + } + if miRow+bs < miRows { + if !d.readVP9IntraModeBlock(r, hdr, maps, tile, miRows, miCols, miRow+bs, miCol, subsize, txMode) { + return false + } + } + case common.PartitionVert: + if !d.readVP9IntraModeBlock(r, hdr, maps, tile, miRows, miCols, miRow, miCol, subsize, txMode) { + return false + } + if miCol+bs < miCols { + if !d.readVP9IntraModeBlock(r, hdr, maps, tile, miRows, miCols, miRow, miCol+bs, subsize, txMode) { + return false + } + } + case common.PartitionSplit: + if !d.readVP9IntraModeSb(r, hdr, maps, tile, miRows, miCols, + miRow, miCol, subsize, txMode, partitionProbs) { + return false + } + if !d.readVP9IntraModeSb(r, hdr, maps, tile, miRows, miCols, + miRow, miCol+bs, subsize, txMode, partitionProbs) { + return false + } + if !d.readVP9IntraModeSb(r, hdr, maps, tile, miRows, miCols, + miRow+bs, miCol, subsize, txMode, partitionProbs) { + return false + } + if !d.readVP9IntraModeSb(r, hdr, maps, tile, miRows, miCols, + miRow+bs, miCol+bs, subsize, txMode, partitionProbs) { + return false + } + default: + return false + } + } + + if bsize >= common.Block8x8 && + (bsize == common.Block8x8 || partition != common.PartitionSplit) { + vp9dec.UpdatePartitionContext(d.aboveSegCtx, d.leftSegCtx, + miRow, miCol, subsize, vp9dec.PartitionContextUpdateWidth(bs)) + } + return true +} + +func (d *VP9Decoder) readVP9InterModeSb(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) bool { + if miRow >= miRows || miCol >= miCols { + return true + } + bsl := int(common.BWidthLog2Lookup[bsize]) + bs := (1 << uint(bsl)) / 4 + ctx := vp9dec.PartitionPlaneContext(d.aboveSegCtx, d.leftSegCtx, miRow, miCol, bsize) + probs := partitionProbs[ctx][:] + hasRows := miRow+bs < miRows + hasCols := miCol+bs < miCols + partition := vp9dec.ReadPartition(r, probs, hasRows, hasCols) + if !hdr.FrameParallelDecoding { + d.counts.Partition[ctx][partition]++ + } + subsize := common.SubsizeLookup[partition][bsize] + if subsize >= common.BlockSizes { + return false + } + + if subsize < common.Block8x8 { + if !d.readVP9InterModeBlock(r, hdr, comp, maps, tile, miRows, miCols, miRow, miCol, subsize) { + return false + } + } else { + switch partition { + case common.PartitionNone: + if !d.readVP9InterModeBlock(r, hdr, comp, maps, tile, miRows, miCols, miRow, miCol, subsize) { + return false + } + case common.PartitionHorz: + if !d.readVP9InterModeBlock(r, hdr, comp, maps, tile, miRows, miCols, miRow, miCol, subsize) { + return false + } + if miRow+bs < miRows { + if !d.readVP9InterModeBlock(r, hdr, comp, maps, tile, miRows, miCols, miRow+bs, miCol, subsize) { + return false + } + } + case common.PartitionVert: + if !d.readVP9InterModeBlock(r, hdr, comp, maps, tile, miRows, miCols, miRow, miCol, subsize) { + return false + } + if miCol+bs < miCols { + if !d.readVP9InterModeBlock(r, hdr, comp, maps, tile, miRows, miCols, miRow, miCol+bs, subsize) { + return false + } + } + case common.PartitionSplit: + if !d.readVP9InterModeSb(r, hdr, comp, maps, tile, miRows, miCols, + miRow, miCol, subsize, partitionProbs) { + return false + } + if !d.readVP9InterModeSb(r, hdr, comp, maps, tile, miRows, miCols, + miRow, miCol+bs, subsize, partitionProbs) { + return false + } + if !d.readVP9InterModeSb(r, hdr, comp, maps, tile, miRows, miCols, + miRow+bs, miCol, subsize, partitionProbs) { + return false + } + if !d.readVP9InterModeSb(r, hdr, comp, maps, tile, miRows, miCols, + miRow+bs, miCol+bs, subsize, partitionProbs) { + return false + } + default: + return false + } + } + + if bsize >= common.Block8x8 && + (bsize == common.Block8x8 || partition != common.PartitionSplit) { + vp9dec.UpdatePartitionContext(d.aboveSegCtx, d.leftSegCtx, + miRow, miCol, subsize, vp9dec.PartitionContextUpdateWidth(bs)) + } + return true +} + +func (d *VP9Decoder) readVP9IntraModeBlock(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, maps *vp9dec.IntraSegmentMaps, + tile vp9dec.TileBounds, miRows, miCols, miRow, miCol int, + bsize common.BlockSize, txMode common.TxMode, +) bool { + xMis := min(int(common.Num8x8BlocksWideLookup[bsize]), miCols-miCol) + yMis := min(int(common.Num8x8BlocksHighLookup[bsize]), miRows-miRow) + + mi := &d.miGrid[miRow*miCols+miCol] + if bsize < common.Block8x8 { + *mi = vp9dec.NeighborMi{SbType: bsize} + } else { + mi.SbType = bsize + mi.TxSize = 0 + mi.InterpFilter = 0 + mi.Skip = 0 + mi.SegmentID = 0 + mi.SegIDPredicted = 0 + mi.Mode = 0 + mi.RefFrame = [2]int8{} + mi.Mv = [2]vp9dec.MV{} + } + above := d.vp9DecoderMiAt(miRows, miCols, miRow-1, miCol) + var left *vp9dec.NeighborMi + if miCol > tile.MiColStart { + left = d.vp9DecoderMiAt(miRows, miCols, miRow, miCol-1) + } + out := vp9dec.ReadIntraFrameModeInfo(vp9dec.IntraFrameDriverArgs{ + Reader: r, + Fc: &d.fc, + Seg: &hdr.Seg, + Maps: maps, + TxMode: txMode, + MiOffset: miRow*miCols + miCol, + XMis: xMis, + YMis: yMis, + Above: above, + Left: left, + }, mi) + reconBsize := vp9dec.ModeInfoDecodeBSize(bsize) + if mi.Skip != 0 { + aboveOffsets, leftOffsets := d.vp9PlaneContextOffsets(miRow, miCol) + vp9dec.ResetSkipContext(d.planes[:], reconBsize, aboveOffsets[:], leftOffsets[:]) + if !d.unsupportedReconstruct { + d.reconstructVP9IntraPredictBlock(hdr, mi, out.UvMode, tile, + miRow, miCol, reconBsize) + } + d.storeVP9CurrentFrameMvs(miRows, miCols, miRow, miCol, xMis, yMis, mi) + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true + } + if !d.readVP9IntraResidueBlock(r, hdr, mi, out.UvMode, tile, miRow, miCol, reconBsize) { + return false + } + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true +} + +func (d *VP9Decoder) readVP9InterModeBlock(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, +) bool { + xMis := min(int(common.Num8x8BlocksWideLookup[bsize]), miCols-miCol) + yMis := min(int(common.Num8x8BlocksHighLookup[bsize]), miRows-miRow) + + mi := &d.miGrid[miRow*miCols+miCol] + if bsize < common.Block8x8 { + *mi = vp9dec.NeighborMi{SbType: bsize} + } else { + mi.SbType = bsize + mi.TxSize = 0 + mi.InterpFilter = 0 + mi.Skip = 0 + mi.SegmentID = 0 + mi.SegIDPredicted = 0 + mi.Mode = 0 + mi.RefFrame = [2]int8{} + mi.Mv = [2]vp9dec.MV{} + } + above := d.vp9DecoderMiAt(miRows, miCols, miRow-1, miCol) + var left *vp9dec.NeighborMi + if miCol > tile.MiColStart { + left = d.vp9DecoderMiAt(miRows, miCols, miRow, miCol-1) + } + + segID := 0 + var isInter int + if !hdr.Seg.Enabled && hdr.FrameParallelDecoding { + skipCtx := vp9dec.GetSkipContext(above, left) + mi.Skip = uint8(r.Read(uint32(d.fc.SkipProbs[skipCtx]))) + interCtx := vp9dec.GetIntraInterContext(above, left) + isInter = int(r.Read(uint32(d.fc.IntraInterProb[interCtx]))) + } else { + d.segIDPredictedScratch = 0 + if hdr.Seg.Enabled { + maps.SegIDPredictedOut = &d.segIDPredictedScratch + segID = vp9dec.ReadInterSegmentId(r, &hdr.Seg, maps, + miRow*miCols+miCol, xMis, yMis, above, left) + } + mi.SegmentID = uint8(segID) + mi.SegIDPredicted = d.segIDPredictedScratch + if !hdr.Seg.TemporalUpdate { + mi.SegIDPredicted = uint8(segID) + } + mi.Skip = uint8(d.readVP9SkipWithCounts(r, hdr, segID, above, left)) + isInter = d.readVP9IsInterBlockWithCounts(r, hdr, segID, above, left) + } + + if bsize >= common.Block8x8 && comp.TxMode == common.TxModeSelect && + !(isInter != 0 && mi.Skip != 0) { + mi.TxSize = d.readVP9TxSizeWithCounts(r, hdr, comp.TxMode, bsize, above, left, true) + } else { + mi.TxSize = d.readVP9TxSizeWithCounts(r, hdr, comp.TxMode, bsize, above, left, false) + } + + uvMode := common.DcPred + if isInter == 0 { + uvMode = d.readVP9IntraBlockModeInfoInterWithCounts(r, hdr, mi) + } else if !d.readVP9InterBlockModeInfo(r, hdr, comp, mi, segID, above, left, + tile, miRows, miCols, miRow, miCol) { + return false + } + + reconBsize := vp9dec.ModeInfoDecodeBSize(bsize) + if mi.Skip != 0 { + aboveOffsets, leftOffsets := d.vp9PlaneContextOffsets(miRow, miCol) + vp9dec.ResetSkipContext(d.planes[:], reconBsize, aboveOffsets[:], leftOffsets[:]) + if !d.unsupportedReconstruct { + if isInter != 0 { + if !d.reconstructVP9InterPredictBlock(hdr, mi, miRow, miCol, reconBsize) { + return false + } + } else { + d.reconstructVP9IntraPredictBlock(hdr, mi, uvMode, tile, + miRow, miCol, reconBsize) + } + } + d.storeVP9CurrentFrameMvs(miRows, miCols, miRow, miCol, xMis, yMis, mi) + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true + } + if isInter != 0 && !vp9dec.CanReconstructInterBlock(mi) { + d.unsupportedReconstruct = true + } + if !d.readVP9ResidueBlock(r, hdr, mi, uvMode, tile, miRow, miCol, reconBsize, segID, isInter) { + return false + } + d.storeVP9CurrentFrameMvs(miRows, miCols, miRow, miCol, xMis, yMis, mi) + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true +} + +func (d *VP9Decoder) readVP9InterBlockModeInfo(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + mi *vp9dec.NeighborMi, segID int, + above, left *vp9dec.NeighborMi, + tile vp9dec.TileBounds, miRows, miCols, miRow, miCol int, +) bool { + signBias := vp9dec.FrameRefSignBias(hdr) + var refs vp9dec.CompoundFrameRefs + if comp.ReferenceMode != vp9dec.SingleReference { + refs = vp9dec.SetupCompoundReferenceMode(signBias) + } + d.readVP9RefFramesWithCounts(r, hdr, comp.ReferenceMode, signBias, refs, + segID, above, left, &mi.RefFrame) + interModeCtx := vp9dec.InterModeContextIdx(d.miGrid, d.miIdx, miCols, tile, + miRows, miRow, miCol, mi.SbType) + + if hdr.Seg.Enabled && vp9dec.SegFeatureActive(&hdr.Seg, segID, vp9dec.SegLvlSkip) { + mi.Mode = common.ZeroMv + if mi.SbType < common.Block8x8 { + return false + } + } else { + if mi.SbType >= common.Block8x8 { + mi.Mode = d.readVP9InterModeWithCounts(r, hdr, interModeCtx) + } + } + + if hdr.InterpFilter == vp9dec.InterpSwitchable { + mi.InterpFilter = uint8(d.readVP9SwitchableInterpFilterWithCounts(r, hdr, above, left)) + } else { + mi.InterpFilter = uint8(hdr.InterpFilter) + } + + isCompound := 0 + if mi.RefFrame[1] > vp9dec.IntraFrame { + isCompound = 1 + } + var mv, refMv, nearNearest [2]vp9dec.MV + if mi.SbType < common.Block8x8 { + num4x4W := int(common.Num4x4BlocksWideLookup[mi.SbType]) + num4x4H := int(common.Num4x4BlocksHighLookup[mi.SbType]) + gotMvRefsForNew := false + for idy := 0; idy < 2; idy += num4x4H { + for idx := 0; idx < 2; idx += num4x4W { + j := idy*2 + idx + bMode := d.readVP9InterModeWithCounts(r, hdr, interModeCtx) + mi.Bmi[j].AsMode = bMode + if bMode == common.NearestMv || bMode == common.NearMv { + halves := 1 + isCompound + for ref := range halves { + nearNearest[ref] = d.vp9AppendSub8x8MvsForIdx(tile, + miRows, miCols, miRow, miCol, mi.SbType, + bMode, j, ref, mi.RefFrame[ref], signBias) + } + } else if bMode == common.NewMv && !gotMvRefsForNew { + halves := 1 + isCompound + for ref := range halves { + refList, _ := d.vp9FindInterMvRefsForBlock(tile, miRows, miCols, + miRow, miCol, mi.SbType, common.NewMv, + mi.RefFrame[ref], signBias, -1) + best := refList[0] + vp9dec.LowerMvPrecision(&best, hdr.AllowHighPrecisionMv) + refMv[ref] = best + } + gotMvRefsForNew = true + } + if vp9dec.AssignMv(bMode, &mi.Bmi[j].AsMv, + &refMv, &nearNearest, isCompound, hdr.AllowHighPrecisionMv, + r, &d.fc) == 0 { + return false + } + if !hdr.FrameParallelDecoding && bMode == common.NewMv { + halves := 1 + isCompound + for ref := range halves { + d.countVP9NewMv(mi.Bmi[j].AsMv[ref], refMv[ref]) + } + } + if num4x4H == 2 { + mi.Bmi[j+2] = mi.Bmi[j] + } + if num4x4W == 2 { + mi.Bmi[j+1] = mi.Bmi[j] + } + } + } + mi.Mode = mi.Bmi[3].AsMode + mi.Mv = mi.Bmi[3].AsMv + return true + } + if mi.Mode != common.ZeroMv { + halves := 1 + isCompound + for ref := range halves { + refList, refCount := d.vp9FindInterMvRefs(tile, miRows, miCols, + miRow, miCol, mi.SbType, mi.Mode, mi.RefFrame[ref], signBias) + best := vp9dec.InterModeMvCandidate(refList, refCount, mi.Mode) + vp9dec.LowerMvPrecision(&best, hdr.AllowHighPrecisionMv) + refMv[ref] = best + nearNearest[ref] = best + } + } + if vp9dec.AssignMv(mi.Mode, &mv, &refMv, &nearNearest, + isCompound, hdr.AllowHighPrecisionMv, r, &d.fc) == 0 { + return false + } + if !hdr.FrameParallelDecoding && mi.Mode == common.NewMv { + halves := 1 + isCompound + for ref := range halves { + d.countVP9NewMv(mv[ref], refMv[ref]) + } + } + mi.Mv = mv + return true +} + +func (d *VP9Decoder) vp9FindInterMvRefs(tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + mode common.PredictionMode, + refFrame int8, + signBias [vp9dec.MaxRefFrames]uint8, +) ([2]vp9dec.MV, int) { + return vp9dec.FindInterMvRefsFieldsIdx(d.miGrid, d.miIdx, d.usePrevFrameMvs, + d.prevFrameMvs, d.prevFrameMvRows, d.prevFrameMvCols, + tile, miRows, miCols, miRow, miCol, bsize, mode, refFrame, + signBias, -1) +} + +func (d *VP9Decoder) vp9FindInterMvRefsForBlock(tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + mode common.PredictionMode, + refFrame int8, + signBias [vp9dec.MaxRefFrames]uint8, + block int, +) ([2]vp9dec.MV, int) { + return vp9dec.FindInterMvRefsFieldsIdx(d.miGrid, d.miIdx, d.usePrevFrameMvs, + d.prevFrameMvs, d.prevFrameMvRows, d.prevFrameMvCols, + tile, miRows, miCols, miRow, miCol, bsize, mode, refFrame, + signBias, block) +} + +func (d *VP9Decoder) vp9AppendSub8x8MvsForIdx(tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + mode common.PredictionMode, + block, ref int, + refFrame int8, + signBias [vp9dec.MaxRefFrames]uint8, +) vp9dec.MV { + mi := &d.miGrid[miRow*miCols+miCol] + refList, refCount := d.vp9FindInterMvRefsForBlock(tile, miRows, miCols, + miRow, miCol, bsize, mode, refFrame, signBias, block) + switch block { + case 0: + return refList[refCount-1] + case 1, 2: + if mode == common.NearestMv { + return mi.Bmi[0].AsMv[ref] + } + for i := range refList { + if refList[i] != mi.Bmi[0].AsMv[ref] { + return refList[i] + } + } + case 3: + if mode == common.NearestMv { + return mi.Bmi[2].AsMv[ref] + } + if mi.Bmi[2].AsMv[ref] != mi.Bmi[1].AsMv[ref] { + return mi.Bmi[1].AsMv[ref] + } + if mi.Bmi[2].AsMv[ref] != mi.Bmi[0].AsMv[ref] { + return mi.Bmi[0].AsMv[ref] + } + for i := range refList { + if refList[i] != mi.Bmi[2].AsMv[ref] { + return refList[i] + } + } + } + return vp9dec.MV{} +} + +func (d *VP9Decoder) readVP9IntraResidueBlock(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, mi *vp9dec.NeighborMi, + uvMode common.PredictionMode, tile vp9dec.TileBounds, + miRow, miCol int, bsize common.BlockSize, +) bool { + return d.readVP9ResidueBlock(r, hdr, mi, uvMode, tile, miRow, miCol, bsize, + int(mi.SegmentID), 0) +} + +func (d *VP9Decoder) reconstructVP9InterPredictBlock( + hdr *vp9dec.UncompressedHeader, + mi *vp9dec.NeighborMi, + miRow, miCol int, + bsize common.BlockSize, +) bool { + if d.unsupportedReconstruct { + return true + } + if hdr.BitDepthColor.BitDepth > vp9dec.Bits8 { + return d.reconstructVP9InterPredictBlockHighBD(hdr, mi, miRow, miCol, bsize) + } + if !vp9dec.CanReconstructInterBlock(mi) { + d.markVP9Unsupported() + return true + } + nrefs := 1 + if mi.RefFrame[1] > vp9dec.IntraFrame { + nrefs = 2 + } + // Fast path for single-reference, unscaled, >=8x8 inter blocks (the 99% decode + // case): resolve the reference frame once instead of 3x per block and avoid + // 6 per-block integer divisions for dstRows/srcRows. + if nrefs == 1 && mi.SbType >= common.Block8x8 && + d.predictPlaneMode == vp9PredictAllPlanes { + refSlot, ok := vp9dec.InterReferenceSlot(hdr, mi.RefFrame[0]) + if !ok { + return false + } + ref := d.vp9PredictRefFrame(refSlot) + if !vp9RefMatchesHeaderFormat(ref, hdr) { + return false + } + if ref.img.Width == int(hdr.Width) && ref.img.Height == int(hdr.Height) { + mv := mi.Mv[0] + mvRow := int(mv.Row) + mvCol := int(mv.Col) + // Fast 4:2:0 integer-luma-MV 3-plane path: handles both even-integer + // (3x CopyBlock) and odd-integer bilinear half-pel chroma directly, + // bypassing vp9InterPredictPlaneParams and InterPredictorWithScratch. + if (mvRow&7) == 0 && (mvCol&7) == 0 && + d.planes[0].SubsamplingX == 0 && d.planes[0].SubsamplingY == 0 && + d.planes[1].SubsamplingX == 1 && d.planes[1].SubsamplingY == 1 && + d.planes[2].SubsamplingX == 1 && d.planes[2].SubsamplingY == 1 { + subY := (mvRow & 15) != 0 + subX := (mvCol & 15) != 0 + if (!subX && !subY) || mi.InterpFilter == uint8(vp9dec.InterpBilinear) { + x0 := miCol * common.MiSize + y0 := miRow * common.MiSize + bw := int(common.Num4x4BlocksWideLookup[bsize]) * 4 + bh := int(common.Num4x4BlocksHighLookup[bsize]) * 4 + sx := x0 + (mvCol >> 3) + sy := y0 + (mvRow >> 3) + yDstStride := d.lastFrame.YStride + uDstStride := d.lastFrame.UStride + vDstStride := d.lastFrame.VStride + ySrcStride := ref.img.YStride + uSrcStride := ref.img.UStride + vSrcStride := ref.img.VStride + uvW := (ref.img.Width + 1) >> 1 + uvH := (ref.img.Height + 1) >> 1 + ux0, uy0 := x0>>1, y0>>1 + ubw, ubh := bw>>1, bh>>1 + usx := ux0 + (mvCol >> 4) + usy := uy0 + (mvRow >> 4) + extraX, extraY := 0, 0 + if subX { + extraX = 1 + } + if subY { + extraY = 1 + } + if sx >= 0 && sy >= 0 && sx+bw <= ref.img.Width && sy+bh <= ref.img.Height && + usx >= 0 && usy >= 0 && usx+ubw+extraX <= uvW && usy+ubh+extraY <= uvH && + yDstStride > 0 && uDstStride > 0 && vDstStride > 0 && + ySrcStride > 0 && uSrcStride > 0 && vSrcStride > 0 && + x0+bw <= yDstStride && (y0+bh)*yDstStride <= len(d.frameY) && + ux0+ubw <= uDstStride && (uy0+ubh)*uDstStride <= len(d.frameU) && + ux0+ubw <= vDstStride && (uy0+ubh)*vDstStride <= len(d.frameV) && + (sy+bh)*ySrcStride <= len(ref.img.Y) && + (usy+ubh+extraY)*uSrcStride <= len(ref.img.U) && + (usy+ubh+extraY)*vSrcStride <= len(ref.img.V) { + pixel.CopyBlock(ref.img.Y[sy*ySrcStride+sx:], ySrcStride, + d.frameY[y0*yDstStride+x0:], yDstStride, bw, bh) + uSrc := ref.img.U[usy*uSrcStride+usx:] + vSrc := ref.img.V[usy*vSrcStride+usx:] + uDst := d.frameU[uy0*uDstStride+ux0:] + vDst := d.frameV[uy0*vDstStride+ux0:] + if !subX && !subY { + pixel.CopyBlock(uSrc, uSrcStride, uDst, uDstStride, ubw, ubh) + pixel.CopyBlock(vSrc, vSrcStride, vDst, vDstStride, ubw, ubh) + return true + } + if !subX && subY { + if ubw == 8 && ubh == 8 && + pixel.FilterBilinear2DPair8x8(uSrc, uSrcStride, vSrc, vSrcStride, uDst, uDstStride, vDst, vDstStride, 128, 0, 64, 64) { + return true + } + pixel.FilterHalfPelDisjoint(uSrc, uSrcStride, uDst, uDstStride, ubw, ubh, uSrcStride) + pixel.FilterHalfPelDisjoint(vSrc, vSrcStride, vDst, vDstStride, ubw, ubh, vSrcStride) + return true + } else if subX && !subY { + if ubw == 8 && ubh == 8 && + pixel.FilterBilinear2DPair8x8(uSrc, uSrcStride, vSrc, vSrcStride, uDst, uDstStride, vDst, vDstStride, 64, 64, 128, 0) { + return true + } + pixel.FilterHalfPelDisjoint(uSrc, uSrcStride, uDst, uDstStride, ubw, ubh, 1) + pixel.FilterHalfPelDisjoint(vSrc, vSrcStride, vDst, vDstStride, ubw, ubh, 1) + return true + } else { + if ubw == 8 && ubh == 8 && + pixel.FilterBilinear2DPair8x8(uSrc, uSrcStride, vSrc, vSrcStride, uDst, uDstStride, vDst, vDstStride, 64, 64, 64, 64) { + return true + } + if pixel.FilterBilinear2D(uSrc, uSrcStride, uDst, uDstStride, ubw, ubh, 64, 64, 64, 64) && + pixel.FilterBilinear2D(vSrc, vSrcStride, vDst, vDstStride, ubw, ubh, 64, 64, 64, 64) { + return true + } + } + } + } + } + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + d.markVP9Unsupported() + return true + } + dst, dstStride := d.vp9OutputPlane(plane) + if dstStride <= 0 || len(dst) == 0 { + return false + } + subX := pd.SubsamplingX + subY := pd.SubsamplingY + x0 := (miCol * common.MiSize) >> subX + y0 := (miRow * common.MiSize) >> subY + if x0 >= dstStride || (y0+1)*dstStride > len(dst) { + continue + } + bw := int(common.Num4x4BlocksWideLookup[planeBsize]) * 4 + bh := int(common.Num4x4BlocksHighLookup[planeBsize]) * 4 + if x0+bw > dstStride || (y0+bh)*dstStride > len(dst) { + d.markVP9Unsupported() + return true + } + src, srcStride := vp9ReferencePlane(ref, plane) + if srcStride <= 0 || len(src) == 0 { + return false + } + if x0 >= srcStride || (y0+1)*srcStride > len(src) { + continue + } + srcWidth := (ref.img.Width + (1 << subX) - 1) >> subX + srcHeight := (ref.img.Height + (1 << subY) - 1) >> subY + if srcWidth <= 0 || srcHeight <= 0 { + return false + } + if (mvRow&((8<> (3 + subX)) + sy := y0 + (mvRow >> (3 + subY)) + if sx >= 0 && sy >= 0 && sx+bw <= srcWidth && sy+bh <= srcHeight { + pixel.CopyBlock(src[sy*srcStride+sx:], srcStride, + dst[y0*dstStride+x0:], dstStride, bw, bh) + continue + } + srcFull, srcOrigin, srcBorderX, srcBorderY := vp9ReferencePlaneBorder(ref, plane) + if len(srcFull) > 0 && + sx >= -srcBorderX && sy >= -srcBorderY && + sx+bw <= srcWidth+srcBorderX && sy+bh <= srcHeight+srcBorderY { + srcOff := srcOrigin + sy*srcStride + sx + if srcOff >= 0 && srcOff+(bh-1)*srcStride+bw <= len(srcFull) { + pixel.CopyBlock(srcFull[srcOff:], srcStride, + dst[y0*dstStride+x0:], dstStride, bw, bh) + continue + } + } + } + srcFull, srcOrigin, srcBorderX, srcBorderY := vp9ReferencePlaneBorder(ref, plane) + params := vp9InterPredictPlaneParams{ + hdr: hdr, + pd: pd, + mi: mi, + dst: dst, + src: src, + srcFull: srcFull, + bsize: bsize, + miRow: miRow, + miCol: miCol, + srcBaseX: x0, + srcBaseY: y0, + dstBaseX: x0, + dstBaseY: y0, + bw: bw, + bh: bh, + dstStride: dstStride, + dstRows: len(dst) / dstStride, + srcStride: srcStride, + srcRows: len(src) / srcStride, + srcWidth: srcWidth, + srcHeight: srcHeight, + srcOrigin: srcOrigin, + srcBorderX: srcBorderX, + srcBorderY: srcBorderY, + } + if !d.reconstructVP9InterPredictPlaneAt(¶ms, 0, 0, bw, bh, mv) { + return false + } + } + return true + } + } + for plane := range vp9dec.MaxMbPlane { + // Encoder motion-search/distortion measurements only consult the + // luma plane; skip U/V to avoid two extra convolutions per + // candidate. libvpx mirrors this with + // vp9_build_inter_predictors_sby (luma) called from + // nonrd_pickmode for mode scoring; chroma reconstruction + // (vp9_build_inter_predictors_sbuv) is deferred until the + // committed mode is encoded. + // libvpx: vp9/encoder/vp9_pickmode.c:2336. + if !d.predictPlaneMode.allowsPlane(plane) { + continue + } + pd := &d.planes[plane] + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + d.markVP9Unsupported() + return true + } + dst, dstStride := d.vp9OutputPlane(plane) + if dstStride <= 0 || len(dst) == 0 { + return false + } + dstRows := len(dst) / dstStride + x0 := (miCol * common.MiSize) >> pd.SubsamplingX + y0 := (miRow * common.MiSize) >> pd.SubsamplingY + if x0 >= dstStride || y0 >= dstRows { + continue + } + bw := int(common.Num4x4BlocksWideLookup[planeBsize]) * 4 + bh := int(common.Num4x4BlocksHighLookup[planeBsize]) * 4 + if x0+bw > dstStride || y0+bh > dstRows { + d.markVP9Unsupported() + return true + } + for refIdx := range nrefs { + refSlot, ok := vp9dec.InterReferenceSlot(hdr, mi.RefFrame[refIdx]) + if !ok { + return false + } + ref := d.vp9PredictRefFrame(refSlot) + if !vp9RefMatchesHeaderFormat(ref, hdr) { + return false + } + var sf *vp9dec.ScaleFactors + scaled := false + if ref.img.Width != int(hdr.Width) || ref.img.Height != int(hdr.Height) { + sf = d.vp9ScaleFactorsFor(ref.img.Width, ref.img.Height, + int(hdr.Width), int(hdr.Height)) + if !sf.IsValidScale() { + d.markVP9Unsupported() + return true + } + scaled = sf.IsScaled() + } + src, srcStride := vp9ReferencePlane(ref, plane) + if srcStride <= 0 || len(src) == 0 { + return false + } + srcRows := len(src) / srcStride + if !scaled && (x0 >= srcStride || y0 >= srcRows) { + continue + } + srcWidth := (ref.img.Width + (1 << pd.SubsamplingX) - 1) >> pd.SubsamplingX + srcHeight := (ref.img.Height + (1 << pd.SubsamplingY) - 1) >> pd.SubsamplingY + if srcWidth <= 0 || srcHeight <= 0 { + return false + } + srcFull, srcOrigin, srcBorderX, srcBorderY := vp9ReferencePlaneBorder(ref, plane) + avg := refIdx == 1 + if mi.SbType < common.Block8x8 { + params := vp9InterPredictPlaneParams{ + hdr: hdr, + pd: pd, + mi: mi, + sf: sf, + dst: dst, + src: src, + srcFull: srcFull, + bsize: bsize, + miRow: miRow, + miCol: miCol, + srcBaseX: x0, + srcBaseY: y0, + dstBaseX: x0, + dstBaseY: y0, + bw: bw, + bh: bh, + dstStride: dstStride, + dstRows: dstRows, + srcStride: srcStride, + srcRows: srcRows, + srcWidth: srcWidth, + srcHeight: srcHeight, + srcOrigin: srcOrigin, + srcBorderX: srcBorderX, + srcBorderY: srcBorderY, + avg: vp9dec.BoolInt(avg), + } + block := 0 + num4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + num4x4H := int(common.Num4x4BlocksHighLookup[planeBsize]) + for y := range num4x4H { + for x := range num4x4W { + mv := vp9dec.AverageSplitMvs(&mi.Bmi, refIdx, block, + int(pd.SubsamplingX), int(pd.SubsamplingY)) + if !d.reconstructVP9InterPredictPlaneAt(¶ms, 4*x, 4*y, 4, 4, mv) { + return false + } + block++ + } + } + continue + } + if !scaled && !avg { + mv := mi.Mv[refIdx] + if mv == (vp9dec.MV{}) && (srcWidth&0x7) == 0 && (srcHeight&0x7) == 0 { + w := min(bw, min(dstStride-x0, srcStride-x0)) + h := min(bh, min(dstRows-y0, srcRows-y0)) + if w > 0 && h > 0 { + pixel.CopyBlock(src[y0*srcStride+x0:], srcStride, + dst[y0*dstStride+x0:], dstStride, w, h) + } + continue + } + if (int(mv.Row)&((8<> (3 + pd.SubsamplingX)) + sy := y0 + (int(mv.Row) >> (3 + pd.SubsamplingY)) + if x0+bw <= dstStride && y0+bh <= dstRows { + if sx >= 0 && sy >= 0 && sx+bw <= srcWidth && sy+bh <= srcHeight { + pixel.CopyBlock(src[sy*srcStride+sx:], srcStride, + dst[y0*dstStride+x0:], dstStride, bw, bh) + continue + } + if len(srcFull) > 0 && + sx >= -srcBorderX && sy >= -srcBorderY && + sx+bw <= srcWidth+srcBorderX && sy+bh <= srcHeight+srcBorderY { + srcOff := srcOrigin + sy*srcStride + sx + if srcOff >= 0 && srcOff+(bh-1)*srcStride+bw <= len(srcFull) { + pixel.CopyBlock(srcFull[srcOff:], srcStride, + dst[y0*dstStride+x0:], dstStride, bw, bh) + continue + } + } + } + } + } else if !scaled && mi.Mv[refIdx] == (vp9dec.MV{}) && + (srcWidth&0x7) == 0 && (srcHeight&0x7) == 0 { + w := min(bw, min(dstStride-x0, srcStride-x0)) + h := min(bh, min(dstRows-y0, srcRows-y0)) + if w > 0 && h > 0 { + buffers.AveragePlaneInto(dst[y0*dstStride+x0:], dstStride, + src[y0*srcStride+x0:], srcStride, w, h) + } + continue + } + params := vp9InterPredictPlaneParams{ + hdr: hdr, + pd: pd, + mi: mi, + sf: sf, + dst: dst, + src: src, + srcFull: srcFull, + bsize: bsize, + miRow: miRow, + miCol: miCol, + srcBaseX: x0, + srcBaseY: y0, + dstBaseX: x0, + dstBaseY: y0, + bw: bw, + bh: bh, + dstStride: dstStride, + dstRows: dstRows, + srcStride: srcStride, + srcRows: srcRows, + srcWidth: srcWidth, + srcHeight: srcHeight, + srcOrigin: srcOrigin, + srcBorderX: srcBorderX, + srcBorderY: srcBorderY, + avg: vp9dec.BoolInt(avg), + } + if !d.reconstructVP9InterPredictPlaneAt(¶ms, 0, 0, bw, bh, mi.Mv[refIdx]) { + return false + } + } + } + return true +} + +func (d *VP9Decoder) reconstructVP9InterPredictLumaTo( + hdr *vp9dec.UncompressedHeader, + mi *vp9dec.NeighborMi, + miRow, miCol int, + bsize common.BlockSize, + dst []byte, + dstStride int, +) bool { + if d.unsupportedReconstruct { + return true + } + if !vp9dec.CanReconstructInterBlock(mi) { + d.markVP9Unsupported() + return true + } + pd := &d.planes[0] + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + d.markVP9Unsupported() + return true + } + if dstStride <= 0 || len(dst) == 0 { + return false + } + dstRows := len(dst) / dstStride + x0 := miCol * common.MiSize + y0 := miRow * common.MiSize + bw := int(common.Num4x4BlocksWideLookup[planeBsize]) * 4 + bh := int(common.Num4x4BlocksHighLookup[planeBsize]) * 4 + if bw > dstStride || bh > dstRows { + d.markVP9Unsupported() + return true + } + nrefs := 1 + if mi.RefFrame[1] > vp9dec.IntraFrame { + nrefs = 2 + } + for refIdx := range nrefs { + refSlot, ok := vp9dec.InterReferenceSlot(hdr, mi.RefFrame[refIdx]) + if !ok { + return false + } + ref := d.vp9PredictRefFrame(refSlot) + if !vp9RefMatchesHeaderFormat(ref, hdr) { + return false + } + sf := d.vp9ScaleFactorsFor(ref.img.Width, ref.img.Height, + int(hdr.Width), int(hdr.Height)) + if !sf.IsValidScale() { + d.markVP9Unsupported() + return true + } + src, srcStride := vp9ReferencePlane(ref, 0) + if srcStride <= 0 || len(src) == 0 { + return false + } + srcRows := len(src) / srcStride + if !sf.IsScaled() && (x0 >= srcStride || y0 >= srcRows) { + continue + } + srcWidth := ref.img.Width + srcHeight := ref.img.Height + if srcWidth <= 0 || srcHeight <= 0 { + return false + } + srcFull, srcOrigin, srcBorderX, srcBorderY := vp9ReferencePlaneBorder(ref, 0) + avg := refIdx == 1 + if mi.SbType < common.Block8x8 { + params := vp9InterPredictPlaneParams{ + hdr: hdr, + pd: pd, + mi: mi, + sf: sf, + dst: dst, + src: src, + srcFull: srcFull, + bsize: bsize, + miRow: miRow, + miCol: miCol, + srcBaseX: x0, + srcBaseY: y0, + bw: bw, + bh: bh, + dstStride: dstStride, + dstRows: dstRows, + srcStride: srcStride, + srcRows: srcRows, + srcWidth: srcWidth, + srcHeight: srcHeight, + srcOrigin: srcOrigin, + srcBorderX: srcBorderX, + srcBorderY: srcBorderY, + avg: vp9dec.BoolInt(avg), + } + block := 0 + num4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + num4x4H := int(common.Num4x4BlocksHighLookup[planeBsize]) + for y := range num4x4H { + for x := range num4x4W { + mv := vp9dec.AverageSplitMvs(&mi.Bmi, refIdx, block, + int(pd.SubsamplingX), int(pd.SubsamplingY)) + if !d.reconstructVP9InterPredictPlaneAt(¶ms, 4*x, 4*y, 4, 4, mv) { + return false + } + block++ + } + } + continue + } + if !sf.IsScaled() && mi.Mv[refIdx] == (vp9dec.MV{}) && + (srcWidth&0x7) == 0 && (srcHeight&0x7) == 0 { + w := min(bw, min(dstStride, srcStride-x0)) + h := min(bh, min(dstRows, srcRows-y0)) + if w <= 0 || h <= 0 { + continue + } + if avg { + buffers.AveragePlaneInto(dst, dstStride, + src[y0*srcStride+x0:], srcStride, w, h) + } else { + pixel.CopyBlock(src[y0*srcStride+x0:], srcStride, + dst, dstStride, w, h) + } + continue + } + params := vp9InterPredictPlaneParams{ + hdr: hdr, + pd: pd, + mi: mi, + sf: sf, + dst: dst, + src: src, + srcFull: srcFull, + bsize: bsize, + miRow: miRow, + miCol: miCol, + srcBaseX: x0, + srcBaseY: y0, + bw: bw, + bh: bh, + dstStride: dstStride, + dstRows: dstRows, + srcStride: srcStride, + srcRows: srcRows, + srcWidth: srcWidth, + srcHeight: srcHeight, + srcOrigin: srcOrigin, + srcBorderX: srcBorderX, + srcBorderY: srcBorderY, + avg: vp9dec.BoolInt(avg), + } + if !d.reconstructVP9InterPredictPlaneAt(¶ms, 0, 0, bw, bh, mi.Mv[refIdx]) { + return false + } + } + return true +} + +// vp9ScaleFactorsEntry caches one SetupScaleFactorsForFrame result keyed +// by the (reference, frame) dimension tuple. +type vp9ScaleFactorsEntry struct { + valid bool + otherW, otherH, thisW, thisH int + sf vp9dec.ScaleFactors +} + +// vp9ScaleFactorsFor returns cached scale factors for a (reference, +// frame) dimension pair. libvpx derives these once per frame per +// reference buffer (vp9_setup_scale_factors_for_frame during ref +// setup); the fixed-point scale involves divisions, so recomputing per +// plane and reference block-by-block is measurable. Caching on the +// dimension key gives the same amortization without tracking reference +// lifetimes. +func (d *VP9Decoder) vp9ScaleFactorsFor(otherW, otherH, thisW, thisH int) *vp9dec.ScaleFactors { + for i := range d.sfCache { + e := &d.sfCache[i] + if e.valid && e.otherW == otherW && e.otherH == otherH && + e.thisW == thisW && e.thisH == thisH { + return &e.sf + } + } + e := &d.sfCache[d.sfCacheNext] + d.sfCacheNext = (d.sfCacheNext + 1) % len(d.sfCache) + e.valid = true + e.otherW, e.otherH, e.thisW, e.thisH = otherW, otherH, thisW, thisH + vp9dec.SetupScaleFactorsForFrame(&e.sf, otherW, otherH, thisW, thisH) + return &e.sf +} + +func vp9RefMatchesHeaderFormat(ref *vp9ReferenceFrame, hdr *vp9dec.UncompressedHeader) bool { + if ref == nil || !ref.valid { + return false + } + if hdr == nil || hdr.BitDepthColor.BitDepth == 0 { + return true + } + wantSub := codecapi.ChromaSubsamplingFromShifts( + hdr.BitDepthColor.SubsamplingX, hdr.BitDepthColor.SubsamplingY) + if ref.img.Subsampling != wantSub { + return false + } + return ref.bitDepthValue() == int(hdr.BitDepthColor.BitDepth) +} + +func (d *VP9Decoder) vp9PredictRefFrame(slot int) *vp9ReferenceFrame { + if slot < 0 || slot >= common.RefFrames { + return nil + } + if d.refFramesView != nil { + return &(*d.refFramesView)[slot] + } + return &d.refFrames[slot] +} + +type vp9InterPredictPlaneParams struct { + hdr *vp9dec.UncompressedHeader + pd *vp9dec.MacroblockdPlane + mi *vp9dec.NeighborMi + sf *vp9dec.ScaleFactors + dst []byte + src []byte + srcFull []byte + bsize common.BlockSize + miRow int + miCol int + srcBaseX int + srcBaseY int + dstBaseX int + dstBaseY int + bw int + bh int + dstStride int + dstRows int + srcStride int + srcRows int + srcWidth int + srcHeight int + srcOrigin int + srcBorderX int + srcBorderY int + avg int +} + +func (d *VP9Decoder) reconstructVP9InterPredictPlaneAt( + p *vp9InterPredictPlaneParams, + blockX, blockY, predW, predH int, + mv vp9dec.MV, +) bool { + if vp9PhaseStatsEnabled { + d.vp9PhaseIncInterPredictPlane() + } + filterIdx := int(p.mi.InterpFilter) + if filterIdx < 0 || filterIdx >= int(vp9dec.InterpSwitchable) { + d.markVP9Unsupported() + return true + } + miRows := int((p.hdr.Height + 7) >> 3) + miCols := int((p.hdr.Width + 7) >> 3) + edges := vp9dec.BlockBoundsEdges{ + MbToLeftEdge: -((p.miCol * common.MiSize) * 8), + MbToRightEdge: ((miCols - int(common.Num8x8BlocksWideLookup[p.bsize]) - p.miCol) * common.MiSize) * 8, + MbToTopEdge: -((p.miRow * common.MiSize) * 8), + MbToBottomEdge: ((miRows - int(common.Num8x8BlocksHighLookup[p.bsize]) - p.miRow) * common.MiSize) * 8, + } + mvQ4 := vp9dec.ClampMvToUmvBorderSb(edges, mv, p.bw, p.bh, + int(p.pd.SubsamplingX), int(p.pd.SubsamplingY)) + dstX := p.dstBaseX + blockX + dstY := p.dstBaseY + blockY + srcX := p.srcBaseX + blockX + srcY := p.srcBaseY + blockY + srcX16 := srcX << vp9dec.SubpelBitsConst + srcY16 := srcY << vp9dec.SubpelBitsConst + scaledMV := vp9dec.MV32{Row: int32(mvQ4.Row), Col: int32(mvQ4.Col)} + xStepQ4 := vp9dec.SubpelShifts + yStepQ4 := vp9dec.SubpelShifts + sf := p.sf + scaled := sf != nil && sf.IsScaled() + if scaled { + srcX16 = sf.ScaleValueX(srcX16) + srcY16 = sf.ScaleValueY(srcY16) + srcX = sf.ScaleValueX(srcX) + srcY = sf.ScaleValueY(srcY) + scaledMV = vp9dec.ScaleMv(mvQ4, + p.miCol*common.MiSize+blockX, p.miRow*common.MiSize+blockY, sf) + xStepQ4 = sf.XStepQ4 + yStepQ4 = sf.YStepQ4 + } + subpelX := int(scaledMV.Col) & (vp9dec.SubpelShifts - 1) + subpelY := int(scaledMV.Row) & (vp9dec.SubpelShifts - 1) + srcX += int(scaledMV.Col) >> vp9dec.SubpelBitsConst + srcY += int(scaledMV.Row) >> vp9dec.SubpelBitsConst + srcX16 += int(scaledMV.Col) + srcY16 += int(scaledMV.Row) + + src := p.src + srcStride := p.srcStride + srcRows := p.srcRows + srcWidth := p.srcWidth + srcHeight := p.srcHeight + srcOffset := srcY*srcStride + srcX + if scaled || scaledMV.Col != 0 || scaledMV.Row != 0 || + (srcWidth&0x7) != 0 || (srcHeight&0x7) != 0 { + x1 := ((srcX16 + (predW-1)*xStepQ4) >> vp9dec.SubpelBitsConst) + 1 + y1 := ((srcY16 + (predH-1)*yStepQ4) >> vp9dec.SubpelBitsConst) + 1 + extX0, extY0 := srcX, srcY + xPad, yPad := 0, 0 + if subpelX != 0 || xStepQ4 != vp9dec.SubpelShifts { + extX0 -= vp9dec.VP9InterpExtend - 1 + x1 += vp9dec.VP9InterpExtend + xPad = 1 + } + if subpelY != 0 || yStepQ4 != vp9dec.SubpelShifts { + extY0 -= vp9dec.VP9InterpExtend - 1 + y1 += vp9dec.VP9InterpExtend + yPad = 1 + } + if extX0 < 0 || extX0 > srcWidth-1 || x1 < 0 || x1 > srcWidth-1 || + extY0 < 0 || extY0 > srcHeight-1 || y1 < 0 || y1 > srcHeight-1 { + if len(p.srcFull) > 0 && + extX0 >= -p.srcBorderX && x1 < srcWidth+p.srcBorderX && + extY0 >= -p.srcBorderY && y1 < srcHeight+p.srcBorderY && + p.srcOrigin+extY0*srcStride+extX0 >= 0 && + p.srcOrigin+y1*srcStride+x1 < len(p.srcFull) { + src = p.srcFull + srcOffset = p.srcOrigin + srcY*srcStride + srcX + srcRows = srcHeight + p.srcBorderY + } else { + extW := x1 - extX0 + 1 + extH := y1 - extY0 + 1 + if extW <= 0 || extH <= 0 { + return false + } + borderOffset := yPad*(vp9dec.VP9InterpExtend-1)*extW + + xPad*(vp9dec.VP9InterpExtend-1) + src, srcStride, srcOffset = d.vp9ExtendInterPredictSource( + src, srcStride, srcWidth, srcHeight, extX0, extY0, extW, extH, + borderOffset) + srcRows = extH + } + } + } + dst := p.dst + dstStride := p.dstStride + avg := p.avg + if srcOffset < 0 || srcOffset >= len(src) || + dstX+predW > dstStride || dstY+predH > p.dstRows || srcRows <= 0 { + return false + } + if vp9PhaseStatsEnabled { + key := avg + if subpelX != 0 || xStepQ4 != vp9dec.SubpelShifts { + key |= 4 + } + if subpelY != 0 || yStepQ4 != vp9dec.SubpelShifts { + key |= 2 + } + d.vp9PhaseCountInterPredictor(key) + } + if !scaled && subpelX == 0 && subpelY == 0 { + if avg != 0 { + buffers.AveragePlaneInto(dst[dstY*dstStride+dstX:], dstStride, + src[srcOffset:], srcStride, predW, predH) + } else { + pixel.CopyBlock(src[srcOffset:], srcStride, + dst[dstY*dstStride+dstX:], dstStride, predW, predH) + } + return true + } + vp9dec.InterPredictorWithScratch(src, srcStride, + dst[dstY*dstStride+dstX:], dstStride, + subpelX, subpelY, tables.FilterKernels[filterIdx], + xStepQ4, yStepQ4, predW, predH, avg, srcOffset, &d.convolveScratch) + return true +} + +func (d *VP9Decoder) vp9ExtendInterPredictSource(src []byte, srcStride int, + srcWidth, srcHeight int, + startX, startY, extStride, extRows int, + srcOffset int, +) ([]byte, int, int) { + need := extStride * extRows + d.interPredictScratch = buffers.EnsureLen(d.interPredictScratch, need) + // libvpx: vp9/decoder/vp9_decodeframe.c:458 build_mc_border splits + // each row into a left memset (clamped to src[0]), a center memcpy + // of in-bounds pixels, and a right memset (clamped to src[w-1]). + // Replaces the per-pixel clamp loop, which was the inner hot loop + // when motion vectors push the kernel window outside the frame + // boundary. + w := srcWidth + h := srcHeight + for y := range extRows { + sy := startY + y + if sy < 0 { + sy = 0 + } else if sy > h-1 { + sy = h - 1 + } + srcRow := src[sy*srcStride:] + dstRow := d.interPredictScratch[y*extStride : y*extStride+extStride] + x := startX + left := 0 + if x < 0 { + left = -x + } + if left > extStride { + left = extStride + } + right := 0 + if x+extStride > w { + right = x + extStride - w + } + if right > extStride { + right = extStride + } + copyN := extStride - left - right + if left > 0 { + leftFill := srcRow[0] + for i := 0; i < left; i++ { + dstRow[i] = leftFill + } + } + if copyN > 0 { + copy(dstRow[left:left+copyN], srcRow[x+left:x+left+copyN]) + } + if right > 0 { + rightFill := srcRow[w-1] + for i := 0; i < right; i++ { + dstRow[left+copyN+i] = rightFill + } + } + } + return d.interPredictScratch, extStride, srcOffset +} + +func vp9ReferencePlaneBorder(ref *vp9ReferenceFrame, plane int) ([]byte, int, int, int) { + if ref == nil || ref.internal == nil || ref.yBorder == 0 { + return nil, 0, 0, 0 + } + switch plane { + case 0: + return ref.internal.yFull, int(ref.yOrigin), int(ref.yBorder), int(ref.yBorder) + case 1: + return ref.internal.uFull, int(ref.uOrigin), int(ref.uvBorderX), int(ref.uvBorderY) + case 2: + return ref.internal.vFull, int(ref.vOrigin), int(ref.uvBorderX), int(ref.uvBorderY) + default: + return nil, 0, 0, 0 + } +} + +func vp9ReferencePlane(ref *vp9ReferenceFrame, plane int) ([]byte, int) { + switch plane { + case 0: + return ref.img.Y, ref.img.YStride + case 1: + return ref.img.U, ref.img.UStride + case 2: + return ref.img.V, ref.img.VStride + default: + return nil, 0 + } +} + +func (d *VP9Decoder) storeVP9CurrentFrameMvs(miRows, miCols, miRow, miCol, + xMis, yMis int, mi *vp9dec.NeighborMi, +) { + if len(d.curFrameMvs) < miRows*miCols || mi == nil { + return + } + yEnd := min(miRow+yMis, miRows) + xEnd := min(miCol+xMis, miCols) + if miRow >= yEnd || miCol >= xEnd { + return + } + v := vp9dec.MvRef{RefFrame: mi.RefFrame, Mv: mi.Mv} + firstRow := d.curFrameMvs[miRow*miCols+miCol : miRow*miCols+xEnd] + for x := range firstRow { + firstRow[x] = v + } + for r := miRow + 1; r < yEnd; r++ { + copy(d.curFrameMvs[r*miCols+miCol:r*miCols+xEnd], firstRow) + } +} + +func clearVP9DecodedDQCoeffs(coeffs []int16, txSize common.TxSize, + txType common.TxType, eob int, +) { + if eob <= 0 { + return + } + clearN := vp9dec.MaxEobForTxSize(txSize) + switch { + case eob == 1: + clearN = 1 + case txType == common.DctDct && txSize <= common.Tx16x16 && eob <= 10: + clearN = 4 * (4 << uint(txSize)) + case txSize == common.Tx32x32 && eob <= 34: + clearN = 256 + } + clear(coeffs[:clearN]) +} + +func (d *VP9Decoder) readVP9ResidueBlock(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, mi *vp9dec.NeighborMi, + uvMode common.PredictionMode, tile vp9dec.TileBounds, + miRow, miCol int, bsize common.BlockSize, segID int, isInter int, +) bool { + if hdr.BitDepthColor.BitDepth > vp9dec.Bits8 { + return d.readVP9ResidueBlockHighBD(r, hdr, mi, uvMode, tile, miRow, miCol, bsize, segID, isInter) + } + aboveOffsets, leftOffsets := d.vp9PlaneContextOffsets(miRow, miCol) + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + if isInter != 0 && !d.unsupportedReconstruct { + if !d.reconstructVP9InterPredictBlock(hdr, mi, miRow, miCol, bsize) { + return false + } + } + // One reader-state snapshot per mode-info block: the transform-block + // loop below is the only bitstream consumer until this function + // returns, so value/range/count round-trip through locals here + // instead of being copied in and out of the Reader per tx block. + rs := r.LocalState() + var coefCounts *vp9dec.CoefCounts + if !hdr.FrameParallelDecoding { + coefCounts = &d.counts.Coef + } + eobTotal := 0 + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeType := 0 + dequant := d.dq.Y[segID] + if plane > 0 { + planeType = 1 + dequant = d.dq.Uv[segID] + } + + txSize := mi.TxSize + if plane > 0 { + txSize = vp9dec.GetUvTxSize(bsize, mi.TxSize, pd) + } + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + rs.Commit() + return false + } + full4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + num4x4W, num4x4H := vp9dec.PlaneMaxBlocks4x4(miRows, miCols, miRow, miCol, + bsize, pd, planeBsize) + step := 1 << uint(txSize) + blockStep := 1 << uint(txSize<<1) + extraStep := ((full4x4W - num4x4W) >> txSize) * blockStep + aboveBase := aboveOffsets[plane] + leftBase := leftOffsets[plane] + blockIdx := 0 + + // Per-plane invariants for the tx-block loop below. + maxEob := vp9dec.MaxEobForTxSize(txSize) + coeffs := d.dqcoeff[:maxEob] + // The scan order only varies per tx block for intra Y (the tx + // type follows the sub-block prediction mode); everything else + // resolves to one table for the whole plane. + var planeScan *common.ScanOrder + if isInter != 0 || planeType != 0 || hdr.Quant.Lossless { + planeScan = common.GetScanPtr(txSize, planeType, isInter, + hdr.Quant.Lossless, uvMode) + } + + // Hoisted per-plane geometry for the inter residue destination + // (vp9InterTxDst inlined: only x0/y0 vary per tx block). + if isInter != 0 && !d.unsupportedReconstruct { + interPlane, interStride := d.vp9OutputPlane(plane) + if interStride > 0 && len(interPlane) > 0 { + interBaseX := (miCol * common.MiSize) >> pd.SubsamplingX + interBaseY := (miRow * common.MiSize) >> pd.SubsamplingY + if interBaseX+((num4x4W+step-1)&^(step-1))*4 <= interStride && + (interBaseY+((num4x4H+step-1)&^(step-1))*4)*interStride <= len(interPlane) { + eobTotal += d.readVP9InterResiduePlane(&rs, pd, planeType, txSize, + dequant, planeScan, coefCounts, num4x4W, num4x4H, step, + aboveBase, leftBase, interPlane, interStride, + interBaseX, interBaseY, hdr.Quant.Lossless, coeffs) + continue + } + } + } + interPlaneOK := false + var interPlane []byte + var interStride, interRows, interBaseX, interBaseY, interBS int + if isInter != 0 && !d.unsupportedReconstruct { + interPlane, interStride = d.vp9OutputPlane(plane) + if interStride > 0 && len(interPlane) > 0 { + interPlaneOK = true + interRows = len(interPlane) / interStride + interBaseX = (miCol * common.MiSize) >> pd.SubsamplingX + interBaseY = (miRow * common.MiSize) >> pd.SubsamplingY + interBS = 4 << uint(txSize) + } + } + + for rr := 0; rr < num4x4H; rr += step { + for cc := 0; cc < num4x4W; cc += step { + mode := uvMode + if plane == 0 { + mode = vp9dec.GetYMode(mi, blockIdx) + } + txType := common.DctDct + if isInter == 0 && planeType == 0 && !hdr.Quant.Lossless { + txType = common.IntraModeToTxType[mode] + } + aboveCtx := pd.AboveContext[aboveBase+cc : aboveBase+cc+step] + leftCtx := pd.LeftContext[leftBase+rr : leftBase+rr+step] + initCtx := 0 + switch txSize { + case common.Tx4x4: + if aboveCtx[0] != 0 { + initCtx++ + } + if leftCtx[0] != 0 { + initCtx++ + } + case common.Tx8x8: + if aboveCtx[0]|aboveCtx[1] != 0 { + initCtx++ + } + if leftCtx[0]|leftCtx[1] != 0 { + initCtx++ + } + case common.Tx16x16: + if aboveCtx[0]|aboveCtx[1]|aboveCtx[2]|aboveCtx[3] != 0 { + initCtx++ + } + if leftCtx[0]|leftCtx[1]|leftCtx[2]|leftCtx[3] != 0 { + initCtx++ + } + default: + if aboveCtx[0]|aboveCtx[1]|aboveCtx[2]|aboveCtx[3]| + aboveCtx[4]|aboveCtx[5]|aboveCtx[6]|aboveCtx[7] != 0 { + initCtx++ + } + if leftCtx[0]|leftCtx[1]|leftCtx[2]|leftCtx[3]| + leftCtx[4]|leftCtx[5]|leftCtx[6]|leftCtx[7] != 0 { + initCtx++ + } + } + so := planeScan + if so == nil { + so = common.GetScanPtr(txSize, planeType, isInter, + hdr.Quant.Lossless, mode) + } + var eob int + if coefCounts == nil { + first := consumeVP9FirstEOB(&rs, uint32(d.fc.CoefProbs[txSize][planeType][isInter][0][initCtx][0])) + if first == 0 { + eob = 0 + } else if first == 1 { + planeCtx := &d.fastCoefCtx + planeCtx.TxSize = txSize + planeCtx.PlaneType = planeType + planeCtx.IsInter = isInter + planeCtx.Dequant = dequant + planeCtx.Scan = so.Scan + planeCtx.Neighbors = so.Neighbors + planeCtx.ScanArr = so.ScanArr + planeCtx.ScanNeighborsArr = so.ScanNeighborsArr + planeCtx.ScanMetaArr = so.ScanMetaArr + planeCtx.FC = &d.fc.CoefProbs + planeCtx.PackedModel = &d.coefProbsPacked[txSize][planeType][isInter] + planeCtx.DQCoeff = &d.dqcoeff + planeCtx.TokenCache = &d.coefTokenCache + buf, _, _, pos := rs.BitView() + var newPos int + eob, newPos, rs.Value, rs.Range, rs.Count = vp9dec.DecodeCoefsFastPlaneAfterEOB( + &rs, planeCtx, buf, pos, rs.Value, rs.Range, rs.Count, initCtx) + rs.CommitPos(newPos) + } else { + eob = vp9dec.DecodeCoefsState(&rs, txSize, planeType, isInter, dequant, + initCtx, so, &d.fc.CoefProbs, + nil, &d.dqcoeff, &d.coefTokenCache) + } + } else { + eob = vp9dec.DecodeCoefsState(&rs, txSize, planeType, isInter, dequant, + initCtx, so, &d.fc.CoefProbs, + coefCounts, &d.dqcoeff, &d.coefTokenCache) + } + eobTotal += eob + if isInter == 0 && !d.unsupportedReconstruct { + dst, stride, ok := d.reconstructVP9IntraPredictTx(hdr, pd, plane, + mode, txSize, tile, miRow, miCol, bsize, rr, cc) + if !ok { + d.markVP9Unsupported() + } else if eob > 0 && dst != nil { + vp9dec.InverseTransformBlock(coeffs, dst, stride, txSize, + txType, eob, hdr.Quant.Lossless) + } + } else if isInter != 0 && !d.unsupportedReconstruct { + x0 := interBaseX + cc*4 + y0 := interBaseY + rr*4 + if !interPlaneOK || x0+interBS > interStride || + y0+interBS > interRows { + d.markVP9Unsupported() + } else if eob > 0 { + vp9dec.InverseTransformBlock(coeffs, + interPlane[y0*interStride+x0:], interStride, txSize, + common.DctDct, eob, hdr.Quant.Lossless) + } + } + if eob == 1 { + coeffs[0] = 0 + } else if eob > 1 && eob <= 8 { + scan := so.Scan + for k := range eob { + coeffs[scan[k]] = 0 + } + } else if eob > 8 { + clearVP9DecodedDQCoeffs(coeffs, txSize, txType, eob) + } + hasResidue := uint8(0) + if eob > 0 { + hasResidue = 1 + } + switch txSize { + case common.Tx4x4: + aboveCtx[0] = hasResidue + leftCtx[0] = hasResidue + case common.Tx8x8: + aboveCtx[0] = hasResidue + aboveCtx[1] = hasResidue + leftCtx[0] = hasResidue + leftCtx[1] = hasResidue + case common.Tx16x16: + aboveCtx[0] = hasResidue + aboveCtx[1] = hasResidue + aboveCtx[2] = hasResidue + aboveCtx[3] = hasResidue + leftCtx[0] = hasResidue + leftCtx[1] = hasResidue + leftCtx[2] = hasResidue + leftCtx[3] = hasResidue + default: + aboveCtx[0] = hasResidue + aboveCtx[1] = hasResidue + aboveCtx[2] = hasResidue + aboveCtx[3] = hasResidue + aboveCtx[4] = hasResidue + aboveCtx[5] = hasResidue + aboveCtx[6] = hasResidue + aboveCtx[7] = hasResidue + leftCtx[0] = hasResidue + leftCtx[1] = hasResidue + leftCtx[2] = hasResidue + leftCtx[3] = hasResidue + leftCtx[4] = hasResidue + leftCtx[5] = hasResidue + leftCtx[6] = hasResidue + leftCtx[7] = hasResidue + } + if hasResidue != 0 { + if cc+step > num4x4W { + clear(aboveCtx[num4x4W-cc:]) + } + if rr+step > num4x4H { + clear(leftCtx[num4x4H-rr:]) + } + } + blockIdx += blockStep + } + blockIdx += extraStep + } + } + rs.Commit() + if isInter != 0 && mi.SbType >= common.Block8x8 && eobTotal == 0 { + mi.Skip = 1 + } + return true +} + +// readVP9InterResiduePlane is readVP9ResidueBlock's transform-block loop +// specialized for one plane of an inter block: the scan order is the +// plane-constant default (DCT_DCT) order, no per-block prediction-mode +// or tx-type lookups are needed, and the residue destination window has +// been bounds-checked by the caller for the whole plane. Returns the +// plane's summed EOB. +// tryConsumeVP9ZeroEOB checks whether the next inter tx block's DC EOB bit is 0 +// (all-zero block) without entering DecodeCoefsState. When bit==1 or a refill +// is needed, rs is left untouched so DecodeCoefsState runs identically. +// consumeVP9FirstEOB consumes the initial c==0 EOB bit directly from rs. +// Returns 0 if EOB=0 (skip block), 1 if EOB=1 (caller should invoke +// DecodeCoefsStateAfterEOB), or -1 if near end-of-buffer (caller falls back to +// DecodeCoefsState). +func consumeVP9FirstEOB(rs *bitstream.ReaderState, prob uint32) int { + if rs.Count < 0 { + buf, _, _, pos := rs.BitView() + if len(buf)-pos < 8 { + return -1 + } + var newPos int + rs.Value, rs.Count, newPos = bitstream.FillFast(buf, pos, rs.Value, rs.Count) + rs.CommitPos(newPos) + } + split := (rs.Range*prob + (256 - prob)) >> 8 + bigsplit := uint64(split) << 56 + if rs.Value >= bigsplit { + rng := rs.Range - split + val := rs.Value - bigsplit + shift := uint32(bits.LeadingZeros8(uint8(rng))) & 7 + rs.Range = rng << shift + rs.Value = val << shift + rs.Count -= int32(shift) + return 1 + } + shift := uint32(bits.LeadingZeros8(uint8(split))) & 7 + rs.Range = split << shift + rs.Value <<= shift + rs.Count -= int32(shift) + return 0 +} + +func (d *VP9Decoder) readVP9InterResiduePlane( + rs *bitstream.ReaderState, + pd *vp9dec.MacroblockdPlane, + planeType int, + txSize common.TxSize, + dequant [2]int16, + so *common.ScanOrder, + coefCounts *vp9dec.CoefCounts, + num4x4W, num4x4H, step int, + aboveBase, leftBase int, + dst []byte, dstStride int, + baseX, baseY int, + lossless bool, + coeffs []int16, +) int { + eobTotal := 0 + aCtx := pd.AboveContext[aboveBase:] + lCtx := pd.LeftContext[leftBase:] + dcProbs := &d.fc.CoefProbs[txSize][planeType][1][0] + // Hoist txSize switch out of the inner (rr, cc) loop so each size runs a + // tight branch-free context read/update without repeated switching. + switch txSize { + case common.Tx4x4: + if coefCounts == nil { + buf, _, _, pos := rs.BitView() + fastLimit := len(buf) - 8 + value := rs.Value + rng := rs.Range + count := rs.Count + ctxInit := false + planeCtx := &d.fastCoefCtx + dcP := [3]uint32{uint32(dcProbs[0][0]), uint32(dcProbs[1][0]), uint32(dcProbs[2][0])} + if num4x4H > 0 && num4x4W > 0 { + aCtx = aCtx[:num4x4W:num4x4W] + lCtx = lCtx[:num4x4H:num4x4H] + } + dstOff := baseY*dstStride + baseX + rowStep := 4 * dstStride + for rr := range num4x4H { + lv := lCtx[rr] + for cc := range num4x4W { + initCtx := int(aCtx[cc]&1) + int(lv&1) + if count < 0 && pos <= fastLimit { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var eob int + if count >= 0 { + prob := dcP[initCtx] + split := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(split) << 56 + if value < bigsplit { + sh := uint32(bits.LeadingZeros8(uint8(split))) + rng = split << sh + value <<= sh + count -= int32(sh) + aCtx[cc] = 0 + lv = 0 + continue + } + nr := rng - split + nv := value - bigsplit + sh := uint32(bits.LeadingZeros8(uint8(nr))) + value = nv << sh + rng = nr << sh + count -= int32(sh) + if !ctxInit { + planeCtx.TxSize = common.Tx4x4 + planeCtx.PlaneType = planeType + planeCtx.IsInter = 1 + planeCtx.Dequant = dequant + planeCtx.Scan = so.Scan + planeCtx.Neighbors = so.Neighbors + planeCtx.ScanArr = so.ScanArr + planeCtx.ScanNeighborsArr = so.ScanNeighborsArr + planeCtx.ScanMetaArr = so.ScanMetaArr + planeCtx.FC = &d.fc.CoefProbs + planeCtx.PackedModel = &d.coefProbsPacked[common.Tx4x4][planeType][1] + planeCtx.DQCoeff = &d.dqcoeff + planeCtx.TokenCache = &d.coefTokenCache + ctxInit = true + } + eob, pos, value, rng, count = vp9dec.DecodeCoefsFastPlaneAfterEOB( + rs, planeCtx, buf, pos, value, rng, count, initCtx) + } else { + rs.Value = value + rs.Range = rng + rs.Count = count + rs.CommitPos(pos) + eob = vp9dec.DecodeCoefsState(rs, common.Tx4x4, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, nil, &d.dqcoeff, &d.coefTokenCache) + value = rs.Value + rng = rs.Range + count = rs.Count + _, _, _, pos = rs.BitView() + } + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + if lossless { + vp9dec.Iwht4x4Add(coeffs, dst[dstOff+cc*4:], dstStride, eob) + } else { + vp9dec.Idct4x4Add(coeffs, dst[dstOff+cc*4:], dstStride, eob) + } + if eob == 1 { + coeffs[0] = 0 + } else if eob <= 8 { + scan := so.Scan + for k := range eob { + coeffs[scan[k]] = 0 + } + } else { + clearVP9DecodedDQCoeffs(coeffs, common.Tx4x4, common.DctDct, eob) + } + hasResidue = 1 + } + aCtx[cc] = hasResidue + lv = hasResidue + } + lCtx[rr] = lv + dstOff += rowStep + } + rs.Value = value + rs.Range = rng + rs.Count = count + rs.CommitPos(pos) + return eobTotal + } + for rr := range num4x4H { + rowDst := dst[(baseY+rr*4)*dstStride+baseX:] + lv := lCtx[rr] + for cc := range num4x4W { + initCtx := 0 + if aCtx[cc] != 0 { + initCtx++ + } + if lv != 0 { + initCtx++ + } + var eob int + if coefCounts == nil { + first := consumeVP9FirstEOB(rs, uint32(dcProbs[initCtx][0])) + if first == 0 { + aCtx[cc] = 0 + lv = 0 + continue + } + if first == 1 { + eob = vp9dec.DecodeCoefsStateAfterEOB(rs, common.Tx4x4, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, &d.dqcoeff, &d.coefTokenCache) + } else { + eob = vp9dec.DecodeCoefsState(rs, common.Tx4x4, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, nil, &d.dqcoeff, &d.coefTokenCache) + } + } else { + eob = vp9dec.DecodeCoefsState(rs, common.Tx4x4, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, coefCounts, + &d.dqcoeff, &d.coefTokenCache) + } + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + if lossless { + vp9dec.Iwht4x4Add(coeffs, rowDst[cc*4:], dstStride, eob) + } else { + vp9dec.Idct4x4Add(coeffs, rowDst[cc*4:], dstStride, eob) + } + if eob == 1 { + coeffs[0] = 0 + } else if eob <= 8 { + scan := so.Scan + for k := range eob { + coeffs[scan[k]] = 0 + } + } else { + clearVP9DecodedDQCoeffs(coeffs, common.Tx4x4, common.DctDct, eob) + } + hasResidue = 1 + } + aCtx[cc] = hasResidue + lv = hasResidue + } + lCtx[rr] = lv + } + case common.Tx8x8: + if coefCounts == nil { + buf, _, _, pos := rs.BitView() + fastLimit := len(buf) - 8 + value := rs.Value + rng := rs.Range + count := rs.Count + ctxInit := false + planeCtx := &d.fastCoefCtx + dcP := [3]uint32{uint32(dcProbs[0][0]), uint32(dcProbs[1][0]), uint32(dcProbs[2][0])} + if num4x4H > 0 && num4x4W > 0 { + aLim := (num4x4W + 1) &^ 1 + lLim := (num4x4H + 1) &^ 1 + aCtx = aCtx[:aLim:aLim] + lCtx = lCtx[:lLim:lLim] + } + dstOff := baseY*dstStride + baseX + rowStep := 8 * dstStride + for rr := 0; rr < num4x4H; rr += 2 { + lv := lCtx[rr] | lCtx[rr+1] + for cc := 0; cc < num4x4W; cc += 2 { + initCtx := int((aCtx[cc]|aCtx[cc+1])&1) + int(lv&1) + if count < 0 && pos <= fastLimit { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var eob int + if count >= 0 { + prob := dcP[initCtx] + split := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(split) << 56 + if value < bigsplit { + sh := uint32(bits.LeadingZeros8(uint8(split))) + rng = split << sh + value <<= sh + count -= int32(sh) + aCtx[cc] = 0 + aCtx[cc+1] = 0 + lv = 0 + continue + } + nr := rng - split + nv := value - bigsplit + sh := uint32(bits.LeadingZeros8(uint8(nr))) + value = nv << sh + rng = nr << sh + count -= int32(sh) + if !ctxInit { + planeCtx.TxSize = common.Tx8x8 + planeCtx.PlaneType = planeType + planeCtx.IsInter = 1 + planeCtx.Dequant = dequant + planeCtx.Scan = so.Scan + planeCtx.Neighbors = so.Neighbors + planeCtx.ScanArr = so.ScanArr + planeCtx.ScanNeighborsArr = so.ScanNeighborsArr + planeCtx.ScanMetaArr = so.ScanMetaArr + planeCtx.FC = &d.fc.CoefProbs + planeCtx.PackedModel = &d.coefProbsPacked[common.Tx8x8][planeType][1] + planeCtx.DQCoeff = &d.dqcoeff + planeCtx.TokenCache = &d.coefTokenCache + ctxInit = true + } + eob, pos, value, rng, count = vp9dec.DecodeCoefsFastPlaneAfterEOB( + rs, planeCtx, buf, pos, value, rng, count, initCtx) + } else { + rs.Value = value + rs.Range = rng + rs.Count = count + rs.CommitPos(pos) + eob = vp9dec.DecodeCoefsState(rs, common.Tx8x8, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, nil, &d.dqcoeff, &d.coefTokenCache) + value = rs.Value + rng = rs.Range + count = rs.Count + _, _, _, pos = rs.BitView() + } + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + vp9dec.Idct8x8Add(coeffs, dst[dstOff+cc*4:], dstStride, eob) + if eob == 1 { + coeffs[0] = 0 + } else if eob <= 8 { + scan := so.ScanArr + for k := range eob { + d.dqcoeff[int(scan[k&1023])&1023] = 0 + } + } else { + clearVP9DecodedDQCoeffs(coeffs, common.Tx8x8, common.DctDct, eob) + } + hasResidue = 1 + } + aCtx[cc] = hasResidue + aCtx[cc+1] = hasResidue + if hasResidue != 0 && cc+2 > num4x4W { + clear(aCtx[num4x4W : cc+2]) + } + lv = hasResidue + } + lCtx[rr] = lv + lCtx[rr+1] = lv + if lv != 0 && rr+2 > num4x4H { + clear(lCtx[num4x4H : rr+2]) + } + dstOff += rowStep + } + rs.Value = value + rs.Range = rng + rs.Count = count + rs.CommitPos(pos) + return eobTotal + } + for rr := 0; rr < num4x4H; rr += 2 { + rowDst := dst[(baseY+rr*4)*dstStride+baseX:] + lv := lCtx[rr] | lCtx[rr+1] + for cc := 0; cc < num4x4W; cc += 2 { + initCtx := 0 + if aCtx[cc]|aCtx[cc+1] != 0 { + initCtx++ + } + if lv != 0 { + initCtx++ + } + var eob int + if coefCounts == nil { + first := consumeVP9FirstEOB(rs, uint32(dcProbs[initCtx][0])) + if first == 0 { + aCtx[cc] = 0 + aCtx[cc+1] = 0 + lv = 0 + continue + } + if first == 1 { + eob = vp9dec.DecodeCoefsStateAfterEOB(rs, common.Tx8x8, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, &d.dqcoeff, &d.coefTokenCache) + } else { + eob = vp9dec.DecodeCoefsState(rs, common.Tx8x8, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, nil, &d.dqcoeff, &d.coefTokenCache) + } + } else { + eob = vp9dec.DecodeCoefsState(rs, common.Tx8x8, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, coefCounts, + &d.dqcoeff, &d.coefTokenCache) + } + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + vp9dec.Idct8x8Add(coeffs, rowDst[cc*4:], dstStride, eob) + if eob == 1 { + coeffs[0] = 0 + } else if eob <= 8 { + scan := so.Scan + for k := range eob { + coeffs[scan[k]] = 0 + } + } else { + clearVP9DecodedDQCoeffs(coeffs, common.Tx8x8, common.DctDct, eob) + } + hasResidue = 1 + } + aCtx[cc] = hasResidue + aCtx[cc+1] = hasResidue + if hasResidue != 0 && cc+2 > num4x4W { + clear(aCtx[num4x4W : cc+2]) + } + lv = hasResidue + } + lCtx[rr] = lv + lCtx[rr+1] = lv + if lv != 0 && rr+2 > num4x4H { + clear(lCtx[num4x4H : rr+2]) + } + } + case common.Tx16x16: + if coefCounts == nil { + buf, _, _, pos := rs.BitView() + fastLimit := len(buf) - 8 + value := rs.Value + rng := rs.Range + count := rs.Count + ctxInit := false + planeCtx := &d.fastCoefCtx + dcP := [3]uint32{uint32(dcProbs[0][0]), uint32(dcProbs[1][0]), uint32(dcProbs[2][0])} + dstOff := baseY*dstStride + baseX + rowStep := 16 * dstStride + for rr := 0; rr < num4x4H; rr += 4 { + lv := lCtx[rr] | lCtx[rr+1] | lCtx[rr+2] | lCtx[rr+3] + for cc := 0; cc < num4x4W; cc += 4 { + initCtx := int((aCtx[cc]|aCtx[cc+1]|aCtx[cc+2]|aCtx[cc+3])&1) + int(lv&1) + if count < 0 && pos <= fastLimit { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var eob int + if count >= 0 { + prob := dcP[initCtx] + split := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(split) << 56 + if value < bigsplit { + sh := uint32(bits.LeadingZeros8(uint8(split))) + rng = split << sh + value <<= sh + count -= int32(sh) + aCtx[cc] = 0 + aCtx[cc+1] = 0 + aCtx[cc+2] = 0 + aCtx[cc+3] = 0 + lv = 0 + continue + } + nr := rng - split + nv := value - bigsplit + sh := uint32(bits.LeadingZeros8(uint8(nr))) + value = nv << sh + rng = nr << sh + count -= int32(sh) + if !ctxInit { + planeCtx.TxSize = common.Tx16x16 + planeCtx.PlaneType = planeType + planeCtx.IsInter = 1 + planeCtx.Dequant = dequant + planeCtx.Scan = so.Scan + planeCtx.Neighbors = so.Neighbors + planeCtx.ScanArr = so.ScanArr + planeCtx.ScanNeighborsArr = so.ScanNeighborsArr + planeCtx.ScanMetaArr = so.ScanMetaArr + planeCtx.FC = &d.fc.CoefProbs + planeCtx.PackedModel = &d.coefProbsPacked[common.Tx16x16][planeType][1] + planeCtx.DQCoeff = &d.dqcoeff + planeCtx.TokenCache = &d.coefTokenCache + ctxInit = true + } + eob, pos, value, rng, count = vp9dec.DecodeCoefsFastPlaneAfterEOB( + rs, planeCtx, buf, pos, value, rng, count, initCtx) + } else { + rs.Value = value + rs.Range = rng + rs.Count = count + rs.CommitPos(pos) + eob = vp9dec.DecodeCoefsState(rs, common.Tx16x16, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, nil, &d.dqcoeff, &d.coefTokenCache) + value = rs.Value + rng = rs.Range + count = rs.Count + _, _, _, pos = rs.BitView() + } + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + vp9dec.Idct16x16Add(coeffs, dst[dstOff+cc*4:], dstStride, eob) + if eob == 1 { + coeffs[0] = 0 + } else if eob <= 8 { + scan := so.Scan + for k := range eob { + coeffs[scan[k]] = 0 + } + } else { + clearVP9DecodedDQCoeffs(coeffs, common.Tx16x16, common.DctDct, eob) + } + hasResidue = 1 + } + aCtx[cc] = hasResidue + aCtx[cc+1] = hasResidue + aCtx[cc+2] = hasResidue + aCtx[cc+3] = hasResidue + if hasResidue != 0 && cc+4 > num4x4W { + clear(aCtx[num4x4W : cc+4]) + } + lv = hasResidue + } + lCtx[rr] = lv + lCtx[rr+1] = lv + lCtx[rr+2] = lv + lCtx[rr+3] = lv + if lv != 0 && rr+4 > num4x4H { + clear(lCtx[num4x4H : rr+4]) + } + dstOff += rowStep + } + rs.Value = value + rs.Range = rng + rs.Count = count + rs.CommitPos(pos) + return eobTotal + } + for rr := 0; rr < num4x4H; rr += 4 { + rowDst := dst[(baseY+rr*4)*dstStride+baseX:] + lv := lCtx[rr] | lCtx[rr+1] | lCtx[rr+2] | lCtx[rr+3] + for cc := 0; cc < num4x4W; cc += 4 { + initCtx := 0 + if aCtx[cc]|aCtx[cc+1]|aCtx[cc+2]|aCtx[cc+3] != 0 { + initCtx++ + } + if lv != 0 { + initCtx++ + } + var eob int + if coefCounts == nil { + first := consumeVP9FirstEOB(rs, uint32(dcProbs[initCtx][0])) + if first == 0 { + aCtx[cc] = 0 + aCtx[cc+1] = 0 + aCtx[cc+2] = 0 + aCtx[cc+3] = 0 + lv = 0 + continue + } + if first == 1 { + eob = vp9dec.DecodeCoefsStateAfterEOB(rs, common.Tx16x16, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, &d.dqcoeff, &d.coefTokenCache) + } else { + eob = vp9dec.DecodeCoefsState(rs, common.Tx16x16, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, nil, &d.dqcoeff, &d.coefTokenCache) + } + } else { + eob = vp9dec.DecodeCoefsState(rs, common.Tx16x16, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, coefCounts, + &d.dqcoeff, &d.coefTokenCache) + } + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + vp9dec.Idct16x16Add(coeffs, rowDst[cc*4:], dstStride, eob) + if eob == 1 { + coeffs[0] = 0 + } else if eob <= 8 { + scan := so.Scan + for k := range eob { + coeffs[scan[k]] = 0 + } + } else { + clearVP9DecodedDQCoeffs(coeffs, common.Tx16x16, common.DctDct, eob) + } + hasResidue = 1 + } + aCtx[cc] = hasResidue + aCtx[cc+1] = hasResidue + aCtx[cc+2] = hasResidue + aCtx[cc+3] = hasResidue + if hasResidue != 0 && cc+4 > num4x4W { + clear(aCtx[num4x4W : cc+4]) + } + lv = hasResidue + } + lCtx[rr] = lv + lCtx[rr+1] = lv + lCtx[rr+2] = lv + lCtx[rr+3] = lv + if lv != 0 && rr+4 > num4x4H { + clear(lCtx[num4x4H : rr+4]) + } + } + default: + for rr := 0; rr < num4x4H; rr += step { + rowDst := dst[(baseY+rr*4)*dstStride+baseX:] + lv := lCtx[rr] | lCtx[rr+1] | lCtx[rr+2] | lCtx[rr+3] | + lCtx[rr+4] | lCtx[rr+5] | lCtx[rr+6] | lCtx[rr+7] + for cc := 0; cc < num4x4W; cc += step { + initCtx := 0 + if aCtx[cc]|aCtx[cc+1]|aCtx[cc+2]|aCtx[cc+3]| + aCtx[cc+4]|aCtx[cc+5]|aCtx[cc+6]|aCtx[cc+7] != 0 { + initCtx++ + } + if lv != 0 { + initCtx++ + } + var eob int + if coefCounts == nil { + first := consumeVP9FirstEOB(rs, uint32(dcProbs[initCtx][0])) + if first == 0 { + for i := range 8 { + aCtx[cc+i] = 0 + } + lv = 0 + continue + } + if first == 1 { + eob = vp9dec.DecodeCoefsStateAfterEOB(rs, txSize, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, &d.dqcoeff, &d.coefTokenCache) + } else { + eob = vp9dec.DecodeCoefsState(rs, txSize, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, nil, &d.dqcoeff, &d.coefTokenCache) + } + } else { + eob = vp9dec.DecodeCoefsState(rs, txSize, planeType, 1, dequant, + initCtx, so, &d.fc.CoefProbs, coefCounts, + &d.dqcoeff, &d.coefTokenCache) + } + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + vp9dec.Idct32x32Add(coeffs, rowDst[cc*4:], dstStride, eob) + if eob == 1 { + coeffs[0] = 0 + } else if eob <= 8 { + scan := so.Scan + for k := range eob { + coeffs[scan[k]] = 0 + } + } else { + clearVP9DecodedDQCoeffs(coeffs, txSize, common.DctDct, eob) + } + hasResidue = 1 + } + for i := range 8 { + aCtx[cc+i] = hasResidue + } + if hasResidue != 0 && cc+8 > num4x4W { + clear(aCtx[num4x4W : cc+8]) + } + lv = hasResidue + } + for i := range 8 { + lCtx[rr+i] = lv + } + if lv != 0 && rr+8 > num4x4H { + clear(lCtx[num4x4H : rr+8]) + } + } + } + return eobTotal +} + +func (d *VP9Decoder) vp9InterTxDst( + hdr *vp9dec.UncompressedHeader, + pd *vp9dec.MacroblockdPlane, + plane int, + txSize common.TxSize, + miRow, miCol int, + blockRow4x4, blockCol4x4 int, +) (dst []byte, stride int, ok bool) { + planeData, stride := d.vp9OutputPlane(plane) + if stride <= 0 || len(planeData) == 0 { + return nil, 0, false + } + rows := len(planeData) / stride + baseX := (miCol * common.MiSize) >> pd.SubsamplingX + baseY := (miRow * common.MiSize) >> pd.SubsamplingY + x0 := baseX + blockCol4x4*4 + y0 := baseY + blockRow4x4*4 + + bs := 4 << uint(txSize) + if x0+bs > stride || y0+bs > rows { + return nil, 0, false + } + return planeData[y0*stride+x0:], stride, true +} + +func (d *VP9Decoder) reconstructVP9IntraPredictBlock( + hdr *vp9dec.UncompressedHeader, + mi *vp9dec.NeighborMi, + uvMode common.PredictionMode, + tile vp9dec.TileBounds, + miRow, miCol int, + bsize common.BlockSize, +) { + if hdr.BitDepthColor.BitDepth > vp9dec.Bits8 { + d.reconstructVP9IntraPredictBlockHighBD(hdr, mi, uvMode, tile, miRow, miCol, bsize) + return + } + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + d.markVP9Unsupported() + return + } + + txSize := mi.TxSize + if plane > 0 { + txSize = vp9dec.GetUvTxSize(bsize, mi.TxSize, pd) + } + num4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + max4x4W, max4x4H := vp9dec.PlaneMaxBlocks4x4(miRows, miCols, + miRow, miCol, bsize, pd, planeBsize) + step := 1 << uint(txSize) + blockStep := 1 << uint(txSize<<1) + extraStep := ((num4x4W - max4x4W) >> txSize) * blockStep + blockIdx := 0 + for rr := 0; rr < max4x4H; rr += step { + for cc := 0; cc < max4x4W; cc += step { + mode := uvMode + if plane == 0 { + mode = vp9dec.GetYMode(mi, blockIdx) + } + if _, _, ok := d.reconstructVP9IntraPredictTx(hdr, pd, plane, mode, txSize, + tile, miRow, miCol, bsize, rr, cc); !ok { + d.markVP9Unsupported() + return + } + blockIdx += blockStep + } + blockIdx += extraStep + } + } +} + +func (d *VP9Decoder) reconstructVP9IntraPredictTx( + hdr *vp9dec.UncompressedHeader, + pd *vp9dec.MacroblockdPlane, + plane int, + mode common.PredictionMode, + txSize common.TxSize, + tile vp9dec.TileBounds, + miRow, miCol int, + bsize common.BlockSize, + blockRow4x4, blockCol4x4 int, +) (dst []byte, stride int, ok bool) { + planeData, stride := d.vp9OutputPlane(plane) + if stride <= 0 || len(planeData) == 0 || int(mode) >= common.IntraModes { + return nil, 0, false + } + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + return nil, 0, false + } + alignedWidth := buffers.Align(int(hdr.Width), 8) + alignedHeight := buffers.Align(int(hdr.Height), 8) + planeWidth := alignedWidth >> pd.SubsamplingX + planeHeight := alignedHeight >> pd.SubsamplingY + baseX := (miCol * common.MiSize) >> pd.SubsamplingX + baseY := (miRow * common.MiSize) >> pd.SubsamplingY + x0 := baseX + blockCol4x4*4 + y0 := baseY + blockRow4x4*4 + + bs := 4 << uint(txSize) + if x0+bs > stride || (y0+bs)*stride > len(planeData) { + return nil, 0, false + } + + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + bounds := vp9dec.BlockBoundsEdgesForMI(miRows, miCols, miRow, miCol, bsize) + leftAvailable := blockCol4x4 != 0 || miCol > tile.MiColStart + left := d.intraScratch.Left[:bs] + if leftAvailable { + for i := range bs { + sy := y0 + i + if bounds.MbToBottomEdge < 0 && sy >= planeHeight { + sy = planeHeight - 1 + } + left[i] = planeData[sy*stride+x0-1] + } + } + + edges := vp9dec.IntraEdgeRefs{ + AboveLeft: 127, + Left: left, + } + upAvailable := blockRow4x4 != 0 || miRow > 0 + if upAvailable { + edges.Above = planeData[(y0-1)*stride+x0:] + if leftAvailable { + edges.AboveLeft = planeData[(y0-1)*stride+x0-1] + } + } + planeBlock4x4W := vp9IntraPredictWidth4x4(bsize, planeBsize, pd) + txw := 1 << uint(txSize) + rightAvailable := blockCol4x4+txw < planeBlock4x4W + dst = planeData[y0*stride+x0:] + vp9dec.BuildIntraPredictorsWithScratch(vp9dec.BuildIntraPredictorsArgs{ + Dst: dst, + DstStride: stride, + Mode: mode, + TxSize: txSize, + Edges: edges, + UpAvailable: upAvailable, + LeftAvailable: leftAvailable, + RightAvailable: rightAvailable, + FrameWidth: planeWidth, + FrameHeight: planeHeight, + X0: x0, + Y0: y0, + MbToRightEdge: bounds.MbToRightEdge, + MbToBottomEdge: bounds.MbToBottomEdge, + }, &d.intraScratch) + return dst, stride, true +} + +func (d *VP9Decoder) vp9OutputPlane(plane int) ([]byte, int) { + switch plane { + case 0: + return d.frameY, d.lastFrame.YStride + case 1: + return d.frameU, d.lastFrame.UStride + case 2: + return d.frameV, d.lastFrame.VStride + default: + return nil, 0 + } +} + +func (d *VP9Decoder) ensureVP9DecoderModeBuffers(miRows, miCols int) { + miColsAligned := common.AlignToSB(miCols) + d.aboveSegCtx = buffers.EnsureLen(d.aboveSegCtx, miColsAligned) + d.leftSegCtx = buffers.EnsureLen(d.leftSegCtx, common.MiBlockSize) + + miGridLen := miRows * miCols + resetLastSegMap := d.segMapMiRows != miRows || d.segMapMiCols != miCols + d.miGrid = buffers.EnsureLen(d.miGrid, miGridLen) + d.miIdx = buffers.EnsureLen(d.miIdx, miGridLen) + d.segMap = buffers.EnsureLen(d.segMap, miGridLen) + d.lastSegMap = buffers.EnsureLen(d.lastSegMap, miGridLen) + if resetLastSegMap { + for i := range d.lastSegMap { + d.lastSegMap[i] = 0 + } + } + d.segMapMiRows = miRows + d.segMapMiCols = miCols + + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + aboveLen := vp9dec.PlaneEntropyLen(miColsAligned, pd.SubsamplingX) + leftLen := vp9dec.PlaneEntropyLen(common.MiBlockSize, pd.SubsamplingY) + pd.AboveContext = buffers.EnsureLen(pd.AboveContext, aboveLen) + pd.LeftContext = buffers.EnsureLen(pd.LeftContext, leftLen) + } +} + +func (d *VP9Decoder) resetVP9AboveEntropyContexts() { + for plane := range vp9dec.MaxMbPlane { + ctx := d.planes[plane].AboveContext + for i := range ctx { + ctx[i] = 0 + } + } +} + +func (d *VP9Decoder) resetVP9LeftEntropyContexts() { + for plane := range vp9dec.MaxMbPlane { + ctx := d.planes[plane].LeftContext + for i := range ctx { + ctx[i] = 0 + } + } +} + +func (d *VP9Decoder) vp9PlaneContextOffsets(miRow, miCol int) ( + above [vp9dec.MaxMbPlane]int, left [vp9dec.MaxMbPlane]int, +) { + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + above[plane] = (miCol * 2) >> pd.SubsamplingX + n := len(pd.LeftContext) + if n&(n-1) == 0 { + left[plane] = ((miRow * 2) >> pd.SubsamplingY) & (n - 1) + } else { + left[plane] = ((miRow * 2) >> pd.SubsamplingY) % n + } + } + return above, left +} + +func (d *VP9Decoder) vp9DecoderMiAt(miRows, miCols, r, c int) *vp9dec.NeighborMi { + if r < 0 || c < 0 || r >= miRows || c >= miCols { + return nil + } + idx := r*miCols + c + if len(d.miIdx) > 0 { + idx = int(d.miIdx[idx]) + } + return &d.miGrid[idx] +} + +func (d *VP9Decoder) fillVP9DecoderMiGrid(miRows, miCols, r, c int, + bsize common.BlockSize, mi *vp9dec.NeighborMi, +) { + rows := int(common.Num8x8BlocksHighLookup[bsize]) + cols := int(common.Num8x8BlocksWideLookup[bsize]) + rowBase := r*miCols + c + srcIdx := int32(rowBase) + if rows == 1 && cols == 1 { + d.miIdx[rowBase] = srcIdx + return + } + rEnd := min(r+rows, miRows) + cEnd := min(c+cols, miCols) + if r >= rEnd || c >= cEnd { + return + } + w := cEnd - c + switch w { + case 1: + for rr := r; rr < rEnd; rr++ { + d.miIdx[rr*miCols+c] = srcIdx + } + case 2: + for rr := r; rr < rEnd; rr++ { + off := rr*miCols + c + d.miIdx[off] = srcIdx + d.miIdx[off+1] = srcIdx + } + case 4: + for rr := r; rr < rEnd; rr++ { + row := d.miIdx[rr*miCols+c : rr*miCols+c+4] + row[0] = srcIdx + row[1] = srcIdx + row[2] = srcIdx + row[3] = srcIdx + } + case 8: + for rr := r; rr < rEnd; rr++ { + row := d.miIdx[rr*miCols+c : rr*miCols+c+8] + row[0] = srcIdx + row[1] = srcIdx + row[2] = srcIdx + row[3] = srcIdx + row[4] = srcIdx + row[5] = srcIdx + row[6] = srcIdx + row[7] = srcIdx + } + default: + for rr := r; rr < rEnd; rr++ { + row := d.miIdx[rr*miCols+c : rr*miCols+cEnd] + for cc := range row { + row[cc] = srcIdx + } + } + } +} + +func prepareVP9DecoderTileDescs(dst []vp9DecoderTileDesc, tileData []byte, + hdr vp9dec.UncompressedHeader, miRows, miCols int, +) ([]vp9DecoderTileDesc, error) { + tileRows := 1 << uint(hdr.Tile.Log2TileRows) + tileCols := 1 << uint(hdr.Tile.Log2TileCols) + nTiles := tileRows * tileCols + dst = buffers.EnsureLen(dst, nTiles) + + offset := 0 + for tileRow := range tileRows { + for tileCol := range tileCols { + idx := tileRow*tileCols + tileCol + isLast := idx == nTiles-1 + tileSize := len(tileData) - offset + if !isLast { + if len(tileData)-offset < 4 { + return nil, ErrInvalidVP9Data + } + size := binary.BigEndian.Uint32(tileData[offset : offset+4]) + offset += 4 + if size > uint32(len(tileData)-offset) { + return nil, ErrInvalidVP9Data + } + tileSize = int(size) + } + if tileSize < 0 || offset+tileSize > len(tileData) { + return nil, ErrInvalidVP9Data + } + dst[idx] = vp9DecoderTileDesc{ + data: tileData[offset : offset+tileSize], + tile: vp9dec.TileBounds{ + MiRowStart: vp9dec.TileOffset(tileRow, miRows, + hdr.Tile.Log2TileRows), + MiRowEnd: vp9dec.TileOffset(tileRow+1, miRows, + hdr.Tile.Log2TileRows), + MiColStart: vp9dec.TileOffset(tileCol, miCols, + hdr.Tile.Log2TileCols), + MiColEnd: vp9dec.TileOffset(tileCol+1, miCols, + hdr.Tile.Log2TileCols), + }, + } + offset += tileSize + } + } + if offset != len(tileData) { + return nil, ErrInvalidVP9Data + } + return dst, nil +} + +func (d *VP9Decoder) vp9DecodeTileCol(tileCol, tileCols int) int { + if d != nil && d.opts.InvertTileDecodeOrder { + return tileCols - tileCol - 1 + } + return tileCol +} diff --git a/internal/vp9/codec/vp9_decoder_rowmt_modes.go b/internal/vp9/codec/vp9_decoder_rowmt_modes.go new file mode 100644 index 0000000..cf2fc4d --- /dev/null +++ b/internal/vp9/codec/vp9_decoder_rowmt_modes.go @@ -0,0 +1,1407 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder_rowmt_modes.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" +) + +type vp9DecoderRowMTPartitionCursor struct { + parts []common.PartitionType + pos int +} + +type vp9DecoderRowMTResidueCursor struct { + eobPos [vp9dec.MaxMbPlane]int + coeffPos [vp9dec.MaxMbPlane]int +} + +func (c *vp9DecoderRowMTPartitionCursor) write(partition common.PartitionType) bool { + if c == nil || c.pos < 0 || c.pos >= len(c.parts) { + return false + } + c.parts[c.pos] = partition + c.pos++ + return true +} + +func (c *vp9DecoderRowMTPartitionCursor) read() (common.PartitionType, bool) { + if c == nil || c.pos < 0 || c.pos >= len(c.parts) { + return common.PartitionNone, false + } + partition := c.parts[c.pos] + c.pos++ + return partition, true +} + +func (s *vp9DecoderRowMTFrameStorage) partitionCursor(sb int) vp9DecoderRowMTPartitionCursor { + if s == nil || sb < 0 || sb >= s.numSBs { + return vp9DecoderRowMTPartitionCursor{} + } + return vp9DecoderRowMTPartitionCursor{parts: s.partitionsForSB(sb)} +} + +func (s *vp9DecoderRowMTFrameStorage) setUVMode(miCols, miRow, miCol int, + mode common.PredictionMode, +) bool { + idx := miRow*miCols + miCol + if s == nil || miCols <= 0 || idx < 0 || idx >= len(s.uvMode) { + return false + } + s.uvMode[idx] = mode + return true +} + +func (s *vp9DecoderRowMTFrameStorage) getUVMode(miCols, miRow, miCol int) ( + common.PredictionMode, bool, +) { + idx := miRow*miCols + miCol + if s == nil || miCols <= 0 || idx < 0 || idx >= len(s.uvMode) { + return common.DcPred, false + } + return s.uvMode[idx], true +} + +func (s *vp9DecoderRowMTFrameStorage) setResidueParsed(miCols, miRow, miCol int, + parsed bool, +) bool { + idx := miRow*miCols + miCol + if s == nil || miCols <= 0 || idx < 0 || idx >= len(s.residueParsed) { + return false + } + s.residueParsed[idx] = parsed + return true +} + +func (s *vp9DecoderRowMTFrameStorage) residueParsedAt(miCols, miRow, miCol int) ( + bool, bool, +) { + idx := miRow*miCols + miCol + if s == nil || miCols <= 0 || idx < 0 || idx >= len(s.residueParsed) { + return false, false + } + return s.residueParsed[idx], true +} + +func (d *VP9Decoder) vp9DecoderRowMTOneTileStorage() *vp9DecoderRowMTFrameStorage { + if d == nil || d.vp9TilePool == nil || !d.opts.DecoderRowMT || + d.lastFrame.BitDepth > 8 || + len(d.vp9TilePool.rowMTSyncs) != 1 { + return nil + } + return &d.vp9TilePool.rowMTFrame +} + +func vp9DecoderRowMTSBIndex(miCols, miRow, miCol int) int { + sbCols := common.AlignToSB(miCols) >> common.MiBlockSizeLog2 + return (miRow>>common.MiBlockSizeLog2)*sbCols + + (miCol >> common.MiBlockSizeLog2) +} + +func vp9DecoderRowMTDQCoeffScratch(coeffs []int16, off, maxEob int) ( + *[1024]int16, bool, +) { + if off < 0 || maxEob <= 0 || off+maxEob > len(coeffs) || off+1024 > cap(coeffs) { + return nil, false + } + // libvpx points xd.plane[].dqcoeff at the transform's first coefficient + // inside the per-SB slab. DecodeCoefsState only touches maxEob entries. + return (*[1024]int16)(coeffs[off : off+1024 : cap(coeffs)]), true +} + +func (d *VP9Decoder) parseVP9IntraModeTileRowMTSplit(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.IntraSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + storage := d.vp9DecoderRowMTOneTileStorage() + rowMT := d.rowMTSync + if storage == nil || rowMT == nil { + return ErrInvalidVP9Data + } + if helpers := d.vp9DecoderRowMTQueueHelpers(); helpers > 0 { + return d.parseVP9IntraModeTileRowMTQueued(r, hdr, comp, maps, tile, + miRows, miCols, partitionProbs, storage, helpers) + } + tileSbCols := (tile.MiColEnd - tile.MiColStart + common.MiBlockSize - 1) >> + common.MiBlockSizeLog2 + globalSbCols := common.AlignToSB(miCols) >> common.MiBlockSizeLog2 + for miRow := tile.MiRowStart; miRow < tile.MiRowEnd; miRow += common.MiBlockSize { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + sbRow := (miRow - tile.MiRowStart) >> common.MiBlockSizeLog2 + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sbCol := (miCol - tile.MiColStart) >> common.MiBlockSizeLog2 + rowMT.read(sbRow, sbCol) + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.parseVP9IntraModeSbRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, common.Block64x64, comp.TxMode, + partitionProbs, &cursor, &residue) { + return ErrInvalidVP9Data + } + } + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sbCol := (miCol - tile.MiColStart) >> common.MiBlockSizeLog2 + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + if sbRow > 0 && !storage.reconMapRead(sb-globalSbCols, sbRow-1) { + return ErrInvalidVP9Data + } + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.reconstructVP9IntraModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, common.Block64x64, &cursor, + &residue) { + return ErrInvalidVP9Data + } + if !storage.reconMapWrite(sb, sbRow) { + return ErrInvalidVP9Data + } + rowMT.write(sbRow, sbCol, tileSbCols) + } + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil +} + +func (d *VP9Decoder) parseVP9InterModeTileRowMTSplit(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + storage := d.vp9DecoderRowMTOneTileStorage() + rowMT := d.rowMTSync + if storage == nil || rowMT == nil { + return ErrInvalidVP9Data + } + if helpers := d.vp9DecoderRowMTQueueHelpers(); helpers > 0 { + return d.parseVP9InterModeTileRowMTQueued(r, hdr, comp, maps, tile, + miRows, miCols, partitionProbs, storage, helpers) + } + tileSbCols := (tile.MiColEnd - tile.MiColStart + common.MiBlockSize - 1) >> + common.MiBlockSizeLog2 + globalSbCols := common.AlignToSB(miCols) >> common.MiBlockSizeLog2 + for miRow := tile.MiRowStart; miRow < tile.MiRowEnd; miRow += common.MiBlockSize { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + sbRow := (miRow - tile.MiRowStart) >> common.MiBlockSizeLog2 + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sbCol := (miCol - tile.MiColStart) >> common.MiBlockSizeLog2 + rowMT.read(sbRow, sbCol) + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.parseVP9InterModeSbRowMT(r, hdr, comp, maps, storage, sb, + tile, miRows, miCols, miRow, miCol, common.Block64x64, + partitionProbs, &cursor, &residue) { + return ErrInvalidVP9Data + } + } + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sbCol := (miCol - tile.MiColStart) >> common.MiBlockSizeLog2 + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + if sbRow > 0 && !storage.reconMapRead(sb-globalSbCols, sbRow-1) { + return ErrInvalidVP9Data + } + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.reconstructVP9InterModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, common.Block64x64, &cursor, + &residue) { + return ErrInvalidVP9Data + } + if !storage.reconMapWrite(sb, sbRow) { + return ErrInvalidVP9Data + } + rowMT.write(sbRow, sbCol, tileSbCols) + } + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil +} + +func (d *VP9Decoder) vp9DecoderRowMTQueueHelpers() int { + if d == nil || d.vp9TilePool == nil { + return 0 + } + return int(d.vp9TilePool.helperCount) +} + +func (d *VP9Decoder) prepareVP9DecoderRowMTLoopFilter( + storage *vp9DecoderRowMTFrameStorage, hdr *vp9dec.UncompressedHeader, + miRows, miCols int, +) bool { + if d == nil || storage == nil || hdr == nil { + return false + } + lpfActive := !d.unsupportedReconstruct && + hdr.Loopfilter.FilterLevel != 0 && !d.opts.SkipLoopFilter + if lpfActive { + if !d.prepareVP9LoopFilterMaskStorage(miRows, miCols) { + storage.markIdle() + return false + } + sbRows := (miRows + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + storage.lfSync.reset(sbRows, int(hdr.Width)) + } + storage.start(lpfActive) + return true +} + +func (d *VP9Decoder) vp9DecoderRowMTLoopFilterApplied() bool { + if d == nil || d.vp9TilePool == nil || !d.opts.DecoderRowMT { + return false + } + return d.vp9TilePool.rowMTFrame.loopFilterApplied() +} + +func (d *VP9Decoder) runVP9DecoderMultiTileRowMTJobs( + descs []vp9DecoderTileDesc, kind vp9DecoderTileJobKind, + comp vp9dec.CompressedHeader, intraMaps vp9dec.IntraSegmentMaps, + interMaps vp9dec.InterSegmentMaps, miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + p := d.vp9TilePool + if p == nil || len(descs) <= 1 || len(descs) != len(p.rowMTSyncs) { + return ErrInvalidVP9Data + } + storage := &p.rowMTFrame + if err := storage.prepareTileStates(d, descs); err != nil { + return err + } + if !d.prepareVP9DecoderRowMTLoopFilter(storage, &p.header, miRows, miCols) { + return ErrInvalidVP9Data + } + helpers := int(p.helperCount) + for worker := range helpers { + p.prepareRowMTJob(worker, d, kind, &p.header, comp, + vp9dec.TileBounds{}, intraMaps, interMaps, miRows, miCols, + partitionProbs, storage) + } + mainJob := &p.mainRowMTJob + mainJob.prepareRowMTJob(d, kind, &p.header, comp, vp9dec.TileBounds{}, + intraMaps, interMaps, miRows, miCols, partitionProbs, storage) + for tileCol := range descs { + if !storage.jobq.queue(vp9DecoderRowMTJob{ + rowNum: descs[tileCol].tile.MiRowStart, tileCol: tileCol, + jobType: vp9DecoderRowMTJobParse, + }) { + return ErrInvalidVP9Data + } + } + epoch := p.startHelperWorkers(helpers) + mainJob.runRowMT() + p.waitHelperWorkers(epoch, helpers) + err := mainJob.err + if mainJob.unsupported { + d.unsupportedReconstruct = true + } + for worker := range helpers { + job := &p.jobs[worker] + if job.unsupported { + d.unsupportedReconstruct = true + } + if err == nil && job.err != nil { + err = job.err + } + } + if err != nil { + return err + } + if !p.header.FrameParallelDecoding { + for tileCol := range storage.tileStates { + vp9dec.MergeFrameCounts(&d.counts, + &storage.tileStates[tileCol].decoder.counts) + } + } + p.lastTileJobs = uint8(len(descs)) + return nil +} + +func (d *VP9Decoder) parseVP9IntraModeTileRowMTQueued(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.IntraSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, + storage *vp9DecoderRowMTFrameStorage, helpers int, +) error { + p := d.vp9TilePool + if p == nil || hdr == nil { + return ErrInvalidVP9Data + } + if helpers > int(p.helperCount) { + helpers = int(p.helperCount) + } + p.header = *hdr + workerHdr := &p.header + intraMaps := *maps + storage.reader = *r + if !d.prepareVP9DecoderRowMTLoopFilter(storage, workerHdr, miRows, miCols) { + return ErrInvalidVP9Data + } + for worker := range helpers { + p.prepareRowMTJob(worker, d, vp9DecoderTileJobIntra, workerHdr, comp, + tile, intraMaps, vp9dec.InterSegmentMaps{}, miRows, miCols, + partitionProbs, storage) + } + mainJob := &p.mainRowMTJob + mainJob.prepareRowMTJob(d, vp9DecoderTileJobIntra, workerHdr, comp, tile, + intraMaps, vp9dec.InterSegmentMaps{}, miRows, miCols, partitionProbs, + storage) + if !storage.jobq.queue(vp9DecoderRowMTJob{ + rowNum: tile.MiRowStart, tileCol: 0, jobType: vp9DecoderRowMTJobParse, + }) { + return ErrInvalidVP9Data + } + epoch := p.startHelperWorkers(helpers) + mainJob.runRowMT() + p.waitHelperWorkers(epoch, helpers) + *r = storage.reader + err := mainJob.err + if mainJob.unsupported { + d.unsupportedReconstruct = true + } + for worker := range helpers { + job := &p.jobs[worker] + if job.unsupported { + d.unsupportedReconstruct = true + } + if err == nil && job.err != nil { + err = job.err + } + } + if err != nil { + return err + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil +} + +func (d *VP9Decoder) parseVP9InterModeTileRowMTQueued(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, tile vp9dec.TileBounds, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, + storage *vp9DecoderRowMTFrameStorage, helpers int, +) error { + p := d.vp9TilePool + if p == nil || hdr == nil { + return ErrInvalidVP9Data + } + if helpers > int(p.helperCount) { + helpers = int(p.helperCount) + } + p.header = *hdr + workerHdr := &p.header + interMaps := *maps + storage.reader = *r + if !d.prepareVP9DecoderRowMTLoopFilter(storage, workerHdr, miRows, miCols) { + return ErrInvalidVP9Data + } + for worker := range helpers { + p.prepareRowMTJob(worker, d, vp9DecoderTileJobInter, workerHdr, comp, + tile, vp9dec.IntraSegmentMaps{}, interMaps, miRows, miCols, + partitionProbs, storage) + } + mainJob := &p.mainRowMTJob + mainJob.prepareRowMTJob(d, vp9DecoderTileJobInter, workerHdr, comp, tile, + vp9dec.IntraSegmentMaps{}, interMaps, miRows, miCols, partitionProbs, + storage) + if !storage.jobq.queue(vp9DecoderRowMTJob{ + rowNum: tile.MiRowStart, tileCol: 0, jobType: vp9DecoderRowMTJobParse, + }) { + return ErrInvalidVP9Data + } + epoch := p.startHelperWorkers(helpers) + mainJob.runRowMT() + p.waitHelperWorkers(epoch, helpers) + *r = storage.reader + err := mainJob.err + if mainJob.unsupported { + d.unsupportedReconstruct = true + } + for worker := range helpers { + job := &p.jobs[worker] + if job.unsupported { + d.unsupportedReconstruct = true + } + if err == nil && job.err != nil { + err = job.err + } + } + if err != nil { + return err + } + if r.HasError() { + return ErrInvalidVP9Data + } + return nil +} + +func (j *vp9DecoderTileJob) runRowMTParse(rowJob vp9DecoderRowMTJob) error { + if j == nil || j.rowMTParent == nil || j.rowMTStorage == nil { + return ErrInvalidVP9Data + } + parser := j.rowMTParent + reader := &j.rowMTStorage.reader + tile := j.tile + if state := j.rowMTStorage.tileState(rowJob.tileCol); state != nil { + parser = &state.decoder + reader = &state.reader + tile = state.tile + } + var err error + if j.kind == vp9DecoderTileJobIntra { + err = parser.parseVP9IntraModeTileRowForRowMT( + reader, j.hdr, &j.intraMaps, j.rowMTStorage, + tile, j.miRows, j.miCols, rowJob.rowNum, j.comp.TxMode, + j.partitionProbs) + } else { + err = parser.parseVP9InterModeTileRowForRowMT( + reader, j.hdr, j.comp, &j.interMaps, + j.rowMTStorage, tile, j.miRows, j.miCols, rowJob.rowNum, + j.partitionProbs) + } + if err != nil { + return err + } + if !j.rowMTStorage.jobq.queue(vp9DecoderRowMTJob{ + rowNum: rowJob.rowNum, tileCol: rowJob.tileCol, + jobType: vp9DecoderRowMTJobRecon, + }) { + return ErrInvalidVP9Data + } + nextRow := rowJob.rowNum + common.MiBlockSize + if nextRow < tile.MiRowEnd { + if !j.rowMTStorage.jobq.queue(vp9DecoderRowMTJob{ + rowNum: nextRow, tileCol: rowJob.tileCol, + jobType: vp9DecoderRowMTJobParse, + }) { + return ErrInvalidVP9Data + } + } + return nil +} + +func (d *VP9Decoder) parseVP9IntraModeTileRowForRowMT(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, maps *vp9dec.IntraSegmentMaps, + storage *vp9DecoderRowMTFrameStorage, tile vp9dec.TileBounds, + miRows, miCols, miRow int, txMode common.TxMode, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.parseVP9IntraModeSbRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, common.Block64x64, txMode, + partitionProbs, &cursor, &residue) { + return ErrInvalidVP9Data + } + } + return nil +} + +func (d *VP9Decoder) parseVP9InterModeTileRowForRowMT(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, storage *vp9DecoderRowMTFrameStorage, + tile vp9dec.TileBounds, miRows, miCols, miRow int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + for i := range d.leftSegCtx { + d.leftSegCtx[i] = 0 + } + d.resetVP9LeftEntropyContexts() + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.parseVP9InterModeSbRowMT(r, hdr, comp, maps, storage, sb, + tile, miRows, miCols, miRow, miCol, common.Block64x64, + partitionProbs, &cursor, &residue) { + return ErrInvalidVP9Data + } + } + return nil +} + +func (d *VP9Decoder) reconstructVP9IntraModeTileRowMTRow( + hdr *vp9dec.UncompressedHeader, storage *vp9DecoderRowMTFrameStorage, + tile vp9dec.TileBounds, miRows, miCols, miRow, tileCol int, +) error { + globalSbCols := common.AlignToSB(miCols) >> common.MiBlockSizeLog2 + sbRow := (miRow - tile.MiRowStart) >> common.MiBlockSizeLog2 + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + if sbRow > 0 && !storage.reconMapRead(sb-globalSbCols, + (sbRow-1)*storage.tileCols+tileCol) { + return ErrInvalidVP9Data + } + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.reconstructVP9IntraModeSbRowMT(hdr, storage, sb, tile, miRows, + miCols, miRow, miCol, common.Block64x64, &cursor, &residue) { + return ErrInvalidVP9Data + } + if miCol+common.MiBlockSize >= tile.MiColEnd && + !storage.queueLoopFilterJobs(miRow, tile.MiRowStart, tile.MiRowEnd) { + return ErrInvalidVP9Data + } + if !storage.reconMapWrite(sb, sbRow*storage.tileCols+tileCol) { + return ErrInvalidVP9Data + } + } + return nil +} + +func (d *VP9Decoder) reconstructVP9InterModeTileRowMTRow( + hdr *vp9dec.UncompressedHeader, storage *vp9DecoderRowMTFrameStorage, + tile vp9dec.TileBounds, miRows, miCols, miRow, tileCol int, +) error { + globalSbCols := common.AlignToSB(miCols) >> common.MiBlockSizeLog2 + sbRow := (miRow - tile.MiRowStart) >> common.MiBlockSizeLog2 + for miCol := tile.MiColStart; miCol < tile.MiColEnd; miCol += common.MiBlockSize { + sb := vp9DecoderRowMTSBIndex(miCols, miRow, miCol) + if sbRow > 0 && !storage.reconMapRead(sb-globalSbCols, + (sbRow-1)*storage.tileCols+tileCol) { + return ErrInvalidVP9Data + } + cursor := storage.partitionCursor(sb) + residue := vp9DecoderRowMTResidueCursor{} + if !d.reconstructVP9InterModeSbRowMT(hdr, storage, sb, tile, miRows, + miCols, miRow, miCol, common.Block64x64, &cursor, &residue) { + return ErrInvalidVP9Data + } + if miCol+common.MiBlockSize >= tile.MiColEnd && + !storage.queueLoopFilterJobs(miRow, tile.MiRowStart, tile.MiRowEnd) { + return ErrInvalidVP9Data + } + if !storage.reconMapWrite(sb, sbRow*storage.tileCols+tileCol) { + return ErrInvalidVP9Data + } + } + return nil +} + +func (s *vp9DecoderRowMTFrameStorage) queueLoopFilterJobs(miRow, + miRowStart, miRowEnd int, +) bool { + if s == nil || !s.loopFilterActive() { + return true + } + sbRow := miRow >> common.MiBlockSizeLog2 + if !s.lfSync.tileRowDone(sbRow, s.tileCols) { + return true + } + if miRow > miRowStart && !s.jobq.queue(vp9DecoderRowMTJob{ + rowNum: miRow - common.MiBlockSize, jobType: vp9DecoderRowMTJobLPF, + }) { + return false + } + if miRow+common.MiBlockSize >= miRowEnd && + !s.jobq.queue(vp9DecoderRowMTJob{ + rowNum: miRow, jobType: vp9DecoderRowMTJobLPF, + }) { + return false + } + return true +} + +func (d *VP9Decoder) parseVP9IntraModeSbRowMT(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, maps *vp9dec.IntraSegmentMaps, + storage *vp9DecoderRowMTFrameStorage, sb int, tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, txMode common.TxMode, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, + cursor *vp9DecoderRowMTPartitionCursor, + residue *vp9DecoderRowMTResidueCursor, +) bool { + if miRow >= miRows || miCol >= miCols { + return true + } + bsl := int(common.BWidthLog2Lookup[bsize]) + bs := (1 << uint(bsl)) / 4 + ctx := vp9dec.PartitionPlaneContext(d.aboveSegCtx, d.leftSegCtx, miRow, miCol, bsize) + probs := partitionProbs[ctx][:] + hasRows := miRow+bs < miRows + hasCols := miCol+bs < miCols + partition := vp9dec.ReadPartition(r, probs, hasRows, hasCols) + if !cursor.write(partition) { + return false + } + if !hdr.FrameParallelDecoding { + d.counts.Partition[ctx][partition]++ + } + subsize := common.SubsizeLookup[partition][bsize] + if subsize >= common.BlockSizes { + return false + } + if subsize < common.Block8x8 { + if !d.readVP9IntraModeBlockRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, txMode, residue) { + return false + } + } else { + switch partition { + case common.PartitionNone: + if !d.readVP9IntraModeBlockRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, txMode, residue) { + return false + } + case common.PartitionHorz: + if !d.readVP9IntraModeBlockRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, txMode, residue) { + return false + } + if miRow+bs < miRows { + if !d.readVP9IntraModeBlockRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow+bs, miCol, subsize, txMode, + residue) { + return false + } + } + case common.PartitionVert: + if !d.readVP9IntraModeBlockRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, txMode, residue) { + return false + } + if miCol+bs < miCols { + if !d.readVP9IntraModeBlockRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol+bs, subsize, txMode, + residue) { + return false + } + } + case common.PartitionSplit: + if !d.parseVP9IntraModeSbRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, txMode, + partitionProbs, cursor, residue) { + return false + } + if !d.parseVP9IntraModeSbRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow, miCol+bs, subsize, txMode, + partitionProbs, cursor, residue) { + return false + } + if !d.parseVP9IntraModeSbRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow+bs, miCol, subsize, txMode, + partitionProbs, cursor, residue) { + return false + } + if !d.parseVP9IntraModeSbRowMT(r, hdr, maps, storage, sb, tile, + miRows, miCols, miRow+bs, miCol+bs, subsize, txMode, + partitionProbs, cursor, residue) { + return false + } + default: + return false + } + } + if bsize >= common.Block8x8 && + (bsize == common.Block8x8 || partition != common.PartitionSplit) { + vp9dec.UpdatePartitionContext(d.aboveSegCtx, d.leftSegCtx, + miRow, miCol, subsize, vp9dec.PartitionContextUpdateWidth(bs)) + } + return true +} + +func (d *VP9Decoder) parseVP9InterModeSbRowMT(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, storage *vp9DecoderRowMTFrameStorage, + sb int, tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, + cursor *vp9DecoderRowMTPartitionCursor, + residue *vp9DecoderRowMTResidueCursor, +) bool { + if miRow >= miRows || miCol >= miCols { + return true + } + bsl := int(common.BWidthLog2Lookup[bsize]) + bs := (1 << uint(bsl)) / 4 + ctx := vp9dec.PartitionPlaneContext(d.aboveSegCtx, d.leftSegCtx, miRow, miCol, bsize) + probs := partitionProbs[ctx][:] + hasRows := miRow+bs < miRows + hasCols := miCol+bs < miCols + partition := vp9dec.ReadPartition(r, probs, hasRows, hasCols) + if !cursor.write(partition) { + return false + } + if !hdr.FrameParallelDecoding { + d.counts.Partition[ctx][partition]++ + } + subsize := common.SubsizeLookup[partition][bsize] + if subsize >= common.BlockSizes { + return false + } + if subsize < common.Block8x8 { + if !d.readVP9InterModeBlockRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + } else { + switch partition { + case common.PartitionNone: + if !d.readVP9InterModeBlockRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + case common.PartitionHorz: + if !d.readVP9InterModeBlockRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + if miRow+bs < miRows { + if !d.readVP9InterModeBlockRowMT(r, hdr, comp, maps, storage, sb, + tile, miRows, miCols, miRow+bs, miCol, subsize, residue) { + return false + } + } + case common.PartitionVert: + if !d.readVP9InterModeBlockRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + if miCol+bs < miCols { + if !d.readVP9InterModeBlockRowMT(r, hdr, comp, maps, storage, sb, + tile, miRows, miCols, miRow, miCol+bs, subsize, residue) { + return false + } + } + case common.PartitionSplit: + if !d.parseVP9InterModeSbRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, partitionProbs, cursor, + residue) { + return false + } + if !d.parseVP9InterModeSbRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow, miCol+bs, subsize, partitionProbs, + cursor, residue) { + return false + } + if !d.parseVP9InterModeSbRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow+bs, miCol, subsize, partitionProbs, + cursor, residue) { + return false + } + if !d.parseVP9InterModeSbRowMT(r, hdr, comp, maps, storage, sb, tile, + miRows, miCols, miRow+bs, miCol+bs, subsize, partitionProbs, + cursor, residue) { + return false + } + default: + return false + } + } + if bsize >= common.Block8x8 && + (bsize == common.Block8x8 || partition != common.PartitionSplit) { + vp9dec.UpdatePartitionContext(d.aboveSegCtx, d.leftSegCtx, + miRow, miCol, subsize, vp9dec.PartitionContextUpdateWidth(bs)) + } + return true +} + +func (d *VP9Decoder) reconstructVP9IntraModeSbRowMT( + hdr *vp9dec.UncompressedHeader, storage *vp9DecoderRowMTFrameStorage, + sb int, tile vp9dec.TileBounds, miRows, miCols, miRow, miCol int, + bsize common.BlockSize, cursor *vp9DecoderRowMTPartitionCursor, + residue *vp9DecoderRowMTResidueCursor, +) bool { + if miRow >= miRows || miCol >= miCols { + return true + } + bsl := int(common.BWidthLog2Lookup[bsize]) + bs := (1 << uint(bsl)) / 4 + partition, ok := cursor.read() + if !ok { + return false + } + subsize := common.SubsizeLookup[partition][bsize] + if subsize >= common.BlockSizes { + return false + } + if subsize < common.Block8x8 { + return d.reconstructVP9IntraModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) + } + switch partition { + case common.PartitionNone: + return d.reconstructVP9IntraModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) + case common.PartitionHorz: + if !d.reconstructVP9IntraModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + if miRow+bs < miRows { + return d.reconstructVP9IntraModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow+bs, miCol, subsize, residue) + } + return true + case common.PartitionVert: + if !d.reconstructVP9IntraModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + if miCol+bs < miCols { + return d.reconstructVP9IntraModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol+bs, subsize, residue) + } + return true + case common.PartitionSplit: + return d.reconstructVP9IntraModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, cursor, residue) && + d.reconstructVP9IntraModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol+bs, subsize, cursor, residue) && + d.reconstructVP9IntraModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow+bs, miCol, subsize, cursor, residue) && + d.reconstructVP9IntraModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow+bs, miCol+bs, subsize, cursor, residue) + default: + return false + } +} + +func (d *VP9Decoder) reconstructVP9InterModeSbRowMT( + hdr *vp9dec.UncompressedHeader, storage *vp9DecoderRowMTFrameStorage, + sb int, tile vp9dec.TileBounds, miRows, miCols, miRow, miCol int, + bsize common.BlockSize, cursor *vp9DecoderRowMTPartitionCursor, + residue *vp9DecoderRowMTResidueCursor, +) bool { + if miRow >= miRows || miCol >= miCols { + return true + } + bsl := int(common.BWidthLog2Lookup[bsize]) + bs := (1 << uint(bsl)) / 4 + partition, ok := cursor.read() + if !ok { + return false + } + subsize := common.SubsizeLookup[partition][bsize] + if subsize >= common.BlockSizes { + return false + } + if subsize < common.Block8x8 { + return d.reconstructVP9InterModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) + } + switch partition { + case common.PartitionNone: + return d.reconstructVP9InterModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) + case common.PartitionHorz: + if !d.reconstructVP9InterModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + if miRow+bs < miRows { + return d.reconstructVP9InterModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow+bs, miCol, subsize, residue) + } + return true + case common.PartitionVert: + if !d.reconstructVP9InterModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, residue) { + return false + } + if miCol+bs < miCols { + return d.reconstructVP9InterModeBlockRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol+bs, subsize, residue) + } + return true + case common.PartitionSplit: + return d.reconstructVP9InterModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol, subsize, cursor, residue) && + d.reconstructVP9InterModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow, miCol+bs, subsize, cursor, residue) && + d.reconstructVP9InterModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow+bs, miCol, subsize, cursor, residue) && + d.reconstructVP9InterModeSbRowMT(hdr, storage, sb, tile, + miRows, miCols, miRow+bs, miCol+bs, subsize, cursor, residue) + default: + return false + } +} + +func (d *VP9Decoder) readVP9IntraModeBlockRowMT(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, maps *vp9dec.IntraSegmentMaps, + storage *vp9DecoderRowMTFrameStorage, sb int, tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, txMode common.TxMode, + residue *vp9DecoderRowMTResidueCursor, +) bool { + xMis := min(int(common.Num8x8BlocksWideLookup[bsize]), miCols-miCol) + yMis := min(int(common.Num8x8BlocksHighLookup[bsize]), miRows-miRow) + mi := &d.miGrid[miRow*miCols+miCol] + *mi = vp9dec.NeighborMi{SbType: bsize} + above := d.vp9DecoderMiAt(miRows, miCols, miRow-1, miCol) + var left *vp9dec.NeighborMi + if miCol > tile.MiColStart { + left = d.vp9DecoderMiAt(miRows, miCols, miRow, miCol-1) + } + out := vp9dec.ReadIntraFrameModeInfo(vp9dec.IntraFrameDriverArgs{ + Reader: r, + Fc: &d.fc, + Seg: &hdr.Seg, + Maps: maps, + TxMode: txMode, + MiOffset: miRow*miCols + miCol, + XMis: xMis, + YMis: yMis, + Above: above, + Left: left, + }, mi) + if !storage.setUVMode(miCols, miRow, miCol, out.UvMode) { + return false + } + reconBsize := vp9dec.ModeInfoDecodeBSize(bsize) + if mi.Skip != 0 { + if !storage.setResidueParsed(miCols, miRow, miCol, false) { + return false + } + aboveOffsets, leftOffsets := d.vp9PlaneContextOffsets(miRow, miCol) + vp9dec.ResetSkipContext(d.planes[:], reconBsize, aboveOffsets[:], leftOffsets[:]) + d.storeVP9CurrentFrameMvs(miRows, miCols, miRow, miCol, xMis, yMis, mi) + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true + } + if !storage.setResidueParsed(miCols, miRow, miCol, true) { + return false + } + if _, ok := d.parseVP9ResidueBlockRowMT(r, hdr, mi, out.UvMode, tile, + miRow, miCol, reconBsize, int(mi.SegmentID), 0, storage, sb, + residue); !ok { + return false + } + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true +} + +func (d *VP9Decoder) readVP9InterModeBlockRowMT(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + maps *vp9dec.InterSegmentMaps, storage *vp9DecoderRowMTFrameStorage, + sb int, tile vp9dec.TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + residue *vp9DecoderRowMTResidueCursor, +) bool { + xMis := min(int(common.Num8x8BlocksWideLookup[bsize]), miCols-miCol) + yMis := min(int(common.Num8x8BlocksHighLookup[bsize]), miRows-miRow) + mi := &d.miGrid[miRow*miCols+miCol] + *mi = vp9dec.NeighborMi{SbType: bsize} + above := d.vp9DecoderMiAt(miRows, miCols, miRow-1, miCol) + var left *vp9dec.NeighborMi + if miCol > tile.MiColStart { + left = d.vp9DecoderMiAt(miRows, miCols, miRow, miCol-1) + } + segID := 0 + d.segIDPredictedScratch = 0 + if hdr.Seg.Enabled { + maps.SegIDPredictedOut = &d.segIDPredictedScratch + segID = vp9dec.ReadInterSegmentId(r, &hdr.Seg, maps, + miRow*miCols+miCol, xMis, yMis, above, left) + } + mi.SegmentID = uint8(segID) + mi.SegIDPredicted = d.segIDPredictedScratch + if !hdr.Seg.TemporalUpdate { + mi.SegIDPredicted = uint8(segID) + } + mi.Skip = uint8(d.readVP9SkipWithCounts(r, hdr, segID, above, left)) + isInter := d.readVP9IsInterBlockWithCounts(r, hdr, segID, above, left) + if bsize >= common.Block8x8 && comp.TxMode == common.TxModeSelect && + !(isInter != 0 && mi.Skip != 0) { + mi.TxSize = d.readVP9TxSizeWithCounts(r, hdr, comp.TxMode, bsize, above, left, true) + } else { + mi.TxSize = d.readVP9TxSizeWithCounts(r, hdr, comp.TxMode, bsize, above, left, false) + } + + uvMode := common.DcPred + if isInter == 0 { + uvMode = d.readVP9IntraBlockModeInfoInterWithCounts(r, hdr, mi) + } else if !d.readVP9InterBlockModeInfo(r, hdr, comp, mi, segID, above, + left, tile, miRows, miCols, miRow, miCol) { + return false + } + if !storage.setUVMode(miCols, miRow, miCol, uvMode) { + return false + } + reconBsize := vp9dec.ModeInfoDecodeBSize(bsize) + if mi.Skip != 0 { + if !storage.setResidueParsed(miCols, miRow, miCol, false) { + return false + } + aboveOffsets, leftOffsets := d.vp9PlaneContextOffsets(miRow, miCol) + vp9dec.ResetSkipContext(d.planes[:], reconBsize, aboveOffsets[:], leftOffsets[:]) + d.storeVP9CurrentFrameMvs(miRows, miCols, miRow, miCol, xMis, yMis, mi) + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true + } + if isInter != 0 && !vp9dec.CanReconstructInterBlock(mi) { + d.unsupportedReconstruct = true + } + if !storage.setResidueParsed(miCols, miRow, miCol, true) { + return false + } + eobTotal, ok := d.parseVP9ResidueBlockRowMT(r, hdr, mi, uvMode, tile, + miRow, miCol, reconBsize, segID, isInter, storage, sb, residue) + if !ok { + return false + } + if isInter != 0 && mi.SbType >= common.Block8x8 && eobTotal == 0 { + mi.Skip = 1 + } + d.storeVP9CurrentFrameMvs(miRows, miCols, miRow, miCol, xMis, yMis, mi) + d.fillVP9DecoderMiGrid(miRows, miCols, miRow, miCol, bsize, mi) + return true +} + +func (d *VP9Decoder) reconstructVP9IntraModeBlockRowMT( + hdr *vp9dec.UncompressedHeader, storage *vp9DecoderRowMTFrameStorage, + sb int, tile vp9dec.TileBounds, miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + residue *vp9DecoderRowMTResidueCursor, +) bool { + mi := d.vp9DecoderMiAt(miRows, miCols, miRow, miCol) + if mi == nil { + return false + } + uvMode, ok := storage.getUVMode(miCols, miRow, miCol) + if !ok { + return false + } + reconBsize := vp9dec.ModeInfoDecodeBSize(bsize) + parsed, ok := storage.residueParsedAt(miCols, miRow, miCol) + if !ok { + return false + } + if !parsed { + if !d.unsupportedReconstruct { + d.reconstructVP9IntraPredictBlock(hdr, mi, uvMode, tile, + miRow, miCol, reconBsize) + } + return true + } + return d.reconstructVP9ResidueBlockRowMT(hdr, mi, uvMode, tile, miRow, + miCol, reconBsize, 0, storage, sb, residue) +} + +func (d *VP9Decoder) reconstructVP9InterModeBlockRowMT( + hdr *vp9dec.UncompressedHeader, storage *vp9DecoderRowMTFrameStorage, + sb int, tile vp9dec.TileBounds, miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + residue *vp9DecoderRowMTResidueCursor, +) bool { + mi := d.vp9DecoderMiAt(miRows, miCols, miRow, miCol) + if mi == nil { + return false + } + uvMode, ok := storage.getUVMode(miCols, miRow, miCol) + if !ok { + return false + } + reconBsize := vp9dec.ModeInfoDecodeBSize(bsize) + isInter := 0 + if mi.RefFrame[0] > vp9dec.IntraFrame { + isInter = 1 + } + parsed, ok := storage.residueParsedAt(miCols, miRow, miCol) + if !ok { + return false + } + if !parsed { + if !d.unsupportedReconstruct { + if isInter != 0 { + if !d.reconstructVP9InterPredictBlock(hdr, mi, miRow, miCol, + reconBsize) { + return false + } + } else { + d.reconstructVP9IntraPredictBlock(hdr, mi, uvMode, tile, + miRow, miCol, reconBsize) + } + } + return true + } + return d.reconstructVP9ResidueBlockRowMT(hdr, mi, uvMode, tile, miRow, + miCol, reconBsize, isInter, storage, sb, residue) +} + +func (d *VP9Decoder) parseVP9ResidueBlockRowMT(r *bitstream.Reader, + hdr *vp9dec.UncompressedHeader, mi *vp9dec.NeighborMi, + uvMode common.PredictionMode, tile vp9dec.TileBounds, + miRow, miCol int, bsize common.BlockSize, segID int, isInter int, + storage *vp9DecoderRowMTFrameStorage, sb int, + residue *vp9DecoderRowMTResidueCursor, +) (int, bool) { + aboveOffsets, leftOffsets := d.vp9PlaneContextOffsets(miRow, miCol) + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + rs := r.LocalState() + var coefCounts *vp9dec.CoefCounts + if !hdr.FrameParallelDecoding { + coefCounts = &d.counts.Coef + } + eobTotal := 0 + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeType := 0 + dequant := d.dq.Y[segID] + if plane > 0 { + planeType = 1 + dequant = d.dq.Uv[segID] + } + txSize := mi.TxSize + if plane > 0 { + txSize = vp9dec.GetUvTxSize(bsize, mi.TxSize, pd) + } + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + rs.Commit() + return 0, false + } + full4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + num4x4W, num4x4H := vp9dec.PlaneMaxBlocks4x4(miRows, miCols, miRow, miCol, + bsize, pd, planeBsize) + step := 1 << uint(txSize) + blockStep := 1 << uint(txSize<<1) + extraStep := ((full4x4W - num4x4W) >> txSize) * blockStep + aboveBase := aboveOffsets[plane] + leftBase := leftOffsets[plane] + blockIdx := 0 + maxEob := vp9dec.MaxEobForTxSize(txSize) + sbCoeffs := storage.dqcoeffForSB(plane, sb) + sbEobs := storage.eobForSB(plane, sb) + var planeScan *common.ScanOrder + if isInter != 0 || planeType != 0 || hdr.Quant.Lossless { + planeScan = common.GetScanPtr(txSize, planeType, isInter, + hdr.Quant.Lossless, uvMode) + } + for rr := 0; rr < num4x4H; rr += step { + for cc := 0; cc < num4x4W; cc += step { + mode := uvMode + if plane == 0 { + mode = vp9dec.GetYMode(mi, blockIdx) + } + aboveCtx := pd.AboveContext[aboveBase+cc : aboveBase+cc+step] + leftCtx := pd.LeftContext[leftBase+rr : leftBase+rr+step] + initCtx := vp9CoeffInitContext(aboveCtx, leftCtx, txSize) + so := planeScan + if so == nil { + so = common.GetScanPtr(txSize, planeType, isInter, + hdr.Quant.Lossless, mode) + } + eobPos := residue.eobPos[plane] + coeffPos := residue.coeffPos[plane] + coeffs, ok := vp9DecoderRowMTDQCoeffScratch(sbCoeffs, coeffPos, + maxEob) + if !ok || eobPos < 0 || eobPos >= len(sbEobs) { + rs.Commit() + return 0, false + } + eob := vp9dec.DecodeCoefsState(&rs, txSize, planeType, isInter, + dequant, initCtx, so, &d.fc.CoefProbs, coefCounts, + coeffs, &d.coefTokenCache) + sbEobs[eobPos] = eob + residue.eobPos[plane]++ + residue.coeffPos[plane] += maxEob + eobTotal += eob + hasResidue := uint8(0) + if eob > 0 { + hasResidue = 1 + } + vp9SetHasResidueContexts(aboveCtx, leftCtx, txSize, hasResidue) + if hasResidue != 0 { + if cc+step > num4x4W { + clear(aboveCtx[num4x4W-cc:]) + } + if rr+step > num4x4H { + clear(leftCtx[num4x4H-rr:]) + } + } + blockIdx += blockStep + } + blockIdx += extraStep + } + } + rs.Commit() + return eobTotal, true +} + +func (d *VP9Decoder) reconstructVP9ResidueBlockRowMT( + hdr *vp9dec.UncompressedHeader, mi *vp9dec.NeighborMi, + uvMode common.PredictionMode, tile vp9dec.TileBounds, + miRow, miCol int, bsize common.BlockSize, isInter int, + storage *vp9DecoderRowMTFrameStorage, sb int, + residue *vp9DecoderRowMTResidueCursor, +) bool { + if isInter != 0 && !d.unsupportedReconstruct { + if !d.reconstructVP9InterPredictBlock(hdr, mi, miRow, miCol, bsize) { + return false + } + } + miRows := int((hdr.Height + 7) >> 3) + miCols := int((hdr.Width + 7) >> 3) + for plane := range vp9dec.MaxMbPlane { + pd := &d.planes[plane] + planeType := 0 + if plane > 0 { + planeType = 1 + } + txSize := mi.TxSize + if plane > 0 { + txSize = vp9dec.GetUvTxSize(bsize, mi.TxSize, pd) + } + planeBsize := vp9dec.GetPlaneBlockSize(bsize, pd) + if planeBsize >= common.BlockSizes { + return false + } + full4x4W := int(common.Num4x4BlocksWideLookup[planeBsize]) + num4x4W, num4x4H := vp9dec.PlaneMaxBlocks4x4(miRows, miCols, miRow, + miCol, bsize, pd, planeBsize) + step := 1 << uint(txSize) + blockStep := 1 << uint(txSize<<1) + extraStep := ((full4x4W - num4x4W) >> txSize) * blockStep + blockIdx := 0 + maxEob := vp9dec.MaxEobForTxSize(txSize) + sbCoeffs := storage.dqcoeffForSB(plane, sb) + sbEobs := storage.eobForSB(plane, sb) + for rr := 0; rr < num4x4H; rr += step { + for cc := 0; cc < num4x4W; cc += step { + eobPos := residue.eobPos[plane] + coeffPos := residue.coeffPos[plane] + if eobPos < 0 || eobPos >= len(sbEobs) || + coeffPos < 0 || coeffPos+maxEob > len(sbCoeffs) { + return false + } + eob := sbEobs[eobPos] + coeffs := sbCoeffs[coeffPos : coeffPos+maxEob] + residue.eobPos[plane]++ + residue.coeffPos[plane] += maxEob + if isInter == 0 && !d.unsupportedReconstruct { + mode := uvMode + if plane == 0 { + mode = vp9dec.GetYMode(mi, blockIdx) + } + txType := common.DctDct + if planeType == 0 && !hdr.Quant.Lossless { + txType = common.IntraModeToTxType[mode] + } + dst, stride, ok := d.reconstructVP9IntraPredictTx(hdr, pd, + plane, mode, txSize, tile, miRow, miCol, bsize, rr, cc) + if !ok { + d.markVP9Unsupported() + } else if eob > 0 && dst != nil { + vp9dec.InverseTransformBlock(coeffs, dst, stride, txSize, + txType, eob, hdr.Quant.Lossless) + } + } else if isInter != 0 && !d.unsupportedReconstruct { + dst, stride, ok := d.vp9InterTxDst(hdr, pd, plane, txSize, + miRow, miCol, rr, cc) + if !ok { + d.markVP9Unsupported() + } else if eob > 0 { + vp9dec.InverseTransformBlock(coeffs, dst, stride, txSize, + common.DctDct, eob, hdr.Quant.Lossless) + } + } + blockIdx += blockStep + } + blockIdx += extraStep + } + } + return true +} + +func vp9CoeffInitContext(aboveCtx, leftCtx []uint8, txSize common.TxSize) int { + initCtx := 0 + switch txSize { + case common.Tx4x4: + if aboveCtx[0] != 0 { + initCtx++ + } + if leftCtx[0] != 0 { + initCtx++ + } + case common.Tx8x8: + if aboveCtx[0]|aboveCtx[1] != 0 { + initCtx++ + } + if leftCtx[0]|leftCtx[1] != 0 { + initCtx++ + } + case common.Tx16x16: + if aboveCtx[0]|aboveCtx[1]|aboveCtx[2]|aboveCtx[3] != 0 { + initCtx++ + } + if leftCtx[0]|leftCtx[1]|leftCtx[2]|leftCtx[3] != 0 { + initCtx++ + } + default: + if aboveCtx[0]|aboveCtx[1]|aboveCtx[2]|aboveCtx[3]| + aboveCtx[4]|aboveCtx[5]|aboveCtx[6]|aboveCtx[7] != 0 { + initCtx++ + } + if leftCtx[0]|leftCtx[1]|leftCtx[2]|leftCtx[3]| + leftCtx[4]|leftCtx[5]|leftCtx[6]|leftCtx[7] != 0 { + initCtx++ + } + } + return initCtx +} + +func vp9SetHasResidueContexts(aboveCtx, leftCtx []uint8, txSize common.TxSize, + hasResidue uint8, +) { + switch txSize { + case common.Tx4x4: + aboveCtx[0] = hasResidue + leftCtx[0] = hasResidue + case common.Tx8x8: + aboveCtx[0] = hasResidue + aboveCtx[1] = hasResidue + leftCtx[0] = hasResidue + leftCtx[1] = hasResidue + case common.Tx16x16: + aboveCtx[0] = hasResidue + aboveCtx[1] = hasResidue + aboveCtx[2] = hasResidue + aboveCtx[3] = hasResidue + leftCtx[0] = hasResidue + leftCtx[1] = hasResidue + leftCtx[2] = hasResidue + leftCtx[3] = hasResidue + default: + for i := range 8 { + aboveCtx[i] = hasResidue + leftCtx[i] = hasResidue + } + } +} diff --git a/internal/vp9/codec/vp9_decoder_threading.go b/internal/vp9/codec/vp9_decoder_threading.go new file mode 100644 index 0000000..05a87bc --- /dev/null +++ b/internal/vp9/codec/vp9_decoder_threading.go @@ -0,0 +1,1456 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_decoder_threading.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "runtime" + "sync" + "sync/atomic" + + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +type vp9LoopFilterPlane uint8 + +const ( + vp9LoopFilterPlaneY vp9LoopFilterPlane = iota + vp9LoopFilterPlaneU + vp9LoopFilterPlaneV +) + +type vp9DecoderLoopFilterPool struct { + helperCount int8 + start []chan struct{} + done []chan struct{} + exited []chan struct{} + jobs []vp9EncodeLfJob + lfSync vp9LfSync + + lastActiveWorkers uint8 +} + +func newVP9DecoderLoopFilterPool(threads int) *vp9DecoderLoopFilterPool { + helpers := min(threads-1, 63) + if helpers <= 0 { + return nil + } + p := &vp9DecoderLoopFilterPool{ + helperCount: int8(helpers), + start: make([]chan struct{}, helpers), + done: make([]chan struct{}, helpers), + exited: make([]chan struct{}, helpers), + jobs: make([]vp9EncodeLfJob, helpers+1), + } + for i := range helpers { + p.start[i] = make(chan struct{}) + p.done[i] = make(chan struct{}) + p.exited[i] = make(chan struct{}) + go p.workerLoop(i) + } + return p +} + +func (p *vp9DecoderLoopFilterPool) workerLoop(worker int) { + defer close(p.exited[worker]) + for range p.start[worker] { + runVP9EncodeLfJob(&p.jobs[worker+1]) + p.done[worker] <- struct{}{} + } +} + +func (p *vp9DecoderLoopFilterPool) shutdown() { + if p == nil || p.helperCount <= 0 { + return + } + for i := 0; i < int(p.helperCount); i++ { + close(p.start[i]) + } + for i := 0; i < int(p.helperCount); i++ { + <-p.exited[i] + } + for i := range p.jobs { + p.jobs[i] = vp9EncodeLfJob{} + } + p.helperCount = 0 + p.lastActiveWorkers = 0 +} + +func (d *VP9Decoder) applyVP9LoopFilterThreaded(miRows, miCols, width int) bool { + p := d.vp9LoopFilterPool + if p == nil || p.helperCount <= 0 { + return d.applyVP9LoopFilterSerial(miRows, miCols) + } + if !d.prepareVP9LoopFilterMasks(miRows, miCols, 0, miRows) { + return false + } + + sbRows := (miRows + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + workers := min(int(p.helperCount)+1, sbRows) + p.lastActiveWorkers = uint8(workers) + if workers <= 1 { + return d.applyVP9LoopFilterSerialCached(miRows, miCols) + } + p.lfSync.reset(sbRows, width) + for i := range p.jobs { + start := i + if i >= workers { + start = sbRows + } + p.jobs[i] = vp9EncodeLfJob{ + d: *d, + lfSync: &p.lfSync, + miRows: miRows, + miCols: miCols, + start: start, + step: workers, + ok: true, + } + } + helpers := workers - 1 + for worker := range helpers { + p.start[worker] <- struct{}{} + } + runVP9EncodeLfJob(&p.jobs[0]) + for worker := range helpers { + <-p.done[worker] + } + ok := true + for i := range workers { + ok = ok && p.jobs[i].ok + } + return ok +} + +type vp9DecoderTileJobKind uint8 + +const ( + vp9DecoderTileJobIntra vp9DecoderTileJobKind = iota + vp9DecoderTileJobInter +) + +type vp9DecoderTileDesc struct { + data []byte + tile vp9dec.TileBounds +} + +const ( + // Mirrors vp9/decoder/vp9_decoder.h row-mt frame storage. + vp9DecoderRowMTEobsPerSBLog2 = 8 + vp9DecoderRowMTDQCoeffsPerSBLog2 = 12 + vp9DecoderRowMTPartitionsPerSB = 85 + vp9DecoderRowMTDQCoeffAlign = 32 +) + +type vp9DecoderRowMTJobType uint8 + +const ( + vp9DecoderRowMTJobParse vp9DecoderRowMTJobType = iota + vp9DecoderRowMTJobRecon + vp9DecoderRowMTJobLPF +) + +type vp9DecoderRowMTJob struct { + rowNum int + tileCol int + jobType vp9DecoderRowMTJobType +} + +// vp9DecoderRowMTJobQueue mirrors libvpx's JobQueueRowMt: a fixed-capacity, +// non-wrapping FIFO that workers block on until a job is queued or the row-mt +// tile pass terminates. +type vp9DecoderRowMTJobQueue struct { + mu sync.Mutex + cond *sync.Cond + jobs []vp9DecoderRowMTJob + read int + terminated bool +} + +func (q *vp9DecoderRowMTJobQueue) ensureCapacity(jobCap int) { + if q == nil || jobCap <= 0 { + return + } + if q.cond == nil { + q.cond = sync.NewCond(&q.mu) + } + if cap(q.jobs) < jobCap { + q.jobs = make([]vp9DecoderRowMTJob, 0, jobCap) + } +} + +func (q *vp9DecoderRowMTJobQueue) reset() { + if q == nil { + return + } + q.mu.Lock() + q.jobs = q.jobs[:0] + q.read = 0 + q.terminated = false + q.mu.Unlock() +} + +func (q *vp9DecoderRowMTJobQueue) release() { + if q == nil { + return + } + q.mu.Lock() + q.jobs = nil + q.read = 0 + q.terminated = false + q.mu.Unlock() +} + +func (q *vp9DecoderRowMTJobQueue) terminate() { + if q == nil { + return + } + q.mu.Lock() + q.terminated = true + if q.cond != nil { + q.cond.Broadcast() + } + q.mu.Unlock() +} + +func (q *vp9DecoderRowMTJobQueue) queue(job vp9DecoderRowMTJob) bool { + if q == nil { + return false + } + q.mu.Lock() + ok := !q.terminated && len(q.jobs) < cap(q.jobs) + if ok { + q.jobs = append(q.jobs, job) + if q.cond != nil { + q.cond.Signal() + } + } + q.mu.Unlock() + return ok +} + +func (q *vp9DecoderRowMTJobQueue) dequeue(blocking bool) (vp9DecoderRowMTJob, bool) { + if q == nil { + return vp9DecoderRowMTJob{}, false + } + q.mu.Lock() + defer q.mu.Unlock() + for { + if q.read < len(q.jobs) { + job := q.jobs[q.read] + q.read++ + return job, true + } + if q.terminated || !blocking { + return vp9DecoderRowMTJob{}, false + } + if q.cond == nil { + q.cond = sync.NewCond(&q.mu) + } + q.cond.Wait() + } +} + +func (q *vp9DecoderRowMTJobQueue) done() bool { + if q == nil { + return true + } + q.mu.Lock() + done := q.terminated && q.read >= len(q.jobs) + q.mu.Unlock() + return done +} + +// vp9RowMTPhase is the explicit lifecycle state of one frame's Row-MT +// decode pipeline. Within a single frame, transitions are monotonic: +// +// Idle -> RunningNoLPF -> CompletedNoLPF | Aborted +// Idle -> RunningWithLPF -> CompletedWithLPF | Aborted +// +// Reset/Idle transitions occur single-threaded at frame start before helper +// workers are dispatched. All concurrent reads and transitions use lock-free +// atomics with zero heap allocations and zero GC pointer overhead. +type vp9RowMTPhase uint32 + +const ( + vp9RowMTPhaseIdle vp9RowMTPhase = iota + vp9RowMTPhaseRunningNoLPF + vp9RowMTPhaseRunningWithLPF + vp9RowMTPhaseCompletedNoLPF + vp9RowMTPhaseCompletedWithLPF + vp9RowMTPhaseAborted +) + +type vp9DecoderRowMTFrameStorage struct { + numSBs int + numJobs int + tileCols int + + eob [vp9dec.MaxMbPlane][]int + dqcoeffBytes [vp9dec.MaxMbPlane][]byte + dqcoeff [vp9dec.MaxMbPlane][]int16 + partition []common.PartitionType + uvMode []common.PredictionMode + residueParsed []bool + reconMap []int8 + reconMu []sync.Mutex + reconCond []*sync.Cond + jobq vp9DecoderRowMTJobQueue + reader bitstream.Reader + lfSync vp9LfSync + tileStates []vp9DecoderRowMTTileState + tilesDone atomic.Int32 + phase atomic.Uint32 +} + +func (s *vp9DecoderRowMTFrameStorage) currentPhase() vp9RowMTPhase { + if s == nil { + return vp9RowMTPhaseIdle + } + return vp9RowMTPhase(s.phase.Load()) +} + +func (s *vp9DecoderRowMTFrameStorage) markIdle() { + if s == nil { + return + } + s.phase.Store(uint32(vp9RowMTPhaseIdle)) +} + +func (s *vp9DecoderRowMTFrameStorage) start(withLPF bool) { + if s == nil { + return + } + if withLPF { + s.phase.Store(uint32(vp9RowMTPhaseRunningWithLPF)) + } else { + s.phase.Store(uint32(vp9RowMTPhaseRunningNoLPF)) + } +} + +func (s *vp9DecoderRowMTFrameStorage) loopFilterActive() bool { + return s.currentPhase() == vp9RowMTPhaseRunningWithLPF +} + +func (s *vp9DecoderRowMTFrameStorage) loopFilterApplied() bool { + return s.currentPhase() == vp9RowMTPhaseCompletedWithLPF +} + +func (s *vp9DecoderRowMTFrameStorage) aborted() bool { + return s.currentPhase() == vp9RowMTPhaseAborted +} + +func (s *vp9DecoderRowMTFrameStorage) completeTileRecon() { + if s == nil || s.currentPhase() != vp9RowMTPhaseRunningNoLPF { + return + } + if s.tilesDone.Add(1) == int32(s.tileCols) { + if s.phase.CompareAndSwap(uint32(vp9RowMTPhaseRunningNoLPF), uint32(vp9RowMTPhaseCompletedNoLPF)) { + s.jobq.terminate() + } + } +} + +func (s *vp9DecoderRowMTFrameStorage) completeLastLPFRow() { + if s == nil { + return + } + if s.phase.CompareAndSwap(uint32(vp9RowMTPhaseRunningWithLPF), uint32(vp9RowMTPhaseCompletedWithLPF)) { + s.jobq.terminate() + } +} + +func (s *vp9DecoderRowMTFrameStorage) abort() { + if s == nil { + return + } + if vp9RowMTPhase(s.phase.Swap(uint32(vp9RowMTPhaseAborted))) == vp9RowMTPhaseAborted { + return + } + s.jobq.terminate() + s.lfSync.abort() + s.wakeAllReconWaiters() +} + +func (s *vp9DecoderRowMTFrameStorage) wakeAllReconWaiters() { + for i := range s.reconCond { + if s.reconCond[i] == nil { + continue + } + s.reconMu[i].Lock() + s.reconCond[i].Broadcast() + s.reconMu[i].Unlock() + } +} + +type vp9DecoderRowMTTileState struct { + decoder VP9Decoder + reader bitstream.Reader + tile vp9dec.TileBounds + + leftSegCtx [common.MiBlockSize]int8 + leftEntropy [vp9dec.MaxMbPlane][16]uint8 +} + +func (s *vp9DecoderRowMTFrameStorage) reset(numSBs int) { + if s == nil { + return + } + if numSBs <= 0 { + s.numSBs = 0 + for plane := range vp9dec.MaxMbPlane { + s.eob[plane] = s.eob[plane][:0] + s.dqcoeffBytes[plane] = s.dqcoeffBytes[plane][:0] + s.dqcoeff[plane] = s.dqcoeff[plane][:0] + } + s.partition = s.partition[:0] + s.uvMode = s.uvMode[:0] + s.residueParsed = s.residueParsed[:0] + s.reconMap = s.reconMap[:0] + s.numJobs = 0 + s.tileCols = 0 + s.tileStates = s.tileStates[:0] + s.tilesDone.Store(0) + s.phase.Store(uint32(vp9RowMTPhaseIdle)) + return + } + + s.numSBs = numSBs + eobLen := numSBs << vp9DecoderRowMTEobsPerSBLog2 + dqcoeffLen := numSBs << vp9DecoderRowMTDQCoeffsPerSBLog2 + for plane := range vp9dec.MaxMbPlane { + s.eob[plane] = buffers.EnsureLenZeroed(s.eob[plane], eobLen) + // Keep 1024 int16s of trailing capacity so vp9DecoderRowMTDQCoeffScratch + // can safely form a *[1024]int16 view at the final SB offset while + // preserving the exact len == dqcoeffLen expected by layout checks. + s.dqcoeff[plane] = buffers.EnsureLenZeroed(s.dqcoeff[plane], dqcoeffLen+1024)[:dqcoeffLen] + } + s.partition = buffers.EnsureLenZeroed(s.partition, + numSBs*vp9DecoderRowMTPartitionsPerSB) + s.reconMap = buffers.EnsureLenZeroed(s.reconMap, numSBs) + s.tileCols = 0 + s.tileStates = s.tileStates[:0] + s.tilesDone.Store(0) + s.phase.Store(uint32(vp9RowMTPhaseIdle)) +} + +func (s *vp9DecoderRowMTFrameStorage) ensureModeStorage(miRows, miCols int) { + if s == nil || miRows <= 0 || miCols <= 0 { + return + } + s.uvMode = buffers.EnsureLenZeroed(s.uvMode, miRows*miCols) + s.residueParsed = buffers.EnsureLenZeroed(s.residueParsed, miRows*miCols) +} + +func (s *vp9DecoderRowMTFrameStorage) ensureJobQueue(tileCols, sbRows int) { + if s == nil || tileCols <= 0 || sbRows <= 0 { + return + } + numJobs := tileCols * sbRows + s.numJobs = numJobs + s.tileCols = tileCols + s.tilesDone.Store(0) + if cap(s.reconMu) < numJobs { + s.reconMu = make([]sync.Mutex, numJobs) + s.reconCond = make([]*sync.Cond, numJobs) + } else { + s.reconMu = s.reconMu[:numJobs] + s.reconCond = s.reconCond[:numJobs] + } + for i := range s.reconCond { + if s.reconCond[i] == nil { + s.reconCond[i] = sync.NewCond(&s.reconMu[i]) + } + } + s.jobq.ensureCapacity(tileCols*sbRows*2 + sbRows) + s.jobq.reset() +} + +func (s *vp9DecoderRowMTFrameStorage) release() { + if s == nil { + return + } + s.numSBs = 0 + s.numJobs = 0 + s.tileCols = 0 + for plane := range vp9dec.MaxMbPlane { + s.eob[plane] = nil + s.dqcoeffBytes[plane] = nil + s.dqcoeff[plane] = nil + } + s.partition = nil + s.uvMode = nil + s.residueParsed = nil + s.reconMap = nil + s.reconMu = nil + s.reconCond = nil + s.jobq.release() + s.lfSync = vp9LfSync{} + s.tileStates = nil + s.tilesDone.Store(0) + s.phase.Store(uint32(vp9RowMTPhaseIdle)) +} + +func (s *vp9DecoderRowMTFrameStorage) prepareTileStates(parent *VP9Decoder, + descs []vp9DecoderTileDesc, +) error { + if s == nil || parent == nil || len(descs) == 0 || len(descs) != s.tileCols { + return ErrInvalidVP9Data + } + s.tileStates = buffers.EnsureLen(s.tileStates, len(descs)) + for tileCol := range descs { + state := &s.tileStates[tileCol] + state.decoder = *parent + state.decoder.vp9LoopFilterPool = nil + state.decoder.vp9TilePool = nil + state.decoder.rowMTSync = nil + state.decoder.leftSegCtx = state.leftSegCtx[:] + clear(state.leftSegCtx[:]) + for plane := range vp9dec.MaxMbPlane { + leftLen := len(parent.planes[plane].LeftContext) + if leftLen > len(state.leftEntropy[plane]) { + return ErrInvalidVP9Data + } + state.decoder.planes[plane].LeftContext = + state.leftEntropy[plane][:leftLen] + clear(state.leftEntropy[plane][:leftLen]) + } + state.decoder.counts = vp9dec.FrameCounts{} + state.tile = descs[tileCol].tile + if err := state.reader.Init(descs[tileCol].data); err != nil { + return ErrInvalidVP9Data + } + } + return nil +} + +func (s *vp9DecoderRowMTFrameStorage) tileState(tileCol int) *vp9DecoderRowMTTileState { + if s == nil || tileCol < 0 || tileCol >= len(s.tileStates) { + return nil + } + return &s.tileStates[tileCol] +} + +func (s *vp9DecoderRowMTFrameStorage) eobForSB(plane, sb int) []int { + base := sb << vp9DecoderRowMTEobsPerSBLog2 + return s.eob[plane][base : base+(1<= len(s.reconMap) || + syncIdx < 0 || syncIdx >= len(s.reconCond) { + return false + } + mu := &s.reconMu[syncIdx] + mu.Lock() + s.reconMap[mapIdx] = 1 + mu.Unlock() + s.reconCond[syncIdx].Signal() + return true +} + +func (s *vp9DecoderRowMTFrameStorage) reconMapRead(mapIdx, syncIdx int) bool { + if s == nil || mapIdx < 0 || mapIdx >= len(s.reconMap) || + syncIdx < 0 || syncIdx >= len(s.reconCond) { + return false + } + mu := &s.reconMu[syncIdx] + mu.Lock() + for s.reconMap[mapIdx] == 0 { + if s.aborted() { + mu.Unlock() + return false + } + s.reconCond[syncIdx].Wait() + } + mu.Unlock() + return !s.aborted() +} + +type vp9DecoderTileJob struct { + data []byte + descs []vp9DecoderTileDesc + hdr *vp9dec.UncompressedHeader + comp vp9dec.CompressedHeader + intraMaps vp9dec.IntraSegmentMaps + interMaps vp9dec.InterSegmentMaps + tile vp9dec.TileBounds + miRows int + miCols int + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8 + kind vp9DecoderTileJobKind + worker VP9Decoder + rowMTParent *VP9Decoder + + leftSegCtx [common.MiBlockSize]int8 + leftEntropy [vp9dec.MaxMbPlane][16]uint8 + leftEntropyLen [vp9dec.MaxMbPlane]uint8 + interPredictScratch []byte + highbdState vp9DecoderHighBDState + + // rowMTSync, when non-nil, is the per-tile-column wavefront sync the + // decoder body should call read / write against. Populated by the tile + // worker pool when VP9D_SET_ROW_MT is enabled. + rowMTSync *vp9RowMTSync + + rowMTStorage *vp9DecoderRowMTFrameStorage + + err error + unsupported bool + + isBorder bool + borderOK bool + borderFull []byte + borderOrigin int + borderStride int + borderWidth int + borderHeight int + borderX int + borderY int +} + +type vp9DecoderTileWorkerPool struct { + helperCount int8 + start []chan struct{} + jobs []vp9DecoderTileJob + mainRowMTJob vp9DecoderTileJob + tileDescs []vp9DecoderTileDesc + header vp9dec.UncompressedHeader + + shutdownCh chan struct{} + wg sync.WaitGroup + jobEpoch atomic.Uint64 + activeHelpers atomic.Uint32 + doneEpoch []atomic.Uint64 + parked []atomic.Uint32 + + // rowMTSyncs holds one vp9RowMTSync per tile-column slot. Allocated + // lazily by ensureRowMTSync when VP9D_SET_ROW_MT is enabled; released + // by releaseRowMTSync when the option toggles off. Mirrors the encoder + // vp9TileWorkerPool layout so the decoder body can index by tile-column + // slot. + rowMTSyncs []vp9RowMTSync + // rowMTArmed records whether SetRowMT(true) has been observed without + // a matching SetRowMT(false). It is sticky until releaseRowMTSync runs. + rowMTArmed bool + // rowMTFrame mirrors libvpx RowMTWorkerData frame slabs. It is reset per + // frame while VP9D_SET_ROW_MT is armed and released with the row-mt sync + // state when the option is disabled. + rowMTFrame vp9DecoderRowMTFrameStorage + + lastTileJobs uint8 + lastTileJobKind vp9DecoderTileJobKind + lastTileSchedule [64]int + lastTileScheduleLen uint8 +} + +func newVP9DecoderTileWorkerPool(threads int) *vp9DecoderTileWorkerPool { + helpers := min(threads-1, 63) + if helpers <= 0 { + return nil + } + p := &vp9DecoderTileWorkerPool{ + helperCount: int8(helpers), + start: make([]chan struct{}, helpers), + jobs: make([]vp9DecoderTileJob, helpers), + shutdownCh: make(chan struct{}), + doneEpoch: make([]atomic.Uint64, helpers), + parked: make([]atomic.Uint32, helpers), + } + for i := range helpers { + p.start[i] = make(chan struct{}, 1) + p.wg.Add(1) + go p.workerLoop(i) + } + return p +} + +func (p *vp9DecoderTileWorkerPool) workerLoop(worker int) { + defer p.wg.Done() + var epoch uint64 + idleSpins := 0 + for { + next := p.jobEpoch.Load() + if next != epoch { + epoch = next + if worker < int(p.activeHelpers.Load()) { + p.jobs[worker].run() + } + p.doneEpoch[worker].Store(epoch) + idleSpins = 0 + continue + } + select { + case <-p.shutdownCh: + return + default: + } + if idleSpins >= rowWorkerIdleSpinBudget { + if !p.parkHelperWorker(worker, epoch) { + return + } + idleSpins = 0 + continue + } + idleSpins++ + runtimeProcYield(30) + if idleSpins >= rowWorkerIdleSchedulerBackoff && + idleSpins%rowWorkerIdleSchedulerBackoff == 0 { + runtime.Gosched() + } + } +} + +func (p *vp9DecoderTileWorkerPool) shutdown() { + if p == nil || p.helperCount <= 0 { + return + } + close(p.shutdownCh) + p.wg.Wait() + for i := range p.jobs { + p.jobs[i] = vp9DecoderTileJob{} + } + p.mainRowMTJob = vp9DecoderTileJob{} + p.tileDescs = nil + p.helperCount = 0 + p.lastTileJobs = 0 + p.rowMTSyncs = nil + p.rowMTFrame.release() + p.rowMTArmed = false +} + +func (p *vp9DecoderTileWorkerPool) parkHelperWorker(worker int, epoch uint64) bool { + if p == nil { + return false + } + if worker >= 0 && worker < len(p.parked) { + p.parked[worker].Store(1) + defer p.parked[worker].Store(0) + } + if p.jobEpoch.Load() != epoch { + return true + } + select { + case _, ok := <-p.start[worker]: + return ok + case <-p.shutdownCh: + return false + } +} + +func (p *vp9DecoderTileWorkerPool) startHelperWorkers(helpers int) uint64 { + if p == nil || helpers <= 0 { + return 0 + } + if helpers > int(p.helperCount) { + helpers = int(p.helperCount) + } + p.activeHelpers.Store(uint32(helpers)) + epoch := p.jobEpoch.Add(1) + for worker := 0; worker < helpers; worker++ { + if worker >= len(p.parked) || p.parked[worker].Load() == 0 { + continue + } + select { + case p.start[worker] <- struct{}{}: + default: + } + } + return epoch +} + +func (p *vp9DecoderTileWorkerPool) waitHelperWorkers(epoch uint64, helpers int) { + if p == nil || helpers <= 0 { + return + } + if helpers > int(p.helperCount) { + helpers = int(p.helperCount) + } + spins := 0 + for ; !p.helperWorkersDone(epoch, helpers); spins++ { + runtimeProcYield(30) + if spins >= rowWorkerIdleSchedulerBackoff && + spins%rowWorkerIdleSchedulerBackoff == 0 { + runtime.Gosched() + } + } +} + +func (p *vp9DecoderTileWorkerPool) helperWorkersDone(epoch uint64, helpers int) bool { + if p == nil { + return true + } + if helpers > len(p.doneEpoch) { + helpers = len(p.doneEpoch) + } + for worker := 0; worker < helpers; worker++ { + if p.doneEpoch[worker].Load() < epoch { + return false + } + } + return true +} + +// armRowMT marks the tile worker pool as serving VP9D_SET_ROW_MT decode +// frames. The per-tile-column wavefront primitive is allocated lazily in +// ensureRowMTSync once miRows is known for a frame. +func (p *vp9DecoderTileWorkerPool) armRowMT() { + if p == nil { + return + } + p.rowMTArmed = true +} + +// ensureRowMTSync arms one vp9RowMTSync per tile-column slot sized to sbRows +// when VP9D_SET_ROW_MT is active. Mirrors the encoder helper of the same +// name so the wavefront primitive layout stays in sync across encode and +// decode. tileCols is the number of tile columns in the current frame. +func (p *vp9DecoderTileWorkerPool) ensureRowMTSync(tileCols, sbRows int) { + if p == nil || tileCols <= 0 || sbRows <= 0 { + return + } + p.rowMTSyncs = buffers.EnsureLen(p.rowMTSyncs, tileCols) + for i := range p.rowMTSyncs { + p.rowMTSyncs[i].reset(sbRows) + } +} + +func (p *vp9DecoderTileWorkerPool) ensureRowMTFrameStorage(miRows, miCols, + tileCols int, +) { + if p == nil || miRows <= 0 || miCols <= 0 || tileCols <= 0 { + return + } + sbRows := common.AlignToSB(miRows) >> common.MiBlockSizeLog2 + sbCols := common.AlignToSB(miCols) >> common.MiBlockSizeLog2 + p.rowMTFrame.reset(sbRows * sbCols) + p.rowMTFrame.ensureModeStorage(miRows, miCols) + p.rowMTFrame.ensureJobQueue(tileCols, sbRows) +} + +// releaseRowMTSync drops the per-tile-column vp9RowMTSync state. It is +// invoked when SetRowMT(false) flips the option so future decodes do not +// pay the wavefront overhead nor keep the primitive arrays resident. +func (p *vp9DecoderTileWorkerPool) releaseRowMTSync() { + if p == nil { + return + } + for i := range p.rowMTSyncs { + p.rowMTSyncs[i].release() + } + p.rowMTSyncs = p.rowMTSyncs[:0] + p.rowMTFrame.release() + p.rowMTArmed = false +} + +func (d *VP9Decoder) vp9DecoderTileThreadingEnabled( + hdr *vp9dec.UncompressedHeader, tileRows, tileCols int, +) bool { + rowMT := d != nil && d.opts.DecoderRowMT + return d != nil && d.vp9TilePool != nil && hdr != nil && + tileRows == 1 && (tileCols > 1 || rowMT) && !d.vp9TileFilterActive() && + !d.opts.InvertTileDecodeOrder +} + +func (d *VP9Decoder) parseVP9IntraModeTilesThreaded(tileData []byte, + hdr vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + descs, err := d.vp9TilePool.prepareTileDescs(tileData, hdr, miRows, + miCols) + if err != nil { + return err + } + maps := vp9dec.IntraSegmentMaps{ + CurrentFrameSegMap: d.segMap, + LastFrameSegMap: d.lastSegMap, + MiCols: miCols, + } + return d.runVP9DecoderTileJobs(descs, vp9DecoderTileJobIntra, hdr, comp, + maps, vp9dec.InterSegmentMaps{}, miRows, miCols, partitionProbs) +} + +func (d *VP9Decoder) parseVP9InterModeTilesThreaded(tileData []byte, + hdr vp9dec.UncompressedHeader, comp vp9dec.CompressedHeader, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + descs, err := d.vp9TilePool.prepareTileDescs(tileData, hdr, miRows, + miCols) + if err != nil { + return err + } + maps := vp9dec.InterSegmentMaps{ + IntraSegmentMaps: vp9dec.IntraSegmentMaps{ + CurrentFrameSegMap: d.segMap, + LastFrameSegMap: d.lastSegMap, + MiCols: miCols, + }, + } + return d.runVP9DecoderTileJobs(descs, vp9DecoderTileJobInter, hdr, comp, + vp9dec.IntraSegmentMaps{}, maps, miRows, miCols, partitionProbs) +} + +func (p *vp9DecoderTileWorkerPool) prepareTileDescs(tileData []byte, + hdr vp9dec.UncompressedHeader, miRows, miCols int, +) ([]vp9DecoderTileDesc, error) { + descs, err := prepareVP9DecoderTileDescs(p.tileDescs, tileData, hdr, + miRows, miCols) + if err != nil { + return nil, err + } + p.tileDescs = descs + return descs, nil +} + +func (d *VP9Decoder) runVP9DecoderTileJobs(descs []vp9DecoderTileDesc, + kind vp9DecoderTileJobKind, hdr vp9dec.UncompressedHeader, + comp vp9dec.CompressedHeader, intraMaps vp9dec.IntraSegmentMaps, + interMaps vp9dec.InterSegmentMaps, miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + p := d.vp9TilePool + p.header = hdr + p.lastTileJobs = 0 + p.lastTileJobKind = kind + p.lastTileScheduleLen = 0 + if len(descs) == 0 { + return nil + } + // Allocate per-tile-column wavefront sync arrays when VP9D_SET_ROW_MT + // is enabled and we have multiple tile columns. The sync primitive is + // armed across the parent decoder and all tile workers so the + // tile-column body can read / write its row state without further + // dispatch changes when per-row goroutines land. + if d.opts.DecoderRowMT && p.rowMTArmed { + sbRows := (miRows + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + p.ensureRowMTSync(len(descs), sbRows) + p.ensureRowMTFrameStorage(miRows, miCols, len(descs)) + } else if len(p.rowMTSyncs) > 0 { + // Reset stale state when the option toggled off mid-stream. + p.rowMTSyncs = p.rowMTSyncs[:0] + p.rowMTFrame.release() + } + if !d.opts.DecoderRowMT || d.lastFrame.BitDepth > 8 { + return d.runVP9DecoderScheduledTileJobs(descs, kind, comp, + intraMaps, interMaps, miRows, miCols, partitionProbs) + } + if len(descs) > 1 { + return d.runVP9DecoderMultiTileRowMTJobs(descs, kind, comp, + intraMaps, interMaps, miRows, miCols, partitionProbs) + } + mergeCounts := !hdr.FrameParallelDecoding + helpersMax := int(p.helperCount) + next := 0 + jobsRun := 0 + for next < len(descs) { + helpers := min(len(descs)-next-1, helpersMax) + for worker := range helpers { + desc := descs[next+worker+1] + p.prepareTileJob(worker, d, kind, desc, comp, intraMaps, + interMaps, miRows, miCols, partitionProbs) + tileSlot := next + worker + 1 + if tileSlot < len(p.rowMTSyncs) { + p.jobs[worker].rowMTSync = &p.rowMTSyncs[tileSlot] + } else { + p.jobs[worker].rowMTSync = nil + } + } + epoch := p.startHelperWorkers(helpers) + + // The lead tile decode runs on this goroutine. When row-MT is + // armed, plumb the lead tile's wavefront sync through the parent + // decoder so parseVP9*ModeTile observes the same shape as worker + // invocations. + if next < len(p.rowMTSyncs) { + d.rowMTSync = &p.rowMTSyncs[next] + } else { + d.rowMTSync = nil + } + err := d.runVP9DecoderTileDesc(kind, descs[next], &p.header, comp, + intraMaps, interMaps, miRows, miCols, partitionProbs) + d.rowMTSync = nil + p.waitHelperWorkers(epoch, helpers) + for worker := range helpers { + job := &p.jobs[worker] + if job.unsupported { + d.unsupportedReconstruct = true + } + if err == nil && job.err != nil { + err = job.err + } + if mergeCounts && job.err == nil { + vp9dec.MergeFrameCounts(&d.counts, &job.worker.counts) + } + } + if err != nil { + return err + } + jobsRun += helpers + 1 + next += helpers + 1 + } + p.lastTileJobs = uint8(jobsRun) + return nil +} + +func (d *VP9Decoder) runVP9DecoderScheduledTileJobs(descs []vp9DecoderTileDesc, + kind vp9DecoderTileJobKind, comp vp9dec.CompressedHeader, + intraMaps vp9dec.IntraSegmentMaps, interMaps vp9dec.InterSegmentMaps, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + p := d.vp9TilePool + workers := min(int(p.helperCount)+1, len(descs)) + if workers <= 1 { + err := d.runVP9DecoderTileDesc(kind, descs[0], &p.header, comp, + intraMaps, interMaps, miRows, miCols, partitionProbs) + if err == nil { + p.lastTileJobs = 1 + p.recordTileSchedule(descs) + } + return err + } + + scheduleVP9DecoderTileDescsForThreading(descs, workers) + p.recordTileSchedule(descs) + + mergeCounts := !p.header.FrameParallelDecoding + base := len(descs) / workers + remain := len(descs) % workers + bufStart := 0 + var err error + helpers := workers - 1 + for worker := range helpers { + count := base + (remain+worker)/workers + bufEnd := bufStart + count + p.prepareTileJobRange(worker, d, kind, descs[bufStart:bufEnd], comp, + intraMaps, interMaps, miRows, miCols, partitionProbs) + bufStart = bufEnd + } + epoch := p.startHelperWorkers(helpers) + + mainCount := base + (remain+helpers)/workers + mainEnd := bufStart + mainCount + for _, desc := range descs[bufStart:mainEnd] { + if runErr := d.runVP9DecoderTileDesc(kind, desc, &p.header, comp, + intraMaps, interMaps, miRows, miCols, partitionProbs); runErr != nil && err == nil { + err = runErr + } + } + + p.waitHelperWorkers(epoch, helpers) + for worker := range helpers { + job := &p.jobs[worker] + if job.unsupported { + d.unsupportedReconstruct = true + } + if err == nil && job.err != nil { + err = job.err + } + if mergeCounts && job.err == nil { + vp9dec.MergeFrameCounts(&d.counts, &job.worker.counts) + } + } + if err != nil { + return err + } + p.lastTileJobs = uint8(len(descs)) + return nil +} + +func scheduleVP9DecoderTileDescsForThreading(descs []vp9DecoderTileDesc, workers int) { + if len(descs) <= 1 || workers <= 1 { + return + } + // libvpx decode_tiles_mt sorts tile buffers by compressed size descending. + for i := 1; i < len(descs); i++ { + desc := descs[i] + j := i - 1 + for j >= 0 && len(descs[j].data) < len(desc.data) { + descs[j+1] = descs[j] + j-- + } + descs[j+1] = desc + } + if workers >= len(descs) { + largest := descs[0] + copy(descs, descs[1:]) + descs[len(descs)-1] = largest + return + } + start, end := 0, len(descs)-2 + for start < end { + descs[start], descs[end] = descs[end], descs[start] + start += 2 + end -= 2 + } +} + +func (p *vp9DecoderTileWorkerPool) recordTileSchedule(descs []vp9DecoderTileDesc) { + if p == nil { + return + } + n := min(len(descs), len(p.lastTileSchedule)) + for i := range n { + p.lastTileSchedule[i] = descs[i].tile.MiColStart + } + p.lastTileScheduleLen = uint8(n) +} + +func copyVP9TileWorkerState(dst *VP9Decoder, parent *VP9Decoder) { + dst.opts = parent.opts + dst.aboveSegCtx = parent.aboveSegCtx + dst.miGrid = parent.miGrid + dst.miIdx = parent.miIdx + dst.segMap = parent.segMap + dst.lastSegMap = parent.lastSegMap + dst.segMapMiRows = parent.segMapMiRows + dst.segMapMiCols = parent.segMapMiCols + dst.planes = parent.planes + dst.lastFrame = parent.lastFrame + dst.frameY = parent.frameY + dst.frameU = parent.frameU + dst.frameV = parent.frameV + dst.frameYFull = parent.frameYFull + dst.frameUFull = parent.frameUFull + dst.frameVFull = parent.frameVFull + if parent.refFramesView != nil { + dst.refFramesView = parent.refFramesView + } else { + dst.refFramesView = &parent.refFrames + } + dst.prevFrameMvs = parent.prevFrameMvs + dst.curFrameMvs = parent.curFrameMvs + dst.frameYOrigin = parent.frameYOrigin + dst.frameUOrigin = parent.frameUOrigin + dst.frameVOrigin = parent.frameVOrigin + dst.prevFrameMvRows = parent.prevFrameMvRows + dst.prevFrameMvCols = parent.prevFrameMvCols + dst.usePrevFrameMvs = parent.usePrevFrameMvs + dst.width = parent.width + dst.height = parent.height + dst.sfCacheNext = 0 + dst.sfCache = [4]vp9ScaleFactorsEntry{} + dst.unsupportedReconstruct = parent.unsupportedReconstruct + dst.predictPlaneMode = parent.predictPlaneMode + dst.dq = parent.dq + dst.fc = parent.fc + dst.coefProbsPacked = parent.coefProbsPacked + dst.highbd = nil +} + +func (p *vp9DecoderTileWorkerPool) prepareTileJob(worker int, + parent *VP9Decoder, kind vp9DecoderTileJobKind, desc vp9DecoderTileDesc, + comp vp9dec.CompressedHeader, + intraMaps vp9dec.IntraSegmentMaps, interMaps vp9dec.InterSegmentMaps, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) { + job := &p.jobs[worker] + job.descs = nil + copyVP9TileWorkerState(&job.worker, parent) + if parent.highbd != nil { + dq := job.highbdState.dqcoeff32 + sc := job.highbdState.interPredictScratch16 + job.highbdState = *parent.highbd + job.highbdState.dqcoeff32 = dq + job.highbdState.interPredictScratch16 = sc + job.worker.highbd = &job.highbdState + } + job.data = desc.data + job.hdr = &p.header + job.comp = comp + job.intraMaps = intraMaps + job.interMaps = interMaps + job.tile = desc.tile + job.miRows = miRows + job.miCols = miCols + job.partitionProbs = partitionProbs + job.kind = kind + job.rowMTParent = nil + job.rowMTStorage = nil + job.err = nil + job.unsupported = false + if !p.header.FrameParallelDecoding { + job.worker.counts = vp9dec.FrameCounts{} + } + for plane := range vp9dec.MaxMbPlane { + job.leftEntropyLen[plane] = uint8(len(parent.planes[plane].LeftContext)) + } +} + +func (p *vp9DecoderTileWorkerPool) prepareTileJobRange(worker int, + parent *VP9Decoder, kind vp9DecoderTileJobKind, descs []vp9DecoderTileDesc, + comp vp9dec.CompressedHeader, + intraMaps vp9dec.IntraSegmentMaps, interMaps vp9dec.InterSegmentMaps, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) { + p.prepareTileJob(worker, parent, kind, vp9DecoderTileDesc{}, comp, + intraMaps, interMaps, miRows, miCols, partitionProbs) + p.jobs[worker].descs = descs + p.jobs[worker].rowMTSync = nil + p.jobs[worker].rowMTStorage = nil +} + +func (j *vp9DecoderTileJob) prepareRowMTJob( + parent *VP9Decoder, kind vp9DecoderTileJobKind, hdr *vp9dec.UncompressedHeader, + comp vp9dec.CompressedHeader, tile vp9dec.TileBounds, + intraMaps vp9dec.IntraSegmentMaps, interMaps vp9dec.InterSegmentMaps, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, + storage *vp9DecoderRowMTFrameStorage, +) { + j.descs = nil + j.worker = *parent + if parent.highbd != nil { + dq := j.highbdState.dqcoeff32 + sc := j.highbdState.interPredictScratch16 + j.highbdState = *parent.highbd + j.highbdState.dqcoeff32 = dq + j.highbdState.interPredictScratch16 = sc + j.worker.highbd = &j.highbdState + } + j.rowMTParent = parent + j.data = nil + j.hdr = hdr + j.comp = comp + j.intraMaps = intraMaps + j.interMaps = interMaps + j.tile = tile + j.miRows = miRows + j.miCols = miCols + j.partitionProbs = partitionProbs + j.kind = kind + j.rowMTSync = nil + j.rowMTStorage = storage + j.err = nil + j.unsupported = false +} + +func (p *vp9DecoderTileWorkerPool) prepareRowMTJob(worker int, + parent *VP9Decoder, kind vp9DecoderTileJobKind, hdr *vp9dec.UncompressedHeader, + comp vp9dec.CompressedHeader, tile vp9dec.TileBounds, + intraMaps vp9dec.IntraSegmentMaps, interMaps vp9dec.InterSegmentMaps, + miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, + storage *vp9DecoderRowMTFrameStorage, +) { + p.jobs[worker].prepareRowMTJob(parent, kind, hdr, comp, tile, intraMaps, + interMaps, miRows, miCols, partitionProbs, storage) +} + +func (p *vp9DecoderTileWorkerPool) extendFrameBorders( + yFull []byte, yOrigin, yStride, yW, yH, yBX, yBY int, + uFull []byte, uOrigin, uStride, uW, uH, uBX, uBY int, + vFull []byte, vOrigin, vStride, vW, vH, vBX, vBY int, +) bool { + j0 := &p.jobs[0] + j0.isBorder = true + j0.borderOK = false + j0.borderFull = uFull + j0.borderOrigin = uOrigin + j0.borderStride = uStride + j0.borderWidth = uW + j0.borderHeight = uH + j0.borderX = uBX + j0.borderY = uBY + + j1 := &p.jobs[1] + j1.isBorder = true + j1.borderOK = false + j1.borderFull = vFull + j1.borderOrigin = vOrigin + j1.borderStride = vStride + j1.borderWidth = vW + j1.borderHeight = vH + j1.borderX = vBX + j1.borderY = vBY + + epoch := p.startHelperWorkers(2) + yOK := vp9ExtendPlaneBorder(yFull, yOrigin, yStride, yW, yH, yBX, yBY) + p.waitHelperWorkers(epoch, 2) + ok := yOK && j0.borderOK && j1.borderOK + j0.isBorder = false + j0.borderFull = nil + j1.isBorder = false + j1.borderFull = nil + return ok +} + +func (j *vp9DecoderTileJob) run() { + if j.isBorder { + j.borderOK = vp9ExtendPlaneBorder(j.borderFull, j.borderOrigin, j.borderStride, j.borderWidth, j.borderHeight, j.borderX, j.borderY) + return + } + if j.rowMTStorage != nil { + j.runRowMT() + return + } + worker := &j.worker + worker.vp9LoopFilterPool = nil + worker.vp9TilePool = nil + worker.rowMTSync = j.rowMTSync + worker.leftSegCtx = j.leftSegCtx[:] + if len(j.descs) > 0 { + j.runDescs(worker, j.descs) + j.descs = nil + return + } + j.resetLeftContexts(worker) + worker.interPredictScratch = j.interPredictScratch + j.err = worker.runVP9DecoderTileDesc(j.kind, vp9DecoderTileDesc{ + data: j.data, + tile: j.tile, + }, j.hdr, j.comp, j.intraMaps, j.interMaps, j.miRows, j.miCols, + j.partitionProbs) + j.interPredictScratch = worker.interPredictScratch + j.unsupported = worker.unsupportedReconstruct + worker.rowMTSync = nil +} + +func (j *vp9DecoderTileJob) runRowMT() { + worker := &j.worker + worker.vp9LoopFilterPool = nil + worker.vp9TilePool = nil + worker.rowMTSync = nil + worker.interPredictScratch = j.interPredictScratch + spins := 0 +workLoop: + for { + rowJob, ok := j.rowMTStorage.jobq.dequeue(false) + if !ok { + if j.rowMTStorage.jobq.done() { + break workLoop + } + runtimeProcYield(30) + spins++ + if spins >= rowWorkerIdleSchedulerBackoff && + spins%rowWorkerIdleSchedulerBackoff == 0 { + runtime.Gosched() + } + continue + } + spins = 0 + tile := j.tile + if state := j.rowMTStorage.tileState(rowJob.tileCol); state != nil { + tile = state.tile + } + switch rowJob.jobType { + case vp9DecoderRowMTJobParse: + if err := j.runRowMTParse(rowJob); err != nil { + j.err = err + j.rowMTStorage.abort() + break workLoop + } + case vp9DecoderRowMTJobLPF: + if !worker.applyVP9LoopFilterRowMT(j.miRows, j.miCols, + rowJob.rowNum, &j.rowMTStorage.lfSync) { + j.err = ErrInvalidVP9Data + j.rowMTStorage.abort() + break workLoop + } + if rowJob.rowNum+common.MiBlockSize >= j.miRows { + j.rowMTStorage.completeLastLPFRow() + } + case vp9DecoderRowMTJobRecon: + var err error + if j.kind == vp9DecoderTileJobIntra { + err = worker.reconstructVP9IntraModeTileRowMTRow( + j.hdr, j.rowMTStorage, tile, j.miRows, j.miCols, + rowJob.rowNum, rowJob.tileCol) + } else { + err = worker.reconstructVP9InterModeTileRowMTRow( + j.hdr, j.rowMTStorage, tile, j.miRows, j.miCols, + rowJob.rowNum, rowJob.tileCol) + } + if err != nil { + j.err = err + j.rowMTStorage.abort() + break workLoop + } + if rowJob.rowNum+common.MiBlockSize >= tile.MiRowEnd { + j.rowMTStorage.completeTileRecon() + } + default: + j.err = ErrInvalidVP9Data + j.rowMTStorage.abort() + break workLoop + } + } + j.interPredictScratch = worker.interPredictScratch + j.unsupported = worker.unsupportedReconstruct + worker.rowMTSync = nil +} + +func (j *vp9DecoderTileJob) runDescs(worker *VP9Decoder, descs []vp9DecoderTileDesc) { + worker.interPredictScratch = j.interPredictScratch + for _, desc := range descs { + j.resetLeftContexts(worker) + if err := worker.runVP9DecoderTileDesc(j.kind, desc, j.hdr, j.comp, + j.intraMaps, j.interMaps, j.miRows, j.miCols, + j.partitionProbs); err != nil { + j.err = err + j.interPredictScratch = worker.interPredictScratch + j.unsupported = worker.unsupportedReconstruct + worker.rowMTSync = nil + return + } + } + j.err = nil + j.interPredictScratch = worker.interPredictScratch + j.unsupported = worker.unsupportedReconstruct + worker.rowMTSync = nil +} + +func (j *vp9DecoderTileJob) resetLeftContexts(worker *VP9Decoder) { + for i := range worker.leftSegCtx { + worker.leftSegCtx[i] = 0 + } + for plane := range vp9dec.MaxMbPlane { + leftLen := int(j.leftEntropyLen[plane]) + if leftLen > len(j.leftEntropy[plane]) { + j.err = ErrInvalidVP9Data + return + } + worker.planes[plane].LeftContext = j.leftEntropy[plane][:leftLen] + for i := range worker.planes[plane].LeftContext { + worker.planes[plane].LeftContext[i] = 0 + } + } +} + +func (d *VP9Decoder) runVP9DecoderTileDesc(kind vp9DecoderTileJobKind, + desc vp9DecoderTileDesc, hdr *vp9dec.UncompressedHeader, + comp vp9dec.CompressedHeader, intraMaps vp9dec.IntraSegmentMaps, + interMaps vp9dec.InterSegmentMaps, miRows, miCols int, + partitionProbs *[common.PartitionContexts][common.PartitionTypes - 1]uint8, +) error { + if kind == vp9DecoderTileJobIntra { + return d.parseVP9IntraModeTile(desc.data, hdr, comp, &intraMaps, + desc.tile, miRows, miCols, partitionProbs) + } + return d.parseVP9InterModeTile(desc.data, hdr, comp, &interMaps, desc.tile, + miRows, miCols, partitionProbs) +} diff --git a/internal/vp9/codec/vp9_encoder_key_modes.go b/internal/vp9/codec/vp9_encoder_key_modes.go new file mode 100644 index 0000000..0c97c5b --- /dev/null +++ b/internal/vp9/codec/vp9_encoder_key_modes.go @@ -0,0 +1,30 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_encoder_key_modes.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" + vp9dec "github.com/go-avkit/vpx/internal/vp9/decoder" +) + +func vp9IntraPredictWidth4x4(bsize, planeBsize common.BlockSize, + pd *vp9dec.MacroblockdPlane, +) int { + w := int(common.Num4x4BlocksWideLookup[planeBsize]) + if pd == nil || bsize >= common.Block8x8 { + return w + } + sub8W := max(2>>pd.SubsamplingX, 1) + if sub8W > w { + return sub8W + } + return w +} diff --git a/internal/vp9/codec/vp9_encoder_lf_workers.go b/internal/vp9/codec/vp9_encoder_lf_workers.go new file mode 100644 index 0000000..4eebcc7 --- /dev/null +++ b/internal/vp9/codec/vp9_encoder_lf_workers.go @@ -0,0 +1,274 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_encoder_lf_workers.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "sync/atomic" + + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// vp9LfSync mirrors libvpx's VP9LfSync (vp9/common/vp9_thread_common.c): a +// per-SB-row column progress tracker that lets the row-interleaved loop +// filter workers stay one sync range behind the row above, since filtering a +// superblock's top horizontal edge writes pixels that the row above's +// vertical pass must have finished first. +// +// Fast path is a single atomic Load; when a row genuinely has to wait on the +// row above, it parks on a pre-allocated buffered channel instead of spinning. +type vp9LfSync struct { + curSbCol []atomic.Int32 + tilesDone []atomic.Int32 + rowWaiting []atomic.Bool + rowWake []chan struct{} + rows int + syncRange int + aborted atomic.Bool +} + +// vp9LfSyncRange mirrors get_sync_range (vp9_thread_common.c:249): +// +// // nsync numbers are picked by testing. For example, for 4k +// // video, using 4 gives best performance. +// if (width < 640) return 1; +// else if (width <= 1280) return 2; +// else if (width <= 4096) return 4; +// else return 8; +func vp9LfSyncRange(width int) int { + switch { + case width < 640: + return 1 + case width <= 1280: + return 2 + case width <= 4096: + return 4 + default: + return 8 + } +} + +// reset re-arms the sync for a frame of sbRows rows, mirroring +// vp9_loop_filter_alloc's cur_sb_col allocation plus the memset to -1 in +// vp9_loop_filter_frame_mt (vp9_thread_common.c:214-216). +func (s *vp9LfSync) reset(sbRows, width int) { + if s == nil || sbRows <= 0 { + return + } + if cap(s.curSbCol) < sbRows { + s.curSbCol = make([]atomic.Int32, sbRows) + s.tilesDone = make([]atomic.Int32, sbRows) + s.rowWaiting = make([]atomic.Bool, sbRows) + s.rowWake = make([]chan struct{}, sbRows) + for r := range s.rowWake { + s.rowWake[r] = make(chan struct{}, 1) + } + } else { + s.curSbCol = s.curSbCol[:sbRows] + s.tilesDone = s.tilesDone[:sbRows] + s.rowWaiting = s.rowWaiting[:sbRows] + s.rowWake = s.rowWake[:sbRows] + } + for r := range s.curSbCol { + s.curSbCol[r].Store(-1) + s.tilesDone[r].Store(0) + s.rowWaiting[r].Store(false) + select { + case <-s.rowWake[r]: + default: + } + } + s.rows = sbRows + s.syncRange = vp9LfSyncRange(width) + s.aborted.Store(false) +} + +func (s *vp9LfSync) abort() { + if s == nil { + return + } + s.aborted.Store(true) + for r := range s.rowWake { + if s.rowWake[r] != nil { + select { + case s.rowWake[r] <- struct{}{}: + default: + } + } + } +} + +// tileRowDone mirrors lpf_map_write_check: the final tile reconstruction for +// an SB row releases exactly one LPF job for that row. +func (s *vp9LfSync) tileRowDone(row, tileCols int) bool { + if s == nil || row < 0 || row >= s.rows || tileCols <= 0 { + return false + } + return int(s.tilesDone[row].Add(1)) == tileCols +} + +// read mirrors sync_read (vp9_thread_common.c:22): before filtering SB +// (r, c) the worker waits until row r-1 has advanced at least sync range +// columns past c. Returns false if the sync was aborted by a sibling error. +func (s *vp9LfSync) read(r, c int) bool { + if s == nil || r <= 0 || r >= s.rows { + return true + } + nsync := s.syncRange + if nsync <= 0 || (c&(nsync-1)) != 0 { + return true + } + target := int32(c + nsync) + for s.curSbCol[r-1].Load() < target { + if s.aborted.Load() { + return false + } + s.rowWaiting[r-1].Store(true) + if s.curSbCol[r-1].Load() >= target { + s.rowWaiting[r-1].Store(false) + return true + } + if s.aborted.Load() { + return false + } + <-s.rowWake[r-1] + } + return true +} + +// write mirrors sync_write (vp9_thread_common.c:42): record the row's +// progress when crossing a sync range boundary or when the row completes. +func (s *vp9LfSync) write(r, c, sbCols int) { + if s == nil || r < 0 || r >= s.rows { + return + } + nsync := s.syncRange + if nsync <= 0 { + return + } + var cur int32 + sig := true + if c < sbCols-1 { + cur = int32(c) + if c%nsync != 0 { + sig = false + } + } else { + cur = int32(sbCols + nsync) + } + if !sig { + return + } + s.curSbCol[r].Store(cur) + if s.rowWaiting[r].Load() && s.rowWaiting[r].Swap(false) { + select { + case s.rowWake[r] <- struct{}{}: + default: + } + } +} + +// markRowsDone releases any rows this worker still owns so sibling workers +// blocked in read never deadlock when a defensive filter-error bail fires. +func (s *vp9LfSync) markRowsDone(startSbRow, step, sbRows, sbCols int) { + for r := startSbRow; r < sbRows; r += step { + s.write(r, sbCols-1, sbCols) + } +} + +// vp9EncodeLfJob carries one worker's share of the row-interleaved loop +// filter walk, mirroring libvpx's LFWorkerData for thread_loop_filter_rows. +type vp9EncodeLfJob struct { + lfSync *vp9LfSync + miRows int + miCols int + start int + step int + ok bool + // d is placed last so Go's GC stops at VP9Decoder's ~4 KiB PtrBytes + // instead of scanning its ~40 KiB pure-value tail. + d VP9Decoder +} + +func runVP9EncodeLfJob(job *vp9EncodeLfJob) { + if job == nil { + return + } + job.ok = job.d.applyVP9LoopFilterRowsInterleaved(job.miRows, job.miCols, + job.start, job.step, job.lfSync) +} + +// applyVP9LoopFilterRowsInterleaved mirrors thread_loop_filter_rows +// (vp9_thread_common.c:74): the worker filters SB rows start, start+step, +// start+2*step, ... walking columns left to right under the lf sync +// wavefront. Masks must already be prepared for the whole frame. +func (d *VP9Decoder) applyVP9LoopFilterRowsInterleaved(miRows, miCols, + start, step int, lfSync *vp9LfSync, +) bool { + if step <= 0 { + return false + } + sbRows := (miRows + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + sbCols := (miCols + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + for miRow := start * common.MiBlockSize; miRow < miRows; miRow += step * common.MiBlockSize { + r := miRow >> common.MiBlockSizeLog2 + for miCol := 0; miCol < miCols; miCol += common.MiBlockSize { + c := miCol >> common.MiBlockSizeLog2 + if !lfSync.read(r, c) { + return false + } + lfm, ok := d.vp9LoopFilterMaskAt(miRow, miCol) + if !ok || !d.vp9FilterLoopBlock(miRows, miCols, miRow, miCol, lfm) { + // Defensive bail: abort sync and release the rows this worker + // owns so siblings blocked in read never deadlock. + lfSync.abort() + lfSync.write(r, sbCols-1, sbCols) + lfSync.markRowsDone(r+step, step, sbRows, sbCols) + return false + } + lfSync.write(r, c, sbCols) + } + } + return true +} + +// applyVP9LoopFilterRowMT mirrors vp9_loopfilter_job for one queued SB row. +// The previous reconstructed row is released by the following RECON job, and +// VP9LfSync preserves the left-to-right dependency between adjacent LPF rows. +func (d *VP9Decoder) applyVP9LoopFilterRowMT(miRows, miCols, miRow int, + lfSync *vp9LfSync, +) bool { + if lfSync == nil || miRow < 0 || miRow >= miRows { + return false + } + endMiRow := min(miRow+common.MiBlockSize, miRows) + if !d.prepareVP9LoopFilterMasksCached(miRows, miCols, miRow, endMiRow) { + lfSync.abort() + return false + } + sbRows := (miRows + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + sbCols := (miCols + common.MiBlockSize - 1) >> common.MiBlockSizeLog2 + r := miRow >> common.MiBlockSizeLog2 + for miCol := 0; miCol < miCols; miCol += common.MiBlockSize { + c := miCol >> common.MiBlockSizeLog2 + if !lfSync.read(r, c) { + return false + } + lfm, ok := d.vp9LoopFilterMaskAt(miRow, miCol) + if !ok || !d.vp9FilterLoopBlock(miRows, miCols, miRow, miCol, lfm) { + lfSync.abort() + lfSync.write(r, sbCols-1, sbCols) + lfSync.markRowsDone(r+1, 1, sbRows, sbCols) + return false + } + lfSync.write(r, c, sbCols) + } + return true +} diff --git a/internal/vp9/codec/vp9_encoder_state.go b/internal/vp9/codec/vp9_encoder_state.go new file mode 100644 index 0000000..537f36a --- /dev/null +++ b/internal/vp9/codec/vp9_encoder_state.go @@ -0,0 +1,17 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_encoder_state.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +const ( + vp9LastRefSlot = 0 + vp9GoldenRefSlot = 1 + vp9AltRefSlot = 2 +) diff --git a/internal/vp9/codec/vp9_encoder_tile_workers.go b/internal/vp9/codec/vp9_encoder_tile_workers.go new file mode 100644 index 0000000..bbcff02 --- /dev/null +++ b/internal/vp9/codec/vp9_encoder_tile_workers.go @@ -0,0 +1,162 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_encoder_tile_workers.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + "sync/atomic" +) + +// vp9RowMTSync mirrors libvpx's VP9RowMTSync (vp9/encoder/vp9_ethread.h). It +// tracks the latest column index encoded for each SB row inside a tile column +// and exposes Read / Write primitives matching vp9_row_mt_sync_read / +// vp9_row_mt_sync_write. SyncRange (libvpx's sync_range) caps how far ahead a +// row can advance before publishing progress. Fast path is a single atomic +// Load; when a row genuinely waits on the row above, it parks on a +// pre-allocated buffered channel instead of spinning. +type vp9RowMTSync struct { + curCol []atomic.Int32 + rowWaiting []atomic.Bool + rowWake []chan struct{} + rows int + syncRange int + aborted atomic.Bool +} + +// vp9RowMTSyncDefaultRange mirrors libvpx's row_mt_sync->sync_range = 1 init in +// vp9_row_mt_sync_mem_alloc. A range of one means each completed SB column +// signals the row below; larger values reduce signalling frequency at the cost +// of more wavefront slack. +const vp9RowMTSyncDefaultRange = 1 + +func (s *vp9RowMTSync) reset(rows int) { + if s == nil || rows <= 0 { + return + } + if cap(s.curCol) < rows { + s.curCol = make([]atomic.Int32, rows) + s.rowWaiting = make([]atomic.Bool, rows) + s.rowWake = make([]chan struct{}, rows) + for r := range s.rowWake { + s.rowWake[r] = make(chan struct{}, 1) + } + } else { + s.curCol = s.curCol[:rows] + s.rowWaiting = s.rowWaiting[:rows] + s.rowWake = s.rowWake[:rows] + } + for r := range s.curCol { + s.curCol[r].Store(-1) + s.rowWaiting[r].Store(false) + select { + case <-s.rowWake[r]: + default: + } + } + s.rows = rows + if s.syncRange == 0 { + s.syncRange = vp9RowMTSyncDefaultRange + } + s.aborted.Store(false) +} + +func (s *vp9RowMTSync) abort() { + if s == nil { + return + } + s.aborted.Store(true) + for r := range s.rowWake { + if s.rowWake[r] != nil { + select { + case s.rowWake[r] <- struct{}{}: + default: + } + } + } +} + +func (s *vp9RowMTSync) release() { + if s == nil { + return + } + s.curCol = s.curCol[:0] + s.rowWaiting = s.rowWaiting[:0] + s.rowWake = s.rowWake[:0] + s.rows = 0 +} + +// read mirrors vp9_row_mt_sync_read. It blocks until the row above has reached +// column position c - syncRange + 1, ensuring the above and above-right SBs +// are encoded before the caller proceeds. +func (s *vp9RowMTSync) read(r, c int) { + if s == nil || r <= 0 || r >= s.rows { + return + } + nsync := s.syncRange + if nsync <= 0 || (c&(nsync-1)) != 0 { + return + } + target := int32(c - nsync + 1) + if s.curCol[r-1].Load() >= target { + return + } + for range 16 { + if s.curCol[r-1].Load() >= target { + return + } + } + for s.curCol[r-1].Load() < target { + if s.aborted.Load() { + return + } + s.rowWaiting[r-1].Store(true) + if s.curCol[r-1].Load() >= target { + s.rowWaiting[r-1].Store(false) + return + } + if s.aborted.Load() { + return + } + <-s.rowWake[r-1] + } +} + +// write mirrors vp9_row_mt_sync_write. It records the row's current column +// position and broadcasts to waiters when crossing a syncRange boundary or +// when the row finishes. cols is the SB column count for the tile. +func (s *vp9RowMTSync) write(r, c, cols int) { + if s == nil || r < 0 || r >= s.rows { + return + } + nsync := s.syncRange + if nsync <= 0 { + return + } + var cur int32 + sig := true + if c < cols-1 { + cur = int32(c) + if c%nsync != nsync-1 { + sig = false + } + } else { + cur = int32(cols + nsync) + } + if !sig { + return + } + s.curCol[r].Store(cur) + if s.rowWaiting[r].Load() && s.rowWaiting[r].Swap(false) { + select { + case s.rowWake[r] <- struct{}{}: + default: + } + } +} diff --git a/internal/vp9/codec/vp9_phase_stats_disabled.go b/internal/vp9/codec/vp9_phase_stats_disabled.go new file mode 100644 index 0000000..486effe --- /dev/null +++ b/internal/vp9/codec/vp9_phase_stats_disabled.go @@ -0,0 +1,23 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_phase_stats_disabled.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !govpx_phase_stats + +package codec + +const vp9PhaseStatsEnabled = false + +type vp9DecoderPhaseStatsOptions struct{} + +func (d *VP9Decoder) setVP9PhaseStats(*EncoderPhaseStats) {} + +func (d *VP9Decoder) vp9PhaseIncInterPredictPlane() {} + +func (d *VP9Decoder) vp9PhaseCountInterPredictor(int) {} diff --git a/internal/vp9/codec/vp9_reference_controls.go b/internal/vp9/codec/vp9_reference_controls.go new file mode 100644 index 0000000..2a11ece --- /dev/null +++ b/internal/vp9/codec/vp9_reference_controls.go @@ -0,0 +1,82 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_reference_controls.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +// SetReferenceFrame replaces a VP9 decoder reference slot with src. ref must +// be [ReferenceLast], [ReferenceGolden], or [ReferenceAltRef]; src must match +// the stream dimensions established by a successfully decoded frame and provide +// valid I420 strides. +func (d *VP9Decoder) SetReferenceFrame(ref ReferenceFrame, src Image) error { + if d.isClosed() { + return ErrClosed + } + slot, ok := vp9PublicReferenceFrameSlot(ref) + if !ok || !d.vp9ReferenceFramesInitialized() || + !src.ValidForEncode(d.width, d.height) { + return ErrInvalidConfig + } + d.releaseVP9ReferenceFrame(slot) + d.refFrames[slot].store(src) + return nil +} + +// CopyReferenceFrame copies a VP9 decoder reference slot into dst. ref must be +// [ReferenceLast], [ReferenceGolden], or [ReferenceAltRef]; dst must be +// non-nil, match the active stream dimensions, and provide valid I420 strides. +func (d *VP9Decoder) CopyReferenceFrame(ref ReferenceFrame, dst *Image) error { + if d.isClosed() { + return ErrClosed + } + if dst == nil { + return ErrInvalidConfig + } + slot, ok := vp9PublicReferenceFrameSlot(ref) + if !ok || !d.vp9ReferenceFramesInitialized() || + !dst.ValidForEncode(d.width, d.height) || + !d.refFrames[slot].valid { + return ErrInvalidConfig + } + copyVP9ImageToPublic(dst, d.refFrames[slot].img) + return nil +} + +// CopyCurrentFrame copies the most recently shown VP9 frame into dst without +// consuming the decoder's NextFrame queue. This mirrors libvpx's +// VP9_GET_REFERENCE control, which exposes the current show-frame buffer rather +// than one of the LAST/GOLDEN/ALTREF reference slots. +func (d *VP9Decoder) CopyCurrentFrame(dst *Image) error { + if d.isClosed() { + return ErrClosed + } + if dst == nil || !d.isActive() || !d.lastInfo.ShowFrame || + !dst.ValidForEncode(d.lastFrame.Width, d.lastFrame.Height) { + return ErrInvalidConfig + } + copyVP9ImageToPublic(dst, d.lastFrame) + return nil +} + +func (d *VP9Decoder) vp9ReferenceFramesInitialized() bool { + return d.isActive() && d.width > 0 && d.height > 0 +} + +func vp9PublicReferenceFrameSlot(ref ReferenceFrame) (int, bool) { + switch ref { + case ReferenceLast: + return vp9LastRefSlot, true + case ReferenceGolden: + return vp9GoldenRefSlot, true + case ReferenceAltRef: + return vp9AltRefSlot, true + default: + return 0, false + } +} diff --git a/internal/vp9/codec/vp9_rtp.go b/internal/vp9/codec/vp9_rtp.go new file mode 100644 index 0000000..18019ce --- /dev/null +++ b/internal/vp9/codec/vp9_rtp.go @@ -0,0 +1,77 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/codec/vp9_rtp.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codec + +import ( + vp9rtp "github.com/go-avkit/vpx/internal/vp9/rtp" +) + +const ( + // VP9RTPMaxReferenceIndices is the maximum number of reference-index + // entries in a VP9 RTP payload descriptor or scalability-structure entry. + VP9RTPMaxReferenceIndices = vp9rtp.MaxReferenceIndices + // VP9RTPMaxSpatialLayers is the maximum number of spatial layers described + // by a VP9 RTP scalability structure. + VP9RTPMaxSpatialLayers = vp9rtp.MaxSpatialLayers +) + +// AssembleVP9RTPFrameInto writes the raw VP9 frame carried by payloads into +// dst and returns the frame length. On [ErrBufferTooSmall], the returned +// length is the required capacity. +func AssembleVP9RTPFrameInto(dst []byte, payloads []RTPPayloadFragment) (int, error) { + return vp9rtp.AssembleFrameInto(dst, payloads) +} + +// AssembleVP9RTPFrame returns the raw VP9 frame carried by an ordered set of +// RTP payload bodies. +func AssembleVP9RTPFrame(payloads []RTPPayloadFragment) ([]byte, error) { + return vp9rtp.AssembleFrame(payloads) +} + +// DecodeRTP assembles one ordered set of VP9 RTP payload bodies and decodes +// the resulting raw VP9 frame. The decoded image is returned by NextFrame when +// the frame is visible. +func (d *VP9Decoder) DecodeRTP(payloads []RTPPayloadFragment) error { + return d.DecodeRTPWithPTS(payloads, 0) +} + +// DecodeRTPWithPTS is DecodeRTP with an explicit presentation timestamp. +func (d *VP9Decoder) DecodeRTPWithPTS(payloads []RTPPayloadFragment, pts uint64) error { + if d.isClosed() { + return ErrClosed + } + frame, err := AssembleVP9RTPFrame(payloads) + if err != nil { + return err + } + return d.DecodeWithPTS(frame, pts) +} + +// DecodeRTPInto assembles one ordered set of VP9 RTP payload bodies into +// frameBuf and decodes the resulting raw VP9 frame. On ErrBufferTooSmall, the +// returned integer is the required frameBuf capacity. The decoded image is +// returned by NextFrame when the frame is visible. +func (d *VP9Decoder) DecodeRTPInto(frameBuf []byte, payloads []RTPPayloadFragment) (int, error) { + return d.DecodeRTPIntoWithPTS(frameBuf, payloads, 0) +} + +// DecodeRTPIntoWithPTS is DecodeRTPInto with an explicit presentation +// timestamp. +func (d *VP9Decoder) DecodeRTPIntoWithPTS(frameBuf []byte, payloads []RTPPayloadFragment, pts uint64) (int, error) { + if d.isClosed() { + return 0, ErrClosed + } + n, err := AssembleVP9RTPFrameInto(frameBuf, payloads) + if err != nil { + return n, err + } + return n, d.DecodeWithPTS(frameBuf[:n], pts) +} diff --git a/internal/vp9/common/common_data.go b/internal/vp9/common/common_data.go new file mode 100644 index 0000000..0c8a73b --- /dev/null +++ b/internal/vp9/common/common_data.go @@ -0,0 +1,250 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/common_data.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +// BWidthLog2Lookup is log2 of the block width in pixels. +var BWidthLog2Lookup = [BlockSizes]uint8{ + 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, +} + +// Num4x4BlocksWideLookup is the block width measured in 4x4 sub-blocks. +var Num4x4BlocksWideLookup = [BlockSizes]uint8{ + 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, +} + +// Num4x4BlocksHighLookup is the block height measured in 4x4 sub-blocks. +var Num4x4BlocksHighLookup = [BlockSizes]uint8{ + 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, +} + +// MiWidthLog2Lookup is log2 of the block width in 8x8 mode-info units. +var MiWidthLog2Lookup = [BlockSizes]uint8{ + 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, +} + +// Num8x8BlocksWideLookup is the block width measured in 8x8 sub-blocks. +var Num8x8BlocksWideLookup = [BlockSizes]uint8{ + 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, +} + +// Num8x8BlocksHighLookup is the block height measured in 8x8 sub-blocks. +var Num8x8BlocksHighLookup = [BlockSizes]uint8{ + 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, +} + +// SizeGroupLookup buckets block sizes into 4 groups used by intra mode +// probability tables — min(3, min(log2_w, log2_h)). +var SizeGroupLookup = [BlockSizes]uint8{ + 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, +} + +// PartitionLookup recovers the PartitionType decision that produced the +// inner BlockSize from an outer 4x4 / 8x8 / 16x16 / 32x32 / 64x64 root. +// Each row is indexed by BlockSizes; PartitionInvalid marks shapes that +// could not have come from the corresponding outer size. +var PartitionLookup = [5][BlockSizes]PartitionType{ + { // outer 4x4 + PartitionNone, PartitionInvalid, PartitionInvalid, PartitionInvalid, + PartitionInvalid, PartitionInvalid, PartitionInvalid, PartitionInvalid, + PartitionInvalid, PartitionInvalid, PartitionInvalid, PartitionInvalid, + PartitionInvalid, + }, + { // outer 8x8 + PartitionSplit, PartitionVert, PartitionHorz, PartitionNone, + PartitionInvalid, PartitionInvalid, PartitionInvalid, PartitionInvalid, + PartitionInvalid, PartitionInvalid, PartitionInvalid, PartitionInvalid, + PartitionInvalid, + }, + { // outer 16x16 + PartitionSplit, PartitionSplit, PartitionSplit, PartitionSplit, + PartitionVert, PartitionHorz, PartitionNone, PartitionInvalid, + PartitionInvalid, PartitionInvalid, PartitionInvalid, PartitionInvalid, + PartitionInvalid, + }, + { // outer 32x32 + PartitionSplit, PartitionSplit, PartitionSplit, PartitionSplit, + PartitionSplit, PartitionSplit, PartitionSplit, PartitionVert, + PartitionHorz, PartitionNone, PartitionInvalid, PartitionInvalid, + PartitionInvalid, + }, + { // outer 64x64 + PartitionSplit, PartitionSplit, PartitionSplit, PartitionSplit, + PartitionSplit, PartitionSplit, PartitionSplit, PartitionSplit, + PartitionSplit, PartitionSplit, PartitionVert, PartitionHorz, + PartitionNone, + }, +} + +// SubsizeLookup gives the resulting BlockSize after applying a partition +// to an outer block. Indexed by [PartitionType][outer BlockSize]. +var SubsizeLookup = [PartitionTypes][BlockSizes]BlockSize{ + { // PartitionNone — identity + Block4x4, Block4x8, Block8x4, Block8x8, Block8x16, Block16x8, + Block16x16, Block16x32, Block32x16, Block32x32, Block32x64, + Block64x32, Block64x64, + }, + { // PartitionHorz + BlockInvalid, BlockInvalid, BlockInvalid, Block8x4, BlockInvalid, + BlockInvalid, Block16x8, BlockInvalid, BlockInvalid, Block32x16, + BlockInvalid, BlockInvalid, Block64x32, + }, + { // PartitionVert + BlockInvalid, BlockInvalid, BlockInvalid, Block4x8, BlockInvalid, + BlockInvalid, Block8x16, BlockInvalid, BlockInvalid, Block16x32, + BlockInvalid, BlockInvalid, Block32x64, + }, + { // PartitionSplit + BlockInvalid, BlockInvalid, BlockInvalid, Block4x4, BlockInvalid, + BlockInvalid, Block8x8, BlockInvalid, BlockInvalid, Block16x16, + BlockInvalid, BlockInvalid, Block32x32, + }, +} + +// MaxTxsizeLookup is the largest legal transform size for each block shape. +var MaxTxsizeLookup = [BlockSizes]TxSize{ + Tx4x4, Tx4x4, Tx4x4, Tx8x8, Tx8x8, Tx8x8, Tx16x16, + Tx16x16, Tx16x16, Tx32x32, Tx32x32, Tx32x32, Tx32x32, +} + +// TxModeToBiggestTxSize caps the per-frame transform-size budget by TxMode. +var TxModeToBiggestTxSize = [TxModes]TxSize{ + Tx4x4, // Only4x4 + Tx8x8, // Allow8x8 + Tx16x16, // Allow16x16 + Tx32x32, // Allow32x32 + Tx32x32, // TxModeSelect +} + +// SsSizeLookup projects a luma BlockSize onto the chroma plane under +// each (ss_x, ss_y) subsampling configuration. Indexed as +// [BlockSize][ss_x][ss_y]. +var SsSizeLookup = [BlockSizes][2][2]BlockSize{ + // ss_x=0/ss_y=0 ss_x=0/ss_y=1 ss_x=1/ss_y=0 ss_x=1/ss_y=1 + {{Block4x4, BlockInvalid}, {BlockInvalid, BlockInvalid}}, // 4x4 + {{Block4x8, Block4x4}, {BlockInvalid, BlockInvalid}}, // 4x8 + {{Block8x4, BlockInvalid}, {Block4x4, BlockInvalid}}, // 8x4 + {{Block8x8, Block8x4}, {Block4x8, Block4x4}}, // 8x8 + {{Block8x16, Block8x8}, {BlockInvalid, Block4x8}}, // 8x16 + {{Block16x8, BlockInvalid}, {Block8x8, Block8x4}}, // 16x8 + {{Block16x16, Block16x8}, {Block8x16, Block8x8}}, // 16x16 + {{Block16x32, Block16x16}, {BlockInvalid, Block8x16}}, // 16x32 + {{Block32x16, BlockInvalid}, {Block16x16, Block16x8}}, // 32x16 + {{Block32x32, Block32x16}, {Block16x32, Block16x16}}, // 32x32 + {{Block32x64, Block32x32}, {BlockInvalid, Block16x32}}, // 32x64 + {{Block64x32, BlockInvalid}, {Block32x32, Block32x16}}, // 64x32 + {{Block64x64, Block64x32}, {Block32x64, Block32x32}}, // 64x64 +} + +// UvTxsizeLookup picks the chroma transform size given the luma block +// shape, luma transform size, and (ss_x, ss_y) chroma subsampling. Index +// order: [BlockSize][TxSize][ss_x][ss_y]. +var UvTxsizeLookup = [BlockSizes][TxSizes][2][2]TxSize{ + { // Block4x4 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + }, + { // Block4x8 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + }, + { // Block8x4 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + }, + { // Block8x8 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx4x4}, {Tx4x4, Tx4x4}}, + }, + { // Block8x16 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx4x4, Tx4x4}}, + }, + { // Block16x8 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx4x4}, {Tx8x8, Tx4x4}}, + {{Tx8x8, Tx4x4}, {Tx8x8, Tx8x8}}, + {{Tx8x8, Tx4x4}, {Tx8x8, Tx8x8}}, + }, + { // Block16x16 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx8x8}, {Tx8x8, Tx8x8}}, + }, + { // Block16x32 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx16x16}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx16x16}, {Tx8x8, Tx8x8}}, + }, + { // Block32x16 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx8x8}, {Tx16x16, Tx8x8}}, + {{Tx16x16, Tx8x8}, {Tx16x16, Tx8x8}}, + }, + { // Block32x32 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx16x16}, {Tx16x16, Tx16x16}}, + {{Tx32x32, Tx16x16}, {Tx16x16, Tx16x16}}, + }, + { // Block32x64 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx16x16}, {Tx16x16, Tx16x16}}, + {{Tx32x32, Tx32x32}, {Tx16x16, Tx16x16}}, + }, + { // Block64x32 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx16x16}, {Tx16x16, Tx16x16}}, + {{Tx32x32, Tx16x16}, {Tx32x32, Tx16x16}}, + }, + { // Block64x64 + {{Tx4x4, Tx4x4}, {Tx4x4, Tx4x4}}, + {{Tx8x8, Tx8x8}, {Tx8x8, Tx8x8}}, + {{Tx16x16, Tx16x16}, {Tx16x16, Tx16x16}}, + {{Tx32x32, Tx32x32}, {Tx32x32, Tx32x32}}, + }, +} + +// PartitionContextLookup is the 4-bit (above, left) partition context +// pair used to select the partition probability model for a given block +// size. Each bit represents whether a level of split is implied by the +// block size: 1111 -> split possible at every level down to 8x8. +var PartitionContextLookup = [BlockSizes]struct { + Above, Left int8 +}{ + {15, 15}, // 4x4 - {0b1111, 0b1111} + {15, 14}, // 4x8 - {0b1111, 0b1110} + {14, 15}, // 8x4 - {0b1110, 0b1111} + {14, 14}, // 8x8 - {0b1110, 0b1110} + {14, 12}, // 8x16 - {0b1110, 0b1100} + {12, 14}, // 16x8 - {0b1100, 0b1110} + {12, 12}, // 16x16 - {0b1100, 0b1100} + {12, 8}, // 16x32 - {0b1100, 0b1000} + {8, 12}, // 32x16 - {0b1000, 0b1100} + {8, 8}, // 32x32 - {0b1000, 0b1000} + {8, 0}, // 32x64 - {0b1000, 0b0000} + {0, 8}, // 64x32 - {0b0000, 0b1000} + {0, 0}, // 64x64 - {0b0000, 0b0000} +} diff --git a/internal/vp9/common/constants.go b/internal/vp9/common/constants.go new file mode 100644 index 0000000..d7b7aad --- /dev/null +++ b/internal/vp9/common/constants.go @@ -0,0 +1,74 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/constants.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +// Wire-format constants that aren't strictly enums but live in the VP9 +// frame header. Ported from libvpx v1.16.0 vp9/common/vp9_common.h and +// vp9/common/vp9_onyxc_int.h byte-for-byte. + +const ( + // VP9FrameMarker is the 2-bit prefix that identifies a VP9 frame. + // Every valid VP9 frame starts with the bits 0b10. + VP9FrameMarker = 0x2 + + // VP9 sync code — three bytes after the profile + frame parameters + // in a key frame or an intra-only frame. Constants from + // vp9_common.h. + VP9SyncCode0 = 0x49 + VP9SyncCode1 = 0x83 + VP9SyncCode2 = 0x42 + + // Reference frame ring slots. VP9 keeps 8 slots ({LAST, GOLDEN, + // ALTREF} are 3 of them at any time). + RefFramesLog2 = 3 + RefFrames = 1 << RefFramesLog2 + RefsPerFrame = 3 + + // 4 frame-context slots (frame-context index is 2 bits in the + // uncompressed header). + FrameContextsLog2 = 2 + FrameContexts = 1 << FrameContextsLog2 +) + +// FrameType is the high-level frame classification carried in the +// uncompressed header. Matches FRAME_TYPE in libvpx vp9_blockd.h. +type FrameType uint8 + +const ( + KeyFrame FrameType = 0 + InterFrame FrameType = 1 + FrameTypes FrameType = 2 +) + +// ColorSpace mirrors vpx_color_space_t in vpx/vpx_image.h — the 3-bit +// color-space field that appears in the bitdepth/colorspace/sampling +// block. +type ColorSpace uint8 + +const ( + CSUnknown ColorSpace = 0 + CSBT601 ColorSpace = 1 + CSBT709 ColorSpace = 2 + CSSMPTE170 ColorSpace = 3 + CSSMPTE240 ColorSpace = 4 + CSBT2020 ColorSpace = 5 + CSReserved ColorSpace = 6 + CSSRGB ColorSpace = 7 +) + +// ColorRange mirrors vpx_color_range_t — the single bit that selects +// studio vs. full range. +type ColorRange uint8 + +const ( + CRStudioRange ColorRange = 0 + CRFullRange ColorRange = 1 +) diff --git a/internal/vp9/common/enums.go b/internal/vp9/common/enums.go new file mode 100644 index 0000000..ed9a916 --- /dev/null +++ b/internal/vp9/common/enums.go @@ -0,0 +1,157 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/enums.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +// Mode-info grid: each 64x64 superblock is an 8x8 grid of 8x8 mode-info +// units. These constants come straight from MI_SIZE_LOG2 / MI_BLOCK_SIZE_ +// LOG2 in vp9_enums.h. +const ( + MiSizeLog2 = 3 + MiBlockSizeLog2 = 6 - MiSizeLog2 + + MiSize = 1 << MiSizeLog2 // pixels per mi-unit + MiBlockSize = 1 << MiBlockSizeLog2 // mi-units per max block + + MiMask = MiBlockSize - 1 +) + +// AlignToSB rounds a count of mode-info units up to the next 64x64 +// superblock boundary. +func AlignToSB(miCount int) int { + return (miCount + MiMask) &^ MiMask +} + +// BitstreamProfile is the 2-or-3-bit profile field in the uncompressed +// header. Public VP9 support is profile 0 only; the other values are kept so +// the parser can classify and reject valid non-profile0 packets cleanly. +type BitstreamProfile uint8 + +const ( + Profile0 BitstreamProfile = iota + Profile1 + Profile2 + Profile3 + MaxProfiles +) + +// BlockSize lists every partition shape that can appear in a VP9 +// superblock. Values are byte-stable: scan-order tables, partition +// probability tables, and SAD/variance kernels all index by these. +type BlockSize uint8 + +const ( + Block4x4 BlockSize = iota + Block4x8 + Block8x4 + Block8x8 + Block8x16 + Block16x8 + Block16x16 + Block16x32 + Block32x16 + Block32x32 + Block32x64 + Block64x32 + Block64x64 + BlockSizes + BlockInvalid = BlockSizes +) + +// PartitionType is the recursive-split decision emitted for every +// non-leaf node in the partition tree. +type PartitionType uint8 + +const ( + PartitionNone PartitionType = iota + PartitionHorz + PartitionVert + PartitionSplit + PartitionTypes + PartitionInvalid = PartitionTypes +) + +// Partition context layout: 4 partition-context bins per block size, 4 +// block sizes that need them — see vp9_enums.h. +const ( + PartitionPloffset = 4 + PartitionContexts = 4 * PartitionPloffset +) + +// TxSize is the transform block size. The four valid values (4, 8, 16, +// 32) directly map to the inverse-transform kernel indices. +type TxSize uint8 + +const ( + Tx4x4 TxSize = 0 + Tx8x8 TxSize = 1 + Tx16x16 TxSize = 2 + Tx32x32 TxSize = 3 + TxSizes TxSize = 4 +) + +// TxMode is the frame-level transform mode signalled in the compressed +// header. TxModeSelect lets every block pick its own size; the others +// cap the largest transform allowed. +type TxMode uint8 + +const ( + Only4x4 TxMode = 0 + Allow8x8 TxMode = 1 + Allow16x16 TxMode = 2 + Allow32x32 TxMode = 3 + TxModeSelect TxMode = 4 + TxModes TxMode = 5 +) + +// TxType is the {horizontal,vertical} transform pair used by 4x4 / 8x8 / +// 16x16 intra blocks driven by intra prediction direction. +type TxType uint8 + +const ( + DctDct TxType = 0 // DCT in both directions + AdstDct TxType = 1 // ADST vertical, DCT horizontal + DctAdst TxType = 2 // DCT vertical, ADST horizontal + AdstAdst TxType = 3 // ADST both directions + TxTypes TxType = 4 +) + +// PredictionMode covers the 10 intra modes (DC..TM) and the 4 inter +// modes (NEARESTMV / NEARMV / ZEROMV / NEWMV). The numeric ordering is +// part of every probability table indexed by mode, so it must not move. +type PredictionMode uint8 + +const ( + DcPred PredictionMode = 0 + VPred PredictionMode = 1 + HPred PredictionMode = 2 + D45Pred PredictionMode = 3 + D135Pred PredictionMode = 4 + D117Pred PredictionMode = 5 + D153Pred PredictionMode = 6 + D207Pred PredictionMode = 7 + D63Pred PredictionMode = 8 + TmPred PredictionMode = 9 + NearestMv PredictionMode = 10 + NearMv PredictionMode = 11 + ZeroMv PredictionMode = 12 + NewMv PredictionMode = 13 + + MbModeCount = 14 + IntraModes = int(TmPred) + 1 + InterModes = 1 + int(NewMv) - int(NearestMv) + + SkipContexts = 3 + InterModeContexts = 7 + MaxMvRefCandidates = 2 + IntraInterContexts = 4 + CompInterContexts = 5 + RefContexts = 5 +) diff --git a/internal/vp9/common/frame_layout.go b/internal/vp9/common/frame_layout.go new file mode 100644 index 0000000..f95c7dc --- /dev/null +++ b/internal/vp9/common/frame_layout.go @@ -0,0 +1,109 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/frame_layout.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +import ( + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +// FrameLayout describes the padded VP9 frame buffer layout for 4:2:0, 4:2:2, +// 4:4:0, or 4:4:4 / RGB planes. +type FrameLayout struct { + YStride int + UVStride int + YWidth int + YHeight int + UVWidth int + UVHeight int + YOrigin int + UVOrigin int + UOrigin int + VOrigin int + YFullLen int + UVFullLen int + SubsamplingX uint8 + SubsamplingY uint8 +} + +// NewDecoderFrameLayoutSubsampled returns the padded VP9 decoder frame buffer +// layout for explicit (ssX, ssY) chroma subsampling shifts. +func NewDecoderFrameLayoutSubsampled(width, height, byteAlignment int, + ssX, ssY uint8, +) FrameLayout { + const border = 32 // VP9_DEC_BORDER_IN_PIXELS in libvpx vpx_scale/yv12config.h. + if ssX > 1 { + ssX = 1 + } + if ssY > 1 { + ssY = 1 + } + alignedWidth := buffers.Align(width, 8) + alignedHeight := buffers.Align(height, 8) + yStride := buffers.Align(alignedWidth+2*border, 32) + uvWidth := alignedWidth >> ssX + uvHeight := alignedHeight >> ssY + uvBorderX := border >> ssX + uvBorderY := border >> ssY + uvStride := yStride >> ssX + yOrigin := border*yStride + border + uvOrigin := uvBorderY*uvStride + uvBorderX + uOrigin := uvOrigin + vOrigin := uvOrigin + extraAlignment := 0 + if byteAlignment > 0 { + yOrigin = buffers.Align(yOrigin, byteAlignment) + uvOrigin = buffers.Align(uvOrigin, byteAlignment) + extraAlignment = byteAlignment + uOrigin = uvOrigin + vOrigin = uvOrigin + } + return FrameLayout{ + YStride: yStride, + UVStride: uvStride, + YWidth: alignedWidth, + YHeight: alignedHeight, + UVWidth: uvWidth, + UVHeight: uvHeight, + YOrigin: yOrigin, + UVOrigin: uvOrigin, + UOrigin: uOrigin, + VOrigin: vOrigin, + YFullLen: yStride*(alignedHeight+2*border) + extraAlignment, + UVFullLen: uvStride*(uvHeight+2*uvBorderY) + extraAlignment, + SubsamplingX: ssX, + SubsamplingY: ssY, + } +} + +// NewDecoderFrameLayoutForPlanesSubsampled returns a VP9 frame buffer layout +// for explicit (ssX, ssY) subsampling adjusted to the actual backing slice +// addresses. +func NewDecoderFrameLayoutForPlanesSubsampled(width, height, byteAlignment int, + ssX, ssY uint8, yFull, uFull, vFull []byte, +) FrameLayout { + layout := NewDecoderFrameLayoutSubsampled(width, height, byteAlignment, ssX, ssY) + if byteAlignment <= 0 { + return layout + } + layout.YOrigin = buffers.AlignOffsetForSlice(yFull, layout.YOrigin, byteAlignment) + layout.UOrigin = buffers.AlignOffsetForSlice(uFull, layout.UOrigin, byteAlignment) + layout.VOrigin = buffers.AlignOffsetForSlice(vFull, layout.VOrigin, byteAlignment) + layout.UVOrigin = layout.UOrigin + return layout +} + +// DecoderFrameAlignment returns the effective VP9 decoder plane alignment. +func DecoderFrameAlignment(byteAlignment int) int { + if byteAlignment > 0 { + return byteAlignment + } + return 32 +} diff --git a/internal/vp9/common/quant.go b/internal/vp9/common/quant.go new file mode 100644 index 0000000..00bc7ac --- /dev/null +++ b/internal/vp9/common/quant.go @@ -0,0 +1,72 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/quant.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +import "github.com/go-avkit/vpx/internal/vp9/tables" + +// Ported from libvpx v1.16.0 vp9/common/vp9_quant_common.{c,h}. +// +// DcQuant / AcQuant look up the dequant multiplier for a given qindex, +// optional per-segment delta, and bit depth. Public VP9 support is profile 0; +// the wider bit-depth table dispatch is retained to keep the libvpx-derived +// helper complete and to classify unsupported profile-family streams. + +// BitDepth selects which of the (8,10,12)-bit dequant tables vp9_dc_quant +// and vp9_ac_quant should pull from. Matches vpx_bit_depth_t in libvpx. +type BitDepth uint8 + +const ( + MinQ = tables.MinQ + MaxQ = tables.MaxQ + + Bits8 BitDepth = 8 + Bits10 BitDepth = 10 + Bits12 BitDepth = 12 +) + +// DcQuant returns the DC dequant scaler at qindex+delta, clamped to the +// valid [0, MaxQ] range. Matches vp9_dc_quant. +func DcQuant(qindex, delta int, bd BitDepth) int16 { + idx := ClampQIndex(qindex + delta) + switch bd { + case Bits10: + return tables.DcQLookup10[idx] + case Bits12: + return tables.DcQLookup12[idx] + default: + return tables.DcQLookup8[idx] + } +} + +// AcQuant returns the AC dequant scaler at qindex+delta, clamped to the +// valid [0, MaxQ] range. Matches vp9_ac_quant. +func AcQuant(qindex, delta int, bd BitDepth) int16 { + idx := ClampQIndex(qindex + delta) + switch bd { + case Bits10: + return tables.AcQLookup10[idx] + case Bits12: + return tables.AcQLookup12[idx] + default: + return tables.AcQLookup8[idx] + } +} + +// ClampQIndex clamps q to libvpx's valid VP9 quantizer-index range. +func ClampQIndex(q int) int { + if q < MinQ { + return MinQ + } + if q > MaxQ { + return MaxQ + } + return q +} diff --git a/internal/vp9/common/scan.go b/internal/vp9/common/scan.go new file mode 100644 index 0000000..2dd6d02 --- /dev/null +++ b/internal/vp9/common/scan.go @@ -0,0 +1,141 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/scan.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +import ( + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// ScanOrder is the trio of tables that drive coefficient entropy coding +// for a particular (TxSize, TxType) pair. All three slices alias into +// internal/vp9/tables storage; ScanOrder values themselves carry no +// allocation cost at use time. +type ScanOrder struct { + Scan []int16 + IScan []int16 + Neighbors []int16 + ScanArr *[1024]int16 + NeighborsArr *[2048]int16 + ScanNeighborsArr *[2048]int16 + ScanMetaArr *[1024]uint32 +} + +func init() { + initScanOrder := func(txSize TxSize, so *ScanOrder) { + var sa [1024]int16 + var na [2048]int16 + var sna [2048]int16 + var meta [1024]uint32 + copy(sa[:], so.Scan) + copy(na[:], so.Neighbors) + for k, nb := range so.Neighbors { + if k < len(sna) && int(nb) >= 0 && int(nb) < len(so.IScan) { + sna[k] = so.IScan[nb] - 1 + } + } + bt := tables.CoefbandTrans8x8Plus[:] + if txSize == Tx4x4 { + bt = tables.CoefbandTrans4x4[:] + } + for c := range 1024 { + nb0 := uint32(sna[2*c]) & 1023 + nb1 := uint32(sna[2*c+1]) & 1023 + var band uint32 + if c < len(bt) { + band = uint32(bt[c]) + } + meta[c] = nb0 | (nb1 << 10) | ((band << 3) << 20) + } + so.ScanArr = &sa + so.NeighborsArr = &na + so.ScanNeighborsArr = &sna + so.ScanMetaArr = &meta + } + for i := range DefaultScanOrders { + initScanOrder(TxSize(i), &DefaultScanOrders[i]) + } + for i := range ScanOrders { + for j := range ScanOrders[i] { + initScanOrder(TxSize(i), &ScanOrders[i][j]) + } + } +} + +// DefaultScanOrders is libvpx's vp9_default_scan_orders, indexed by +// TxSize. It is the dispatch table used when the block does not have a +// custom intra-prediction-driven scan. +var DefaultScanOrders = [TxSizes]ScanOrder{ + {Scan: tables.DefaultScan4x4[:], IScan: tables.DefaultIScan4x4[:], Neighbors: tables.DefaultScan4x4Neighbors[:]}, + {Scan: tables.DefaultScan8x8[:], IScan: tables.DefaultIScan8x8[:], Neighbors: tables.DefaultScan8x8Neighbors[:]}, + {Scan: tables.DefaultScan16x16[:], IScan: tables.DefaultIScan16x16[:], Neighbors: tables.DefaultScan16x16Neighbors[:]}, + {Scan: tables.DefaultScan32x32[:], IScan: tables.DefaultIScan32x32[:], Neighbors: tables.DefaultScan32x32Neighbors[:]}, +} + +// ScanOrders is libvpx's vp9_scan_orders, indexed by [TxSize][TxType]. +// 32x32 transforms only run DCT_DCT, so all four TxType entries point at +// the same DCT_DCT scan — matching libvpx's table layout. +var ScanOrders = [TxSizes][TxTypes]ScanOrder{ + { // Tx4x4 + {Scan: tables.DefaultScan4x4[:], IScan: tables.DefaultIScan4x4[:], Neighbors: tables.DefaultScan4x4Neighbors[:]}, + {Scan: tables.RowScan4x4[:], IScan: tables.RowIScan4x4[:], Neighbors: tables.RowScan4x4Neighbors[:]}, + {Scan: tables.ColScan4x4[:], IScan: tables.ColIScan4x4[:], Neighbors: tables.ColScan4x4Neighbors[:]}, + {Scan: tables.DefaultScan4x4[:], IScan: tables.DefaultIScan4x4[:], Neighbors: tables.DefaultScan4x4Neighbors[:]}, + }, + { // Tx8x8 + {Scan: tables.DefaultScan8x8[:], IScan: tables.DefaultIScan8x8[:], Neighbors: tables.DefaultScan8x8Neighbors[:]}, + {Scan: tables.RowScan8x8[:], IScan: tables.RowIScan8x8[:], Neighbors: tables.RowScan8x8Neighbors[:]}, + {Scan: tables.ColScan8x8[:], IScan: tables.ColIScan8x8[:], Neighbors: tables.ColScan8x8Neighbors[:]}, + {Scan: tables.DefaultScan8x8[:], IScan: tables.DefaultIScan8x8[:], Neighbors: tables.DefaultScan8x8Neighbors[:]}, + }, + { // Tx16x16 + {Scan: tables.DefaultScan16x16[:], IScan: tables.DefaultIScan16x16[:], Neighbors: tables.DefaultScan16x16Neighbors[:]}, + {Scan: tables.RowScan16x16[:], IScan: tables.RowIScan16x16[:], Neighbors: tables.RowScan16x16Neighbors[:]}, + {Scan: tables.ColScan16x16[:], IScan: tables.ColIScan16x16[:], Neighbors: tables.ColScan16x16Neighbors[:]}, + {Scan: tables.DefaultScan16x16[:], IScan: tables.DefaultIScan16x16[:], Neighbors: tables.DefaultScan16x16Neighbors[:]}, + }, + { // Tx32x32 — DCT_DCT only; the row/col rows of the table mirror the default. + {Scan: tables.DefaultScan32x32[:], IScan: tables.DefaultIScan32x32[:], Neighbors: tables.DefaultScan32x32Neighbors[:]}, + {Scan: tables.DefaultScan32x32[:], IScan: tables.DefaultIScan32x32[:], Neighbors: tables.DefaultScan32x32Neighbors[:]}, + {Scan: tables.DefaultScan32x32[:], IScan: tables.DefaultIScan32x32[:], Neighbors: tables.DefaultScan32x32Neighbors[:]}, + {Scan: tables.DefaultScan32x32[:], IScan: tables.DefaultIScan32x32[:], Neighbors: tables.DefaultScan32x32Neighbors[:]}, + }, +} + +// IntraModeToTxType mirrors libvpx's intra_mode_to_tx_type_lookup — +// each Y intra mode picks the (vertical, horizontal) ADST/DCT pair +// used for that block's transform + scan. Inter blocks and chroma +// planes always use DCT_DCT; the lossless path is forced to DCT_DCT +// too. Indexed by PredictionMode (DcPred..TmPred = 0..9). +var IntraModeToTxType = [IntraModes]TxType{ + DctDct, // DC_PRED + AdstDct, // V_PRED + DctAdst, // H_PRED + DctDct, // D45_PRED + AdstAdst, // D135_PRED + AdstDct, // D117_PRED + DctAdst, // D153_PRED + DctAdst, // D207_PRED + AdstDct, // D63_PRED + AdstAdst, // TM_PRED +} + +// GetScanPtr is GetScan without the ScanOrder value copy: it returns a +// pointer into the global scan-order dispatch tables, which are never +// mutated after init. Hot per-transform-block callers use this to avoid +// copying three slice headers per block. +func GetScanPtr(txSize TxSize, planeType int, isInter int, lossless bool, + yMode PredictionMode, +) *ScanOrder { + if isInter != 0 || planeType != 0 || lossless { + return &DefaultScanOrders[txSize] + } + return &ScanOrders[txSize][IntraModeToTxType[yMode]] +} diff --git a/internal/vp9/common/trees.go b/internal/vp9/common/trees.go new file mode 100644 index 0000000..aa39fd2 --- /dev/null +++ b/internal/vp9/common/trees.go @@ -0,0 +1,89 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/trees.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +// Canonical token trees that drive every VP9 mode / partition / inter- +// mode / interp-filter / segmentation decode through the boolean +// range coder's vpx_read_tree primitive. Ported byte-for-byte from +// libvpx v1.16.0: +// - vp9/common/vp9_entropymode.c (intra, inter, partition, switchable +// interp) +// - vp9/common/vp9_seg_common.c (segment) +// +// TreeSize(N) = 2*N - 2 — the flat layout libvpx's TREE_SIZE macro +// produces for a binary tree with N leaves. Each pair of consecutive +// entries holds the (left, right) link from an internal node; +// positive values are next-node indices into the same array, zero or +// negative values are leaf labels stored as the negation of the +// decoded value. + +// IntraModeTree mirrors libvpx's vp9_intra_mode_tree — 10 intra-pred +// modes ordered for the canonical traversal. +var IntraModeTree = [18]int8{ + -int8(DcPred), 2, // 0: DC_NODE + -int8(TmPred), 4, // 1: TM_NODE + -int8(VPred), 6, // 2: V_NODE + 8, 12, // 3: COM_NODE + -int8(HPred), 10, // 4: H_NODE + -int8(D135Pred), -int8(D117Pred), // 5: D135_NODE + -int8(D45Pred), 14, // 6: D45_NODE + -int8(D63Pred), 16, // 7: D63_NODE + -int8(D153Pred), -int8(D207Pred), // 8: D153_NODE +} + +// Inter mode indices used by the tree below. INTER_OFFSET(mode) maps +// {NEARESTMV, NEARMV, ZEROMV, NEWMV} to {0, 1, 2, 3} by subtracting +// NEARESTMV. +const ( + interOffsetNearestMv = 0 + interOffsetNearMv = 1 + interOffsetZeroMv = 2 + interOffsetNewMv = 3 +) + +// InterModeTree mirrors libvpx's vp9_inter_mode_tree. Note the +// INTER_OFFSET indirection: leaf values are offsets into the inter +// mode subspace, not raw PredictionMode codes. +var InterModeTree = [6]int8{ + -interOffsetZeroMv, 2, + -interOffsetNearestMv, 4, + -interOffsetNearMv, -interOffsetNewMv, +} + +// PartitionTree mirrors libvpx's vp9_partition_tree. +var PartitionTree = [6]int8{ + -int8(PartitionNone), 2, + -int8(PartitionHorz), 4, + -int8(PartitionVert), -int8(PartitionSplit), +} + +// SwitchableInterpTree mirrors libvpx's vp9_switchable_interp_tree. +// Leaves are the InterpFilter constants — see internal/vp9/decoder +// for the matching enum. +const ( + // Mirrored from internal/vp9/decoder/header_size.go to keep this + // tree self-contained at the common layer. Any drift would skew + // every motion-compensation filter dispatch. + interpFilterEighttap = 0 + interpFilterEighttapSmooth = 1 + interpFilterEighttapSharp = 2 +) + +var SwitchableInterpTree = [4]int8{ + -interpFilterEighttap, 2, + -interpFilterEighttapSmooth, -interpFilterEighttapSharp, +} + +// SegmentTree mirrors libvpx's vp9_segment_tree — a balanced 8-leaf +// tree for the segmentation index. +var SegmentTree = [14]int8{ + 2, 4, 6, 8, 10, 12, 0, -1, -2, -3, -4, -5, -6, -7, +} diff --git a/internal/vp9/common/yv12_border.go b/internal/vp9/common/yv12_border.go new file mode 100644 index 0000000..74cd074 --- /dev/null +++ b/internal/vp9/common/yv12_border.go @@ -0,0 +1,33 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/common/yv12_border.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package common + +// VP9 YV12 border constants. Verbatim ports of vpx_scale/yv12config.h: +// +// #define VP8BORDERINPIXELS 32 (line 23) +// #define VP9INNERBORDERINPIXELS 96 (line 24) +// #define VP9_INTERP_EXTEND 4 (line 25) +// #define VP9_ENC_BORDER_IN_PIXELS 160 (line 26) +// #define VP9_DEC_BORDER_IN_PIXELS 32 (line 27) +// +// The encoder always allocates VP9_ENC_BORDER_IN_PIXELS of padding per +// plane (vp9/encoder/vp9_encoder.c:1297 et al.). The decoder uses +// VP9_DEC_BORDER_IN_PIXELS. The int-pro motion search's worst-case +// reach (bw>>1 = 32 for BLOCK_64X64) fits inside the smaller decoder +// border, but on the encoder side libvpx provisions the full 160 +// pixels so all hot paths share one allocation. +const ( + VP8BorderInPixels = 32 + VP9InnerBorderInPixels = 96 + VP9InterpExtend = 4 + VP9EncBorderInPixels = 160 + VP9DecBorderInPixels = 32 +) diff --git a/internal/vp9/decoder/adapt.go b/internal/vp9/decoder/adapt.go new file mode 100644 index 0000000..1622442 --- /dev/null +++ b/internal/vp9/decoder/adapt.go @@ -0,0 +1,522 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/adapt.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "math/bits" + + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +const ( + // libvpx: vpx_dsp/prob.h:37 — MODE_MV_COUNT_SAT. + modeMvCountSat uint32 = 20 + // libvpx: vpx_dsp/prob.h:78-82 — last entry of count_to_update_factor[]. + modeMvMaxUpdateFactor uint32 = 128 + // libvpx: vp9/common/vp9_entropy.c:1048 — COEF_COUNT_SAT. + coefCountSatInterAfterInter uint32 = 24 + // libvpx: vp9/common/vp9_entropy.c:1049 — COEF_MAX_UPDATE_FACTOR. + coefMaxUpdateFactorInterAfterInter uint32 = 112 + // libvpx: vp9/common/vp9_entropy.c:1050 — COEF_COUNT_SAT_KEY. + coefCountSatIntraOnly uint32 = 24 + // libvpx: vp9/common/vp9_entropy.c:1051 — COEF_MAX_UPDATE_FACTOR_KEY. + coefMaxUpdateFactorIntraOnly uint32 = 112 + // libvpx: vp9/common/vp9_entropy.c:1052 — COEF_COUNT_SAT_AFTER_KEY. + coefCountSatInterAfterKey uint32 = 24 + // libvpx: vp9/common/vp9_entropy.c:1053 — COEF_MAX_UPDATE_FACTOR_AFTER_KEY. + coefMaxUpdateFactorInterAfterKey uint32 = 128 +) + +var modeMvUpdateFactors = [...]uint32{ + 0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, + 70, 76, 83, 89, 96, 102, 108, 115, 121, 128, +} + +// TxCounts carries VP9 transform-size adaptation counts. +type TxCounts struct { + P32x32 [TxSizeContexts][common.TxSizes]uint32 + P16x16 [TxSizeContexts][common.TxSizes - 1]uint32 + P8x8 [TxSizeContexts][common.TxSizes - 2]uint32 +} + +// NmvComponentCounts carries VP9 motion-vector component adaptation counts. +type NmvComponentCounts struct { + Sign [2]uint32 + Classes [MvClasses]uint32 + Class0 [Class0Size]uint32 + Bits [MvOffsetBits][2]uint32 + Class0Fp [Class0Size][MvFpSize]uint32 + Fp [MvFpSize]uint32 + Class0Hp [2]uint32 + Hp [2]uint32 +} + +// NmvContextCounts carries VP9 motion-vector adaptation counts. +type NmvContextCounts struct { + Joints [MvJoints]uint32 + Comps [2]NmvComponentCounts +} + +// FrameCounts carries the VP9 frame adaptation counts accumulated while +// parsing a non-frame-parallel frame. +type FrameCounts struct { + YMode [BlockSizeGroups][common.IntraModes]uint32 + UvMode [common.IntraModes][common.IntraModes]uint32 + Partition [common.PartitionContexts][common.PartitionTypes]uint32 + Coef CoefCounts + SwitchableInterp [SwitchableFilterContexts][SwitchableFilters]uint32 + InterMode [common.InterModeContexts][common.InterModes]uint32 + IntraInter [common.IntraInterContexts][2]uint32 + CompInter [common.CompInterContexts][2]uint32 + SingleRef [common.RefContexts][2][2]uint32 + CompRef [common.RefContexts][2]uint32 + Tx TxCounts + Skip [common.SkipContexts][2]uint32 + Mv NmvContextCounts +} + +// AdaptFrameContextWithCounts applies libvpx-style VP9 probability adaptation +// from the accumulated frame counts. +func AdaptFrameContextWithCounts(fc *FrameContext, + pre *FrameContext, counts *FrameCounts, + hdr *UncompressedHeader, txMode common.TxMode, afterKey bool, +) { + if fc == nil || pre == nil || counts == nil || hdr == nil { + return + } + adaptCoefProbsWithCounts(fc, pre, counts, hdr, afterKey) + if hdr.FrameType == common.KeyFrame || hdr.IntraOnly { + return + } + adaptModeProbsWithCounts(fc, pre, counts, hdr, txMode) + adaptMvProbsWithCounts(fc, pre, counts, hdr.AllowHighPrecisionMv) +} + +func adaptCoefProbsWithCounts(fc *FrameContext, + pre *FrameContext, counts *FrameCounts, + hdr *UncompressedHeader, afterKey bool, +) { + countSat := coefCountSatInterAfterInter + updateFactor := coefMaxUpdateFactorInterAfterInter + if hdr.FrameType == common.KeyFrame || hdr.IntraOnly { + countSat = coefCountSatIntraOnly + updateFactor = coefMaxUpdateFactorIntraOnly + } else if afterKey { + countSat = coefCountSatInterAfterKey + updateFactor = coefMaxUpdateFactorInterAfterKey + } + + for tx := common.Tx4x4; tx <= common.Tx32x32; tx++ { + for plane := range CoefPlaneTypes { + for ref := range CoefRefTypes { + for band := range CoefBands { + for ctx := range BandCoefContexts(band) { + n0 := counts.Coef.Coef[tx][plane][ref][band][ctx][0] + n1 := counts.Coef.Coef[tx][plane][ref][band][ctx][1] + n2 := counts.Coef.Coef[tx][plane][ref][band][ctx][2] + neob := counts.Coef.Coef[tx][plane][ref][band][ctx][3] + eob := counts.Coef.EobBranch[tx][plane][ref][band][ctx] + branch := [UnconstrainedNodes][2]uint32{ + {neob, eob - neob}, + {n0, n1 + n2}, + {n1, n2}, + } + for node := range UnconstrainedNodes { + fc.CoefProbs[tx][plane][ref][band][ctx][node] = + mergeProbs(pre.CoefProbs[tx][plane][ref][band][ctx][node], + branch[node], countSat, updateFactor) + } + } + } + } + } + } +} + +func adaptModeProbsWithCounts(fc *FrameContext, + pre *FrameContext, counts *FrameCounts, + hdr *UncompressedHeader, txMode common.TxMode, +) { + for i := range fc.IntraInterProb { + fc.IntraInterProb[i] = modeMvMergeProbs(pre.IntraInterProb[i], + counts.IntraInter[i]) + } + for i := range fc.ReferenceModeProbs.CompInterProb { + fc.ReferenceModeProbs.CompInterProb[i] = + modeMvMergeProbs(pre.ReferenceModeProbs.CompInterProb[i], + counts.CompInter[i]) + } + for i := range fc.ReferenceModeProbs.CompRefProb { + fc.ReferenceModeProbs.CompRefProb[i] = + modeMvMergeProbs(pre.ReferenceModeProbs.CompRefProb[i], + counts.CompRef[i]) + } + for i := range fc.ReferenceModeProbs.SingleRefProb { + for j := range fc.ReferenceModeProbs.SingleRefProb[i] { + fc.ReferenceModeProbs.SingleRefProb[i][j] = + modeMvMergeProbs(pre.ReferenceModeProbs.SingleRefProb[i][j], + counts.SingleRef[i][j]) + } + } + for i := range fc.InterModeProbs { + treeMergeProbs(common.InterModeTree[:], pre.InterModeProbs[i][:], + counts.InterMode[i][:], fc.InterModeProbs[i][:]) + } + for i := range fc.YModeProb { + treeMergeProbs(common.IntraModeTree[:], pre.YModeProb[i][:], + counts.YMode[i][:], fc.YModeProb[i][:]) + } + for i := range fc.UvModeProb { + treeMergeProbs(common.IntraModeTree[:], pre.UvModeProb[i][:], + counts.UvMode[i][:], fc.UvModeProb[i][:]) + } + for i := range fc.PartitionProb { + treeMergeProbs(common.PartitionTree[:], pre.PartitionProb[i][:], + counts.Partition[i][:], fc.PartitionProb[i][:]) + } + if hdr.InterpFilter == InterpSwitchable { + for i := range fc.SwitchableInterpProb { + treeMergeProbs(common.SwitchableInterpTree[:], + pre.SwitchableInterpProb[i][:], counts.SwitchableInterp[i][:], + fc.SwitchableInterpProb[i][:]) + } + } + if txMode == common.TxModeSelect { + for i := range TxSizeContexts { + c8 := counts.Tx.P8x8[i] + fc.TxProbs.P8x8[i][0] = modeMvMergeProbs(pre.TxProbs.P8x8[i][0], + [2]uint32{c8[0], c8[1]}) + + c16 := counts.Tx.P16x16[i] + fc.TxProbs.P16x16[i][0] = modeMvMergeProbs(pre.TxProbs.P16x16[i][0], + [2]uint32{c16[0], c16[1] + c16[2]}) + fc.TxProbs.P16x16[i][1] = modeMvMergeProbs(pre.TxProbs.P16x16[i][1], + [2]uint32{c16[1], c16[2]}) + + c32 := counts.Tx.P32x32[i] + fc.TxProbs.P32x32[i][0] = modeMvMergeProbs(pre.TxProbs.P32x32[i][0], + [2]uint32{c32[0], c32[1] + c32[2] + c32[3]}) + fc.TxProbs.P32x32[i][1] = modeMvMergeProbs(pre.TxProbs.P32x32[i][1], + [2]uint32{c32[1], c32[2] + c32[3]}) + fc.TxProbs.P32x32[i][2] = modeMvMergeProbs(pre.TxProbs.P32x32[i][2], + [2]uint32{c32[2], c32[3]}) + } + } + for i := range fc.SkipProbs { + fc.SkipProbs[i] = modeMvMergeProbs(pre.SkipProbs[i], counts.Skip[i]) + } +} + +func adaptMvProbsWithCounts(fc *FrameContext, + pre *FrameContext, counts *FrameCounts, allowHP bool, +) { + treeMergeProbs(tables.MvJointTree[:], pre.Nmvc.Joints[:], + counts.Mv.Joints[:], fc.Nmvc.Joints[:]) + for i := range 2 { + comp := &fc.Nmvc.Comps[i] + preComp := &pre.Nmvc.Comps[i] + compCounts := &counts.Mv.Comps[i] + + comp.Sign = modeMvMergeProbs(preComp.Sign, compCounts.Sign) + treeMergeProbs(tables.MvClassTree[:], preComp.Classes[:], + compCounts.Classes[:], comp.Classes[:]) + treeMergeProbs(tables.MvClass0Tree[:], preComp.Class0[:], + compCounts.Class0[:], comp.Class0[:]) + for j := range MvOffsetBits { + comp.Bits[j] = modeMvMergeProbs(preComp.Bits[j], compCounts.Bits[j]) + } + for j := range Class0Size { + treeMergeProbs(tables.MvFpTree[:], preComp.Class0Fp[j][:], + compCounts.Class0Fp[j][:], comp.Class0Fp[j][:]) + } + treeMergeProbs(tables.MvFpTree[:], preComp.Fp[:], + compCounts.Fp[:], comp.Fp[:]) + if allowHP { + comp.Class0Hp = modeMvMergeProbs(preComp.Class0Hp, compCounts.Class0Hp) + comp.Hp = modeMvMergeProbs(preComp.Hp, compCounts.Hp) + } + } +} + +func treeMergeProbs(tree []int8, preProbs []uint8, counts []uint32, probs []uint8) { + var walk func(i int) uint32 + walk = func(i int) uint32 { + var left, right uint32 + if tree[i] <= 0 { + left = counts[-tree[i]] + } else { + left = walk(int(tree[i])) + } + if tree[i+1] <= 0 { + right = counts[-tree[i+1]] + } else { + right = walk(int(tree[i+1])) + } + probs[i>>1] = modeMvMergeProbs(preProbs[i>>1], [2]uint32{left, right}) + return left + right + } + walk(0) +} + +func modeMvMergeProbs(preProb uint8, ct [2]uint32) uint8 { + den := ct[0] + ct[1] + if den == 0 { + return preProb + } + count := min(den, modeMvCountSat) + factor := modeMvUpdateFactors[count] + prob := getProb(ct[0], den) + return uint8((uint32(preProb)*(256-factor) + uint32(prob)*factor + 128) >> 8) +} + +func mergeProbs(preProb uint8, ct [2]uint32, countSat, maxUpdateFactor uint32) uint8 { + den := ct[0] + ct[1] + prob := uint8(128) + if den != 0 { + prob = getProb(ct[0], den) + } + count := min(den, countSat) + factor := maxUpdateFactor * count / countSat + return uint8((uint32(preProb)*(256-factor) + uint32(prob)*factor + 128) >> 8) +} + +func getProb(num, den uint32) uint8 { + p := (uint64(num)*256 + uint64(den>>1)) / uint64(den) + if p == 0 { + return 1 + } + if p > 255 { + return 255 + } + return uint8(p) +} + +// IncMv records one decoded NEWMV delta into the VP9 motion-vector count +// tables. +func IncMv(mv MV, counts *NmvContextCounts) { + joint := GetMvJoint(mv) + counts.Joints[joint]++ + if joint == tables.MvJointHzVnz || joint == tables.MvJointHnzVnz { + incMvComponent(mv.Row, &counts.Comps[0]) + } + if joint == tables.MvJointHnzVz || joint == tables.MvJointHnzVnz { + incMvComponent(mv.Col, &counts.Comps[1]) + } +} + +func incMvComponent(v int16, counts *NmvComponentCounts) { + sign := 0 + zv := int(v) + if zv < 0 { + sign = 1 + zv = -zv + } + counts.Sign[sign]++ + z := zv - 1 + cls, offset := GetMvClass(z) + counts.Classes[cls]++ + d := offset >> 3 + f := (offset >> 1) & 3 + hp := offset & 1 + if cls == tables.MvClass0 { + counts.Class0[d]++ + counts.Class0Fp[d][f]++ + counts.Class0Hp[hp]++ + return + } + nBits := cls + Class0Bits - 1 + for i := range nBits { + counts.Bits[i][(d>>i)&1]++ + } + counts.Fp[f]++ + counts.Hp[hp]++ +} + +// GetMvJoint returns the libvpx VP9 motion-vector joint class. +func GetMvJoint(mv MV) int { + switch { + case mv.Row == 0 && mv.Col == 0: + return tables.MvJointZero + case mv.Row == 0: + return tables.MvJointHnzVz + case mv.Col == 0: + return tables.MvJointHzVnz + default: + return tables.MvJointHnzVnz + } +} + +// GetMvClass returns the libvpx VP9 motion-vector class and class offset for +// a positive magnitude minus one. +func GetMvClass(z int) (cls int, offset int) { + if z >= Class0Size*4096 { + cls = tables.MvClass10 + } else if z < Class0Size*8 { + cls = tables.MvClass0 + } else { + cls = bits.Len(uint(z>>3)) - 1 + } + return cls, z - mvClassBase(cls) +} + +func mvClassBase(cls int) int { + if cls == 0 { + return 0 + } + return Class0Size << uint(cls+2) +} + +// MergeFrameCounts adds src into dst. +func MergeFrameCounts(dst, src *FrameCounts) { + for i := range dst.YMode { + for j := range dst.YMode[i] { + dst.YMode[i][j] += src.YMode[i][j] + } + } + for i := range dst.UvMode { + for j := range dst.UvMode[i] { + dst.UvMode[i][j] += src.UvMode[i][j] + } + } + for i := range dst.Partition { + for j := range dst.Partition[i] { + dst.Partition[i][j] += src.Partition[i][j] + } + } + mergeCoefCounts(&dst.Coef, &src.Coef) + for i := range dst.SwitchableInterp { + for j := range dst.SwitchableInterp[i] { + dst.SwitchableInterp[i][j] += src.SwitchableInterp[i][j] + } + } + for i := range dst.InterMode { + for j := range dst.InterMode[i] { + dst.InterMode[i][j] += src.InterMode[i][j] + } + } + for i := range dst.IntraInter { + for j := range dst.IntraInter[i] { + dst.IntraInter[i][j] += src.IntraInter[i][j] + } + } + for i := range dst.CompInter { + for j := range dst.CompInter[i] { + dst.CompInter[i][j] += src.CompInter[i][j] + } + } + for i := range dst.SingleRef { + for j := range dst.SingleRef[i] { + for k := range dst.SingleRef[i][j] { + dst.SingleRef[i][j][k] += src.SingleRef[i][j][k] + } + } + } + for i := range dst.CompRef { + for j := range dst.CompRef[i] { + dst.CompRef[i][j] += src.CompRef[i][j] + } + } + mergeTxCounts(&dst.Tx, &src.Tx) + for i := range dst.Skip { + for j := range dst.Skip[i] { + dst.Skip[i][j] += src.Skip[i][j] + } + } + mergeMvCounts(&dst.Mv, &src.Mv) +} + +func mergeCoefCounts(dst, src *CoefCounts) { + for tx := range dst.Coef { + for plane := range dst.Coef[tx] { + for ref := range dst.Coef[tx][plane] { + for band := range dst.Coef[tx][plane][ref] { + for ctx := range dst.Coef[tx][plane][ref][band] { + for node := range dst.Coef[tx][plane][ref][band][ctx] { + dst.Coef[tx][plane][ref][band][ctx][node] += + src.Coef[tx][plane][ref][band][ctx][node] + } + } + } + } + } + } + for tx := range dst.EobBranch { + for plane := range dst.EobBranch[tx] { + for ref := range dst.EobBranch[tx][plane] { + for band := range dst.EobBranch[tx][plane][ref] { + for ctx := range dst.EobBranch[tx][plane][ref][band] { + dst.EobBranch[tx][plane][ref][band][ctx] += + src.EobBranch[tx][plane][ref][band][ctx] + } + } + } + } + } +} + +func mergeTxCounts(dst, src *TxCounts) { + for i := range dst.P32x32 { + for j := range dst.P32x32[i] { + dst.P32x32[i][j] += src.P32x32[i][j] + } + } + for i := range dst.P16x16 { + for j := range dst.P16x16[i] { + dst.P16x16[i][j] += src.P16x16[i][j] + } + } + for i := range dst.P8x8 { + for j := range dst.P8x8[i] { + dst.P8x8[i][j] += src.P8x8[i][j] + } + } +} + +func mergeMvCounts(dst, src *NmvContextCounts) { + for i := range dst.Joints { + dst.Joints[i] += src.Joints[i] + } + for i := range dst.Comps { + mergeMvComponentCounts(&dst.Comps[i], &src.Comps[i]) + } +} + +func mergeMvComponentCounts(dst, src *NmvComponentCounts) { + for i := range dst.Sign { + dst.Sign[i] += src.Sign[i] + } + for i := range dst.Classes { + dst.Classes[i] += src.Classes[i] + } + for i := range dst.Class0 { + dst.Class0[i] += src.Class0[i] + } + for i := range dst.Bits { + for j := range dst.Bits[i] { + dst.Bits[i][j] += src.Bits[i][j] + } + } + for i := range dst.Class0Fp { + for j := range dst.Class0Fp[i] { + dst.Class0Fp[i][j] += src.Class0Fp[i][j] + } + } + for i := range dst.Fp { + dst.Fp[i] += src.Fp[i] + } + for i := range dst.Class0Hp { + dst.Class0Hp[i] += src.Class0Hp[i] + } + for i := range dst.Hp { + dst.Hp[i] += src.Hp[i] + } +} diff --git a/internal/vp9/decoder/assign_mv.go b/internal/vp9/decoder/assign_mv.go new file mode 100644 index 0000000..3862b1c --- /dev/null +++ b/internal/vp9/decoder/assign_mv.go @@ -0,0 +1,73 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/assign_mv.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// IsMvValid mirrors libvpx's is_mv_valid. An MV component crosses +// into "corrupt" territory when it touches the saturation bound. +func IsMvValid(mv MV) bool { + return int(mv.Row) > MvLow && int(mv.Row) < MvUpp && + int(mv.Col) > MvLow && int(mv.Col) < MvUpp +} + +// CopyMvPair mirrors libvpx's copy_mv_pair memcpy. +func CopyMvPair(dst, src *[2]MV) { *dst = *src } + +// ZeroMvPair mirrors libvpx's zero_mv_pair memset. +func ZeroMvPair(dst *[2]MV) { *dst = [2]MV{} } + +// AssignMv mirrors libvpx's assign_mv. Writes the final MV pair +// into `mv`, picks based on `mode`, and returns 1 if every decoded +// component lands inside [MvLow+1, MvUpp-1] — matches the libvpx +// validity gate the frame-corrupt path consults. +// +// Inputs: +// - mode : decoded inter PREDICTION_MODE (NEARESTMV..NEWMV). +// - mv : output pair, 2 slots — both written for compound. +// - refMv : per-ref `best_ref_mvs[i]` from the MV-ref search. +// - nearNearest: the (NEARESTMV/NEARMV) candidate output of the +// ref-search; libvpx fills it in dec_find_mv_refs. +// - isCompound: 1 when ref_frame[1] > INTRA_FRAME (i.e. two halves). +// - allowHp : frame-level allow-high-precision-MV flag. +// - r : boolean range coder; only consumed when mode==NEWMV. +// - fc : entropy context (Nmvc carries the MV PMF rows). +func AssignMv( + mode common.PredictionMode, + mv, refMv, nearNearest *[2]MV, + isCompound int, + allowHp bool, + r *bitstream.Reader, + fc *FrameContext, +) int { + switch mode { + case common.NewMv: + ret := 1 + halves := 1 + isCompound + for i := range halves { + ReadMv(r, &mv[i], &refMv[i], &fc.Nmvc, allowHp) + if !IsMvValid(mv[i]) { + ret = 0 + } + } + return ret + case common.NearMv, common.NearestMv: + CopyMvPair(mv, nearNearest) + return 1 + case common.ZeroMv: + ZeroMvPair(mv) + return 1 + } + return 0 +} diff --git a/internal/vp9/decoder/bitbuffer.go b/internal/vp9/decoder/bitbuffer.go new file mode 100644 index 0000000..017ec72 --- /dev/null +++ b/internal/vp9/decoder/bitbuffer.go @@ -0,0 +1,80 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/bitbuffer.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +// BitReader is the byte-aligned bit reader used by the VP9 uncompressed +// header — distinct from the boolean range coder used by the compressed +// header and tile payload. Ported from libvpx v1.16.0 +// vpx_dsp/bitreader_buffer.{h,c}: reads MSB-first from a caller-owned +// buffer with a running bit offset. +// +// All methods on BitReader are allocation-free; the caller owns the +// source bytes. +type BitReader struct { + buf []byte + bitOffset uint64 + err bool +} + +// Init seeds the reader with src. Resets any previously-accumulated +// error state so the BitReader can be reused across frames. +func (r *BitReader) Init(src []byte) { + r.buf = src + r.bitOffset = 0 + r.err = false +} + +// BytesRead returns the number of whole bytes consumed so far, +// matching vpx_rb_bytes_read — rounded up so a partially-consumed byte +// still counts. +func (r *BitReader) BytesRead() int { + return int((r.bitOffset + 7) >> 3) +} + +// HasError reports whether any read since Init went past the end of +// the source buffer. +func (r *BitReader) HasError() bool { return r.err } + +// ReadBit pulls a single MSB-first bit from the buffer. Bit-identical +// to vpx_rb_read_bit; returns 0 and sets the error flag on EOF. +func (r *BitReader) ReadBit() uint32 { + off := r.bitOffset + p := off >> 3 + q := 7 - uint(off&0x7) + if int(p) >= len(r.buf) { + r.err = true + return 0 + } + bit := uint32(r.buf[p]>>q) & 1 + r.bitOffset = off + 1 + return bit +} + +// ReadLiteral pulls `bits` bits as a big-endian integer (MSB first). +// Bit-identical to vpx_rb_read_literal. +func (r *BitReader) ReadLiteral(bits int) uint32 { + var v uint32 + for b := bits - 1; b >= 0; b-- { + v |= r.ReadBit() << uint(b) + } + return v +} + +// ReadSignedLiteral mirrors vpx_rb_read_signed_literal: the magnitude +// is read as an unsigned literal, then a trailing sign bit selects +// negation. Note the sign convention: 1 means negative. +func (r *BitReader) ReadSignedLiteral(bits int) int32 { + v := int32(r.ReadLiteral(bits)) + if r.ReadBit() != 0 { + return -v + } + return v +} diff --git a/internal/vp9/decoder/compressed.go b/internal/vp9/decoder/compressed.go new file mode 100644 index 0000000..6fd9141 --- /dev/null +++ b/internal/vp9/decoder/compressed.go @@ -0,0 +1,448 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/compressed.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// VP9 compressed header foundations. Ported from libvpx v1.16.0 +// vp9/decoder/vp9_decodeframe.c — the boolean-coder-driven +// probability updates that follow the uncompressed header. + +// TxSizeContexts is libvpx's TX_SIZE_CONTEXTS — 2 contexts per +// transform-size probability bucket. +const TxSizeContexts = 2 + +// TxProbs mirrors libvpx's struct tx_probs. The dimensions follow the +// fixed `TX_SIZES - {1, 2, 3}` triangular layout in vp9_entropymode.h. +type TxProbs struct { + P32x32 [TxSizeContexts][common.TxSizes - 1]uint8 + P16x16 [TxSizeContexts][common.TxSizes - 2]uint8 + P8x8 [TxSizeContexts][common.TxSizes - 3]uint8 +} + +// ReadTxMode mirrors read_tx_mode. Two bits select Only4x4 / Allow8x8 +// / Allow16x16 / Allow32x32; a third bit is read only when the first +// two say "Allow32x32", promoting to TxModeSelect. +func ReadTxMode(r *bitstream.Reader) common.TxMode { + tm := common.TxMode(r.ReadLiteral(2)) + if tm == common.Allow32x32 { + tm += common.TxMode(r.ReadBit()) + } + return tm +} + +// ReadTxModeProbs mirrors read_tx_mode_probs. Three nested loops over +// the (TxSizeContexts × {TxSizes-3, TxSizes-2, TxSizes-1}) probability +// slots; each slot is conditionally updated via vp9_diff_update_prob. +func ReadTxModeProbs(r *bitstream.Reader, tp *TxProbs) { + for i := range TxSizeContexts { + for j := range int(common.TxSizes - 3) { + VpxDiffUpdateProb(r, &tp.P8x8[i][j]) + } + } + for i := range TxSizeContexts { + for j := range int(common.TxSizes - 2) { + VpxDiffUpdateProb(r, &tp.P16x16[i][j]) + } + } + for i := range TxSizeContexts { + for j := range int(common.TxSizes - 1) { + VpxDiffUpdateProb(r, &tp.P32x32[i][j]) + } + } +} + +// SkipContexts mirrors libvpx's SKIP_CONTEXTS (= 3). +const SkipContexts = common.SkipContexts + +// ReadSkipProbs runs vp9_diff_update_prob across the 3 skip-context +// probability slots. Mirrors the corresponding fragment of +// read_compressed_header. +func ReadSkipProbs(r *bitstream.Reader, probs *[SkipContexts]uint8) { + for k := range SkipContexts { + VpxDiffUpdateProb(r, &probs[k]) + } +} + +// Coefficient probability updates from the VP9 compressed header. +// Ported from libvpx v1.16.0 vp9/decoder/vp9_decodeframe.c +// (read_coef_probs / read_coef_probs_common) plus the table sizing +// constants in vp9/common/vp9_entropy.h. + +const ( + // CoefPlaneTypes — VP9 keeps separate coefficient probs for luma + // and chroma (libvpx's PLANE_TYPES = 2). + CoefPlaneTypes = 2 + // CoefRefTypes — intra vs inter reference frame (REF_TYPES = 2). + CoefRefTypes = 2 + // CoefBands — six bands per (plane, ref, tx_size) entry. + CoefBands = 6 + // CoefContexts — full per-band context count outside band 0. + CoefContexts = 6 + // CoefBand0Contexts — band 0 uses a reduced context space. + CoefBand0Contexts = 3 + // UnconstrainedNodes — three of the four token-tree nodes are + // unconstrained and carry their own probabilities; the fourth is + // implied from the others. + UnconstrainedNodes = 3 +) + +// BandCoefContexts mirrors libvpx's BAND_COEFF_CONTEXTS(band) macro — +// band 0 uses 3 contexts, every other band uses 6. +func BandCoefContexts(band int) int { + if band == 0 { + return CoefBand0Contexts + } + return CoefContexts +} + +// CoefProbsModel matches libvpx's vp9_coeff_probs_model layout. The +// per-tx-size table is a 4-D array indexed as +// +// [PLANE_TYPES][REF_TYPES][COEF_BANDS][COEF_CONTEXTS][UNCONSTRAINED_NODES] +// +// Band 0 only actually uses 3 of the COEF_CONTEXTS slots; the tail +// slots are unused but the storage is square so the surrounding code +// can index uniformly. +type CoefProbsModel [CoefPlaneTypes][CoefRefTypes][CoefBands][CoefContexts][UnconstrainedNodes]uint8 + +// FrameCoefProbs aggregates the per-tx-size coefficient probability +// tables the compressed header may update — one model per TxSize +// (4x4 / 8x8 / 16x16 / 32x32). +type FrameCoefProbs [common.TxSizes]CoefProbsModel + +// readCoefProbsCommon mirrors read_coef_probs_common — a single +// leading bit gates the full nested loop over (planes × refs × bands × +// per-band contexts × unconstrained nodes). +func readCoefProbsCommon(r *bitstream.Reader, model *CoefProbsModel) { + if r.ReadBit() == 0 { + return + } + for i := range CoefPlaneTypes { + for j := range CoefRefTypes { + for k := range CoefBands { + for l := range BandCoefContexts(k) { + for m := range UnconstrainedNodes { + VpxDiffUpdateProb(r, &model[i][j][k][l][m]) + } + } + } + } + } +} + +// ReadCoefProbs mirrors read_coef_probs. It walks every TxSize up to +// the cap that tx_mode_to_biggest_tx_size selects from the frame +// header's TxMode and invokes the per-model update routine on each. +func ReadCoefProbs(r *bitstream.Reader, fc *FrameCoefProbs, txMode common.TxMode) { + max := common.TxModeToBiggestTxSize[txMode] + for tx := common.TxSize(0); tx <= max; tx++ { + readCoefProbsCommon(r, &fc[tx]) + } +} + +// FrameContext carries the full set of per-frame probability tables +// the VP9 compressed header may update. Mirrors the parser-visible +// subset of libvpx's FRAME_CONTEXT — the tables that +// read_compressed_header actually walks. Tables not touched by the +// compressed header (token tree positions, mv tree positions, etc.) +// stay in internal/vp9/tables / internal/vp9/common. +type FrameContext struct { + TxProbs TxProbs + CoefProbs FrameCoefProbs + SkipProbs [SkipContexts]uint8 + InterModeProbs [common.InterModeContexts][common.InterModes - 1]uint8 + SwitchableInterpProb [SwitchableFilterContexts][SwitchableFilters - 1]uint8 + IntraInterProb [common.IntraInterContexts]uint8 + ReferenceModeProbs FrameReferenceModeProbs + YModeProb [BlockSizeGroups][common.IntraModes - 1]uint8 + UvModeProb [common.IntraModes][common.IntraModes - 1]uint8 + PartitionProb [common.PartitionContexts][common.PartitionTypes - 1]uint8 + Nmvc NmvContext +} + +// CompressedHeader carries the outputs of ReadCompressedHeader the +// decoder needs to drive the tile pass. Most of the table updates +// land in *FrameContext directly; this struct carries the few +// frame-scalar outputs (TxMode, ReferenceMode). +type CompressedHeader struct { + TxMode common.TxMode + ReferenceMode ReferenceMode +} + +// ReadCompressedHeaderArgs bundles the frame-state inputs to the +// driver: the uncompressed-header fields that gate the compressed +// header's optional branches, plus a flag indicating whether the +// compound-reference path is allowed for this frame. +type ReadCompressedHeaderArgs struct { + Lossless bool + IntraOnly bool + KeyFrame bool + InterpFilter InterpFilter + AllowHighPrecisionMv bool + CompoundRefAllowed bool +} + +// ReadCompressedHeader drives the VP9 compressed-header parse end to +// end, mirroring read_compressed_header in libvpx v1.16.0 +// vp9/decoder/vp9_decodeframe.c. The frame_context pointer holds the +// caller-provided probability state — typically the entry in +// cm->frame_contexts[frame_context_idx] for this frame — and is +// updated in place. The bitstream.Reader must already be Init'd +// against the first_partition_size bytes of the compressed payload. +func ReadCompressedHeader(r *bitstream.Reader, fc *FrameContext, + args ReadCompressedHeaderArgs, +) CompressedHeader { + var out CompressedHeader + + if args.Lossless { + out.TxMode = common.Only4x4 + } else { + out.TxMode = ReadTxMode(r) + if out.TxMode == common.TxModeSelect { + ReadTxModeProbs(r, &fc.TxProbs) + } + } + ReadCoefProbs(r, &fc.CoefProbs, out.TxMode) + ReadSkipProbs(r, &fc.SkipProbs) + + frameIsIntraOnly := args.KeyFrame || args.IntraOnly + if !frameIsIntraOnly { + ReadInterModeProbs(r, &fc.InterModeProbs) + if args.InterpFilter == InterpSwitchable { + ReadSwitchableInterpProbs(r, &fc.SwitchableInterpProb) + } + ReadIntraInterProbs(r, &fc.IntraInterProb) + out.ReferenceMode = ReadFrameReferenceMode(r, args.CompoundRefAllowed) + ReadFrameReferenceModeProbs(r, out.ReferenceMode, &fc.ReferenceModeProbs) + ReadYModeProbs(r, &fc.YModeProb) + ReadPartitionProbs(r, &fc.PartitionProb) + ReadMvProbs(r, &fc.Nmvc, args.AllowHighPrecisionMv) + } + + return out +} + +// VP9 compressed-header probability updates for the inter-frame +// branch. Ported from libvpx v1.16.0 vp9/decoder/vp9_decodeframe.c: +// read_switchable_interp_probs, read_inter_mode_probs, +// read_frame_reference_mode, read_frame_reference_mode_probs, +// update_mv_probs. + +// Compressed-header sizing constants from libvpx. +const ( + SwitchableFilters = 3 + SwitchableFilterContexts = SwitchableFilters + 1 + BlockSizeGroups = 4 + MvUpdateProb = 252 +) + +// ReferenceMode mirrors libvpx's REFERENCE_MODE enum. +type ReferenceMode uint8 + +const ( + SingleReference ReferenceMode = 0 + CompoundReference ReferenceMode = 1 + ReferenceModeSelect ReferenceMode = 2 +) + +// ReadSwitchableInterpProbs mirrors read_switchable_interp_probs. The +// caller passes the (contexts × filters-1) probability table. +func ReadSwitchableInterpProbs(r *bitstream.Reader, + probs *[SwitchableFilterContexts][SwitchableFilters - 1]uint8, +) { + for j := range SwitchableFilterContexts { + for i := range SwitchableFilters - 1 { + VpxDiffUpdateProb(r, &probs[j][i]) + } + } +} + +// ReadInterModeProbs mirrors read_inter_mode_probs. Walks the +// (INTER_MODE_CONTEXTS × INTER_MODES-1) probability table. +func ReadInterModeProbs(r *bitstream.Reader, + probs *[common.InterModeContexts][common.InterModes - 1]uint8, +) { + for i := range common.InterModeContexts { + for j := range common.InterModes - 1 { + VpxDiffUpdateProb(r, &probs[i][j]) + } + } +} + +// ReadFrameReferenceMode mirrors read_frame_reference_mode. When the +// compound-reference path is allowed the wire form is a 1-or-2-bit +// prefix selecting SingleReference / CompoundReference / +// ReferenceModeSelect; otherwise the value is SingleReference. +func ReadFrameReferenceMode(r *bitstream.Reader, compoundAllowed bool) ReferenceMode { + if !compoundAllowed { + return SingleReference + } + if r.ReadBit() == 0 { + return SingleReference + } + if r.ReadBit() != 0 { + return ReferenceModeSelect + } + return CompoundReference +} + +// FrameReferenceModeProbs carries the three probability tables the +// reference-mode update fragment touches. Each is conditionally +// updated based on the active ReferenceMode. +type FrameReferenceModeProbs struct { + CompInterProb [common.CompInterContexts]uint8 + SingleRefProb [common.RefContexts][2]uint8 + CompRefProb [common.RefContexts]uint8 +} + +// ReadFrameReferenceModeProbs mirrors read_frame_reference_mode_probs. +// The active reference mode gates which subtables receive updates. +func ReadFrameReferenceModeProbs(r *bitstream.Reader, mode ReferenceMode, + probs *FrameReferenceModeProbs, +) { + if mode == ReferenceModeSelect { + for i := range common.CompInterContexts { + VpxDiffUpdateProb(r, &probs.CompInterProb[i]) + } + } + if mode != CompoundReference { + for i := range common.RefContexts { + VpxDiffUpdateProb(r, &probs.SingleRefProb[i][0]) + VpxDiffUpdateProb(r, &probs.SingleRefProb[i][1]) + } + } + if mode != SingleReference { + for i := range common.RefContexts { + VpxDiffUpdateProb(r, &probs.CompRefProb[i]) + } + } +} + +// UpdateMvProbs mirrors update_mv_probs: for each slot, read a single +// "update?" bit against MV_UPDATE_PROB; on update read 7 bits and +// store as (literal << 1) | 1 so the resulting probability is always +// odd in [1, 255]. +func UpdateMvProbs(r *bitstream.Reader, p []uint8) { + for i := range p { + if r.Read(MvUpdateProb) != 0 { + p[i] = uint8((r.ReadLiteral(7) << 1) | 1) + } + } +} + +// ReadIntraInterProbs runs vp9_diff_update_prob across the +// INTRA_INTER_CONTEXTS probability slots. Mirrors the intra/inter +// probability update fragment of read_compressed_header. +func ReadIntraInterProbs(r *bitstream.Reader, probs *[common.IntraInterContexts]uint8) { + for i := range common.IntraInterContexts { + VpxDiffUpdateProb(r, &probs[i]) + } +} + +// ReadYModeProbs runs vp9_diff_update_prob across the +// BLOCK_SIZE_GROUPS × (INTRA_MODES - 1) intra-mode probability table. +// Mirrors the y_mode_prob update fragment of read_compressed_header. +func ReadYModeProbs(r *bitstream.Reader, probs *[BlockSizeGroups][common.IntraModes - 1]uint8) { + for j := range BlockSizeGroups { + for i := range common.IntraModes - 1 { + VpxDiffUpdateProb(r, &probs[j][i]) + } + } +} + +// ReadPartitionProbs runs vp9_diff_update_prob across the +// PARTITION_CONTEXTS × (PARTITION_TYPES - 1) partition probability +// table. Mirrors the partition_prob update fragment. +func ReadPartitionProbs(r *bitstream.Reader, probs *[common.PartitionContexts][common.PartitionTypes - 1]uint8) { + for j := range common.PartitionContexts { + for i := range common.PartitionTypes - 1 { + VpxDiffUpdateProb(r, &probs[j][i]) + } + } +} + +// VP9 motion-vector probability tables and the compressed-header walk +// that updates them. Ported from libvpx v1.16.0: +// - vp9/common/vp9_entropymv.h (nmv_component, nmv_context layout + +// MV_JOINTS / MV_CLASSES / CLASS0_SIZE / MV_OFFSET_BITS / MV_FP_SIZE) +// - vp9/decoder/vp9_decodeframe.c (read_mv_probs walking the +// nmv_context via update_mv_probs) + +const ( + MvJoints = 4 + MvClasses = 11 + Class0Bits = 1 + Class0Size = 1 << Class0Bits + MvOffsetBits = MvClasses + Class0Bits - 2 // = 10 + MvFpSize = 4 +) + +// NmvComponent mirrors libvpx's struct nmv_component — the per-axis +// probability layout (horizontal then vertical) inside an nmv_context. +type NmvComponent struct { + Sign uint8 + Classes [MvClasses - 1]uint8 + Class0 [Class0Size - 1]uint8 + Bits [MvOffsetBits]uint8 + Class0Fp [Class0Size][MvFpSize - 1]uint8 + Fp [MvFpSize - 1]uint8 + Class0Hp uint8 + Hp uint8 +} + +// NmvContext mirrors libvpx's nmv_context — the joints + 2 components +// the compressed header walks per inter frame. +type NmvContext struct { + Joints [MvJoints - 1]uint8 + Comps [2]NmvComponent +} + +// ReadMvProbs mirrors read_mv_probs. The walk order — joints, then for +// each axis (sign / classes / class0 / bits), then for each axis +// (class0_fp[*] / fp), then (gated by allow_hp) class0_hp / hp — is +// wire-stable; reordering even one slot would break byte parity. +func ReadMvProbs(r *bitstream.Reader, ctx *NmvContext, allowHp bool) { + UpdateMvProbs(r, ctx.Joints[:]) + + for i := range 2 { + cc := &ctx.Comps[i] + updateMvProb(r, &cc.Sign) + UpdateMvProbs(r, cc.Classes[:]) + UpdateMvProbs(r, cc.Class0[:]) + UpdateMvProbs(r, cc.Bits[:]) + } + + for i := range 2 { + cc := &ctx.Comps[i] + for j := range Class0Size { + UpdateMvProbs(r, cc.Class0Fp[j][:]) + } + UpdateMvProbs(r, cc.Fp[:]) + } + + if allowHp { + for i := range 2 { + cc := &ctx.Comps[i] + updateMvProb(r, &cc.Class0Hp) + updateMvProb(r, &cc.Hp) + } + } +} + +func updateMvProb(r *bitstream.Reader, p *uint8) { + if r.Read(MvUpdateProb) != 0 { + *p = uint8((r.ReadLiteral(7) << 1) | 1) + } +} diff --git a/internal/vp9/decoder/convolve_dispatch.go b/internal/vp9/decoder/convolve_dispatch.go new file mode 100644 index 0000000..d48219c --- /dev/null +++ b/internal/vp9/decoder/convolve_dispatch.go @@ -0,0 +1,76 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/convolve_dispatch.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/dsp" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// InterPredictorWithScratch is InterPredictor with caller-owned convolve +// scratch. The scratch is used for 2-D subpel prediction and SIMD compound +// one-axis averaging paths; nil keeps the package-level fallback pool used by +// existing callers. +func InterPredictorWithScratch( + src []byte, srcStride int, dst []byte, dstStride int, + subpelX, subpelY int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + xStepQ4, yStepQ4, w, h int, + ref int, + srcOffset int, + scratch *dsp.Convolve8Scratch, +) { + key := ref + if uint(ref) > 1 { + panic("govpx/vp9/decoder: invalid inter predictor ref") + } + if subpelX != 0 || xStepQ4 != SubpelShifts { + key |= 4 + } + if subpelY != 0 || yStepQ4 != SubpelShifts { + key |= 2 + } + + switch key { + case 0: + dsp.VpxConvolveCopy(src, srcStride, dst, dstStride, w, h, srcOffset) + case 1: + dsp.VpxConvolveAvg(src, srcStride, dst, dstStride, w, h, srcOffset) + case 2: + dsp.VpxConvolve8Vert(src, srcStride, dst, dstStride, filter, + subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset) + case 3: + if scratch != nil { + dsp.VpxConvolve8AvgVertWithScratch(src, srcStride, dst, dstStride, + filter, subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset, scratch) + return + } + dsp.VpxConvolve8AvgVert(src, srcStride, dst, dstStride, filter, + subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset) + case 4: + dsp.VpxConvolve8Horiz(src, srcStride, dst, dstStride, filter, + subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset) + case 5: + if scratch != nil { + dsp.VpxConvolve8AvgHorizWithScratch(src, srcStride, dst, dstStride, + filter, subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset, scratch) + return + } + dsp.VpxConvolve8AvgHoriz(src, srcStride, dst, dstStride, filter, + subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset) + case 6: + dsp.VpxConvolve8WithScratch(src, srcStride, dst, dstStride, filter, + subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset, scratch) + case 7: + dsp.VpxConvolve8AvgWithScratch(src, srcStride, dst, dstStride, filter, + subpelX, xStepQ4, subpelY, yStepQ4, w, h, srcOffset, scratch) + } +} diff --git a/internal/vp9/decoder/dequant.go b/internal/vp9/decoder/dequant.go new file mode 100644 index 0000000..0b9a363 --- /dev/null +++ b/internal/vp9/decoder/dequant.go @@ -0,0 +1,92 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/dequant.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// BitDepth mirrors libvpx's vpx_bit_depth_t. The decoder picks the matching +// qlookup table based on this value via internal/vp9/common. +type BitDepth = common.BitDepth + +const ( + BitDepth8 = common.Bits8 + BitDepth10 = common.Bits10 + BitDepth12 = common.Bits12 +) + +// VpxDcQuant mirrors libvpx's vp9_dc_quant. Returns the DC dequant +// for `qindex + delta` clamped to [0, MaxQ], picking the per-bit-depth +// dc_qlookup table. +func VpxDcQuant(qindex, delta int, bd BitDepth) int16 { + return common.DcQuant(qindex, delta, bd) +} + +// VpxAcQuant mirrors libvpx's vp9_ac_quant. +func VpxAcQuant(qindex, delta int, bd BitDepth) int16 { + return common.AcQuant(qindex, delta, bd) +} + +// GetSegmentQindex mirrors libvpx's vp9_get_qindex. When SEG_LVL_ALT_Q +// is active for the segment the segment data either replaces or +// offsets the base qindex (selected by seg.AbsDelta == SEGMENT_ABSDATA). +func GetSegmentQindex(seg *SegmentationParams, segID, baseQindex int) int { + if !SegFeatureActive(seg, segID, SegLvlAltQ) { + return baseQindex + } + data := int(GetSegData(seg, segID, SegLvlAltQ)) + if seg.AbsDelta { + return common.ClampQIndex(data) + } + return common.ClampQIndex(baseQindex + data) +} + +// DequantTables holds the y/uv per-segment dequant pairs the tile +// driver consults during reconstruct. Mirrors libvpx's +// VP9_COMMON.y_dequant / uv_dequant arrays — [MAX_SEGMENTS][2] each. +type DequantTables struct { + Y [MaxSegments][2]int16 + Uv [MaxSegments][2]int16 +} + +// SetupSegmentationDequantArgs bundles the per-frame inputs to +// SetupSegmentationDequant. Mirrors the cm->base_qindex / +// y_dc_delta_q / uv_dc_delta_q / uv_ac_delta_q quartet. +type SetupSegmentationDequantArgs struct { + BaseQindex int + YDcDeltaQ int + UvDcDeltaQ int + UvAcDeltaQ int + BitDepth BitDepth +} + +// SetupSegmentationDequant mirrors setup_segmentation_dequant. Builds +// the per-segment y/uv (DC, AC) dequant pairs. When segmentation is +// disabled only slot 0 is filled; libvpx leaves the rest as don't +// cares (we follow suit). +func SetupSegmentationDequant(seg *SegmentationParams, args SetupSegmentationDequantArgs, out *DequantTables) { + if seg.Enabled { + for i := range MaxSegments { + qindex := GetSegmentQindex(seg, i, args.BaseQindex) + out.Y[i][0] = VpxDcQuant(qindex, args.YDcDeltaQ, args.BitDepth) + out.Y[i][1] = VpxAcQuant(qindex, 0, args.BitDepth) + out.Uv[i][0] = VpxDcQuant(qindex, args.UvDcDeltaQ, args.BitDepth) + out.Uv[i][1] = VpxAcQuant(qindex, args.UvAcDeltaQ, args.BitDepth) + } + return + } + q := args.BaseQindex + out.Y[0][0] = VpxDcQuant(q, args.YDcDeltaQ, args.BitDepth) + out.Y[0][1] = VpxAcQuant(q, 0, args.BitDepth) + out.Uv[0][0] = VpxDcQuant(q, args.UvDcDeltaQ, args.BitDepth) + out.Uv[0][1] = VpxAcQuant(q, args.UvAcDeltaQ, args.BitDepth) +} diff --git a/internal/vp9/decoder/detokenize.go b/internal/vp9/decoder/detokenize.go new file mode 100644 index 0000000..4a15ac1 --- /dev/null +++ b/internal/vp9/decoder/detokenize.go @@ -0,0 +1,1409 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/detokenize.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "math/bits" + + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// Token-tree node positions inside the unconstrained-prefix PMF. +const ( + eobContextNode = 0 + zeroContextNode = 1 + oneContextNode = 2 + pivotNode = 2 +) + +// Magnitude category minima, mirroring CAT{n}_MIN_VAL in +// vp9_entropy.h. +const ( + cat1MinVal = 5 + cat2MinVal = 7 + cat3MinVal = 11 + cat4MinVal = 19 + cat5MinVal = 35 + cat6MinVal = 67 +) + +const cat6Bits8 = 14 + +const ( + zeroToken = 0 + oneToken = 1 + twoToken = 2 + eobModelToken = 3 +) + +// coefFastMargin is how many bytes of headroom the call-free token loop +// keeps between the read position and the end of the tile buffer. One +// token consumes at most ~22 boolean reads (EOB + zero + one + 4 Pareto +// nodes + 14 cat6 bits + sign) of at most 8 bits each, and each refill +// advances the position by at most 8 bytes while topping the register up +// to at least 48 bits, so between two guard checks the position moves by +// well under 48 bytes. 64 leaves slack; the residue of the buffer is +// decoded by the resumable slow tail. +const coefFastMargin = 64 + +// FrameCoefCounts mirrors libvpx's FRAME_COUNTS.coef slab: +// [TX_SIZES][PLANE_TYPES][REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] +// [UNCONSTRAINED_NODES + EOB_MODEL_TOKEN]. +type FrameCoefCounts [common.TxSizes][CoefPlaneTypes][CoefRefTypes][CoefBands][CoefContexts][UnconstrainedNodes + 1]uint32 + +// FrameEobBranchCounts mirrors libvpx's FRAME_COUNTS.eob_branch slab. +type FrameEobBranchCounts [common.TxSizes][CoefPlaneTypes][CoefRefTypes][CoefBands][CoefContexts]uint32 + +// CoefCounts carries the coefficient-count state needed by libvpx's +// counts-driven non-frame-parallel probability adaptation. +type CoefCounts struct { + Coef FrameCoefCounts + EobBranch FrameEobBranchCounts +} + +// maxEobForTxSize returns the maximum number of coefficients a given +// transform contains. Mirrors `max_eob = 16 << (tx_size << 1)`. +func maxEobForTxSize(tx common.TxSize) int { + return MaxEobForTxSize(tx) +} + +// MaxEobForTxSize is the public mirror of maxEobForTxSize — the +// coefficient count for the given transform shape. +func MaxEobForTxSize(tx common.TxSize) int { + return 16 << (tx << 1) +} + +// coefbandTrans4x4Padded is CoefbandTrans4x4 widened to 1024 entries so +// the token loops can index one *[1024]uint8 band table with `scan +// position & 1023` for every transform size without a bounds check. +// Positions 16..1023 are unreachable for 4x4 blocks (max_eob is 16). +var coefbandTrans4x4Padded = func() [1024]uint8 { + var t [1024]uint8 + copy(t[:], tables.CoefbandTrans4x4[:]) + return t +}() + +// bandTranslatePadded selects the scan-position → coef-band map as a +// full-width array pointer. Mirrors get_band_translate in vp9_entropy.h. +func bandTranslatePadded(tx common.TxSize) *[1024]uint8 { + if tx == common.Tx4x4 { + return &coefbandTrans4x4Padded + } + return &tables.CoefbandTrans8x8Plus +} + +// readCoeffBits pulls `n` raw bits from the boolean coder against the +// supplied per-bit probabilities, MSB first. Mirrors read_coeff. +func readCoeffBits(r *bitstream.ReaderState, probs []uint8, n int, + value uint64, rng uint32, count int32, +) (int, uint64, uint32, int32) { + val := 0 + for i := range n { + if count < 0 { + r.Fill(&value, &count) + } + var bit uint32 + bit, value, rng, count = vpxReadNoFill(uint32(probs[i]), value, rng, count) + val = (val << 1) | int(bit) + } + return val, value, rng, count +} + +// vpxReadNoFill is the 100% branchless arithmetic body of vpx_read +// (vpx_dsp/bitreader.h) after the refill check. Using arithmetic masking avoids +// the multi-assignment `if` that causes Go's arm64 backend to emit a +// conditional branch (and suffer ~14-cycle mispredicts on 50/50 coefficient +// bits), while LeadingZeros8 keeps the AST cost well below Go's 80-node +// inliner budget so every call site inlines unconditionally. +func vpxReadNoFill(prob uint32, + value uint64, rng uint32, count int32, +) (uint32, uint64, uint32, int32) { + s := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(s) << 56 + ge := value >= bigsplit + nr := s + if ge { + nr = rng - s + } + nv := value + if ge { + nv = value - bigsplit + } + var bit uint32 + if ge { + bit = 1 + } + sh := uint32(bits.LeadingZeros8(uint8(nr))) + return bit, nv << sh, nr << sh, count - int32(sh) +} + +// vpxReadBoolNoFill lowers to MADD + LSR + CMP + CSEL on arm64 (0 branches, +// ~9 cycles vs ~11 for SUB+MUL+LSR+ADD) while staying under Go's 80-node +// inliner budget by returning bool directly. +func vpxReadBoolNoFill(prob uint32, + value uint64, rng uint32, count int32, +) (bool, uint64, uint32, int32) { + s := (rng*prob + (256 - prob)) >> 8 + bigsplit := uint64(s) << 56 + ge := value >= bigsplit + nr := s + if ge { + nr = rng - s + } + nv := value + if ge { + nv = value - bigsplit + } + sh := uint32(bits.LeadingZeros8(uint8(nr))) + return ge, nv << sh, nr << sh, count - int32(sh) +} + +// vpxReadBitBoolNoFill is branchless vpxReadBoolNoFill at prob=128 — one +// equally-likely bit returning bool so callers lower sign negation to CSNEG. +// Since rng-split == rng>>1 identically for all rng, both candidates compute +// in parallel without waiting on split. +func vpxReadBitBoolNoFill( + value uint64, rng uint32, count int32, +) (bool, uint64, uint32, int32) { + split := (rng + 1) >> 1 + bigsplit := uint64(split) << 56 + ge := value >= bigsplit + nr := split + if ge { + nr = rng >> 1 + } + nv := value + if ge { + nv = value - bigsplit + } + shift := uint32(1) - (nr >> 7) + return ge, nv << shift, nr << shift, count - int32(shift) +} + +// vpxReadBitNoFill is branchless vpxReadNoFill at prob=128 — one equally-likely +// bit, mirroring vpx_read_bit. The caller performs the fill check. +func vpxReadBitNoFill( + value uint64, rng uint32, count int32, +) (uint32, uint64, uint32, int32) { + split := (rng + 1) >> 1 + bigsplit := uint64(split) << 56 + ge := value >= bigsplit + nr := split + if ge { + nr = rng >> 1 + } + nv := value + if ge { + nv = value - bigsplit + } + var bit uint32 + if ge { + bit = 1 + } + shift := uint32(1) - (nr >> 7) + return bit, nv << shift, nr << shift, count - int32(shift) +} + +// getCoefContext mirrors get_coef_context from vp9_scan.h. Looks up +// the two neighbor scan positions and averages their cached token +// magnitudes, +1, >> 1. +func getCoefContext(neighbors []int16, tokenCache []uint8, c int) int { + a := tokenCache[neighbors[2*c+0]] + b := tokenCache[neighbors[2*c+1]] + return (1 + int(a) + int(b)) >> 1 +} + +// getCoefContextArr is getCoefContext against the full token-cache +// array. Neighbor entries are trusted scan positions (< 1024, mirroring +// libvpx's unchecked table indexing); the mask makes that explicit to +// the compiler so the dependent load carries no bounds check. +func getCoefContextArr(neighbors []int16, tokenCache *[1024]uint8, c int) int { + a := tokenCache[int(neighbors[2*c+0])&1023] + b := tokenCache[int(neighbors[2*c+1])&1023] + return (1 + int(a) + int(b)) >> 1 +} + +// DecodeCoefsState is DecodeCoefsWithCountsScratch against an already +// materialized ReaderState, letting callers that decode many transform +// blocks in a row (the per-superblock residue loop) snapshot the reader +// once instead of copying reader state in and out per block. The caller +// owns the Commit. +func DecodeCoefsState( + rs *bitstream.ReaderState, + txSize common.TxSize, + planeType int, + isInter int, + dequant [2]int16, + ctx int, + so *common.ScanOrder, + fc *FrameCoefProbs, + counts *CoefCounts, + dqcoeff *[1024]int16, + tokenCache *[1024]uint8, +) int { + if counts == nil { + return decodeCoefsReaderState(rs, txSize, planeType, isInter, + dequant, ctx, so.Scan, so.Neighbors, fc, dqcoeff, tokenCache, false) + } + return decodeCoefsWithCountsReaderState(rs, txSize, planeType, isInter, + dequant, ctx, so.Scan, so.Neighbors, fc, counts, dqcoeff, tokenCache) +} + +// DecodeCoefsStateAfterEOB decodes a counts-less transform block whose initial +// c==0 EOB bit was already consumed as 1 by the caller. +func DecodeCoefsStateAfterEOB( + rs *bitstream.ReaderState, + txSize common.TxSize, + planeType int, + isInter int, + dequant [2]int16, + ctx int, + so *common.ScanOrder, + fc *FrameCoefProbs, + dqcoeff *[1024]int16, + tokenCache *[1024]uint8, +) int { + return decodeCoefsReaderState(rs, txSize, planeType, isInter, + dequant, ctx, so.Scan, so.Neighbors, fc, dqcoeff, tokenCache, true) +} + +// PackedFrameCoefProbs packs each [band][ctx][3]uint8 probability triple into a +// single uint32 (p0 | p1<<8 | p2<<16) in a power-of-2 [64]uint32 table indexed +// by (band<<3)|ctx. This replaces two bounds checks, two address multiplies +// (*18 and *3), and three byte loads with a single unchecked 32-bit load per +// coefficient. +type PackedFrameCoefProbs [common.TxSizes][CoefPlaneTypes][CoefRefTypes][64]uint32 + +// PackFrameCoefProbs packs fc into dst once per frame before tile decoding. +func PackFrameCoefProbs(dst *PackedFrameCoefProbs, fc *FrameCoefProbs) { + for tx := range common.TxSizes { + for pt := range CoefPlaneTypes { + for rt := range CoefRefTypes { + for band := range CoefBands { + row := band << 3 + for ctx := range CoefContexts { + p := &fc[tx][pt][rt][band][ctx] + dst[tx][pt][rt][row|ctx] = uint32(p[0]) | uint32(p[1])<<8 | uint32(p[2])<<16 + } + } + } + } + } +} + +// FastCoefPlaneCtx holds per-plane read-only decode state hoisted outside the +// per-transform-block loop in readVP9InterResiduePlane. +type FastCoefPlaneCtx struct { + TxSize common.TxSize + PlaneType int + IsInter int + Dequant [2]int16 + Scan []int16 + Neighbors []int16 + ScanArr *[1024]int16 + ScanNeighborsArr *[2048]int16 + ScanMetaArr *[1024]uint32 + FC *FrameCoefProbs + PackedModel *[64]uint32 + DQCoeff *[1024]int16 + TokenCache *[1024]uint8 +} + +//go:noinline +func decodeVP9Cat3to6Fast( + buf []byte, pos int, value uint64, rng uint32, count int32, + p *[8]uint8, +) (int, int, uint64, uint32, int32) { + if count < 32 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var b bool + var val int + b, value, rng, count = vpxReadBoolNoFill(uint32(p[5]), value, rng, count) + if b { + b, value, rng, count = vpxReadBoolNoFill(uint32(p[7]), value, rng, count) + if b { + val = cat6MinVal + for i := range cat6Bits8 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(tables.Cat6Prob[i]), value, rng, count) + val += val - cat6MinVal + if b { + val++ + } + } + } else { + val = cat5MinVal + for i := range 5 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(tables.Cat5Prob[i]), value, rng, count) + val += val - cat5MinVal + if b { + val++ + } + } + } + } else { + b, value, rng, count = vpxReadBoolNoFill(uint32(p[6]), value, rng, count) + if b { + val = cat4MinVal + for i := range 4 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(tables.Cat4Prob[i]), value, rng, count) + val += val - cat4MinVal + if b { + val++ + } + } + } else { + val = cat3MinVal + for i := range 3 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(tables.Cat3Prob[i]), value, rng, count) + val += val - cat3MinVal + if b { + val++ + } + } + } + } + return val, pos, value, rng, count +} + +// DecodeCoefsFastPlaneAfterEOB decodes a counts-less transform block whose +// initial c==0 EOB bit was already consumed as 1, using pre-hoisted plane +// context, power-of-2 packed uint32 probabilities, and scan-order tokenCache. +func DecodeCoefsFastPlaneAfterEOB( + r *bitstream.ReaderState, + a *FastCoefPlaneCtx, + buf []byte, pos int, + value uint64, rng uint32, count int32, + ctx int, +) (int, int, uint64, uint32, int32) { + txSize := a.TxSize + maxEob := maxEobForTxSize(txSize) + dqShift := uint(0) + if txSize == common.Tx32x32 { + dqShift = 1 + } + dqv := a.Dequant[0] + dqvAC := a.Dequant[1] + dq1 := int(dqv) >> dqShift + dq1AC := int(dqvAC) >> dqShift + + model := a.PackedModel + scanArr := a.ScanArr + scanMeta := a.ScanMetaArr + dqcoeff := a.DQCoeff + scanCache := a.TokenCache + fastLimit := len(buf) - coefFastMargin + + c := 0 + slowResume := false + slowSkipEob := false + var p32 uint32 + var b bool + if pos > fastLimit { + slowResume = true + slowSkipEob = true + goto doneFast + } + p32 = model[ctx&63] + if count < 24 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + +fastLoop: + for { + b, value, rng, count = vpxReadBoolNoFill((p32>>8)&0xFF, value, rng, count) + if !b { + dqv = dqvAC + dq1 = dq1AC + for { + scanCache[c&1023] = 0 + c++ + if c >= maxEob { + break fastLoop + } + meta := scanMeta[c&1023] + ctx = (1 + int(scanCache[meta&1023]) + int(scanCache[(meta>>10)&1023])) >> 1 + p32 = model[(int(meta>>20)|ctx)&63] + if count < 16 { + if pos > fastLimit { + slowResume = true + slowSkipEob = true + break fastLoop + } + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill((p32>>8)&0xFF, value, rng, count) + if b { + break + } + } + } + + b, value, rng, count = vpxReadBoolNoFill((p32>>16)&0xFF, value, rng, count) + if b { + var val int + p := &tables.Pareto8Full[((p32>>16)&0xFF)-1] + if count < 32 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(p[0]), value, rng, count) + if b { + b, value, rng, count = vpxReadBoolNoFill(uint32(p[3]), value, rng, count) + if b { + scanCache[c&1023] = 5 + val, pos, value, rng, count = decodeVP9Cat3to6Fast(buf, pos, value, rng, count, p) + } else { + scanCache[c&1023] = 4 + b, value, rng, count = vpxReadBoolNoFill(uint32(p[4]), value, rng, count) + if b { + val = cat2MinVal + for i := range 2 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(tables.Cat2Prob[i]), value, rng, count) + val += val - cat2MinVal + if b { + val++ + } + } + } else { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(tables.Cat1Prob[0]), value, rng, count) + val = cat1MinVal + if b { + val++ + } + } + } + v := (val * int(dqv)) >> dqShift + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBitBoolNoFill(value, rng, count) + if b { + v = -v + } + dqcoeff[int(scanArr[c&1023])&1023] = int16(v) + } else { + idx := int(scanArr[c&1023]) & 1023 + b, value, rng, count = vpxReadBoolNoFill(uint32(p[1]), value, rng, count) + if b { + scanCache[c&1023] = 3 + b, value, rng, count = vpxReadBoolNoFill(uint32(p[2]), value, rng, count) + m := 3 + if b { + m = 4 + } + v := (m * int(dqv)) >> dqShift + b, value, rng, count = vpxReadBitBoolNoFill(value, rng, count) + if b { + v = -v + } + dqcoeff[idx] = int16(v) + } else { + scanCache[c&1023] = 2 + v := (2 * int(dqv)) >> dqShift + b, value, rng, count = vpxReadBitBoolNoFill(value, rng, count) + if b { + v = -v + } + dqcoeff[idx] = int16(v) + } + } + } else { + scanCache[c&1023] = 1 + b, value, rng, count = vpxReadBitBoolNoFill(value, rng, count) + v := dq1 + if b { + v = -v + } + dqcoeff[int(scanArr[c&1023])&1023] = int16(v) + } + + c++ + if c >= maxEob { + break + } + meta := scanMeta[c&1023] + ctx = (1 + int(scanCache[meta&1023]) + int(scanCache[(meta>>10)&1023])) >> 1 + dqv = dqvAC + dq1 = dq1AC + if pos > fastLimit { + slowResume = true + break + } + p32 = model[(int(meta>>20)|ctx)&63] + if count < 24 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(p32&0xFF, value, rng, count) + if !b { + break + } + } + +doneFast: + if !slowResume { + return c, pos, value, rng, count + } + return decodeCoefsFastPlaneSlowTail(r, a, pos, value, rng, count, c, ctx, dqv, slowSkipEob) +} + +//go:noinline +func decodeCoefsFastPlaneSlowTail( + r *bitstream.ReaderState, + a *FastCoefPlaneCtx, + pos int, value uint64, rng uint32, count int32, + c, ctx int, dqv int16, slowSkipEob bool, +) (int, int, uint64, uint32, int32) { + // Convert scan-order cache to raster-order cache for the rare slow tail. + var rasterCache [1024]uint8 + scanArr := a.ScanArr + scanCache := a.TokenCache + for k := range c { + rasterCache[int(scanArr[k&1023])&1023] = scanCache[k&1023] + } + r.Value = value + r.Range = rng + r.Count = count + r.CommitPos(pos) + eob := decodeCoefsSlowTail(r, a.TxSize, a.PlaneType, a.IsInter, a.Dequant, + a.Scan, a.Neighbors, a.FC, nil, a.DQCoeff, &rasterCache, c, ctx, dqv, slowSkipEob) + _, _, _, nextPos := r.BitView() + return eob, nextPos, r.Value, r.Range, r.Count +} + +type decodeCoefsCoreArgs struct { + r *bitstream.ReaderState + txSize common.TxSize + planeType int + isInter int + dequant [2]int16 + scan []int16 + neighbors []int16 + scanArr *[1024]int16 + neighborsArr *[2048]int16 + fc *FrameCoefProbs + dqcoeff *[1024]int16 + tokenCache *[1024]uint8 + skipFirstEOB bool +} + +// decodeCoefsReaderState is the call-free fast token loop (counts-less, +// frame-parallel streams). See the package comment block above for the +// fast/slow structure. +func decodeCoefsReaderState( + r *bitstream.ReaderState, + txSize common.TxSize, + planeType int, + isInter int, + dequant [2]int16, + ctx int, + scan, neighbors []int16, + fc *FrameCoefProbs, + dqcoeff *[1024]int16, + tokenCache *[1024]uint8, + skipFirstEOB bool, +) int { + buf, _, _, pos := r.BitView() + args := decodeCoefsCoreArgs{ + r: r, + txSize: txSize, + planeType: planeType, + isInter: isInter, + dequant: dequant, + scan: scan, + neighbors: neighbors, + fc: fc, + dqcoeff: dqcoeff, + tokenCache: tokenCache, + skipFirstEOB: skipFirstEOB, + } + eob, nextPos, value, rng, count := decodeCoefsReaderStateCore( + &args, buf, pos, r.Value, r.Range, r.Count, ctx) + r.Value = value + r.Range = rng + r.Count = count + r.CommitPos(nextPos) + return eob +} + +func decodeCoefsReaderStateCore( + a *decodeCoefsCoreArgs, + buf []byte, pos int, + value uint64, rng uint32, count int32, + ctx int, +) (int, int, uint64, uint32, int32) { + txSize := a.txSize + maxEob := maxEobForTxSize(txSize) + scan := a.scan + neighbors := a.neighbors + scanArr := a.scanArr + neighborsArr := a.neighborsArr + _ = scan[maxEob-1] + _ = neighbors[(maxEob<<1)-1] + bt := bandTranslatePadded(txSize) + dqShift := uint(0) + if txSize == common.Tx32x32 { + dqShift = 1 + } + dqv := a.dequant[0] + dqvAC := a.dequant[1] + dq1 := int(dqv) >> dqShift + dq1AC := int(dqvAC) >> dqShift + + coefModel := &a.fc[txSize][a.planeType][a.isInter] + dqcoeff := a.dqcoeff + tokenCache := a.tokenCache + fastLimit := len(buf) - coefFastMargin + + c := 0 + slowResume := false + skipEob := a.skipFirstEOB + + scanAt := func(i int) int { + if scanArr != nil { + return int(scanArr[i&1023]) & 1023 + } + return int(scan[i]) & 1023 + } + coefCtxAt := func(i int) int { + if neighborsArr != nil { + i2 := (i << 1) & 2046 + a := tokenCache[int(neighborsArr[i2])&1023] + b := tokenCache[int(neighborsArr[i2+1])&1023] + return (1 + int(a) + int(b)) >> 1 + } + return getCoefContextArr(neighbors, tokenCache, i) + } + +fastLoop: + for c < maxEob { + if pos > fastLimit { + slowResume = true + break + } + band := int(bt[c&1023]) + probs := &coefModel[band][ctx] + + // One batched refill guarantees count >= 24 (>= 32 valid bits), + // enough for EOB (<=7) + zero (<=7) + one (<=7) + sign (<=1) = <=22 + // bits without another refill check on the hot ±1 path. + if count < 24 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var bit uint32 + if skipEob { + skipEob = false + } else { + bit, value, rng, count = vpxReadNoFill(uint32(probs[eobContextNode]), + value, rng, count) + if bit == 0 { + break + } + } + + bit, value, rng, count = vpxReadNoFill(uint32(probs[zeroContextNode]), + value, rng, count) + for bit == 0 { + dqv = dqvAC + dq1 = dq1AC + tokenCache[scanAt(c)] = 0 + c++ + if c >= maxEob { + break fastLoop + } + ctx = coefCtxAt(c) + band = int(bt[c&1023]) + probs = &coefModel[band][ctx] + // Keep count >= 16 before zeroContextNode so exiting the zero-run + // still leaves count >= 9 for oneContextNode (<=7) + sign (<=1). + if count < 16 { + if pos > fastLimit { + slowResume = true + skipEob = true + break fastLoop + } + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[zeroContextNode]), + value, rng, count) + } + + var val int + bit, value, rng, count = vpxReadNoFill(uint32(probs[oneContextNode]), + value, rng, count) + if bit != 0 { + p := &tables.Pareto8Full[probs[pivotNode]-1] + // count >= 32 covers p[0], p[1], p[2], and sign (<=22 bits) for ±2..±4, + // and p[0], p[3], p[4], cat1/cat2, and sign for small categories. + if count < 32 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[0]), value, rng, + count) + if bit != 0 { + bit, value, rng, count = vpxReadNoFill(uint32(p[3]), value, + rng, count) + if bit != 0 { + tokenCache[int(scan[c])&1023] = 5 + if count < 32 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[5]), + value, rng, count) + if bit != 0 { + bit, value, rng, count = vpxReadNoFill(uint32(p[7]), + value, rng, count) + if bit != 0 { + val = cat6MinVal + for i := range cat6Bits8 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat6Prob[i]), value, rng, count) + val += val - cat6MinVal + int(bit) + } + } else { + val = cat5MinVal + for i := range 5 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat5Prob[i]), value, rng, count) + val += val - cat5MinVal + int(bit) + } + } + } else { + bit, value, rng, count = vpxReadNoFill(uint32(p[6]), + value, rng, count) + if bit != 0 { + val = cat4MinVal + for i := range 4 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat4Prob[i]), value, rng, count) + val += val - cat4MinVal + int(bit) + } + } else { + val = cat3MinVal + for i := range 3 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat3Prob[i]), value, rng, count) + val += val - cat3MinVal + int(bit) + } + } + } + } else { + tokenCache[int(scan[c])&1023] = 4 + bit, value, rng, count = vpxReadNoFill(uint32(p[4]), + value, rng, count) + if bit != 0 { + val = cat2MinVal + for i := range 2 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat2Prob[i]), value, rng, count) + val += val - cat2MinVal + int(bit) + } + } else { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat1Prob[0]), value, rng, count) + val = cat1MinVal + int(bit) + } + } + v := (val * int(dqv)) >> dqShift + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + sign := -int(bit) + dqcoeff[int(scan[c])&1023] = int16((v ^ sign) - sign) + } else { + idx := int(scan[c]) & 1023 + bit, value, rng, count = vpxReadNoFill(uint32(p[1]), value, + rng, count) + if bit != 0 { + tokenCache[idx] = 3 + bit, value, rng, count = vpxReadNoFill(uint32(p[2]), + value, rng, count) + v := ((3 + int(bit)) * int(dqv)) >> dqShift + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + sign := -int(bit) + dqcoeff[idx] = int16((v ^ sign) - sign) + } else { + tokenCache[idx] = 2 + v := (2 * int(dqv)) >> dqShift + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + sign := -int(bit) + dqcoeff[idx] = int16((v ^ sign) - sign) + } + } + } else { + idx := scanAt(c) + tokenCache[idx] = 1 + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + sign := -int(bit) + dqcoeff[idx] = int16((dq1 ^ sign) - sign) + } + + c++ + if c >= maxEob { + break + } + ctx = coefCtxAt(c) + dqv = dqvAC + dq1 = dq1AC + } + + if !slowResume { + return c, pos, value, rng, count + } + r := a.r + r.Value = value + r.Range = rng + r.Count = count + r.CommitPos(pos) + eob := decodeCoefsSlowTail(r, txSize, a.planeType, a.isInter, a.dequant, + scan, neighbors, a.fc, nil, dqcoeff, tokenCache, c, ctx, dqv, skipEob) + _, _, _, nextPos := r.BitView() + return eob, nextPos, r.Value, r.Range, r.Count +} + +// decodeCoefsWithCountsReaderState is decodeCoefsReaderState plus the +// libvpx FRAME_COUNTS updates used by counts-driven (non-frame-parallel) +// probability adaptation. Kept as a separate copy so the counts-less +// loop pays nothing for the increments. +func decodeCoefsWithCountsReaderState( + r *bitstream.ReaderState, + txSize common.TxSize, + planeType int, + isInter int, + dequant [2]int16, + ctx int, + scan, neighbors []int16, + fc *FrameCoefProbs, + counts *CoefCounts, + dqcoeff *[1024]int16, + tokenCache *[1024]uint8, +) int { + maxEob := maxEobForTxSize(txSize) + _ = scan[maxEob-1] + _ = neighbors[(maxEob<<1)-1] + bt := bandTranslatePadded(txSize) + dqShift := uint(0) + if txSize == common.Tx32x32 { + dqShift = 1 + } + dqv := dequant[0] + dqvAC := dequant[1] + + coefModel := &fc[txSize][planeType][isInter] + eobBranch := &counts.EobBranch[txSize][planeType][isInter] + coefCount := &counts.Coef[txSize][planeType][isInter] + + buf, _, _, pos := r.BitView() + fastLimit := len(buf) - coefFastMargin + value := r.Value + rng := r.Range + count := r.Count + + c := 0 + slowResume := false + skipEob := false + +fastLoop: + for c < maxEob { + if pos > fastLimit { + slowResume = true + break + } + band := int(bt[c&1023]) + probs := &coefModel[band][ctx] + + eobBranch[band][ctx]++ + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var bit uint32 + bit, value, rng, count = vpxReadNoFill(uint32(probs[eobContextNode]), + value, rng, count) + if bit == 0 { + coefCount[band][ctx][eobModelToken]++ + break + } + + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[zeroContextNode]), + value, rng, count) + for bit == 0 { + coefCount[band][ctx][zeroToken]++ + dqv = dqvAC + tokenCache[int(scan[c])&1023] = 0 + c++ + if c >= maxEob { + break fastLoop + } + ctx = getCoefContextArr(neighbors, tokenCache, c) + band = int(bt[c&1023]) + probs = &coefModel[band][ctx] + if pos > fastLimit { + slowResume = true + skipEob = true + break fastLoop + } + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[zeroContextNode]), + value, rng, count) + } + + var val int + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[oneContextNode]), + value, rng, count) + if bit != 0 { + coefCount[band][ctx][twoToken]++ + p := &tables.Pareto8Full[probs[pivotNode]-1] + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[0]), value, rng, + count) + if bit != 0 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[3]), value, + rng, count) + if bit != 0 { + tokenCache[int(scan[c])&1023] = 5 + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[5]), + value, rng, count) + if bit != 0 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[7]), + value, rng, count) + if bit != 0 { + val = cat6MinVal + for i := range cat6Bits8 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat6Prob[i]), value, rng, count) + val += val - cat6MinVal + int(bit) + } + } else { + val = cat5MinVal + for i := range 5 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat5Prob[i]), value, rng, count) + val += val - cat5MinVal + int(bit) + } + } + } else { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[6]), + value, rng, count) + if bit != 0 { + val = cat4MinVal + for i := range 4 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat4Prob[i]), value, rng, count) + val += val - cat4MinVal + int(bit) + } + } else { + val = cat3MinVal + for i := range 3 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat3Prob[i]), value, rng, count) + val += val - cat3MinVal + int(bit) + } + } + } + } else { + tokenCache[int(scan[c])&1023] = 4 + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[4]), + value, rng, count) + if bit != 0 { + val = cat2MinVal + for i := range 2 { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat2Prob[i]), value, rng, count) + val += val - cat2MinVal + int(bit) + } + } else { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill( + uint32(tables.Cat1Prob[0]), value, rng, count) + val = cat1MinVal + int(bit) + } + } + v := (val * int(dqv)) >> dqShift + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } else { + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[1]), value, + rng, count) + if bit != 0 { + tokenCache[int(scan[c])&1023] = 3 + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[2]), + value, rng, count) + v := ((3 + int(bit)) * int(dqv)) >> dqShift + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } else { + tokenCache[int(scan[c])&1023] = 2 + v := (2 * int(dqv)) >> dqShift + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } + } + } else { + coefCount[band][ctx][oneToken]++ + tokenCache[int(scan[c])&1023] = 1 + v := int(dqv) >> dqShift + if count < 0 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } + + c++ + ctx = getCoefContextArr(neighbors, tokenCache, c) + dqv = dqvAC + } + + r.Value = value + r.Range = rng + r.Count = count + r.CommitPos(pos) + if !slowResume { + return c + } + return decodeCoefsSlowTail(r, txSize, planeType, isInter, dequant, + scan, neighbors, fc, counts, dqcoeff, tokenCache, c, ctx, dqv, skipEob) +} + +// decodeCoefsSlowTail finishes a coefficient block once the fast loops +// run out of buffer headroom. It resumes at scan position c with the +// given band context and dequant value; skipEob resumes mid zero-run +// (the EOB branch for the current token was already decoded — and, for +// the counts variant, already counted — by the fast loop). The refills +// here go through the general sentinel-aware path, so it also handles +// end-of-stream exactly like libvpx's byte-loop vpx_reader_fill. +func decodeCoefsSlowTail( + r *bitstream.ReaderState, + txSize common.TxSize, + planeType int, + isInter int, + dequant [2]int16, + scan, neighbors []int16, + fc *FrameCoefProbs, + counts *CoefCounts, + dqcoeff *[1024]int16, + tokenCache *[1024]uint8, + c, ctx int, + dqv int16, + skipEob bool, +) int { + maxEob := maxEobForTxSize(txSize) + _ = scan[maxEob-1] + _ = neighbors[(maxEob<<1)-1] + bt := bandTranslatePadded(txSize) + dqShift := uint(0) + if txSize == common.Tx32x32 { + dqShift = 1 + } + + coefModel := &fc[txSize][planeType][isInter] + + value := r.Value + rng := r.Range + count := r.Count + + for c < maxEob { + band := int(bt[c&1023]) + probs := &coefModel[band][ctx] + + var bit uint32 + if !skipEob { + // EOB node — bail out of the loop entirely if the bit is 0. + if counts != nil { + counts.EobBranch[txSize][planeType][isInter][band][ctx]++ + } + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[eobContextNode]), value, rng, count) + if bit == 0 { + if counts != nil { + counts.Coef[txSize][planeType][isInter][band][ctx][eobModelToken]++ + } + break + } + } + skipEob = false + + // ZERO node — runs of zero tokens. + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[zeroContextNode]), value, rng, count) + for bit == 0 { + if counts != nil { + counts.Coef[txSize][planeType][isInter][band][ctx][zeroToken]++ + } + dqv = dequant[1] + tokenCache[int(scan[c])&1023] = 0 + c++ + if c >= maxEob { + r.Value = value + r.Range = rng + r.Count = count + return c + } + ctx = getCoefContextArr(neighbors, tokenCache, c) + band = int(bt[c&1023]) + probs = &coefModel[band][ctx] + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[zeroContextNode]), value, rng, count) + } + + var val int + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(probs[oneContextNode]), value, rng, count) + if bit != 0 { + // Token >= 2 — read the Pareto8 tail. + if counts != nil { + counts.Coef[txSize][planeType][isInter][band][ctx][twoToken]++ + } + p := &tables.Pareto8Full[probs[pivotNode]-1] + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[0]), value, rng, count) + if bit != 0 { + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[3]), value, rng, count) + if bit != 0 { + tokenCache[int(scan[c])&1023] = 5 + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[5]), value, rng, count) + if bit != 0 { + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[7]), value, rng, count) + if bit != 0 { + var extra int + extra, value, rng, count = readCoeffBits(r, tables.Cat6Prob[:], cat6Bits8, value, rng, count) + val = cat6MinVal + extra + } else { + var extra int + extra, value, rng, count = readCoeffBits(r, tables.Cat5Prob[:], 5, value, rng, count) + val = cat5MinVal + extra + } + } else { + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[6]), value, rng, count) + if bit != 0 { + var extra int + extra, value, rng, count = readCoeffBits(r, tables.Cat4Prob[:], 4, value, rng, count) + val = cat4MinVal + extra + } else { + var extra int + extra, value, rng, count = readCoeffBits(r, tables.Cat3Prob[:], 3, value, rng, count) + val = cat3MinVal + extra + } + } + } else { + tokenCache[int(scan[c])&1023] = 4 + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[4]), value, rng, count) + if bit != 0 { + var extra int + extra, value, rng, count = readCoeffBits(r, tables.Cat2Prob[:], 2, value, rng, count) + val = cat2MinVal + extra + } else { + var extra int + extra, value, rng, count = readCoeffBits(r, tables.Cat1Prob[:], 1, value, rng, count) + val = cat1MinVal + extra + } + } + v := (val * int(dqv)) >> dqShift + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } else { + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[1]), value, rng, count) + if bit != 0 { + tokenCache[int(scan[c])&1023] = 3 + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadNoFill(uint32(p[2]), value, rng, count) + v := ((3 + int(bit)) * int(dqv)) >> dqShift + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } else { + tokenCache[int(scan[c])&1023] = 2 + v := (2 * int(dqv)) >> dqShift + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } + } + } else { + // Token == 1 — magnitude is exactly the AC/DC dequant value. + if counts != nil { + counts.Coef[txSize][planeType][isInter][band][ctx][oneToken]++ + } + tokenCache[int(scan[c])&1023] = 1 + v := int(dqv) >> dqShift + if count < 0 { + r.Fill(&value, &count) + } + bit, value, rng, count = vpxReadBitNoFill(value, rng, count) + if bit != 0 { + v = -v + } + dqcoeff[int(scan[c])&1023] = int16(v) + } + + c++ + ctx = getCoefContextArr(neighbors, tokenCache, c) + dqv = dequant[1] + } + + r.Value = value + r.Range = rng + r.Count = count + return c +} diff --git a/internal/vp9/decoder/detokenize_highbd.go b/internal/vp9/decoder/detokenize_highbd.go new file mode 100644 index 0000000..13e0e7b --- /dev/null +++ b/internal/vp9/decoder/detokenize_highbd.go @@ -0,0 +1,182 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/detokenize_highbd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// High-bit-depth (10-bit / 12-bit) VP9 coefficient detokenizer. +// Ported verbatim from libvpx v1.16.0 vp9/decoder/vp9_detokenize.c +// (decode_coefs with CONFIG_VP9_HIGHBITDEPTH). + +// vp9Cat6ProbHigh12 mirrors libvpx's vp9_cat6_prob_high12[18]. +// 10-bit uses [2:] (16 entries); 12-bit uses [0:] (18 entries). +var vp9Cat6ProbHigh12 = [18]uint8{ + 255, 255, 255, 255, 254, 254, + 254, 252, 249, 243, 230, 196, + 177, 153, 140, 133, 130, 129, +} + +func cat6ProbsForBitDepth(bd BitDepth) []uint8 { + switch bd { + case BitDepth12: + return vp9Cat6ProbHigh12[:] + case BitDepth10: + return vp9Cat6ProbHigh12[2:] + default: + return tables.Cat6Prob[:] + } +} + +// DecodeCoefsHighBD decodes one transform block of high-bit-depth (10/12-bit) +// coefficients into int32 dqcoeff, returning EOB. +func DecodeCoefsHighBD(r *bitstream.Reader, probs *FrameCoefProbs, + txSize common.TxSize, planeType, isInter int, + scan, neighbors []int16, dequant [2]int16, + dqShift uint, initCtx int, bd BitDepth, + dqcoeff []int32, tokenCache *[1024]uint8, + counts *CoefCounts, +) int { + maxEob := maxEobForTxSize(txSize) + bandTrans := bandTranslatePadded(txSize) + coefProbs := &probs[txSize][planeType][isInter] + cat6Probs := cat6ProbsForBitDepth(bd) + cat6Bits := len(cat6Probs) + + var coefCounts *[CoefBands][CoefContexts][UnconstrainedNodes + 1]uint32 + var eobCounts *[CoefBands][CoefContexts]uint32 + if counts != nil { + coefCounts = &counts.Coef[txSize][planeType][isInter] + eobCounts = &counts.EobBranch[txSize][planeType][isInter] + } + + c := 0 + ctx := initCtx + band := int(bandTrans[0]) + prob := &coefProbs[band][ctx] + + for c < maxEob { + if eobCounts != nil { + eobCounts[band][ctx]++ + } + if r.Read(uint32(prob[eobContextNode])) == 0 { + if coefCounts != nil { + coefCounts[band][ctx][eobModelToken]++ + } + break + } + + // Zero run loop. + for r.Read(uint32(prob[zeroContextNode])) == 0 { + if coefCounts != nil { + coefCounts[band][ctx][zeroToken]++ + } + tokenCache[scan[c]] = 0 + c++ + if c >= maxEob { + return c + } + band = int(bandTrans[c]) + ctx = getCoefContext(neighbors, tokenCache[:], c) + prob = &coefProbs[band][ctx] + } + + // Non-zero coefficient. + var val int32 + if r.Read(uint32(prob[oneContextNode])) == 0 { + if coefCounts != nil { + coefCounts[band][ctx][oneToken]++ + } + val = 1 + tokenCache[scan[c]] = 1 + } else { + if coefCounts != nil { + coefCounts[band][ctx][twoToken]++ + } + pareto := &tables.Pareto8Full[prob[pivotNode]-1] + if r.Read(uint32(pareto[0])) == 0 { + if r.Read(uint32(pareto[1])) == 0 { + val = 2 + tokenCache[scan[c]] = 2 + } else { + if r.Read(uint32(pareto[2])) == 0 { + val = 3 + } else { + val = 4 + } + tokenCache[scan[c]] = 3 + } + } else { + if r.Read(uint32(pareto[3])) == 0 { + tokenCache[scan[c]] = 4 + if r.Read(uint32(pareto[4])) == 0 { + val = int32(cat1MinVal + int(r.Read(uint32(tables.Cat1Prob[0])))) + } else { + v := int(r.Read(uint32(tables.Cat2Prob[0])))<<1 | int(r.Read(uint32(tables.Cat2Prob[1]))) + val = int32(cat2MinVal + v) + } + } else { + tokenCache[scan[c]] = 5 + if r.Read(uint32(pareto[5])) == 0 { + if r.Read(uint32(pareto[6])) == 0 { + v := int(r.Read(uint32(tables.Cat3Prob[0])))<<2 | + int(r.Read(uint32(tables.Cat3Prob[1])))<<1 | + int(r.Read(uint32(tables.Cat3Prob[2]))) + val = int32(cat3MinVal + v) + } else { + v := int(r.Read(uint32(tables.Cat4Prob[0])))<<3 | + int(r.Read(uint32(tables.Cat4Prob[1])))<<2 | + int(r.Read(uint32(tables.Cat4Prob[2])))<<1 | + int(r.Read(uint32(tables.Cat4Prob[3]))) + val = int32(cat4MinVal + v) + } + } else { + if r.Read(uint32(pareto[7])) == 0 { + v := int(r.Read(uint32(tables.Cat5Prob[0])))<<4 | + int(r.Read(uint32(tables.Cat5Prob[1])))<<3 | + int(r.Read(uint32(tables.Cat5Prob[2])))<<2 | + int(r.Read(uint32(tables.Cat5Prob[3])))<<1 | + int(r.Read(uint32(tables.Cat5Prob[4]))) + val = int32(cat5MinVal + v) + } else { + v := 0 + for i := range cat6Bits { + v = (v << 1) | int(r.Read(uint32(cat6Probs[i]))) + } + val = int32(cat6MinVal + v) + } + } + } + } + } + + dq := int32(dequant[1]) + if c == 0 { + dq = int32(dequant[0]) + } + v := (val * dq) >> dqShift + if r.ReadBit() != 0 { + v = -v + } + dqcoeff[scan[c]] = v + c++ + if c >= maxEob { + break + } + band = int(bandTrans[c]) + ctx = getCoefContext(neighbors, tokenCache[:], c) + prob = &coefProbs[band][ctx] + } + return c +} diff --git a/internal/vp9/decoder/dsubexp.go b/internal/vp9/decoder/dsubexp.go new file mode 100644 index 0000000..26bfe78 --- /dev/null +++ b/internal/vp9/decoder/dsubexp.go @@ -0,0 +1,107 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/dsubexp.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import "github.com/go-avkit/vpx/internal/vp9/bitstream" + +// Probability-update sub-exponential helpers from the VP9 compressed +// header. Ported from libvpx v1.16.0 vp9/decoder/vp9_dsubexp.c. +// vp9_diff_update_prob walks a probability slot in the frame context +// and conditionally updates it via a remap-table-driven sub-exp code. +// +// DiffUpdateProb is the boolean coder prob used to gate the update — +// MAX_PROB-3 (= 252) per vp9/common/vp9_entropy.h. +const DiffUpdateProb = 252 + +// invMapTable mirrors inv_map_table in vp9_dsubexp.c. The probability +// space is permuted so the encoder can spend fewer bits on commonly +// updated values. +var invMapTable = [255]uint8{ + 7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176, 189, + 202, 215, 228, 241, 254, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 253, +} + +// invRecenterNonneg mirrors inv_recenter_nonneg. +func invRecenterNonneg(v, m int) int { + if v > 2*m { + return v + } + if v&1 != 0 { + return m - ((v + 1) >> 1) + } + return m + (v >> 1) +} + +// decodeUniform mirrors decode_uniform in libvpx — read a uniformly +// distributed value in [0, 191) via the boolean coder using 7 then +// possibly 8 bits. +func decodeUniform(r *bitstream.Reader) int { + const l = 8 + const m = (1 << l) - 191 + v := int(r.ReadLiteral(l - 1)) + if v < m { + return v + } + return (v << 1) - m + int(r.ReadBit()) +} + +// decodeTermSubexp mirrors decode_term_subexp — the three-category +// prefix code that selects the magnitude bucket and then a uniform +// tail when the value exceeds 64. +func decodeTermSubexp(r *bitstream.Reader) int { + if r.ReadBit() == 0 { + return int(r.ReadLiteral(4)) + } + if r.ReadBit() == 0 { + return int(r.ReadLiteral(4)) + 16 + } + if r.ReadBit() == 0 { + return int(r.ReadLiteral(5)) + 32 + } + return decodeUniform(r) + 64 +} + +// invRemapProb mirrors inv_remap_prob: pass through the permutation +// table, then re-center around the current probability with a +// triangular split at MAX_PROB. +func invRemapProb(v int, m uint8) uint8 { + v = int(invMapTable[v]) + mm := int(m) - 1 + if (mm << 1) <= 255 { + return uint8(1 + invRecenterNonneg(v, mm)) + } + return uint8(255 - invRecenterNonneg(v, 255-1-mm)) +} + +// VpxDiffUpdateProb mirrors vp9_diff_update_prob. The boolean coder +// decides whether to update; on update the sub-exp delta selects the +// new probability via the inverse map. +func VpxDiffUpdateProb(r *bitstream.Reader, p *uint8) { + if r.Read(DiffUpdateProb) != 0 { + delp := decodeTermSubexp(r) + *p = invRemapProb(delp, *p) + } +} diff --git a/internal/vp9/decoder/frame_context_init.go b/internal/vp9/decoder/frame_context_init.go new file mode 100644 index 0000000..89317df --- /dev/null +++ b/internal/vp9/decoder/frame_context_init.go @@ -0,0 +1,71 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/frame_context_init.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import "github.com/go-avkit/vpx/internal/vp9/tables" + +// VP9 default frame-context seeder. Ported from libvpx v1.16.0 +// vp9/common/vp9_entropymode.c — init_mode_probs + the equivalent +// init_coef_probs / init_mv_probs paths libvpx invokes inside +// vp9_setup_past_independence at keyframes and error-resilient +// resets. +// +// Both encoder and decoder need byte-identical seed probabilities +// before a context-resetting frame is decoded; this function is +// the single source of truth. + +// ResetFrameContext seeds every probability slot in fc with the +// libvpx default values. Mirrors the cumulative effect of +// init_mode_probs (mode + ref + skip + partition + interp), plus +// the per-tx-size default_coef_probs copy and default_nmv_context +// copy that vp9_setup_past_independence triggers via +// vp9_default_coef_probs / vp9_init_mv_probs. +// +// Keyframes, error-resilient frames, and any frame whose +// frame_context_idx points at an unset context all start from +// this seed; counts-driven updates ride on top. +func ResetFrameContext(fc *FrameContext) { + // Mode + ref + skip + partition + switchable interp. + fc.YModeProb = tables.DefaultIfYProbs + fc.UvModeProb = tables.DefaultIfUvProbs + fc.SwitchableInterpProb = tables.DefaultSwitchableInterpProb + fc.PartitionProb = tables.DefaultPartitionProbs + fc.IntraInterProb = tables.DefaultIntraInter + fc.ReferenceModeProbs.CompInterProb = tables.DefaultCompInter + fc.ReferenceModeProbs.CompRefProb = tables.DefaultCompRef + fc.ReferenceModeProbs.SingleRefProb = tables.DefaultSingleRef + fc.TxProbs.P32x32 = tables.DefaultTxProbsP32x32 + fc.TxProbs.P16x16 = tables.DefaultTxProbsP16x16 + fc.TxProbs.P8x8 = tables.DefaultTxProbsP8x8 + fc.SkipProbs = tables.DefaultSkipProbs + fc.InterModeProbs = tables.DefaultInterModeProbs + + // Coefficient probs (per tx_size). + fc.CoefProbs[0] = tables.DefaultCoefProbs4x4 + fc.CoefProbs[1] = tables.DefaultCoefProbs8x8 + fc.CoefProbs[2] = tables.DefaultCoefProbs16x16 + fc.CoefProbs[3] = tables.DefaultCoefProbs32x32 + + // NMV context. + fc.Nmvc.Joints = tables.DefaultNmvJoints + for i := range 2 { + src := &tables.DefaultNmvComps[i] + dst := &fc.Nmvc.Comps[i] + dst.Sign = src.Sign + dst.Classes = src.Classes + dst.Class0 = src.Class0 + dst.Bits = src.Bits + dst.Class0Fp = src.Class0Fp + dst.Fp = src.Fp + dst.Class0Hp = src.Class0Hp + dst.Hp = src.Hp + } +} diff --git a/internal/vp9/decoder/header.go b/internal/vp9/decoder/header.go new file mode 100644 index 0000000..38e7a40 --- /dev/null +++ b/internal/vp9/decoder/header.go @@ -0,0 +1,849 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/header.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "errors" + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// Header parsing helpers for the VP9 uncompressed frame header. +// Ported from libvpx v1.16.0 vp9/decoder/vp9_decodeframe.c — +// specifically vp9_read_profile, vp9_read_sync_code, vp9_read_frame_size, +// and read_bitdepth_colorspace_sampling. + +// ErrInvalidHeader is returned when the uncompressed header fails any +// of the validation steps libvpx surfaces as VPX_CODEC_UNSUP_BITSTREAM: +// bad frame marker, bad sync code, illegal subsampling combination, or +// a reserved bit set to 1. +var ErrInvalidHeader = errors.New("govpx: invalid VP9 uncompressed header") + +// ReadProfile reads the 2- or 3-bit profile field. Profiles 0..2 use +// 2 bits; profile 3 uses 3 (the third bit is read only when the first +// two say "3"). Mirrors vp9_read_profile. +func ReadProfile(r *BitReader) common.BitstreamProfile { + p := r.ReadBit() + p |= r.ReadBit() << 1 + if p > 2 { + p += r.ReadBit() + } + return common.BitstreamProfile(p) +} + +// ReadSyncCode consumes the three VP9 sync code bytes and returns true +// iff they match. Mirrors vp9_read_sync_code — callers convert a false +// return into a VPX_CODEC_UNSUP_BITSTREAM error. +func ReadSyncCode(r *BitReader) bool { + return r.ReadLiteral(8) == common.VP9SyncCode0 && + r.ReadLiteral(8) == common.VP9SyncCode1 && + r.ReadLiteral(8) == common.VP9SyncCode2 +} + +// ReadFrameSize reads the 32 bits encoding (width-1, height-1) and +// returns them as 1-based dimensions. Mirrors vp9_read_frame_size. +func ReadFrameSize(r *BitReader) (width, height uint32) { + width = r.ReadLiteral(16) + 1 + height = r.ReadLiteral(16) + 1 + return +} + +// BitDepth values returned by ReadBitdepthColorspaceSampling. The +// non-highbitdepth build is always 8. +const ( + Bits8 = 8 + Bits10 = 10 + Bits12 = 12 +) + +// BitdepthColorspaceSampling carries the values parsed by +// read_bitdepth_colorspace_sampling: bit depth, color space, color +// range, and (subsampling_x, subsampling_y). +type BitdepthColorspaceSampling struct { + BitDepth uint8 + ColorSpace common.ColorSpace + ColorRange common.ColorRange + SubsamplingX uint8 + SubsamplingY uint8 +} + +// ReadBitdepthColorspaceSampling parses the block after the sync code +// in a key frame (and in an intra-only frame on profile > 0). Mirrors +// read_bitdepth_colorspace_sampling. +func ReadBitdepthColorspaceSampling(r *BitReader, profile common.BitstreamProfile) (BitdepthColorspaceSampling, error) { + var out BitdepthColorspaceSampling + if profile >= common.Profile2 { + if r.ReadBit() == 1 { + out.BitDepth = Bits12 + } else { + out.BitDepth = Bits10 + } + } else { + out.BitDepth = Bits8 + } + out.ColorSpace = common.ColorSpace(r.ReadLiteral(3)) + if out.ColorSpace != common.CSSRGB { + out.ColorRange = common.ColorRange(r.ReadBit()) + if profile == common.Profile1 || profile == common.Profile3 { + out.SubsamplingX = uint8(r.ReadBit()) + out.SubsamplingY = uint8(r.ReadBit()) + if out.SubsamplingX == 1 && out.SubsamplingY == 1 { + return out, ErrInvalidHeader + } + if r.ReadBit() != 0 { + return out, ErrInvalidHeader + } + } else { + out.SubsamplingX = 1 + out.SubsamplingY = 1 + } + } else { + out.ColorRange = common.CRFullRange + if profile == common.Profile1 || profile == common.Profile3 { + // 4:4:4 chroma is the only legal sampling for sRGB + profile + // 1/3. + out.SubsamplingX = 0 + out.SubsamplingY = 0 + if r.ReadBit() != 0 { + return out, ErrInvalidHeader + } + } else { + // 4:4:4 not allowed in profile 0 or 2. + return out, ErrInvalidHeader + } + } + return out, nil +} + +// ReadFrameMarker validates the 2-bit VP9 frame marker. Returns nil if +// the bits are 0b10; otherwise ErrInvalidHeader. This is the very +// first call against a fresh BitReader on a new frame. +func ReadFrameMarker(r *BitReader) error { + if r.ReadLiteral(2) != common.VP9FrameMarker { + return ErrInvalidHeader + } + return nil +} + +// UncompressedHeader carries the full state the VP9 uncompressed +// header emits. Mirrors the parser-visible subset of VP9_COMMON that +// read_uncompressed_header in libvpx v1.16.0 vp9/decoder/ +// vp9_decodeframe.c populates — no buffer pool, no ref-counted frame +// management, just the wire-format fields needed for byte-parity +// validation and to drive the compressed-header parser. +type UncompressedHeader struct { + Profile common.BitstreamProfile + ShowExistingFrame bool + ExistingFrameSlot uint8 // valid when ShowExistingFrame + FrameType common.FrameType + ShowFrame bool + ErrorResilientMode bool + IntraOnly bool + ResetFrameContext uint8 // 0..3 + RefreshFrameFlags uint8 // 8 bits, one per ring slot + BitDepthColor BitdepthColorspaceSampling + Width uint32 + Height uint32 + Render RenderSize + InterRef InterRefBlock + AllowHighPrecisionMv bool + InterpFilter InterpFilter + RefreshFrameContext bool + FrameParallelDecoding bool + FrameContextIdx uint8 + + Loopfilter LoopfilterParams + Quant QuantizationParams + Seg SegmentationParams + Tile TileInfo + + // FirstPartitionSize is the size in bytes of the compressed header + // that follows the uncompressed header. Read as a trailing 16-bit + // literal. + FirstPartitionSize uint16 +} + +// ReadUncompressedHeader drives the VP9 uncompressed header parse end +// to end. Caller passes a fresh BitReader sitting at the start of the +// frame, the previous frame's parser state (used as the seed for +// fields the wire format preserves when their update bit is 0, unless +// the new frame triggers vp9_setup_past_independence), and a refDims function +// returning (width, height) of a ring-slot reference frame; refDims +// is called for the three inter refs after the ref-index block is +// read. +// +// Returns ErrInvalidHeader on the malformed-frame branches libvpx +// surfaces as VPX_CODEC_UNSUP_BITSTREAM. Buffer allocation, +// ref-counted frame management, and the compressed-header parse all +// live above this layer. +func ReadUncompressedHeader(r *BitReader, prev *UncompressedHeader, + refDims func(slot uint8) (uint32, uint32), +) (UncompressedHeader, error) { + var h UncompressedHeader + if prev != nil { + // Carry parser-preserved state forward. + h.BitDepthColor = prev.BitDepthColor + h.Loopfilter = prev.Loopfilter + h.Seg = prev.Seg + // Tile info and frame size are also re-read every frame, but + // the wire format never preserves them — they always emit. + } + + if err := ReadFrameMarker(r); err != nil { + return h, err + } + + h.Profile = ReadProfile(r) + if h.Profile >= common.MaxProfiles { + return h, ErrInvalidHeader + } + + h.ShowExistingFrame = r.ReadBit() != 0 + if h.ShowExistingFrame { + h.ExistingFrameSlot = uint8(r.ReadLiteral(3)) + return h, nil + } + + h.FrameType = common.FrameType(r.ReadBit()) + h.ShowFrame = r.ReadBit() != 0 + h.ErrorResilientMode = r.ReadBit() != 0 + + switch { + case h.FrameType == common.KeyFrame: + if !ReadSyncCode(r) { + return h, ErrInvalidHeader + } + bd, err := ReadBitdepthColorspaceSampling(r, h.Profile) + if err != nil { + return h, err + } + h.BitDepthColor = bd + h.RefreshFrameFlags = 0xff + h.Width, h.Height = ReadFrameSize(r) + h.Render = ReadRenderSize(r, h.Width, h.Height) + + default: + if h.ShowFrame { + h.IntraOnly = false + } else { + h.IntraOnly = r.ReadBit() != 0 + } + if !h.ErrorResilientMode { + h.ResetFrameContext = uint8(r.ReadLiteral(2)) + } + if h.IntraOnly { + if !ReadSyncCode(r) { + return h, ErrInvalidHeader + } + if h.Profile > common.Profile0 { + bd, err := ReadBitdepthColorspaceSampling(r, h.Profile) + if err != nil { + return h, err + } + h.BitDepthColor = bd + } else { + h.BitDepthColor = BitdepthColorspaceSampling{ + BitDepth: Bits8, + ColorSpace: common.CSBT601, + ColorRange: common.CRStudioRange, + SubsamplingX: 1, + SubsamplingY: 1, + } + } + h.RefreshFrameFlags = uint8(r.ReadLiteral(common.RefFrames)) + h.Width, h.Height = ReadFrameSize(r) + h.Render = ReadRenderSize(r, h.Width, h.Height) + } else { + h.RefreshFrameFlags = uint8(r.ReadLiteral(common.RefFrames)) + h.InterRef = ReadInterRefBlock(r) + var refWidths, refHeights [3]uint32 + if refDims != nil { + for i, slot := range h.InterRef.RefIndex { + refWidths[i], refHeights[i] = refDims(slot) + } + } + fs := ReadFrameSizeWithRefs(r, refWidths, refHeights) + h.Width, h.Height = fs.Width, fs.Height + h.Render = fs.Render + h.AllowHighPrecisionMv = r.ReadBit() != 0 + h.InterpFilter = ReadInterpFilter(r) + } + } + + if !h.ErrorResilientMode { + h.RefreshFrameContext = r.ReadBit() != 0 + h.FrameParallelDecoding = r.ReadBit() != 0 + } else { + h.RefreshFrameContext = false + h.FrameParallelDecoding = true + } + h.FrameContextIdx = uint8(r.ReadLiteral(common.FrameContextsLog2)) + + if prev == nil || h.FrameType == common.KeyFrame || h.IntraOnly || + h.ErrorResilientMode { + SetupPastIndependence(&h) + } + + ReadLoopfilter(r, &h.Loopfilter) + ReadQuantization(r, &h.Quant) + ReadSegmentation(r, &h.Seg) + + miCols := alignPowerOfTwo(int(h.Width), common.MiSizeLog2) >> common.MiSizeLog2 + if err := ReadTileInfo(r, miCols, &h.Tile); err != nil { + return h, err + } + + h.FirstPartitionSize = uint16(r.ReadLiteral(16)) + return h, nil +} + +// SetupPastIndependence mirrors the header-state portion of libvpx +// vp9_setup_past_independence. Reset-style frames must not inherit +// loop-filter deltas or segment features from earlier frames; the following +// loopfilter / segmentation parser then applies the current header's update +// bits on top of these defaults. +func SetupPastIndependence(h *UncompressedHeader) { + if h == nil { + return + } + ResetSegmentationFeatures(&h.Seg) + ResetLoopfilterDeltas(&h.Loopfilter) +} + +// HeaderRenderSize returns the render dimensions signalled by the +// uncompressed header, falling back to coded dimensions when no render size was +// present. +func HeaderRenderSize(hdr *UncompressedHeader) (int, int) { + if hdr == nil { + return 0, 0 + } + if hdr.Render.Width > 0 && hdr.Render.Height > 0 { + return int(hdr.Render.Width), int(hdr.Render.Height) + } + return int(hdr.Width), int(hdr.Height) +} + +// SupportedOutputFormat reports whether hdr describes an output format that +// the public decoder can currently publish (Profile 0 8-bit 4:2:0, +// Profile 1 8-bit 4:2:2 / 4:4:0 / 4:4:4 / RGB, Profile 2 10/12-bit 4:2:0, +// and Profile 3 10/12-bit 4:2:2 / 4:4:0 / 4:4:4 / RGB). +func SupportedOutputFormat(hdr *UncompressedHeader) bool { + switch hdr.Profile { + case common.Profile0: + return hdr.BitDepthColor.BitDepth == Bits8 && + hdr.BitDepthColor.SubsamplingX == 1 && hdr.BitDepthColor.SubsamplingY == 1 + case common.Profile1: + return hdr.BitDepthColor.BitDepth == Bits8 && + hdr.BitDepthColor.SubsamplingX <= 1 && hdr.BitDepthColor.SubsamplingY <= 1 && + !(hdr.BitDepthColor.SubsamplingX == 1 && hdr.BitDepthColor.SubsamplingY == 1) + case common.Profile2: + return (hdr.BitDepthColor.BitDepth == Bits10 || hdr.BitDepthColor.BitDepth == Bits12) && + hdr.BitDepthColor.SubsamplingX == 1 && hdr.BitDepthColor.SubsamplingY == 1 + case common.Profile3: + return (hdr.BitDepthColor.BitDepth == Bits10 || hdr.BitDepthColor.BitDepth == Bits12) && + hdr.BitDepthColor.SubsamplingX <= 1 && hdr.BitDepthColor.SubsamplingY <= 1 && + !(hdr.BitDepthColor.SubsamplingX == 1 && hdr.BitDepthColor.SubsamplingY == 1) + default: + return false + } +} + +// FrameRefSignBias converts the uncompressed-header reference sign-bias fields +// into the full VP9 reference-frame bias table. +func FrameRefSignBias(hdr *UncompressedHeader) [MaxRefFrames]uint8 { + var signBias [MaxRefFrames]uint8 + for i := range common.RefsPerFrame { + signBias[LastFrame+i] = hdr.InterRef.SignBias[i] + } + return signBias +} + +// HeaderKind classifies the mutually exclusive VP9 uncompressed frame header +// variants without colliding on Go's zero value (KeyFrame == 0). +type HeaderKind uint8 + +const ( + HeaderKindShowExisting HeaderKind = iota + HeaderKindKeyFrame + HeaderKindIntraOnly + HeaderKindInterFrame +) + +// Kind returns the explicit frame-header variant of hdr. +func (hdr *UncompressedHeader) Kind() HeaderKind { + if hdr == nil || hdr.ShowExistingFrame { + return HeaderKindShowExisting + } + if hdr.FrameType == common.KeyFrame { + return HeaderKindKeyFrame + } + if hdr.IntraOnly { + return HeaderKindIntraOnly + } + return HeaderKindInterFrame +} + +// CompoundReferenceAllowedForHeader reports whether compound prediction is +// allowed for this uncompressed header. +func CompoundReferenceAllowedForHeader(hdr *UncompressedHeader) bool { + if hdr == nil || hdr.Kind() != HeaderKindInterFrame { + return false + } + return CompoundReferenceAllowed(FrameRefSignBias(hdr)) +} + +// HeaderResetsPastIndependence reports whether this header resets state that +// depends on prior frames. +func HeaderResetsPastIndependence(hdr *UncompressedHeader) bool { + if hdr == nil || hdr.ShowExistingFrame { + return false + } + return hdr.FrameType == common.KeyFrame || + hdr.IntraOnly || hdr.ErrorResilientMode +} + +// PartitionContextUpdateWidth returns the context update width used by libvpx +// for a partition whose half-size is measured in 8x8 mode-info units. +func PartitionContextUpdateWidth(halfBlock8x8 int) int { + width := 2 * halfBlock8x8 + if width == 0 { + return 1 + } + return width +} + +// PlaneEntropyLen returns the entropy-context length for miCount mode-info +// units at the plane subsampling factor. +func PlaneEntropyLen(miCount int, subsampling uint8) int { + return (miCount * 2) >> subsampling +} + +// TileOffset returns the tile boundary offset in mode-info units. +func TileOffset(idx, mis, log2 int) int { + sbCols := common.AlignToSB(mis) >> common.MiBlockSizeLog2 + offset := ((idx * sbCols) >> uint(log2)) << common.MiBlockSizeLog2 + return min(offset, mis) +} + +// Loopfilter / quantization / tile-info parsers from the VP9 +// uncompressed header. Ported from libvpx v1.16.0 +// vp9/decoder/vp9_decodeframe.c — setup_loopfilter, setup_quantization, +// setup_tile_info. + +// MaxRefLfDeltas / MaxModeLfDeltas mirror libvpx's MAX_REF_LF_DELTAS +// and MAX_MODE_LF_DELTAS — four ref deltas and two mode deltas per +// frame. +const ( + MaxRefLfDeltas = 4 + MaxModeLfDeltas = 2 +) + +// LoopfilterParams holds the loop filter knobs the uncompressed header +// emits. Mirrors libvpx's struct loopfilter (just the parser-visible +// fields). +type LoopfilterParams struct { + FilterLevel uint8 + SharpnessLevel uint8 + ModeRefDeltaEnabled bool + ModeRefDeltaUpdate bool + RefDeltas [MaxRefLfDeltas]int8 + ModeDeltas [MaxModeLfDeltas]int8 +} + +// ResetLoopfilterDeltas mirrors libvpx's set_default_lf_deltas. It is part of +// vp9_setup_past_independence: reset-style frames start from these deltas, and +// setup_loopfilter only overwrites them when mode_ref_delta_update is set. +func ResetLoopfilterDeltas(lf *LoopfilterParams) { + if lf == nil { + return + } + lf.ModeRefDeltaEnabled = true + lf.ModeRefDeltaUpdate = true + lf.RefDeltas = [MaxRefLfDeltas]int8{1, 0, -1, -1} + lf.ModeDeltas = [MaxModeLfDeltas]int8{0, 0} +} + +// ReadLoopfilter parses the 6-bit filter level + 3-bit sharpness + +// optional mode/ref delta block. Mirrors setup_loopfilter exactly: +// when the delta-update bit is 0 the existing deltas are preserved, so +// the caller passes the previous frame's state in `lf` and this +// function only overwrites entries with their per-slot enable bit set. +func ReadLoopfilter(r *BitReader, lf *LoopfilterParams) { + lf.FilterLevel = uint8(r.ReadLiteral(6)) + lf.SharpnessLevel = uint8(r.ReadLiteral(3)) + lf.ModeRefDeltaUpdate = false + lf.ModeRefDeltaEnabled = r.ReadBit() != 0 + if !lf.ModeRefDeltaEnabled { + return + } + lf.ModeRefDeltaUpdate = r.ReadBit() != 0 + if !lf.ModeRefDeltaUpdate { + return + } + for i := range MaxRefLfDeltas { + if r.ReadBit() != 0 { + lf.RefDeltas[i] = int8(r.ReadSignedLiteral(6)) + } + } + for i := range MaxModeLfDeltas { + if r.ReadBit() != 0 { + lf.ModeDeltas[i] = int8(r.ReadSignedLiteral(6)) + } + } +} + +// QindexBits is the wire-format width of the base qindex. +const QindexBits = 8 + +// QuantizationParams holds the frame-level quant knobs. +type QuantizationParams struct { + BaseQindex int16 + YDcDeltaQ int8 + UvDcDeltaQ int8 + UvAcDeltaQ int8 + Lossless bool +} + +func readDeltaQ(r *BitReader) int8 { + if r.ReadBit() != 0 { + return int8(r.ReadSignedLiteral(4)) + } + return 0 +} + +// ReadQuantization mirrors setup_quantization — reads the 8-bit +// base_qindex plus the three optional 4-bit signed deltas and derives +// the lossless flag. +func ReadQuantization(r *BitReader, q *QuantizationParams) { + q.BaseQindex = int16(r.ReadLiteral(QindexBits)) + q.YDcDeltaQ = readDeltaQ(r) + q.UvDcDeltaQ = readDeltaQ(r) + q.UvAcDeltaQ = readDeltaQ(r) + q.Lossless = q.BaseQindex == 0 && q.YDcDeltaQ == 0 && q.UvDcDeltaQ == 0 && q.UvAcDeltaQ == 0 +} + +// TileInfo holds the tile-grid sizing derived from the frame's mi +// dimensions and the trailing tile_cols / tile_rows bits. +type TileInfo struct { + Log2TileCols int + Log2TileRows int +} + +// ReadTileInfo mirrors setup_tile_info. It needs the frame's mi_cols +// to pick the valid (min, max) tile column range. Returns ErrInvalid +// Header if tile_cols exceeds 6 (the VP9 spec limit). +func ReadTileInfo(r *BitReader, miCols int, tile *TileInfo) error { + minLog2, maxLog2 := TileNBits(miCols) + + tile.Log2TileCols = minLog2 + for n := maxLog2 - minLog2; n > 0; n-- { + if r.ReadBit() == 0 { + break + } + tile.Log2TileCols++ + } + if tile.Log2TileCols > 6 { + return ErrInvalidHeader + } + + tile.Log2TileRows = int(r.ReadBit()) + if tile.Log2TileRows != 0 { + tile.Log2TileRows += int(r.ReadBit()) + } + return nil +} + +// TileNBits mirrors vp9_get_tile_n_bits. Returns (min, max) for the +// log2_tile_cols range based on the frame's mode-info column count. +func TileNBits(miCols int) (minLog2, maxLog2 int) { + const ( + miBlockSizeLog2 = common.MiBlockSizeLog2 + minTileWidthB64 = 4 + maxTileWidthB64 = 64 + ) + sb64Cols := alignPowerOfTwo(miCols, miBlockSizeLog2) >> miBlockSizeLog2 + + for (maxTileWidthB64 << minLog2) < sb64Cols { + minLog2++ + } + maxLog2 = 1 + for (sb64Cols >> maxLog2) >= minTileWidthB64 { + maxLog2++ + } + maxLog2-- + return +} + +func alignPowerOfTwo(value, n int) int { + return (value + (1 << uint(n)) - 1) &^ ((1 << uint(n)) - 1) +} + +// VP9 segmentation parser. Ported from libvpx v1.16.0 +// vp9/decoder/vp9_decodeframe.c:setup_segmentation. + +// Segmentation constants from vp9/common/vp9_seg_common.h. +const ( + MaxSegments = 8 + SegTreeProbs = MaxSegments - 1 + PredictionProbs = 3 + SegLvlMax = 4 + MaxProb = 255 +) + +// SegLvl* identify each per-segment feature slot. Matches +// SEG_LVL_FEATURES in libvpx. +const ( + SegLvlAltQ = 0 + SegLvlAltLf = 1 + SegLvlRefFrame = 2 + SegLvlSkip = 3 +) + +// Maximum data magnitude per feature. Mirrors seg_feature_data_max in +// vp9/common/vp9_seg_common.c. MAXQ = 255, MAX_LOOP_FILTER = 63. +var segFeatureDataMax = [SegLvlMax]int{255, 63, 3, 0} + +// Whether the per-segment data is signed. Mirrors +// seg_feature_data_signed in libvpx. +var segFeatureDataSigned = [SegLvlMax]bool{true, true, false, false} + +// SegmentationParams holds the parsed segmentation state. +type SegmentationParams struct { + Enabled bool + UpdateMap bool + UpdateData bool + AbsDelta bool + TemporalUpdate bool + + TreeProbs [SegTreeProbs]uint8 + PredProbs [PredictionProbs]uint8 + FeatureMask [MaxSegments]uint32 + FeatureData [MaxSegments][SegLvlMax]int16 +} + +// ResetSegmentationFeatures mirrors the segmentation part of libvpx's +// vp9_setup_past_independence. It clears every feature and restores delta-data +// semantics, while leaving the next header free to set Enabled/UpdateMap/Data. +func ResetSegmentationFeatures(seg *SegmentationParams) { + if seg == nil { + return + } + *seg = SegmentationParams{} +} + +// ReadSegmentation mirrors setup_segmentation. Caller passes an +// existing SegmentationParams; the parser preserves previous-frame +// state when the corresponding update flag is 0. The non-update path +// resets UpdateMap / UpdateData to false. +func ReadSegmentation(r *BitReader, seg *SegmentationParams) { + seg.UpdateMap = false + seg.UpdateData = false + + seg.Enabled = r.ReadBit() != 0 + if !seg.Enabled { + return + } + + // Map update. + seg.UpdateMap = r.ReadBit() != 0 + if seg.UpdateMap { + for i := range SegTreeProbs { + if r.ReadBit() != 0 { + seg.TreeProbs[i] = uint8(r.ReadLiteral(8)) + } else { + seg.TreeProbs[i] = MaxProb + } + } + seg.TemporalUpdate = r.ReadBit() != 0 + if seg.TemporalUpdate { + for i := range PredictionProbs { + if r.ReadBit() != 0 { + seg.PredProbs[i] = uint8(r.ReadLiteral(8)) + } else { + seg.PredProbs[i] = MaxProb + } + } + } else { + for i := range PredictionProbs { + seg.PredProbs[i] = MaxProb + } + } + } + + // Data update. + seg.UpdateData = r.ReadBit() != 0 + if !seg.UpdateData { + return + } + seg.AbsDelta = r.ReadBit() != 0 + + // Reset feature mask + data — mirrors vp9_clearall_segfeatures. + for i := range seg.FeatureMask { + seg.FeatureMask[i] = 0 + } + for i := range seg.FeatureData { + for j := range seg.FeatureData[i] { + seg.FeatureData[i][j] = 0 + } + } + + for i := range MaxSegments { + for j := range SegLvlMax { + var data int + if r.ReadBit() != 0 { + seg.FeatureMask[i] |= 1 << uint(j) + data = decodeUnsignedMax(r, segFeatureDataMax[j]) + if segFeatureDataSigned[j] { + if r.ReadBit() != 0 { + data = -data + } + } + } + seg.FeatureData[i][j] = int16(data) + } + } +} + +// decodeUnsignedMax mirrors the static helper in libvpx — read +// get_unsigned_bits(max) bits, then saturate at max. +func decodeUnsignedMax(r *BitReader, max int) int { + data := int(r.ReadLiteral(getUnsignedBits(max))) + if data > max { + return max + } + return data +} + +// getUnsignedBits returns the number of bits needed to encode any +// value in [0, n]. Mirrors get_unsigned_bits in vp9_common.h. +func getUnsignedBits(n int) int { + if n <= 0 { + return 0 + } + bits := 0 + for v := uint(n); v > 0; v >>= 1 { + bits++ + } + return bits +} + +// VP9 frame-size + interpolation-filter parsing helpers used by the +// uncompressed header. Ported from libvpx v1.16.0 +// vp9/decoder/vp9_decodeframe.c — read_interp_filter, setup_render_size, +// the frame-size-with-refs reference picker, and the inter-frame ref +// frame index block. + +// InterpFilter mirrors the INTERP_FILTER enum in vp9/common/vp9_filter.h. +type InterpFilter uint8 + +const ( + InterpEighttap InterpFilter = 0 + InterpEighttapSmooth InterpFilter = 1 + InterpEighttapSharp InterpFilter = 2 + InterpBilinear InterpFilter = 3 + InterpSwitchable InterpFilter = 4 +) + +// literalToFilter maps the 2-bit literal in read_interp_filter to the +// matching INTERP_FILTER value. Order is fixed by the wire format. +var literalToFilter = [4]InterpFilter{ + InterpEighttapSmooth, InterpEighttap, InterpEighttapSharp, InterpBilinear, +} + +// ReadInterpFilter mirrors read_interp_filter. A leading 1-bit selects +// SWITCHABLE (per-block); otherwise a 2-bit literal selects one of the +// four banks. +func ReadInterpFilter(r *BitReader) InterpFilter { + if r.ReadBit() != 0 { + return InterpSwitchable + } + return literalToFilter[r.ReadLiteral(2)] +} + +// RenderSize holds the optional display dimensions a key/intra-only +// frame can carry after the coded dimensions. +type RenderSize struct { + Width, Height uint32 +} + +// ReadRenderSize mirrors setup_render_size. If the leading bit is 0 +// the render dimensions equal the coded (width, height); otherwise a +// fresh 32-bit (w-1, h-1) field follows. +func ReadRenderSize(r *BitReader, codedWidth, codedHeight uint32) RenderSize { + out := RenderSize{Width: codedWidth, Height: codedHeight} + if r.ReadBit() != 0 { + out.Width, out.Height = ReadFrameSize(r) + } + return out +} + +// FrameSizeWithRefs carries the state setup_frame_size_with_refs +// emits — either an inherited size from one of the three reference +// frames (Found = true with refer index FromRef) or a freshly read +// (Width, Height) pair (Found = false). +type FrameSizeWithRefs struct { + Found bool + FromRef int + Width uint32 + Height uint32 + Render RenderSize +} + +// ReadFrameSizeWithRefs mirrors the parser shape of +// setup_frame_size_with_refs without doing any buffer allocation. For +// each of the three reference slots a 1-bit flag says "inherit this +// ref's size"; the first set bit wins. If none is set, an explicit +// 32-bit (w-1, h-1) field is read. Then the render size follows. +// +// refWidths / refHeights carry the dimensions of the three references +// in the order LAST / GOLDEN / ALTREF. Callers wire this from the +// frame buffer pool. +func ReadFrameSizeWithRefs(r *BitReader, refWidths, refHeights [3]uint32) FrameSizeWithRefs { + var out FrameSizeWithRefs + // libvpx breaks out of the per-ref loop on the first set "found" + // bit; the encoder mirrors this by emitting only one bit when a + // match is found. Walking all three slots would consume bits the + // encoder never wrote, mis-aligning every downstream field. + for i := range 3 { + if r.ReadBit() != 0 { + out.Found = true + out.FromRef = i + out.Width = refWidths[i] + out.Height = refHeights[i] + break + } + } + if !out.Found { + out.Width, out.Height = ReadFrameSize(r) + } + out.Render = ReadRenderSize(r, out.Width, out.Height) + return out +} + +// InterRefBlock carries the per-reference-frame state read for an +// inter frame: each of REFS_PER_FRAME slots picks a ring slot via 3 +// bits and adds a sign-bias bit. +type InterRefBlock struct { + RefIndex [3]uint8 // 0..7 index into the 8-slot ring + SignBias [3]uint8 // 0 or 1 +} + +// ReadInterRefBlock mirrors the per-reference fragment of +// read_uncompressed_header's non-key, non-intra-only path: for each of +// 3 inter refs, read REF_FRAMES_LOG2 (= 3) bits for the ring slot and +// one bit for the sign bias. +func ReadInterRefBlock(r *BitReader) InterRefBlock { + var out InterRefBlock + for i := range 3 { + out.RefIndex[i] = uint8(r.ReadLiteral(3)) + out.SignBias[i] = uint8(r.ReadBit()) + } + return out +} diff --git a/internal/vp9/decoder/inter_mv.go b/internal/vp9/decoder/inter_mv.go new file mode 100644 index 0000000..217f09d --- /dev/null +++ b/internal/vp9/decoder/inter_mv.go @@ -0,0 +1,163 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/inter_mv.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// InterModeContextIdx is InterModeContext backed by a 4-byte miIdx indirection +// grid (matching libvpx's mi_grid_visible pointer grid). +func InterModeContextIdx(miGrid []NeighborMi, miIdx []int32, miCols int, + tile TileBounds, miRows, miRow, miCol int, bsize common.BlockSize, +) int { + contextCounter := 0 + search := tables.MvRefBlocks[bsize] + tileInBounds := tile.MiColStart >= 0 && tile.MiColEnd <= miCols + for i := range 2 { + pos := search[i] + r := miRow + int(pos.Row) + c := miCol + int(pos.Col) + if r < 0 || r >= miRows || c < tile.MiColStart || c >= tile.MiColEnd { + continue + } + if !tileInBounds && (c < 0 || c >= miCols) { + continue + } + mode := miGrid[miIdx[r*miCols+c]].Mode + if int(mode) >= len(tables.Mode2Counter) { + continue + } + contextCounter += int(tables.Mode2Counter[mode]) + } + return int(tables.CounterToContext[contextCounter]) +} + +// Subpel + interpolation margins, mirroring libvpx's +// vpx_dsp/vpx_filter.h and vpx_scale/yv12config.h. +const ( + SubpelBitsConst = 4 + SubpelShifts = 1 << SubpelBitsConst + VP9InterpExtend = 4 + VP9EncBorderPels = 160 + // LeftTopMargin / RightBottomMargin gate the per-block clamp + // region against the frame's reconstruction border. The shift by + // 3 converts pixels into 1/8-pel MV units. + LeftTopMargin = (VP9EncBorderPels - VP9InterpExtend) << 3 + RightBottomMargin = (VP9EncBorderPels - VP9InterpExtend) << 3 +) + +// roundMvCompQ4 mirrors libvpx's round_mv_comp_q4 — rounds an MV +// component to the nearest multiple of 4, halfway-away-from-zero. +func roundMvCompQ4(v int) int { + if v < 0 { + return (v - 2) / 4 + } + return (v + 2) / 4 +} + +// roundMvCompQ2 mirrors round_mv_comp_q2. +func roundMvCompQ2(v int) int { + if v < 0 { + return (v - 1) / 2 + } + return (v + 1) / 2 +} + +// miMvPredQ4 mirrors libvpx's mi_mv_pred_q4 — average of the four +// sub-block MVs at the given ref index, rounded to the original +// 1/8-pel grid. +func miMvPredQ4(bmi *[4]Bmi, idx int) MV { + rowSum := int(bmi[0].AsMv[idx].Row) + int(bmi[1].AsMv[idx].Row) + + int(bmi[2].AsMv[idx].Row) + int(bmi[3].AsMv[idx].Row) + colSum := int(bmi[0].AsMv[idx].Col) + int(bmi[1].AsMv[idx].Col) + + int(bmi[2].AsMv[idx].Col) + int(bmi[3].AsMv[idx].Col) + return MV{Row: int16(roundMvCompQ4(rowSum)), Col: int16(roundMvCompQ4(colSum))} +} + +// miMvPredQ2 mirrors mi_mv_pred_q2 — half-block average between two +// adjacent sub-blocks. +func miMvPredQ2(bmi *[4]Bmi, idx, block0, block1 int) MV { + rowSum := int(bmi[block0].AsMv[idx].Row) + int(bmi[block1].AsMv[idx].Row) + colSum := int(bmi[block0].AsMv[idx].Col) + int(bmi[block1].AsMv[idx].Col) + return MV{Row: int16(roundMvCompQ2(rowSum)), Col: int16(roundMvCompQ2(colSum))} +} + +// AverageSplitMvs mirrors libvpx's average_split_mvs. For a sub-8x8 +// inter partition, depending on the chroma subsampling pair (ss_x, +// ss_y) the matching MV is either the per-subblock value (4:4:4), +// the vertical pair average (4:4:2), the horizontal pair average +// (4:2:2), or the 4-way average (4:2:0). +func AverageSplitMvs(bmi *[4]Bmi, ref, block int, ssX, ssY int) MV { + idx := 0 + if ssX > 0 { + idx |= 2 + } + if ssY > 0 { + idx |= 1 + } + switch idx { + case 0: + return bmi[block].AsMv[ref] + case 1: + return miMvPredQ2(bmi, ref, block, block+2) + case 2: + return miMvPredQ2(bmi, ref, block, block+1) + default: + return miMvPredQ4(bmi, ref) + } +} + +// BlockBoundsEdges carries the per-block edge offsets that +// clamp_mv_to_umv_border_sb consults. Mirrors libvpx's xd->mb_to_*_edge +// quartet (signed 1/8-pel offsets to the frame margin). +type BlockBoundsEdges struct { + MbToLeftEdge int + MbToRightEdge int + MbToTopEdge int + MbToBottomEdge int +} + +// ClampMvToUmvBorderSb mirrors libvpx's clamp_mv_to_umv_border_sb. +// Takes a source MV in 1/8-pel units plus the block dimensions +// (bw, bh) in source-plane pixels and the chroma subsampling pair +// (ssX, ssY) — returns the MV scaled to 1/8-pel * 2^(1-ss) and +// saturated to keep the projected reference window inside the +// unrestricted motion-vector border. +func ClampMvToUmvBorderSb(edges BlockBoundsEdges, srcMv MV, bw, bh, ssX, ssY int) MV { + spelLeft := (VP9InterpExtend + bw) << SubpelBitsConst + spelRight := spelLeft - SubpelShifts + spelTop := (VP9InterpExtend + bh) << SubpelBitsConst + spelBottom := spelTop - SubpelShifts + shiftY := 1 << uint(1-ssY) + shiftX := 1 << uint(1-ssX) + minCol := int32(edges.MbToLeftEdge*shiftX - spelLeft) + maxCol := int32(edges.MbToRightEdge*shiftX + spelRight) + minRow := int32(edges.MbToTopEdge*shiftY - spelTop) + maxRow := int32(edges.MbToBottomEdge*shiftY + spelBottom) + row := int32(srcMv.Row) * int32(shiftY) + col := int32(srcMv.Col) * int32(shiftX) + if row >= minRow && row <= maxRow && col >= minCol && col <= maxCol { + return MV{Row: int16(row), Col: int16(col)} + } + if row < minRow { + row = minRow + } else if row > maxRow { + row = maxRow + } + if col < minCol { + col = minCol + } else if col > maxCol { + col = maxCol + } + return MV{Row: int16(row), Col: int16(col)} +} diff --git a/internal/vp9/decoder/inter_mv_refs.go b/internal/vp9/decoder/inter_mv_refs.go new file mode 100644 index 0000000..95b6386 --- /dev/null +++ b/internal/vp9/decoder/inter_mv_refs.go @@ -0,0 +1,337 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/inter_mv_refs.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// MvRef stores the previous/current-frame reference and MV pair tracked by +// libvpx's MODE_INFO grid for find_mv_refs_idx. +type MvRef struct { + RefFrame [2]int8 + Mv [2]MV +} + +// ModeInfoDecodeBSize returns the reconstruction block size used by VP9 mode +// decoding. Sub-8x8 blocks still reconstruct through an 8x8 mode-info cell. +func ModeInfoDecodeBSize(bsize common.BlockSize) common.BlockSize { + if bsize < common.Block8x8 { + return common.Block8x8 + } + return bsize +} + +// FindInterMvRefsFieldsIdx is FindInterMvRefsFields backed by a 4-byte miIdx +// indirection grid (matching libvpx's mi_grid_visible pointer grid). +func FindInterMvRefsFieldsIdx(miGrid []NeighborMi, miIdx []int32, + usePrevFrameMvs bool, prevFrameMvs []MvRef, + prevFrameMvRows, prevFrameMvCols int, + tile TileBounds, + miRows, miCols, miRow, miCol int, + bsize common.BlockSize, + mode common.PredictionMode, + refFrame int8, + signBias [MaxRefFrames]uint8, + block int, +) ([2]MV, int) { + var out [2]MV + count := 0 + normalizeCount := false + differentRefFound := false + earlyBreak := mode != common.NearMv + search := tables.MvRefBlocks[bsize] + tileInBounds := tile.MiColStart >= 0 && tile.MiColEnd <= miCols + var prevFrameMvsRef *MvRef + + i := 0 + if block >= 0 { + for ; i < 2 && i < len(search); i++ { + pos := search[i] + if !IsInside(tile, miRows, miRow, miCol, int(pos.Row), int(pos.Col)) { + continue + } + r := miRow + int(pos.Row) + c := miCol + int(pos.Col) + if !tileInBounds && (c < 0 || c >= miCols) { + continue + } + cand := &miGrid[miIdx[r*miCols+c]] + differentRefFound = true + if cand.RefFrame[0] == refFrame { + mv := subBlockMv(cand, 0, int(pos.Col), block) + if appendMvRef(&out, &count, mv, earlyBreak) { + goto done + } + } else if cand.RefFrame[1] == refFrame { + mv := subBlockMv(cand, 1, int(pos.Col), block) + if appendMvRef(&out, &count, mv, earlyBreak) { + goto done + } + } + } + } + + for ; i < len(search); i++ { + pos := search[i] + if !IsInside(tile, miRows, miRow, miCol, int(pos.Row), int(pos.Col)) { + continue + } + r := miRow + int(pos.Row) + c := miCol + int(pos.Col) + if !tileInBounds && (c < 0 || c >= miCols) { + continue + } + cand := &miGrid[miIdx[r*miCols+c]] + differentRefFound = true + if cand.RefFrame[0] == refFrame { + if appendMvRef(&out, &count, cand.Mv[0], earlyBreak) { + goto done + } + } else if cand.RefFrame[1] == refFrame { + if appendMvRef(&out, &count, cand.Mv[1], earlyBreak) { + goto done + } + } + } + + if usePrevFrameMvs && miRow >= 0 && miCol >= 0 && + miRow < prevFrameMvRows && miCol < prevFrameMvCols { + idx := miRow*prevFrameMvCols + miCol + if idx >= 0 && idx < len(prevFrameMvs) { + prevFrameMvsRef = &prevFrameMvs[idx] + } + } + if prevFrameMvsRef != nil { + if prevFrameMvsRef.RefFrame[0] == refFrame { + if appendMvRef(&out, &count, prevFrameMvsRef.Mv[0], earlyBreak) { + goto done + } + } else if prevFrameMvsRef.RefFrame[1] == refFrame { + if appendMvRef(&out, &count, prevFrameMvsRef.Mv[1], earlyBreak) { + goto done + } + } + } + + if differentRefFound { + for i := range search { + pos := search[i] + if !IsInside(tile, miRows, miRow, miCol, int(pos.Row), int(pos.Col)) { + continue + } + r := miRow + int(pos.Row) + c := miCol + int(pos.Col) + if !tileInBounds && (c < 0 || c >= miCols) { + continue + } + cand := &miGrid[miIdx[r*miCols+c]] + if cand.RefFrame[0] > IntraFrame && cand.RefFrame[0] != refFrame { + mv := scaleDiffRefMv(cand.Mv[0], cand.RefFrame[0], refFrame, signBias) + if appendMvRef(&out, &count, mv, earlyBreak) { + goto done + } + } + if cand.RefFrame[1] > IntraFrame && cand.RefFrame[1] != refFrame && + cand.Mv[1] != cand.Mv[0] { + mv := scaleDiffRefMv(cand.Mv[1], cand.RefFrame[1], refFrame, signBias) + if appendMvRef(&out, &count, mv, earlyBreak) { + goto done + } + } + } + } + + if prevFrameMvsRef != nil { + if prevFrameMvsRef.RefFrame[0] != refFrame && + prevFrameMvsRef.RefFrame[0] > IntraFrame { + mv := scaleDiffRefMv(prevFrameMvsRef.Mv[0], + prevFrameMvsRef.RefFrame[0], refFrame, signBias) + if appendMvRef(&out, &count, mv, earlyBreak) { + goto done + } + } + if prevFrameMvsRef.RefFrame[1] > IntraFrame && + prevFrameMvsRef.RefFrame[1] != refFrame && + prevFrameMvsRef.Mv[1] != prevFrameMvsRef.Mv[0] { + mv := scaleDiffRefMv(prevFrameMvsRef.Mv[1], + prevFrameMvsRef.RefFrame[1], refFrame, signBias) + if appendMvRef(&out, &count, mv, earlyBreak) { + goto done + } + } + } + + normalizeCount = true + +done: + if normalizeCount { + if mode == common.NearMv { + count = 2 + } else { + count = 1 + } + } + for i := 0; i < count; i++ { + ClampMvRef(&out[i], miRows, miCols, miRow, miCol, bsize) + } + return out, count +} + +var idxNColumnToSubblock = [4][2]int{ + {1, 2}, {1, 3}, {3, 2}, {3, 3}, +} + +func subBlockMv(candidate *NeighborMi, refIdx, searchCol, block int) MV { + if block >= 0 && block < len(idxNColumnToSubblock) && + candidate != nil && candidate.SbType < common.Block8x8 { + colIdx := 0 + if searchCol == 0 { + colIdx = 1 + } + return candidate.Bmi[idxNColumnToSubblock[block][colIdx]].AsMv[refIdx] + } + return candidate.Mv[refIdx] +} + +// ClampMvRef mirrors libvpx's clamp_mv_ref for a mode-info block. +func ClampMvRef(mv *MV, miRows, miCols, miRow, miCol int, bsize common.BlockSize) { + const mvBorder = 16 << 3 + miW := int(common.Num8x8BlocksWideLookup[bsize]) + miH := int(common.Num8x8BlocksHighLookup[bsize]) + left := -((miCol * common.MiSize) * 8) + right := ((miCols - miW - miCol) * common.MiSize) * 8 + top := -((miRow * common.MiSize) * 8) + bottom := ((miRows - miH - miRow) * common.MiSize) * 8 + ClampMv(mv, + int32(left-mvBorder), int32(right+mvBorder), + int32(top-mvBorder), int32(bottom+mvBorder)) +} + +func appendMvRef(out *[2]MV, count *int, mv MV, earlyBreak bool) bool { + if *count == 0 { + out[0] = mv + *count = 1 + return earlyBreak + } + if mv != out[0] { + out[1] = mv + *count = 2 + return true + } + return false +} + +func scaleDiffRefMv(mv MV, candRef, refFrame int8, + signBias [MaxRefFrames]uint8, +) MV { + if candRef >= 0 && int(candRef) < len(signBias) && + refFrame >= 0 && int(refFrame) < len(signBias) && + signBias[candRef] != signBias[refFrame] { + mv.Row = -mv.Row + mv.Col = -mv.Col + } + return mv +} + +// InterModeMvCandidate selects the NEARESTMV/NEARMV candidate returned by the +// VP9 MV-ref scan. +func InterModeMvCandidate(refs [2]MV, count int, + mode common.PredictionMode, +) MV { + if mode == common.NearMv { + if count > 1 { + return refs[1] + } + return MV{} + } + if count > 0 { + return refs[0] + } + return MV{} +} + +// CanReconstructInterBlock reports whether the inter mode info has a +// reconstruction path in this Profile 0 implementation. +func CanReconstructInterBlock(mi *NeighborMi) bool { + if mi == nil { + return false + } + if mi.RefFrame[0] <= IntraFrame || mi.RefFrame[0] > AltrefFrame { + return false + } + if mi.RefFrame[1] != NoRefFrame && + (mi.RefFrame[1] <= IntraFrame || mi.RefFrame[1] > AltrefFrame) { + return false + } + return mi.Mode == common.ZeroMv || mi.Mode == common.NearestMv || + mi.Mode == common.NearMv || mi.Mode == common.NewMv +} + +// BoolInt returns 1 for true and 0 for false, matching libvpx count updates. +func BoolInt(v bool) int { + if v { + return 1 + } + return 0 +} + +// BlockBoundsEdgesForMI converts a mode-info position into the edge offsets +// used by VP9 inter and intra reconstruction helpers. +func BlockBoundsEdgesForMI(miRows, miCols, miRow, miCol int, + bsize common.BlockSize, +) BlockBoundsEdges { + return BlockBoundsEdges{ + MbToLeftEdge: -((miCol * common.MiSize) * 8), + MbToRightEdge: ((miCols - int(common.Num8x8BlocksWideLookup[bsize]) - miCol) * common.MiSize) * 8, + MbToTopEdge: -((miRow * common.MiSize) * 8), + MbToBottomEdge: ((miRows - int(common.Num8x8BlocksHighLookup[bsize]) - miRow) * common.MiSize) * 8, + } +} + +// PlaneMaxBlocks4x4 returns the in-frame 4x4 block span for a plane at a +// possibly clipped frame edge. +func PlaneMaxBlocks4x4(miRows, miCols, miRow, miCol int, + bsize common.BlockSize, pd *MacroblockdPlane, + planeBsize common.BlockSize, +) (int, int) { + edges := BlockBoundsEdgesForMI(miRows, miCols, miRow, miCol, bsize) + w := int(common.Num4x4BlocksWideLookup[planeBsize]) + h := int(common.Num4x4BlocksHighLookup[planeBsize]) + if edges.MbToRightEdge < 0 { + w += edges.MbToRightEdge >> (5 + pd.SubsamplingX) + } + if edges.MbToBottomEdge < 0 { + h += edges.MbToBottomEdge >> (5 + pd.SubsamplingY) + } + if w < 0 { + w = 0 + } + if h < 0 { + h = 0 + } + return w, h +} + +// InterReferenceSlot maps a LAST/GOLDEN/ALTREF reference enum to the active +// reference-buffer slot in the uncompressed frame header. +func InterReferenceSlot(hdr *UncompressedHeader, ref int8) (int, bool) { + if ref < LastFrame || ref > AltrefFrame { + return 0, false + } + idx := int(ref - LastFrame) + slot := int(hdr.InterRef.RefIndex[idx]) + if slot < 0 || slot >= common.RefFrames { + return 0, false + } + return slot, true +} diff --git a/internal/vp9/decoder/intra_block.go b/internal/vp9/decoder/intra_block.go new file mode 100644 index 0000000..d5729c2 --- /dev/null +++ b/internal/vp9/decoder/intra_block.go @@ -0,0 +1,233 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/intra_block.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// GetYMode mirrors libvpx's get_y_mode. For sub-8x8 partitions the +// `block` index selects one of the four bmi sub-modes; for ≥8x8 +// partitions the single block-level mode applies. +func GetYMode(mi *NeighborMi, block int) common.PredictionMode { + if mi.SbType < common.Block8x8 { + return mi.Bmi[block].AsMode + } + return mi.Mode +} + +// LeftBlockMode mirrors libvpx's vp9_left_block_mode. For sub-block +// indices 0 and 2, it looks one block to the left and reaches into +// that block's bmi quartet (or DC for inter-block / missing +// neighbors). For indices 1 and 3 it pulls the matching subblock out +// of the current MI. +func LeftBlockMode(curMi, leftMi *NeighborMi, b int) common.PredictionMode { + if b == 0 || b == 2 { + if leftMi == nil || isInterBlock(leftMi) { + return common.DcPred + } + return GetYMode(leftMi, b+1) + } + return curMi.Bmi[b-1].AsMode +} + +// AboveBlockMode mirrors libvpx's vp9_above_block_mode. +func AboveBlockMode(curMi, aboveMi *NeighborMi, b int) common.PredictionMode { + if b == 0 || b == 1 { + if aboveMi == nil || isInterBlock(aboveMi) { + return common.DcPred + } + return GetYMode(aboveMi, b+2) + } + return curMi.Bmi[b-2].AsMode +} + +// GetYModeProbs mirrors libvpx's get_y_mode_probs — keyframe Y-mode +// probability lookup keyed by (above_mode, left_mode). Returns the +// 9-element probability row that drives ReadIntraMode. +func GetYModeProbs(curMi, aboveMi, leftMi *NeighborMi, block int) []uint8 { + above := AboveBlockMode(curMi, aboveMi, block) + left := LeftBlockMode(curMi, leftMi, block) + row := &tables.KfYModeProb[above][left] + return row[:] +} + +// ReadTxSize mirrors libvpx's read_tx_size. When the frame's TxMode +// is TxModeSelect AND the block is at least 8x8 AND the caller passed +// allowSelect=true, the per-block transform size is decoded from the +// boolean coder; otherwise it's clamped to the block's max via the +// frame-level TxMode-to-biggest-tx-size table. +func ReadTxSize(r *bitstream.Reader, fc *FrameContext, txMode common.TxMode, + bsize common.BlockSize, above, left *NeighborMi, allowSelect bool, +) common.TxSize { + maxTxSize := common.MaxTxsizeLookup[bsize] + if allowSelect && txMode == common.TxModeSelect && bsize >= common.Block8x8 { + ctx := GetTxSizeContext(above, left, maxTxSize) + probs := getTxProbsRow(&fc.TxProbs, maxTxSize, ctx) + return ReadSelectedTxSize(r, maxTxSize, probs) + } + cap := common.TxModeToBiggestTxSize[txMode] + if maxTxSize < cap { + return maxTxSize + } + return cap +} + +// getTxProbsRow mirrors libvpx's get_tx_probs — selects the +// per-max-tx-size probability row out of TxProbs. Returns a slice +// aliasing the matching fixed-size sub-array (no allocation). +func getTxProbsRow(p *TxProbs, maxTxSize common.TxSize, ctx int) []uint8 { + switch maxTxSize { + case common.Tx8x8: + return p.P8x8[ctx][:] + case common.Tx16x16: + return p.P16x16[ctx][:] + case common.Tx32x32: + return p.P32x32[ctx][:] + } + return nil +} + +// ReadIntraBlockModeInfo mirrors libvpx's intra-block mode-info +// fragment from read_intra_frame_mode_info — the per-bsize Y-mode +// dispatch plus the UV-mode read. `out` is updated in place; callers +// pre-populate sb_type, ref_frame, and the side-channel signals. +// +// Layout per libvpx's switch: +// - BLOCK_4X4: 4 sub-modes; mi->mode = bmi[3]. +// - BLOCK_4X8: bmi[0]=bmi[2] from block 0, bmi[1]=bmi[3]=mode from block 1. +// - BLOCK_8X4: bmi[0]=bmi[1] from block 0, bmi[2]=bmi[3]=mode from block 2. +// - else: single mode from block 0. +// +// In every case `mi->uv_mode = read_intra_mode(r, kf_uv_mode_prob[mi->mode])` +// follows the Y dispatch. +func ReadIntraBlockModeInfo(r *bitstream.Reader, out *NeighborMi, + aboveMi, leftMi *NeighborMi, +) (uvMode common.PredictionMode) { + switch out.SbType { + case common.Block4x4: + for i := range 4 { + out.Bmi[i].AsMode = ReadIntraMode(r, GetYModeProbs(out, aboveMi, leftMi, i)) + } + out.Mode = out.Bmi[3].AsMode + case common.Block4x8: + out.Bmi[0].AsMode = ReadIntraMode(r, GetYModeProbs(out, aboveMi, leftMi, 0)) + out.Bmi[2].AsMode = out.Bmi[0].AsMode + out.Bmi[1].AsMode = ReadIntraMode(r, GetYModeProbs(out, aboveMi, leftMi, 1)) + out.Bmi[3].AsMode = out.Bmi[1].AsMode + out.Mode = out.Bmi[1].AsMode + case common.Block8x4: + out.Bmi[0].AsMode = ReadIntraMode(r, GetYModeProbs(out, aboveMi, leftMi, 0)) + out.Bmi[1].AsMode = out.Bmi[0].AsMode + out.Bmi[2].AsMode = ReadIntraMode(r, GetYModeProbs(out, aboveMi, leftMi, 2)) + out.Bmi[3].AsMode = out.Bmi[2].AsMode + out.Mode = out.Bmi[2].AsMode + default: + out.Mode = ReadIntraMode(r, GetYModeProbs(out, aboveMi, leftMi, 0)) + } + uvRow := &tables.KfUvModeProb[out.Mode] + uvMode = ReadIntraMode(r, uvRow[:]) + return uvMode +} + +// ReadIntraModeYInter mirrors libvpx's read_intra_mode_y. The +// size_group classification picks one of four probability rows. +func ReadIntraModeYInter(r *bitstream.Reader, fc *FrameContext, sizeGroup int) common.PredictionMode { + row := &fc.YModeProb[sizeGroup] + return ReadIntraMode(r, row[:]) +} + +// ReadIntraModeUvInter mirrors libvpx's read_intra_mode_uv. The UV +// probability row is keyed by the just-decoded Y mode. The fc keeps +// a 10x9 table; the keyframe path uses KfUvModeProb instead. +func ReadIntraModeUvInter(r *bitstream.Reader, fc *FrameContext, yMode common.PredictionMode) common.PredictionMode { + row := &fc.UvModeProb[yMode] + return ReadIntraMode(r, row[:]) +} + +// IntraFrameDriverArgs bundles the inputs to ReadIntraFrameModeInfo. +// `mi` holds the partially-populated MODE_INFO for the current block +// — SbType is read on entry; ref_frame / segment_id / skip / tx_size +// / Mode / Bmi / uv-mode are written out as the C source does. +type IntraFrameDriverArgs struct { + Reader *bitstream.Reader + Fc *FrameContext + Seg *SegmentationParams + Maps *IntraSegmentMaps + TxMode common.TxMode + MiOffset int + XMis, YMis int + Above *NeighborMi + Left *NeighborMi +} + +// IntraFrameModeInfoOut carries the per-block outputs of the +// keyframe intra-mode-info read. +type IntraFrameModeInfoOut struct { + UvMode common.PredictionMode +} + +// ReadIntraFrameModeInfo mirrors libvpx's read_intra_frame_mode_info +// — the full keyframe per-block driver. Decodes: +// +// 1. segment_id via ReadIntraSegmentId (gates on UpdateMap). +// 2. skip via ReadSkipWithSeg (gates on SEG_LVL_SKIP). +// 3. tx_size via ReadTxSize (gated by frame TxMode + sb_type). +// 4. ref_frame[0/1] forced to (IntraFrame, NoRefFrame). +// 5. Y/UV modes via ReadIntraBlockModeInfo (keyframe path, using +// KfYModeProb keyed by neighbor modes and KfUvModeProb keyed by +// the decoded Y mode). +// +// All side-effect writes land on `mi`; the returned struct surfaces +// signals (like uv_mode) that don't have a dedicated NeighborMi slot. +func ReadIntraFrameModeInfo(args IntraFrameDriverArgs, mi *NeighborMi) IntraFrameModeInfoOut { + mi.RefFrame[0] = IntraFrame + mi.RefFrame[1] = NoRefFrame + + segID := ReadIntraSegmentId(args.Reader, args.Seg, args.Maps, + args.MiOffset, args.XMis, args.YMis) + mi.SegmentID = uint8(segID) + mi.SegIDPredicted = uint8(segID) + + mi.Skip = uint8(ReadSkipWithSeg(args.Reader, args.Seg, segID, args.Fc, + args.Above, args.Left)) + + mi.TxSize = ReadTxSize(args.Reader, args.Fc, args.TxMode, mi.SbType, + args.Above, args.Left, true) + + uv := ReadIntraBlockModeInfo(args.Reader, mi, args.Above, args.Left) + return IntraFrameModeInfoOut{UvMode: uv} +} + +const ( + // NeedLeft, NeedAbove, NeedAboveRight mirror libvpx's anonymous + // enum at the top of vp9_reconintra.c. + NeedLeft = 1 << 1 + NeedAbove = 1 << 2 + NeedAboveRight = 1 << 3 +) + +// ExtendModes mirrors libvpx's extend_modes[INTRA_MODES] table. +// Indexed by PredictionMode in the intra range (DcPred..TmPred). +var ExtendModes = [common.IntraModes]uint8{ + NeedAbove | NeedLeft, // DcPred + NeedAbove, // VPred + NeedLeft, // HPred + NeedAboveRight, // D45Pred + NeedLeft | NeedAbove, // D135Pred + NeedLeft | NeedAbove, // D117Pred + NeedLeft | NeedAbove, // D153Pred + NeedLeft, // D207Pred + NeedAboveRight, // D63Pred + NeedLeft | NeedAbove, // TmPred +} diff --git a/internal/vp9/decoder/intra_build.go b/internal/vp9/decoder/intra_build.go new file mode 100644 index 0000000..a1c37de --- /dev/null +++ b/internal/vp9/decoder/intra_build.go @@ -0,0 +1,245 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/intra_build.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/dsp" +) + +// IntraPredFn matches the DSP intra-predictor signature. +type IntraPredFn func(dst []uint8, stride int, above, left []uint8) + +// IntraDcPredTable indexes the DC variant by (leftAvailable, +// aboveAvailable, tx_size). Mirrors libvpx's dc_pred[2][2][TX_SIZES] +// dispatch table: +// +// [0][0] Dc128 (no neighbors). +// [0][1] DcTop (only above available). +// [1][0] DcLeft (only left available). +// [1][1] Dc (both — the standard average). +var IntraDcPredTable = [2][2][common.TxSizes]IntraPredFn{ + { + {dsp.VpxDc128Predictor4x4, dsp.VpxDc128Predictor8x8, dsp.VpxDc128Predictor16x16, dsp.VpxDc128Predictor32x32}, + {dsp.VpxDcTopPredictor4x4, dsp.VpxDcTopPredictor8x8, dsp.VpxDcTopPredictor16x16, dsp.VpxDcTopPredictor32x32}, + }, + { + {dsp.VpxDcLeftPredictor4x4, dsp.VpxDcLeftPredictor8x8, dsp.VpxDcLeftPredictor16x16, dsp.VpxDcLeftPredictor32x32}, + {dsp.VpxDcPredictor4x4, dsp.VpxDcPredictor8x8, dsp.VpxDcPredictor16x16, dsp.VpxDcPredictor32x32}, + }, +} + +// IntraPredTable indexes the non-DC kernels by (mode, tx_size). +// Mirrors libvpx's pred[INTRA_MODES][TX_SIZES] dispatch table. +// Slot [DcPred] is unused — DC variants are picked from +// IntraDcPredTable. +var IntraPredTable = [common.IntraModes][common.TxSizes]IntraPredFn{ + {}, // DcPred — unused + {dsp.VpxVPredictor4x4, dsp.VpxVPredictor8x8, dsp.VpxVPredictor16x16, dsp.VpxVPredictor32x32}, + {dsp.VpxHPredictor4x4, dsp.VpxHPredictor8x8, dsp.VpxHPredictor16x16, dsp.VpxHPredictor32x32}, + {dsp.VpxD45Predictor4x4, dsp.VpxD45Predictor8x8, dsp.VpxD45Predictor16x16, dsp.VpxD45Predictor32x32}, + {dsp.VpxD135Predictor4x4, dsp.VpxD135Predictor8x8, dsp.VpxD135Predictor16x16, dsp.VpxD135Predictor32x32}, + {dsp.VpxD117Predictor4x4, dsp.VpxD117Predictor8x8, dsp.VpxD117Predictor16x16, dsp.VpxD117Predictor32x32}, + {dsp.VpxD153Predictor4x4, dsp.VpxD153Predictor8x8, dsp.VpxD153Predictor16x16, dsp.VpxD153Predictor32x32}, + {dsp.VpxD207Predictor4x4, dsp.VpxD207Predictor8x8, dsp.VpxD207Predictor16x16, dsp.VpxD207Predictor32x32}, + {dsp.VpxD63Predictor4x4, dsp.VpxD63Predictor8x8, dsp.VpxD63Predictor16x16, dsp.VpxD63Predictor32x32}, + {dsp.VpxTmPredictor4x4, dsp.VpxTmPredictor8x8, dsp.VpxTmPredictor16x16, dsp.VpxTmPredictor32x32}, +} + +// IntraEdgeRefs collects the neighbor-pixel slices the caller +// extracts from the source frame for the current block. Decouples +// the C pointer arithmetic from the Go port. +// +// - Above : `2*bs` bytes starting at (row-1, col). For modes +// that don't read above-right, only the first `bs` +// are consulted. +// - AboveLeft : the single byte at (row-1, col-1). Only consulted +// when both UpAvailable and LeftAvailable are true. +// - Left : `bs` bytes at (row+i, col-1) for i=0..bs-1. +// +// Caller is responsible for ensuring the slices have the right +// length when the corresponding need flag is set. +type IntraEdgeRefs struct { + Above []uint8 + AboveLeft uint8 + Left []uint8 +} + +// BuildIntraPredictorsArgs bundles every input the libvpx +// build_intra_predictors driver consults. Caller-supplied fields +// mirror the fragments libvpx pulls out of MACROBLOCKD / xd->plane. +type BuildIntraPredictorsArgs struct { + Dst []uint8 + DstStride int + Mode common.PredictionMode + TxSize common.TxSize + Edges IntraEdgeRefs + UpAvailable bool + LeftAvailable bool + RightAvailable bool + FrameWidth int + FrameHeight int + X0, Y0 int + MbToRightEdge int + MbToBottomEdge int +} + +// IntraPredictorScratch holds the temporary above/left edge buffers +// used by BuildIntraPredictorsWithScratch. Keep it caller-owned on hot +// paths so per-transform predictor dispatch stays allocation-free. +type IntraPredictorScratch struct { + Left [32]uint8 + Above [1 + 64]uint8 +} + +// BuildIntraPredictorsWithScratch is BuildIntraPredictors with +// caller-owned edge storage. It is the public decoder hot-path entry +// because indirect predictor dispatch can otherwise make local edge +// arrays escape to the heap. +func BuildIntraPredictorsWithScratch(a BuildIntraPredictorsArgs, scratch *IntraPredictorScratch) { + // aboveData[16] is the slot libvpx writes for above_row[-1]; we + // expose it as topLeft and pass aboveRow = aboveData[17:] to the + // kernel. Kernels that need the top-left byte read above[-1]; in + // Go we synthesize a buffer where index 0 is the corner byte and + // index 1..2*bs are the row. + if scratch == nil { + var local IntraPredictorScratch + scratch = &local + } + leftCol := scratch.Left[:] + aboveBuf := scratch.Above[:] // [0]=topLeft, [1:]=above row up to 2*bs + topLeft := uint8(127) + bs := 4 << uint(a.TxSize) + + need := ExtendModes[a.Mode] + + if need&NeedLeft != 0 { + if a.LeftAvailable { + ref := a.Edges.Left + if a.MbToBottomEdge < 0 { + if a.Y0+bs <= a.FrameHeight { + copy(leftCol[:bs], ref[:bs]) + } else { + extendBottom := min(a.FrameHeight-a.Y0, len(ref)) + last := uint8(0) + if extendBottom <= 0 { + if len(ref) > 0 { + last = ref[0] + } + } else { + copy(leftCol[:extendBottom], ref[:extendBottom]) + last = ref[extendBottom-1] + } + for i := max(extendBottom, 0); i < bs; i++ { + leftCol[i] = last + } + } + } else { + copy(leftCol[:bs], ref[:bs]) + } + } else { + fillByte(leftCol[:bs], 129) + } + } + + if need&(NeedAbove|NeedAboveRight) != 0 { + row := aboveBuf[1:] // exposed as the "above" slice; index 0 mirrors above_row[-1]. + need2bs := need&NeedAboveRight != 0 + span := bs + if need2bs { + span = 2 * bs + } + + if a.UpAvailable { + ref := a.Edges.Above + if a.MbToRightEdge < 0 { + switch { + case a.X0+span <= a.FrameWidth: + copy(row[:span], ref[:span]) + case a.X0+bs <= a.FrameWidth: + if need2bs { + r := a.FrameWidth - a.X0 + if a.RightAvailable && bs == 4 { + copy(row[:r], ref[:r]) + fillByte(row[r:span], row[r-1]) + } else { + copy(row[:bs], ref[:bs]) + fillByte(row[bs:span], row[bs-1]) + } + } else { + r := a.FrameWidth - a.X0 + copy(row[:r], ref[:r]) + fillByte(row[r:span], row[r-1]) + } + case a.X0 <= a.FrameWidth: + r := a.FrameWidth - a.X0 + copy(row[:r], ref[:r]) + if r > 0 { + fillByte(row[r:span], row[r-1]) + } + } + } else { + if need2bs { + if bs == 4 && a.RightAvailable && a.LeftAvailable { + copy(row[:span], ref[:span]) + } else { + copy(row[:bs], ref[:bs]) + if bs == 4 && a.RightAvailable { + copy(row[bs:span], ref[bs:span]) + } else { + fillByte(row[bs:span], row[bs-1]) + } + } + } else { + copy(row[:bs], ref[:bs]) + } + } + if a.LeftAvailable { + topLeft = a.Edges.AboveLeft + } else { + topLeft = 129 + } + } else { + fillByte(row[:span], 127) + topLeft = 127 + } + } + + aboveBuf[0] = topLeft + // DSP intra-pred kernels expect a slice where [0] is the + // top-left corner byte and [1..] is the above row. The kernels + // internally do `above[1:]` to strip the corner. We hand them + // the corner-prefixed slice directly. + aboveSlice := aboveBuf[0 : 1+2*bs] + leftSlice := leftCol[:bs] + + if a.Mode == common.DcPred { + li := 0 + if a.LeftAvailable { + li = 1 + } + ai := 0 + if a.UpAvailable { + ai = 1 + } + IntraDcPredTable[li][ai][a.TxSize](a.Dst, a.DstStride, aboveSlice, leftSlice) + return + } + IntraPredTable[a.Mode][a.TxSize](a.Dst, a.DstStride, aboveSlice, leftSlice) +} + +// fillByte memsets `b` to `v` without runtime.memclr — keeps the +// hot path inlineable. +func fillByte(b []uint8, v uint8) { + for i := range b { + b[i] = v + } +} diff --git a/internal/vp9/decoder/inv_txfm.go b/internal/vp9/decoder/inv_txfm.go new file mode 100644 index 0000000..5147c49 --- /dev/null +++ b/internal/vp9/decoder/inv_txfm.go @@ -0,0 +1,146 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/inv_txfm.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/dsp" +) + +// VP9 inverse-transform dispatchers. Ported from libvpx v1.16.0 +// vp9/common/vp9_idct.c — vp9_idct{4x4,8x8,16x16,32x32}_add, +// vp9_iwht4x4_add, and the four vp9_iht{4x4,8x8,16x16}_add wrappers. +// +// Each function takes the dequantized coefficient block, picks the +// fast/slow DSP kernel by EOB, and writes the reconstructed pixels +// over the predictor block in-place (add). The dispatcher operates +// on the 8-bit profile. + +// Idct4x4Add mirrors libvpx's vp9_idct4x4_add. EOB > 1 selects the +// full 16-coeff kernel; EOB == 1 picks the DC-only fast path. +func Idct4x4Add(input []int16, dest []uint8, stride, eob int) { + if eob > 1 { + dsp.Idct4x4_16Add(input, dest, stride) + return + } + dsp.Idct4x4_1Add(input, dest, stride) +} + +// Iwht4x4Add mirrors libvpx's vp9_iwht4x4_add (lossless path). +func Iwht4x4Add(input []int16, dest []uint8, stride, eob int) { + if eob > 1 { + dsp.Iwht4x4_16Add(input, dest, stride) + return + } + dsp.Iwht4x4_1Add(input, dest, stride) +} + +// Idct8x8Add mirrors libvpx's vp9_idct8x8_add. EOB partitions: +// +// eob == 1: DC-only fast path. +// eob <= 12: upper-left 4x4 dense fast path. +// default: full 64-coeff kernel. +func Idct8x8Add(input []int16, dest []uint8, stride, eob int) { + switch { + case eob == 1: + dsp.Idct8x8_1Add(input, dest, stride) + case eob <= 12: + dsp.Idct8x8_12Add(input, dest, stride) + default: + dsp.Idct8x8_64Add(input, dest, stride) + } +} + +// Idct16x16Add mirrors libvpx's vp9_idct16x16_add. Four EOB tiers +// (1 / 10 / 38 / 256) pick progressively denser kernels. +func Idct16x16Add(input []int16, dest []uint8, stride, eob int) { + switch { + case eob == 1: + dsp.Idct16x16_1Add(input, dest, stride) + case eob <= 10: + dsp.Idct16x16_10Add(input, dest, stride) + case eob <= 38: + dsp.Idct16x16_38Add(input, dest, stride) + default: + dsp.Idct16x16_256Add(input, dest, stride) + } +} + +// Idct32x32Add mirrors libvpx's vp9_idct32x32_add. EOB tiers +// (1 / 34 / 135 / 1024). +func Idct32x32Add(input []int16, dest []uint8, stride, eob int) { + switch { + case eob == 1: + dsp.Idct32x32_1Add(input, dest, stride) + case eob <= 34: + dsp.Idct32x32_34Add(input, dest, stride) + case eob <= 135: + dsp.Idct32x32_135Add(input, dest, stride) + default: + dsp.Idct32x32_1024Add(input, dest, stride) + } +} + +// Iht4x4Add mirrors libvpx's vp9_iht4x4_add. The DCT_DCT case falls +// back to the EOB-cascaded Idct dispatcher; every other tx_type +// drives the full 16-coeff iht kernel directly (libvpx doesn't have +// EOB-tiered fast paths for the hybrid transforms). +func Iht4x4Add(txType common.TxType, input []int16, dest []uint8, stride, eob int) { + if txType == common.DctDct { + Idct4x4Add(input, dest, stride, eob) + return + } + dsp.Iht4x4_16Add(input, dest, stride, int(txType)) +} + +// Iht8x8Add mirrors libvpx's vp9_iht8x8_add. +func Iht8x8Add(txType common.TxType, input []int16, dest []uint8, stride, eob int) { + if txType == common.DctDct { + Idct8x8Add(input, dest, stride, eob) + return + } + dsp.Iht8x8_64Add(input, dest, stride, int(txType)) +} + +// Iht16x16Add mirrors libvpx's vp9_iht16x16_add. +func Iht16x16Add(txType common.TxType, input []int16, dest []uint8, stride, eob int) { + if txType == common.DctDct { + Idct16x16Add(input, dest, stride, eob) + return + } + dsp.Iht16x16_256Add(input, dest, stride, int(txType)) +} + +// InverseTransformBlock mirrors libvpx's inverse_transform_block_inter +// dispatch — the top-level call out of the reconstruct path. Picks +// the right DCT (lossless WHT for 4x4 + lossless) or hybrid IHT +// based on (txSize, txType) and the lossless flag. +// +// Caller supplies the per-block parameters; the dispatcher writes +// the residual on top of `dest`. +func InverseTransformBlock(input []int16, dest []uint8, stride int, + txSize common.TxSize, txType common.TxType, eob int, lossless bool, +) { + if lossless && txSize == common.Tx4x4 { + Iwht4x4Add(input, dest, stride, eob) + return + } + switch txSize { + case common.Tx4x4: + Iht4x4Add(txType, input, dest, stride, eob) + case common.Tx8x8: + Iht8x8Add(txType, input, dest, stride, eob) + case common.Tx16x16: + Iht16x16Add(txType, input, dest, stride, eob) + case common.Tx32x32: + Idct32x32Add(input, dest, stride, eob) + } +} diff --git a/internal/vp9/decoder/loopfilter_init.go b/internal/vp9/decoder/loopfilter_init.go new file mode 100644 index 0000000..915d61a --- /dev/null +++ b/internal/vp9/decoder/loopfilter_init.go @@ -0,0 +1,179 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/loopfilter_init.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" + "github.com/go-avkit/vpx/internal/vp9/dsp" +) + +// VP9 per-frame loopfilter init. Ported from libvpx v1.16.0 +// vp9/common/vp9_loopfilter.c — vp9_loop_filter_init, +// vp9_loop_filter_frame_init, and update_sharpness. +// +// LoopFilterInfoN holds the two derived tables the loopfilter +// kernels consult per block: +// - Lfthr[level]: (mblim, lim, hev_thr) thresholds for each of the +// 64 possible filter levels. +// - Lvl[seg][ref][mode]: the actual filter level to use for a +// given (segment, ref-frame, mode) tuple. The block's lookup +// reduces to a single byte fetch. + +const ( + // MaxLoopFilter mirrors MAX_LOOP_FILTER — the maximum filter + // level libvpx emits + the upper bound of the per-level + // threshold table. + MaxLoopFilter = 63 +) + +// LoopFilterThresh mirrors libvpx's loop_filter_thresh — three +// per-level limits. Stored as scalars; libvpx broadcasts each to a +// SIMD_WIDTH vector for the SIMD kernels but the value is the same +// in every lane. +// LoopFilterThresh aliases the DSP-level triplet so filter dispatch can +// hand kernel wrappers a single per-level pointer without copying. +type LoopFilterThresh = dsp.LfThresh + +// LoopFilterInfoN mirrors libvpx's loop_filter_info_n. +type LoopFilterInfoN struct { + Lfthr [MaxLoopFilter + 1]LoopFilterThresh + Lvl [MaxSegments][MaxRefFrames][MaxModeLfDeltas]uint8 + LastSharpnessLvl int8 // -1 sentinel forces update_sharpness on the first init. +} + +// NewLoopFilterInfoN returns a fresh LoopFilterInfoN with the +// last-sharpness sentinel set so the first call to +// LoopFilterFrameInit always rebuilds the lfthr table. +func NewLoopFilterInfoN() LoopFilterInfoN { + return LoopFilterInfoN{LastSharpnessLvl: -1} +} + +// LoopFilterInit mirrors libvpx's vp9_loop_filter_init. Seeds the +// per-level lfthr table (limit, mblim) from the sharpness and the +// hev_thr (= lvl >> 4) ladder. Should be called once when the +// LoopFilterInfoN buffer is allocated; subsequent calls to +// LoopFilterFrameInit refresh the limits if sharpness changed. +func LoopFilterInit(lfi *LoopFilterInfoN, sharpness int) { + updateSharpness(lfi, sharpness) + lfi.LastSharpnessLvl = int8(sharpness) + for lvl := 0; lvl <= MaxLoopFilter; lvl++ { + lfi.Lfthr[lvl].HevThr = uint8(lvl >> 4) + } +} + +// LoopFilterFrameInit mirrors vp9_loop_filter_frame_init. Builds +// the per-(seg, ref, mode) filter-level table from the frame-level +// default, the per-segment SEG_LVL_ALT_LF override, and the +// loop-filter mode/ref deltas. Also refreshes lfthr limits when the +// sharpness setting changes. +// +// `defaultFiltLvl` is libvpx's frame_filter_level (filter_level when +// no segment delta wins, clamped to [0, MAX_LOOP_FILTER]). +func LoopFilterFrameInit(lfi *LoopFilterInfoN, lf *LoopfilterParams, + seg *SegmentationParams, defaultFiltLvl int, +) { + if lfi.LastSharpnessLvl != int8(lf.SharpnessLevel) { + updateSharpness(lfi, int(lf.SharpnessLevel)) + lfi.LastSharpnessLvl = int8(lf.SharpnessLevel) + } + scale := 1 << uint(defaultFiltLvl>>5) + + for segID := range MaxSegments { + lvlSeg := defaultFiltLvl + if SegFeatureActive(seg, segID, SegLvlAltLf) { + data := int(GetSegData(seg, segID, SegLvlAltLf)) + if seg.AbsDelta { + lvlSeg = clampLfLvl(data) + } else { + lvlSeg = clampLfLvl(defaultFiltLvl + data) + } + } + + if !lf.ModeRefDeltaEnabled { + for ref := range MaxRefFrames { + for mode := range MaxModeLfDeltas { + lfi.Lvl[segID][ref][mode] = uint8(lvlSeg) + } + } + continue + } + + intraLvl := lvlSeg + int(lf.RefDeltas[IntraFrame])*scale + lfi.Lvl[segID][IntraFrame][0] = uint8(clampLfLvl(intraLvl)) + // libvpx leaves [INTRA_FRAME][1] untouched; we follow suit. + + for ref := LastFrame; ref < MaxRefFrames; ref++ { + for mode := range MaxModeLfDeltas { + interLvl := lvlSeg + + int(lf.RefDeltas[ref])*scale + + int(lf.ModeDeltas[mode])*scale + lfi.Lvl[segID][ref][mode] = uint8(clampLfLvl(interLvl)) + } + } + } +} + +func clampLfLvl(v int) int { + if v < 0 { + return 0 + } + if v > MaxLoopFilter { + return MaxLoopFilter + } + return v +} + +// ModeLfLut mirrors libvpx's mode_lf_lut[MB_MODE_COUNT]. Indexes +// the 2-element mode_deltas[] axis of LoopFilterInfoN.Lvl: +// +// - All intra modes (DC..TM) → 0. +// - NEARESTMV, NEARMV, NEWMV → 1. +// - ZEROMV → 0 (libvpx comment: "ZEROMV == 0"). +// +// Inter-mode classification matches the C source byte-for-byte. +var ModeLfLut = [14]uint8{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // intra modes 0..9 + 1, 1, 0, 1, // NEARESTMV, NEARMV, ZEROMV, NEWMV +} + +// GetFilterLevel mirrors libvpx's get_filter_level. Reduces the +// per-block loopfilter pick to a single byte fetch out of +// LoopFilterInfoN.Lvl, indexed by (segment, ref-frame[0], mode-lut). +func GetFilterLevel(lfi *LoopFilterInfoN, segID int, refFrame int8, mode common.PredictionMode) uint8 { + return lfi.Lvl[segID][refFrame][ModeLfLut[mode]] +} + +// updateSharpness mirrors libvpx's static update_sharpness. For each +// possible filter level it derives the inside-block limit (a function +// of `sharpness_lvl`) and stamps the (lim, mblim) pair. The hev_thr +// slot is left alone — LoopFilterInit seeded it once at init time. +func updateSharpness(lfi *LoopFilterInfoN, sharpnessLvl int) { + for lvl := 0; lvl <= MaxLoopFilter; lvl++ { + shift := 0 + if sharpnessLvl > 0 { + shift++ + } + if sharpnessLvl > 4 { + shift++ + } + blockInsideLimit := lvl >> uint(shift) + if sharpnessLvl > 0 { + if blockInsideLimit > 9-sharpnessLvl { + blockInsideLimit = 9 - sharpnessLvl + } + } + if blockInsideLimit < 1 { + blockInsideLimit = 1 + } + lfi.Lfthr[lvl].Lim = uint8(blockInsideLimit) + lfi.Lfthr[lvl].Mblim = uint8(2*(lvl+2) + blockInsideLimit) + } +} diff --git a/internal/vp9/decoder/mfqe.go b/internal/vp9/decoder/mfqe.go new file mode 100644 index 0000000..e3e1d76 --- /dev/null +++ b/internal/vp9/decoder/mfqe.go @@ -0,0 +1,101 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/mfqe.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import "github.com/go-avkit/vpx/internal/vp9/common" + +const ( + // MFQEPrecision mirrors libvpx vp9_postproc.h: weights live in 4-bit + // fixed point ([0,16]). + MFQEPrecision = 4 + // MFQEMvLenSquareThreshold is the libvpx vp9_mfqe.c:203 squared + // MV-length cap, in 1/8-pel units, below which MFQE is admitted on an + // inter block. + MFQEMvLenSquareThreshold = 100 + // MFQEQDiffThreshold is the libvpx vp9_postproc.c:32 SB-level MFQE + // q-difference precondition. + MFQEQDiffThreshold = 20 + // MFQELastQThreshold is the libvpx vp9_postproc.c:33 previous-frame + // quantizer precondition. + MFQELastQThreshold = 170 +) + +// MFQEDecision mirrors libvpx vp9_mfqe.c:198. Block must be inter +// (mode >= NEARESTMV), at least 16x16, and have a small enough MV +// (squared L2 <= 100 in 1/8-pel units). +func MFQEDecision(mi *NeighborMi, curBs common.BlockSize) bool { + row := int(mi.Mv[0].Row) + col := int(mi.Mv[0].Col) + mvLenSquare := row*row + col*col + return mi.Mode >= common.NearestMv && + curBs >= common.Block16x16 && + mvLenSquare <= MFQEMvLenSquareThreshold +} + +// MFQEThresholds returns the libvpx vp9_mfqe.c:147 block-size-conditioned +// SAD and vdiff thresholds for the MFQE block test. +func MFQEThresholds(bs common.BlockSize, qdiff int) (sadThr int, vdiffThr int) { + adj := qdiff >> MFQEPrecision + switch bs { + case common.Block16x16: + sadThr = 7 + adj + case common.Block32x32: + sadThr = 6 + adj + default: // Block64x64 + sadThr = 5 + adj + } + vdiffThr = 125 + qdiff + return +} + +// MFQESum2D returns sum and sum-of-squares-of-diffs over a width x height +// window. +func MFQESum2D(a []byte, aStride int, b []byte, bStride int, width int, height int) (sum int, sse int, sad int) { + for r := range height { + aRow := a[r*aStride:] + bRow := b[r*bStride:] + for c := range width { + diff := int(aRow[c]) - int(bRow[c]) + sum += diff + sse += diff * diff + if diff < 0 { + sad += -diff + } else { + sad += diff + } + } + } + return +} + +// MFQEBlockMetrics returns the libvpx-faithful vdiff and sad pair for a square +// block of side pixels, using the normalization in vp9_mfqe.c:168-177. +func MFQEBlockMetrics(side int, a []byte, aStride int, b []byte, bStride int) (vdiff int, sad int) { + sum, sse, sadRaw := MFQESum2D(a, aStride, b, bStride, side, side) + pels := side * side + variance := sse - (sum*sum)/pels + var round int + var shift int + switch side { + case 16: + round = 128 + shift = 8 + case 32: + round = 512 + shift = 10 + default: // 64 + round = 2048 + shift = 12 + } + vdiff = (variance + round) >> shift + sad = (sadRaw + round) >> shift + return +} diff --git a/internal/vp9/decoder/mode.go b/internal/vp9/decoder/mode.go new file mode 100644 index 0000000..3b2c4c9 --- /dev/null +++ b/internal/vp9/decoder/mode.go @@ -0,0 +1,51 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/mode.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// ReadIntraMode mirrors read_intra_mode. Picks one of 10 intra +// prediction modes from the supplied probability row. +func ReadIntraMode(r *bitstream.Reader, probs []uint8) common.PredictionMode { + return common.PredictionMode(r.ReadTree(common.IntraModeTree[:], probs)) +} + +var interModeFromUnary = [4]common.PredictionMode{ + common.ZeroMv, + common.NearestMv, + common.NearMv, + common.NewMv, +} + +// ReadInterMode mirrors read_inter_mode. Returns the absolute +// PredictionMode (NEARESTMV..NEWMV), having added the NEARESTMV +// offset that the InterModeTree leaves omit. +func ReadInterMode(r *bitstream.Reader, interModeProbs [common.InterModes - 1]uint8) common.PredictionMode { + return interModeFromUnary[r.ReadUnary3(uint32(interModeProbs[0]), uint32(interModeProbs[1]), uint32(interModeProbs[2]))] +} + +// ReadSelectedTxSize mirrors read_selected_tx_size — the multi-bit +// transform-size selector used when TxMode = TxModeSelect and the +// block is at least 8x8. `txProbs` is the 3-element probability row +// selected by (max_tx_size, ctx). +func ReadSelectedTxSize(r *bitstream.Reader, maxTxSize common.TxSize, txProbs []uint8) common.TxSize { + tx := common.TxSize(r.Read(uint32(txProbs[0]))) + if tx != common.Tx4x4 && maxTxSize >= common.Tx16x16 { + tx += common.TxSize(r.Read(uint32(txProbs[1]))) + if tx != common.Tx8x8 && maxTxSize >= common.Tx32x32 { + tx += common.TxSize(r.Read(uint32(txProbs[2]))) + } + } + return tx +} diff --git a/internal/vp9/decoder/mv.go b/internal/vp9/decoder/mv.go new file mode 100644 index 0000000..9f6a047 --- /dev/null +++ b/internal/vp9/decoder/mv.go @@ -0,0 +1,311 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/mv.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// MV is the int16 row/col pair libvpx carries through reconstruction. +// Matches the union MV layout in vpx_dsp/vpx_filter.h (row then col). +type MV struct { + Row int16 + Col int16 +} + +// ReadMvComponent mirrors libvpx's read_mv_component. +// +// Decodes one axis of an MV delta. The encoded value is sign-magnitude +// with: +// - sign bit +// - class (1..10 via mv_class_tree, plus class-0 fast path) +// - integer-part magnitude +// - fractional pel (mv_fp_tree) +// - optional eighth-pel bit +// +// `usehp` gates the eighth-pel bit; when false the high-precision +// component defaults to 1, exactly as libvpx does. +func ReadMvComponent(r *bitstream.Reader, c *NmvComponent, usehp bool) int { + sign := r.Read(uint32(c.Sign)) + mvClass := r.ReadTree(tables.MvClassTree[:], c.Classes[:]) + class0 := mvClass == tables.MvClass0 + + var d, mag int + if class0 { + d = int(r.Read(uint32(c.Class0[0]))) + mag = 0 + } else { + n := mvClass + Class0Bits - 1 + for i := range n { + d |= int(r.Read(uint32(c.Bits[i]))) << uint(i) + } + mag = Class0Size << uint(mvClass+2) + } + + var fr int + if class0 { + fr = r.ReadTree(tables.MvFpTree[:], c.Class0Fp[d][:]) + } else { + fr = r.ReadTree(tables.MvFpTree[:], c.Fp[:]) + } + + hp := 1 + if usehp { + if class0 { + hp = int(r.Read(uint32(c.Class0Hp))) + } else { + hp = int(r.Read(uint32(c.Hp))) + } + } + + mag += ((d << 3) | (fr << 1) | hp) + 1 + if sign != 0 { + return -mag + } + return mag +} + +// ReadMv mirrors libvpx's read_mv. Decodes a joint, then up to two +// axis components, applies the delta against `ref`, and writes the +// result to `mv`. `allowHp` is the frame-level allow-high-precision +// flag; libvpx then ANDs it with use_mv_hp(ref) — we follow the same +// gate (a magnitude check on ref against COMPANDED_MVREF_THRESH). +func ReadMv(r *bitstream.Reader, mv, ref *MV, ctx *NmvContext, allowHp bool) { + rs := r.LocalState() + buf, _, _, pos := rs.BitView() + if len(buf)-pos > 56 { + value := rs.Value + rng := rs.Range + count := rs.Count + useHp := allowHp && useMvHp(ref) + var joint int + joint, pos, value, rng, count = readUnary3Fast(buf, pos, value, rng, count, + uint32(ctx.Joints[0]), uint32(ctx.Joints[1]), uint32(ctx.Joints[2])) + var diff MV + if mvJointVertical(joint) { + var v int + v, pos, value, rng, count = readMvComponentFast(buf, pos, value, rng, count, &ctx.Comps[0], useHp) + diff.Row = int16(v) + } + if mvJointHorizontal(joint) { + var v int + v, pos, value, rng, count = readMvComponentFast(buf, pos, value, rng, count, &ctx.Comps[1], useHp) + diff.Col = int16(v) + } + rs.Value = value + rs.Range = rng + rs.Count = count + rs.CommitPos(pos) + rs.Commit() + mv.Row = ref.Row + diff.Row + mv.Col = ref.Col + diff.Col + return + } + joint := r.ReadUnary3(uint32(ctx.Joints[0]), uint32(ctx.Joints[1]), uint32(ctx.Joints[2])) + useHp := allowHp && useMvHp(ref) + + var diff MV + if mvJointVertical(joint) { + diff.Row = int16(ReadMvComponent(r, &ctx.Comps[0], useHp)) + } + if mvJointHorizontal(joint) { + diff.Col = int16(ReadMvComponent(r, &ctx.Comps[1], useHp)) + } + + mv.Row = ref.Row + diff.Row + mv.Col = ref.Col + diff.Col +} + +func readUnary3Fast(buf []byte, pos int, value uint64, rng uint32, count int32, p0, p1, p2 uint32) (int, int, uint64, uint32, int32) { + if count < 24 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var b bool + b, value, rng, count = vpxReadBoolNoFill(p0, value, rng, count) + if !b { + return 0, pos, value, rng, count + } + b, value, rng, count = vpxReadBoolNoFill(p1, value, rng, count) + if !b { + return 1, pos, value, rng, count + } + b, value, rng, count = vpxReadBoolNoFill(p2, value, rng, count) + if !b { + return 2, pos, value, rng, count + } + return 3, pos, value, rng, count +} + +func readMvComponentFast(buf []byte, pos int, value uint64, rng uint32, count int32, c *NmvComponent, usehp bool) (int, int, uint64, uint32, int32) { + if count < 16 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var sign, b bool + sign, value, rng, count = vpxReadBoolNoFill(uint32(c.Sign), value, rng, count) + // Walk MvClassTree in registers. + i := int8(0) + var mvClass int + for { + if count < 8 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(c.Classes[i>>1]), value, rng, count) + bi := 0 + if b { + bi = 1 + } + next := tables.MvClassTree[int(i)+bi] + if next <= 0 { + mvClass = -int(next) + break + } + i = next + } + class0 := mvClass == tables.MvClass0 + var d, mag int + if class0 { + if count < 8 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(c.Class0[0]), value, rng, count) + if b { + d = 1 + } + } else { + n := mvClass + Class0Bits - 1 + for k := range n { + if count < 8 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + b, value, rng, count = vpxReadBoolNoFill(uint32(c.Bits[k]), value, rng, count) + if b { + d |= 1 << uint(k) + } + } + mag = Class0Size << uint(mvClass+2) + } + var fr int + if class0 { + fp := &c.Class0Fp[d] + fr, pos, value, rng, count = readUnary3Fast(buf, pos, value, rng, count, uint32(fp[0]), uint32(fp[1]), uint32(fp[2])) + } else { + fp := &c.Fp + fr, pos, value, rng, count = readUnary3Fast(buf, pos, value, rng, count, uint32(fp[0]), uint32(fp[1]), uint32(fp[2])) + } + hp := 1 + if usehp { + if count < 8 { + value, count, pos = bitstream.FillFast(buf, pos, value, count) + } + var hpProb uint32 + if class0 { + hpProb = uint32(c.Class0Hp) + } else { + hpProb = uint32(c.Hp) + } + b, value, rng, count = vpxReadBoolNoFill(hpProb, value, rng, count) + if !b { + hp = 0 + } + } + mag += ((d << 3) | (fr << 1) | hp) + 1 + if sign { + return -mag, pos, value, rng, count + } + return mag, pos, value, rng, count +} + +// mvJointVertical: joint has a non-zero vertical component. +// Mirrors mv_joint_vertical (joint == MV_JOINT_HZVNZ || HNZVNZ). +func mvJointVertical(joint int) bool { + return joint == tables.MvJointHzVnz || joint == tables.MvJointHnzVnz +} + +// mvJointHorizontal: joint has a non-zero horizontal component. +// Mirrors mv_joint_horizontal (joint == MV_JOINT_HNZVZ || HNZVNZ). +func mvJointHorizontal(joint int) bool { + return joint == tables.MvJointHnzVz || joint == tables.MvJointHnzVnz +} + +// kMvRefThresh from vp9_entropymv.h. MV units are eighth-pel, so libvpx +// keeps the high-precision bit for references within eight pixels. +const compandedMvrefThresh = 64 + +// useMvHp mirrors use_mv_hp from vp9_entropymv.h: high-precision MVs +// are only enabled when the reference is close enough to the origin. +func useMvHp(ref *MV) bool { + return absInt16(ref.Row) < compandedMvrefThresh && + absInt16(ref.Col) < compandedMvrefThresh +} + +func absInt16(v int16) int16 { + if v < 0 { + return -v + } + return v +} + +// MV magnitude limits from vp9_entropymv.h. The boolean coder +// represents an MV component as int16; the bounds keep the magnitude +// inside ±MV_UPP so encoder + decoder paths stay in lock-step on +// what range gets emitted. +const ( + MvInUseBits = 14 + MvUpp = (1 << MvInUseBits) - 1 + MvLow = -(1 << MvInUseBits) +) + +// LowerMvPrecision mirrors lower_mv_precision in vp9_mvref_common.h. +// When the high-precision MV gate is closed (either by the frame +// flag OR by use_mv_hp(ref) on the candidate) any odd low bit gets +// stripped, rounding toward zero. The libvpx implementation lives +// on the candidate MV before assign_mv consults it. +func LowerMvPrecision(mv *MV, allowHp bool) { + useHp := allowHp && useMvHp(mv) + if useHp { + return + } + if mv.Row&1 != 0 { + if mv.Row > 0 { + mv.Row -= 1 + } else { + mv.Row += 1 + } + } + if mv.Col&1 != 0 { + if mv.Col > 0 { + mv.Col -= 1 + } else { + mv.Col += 1 + } + } +} + +// ClampMv mirrors libvpx's clamp_mv. Saturates the (row,col) pair +// into the supplied bounding box, expressed in 1/8-pel units like +// the rest of the MV pipeline. +func ClampMv(mv *MV, minCol, maxCol, minRow, maxRow int32) { + r := int32(mv.Row) + c := int32(mv.Col) + if r < minRow { + r = minRow + } else if r > maxRow { + r = maxRow + } + if c < minCol { + c = minCol + } else if c > maxCol { + c = maxCol + } + mv.Row = int16(r) + mv.Col = int16(c) +} diff --git a/internal/vp9/decoder/partition.go b/internal/vp9/decoder/partition.go new file mode 100644 index 0000000..50a939d --- /dev/null +++ b/internal/vp9/decoder/partition.go @@ -0,0 +1,129 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/partition.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// VP9 partition-tree decode primitives. Ported from libvpx v1.16.0 +// vp9/decoder/vp9_decodeframe.c (read_partition, +// dec_partition_plane_context) and vp9/common/vp9_onyxc_int.h +// (partition_plane_context). + +// PartitionPlaneContext computes the 4-state partition context from +// the partition-history bits stored in the above-row and left-column +// segmentation contexts. Mirrors partition_plane_context. +// +// `aboveSegCtx` and `leftSegCtx` are caller-owned arrays sized to the +// frame's mi-column count (above) and MI_BLOCK_SIZE (= 8, left). +// `bsize` selects the bit position; the result is in +// [0, PARTITION_CONTEXTS). +func PartitionPlaneContext(aboveSegCtx, leftSegCtx []int8, miRow, miCol int, bsize common.BlockSize) int { + bsl := common.MiWidthLog2Lookup[bsize] + above := (int(aboveSegCtx[miCol]) >> bsl) & 1 + left := (int(leftSegCtx[miRow&common.MiMask]) >> bsl) & 1 + return left*2 + above + int(bsl)*common.PartitionPloffset +} + +// UpdatePartitionContext mirrors libvpx's +// dec_update_partition_context. After a partition decision is made +// at a given (miRow, miCol, subsize, bw), the partition-history bits +// above and to the left of the current tile slot are stamped with +// the per-subsize "above" / "left" partition_context_lookup values. +// Mirrors the dual-memset libvpx does at the end of read_partition's +// caller. +// +// `bw` is the count of 8x8 columns the subsize spans (1, 2, 4, or 8). +func UpdatePartitionContext(aboveSegCtx, leftSegCtx []int8, miRow, miCol int, subsize common.BlockSize, bw int) { + ent := common.PartitionContextLookup[subsize] + av := int8(ent.Above) + lv := int8(ent.Left) + a := aboveSegCtx[miCol : miCol+bw] + lOff := miRow & common.MiMask + l := leftSegCtx[lOff : lOff+bw] + switch bw { + case 1: + a[0] = av + l[0] = lv + case 2: + a[0], a[1] = av, av + l[0], l[1] = lv, lv + case 4: + _ = a[3] + _ = l[3] + a[0], a[1], a[2], a[3] = av, av, av, av + l[0], l[1], l[2], l[3] = lv, lv, lv, lv + case 8: + _ = a[7] + _ = l[7] + a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7] = av, av, av, av, av, av, av, av + l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7] = lv, lv, lv, lv, lv, lv, lv, lv + default: + for i := range a { + a[i] = av + } + for i := range l { + l[i] = lv + } + } +} + +// TileBounds carries the per-tile mi-coordinate bounds the recursive +// partition walk consults. Mirrors libvpx's TileInfo.mi_col_start / +// mi_col_end pair plus the frame-level mi_rows / mi_cols fallback +// row gate. +type TileBounds struct { + MiColStart int + MiColEnd int + MiRowStart int + MiRowEnd int +} + +// IsInside mirrors libvpx's is_inside in vp9_mvref_common.h. Returns +// true iff (miRow + miPos.Row, miCol + miPos.Col) lands inside the +// tile + frame bounds — the gate the MV-ref candidate scan and the +// recursive partition walk use to skip out-of-tile neighbors. +// +// `miRows` is the frame-level cm->mi_rows; libvpx also bounds with +// cm->mi_rows above and the tile-relative miColStart/miColEnd below. +func IsInside(tile TileBounds, miRows, miRow, miCol int, posRow, posCol int) bool { + r := miRow + posRow + c := miCol + posCol + return r >= 0 && c >= tile.MiColStart && r < miRows && c < tile.MiColEnd +} + +// ReadPartition mirrors read_partition. The (hasRows, hasCols) flags +// describe whether the inner halves of the current block fit inside +// the frame; when one or both don't fit, the partition decode falls +// back to a 1-bit branch or is forced to SPLIT. +// +// `probs` is the 3-element partition-prob row for the active context +// (caller-loaded from FrameContext.PartitionProb[ctx]). +func ReadPartition(r *bitstream.Reader, probs []uint8, hasRows, hasCols bool) common.PartitionType { + switch { + case hasRows && hasCols: + return common.PartitionType(r.ReadUnary3(uint32(probs[0]), uint32(probs[1]), uint32(probs[2]))) + case !hasRows && hasCols: + if r.Read(uint32(probs[1])) != 0 { + return common.PartitionSplit + } + return common.PartitionHorz + case hasRows && !hasCols: + if r.Read(uint32(probs[2])) != 0 { + return common.PartitionSplit + } + return common.PartitionVert + default: + return common.PartitionSplit + } +} diff --git a/internal/vp9/decoder/plane.go b/internal/vp9/decoder/plane.go new file mode 100644 index 0000000..d13715b --- /dev/null +++ b/internal/vp9/decoder/plane.go @@ -0,0 +1,160 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/plane.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// MaxMbPlane mirrors libvpx's MAX_MB_PLANE — 3 planes (Y, U, V). +const MaxMbPlane = 3 + +// MacroblockdPlane mirrors the parser-visible subset of libvpx's +// struct macroblockd_plane: the chroma-subsampling pair (0 for luma +// or 4:4:4 chroma, 1 for the subsampled chroma axes) plus the two +// entropy-context buffers a tile pass updates per super-block row. +// +// Caller owns AboveContext and LeftContext; the per-frame setup +// allocates them sized to the frame's column count (above) and +// MI_BLOCK_SIZE (left). +type MacroblockdPlane struct { + SubsamplingX uint8 + SubsamplingY uint8 + + // EntropyContext arrays carry per-4x4-block "has-residual" bits + // for the coefficient-context update path. ENTROPY_CONTEXT is + // uint8 in libvpx. + AboveContext []uint8 + LeftContext []uint8 +} + +// GetPlaneBlockSize mirrors get_plane_block_size — projects a luma +// BlockSize onto the chroma plane using the (subsampling_x, +// subsampling_y) pair from the plane. +func GetPlaneBlockSize(bsize common.BlockSize, pd *MacroblockdPlane) common.BlockSize { + if bsize >= common.BlockSizes || pd.SubsamplingX > 1 || pd.SubsamplingY > 1 { + return common.BlockInvalid + } + return common.SsSizeLookup[bsize][pd.SubsamplingX][pd.SubsamplingY] +} + +// GetUvTxSize mirrors get_uv_tx_size — picks the chroma plane's +// transform size from the (sb_type, luma tx_size) pair via the +// per-subsampling UV lookup table. +func GetUvTxSize(sbType common.BlockSize, lumaTxSize common.TxSize, pd *MacroblockdPlane) common.TxSize { + if sbType >= common.BlockSizes || lumaTxSize >= common.TxSizes || + pd.SubsamplingX > 1 || pd.SubsamplingY > 1 { + return common.Tx4x4 + } + return common.UvTxsizeLookup[sbType][lumaTxSize][pd.SubsamplingX][pd.SubsamplingY] +} + +// GetEntropyContext mirrors libvpx's get_entropy_context. Combines +// the above and left entropy-context windows for the given tx size +// — non-zero in any byte makes that axis "1", and the result is the +// sum across axes (0..2). The window width is (1 << txSize) bytes +// (1 for 4x4, 2 for 8x8, 4 for 16x16, 8 for 32x32). +func GetEntropyContext(txSize common.TxSize, aboveCtx, leftCtx []uint8) int { + n := 1 << uint(txSize) + above := 0 + for i := 0; i < n && i < len(aboveCtx); i++ { + if aboveCtx[i] != 0 { + above = 1 + break + } + } + left := 0 + for i := 0; i < n && i < len(leftCtx); i++ { + if leftCtx[i] != 0 { + left = 1 + break + } + } + return above + left +} + +// GetEntropyContextFull is GetEntropyContext for callers that have already +// sliced both context windows to exactly 1<= common.BlockSizes { + continue + } + bw := int(common.Num4x4BlocksWideLookup[planeBsize]) + bh := int(common.Num4x4BlocksHighLookup[planeBsize]) + if i < len(aboveOffsets) && len(pd.AboveContext) >= aboveOffsets[i]+bw { + for j := range bw { + pd.AboveContext[aboveOffsets[i]+j] = 0 + } + } + if i < len(leftOffsets) && len(pd.LeftContext) >= leftOffsets[i]+bh { + for j := range bh { + pd.LeftContext[leftOffsets[i]+j] = 0 + } + } + } +} + +// SetupBlockPlanes mirrors vp9_setup_block_planes — assigns the +// (ssX, ssY) pair to the chroma planes (slot 0 is luma; slots 1 and +// 2 carry the subsampling for U / V). The above/left context buffers +// are caller-supplied (or left nil for tests that don't drive the +// coefficient-context update path). +func SetupBlockPlanes(planes *[MaxMbPlane]MacroblockdPlane, ssX, ssY uint8) { + for i := range planes { + if i == 0 { + planes[i].SubsamplingX = 0 + planes[i].SubsamplingY = 0 + } else { + planes[i].SubsamplingX = ssX + planes[i].SubsamplingY = ssY + } + } +} diff --git a/internal/vp9/decoder/pred_common.go b/internal/vp9/decoder/pred_common.go new file mode 100644 index 0000000..9e4c6b1 --- /dev/null +++ b/internal/vp9/decoder/pred_common.go @@ -0,0 +1,539 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/pred_common.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import "github.com/go-avkit/vpx/internal/vp9/common" + +// VP9 neighbor-context helpers. Ported from libvpx v1.16.0 +// vp9/common/vp9_pred_common.{h,c}. These small functions sample the +// already-decoded above / left blocks to pick a context index into the +// frame's probability tables for every per-block boolean-coded signal: +// intra/inter, skip, switchable interp filter, tx-size, segment id, +// and the reference-frame selectors. +// +// NeighborMi is a lightweight view of the fields these helpers touch +// inside libvpx's struct MODE_INFO. The full struct carries the +// motion-vector cache, BMI quartet, and prediction-state flags; here we +// expose the subset the parser, context helpers, and first reconstruction +// slices read. +// +// A nil NeighborMi means the neighbor is outside the picture or not +// yet decoded — libvpx's "one-element border" of zero-initialized +// MODE_INFO. Helpers branch on (above != nil, left != nil) accordingly. + +// VP9 reference-frame codes, mirroring vp9_blockd.h. NoRefFrame is the +// sentinel libvpx writes into ref_frame[1] for single-ref blocks. +const ( + NoRefFrame = -1 + IntraFrame = 0 + LastFrame = 1 + GoldenFrame = 2 + AltrefFrame = 3 + MaxRefFrames = 4 +) + +// NeighborMi mirrors the subset of libvpx's MODE_INFO that the +// neighbor-context helpers read. Field types match libvpx widths so a +// future full ModeInfo type can embed or alias this view. +// +// Bmi[i].AsMode mirrors libvpx's b_mode_info.as_mode quartet — +// populated for sub-8x8 intra partitions (BLOCK_4X4 / 4X8 / 8X4) and +// referenced by [[GetYMode]] / [[LeftBlockMode]] / [[AboveBlockMode]]. +type NeighborMi struct { + SbType common.BlockSize + TxSize common.TxSize + InterpFilter uint8 + Skip uint8 + SegmentID uint8 + SegIDPredicted uint8 + Mode common.PredictionMode + RefFrame [2]int8 // ref_frame[0..1] — NoRefFrame when unused + Mv [2]MV + Bmi [4]Bmi +} + +// Bmi mirrors libvpx's b_mode_info — the per-4x4-subblock side of a +// MODE_INFO. Carries the per-subblock intra mode (as_mode) and the +// per-ref motion vector pair (as_mv) for sub-8x8 inter partitions. +type Bmi struct { + AsMode common.PredictionMode + AsMv [2]MV +} + +// isInterBlock mirrors libvpx's is_inter_block(MODE_INFO*). +func isInterBlock(mi *NeighborMi) bool { return mi != nil && mi.RefFrame[0] > IntraFrame } + +// hasSecondRef mirrors libvpx's has_second_ref(MODE_INFO*). +func hasSecondRef(mi *NeighborMi) bool { return mi != nil && mi.RefFrame[1] > IntraFrame } + +// GetPredContextSegId mirrors vp9_get_pred_context_seg_id — adds the +// "segment id was predicted" flag from above and left. +func GetPredContextSegId(above, left *NeighborMi) int { + a := 0 + if above != nil { + a = int(above.SegIDPredicted) + } + l := 0 + if left != nil { + l = int(left.SegIDPredicted) + } + return a + l +} + +// GetSkipContext mirrors vp9_get_skip_context — sums the skip flags +// of above and left. +func GetSkipContext(above, left *NeighborMi) int { + a := 0 + if above != nil { + a = int(above.Skip) + } + l := 0 + if left != nil { + l = int(left.Skip) + } + return a + l +} + +// GetPredContextSwitchableInterp mirrors +// get_pred_context_switchable_interp from vp9_pred_common.h. The +// returned context indexes cm->fc->switchable_interp_prob. +func GetPredContextSwitchableInterp(above, left *NeighborMi) int { + leftType := int(SwitchableFilters) + if left != nil { + leftType = int(left.InterpFilter) + } + aboveType := int(SwitchableFilters) + if above != nil { + aboveType = int(above.InterpFilter) + } + switch { + case leftType == aboveType: + return leftType + case leftType == SwitchableFilters: + return aboveType + case aboveType == SwitchableFilters: + return leftType + default: + return SwitchableFilters + } +} + +// GetIntraInterContext mirrors get_intra_inter_context. The 4-state +// context encodes the intra/inter mix of the above/left pair: +// +// 0 - inter/inter, inter/--, --/inter, --/-- +// 1 - intra/inter, inter/intra +// 2 - intra/--, --/intra +// 3 - intra/intra +func GetIntraInterContext(above, left *NeighborMi) int { + hasAbove := above != nil + hasLeft := left != nil + switch { + case hasAbove && hasLeft: + aboveIntra := !isInterBlock(above) + leftIntra := !isInterBlock(left) + if leftIntra && aboveIntra { + return 3 + } + if leftIntra || aboveIntra { + return 1 + } + return 0 + case hasAbove || hasLeft: + edge := above + if !hasAbove { + edge = left + } + if !isInterBlock(edge) { + return 2 + } + return 0 + default: + return 0 + } +} + +// GetTxSizeContext mirrors get_tx_size_context. Returns 0 or 1 +// depending on whether the average tx-size of above+left exceeds +// max_tx_size. Caller supplies max_tx_size for the current block +// (libvpx computes it from sb_type via max_txsize_lookup). +func GetTxSizeContext(above, left *NeighborMi, maxTxSize common.TxSize) int { + hasAbove := above != nil + hasLeft := left != nil + aboveCtx := int(maxTxSize) + if hasAbove && above.Skip == 0 { + aboveCtx = int(above.TxSize) + } + leftCtx := int(maxTxSize) + if hasLeft && left.Skip == 0 { + leftCtx = int(left.TxSize) + } + if !hasLeft { + leftCtx = aboveCtx + } + if !hasAbove { + aboveCtx = leftCtx + } + if (aboveCtx + leftCtx) > int(maxTxSize) { + return 1 + } + return 0 +} + +// CompoundFrameRefs carries the two compound-reference assignments +// libvpx maintains on VP9_COMMON. CompFixedRef is the "fixed" half, +// CompVarRef the two alternatives the variable half ranges over. +type CompoundFrameRefs struct { + CompFixedRef int8 + CompVarRef [2]int8 +} + +// CompoundReferenceAllowed mirrors vp9_compound_reference_allowed. +// Returns true iff the three forward/backward ref frames have at +// least one direction-flip in their sign-bias table. +func CompoundReferenceAllowed(signBias [MaxRefFrames]uint8) bool { + for i := 1; i < 3; i++ { + if signBias[i+1] != signBias[1] { + return true + } + } + return false +} + +// SetupCompoundReferenceMode mirrors vp9_setup_compound_reference_mode. +// Picks which of the three ref frames is the "fixed" anchor for compound +// prediction and which two are the variable alternatives. Driven by the +// per-frame ref_frame_sign_bias array libvpx wires through VP9_COMMON. +func SetupCompoundReferenceMode(signBias [MaxRefFrames]uint8) CompoundFrameRefs { + switch { + case signBias[LastFrame] == signBias[GoldenFrame]: + return CompoundFrameRefs{ + CompFixedRef: AltrefFrame, + CompVarRef: [2]int8{LastFrame, GoldenFrame}, + } + case signBias[LastFrame] == signBias[AltrefFrame]: + return CompoundFrameRefs{ + CompFixedRef: GoldenFrame, + CompVarRef: [2]int8{LastFrame, AltrefFrame}, + } + default: + return CompoundFrameRefs{ + CompFixedRef: LastFrame, + CompVarRef: [2]int8{GoldenFrame, AltrefFrame}, + } + } +} + +// b2i returns 1 if cond is true else 0. Mirrors libvpx's C-style +// implicit bool→int coercion in the predictor-context helpers. +func b2i(cond bool) int { + if cond { + return 1 + } + return 0 +} + +// GetPredContextCompRefP mirrors vp9_get_pred_context_comp_ref_p — the +// 5-state compound-ref-half-pick context used when the frame is in +// REFERENCE_MODE_SELECT and the block already chose COMPOUND_REFERENCE. +func GetPredContextCompRefP(above, left *NeighborMi, refs CompoundFrameRefs, signBias [MaxRefFrames]uint8) int { + fixRefIdx := int(signBias[refs.CompFixedRef]) + varRefIdx := 1 - fixRefIdx + hasAbove := above != nil + hasLeft := left != nil + + switch { + case hasAbove && hasLeft: + aboveIntra := !isInterBlock(above) + leftIntra := !isInterBlock(left) + switch { + case aboveIntra && leftIntra: + return 2 + case aboveIntra || leftIntra: + edge := above + if aboveIntra { + edge = left + } + if !hasSecondRef(edge) { + return 1 + 2*b2i(edge.RefFrame[0] != refs.CompVarRef[1]) + } + return 1 + 2*b2i(edge.RefFrame[varRefIdx] != refs.CompVarRef[1]) + default: + lSg := !hasSecondRef(left) + aSg := !hasSecondRef(above) + vrfa := above.RefFrame[varRefIdx] + if aSg { + vrfa = above.RefFrame[0] + } + vrfl := left.RefFrame[varRefIdx] + if lSg { + vrfl = left.RefFrame[0] + } + switch { + case vrfa == vrfl && refs.CompVarRef[1] == vrfa: + return 0 + case lSg && aSg: + if (vrfa == refs.CompFixedRef && vrfl == refs.CompVarRef[0]) || + (vrfl == refs.CompFixedRef && vrfa == refs.CompVarRef[0]) { + return 4 + } + if vrfa == vrfl { + return 3 + } + return 1 + case lSg || aSg: + vrfc := vrfa + if !lSg { + vrfc = vrfl + } + rfs := vrfa + if !aSg { + rfs = vrfl + } + if vrfc == refs.CompVarRef[1] && rfs != refs.CompVarRef[1] { + return 1 + } + if rfs == refs.CompVarRef[1] && vrfc != refs.CompVarRef[1] { + return 2 + } + return 4 + case vrfa == vrfl: + return 4 + default: + return 2 + } + } + case hasAbove || hasLeft: + edge := above + if !hasAbove { + edge = left + } + if !isInterBlock(edge) { + return 2 + } + if hasSecondRef(edge) { + return 4 * b2i(edge.RefFrame[varRefIdx] != refs.CompVarRef[1]) + } + return 3 * b2i(edge.RefFrame[0] != refs.CompVarRef[1]) + default: + return 2 + } +} + +// GetPredContextSingleRefP1 mirrors vp9_get_pred_context_single_ref_p1 +// — the 5-state context for the first of two single-ref bits. +func GetPredContextSingleRefP1(above, left *NeighborMi) int { + hasAbove := above != nil + hasLeft := left != nil + switch { + case hasAbove && hasLeft: + aboveIntra := !isInterBlock(above) + leftIntra := !isInterBlock(left) + switch { + case aboveIntra && leftIntra: + return 2 + case aboveIntra || leftIntra: + edge := above + if aboveIntra { + edge = left + } + if !hasSecondRef(edge) { + return 4 * b2i(edge.RefFrame[0] == LastFrame) + } + return 1 + b2i(edge.RefFrame[0] == LastFrame || edge.RefFrame[1] == LastFrame) + default: + aHasSecond := hasSecondRef(above) + lHasSecond := hasSecondRef(left) + a0, a1 := above.RefFrame[0], above.RefFrame[1] + l0, l1 := left.RefFrame[0], left.RefFrame[1] + switch { + case aHasSecond && lHasSecond: + return 1 + b2i(a0 == LastFrame || a1 == LastFrame || + l0 == LastFrame || l1 == LastFrame) + case aHasSecond || lHasSecond: + rfs := a0 + if aHasSecond { + rfs = l0 + } + crf1 := a0 + crf2 := a1 + if !aHasSecond { + crf1 = l0 + crf2 = l1 + } + if rfs == LastFrame { + return 3 + b2i(crf1 == LastFrame || crf2 == LastFrame) + } + return b2i(crf1 == LastFrame || crf2 == LastFrame) + default: + return 2*b2i(a0 == LastFrame) + 2*b2i(l0 == LastFrame) + } + } + case hasAbove || hasLeft: + edge := above + if !hasAbove { + edge = left + } + if !isInterBlock(edge) { + return 2 + } + if !hasSecondRef(edge) { + return 4 * b2i(edge.RefFrame[0] == LastFrame) + } + return 1 + b2i(edge.RefFrame[0] == LastFrame || edge.RefFrame[1] == LastFrame) + default: + return 2 + } +} + +// GetPredContextSingleRefP2 mirrors vp9_get_pred_context_single_ref_p2 +// — the second single-ref bit context. +func GetPredContextSingleRefP2(above, left *NeighborMi) int { + hasAbove := above != nil + hasLeft := left != nil + switch { + case hasAbove && hasLeft: + aboveIntra := !isInterBlock(above) + leftIntra := !isInterBlock(left) + switch { + case aboveIntra && leftIntra: + return 2 + case aboveIntra || leftIntra: + edge := above + if aboveIntra { + edge = left + } + if !hasSecondRef(edge) { + if edge.RefFrame[0] == LastFrame { + return 3 + } + return 4 * b2i(edge.RefFrame[0] == GoldenFrame) + } + return 1 + 2*b2i(edge.RefFrame[0] == GoldenFrame || + edge.RefFrame[1] == GoldenFrame) + default: + aHasSecond := hasSecondRef(above) + lHasSecond := hasSecondRef(left) + a0, a1 := above.RefFrame[0], above.RefFrame[1] + l0, l1 := left.RefFrame[0], left.RefFrame[1] + switch { + case aHasSecond && lHasSecond: + if a0 == l0 && a1 == l1 { + return 3 * b2i(a0 == GoldenFrame || a1 == GoldenFrame || + l0 == GoldenFrame || l1 == GoldenFrame) + } + return 2 + case aHasSecond || lHasSecond: + rfs := a0 + if aHasSecond { + rfs = l0 + } + crf1 := a0 + crf2 := a1 + if !aHasSecond { + crf1 = l0 + crf2 = l1 + } + switch rfs { + case GoldenFrame: + return 3 + b2i(crf1 == GoldenFrame || crf2 == GoldenFrame) + case AltrefFrame: + return b2i(crf1 == GoldenFrame || crf2 == GoldenFrame) + default: + return 1 + 2*b2i(crf1 == GoldenFrame || crf2 == GoldenFrame) + } + default: + if a0 == LastFrame && l0 == LastFrame { + return 3 + } + if a0 == LastFrame || l0 == LastFrame { + edge0 := a0 + if a0 == LastFrame { + edge0 = l0 + } + return 4 * b2i(edge0 == GoldenFrame) + } + return 2*b2i(a0 == GoldenFrame) + 2*b2i(l0 == GoldenFrame) + } + } + case hasAbove || hasLeft: + edge := above + if !hasAbove { + edge = left + } + if !isInterBlock(edge) || + (edge.RefFrame[0] == LastFrame && !hasSecondRef(edge)) { + return 2 + } + if !hasSecondRef(edge) { + return 4 * b2i(edge.RefFrame[0] == GoldenFrame) + } + return 3 * b2i(edge.RefFrame[0] == GoldenFrame || edge.RefFrame[1] == GoldenFrame) + default: + return 2 + } +} + +// GetReferenceModeContext mirrors vp9_get_reference_mode_context. The +// 5-state context distinguishes (intra,single,compound) mixes of the +// above/left pair and selects an entry in fc->comp_inter_prob. +func GetReferenceModeContext(above, left *NeighborMi, refs CompoundFrameRefs) int { + hasAbove := above != nil + hasLeft := left != nil + switch { + case hasAbove && hasLeft: + aboveSingle := !hasSecondRef(above) + leftSingle := !hasSecondRef(left) + switch { + case aboveSingle && leftSingle: + // neither edge uses comp pred (0/1) + a := int8(0) + if above.RefFrame[0] == refs.CompFixedRef { + a = 1 + } + l := int8(0) + if left.RefFrame[0] == refs.CompFixedRef { + l = 1 + } + return int(a ^ l) + case aboveSingle: + // one of two edges uses comp pred (2/3) + extra := 0 + if above.RefFrame[0] == refs.CompFixedRef || !isInterBlock(above) { + extra = 1 + } + return 2 + extra + case leftSingle: + extra := 0 + if left.RefFrame[0] == refs.CompFixedRef || !isInterBlock(left) { + extra = 1 + } + return 2 + extra + default: + // both edges use comp pred + return 4 + } + case hasAbove || hasLeft: + edge := above + if !hasAbove { + edge = left + } + if !hasSecondRef(edge) { + if edge.RefFrame[0] == refs.CompFixedRef { + return 1 + } + return 0 + } + return 3 + default: + return 1 + } +} diff --git a/internal/vp9/decoder/refframe.go b/internal/vp9/decoder/refframe.go new file mode 100644 index 0000000..8841b8f --- /dev/null +++ b/internal/vp9/decoder/refframe.go @@ -0,0 +1,70 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/refframe.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" + "github.com/go-avkit/vpx/internal/vp9/common" +) + +// SegFeatureActive mirrors libvpx's segfeature_active in +// vp9/common/vp9_seg_common.h. Returns true iff segmentation is +// enabled AND the given feature is masked on for that segment. +func SegFeatureActive(seg *SegmentationParams, segID int, feature int) bool { + if !seg.Enabled { + return false + } + return seg.FeatureMask[segID]&(1<> RefScaleShift) +} + +func scaledYInt(val int, sf *ScaleFactors) int { + return int((int64(val) * int64(sf.YScaleFp)) >> RefScaleShift) +} + +func getFixedPointScale(otherSize, thisSize int) int { + return (otherSize << RefScaleShift) / thisSize +} + +// validRefFrameSize mirrors libvpx's valid_ref_frame_size predicate: +// reference width/height must be within 2x of the current frame in +// either direction. +func validRefFrameSize(refW, refH, thisW, thisH int) bool { + return 2*thisW >= refW && 2*thisH >= refH && + thisW <= 16*refW && thisH <= 16*refH +} diff --git a/internal/vp9/decoder/segment_driver.go b/internal/vp9/decoder/segment_driver.go new file mode 100644 index 0000000..1457e9a --- /dev/null +++ b/internal/vp9/decoder/segment_driver.go @@ -0,0 +1,126 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/decoder/segment_driver.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package decoder + +import ( + "github.com/go-avkit/vpx/internal/vp9/bitstream" +) + +// CopySegmentId mirrors libvpx's copy_segment_id. Copies a +// [yMis × xMis] window from `lastSeg` (nullable; nil means zero) into +// `currentSeg`, indexing both with miCols stride. Both arguments +// alias the per-frame segment-id raster maps. +func CopySegmentId(currentSeg, lastSeg []uint8, miCols, miOffset, xMis, yMis int) { + for y := range yMis { + for x := range xMis { + off := miOffset + y*miCols + x + if lastSeg != nil { + currentSeg[off] = lastSeg[off] + } else { + currentSeg[off] = 0 + } + } + } +} + +// SetSegmentId mirrors libvpx's set_segment_id. Writes `segID` into +// every entry of the [yMis × xMis] window. +func SetSegmentId(currentSeg []uint8, miCols, miOffset, xMis, yMis, segID int) { + v := uint8(segID) + for y := range yMis { + for x := range xMis { + currentSeg[miOffset+y*miCols+x] = v + } + } +} + +// IntraSegmentMaps groups the two segment-id raster maps libvpx's +// VP9_COMMON carries for the intra path. LastFrameSegMap may be nil +// when the prior frame had segmentation disabled or didn't update +// the map. +type IntraSegmentMaps struct { + CurrentFrameSegMap []uint8 + LastFrameSegMap []uint8 // may be nil + MiCols int +} + +// ReadIntraSegmentId mirrors libvpx's read_intra_segment_id. Mirrors +// the gate logic: disabled segmentation always returns 0; UpdateMap +// off triggers a copy of the last-frame map into the current-frame +// map (and still returns 0 — libvpx counts the keyframe seg map as +// a fresh write); otherwise the segment id is decoded from the +// reader and written into the current-frame map. +func ReadIntraSegmentId(r *bitstream.Reader, seg *SegmentationParams, + maps *IntraSegmentMaps, miOffset, xMis, yMis int, +) int { + if !seg.Enabled { + return 0 + } + if !seg.UpdateMap { + CopySegmentId(maps.CurrentFrameSegMap, maps.LastFrameSegMap, + maps.MiCols, miOffset, xMis, yMis) + return 0 + } + segID := ReadSegmentIDProb(r, seg) + SetSegmentId(maps.CurrentFrameSegMap, maps.MiCols, miOffset, xMis, yMis, segID) + return segID +} + +// InterSegmentMaps extends IntraSegmentMaps for the temporal-update +// path. SegIDPredictedOut is written back to the per-block MI's +// seg_id_predicted slot when libvpx would set it. +type InterSegmentMaps struct { + IntraSegmentMaps + SegIDPredictedOut *uint8 // optional sink for predicted-flag write-back +} + +// ReadInterSegmentId mirrors libvpx's read_inter_segment_id. When +// temporal update is enabled the decoder reads a single predicted-id +// bit against the seg-id-pred prob row (indexed by GetPredContextSegId +// over the above/left blocks). When the bit is 1, libvpx skips the +// segment-tree read and reuses the predicted id from the prior +// frame's seg map. +func ReadInterSegmentId(r *bitstream.Reader, seg *SegmentationParams, + maps *InterSegmentMaps, miOffset, xMis, yMis int, + above, left *NeighborMi, +) int { + if !seg.Enabled { + return 0 + } + predictedID := 0 + if maps.LastFrameSegMap != nil { + predictedID = DecGetSegmentId(maps.LastFrameSegMap, + maps.MiCols, miOffset, xMis, yMis) + } + if !seg.UpdateMap { + CopySegmentId(maps.CurrentFrameSegMap, maps.LastFrameSegMap, + maps.MiCols, miOffset, xMis, yMis) + return predictedID + } + var segID int + if seg.TemporalUpdate { + ctx := GetPredContextSegId(above, left) + predProb := uint32(seg.PredProbs[ctx]) + bit := uint8(r.Read(predProb)) + if maps.SegIDPredictedOut != nil { + *maps.SegIDPredictedOut = bit + } + if bit != 0 { + segID = predictedID + } else { + segID = ReadSegmentIDProb(r, seg) + } + } else { + segID = ReadSegmentIDProb(r, seg) + } + SetSegmentId(maps.CurrentFrameSegMap, maps.MiCols, miOffset, xMis, yMis, segID) + return segID +} diff --git a/internal/vp9/dsp/convolve.go b/internal/vp9/dsp/convolve.go new file mode 100644 index 0000000..354a0c3 --- /dev/null +++ b/internal/vp9/dsp/convolve.go @@ -0,0 +1,332 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/convolve.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "runtime" + + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +// convolve8TempBuf is the intermediate-row buffer used by VpxConvolve8 / +// VpxConvolve8Avg between the H and V passes. libvpx declares this as a +// stack-local uint8_t array (vpx_dsp/vpx_convolve.c:177) which has no +// initialization cost in C; Go's `var temp [N]byte` form emits a +// per-call memclr of all 8640 bytes that shows up as ~50ms self-time on +// cpu_used=8 RT for the convolve-heavy realtime inter predictor. Pool +// a reusable buffer so the steady-state path performs no zeroing — the +// H pass always writes the full intermediate region before the V pass +// reads it. +type convolve8TempBuf [64 * 135]byte + +// convolve8AvgTempBuf is the smaller scratch for VpxConvolve8Avg. +type convolve8AvgTempBuf [64 * 64]byte + +// Convolve8Scratch is caller-owned scratch for full two-pass VP9 8-tap +// convolve. libvpx keeps the intermediate H/V buffers stack-local at each +// predictor call; decoder/tile workers pass this scratch to avoid the global +// fallback pool in threaded reconstruction. +type Convolve8Scratch struct { + temp convolve8TempBuf + avgTemp convolve8AvgTempBuf +} + +func convolve8TempForScratch(scratch *Convolve8Scratch) ([]byte, *convolve8TempBuf) { + if scratch != nil { + return scratch.temp[:], nil + } + tempBuf := convolve8TempGet() + return tempBuf[:], tempBuf +} + +func convolve8AvgTempForScratch(scratch *Convolve8Scratch) ([]byte, *convolve8AvgTempBuf) { + if scratch != nil { + return scratch.avgTemp[:], nil + } + tempBuf := convolve8AvgTempGet() + return tempBuf[:], tempBuf +} + +// convolveTempCap caps the GC-immune free list capacity at 4×GOMAXPROCS +// so even with the VP9 encoder's per-tile-column worker pool plus the +// helper row workers there are always free slabs ready to hand out. The +// channel itself is allocated lazily once per program start. +var ( + convolve8TempPool chan *convolve8TempBuf + convolve8AvgTempPool chan *convolve8AvgTempBuf +) + +// convolveTempPoolCapacity returns the steady-state slab budget for the +// convolve8 free lists. Matches libvpx's stack-local zero-init avoidance +// rationale but in a form that survives runtime.GC() — sync.Pool drops +// items on the second GC sweep which made the encoder steady-state +// allocation gate flaky under parallel test load (agents #108/#114/#117). +func convolveTempPoolCapacity() int { + n := runtime.GOMAXPROCS(0) + if n <= 0 { + n = 1 + } + // 4× headroom covers tile-column + row-MT helper goroutines on every + // realistic config without growing the global slab footprint. + return n * 4 +} + +func init() { + capacity := convolveTempPoolCapacity() + convolve8TempPool = make(chan *convolve8TempBuf, capacity) + convolve8AvgTempPool = make(chan *convolve8AvgTempBuf, capacity) + for range capacity { + convolve8TempPool <- new(convolve8TempBuf) + convolve8AvgTempPool <- new(convolve8AvgTempBuf) + } +} + +// convolve8TempGet returns a reusable 64×135 intermediate buffer. If the +// free list is empty (e.g., GOMAXPROCS grew at runtime above the capacity +// snapshot taken at init time) the call falls back to a one-shot heap +// allocation; convolve8TempPut silently drops returns that would overfill +// the channel. +func convolve8TempGet() *convolve8TempBuf { + select { + case b := <-convolve8TempPool: + return b + default: + return new(convolve8TempBuf) + } +} + +func convolve8TempPut(b *convolve8TempBuf) { + if b == nil { + return + } + select { + case convolve8TempPool <- b: + default: + } +} + +func convolve8AvgTempGet() *convolve8AvgTempBuf { + select { + case b := <-convolve8AvgTempPool: + return b + default: + return new(convolve8AvgTempBuf) + } +} + +func convolve8AvgTempPut(b *convolve8AvgTempBuf) { + if b == nil { + return + } + select { + case convolve8AvgTempPool <- b: + default: + } +} + +// VP9 8-tap subpel convolve kernels. Ported from libvpx v1.16.0 +// vpx_dsp/vpx_convolve.c (the "_c" reference implementations only — +// the SIMD path lives elsewhere). The fractional MV is split into +// (x0_q4, x_step_q4) / (y0_q4, y_step_q4) at 1/16-pel precision; the +// integer part indexes into the source plane and the fractional part +// selects one of 16 InterpKernel rows. + +// convolveHoriz applies a single horizontal pass with the supplied +// subpel filter table, stepping the fractional x by xStepQ4 per output +// column. Matches libvpx's convolve_horiz line-for-line; src is biased +// back by SUBPEL_TAPS/2 - 1 so the kernel center aligns with x_q4 >> 4. +func convolveHoriz(src []byte, srcStride int, dst []byte, dstStride int, + xFilters *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, w, h, srcOffset int, +) { + if xStepQ4 == 16 && w >= 4 && h > 0 { + base := srcOffset - 3 + (x0Q4 >> 4) + pixel.Filter(src[base:], srcStride, dst, dstStride, w, h, 1, xFilters[x0Q4&15][:]) + return + } + + srcStart := srcOffset - (tables.SubpelTaps/2 - 1) + for y := range h { + xQ4 := x0Q4 + rowSrc := srcStart + y*srcStride + rowDst := y * dstStride + for x := range w { + base := rowSrc + (xQ4 >> tables.SubpelBits) + filter := &xFilters[xQ4&tables.SubpelMask] + sum := 0 + for k := range tables.SubpelTaps { + sum += int(src[base+k]) * int(filter[k]) + } + dst[rowDst+x] = clipPixel(roundPowerOfTwo(int32(sum), tables.FilterBits)) + xQ4 += xStepQ4 + } + } +} + +// convolveVert applies a single vertical pass. Matches convolve_vert in +// libvpx. +func convolveVert(src []byte, srcStride int, dst []byte, dstStride int, + yFilters *[tables.SubpelShifts][tables.SubpelTaps]int16, + y0Q4, yStepQ4, w, h, srcOffset int, +) { + if yStepQ4 == 16 && w >= 4 && h > 0 { + base := srcOffset + (y0Q4>>4)*srcStride - 3*srcStride + pixel.Filter(src[base:], srcStride, dst, dstStride, w, h, srcStride, yFilters[y0Q4&15][:]) + return + } + + srcStart := srcOffset - srcStride*(tables.SubpelTaps/2-1) + for x := range w { + yQ4 := y0Q4 + for y := range h { + base := srcStart + (yQ4>>tables.SubpelBits)*srcStride + filter := &yFilters[yQ4&tables.SubpelMask] + sum := 0 + for k := range tables.SubpelTaps { + sum += int(src[base+k*srcStride]) * int(filter[k]) + } + dst[y*dstStride+x] = clipPixel(roundPowerOfTwo(int32(sum), tables.FilterBits)) + yQ4 += yStepQ4 + } + srcStart++ + } +} + +// convolveAvgHoriz / convolveAvgVert blend the filtered result with the +// pre-existing dst pixel (used when libvpx caller wants 2-reference +// averaging in inter prediction). Matches convolve_avg_horiz/vert. +func convolveAvgHoriz(src []byte, srcStride int, dst []byte, dstStride int, + xFilters *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, w, h, srcOffset int, +) { + srcStart := srcOffset - (tables.SubpelTaps/2 - 1) + for y := range h { + xQ4 := x0Q4 + rowSrc := srcStart + y*srcStride + rowDst := y * dstStride + for x := range w { + base := rowSrc + (xQ4 >> tables.SubpelBits) + filter := &xFilters[xQ4&tables.SubpelMask] + sum := 0 + for k := range tables.SubpelTaps { + sum += int(src[base+k]) * int(filter[k]) + } + c := int(dst[rowDst+x]) + int(clipPixel(roundPowerOfTwo(int32(sum), tables.FilterBits))) + dst[rowDst+x] = uint8((c + 1) >> 1) + xQ4 += xStepQ4 + } + } +} + +func convolveAvgVert(src []byte, srcStride int, dst []byte, dstStride int, + yFilters *[tables.SubpelShifts][tables.SubpelTaps]int16, + y0Q4, yStepQ4, w, h, srcOffset int, +) { + srcStart := srcOffset - srcStride*(tables.SubpelTaps/2-1) + for x := range w { + yQ4 := y0Q4 + for y := range h { + base := srcStart + (yQ4>>tables.SubpelBits)*srcStride + filter := &yFilters[yQ4&tables.SubpelMask] + sum := 0 + for k := range tables.SubpelTaps { + sum += int(src[base+k*srcStride]) * int(filter[k]) + } + c := int(dst[y*dstStride+x]) + int(clipPixel(roundPowerOfTwo(int32(sum), tables.FilterBits))) + dst[y*dstStride+x] = uint8((c + 1) >> 1) + yQ4 += yStepQ4 + } + srcStart++ + } +} + +func clipPixel(v int32) uint8 { + if v < 0 { + return 0 + } + if v > 255 { + return 255 + } + return uint8(v) +} + +// VpxConvolve8AvgHoriz mirrors vpx_convolve8_avg_horiz_c. +func VpxConvolve8AvgHoriz(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, +) { + VpxConvolve8AvgHorizWithScratch(src, srcStride, dst, dstStride, filter, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset, nil) +} + +// VpxConvolve8AvgHorizWithScratch is VpxConvolve8AvgHoriz with optional +// caller-owned temp storage for the SIMD filter-then-average path. +func VpxConvolve8AvgHorizWithScratch(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, + scratch *Convolve8Scratch, +) { + vpxConvolve8AvgHoriz(src, srcStride, dst, dstStride, filter, x0Q4, + xStepQ4, y0Q4, yStepQ4, w, h, srcOffset, scratch) +} + +// VpxConvolve8AvgVert mirrors vpx_convolve8_avg_vert_c. +func VpxConvolve8AvgVert(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, +) { + VpxConvolve8AvgVertWithScratch(src, srcStride, dst, dstStride, filter, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset, nil) +} + +// VpxConvolve8AvgVertWithScratch is VpxConvolve8AvgVert with optional +// caller-owned temp storage for the SIMD filter-then-average path. +func VpxConvolve8AvgVertWithScratch(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, + scratch *Convolve8Scratch, +) { + vpxConvolve8AvgVert(src, srcStride, dst, dstStride, filter, x0Q4, + xStepQ4, y0Q4, yStepQ4, w, h, srcOffset, scratch) +} + +// VpxConvolveCopy mirrors vpx_convolve_copy_c — a straight copy of +// w x h pixels from src to dst at the given strides. +func VpxConvolveCopy(src []byte, srcStride int, dst []byte, dstStride, w, h, srcOffset int) { + pixel.CopyBlock(src[srcOffset:], srcStride, dst, dstStride, w, h) +} + +// VpxConvolveAvg mirrors vpx_convolve_avg_c — blend src and dst by +// rounded mean. +func VpxConvolveAvg(src []byte, srcStride int, dst []byte, dstStride, w, h, srcOffset int) { + vpxConvolveAvg(src, srcStride, dst, dstStride, w, h, srcOffset) +} + +func vpxConvolveAvgScalar(src []byte, srcStride int, dst []byte, dstStride, w, h, srcOffset int) { + if pixel.Enabled { + pixel.Average(src[srcOffset:], srcStride, dst, dstStride, w, h) + return + } + + for y := range h { + for x := range w { + c := int(src[srcOffset+y*srcStride+x]) + int(dst[y*dstStride+x]) + dst[y*dstStride+x] = uint8((c + 1) >> 1) + } + } +} + +// The size-specialized VpxConvolve8Horiz / VpxConvolve8Vert / +// VpxConvolve8 / VpxConvolve8Avg public APIs live in convolve_arm64.go +// (NEON path) and convolve_other.go (scalar fallback). They share the +// scalar helpers above (convolveHoriz, convolveVert, convolveAvgHoriz, +// convolveAvgVert) for the slow paths. diff --git a/internal/vp9/dsp/convolve_other.go b/internal/vp9/dsp/convolve_other.go new file mode 100644 index 0000000..f3d30e8 --- /dev/null +++ b/internal/vp9/dsp/convolve_other.go @@ -0,0 +1,123 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/convolve_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "github.com/go-avkit/vpx/internal/vp9/tables" +) + +func vpxConvolve8AvgHoriz(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, + scratch *Convolve8Scratch, +) { + _ = y0Q4 + _ = yStepQ4 + _ = scratch + convolveAvgHoriz(src, srcStride, dst, dstStride, filter, x0Q4, xStepQ4, + w, h, srcOffset) +} + +func vpxConvolve8AvgVert(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, + scratch *Convolve8Scratch, +) { + _ = x0Q4 + _ = xStepQ4 + _ = scratch + convolveAvgVert(src, srcStride, dst, dstStride, filter, y0Q4, yStepQ4, + w, h, srcOffset) +} + +func vpxConvolveAvg(src []byte, srcStride int, dst []byte, dstStride, w, h, srcOffset int) { + vpxConvolveAvgScalar(src, srcStride, dst, dstStride, w, h, srcOffset) +} + +// VpxConvolve8Horiz applies the horizontal 8-tap subpel filter. +// Mirrors vpx_convolve8_horiz_c. +func VpxConvolve8Horiz(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, +) { + _ = y0Q4 + _ = yStepQ4 + if xStepQ4 == tables.SubpelShifts && srcOffset >= 0 && (w == 4 || (w > 0 && w%8 == 0)) && h > 0 && srcStride >= 0 && dstStride >= 0 { + f := &filter[x0Q4] + if (f[0]|f[1]|f[2]|f[5]|f[6]|f[7]) == 0 && f[3] >= 0 && f[4] >= 0 && + len(src)-srcOffset >= (h-1)*srcStride+w+1 && len(dst) >= (h-1)*dstStride+w { + pixel.FilterBilinear(src[srcOffset:], srcStride, dst, dstStride, w, h, 1, uint8(f[3]), uint8(f[4])) + return + } + } + convolveHoriz(src, srcStride, dst, dstStride, filter, x0Q4, xStepQ4, w, h, srcOffset) +} + +// VpxConvolve8Vert mirrors vpx_convolve8_vert_c. +func VpxConvolve8Vert(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, +) { + _ = x0Q4 + _ = xStepQ4 + if yStepQ4 == tables.SubpelShifts && srcOffset >= 0 && (w == 4 || (w > 0 && w%8 == 0)) && h > 0 && srcStride >= 0 && dstStride >= 0 { + f := &filter[y0Q4] + if (f[0]|f[1]|f[2]|f[5]|f[6]|f[7]) == 0 && f[3] >= 0 && f[4] >= 0 && + len(src)-srcOffset >= h*srcStride+w && len(dst) >= (h-1)*dstStride+w { + pixel.FilterBilinear(src[srcOffset:], srcStride, dst, dstStride, w, h, srcStride, uint8(f[3]), uint8(f[4])) + return + } + } + convolveVert(src, srcStride, dst, dstStride, filter, y0Q4, yStepQ4, w, h, srcOffset) +} + +// VpxConvolve8WithScratch is VpxConvolve8 with optional caller-owned scratch. +func VpxConvolve8WithScratch(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, + scratch *Convolve8Scratch, +) { + if xStepQ4 == tables.SubpelShifts && yStepQ4 == tables.SubpelShifts && srcOffset >= 0 && srcOffset < len(src) { + fx := &filter[x0Q4] + fy := &filter[y0Q4] + if (fx[0]|fx[1]|fx[2]|fx[5]|fx[6]|fx[7]|fy[0]|fy[1]|fy[2]|fy[5]|fy[6]|fy[7]) == 0 && + fx[3] >= 0 && fx[4] >= 0 && fy[3] >= 0 && fy[4] >= 0 && + pixel.FilterBilinear2D(src[srcOffset:], srcStride, dst, dstStride, w, h, + uint8(fx[3]), uint8(fx[4]), uint8(fy[3]), uint8(fy[4])) { + return + } + } + temp, tempBuf := convolve8TempForScratch(scratch) + intermediateHeight := (((h-1)*yStepQ4 + y0Q4) >> tables.SubpelBits) + tables.SubpelTaps + horizSrcOffset := srcOffset - srcStride*(tables.SubpelTaps/2-1) + convolveHoriz(src, srcStride, temp, 64, filter, x0Q4, xStepQ4, w, intermediateHeight, horizSrcOffset) + vertSrcOffset := 64 * (tables.SubpelTaps/2 - 1) + convolveVert(temp, 64, dst, dstStride, filter, y0Q4, yStepQ4, w, h, vertSrcOffset) + if tempBuf != nil { + convolve8TempPut(tempBuf) + } +} + +// VpxConvolve8AvgWithScratch is VpxConvolve8Avg with optional caller-owned scratch. +func VpxConvolve8AvgWithScratch(src []byte, srcStride int, dst []byte, dstStride int, + filter *[tables.SubpelShifts][tables.SubpelTaps]int16, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset int, + scratch *Convolve8Scratch, +) { + temp, tempBuf := convolve8AvgTempForScratch(scratch) + VpxConvolve8WithScratch(src, srcStride, temp, 64, filter, + x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, srcOffset, scratch) + VpxConvolveAvg(temp, 64, dst, dstStride, w, h, 0) + if tempBuf != nil { + convolve8AvgTempPut(tempBuf) + } +} diff --git a/internal/vp9/dsp/dct_core_avx2.go b/internal/vp9/dsp/dct_core_avx2.go new file mode 100644 index 0000000..c49ed5c --- /dev/null +++ b/internal/vp9/dsp/dct_core_avx2.go @@ -0,0 +1,586 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/dct_core_avx2.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "simd/archsimd" +) + +func vecRound8(v archsimd.Int32x8) archsimd.Int32x8 { + return v.Add(archsimd.BroadcastInt32x8(8192)).ShiftAllRight(14) +} +func vecWrap8(v archsimd.Int32x8) archsimd.Int32x8 { return v.ShiftAllLeft(16).ShiftAllRight(16) } +func inverseDCT8AVX2(input []int16, dst []byte, stride, rows int) bool { + if !pixel.Enabled || stride < 8 || len(input) < 8*rows || len(dst) < 7*stride+8 { + return false + } + defer pixel.FinishWide() + row := 0 + var lane0, lane1, lane2, lane3, lane4, lane5, lane6, lane7 archsimd.Int32x8 + { + var a, b, c, d, e, f, g, h archsimd.Int32x8 + if row+0 < rows { + a = pixel.Load8(input[(row+0)*8+0:]) + } + if row+1 < rows { + b = pixel.Load8(input[(row+1)*8+0:]) + } + if row+2 < rows { + c = pixel.Load8(input[(row+2)*8+0:]) + } + if row+3 < rows { + d = pixel.Load8(input[(row+3)*8+0:]) + } + if row+4 < rows { + e = pixel.Load8(input[(row+4)*8+0:]) + } + if row+5 < rows { + f = pixel.Load8(input[(row+5)*8+0:]) + } + if row+6 < rows { + g = pixel.Load8(input[(row+6)*8+0:]) + } + if row+7 < rows { + h = pixel.Load8(input[(row+7)*8+0:]) + } + lane0, lane1, lane2, lane3, lane4, lane5, lane6, lane7 = pixel.Transpose8(a, b, c, d, e, f, g, h) + } + var output0, output1, output2, output3, output4, output5, output6, output7 archsimd.Int32x8 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step20, step21, step22, step23, step24, step25, step26, step27 archsimd.Int32x8 + in0 := lane0 + in1 := lane1 + in2 := lane2 + in3 := lane3 + in4 := lane4 + in5 := lane5 + in6 := lane6 + in7 := lane7 + step10 = vecWrap8(in0) + step12 = vecWrap8(in4) + step11 = vecWrap8(in2) + step13 = vecWrap8(in6) + temp1 := pixel.MulAdd8(in1, archsimd.BroadcastInt32x8(cospi28_64), (in7).Mul(archsimd.BroadcastInt32x8(-cospi4_64))) + temp2 := pixel.MulAdd8(in1, archsimd.BroadcastInt32x8(cospi4_64), (in7).Mul(archsimd.BroadcastInt32x8(cospi28_64))) + step14 = vecWrap8(vecRound8(temp1)) + step17 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(in5, archsimd.BroadcastInt32x8(cospi12_64), (in3).Mul(archsimd.BroadcastInt32x8(-cospi20_64))) + temp2 = pixel.MulAdd8(in5, archsimd.BroadcastInt32x8(cospi20_64), (in3).Mul(archsimd.BroadcastInt32x8(cospi12_64))) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + temp1 = ((step10).Add(step12)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step10).Sub(step12)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step20 = vecWrap8(vecRound8(temp1)) + step21 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step11, archsimd.BroadcastInt32x8(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x8(-cospi8_64))) + temp2 = pixel.MulAdd8(step11, archsimd.BroadcastInt32x8(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + step22 = vecWrap8(vecRound8(temp1)) + step23 = vecWrap8(vecRound8(temp2)) + step24 = vecWrap8((step14).Add(step15)) + step25 = vecWrap8((step14).Sub(step15)) + step26 = vecWrap8((step17).Sub(step16)) + step27 = vecWrap8((step16).Add(step17)) + step10 = vecWrap8((step20).Add(step23)) + step11 = vecWrap8((step21).Add(step22)) + step12 = vecWrap8((step21).Sub(step22)) + step13 = vecWrap8((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + step17 = step27 + output0 = vecWrap8((step10).Add(step17)) + output1 = vecWrap8((step11).Add(step16)) + output2 = vecWrap8((step12).Add(step15)) + output3 = vecWrap8((step13).Add(step14)) + output4 = vecWrap8((step13).Sub(step14)) + output5 = vecWrap8((step12).Sub(step15)) + output6 = vecWrap8((step11).Sub(step16)) + output7 = vecWrap8((step10).Sub(step17)) + } + lane0, lane1, lane2, lane3, lane4, lane5, lane6, lane7 = pixel.Transpose8(output0, output1, output2, output3, output4, output5, output6, output7) + col := 0 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step20, step21, step22, step23, step24, step25, step26, step27 archsimd.Int32x8 + in0 := lane0 + in1 := lane1 + in2 := lane2 + in3 := lane3 + in4 := lane4 + in5 := lane5 + in6 := lane6 + in7 := lane7 + step10 = vecWrap8(in0) + step12 = vecWrap8(in4) + step11 = vecWrap8(in2) + step13 = vecWrap8(in6) + temp1 := pixel.MulAdd8(in1, archsimd.BroadcastInt32x8(cospi28_64), (in7).Mul(archsimd.BroadcastInt32x8(-cospi4_64))) + temp2 := pixel.MulAdd8(in1, archsimd.BroadcastInt32x8(cospi4_64), (in7).Mul(archsimd.BroadcastInt32x8(cospi28_64))) + step14 = vecWrap8(vecRound8(temp1)) + step17 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(in5, archsimd.BroadcastInt32x8(cospi12_64), (in3).Mul(archsimd.BroadcastInt32x8(-cospi20_64))) + temp2 = pixel.MulAdd8(in5, archsimd.BroadcastInt32x8(cospi20_64), (in3).Mul(archsimd.BroadcastInt32x8(cospi12_64))) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + temp1 = ((step10).Add(step12)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step10).Sub(step12)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step20 = vecWrap8(vecRound8(temp1)) + step21 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step11, archsimd.BroadcastInt32x8(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x8(-cospi8_64))) + temp2 = pixel.MulAdd8(step11, archsimd.BroadcastInt32x8(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + step22 = vecWrap8(vecRound8(temp1)) + step23 = vecWrap8(vecRound8(temp2)) + step24 = vecWrap8((step14).Add(step15)) + step25 = vecWrap8((step14).Sub(step15)) + step26 = vecWrap8((step17).Sub(step16)) + step27 = vecWrap8((step16).Add(step17)) + step10 = vecWrap8((step20).Add(step23)) + step11 = vecWrap8((step21).Add(step22)) + step12 = vecWrap8((step21).Sub(step22)) + step13 = vecWrap8((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + step17 = step27 + output0 = vecWrap8((step10).Add(step17)) + output1 = vecWrap8((step11).Add(step16)) + output2 = vecWrap8((step12).Add(step15)) + output3 = vecWrap8((step13).Add(step14)) + output4 = vecWrap8((step13).Sub(step14)) + output5 = vecWrap8((step12).Sub(step15)) + output6 = vecWrap8((step11).Sub(step16)) + output7 = vecWrap8((step10).Sub(step17)) + } + pixel.StorePixels8(dst[0*stride+col:], output0.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[0*stride+col:]))) + pixel.StorePixels8(dst[1*stride+col:], output1.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[1*stride+col:]))) + pixel.StorePixels8(dst[2*stride+col:], output2.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[2*stride+col:]))) + pixel.StorePixels8(dst[3*stride+col:], output3.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[3*stride+col:]))) + pixel.StorePixels8(dst[4*stride+col:], output4.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[4*stride+col:]))) + pixel.StorePixels8(dst[5*stride+col:], output5.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[5*stride+col:]))) + pixel.StorePixels8(dst[6*stride+col:], output6.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[6*stride+col:]))) + pixel.StorePixels8(dst[7*stride+col:], output7.Add(archsimd.BroadcastInt32x8(16)).ShiftAllRight(5).Add(pixel.LoadPixels8(dst[7*stride+col:]))) + return true +} +func inverseDCT16AVX2(input []int16, dst []byte, stride, rows int) bool { + if !pixel.Enabled || stride < 16 || len(input) < 16*rows || len(dst) < 15*stride+16 { + return false + } + defer pixel.FinishWide() + var tmp [256]int32 + for row := 0; row < rows; row += 8 { + var lane0, lane1, lane2, lane3, lane4, lane5, lane6, lane7, lane8, lane9, lane10, lane11, lane12, lane13, lane14, lane15 archsimd.Int32x8 + { + var a, b, c, d, e, f, g, h archsimd.Int32x8 + if row+0 < rows { + a = pixel.Load8(input[(row+0)*16+0:]) + } + if row+1 < rows { + b = pixel.Load8(input[(row+1)*16+0:]) + } + if row+2 < rows { + c = pixel.Load8(input[(row+2)*16+0:]) + } + if row+3 < rows { + d = pixel.Load8(input[(row+3)*16+0:]) + } + if row+4 < rows { + e = pixel.Load8(input[(row+4)*16+0:]) + } + if row+5 < rows { + f = pixel.Load8(input[(row+5)*16+0:]) + } + if row+6 < rows { + g = pixel.Load8(input[(row+6)*16+0:]) + } + if row+7 < rows { + h = pixel.Load8(input[(row+7)*16+0:]) + } + lane0, lane1, lane2, lane3, lane4, lane5, lane6, lane7 = pixel.Transpose8(a, b, c, d, e, f, g, h) + } + { + var a, b, c, d, e, f, g, h archsimd.Int32x8 + if row+0 < rows { + a = pixel.Load8(input[(row+0)*16+8:]) + } + if row+1 < rows { + b = pixel.Load8(input[(row+1)*16+8:]) + } + if row+2 < rows { + c = pixel.Load8(input[(row+2)*16+8:]) + } + if row+3 < rows { + d = pixel.Load8(input[(row+3)*16+8:]) + } + if row+4 < rows { + e = pixel.Load8(input[(row+4)*16+8:]) + } + if row+5 < rows { + f = pixel.Load8(input[(row+5)*16+8:]) + } + if row+6 < rows { + g = pixel.Load8(input[(row+6)*16+8:]) + } + if row+7 < rows { + h = pixel.Load8(input[(row+7)*16+8:]) + } + lane8, lane9, lane10, lane11, lane12, lane13, lane14, lane15 = pixel.Transpose8(a, b, c, d, e, f, g, h) + } + var output0, output1, output2, output3, output4, output5, output6, output7, output8, output9, output10, output11, output12, output13, output14, output15 archsimd.Int32x8 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step18, step19, step110, step111, step112, step113, step114, step115, step20, step21, step22, step23, step24, step25, step26, step27, step28, step29, step210, step211, step212, step213, step214, step215 archsimd.Int32x8 + step10 = lane0 + step11 = lane8 + step12 = lane4 + step13 = lane12 + step14 = lane2 + step15 = lane10 + step16 = lane6 + step17 = lane14 + step18 = lane1 + step19 = lane9 + step110 = lane5 + step111 = lane13 + step112 = lane3 + step113 = lane11 + step114 = lane7 + step115 = lane15 + step20 = step10 + step21 = step11 + step22 = step12 + step23 = step13 + step24 = step14 + step25 = step15 + step26 = step16 + step27 = step17 + temp1 := pixel.MulAdd8(step18, archsimd.BroadcastInt32x8(cospi30_64), (step115).Mul(archsimd.BroadcastInt32x8(-cospi2_64))) + temp2 := pixel.MulAdd8(step18, archsimd.BroadcastInt32x8(cospi2_64), (step115).Mul(archsimd.BroadcastInt32x8(cospi30_64))) + step28 = vecWrap8(vecRound8(temp1)) + step215 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step19, archsimd.BroadcastInt32x8(cospi14_64), (step114).Mul(archsimd.BroadcastInt32x8(-cospi18_64))) + temp2 = pixel.MulAdd8(step19, archsimd.BroadcastInt32x8(cospi18_64), (step114).Mul(archsimd.BroadcastInt32x8(cospi14_64))) + step29 = vecWrap8(vecRound8(temp1)) + step214 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step110, archsimd.BroadcastInt32x8(cospi22_64), (step113).Mul(archsimd.BroadcastInt32x8(-cospi10_64))) + temp2 = pixel.MulAdd8(step110, archsimd.BroadcastInt32x8(cospi10_64), (step113).Mul(archsimd.BroadcastInt32x8(cospi22_64))) + step210 = vecWrap8(vecRound8(temp1)) + step213 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step111, archsimd.BroadcastInt32x8(cospi6_64), (step112).Mul(archsimd.BroadcastInt32x8(-cospi26_64))) + temp2 = pixel.MulAdd8(step111, archsimd.BroadcastInt32x8(cospi26_64), (step112).Mul(archsimd.BroadcastInt32x8(cospi6_64))) + step211 = vecWrap8(vecRound8(temp1)) + step212 = vecWrap8(vecRound8(temp2)) + step10 = step20 + step11 = step21 + step12 = step22 + step13 = step23 + temp1 = pixel.MulAdd8(step24, archsimd.BroadcastInt32x8(cospi28_64), (step27).Mul(archsimd.BroadcastInt32x8(-cospi4_64))) + temp2 = pixel.MulAdd8(step24, archsimd.BroadcastInt32x8(cospi4_64), (step27).Mul(archsimd.BroadcastInt32x8(cospi28_64))) + step14 = vecWrap8(vecRound8(temp1)) + step17 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step25, archsimd.BroadcastInt32x8(cospi12_64), (step26).Mul(archsimd.BroadcastInt32x8(-cospi20_64))) + temp2 = pixel.MulAdd8(step25, archsimd.BroadcastInt32x8(cospi20_64), (step26).Mul(archsimd.BroadcastInt32x8(cospi12_64))) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + step18 = vecWrap8((step28).Add(step29)) + step19 = vecWrap8((step28).Sub(step29)) + step110 = vecWrap8((step211).Sub(step210)) + step111 = vecWrap8((step210).Add(step211)) + step112 = vecWrap8((step212).Add(step213)) + step113 = vecWrap8((step212).Sub(step213)) + step114 = vecWrap8((step215).Sub(step214)) + step115 = vecWrap8((step214).Add(step215)) + temp1 = ((step10).Add(step11)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step10).Sub(step11)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step20 = vecWrap8(vecRound8(temp1)) + step21 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step12, archsimd.BroadcastInt32x8(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x8(-cospi8_64))) + temp2 = pixel.MulAdd8(step12, archsimd.BroadcastInt32x8(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + step22 = vecWrap8(vecRound8(temp1)) + step23 = vecWrap8(vecRound8(temp2)) + step24 = vecWrap8((step14).Add(step15)) + step25 = vecWrap8((step14).Sub(step15)) + step26 = vecWrap8((step17).Sub(step16)) + step27 = vecWrap8((step16).Add(step17)) + step28 = step18 + step215 = step115 + temp1 = pixel.MulAdd8(archsimd.Int32x8{}.Sub(step19), archsimd.BroadcastInt32x8(cospi8_64), (step114).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + temp2 = pixel.MulAdd8(step19, archsimd.BroadcastInt32x8(cospi24_64), (step114).Mul(archsimd.BroadcastInt32x8(cospi8_64))) + step29 = vecWrap8(vecRound8(temp1)) + step214 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(archsimd.Int32x8{}.Sub(step110), archsimd.BroadcastInt32x8(cospi24_64), (step113).Mul(archsimd.BroadcastInt32x8(-cospi8_64))) + temp2 = pixel.MulAdd8(archsimd.Int32x8{}.Sub(step110), archsimd.BroadcastInt32x8(cospi8_64), (step113).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + step210 = vecWrap8(vecRound8(temp1)) + step213 = vecWrap8(vecRound8(temp2)) + step211 = step111 + step212 = step112 + step10 = vecWrap8((step20).Add(step23)) + step11 = vecWrap8((step21).Add(step22)) + step12 = vecWrap8((step21).Sub(step22)) + step13 = vecWrap8((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + step17 = step27 + step18 = vecWrap8((step28).Add(step211)) + step19 = vecWrap8((step29).Add(step210)) + step110 = vecWrap8((step29).Sub(step210)) + step111 = vecWrap8((step28).Sub(step211)) + step112 = vecWrap8((step215).Sub(step212)) + step113 = vecWrap8((step214).Sub(step213)) + step114 = vecWrap8((step213).Add(step214)) + step115 = vecWrap8((step212).Add(step215)) + step20 = vecWrap8((step10).Add(step17)) + step21 = vecWrap8((step11).Add(step16)) + step22 = vecWrap8((step12).Add(step15)) + step23 = vecWrap8((step13).Add(step14)) + step24 = vecWrap8((step13).Sub(step14)) + step25 = vecWrap8((step12).Sub(step15)) + step26 = vecWrap8((step11).Sub(step16)) + step27 = vecWrap8((step10).Sub(step17)) + step28 = step18 + step29 = step19 + temp1 = ((step113).Sub(step110)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step110).Add(step113)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step210 = vecWrap8(vecRound8(temp1)) + step213 = vecWrap8(vecRound8(temp2)) + temp1 = ((step112).Sub(step111)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step111).Add(step112)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step211 = vecWrap8(vecRound8(temp1)) + step212 = vecWrap8(vecRound8(temp2)) + step214 = step114 + step215 = step115 + output0 = vecWrap8((step20).Add(step215)) + output1 = vecWrap8((step21).Add(step214)) + output2 = vecWrap8((step22).Add(step213)) + output3 = vecWrap8((step23).Add(step212)) + output4 = vecWrap8((step24).Add(step211)) + output5 = vecWrap8((step25).Add(step210)) + output6 = vecWrap8((step26).Add(step29)) + output7 = vecWrap8((step27).Add(step28)) + output8 = vecWrap8((step27).Sub(step28)) + output9 = vecWrap8((step26).Sub(step29)) + output10 = vecWrap8((step25).Sub(step210)) + output11 = vecWrap8((step24).Sub(step211)) + output12 = vecWrap8((step23).Sub(step212)) + output13 = vecWrap8((step22).Sub(step213)) + output14 = vecWrap8((step21).Sub(step214)) + output15 = vecWrap8((step20).Sub(step215)) + } + { + a, b, c, d, e, f, g, h := pixel.Transpose8(output0, output1, output2, output3, output4, output5, output6, output7) + a.Store(tmp[(row+0)*16+0:]) + b.Store(tmp[(row+1)*16+0:]) + c.Store(tmp[(row+2)*16+0:]) + d.Store(tmp[(row+3)*16+0:]) + e.Store(tmp[(row+4)*16+0:]) + f.Store(tmp[(row+5)*16+0:]) + g.Store(tmp[(row+6)*16+0:]) + h.Store(tmp[(row+7)*16+0:]) + } + { + a, b, c, d, e, f, g, h := pixel.Transpose8(output8, output9, output10, output11, output12, output13, output14, output15) + a.Store(tmp[(row+0)*16+8:]) + b.Store(tmp[(row+1)*16+8:]) + c.Store(tmp[(row+2)*16+8:]) + d.Store(tmp[(row+3)*16+8:]) + e.Store(tmp[(row+4)*16+8:]) + f.Store(tmp[(row+5)*16+8:]) + g.Store(tmp[(row+6)*16+8:]) + h.Store(tmp[(row+7)*16+8:]) + } + } + for col := 0; col < 16; col += 8 { + lane0 := archsimd.LoadInt32x8(tmp[0*16+col:]) + lane1 := archsimd.LoadInt32x8(tmp[1*16+col:]) + lane2 := archsimd.LoadInt32x8(tmp[2*16+col:]) + lane3 := archsimd.LoadInt32x8(tmp[3*16+col:]) + lane4 := archsimd.LoadInt32x8(tmp[4*16+col:]) + lane5 := archsimd.LoadInt32x8(tmp[5*16+col:]) + lane6 := archsimd.LoadInt32x8(tmp[6*16+col:]) + lane7 := archsimd.LoadInt32x8(tmp[7*16+col:]) + lane8 := archsimd.LoadInt32x8(tmp[8*16+col:]) + lane9 := archsimd.LoadInt32x8(tmp[9*16+col:]) + lane10 := archsimd.LoadInt32x8(tmp[10*16+col:]) + lane11 := archsimd.LoadInt32x8(tmp[11*16+col:]) + lane12 := archsimd.LoadInt32x8(tmp[12*16+col:]) + lane13 := archsimd.LoadInt32x8(tmp[13*16+col:]) + lane14 := archsimd.LoadInt32x8(tmp[14*16+col:]) + lane15 := archsimd.LoadInt32x8(tmp[15*16+col:]) + var output0, output1, output2, output3, output4, output5, output6, output7, output8, output9, output10, output11, output12, output13, output14, output15 archsimd.Int32x8 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step18, step19, step110, step111, step112, step113, step114, step115, step20, step21, step22, step23, step24, step25, step26, step27, step28, step29, step210, step211, step212, step213, step214, step215 archsimd.Int32x8 + step10 = lane0 + step11 = lane8 + step12 = lane4 + step13 = lane12 + step14 = lane2 + step15 = lane10 + step16 = lane6 + step17 = lane14 + step18 = lane1 + step19 = lane9 + step110 = lane5 + step111 = lane13 + step112 = lane3 + step113 = lane11 + step114 = lane7 + step115 = lane15 + step20 = step10 + step21 = step11 + step22 = step12 + step23 = step13 + step24 = step14 + step25 = step15 + step26 = step16 + step27 = step17 + temp1 := pixel.MulAdd8(step18, archsimd.BroadcastInt32x8(cospi30_64), (step115).Mul(archsimd.BroadcastInt32x8(-cospi2_64))) + temp2 := pixel.MulAdd8(step18, archsimd.BroadcastInt32x8(cospi2_64), (step115).Mul(archsimd.BroadcastInt32x8(cospi30_64))) + step28 = vecWrap8(vecRound8(temp1)) + step215 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step19, archsimd.BroadcastInt32x8(cospi14_64), (step114).Mul(archsimd.BroadcastInt32x8(-cospi18_64))) + temp2 = pixel.MulAdd8(step19, archsimd.BroadcastInt32x8(cospi18_64), (step114).Mul(archsimd.BroadcastInt32x8(cospi14_64))) + step29 = vecWrap8(vecRound8(temp1)) + step214 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step110, archsimd.BroadcastInt32x8(cospi22_64), (step113).Mul(archsimd.BroadcastInt32x8(-cospi10_64))) + temp2 = pixel.MulAdd8(step110, archsimd.BroadcastInt32x8(cospi10_64), (step113).Mul(archsimd.BroadcastInt32x8(cospi22_64))) + step210 = vecWrap8(vecRound8(temp1)) + step213 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step111, archsimd.BroadcastInt32x8(cospi6_64), (step112).Mul(archsimd.BroadcastInt32x8(-cospi26_64))) + temp2 = pixel.MulAdd8(step111, archsimd.BroadcastInt32x8(cospi26_64), (step112).Mul(archsimd.BroadcastInt32x8(cospi6_64))) + step211 = vecWrap8(vecRound8(temp1)) + step212 = vecWrap8(vecRound8(temp2)) + step10 = step20 + step11 = step21 + step12 = step22 + step13 = step23 + temp1 = pixel.MulAdd8(step24, archsimd.BroadcastInt32x8(cospi28_64), (step27).Mul(archsimd.BroadcastInt32x8(-cospi4_64))) + temp2 = pixel.MulAdd8(step24, archsimd.BroadcastInt32x8(cospi4_64), (step27).Mul(archsimd.BroadcastInt32x8(cospi28_64))) + step14 = vecWrap8(vecRound8(temp1)) + step17 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step25, archsimd.BroadcastInt32x8(cospi12_64), (step26).Mul(archsimd.BroadcastInt32x8(-cospi20_64))) + temp2 = pixel.MulAdd8(step25, archsimd.BroadcastInt32x8(cospi20_64), (step26).Mul(archsimd.BroadcastInt32x8(cospi12_64))) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + step18 = vecWrap8((step28).Add(step29)) + step19 = vecWrap8((step28).Sub(step29)) + step110 = vecWrap8((step211).Sub(step210)) + step111 = vecWrap8((step210).Add(step211)) + step112 = vecWrap8((step212).Add(step213)) + step113 = vecWrap8((step212).Sub(step213)) + step114 = vecWrap8((step215).Sub(step214)) + step115 = vecWrap8((step214).Add(step215)) + temp1 = ((step10).Add(step11)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step10).Sub(step11)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step20 = vecWrap8(vecRound8(temp1)) + step21 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(step12, archsimd.BroadcastInt32x8(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x8(-cospi8_64))) + temp2 = pixel.MulAdd8(step12, archsimd.BroadcastInt32x8(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + step22 = vecWrap8(vecRound8(temp1)) + step23 = vecWrap8(vecRound8(temp2)) + step24 = vecWrap8((step14).Add(step15)) + step25 = vecWrap8((step14).Sub(step15)) + step26 = vecWrap8((step17).Sub(step16)) + step27 = vecWrap8((step16).Add(step17)) + step28 = step18 + step215 = step115 + temp1 = pixel.MulAdd8(archsimd.Int32x8{}.Sub(step19), archsimd.BroadcastInt32x8(cospi8_64), (step114).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + temp2 = pixel.MulAdd8(step19, archsimd.BroadcastInt32x8(cospi24_64), (step114).Mul(archsimd.BroadcastInt32x8(cospi8_64))) + step29 = vecWrap8(vecRound8(temp1)) + step214 = vecWrap8(vecRound8(temp2)) + temp1 = pixel.MulAdd8(archsimd.Int32x8{}.Sub(step110), archsimd.BroadcastInt32x8(cospi24_64), (step113).Mul(archsimd.BroadcastInt32x8(-cospi8_64))) + temp2 = pixel.MulAdd8(archsimd.Int32x8{}.Sub(step110), archsimd.BroadcastInt32x8(cospi8_64), (step113).Mul(archsimd.BroadcastInt32x8(cospi24_64))) + step210 = vecWrap8(vecRound8(temp1)) + step213 = vecWrap8(vecRound8(temp2)) + step211 = step111 + step212 = step112 + step10 = vecWrap8((step20).Add(step23)) + step11 = vecWrap8((step21).Add(step22)) + step12 = vecWrap8((step21).Sub(step22)) + step13 = vecWrap8((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step15 = vecWrap8(vecRound8(temp1)) + step16 = vecWrap8(vecRound8(temp2)) + step17 = step27 + step18 = vecWrap8((step28).Add(step211)) + step19 = vecWrap8((step29).Add(step210)) + step110 = vecWrap8((step29).Sub(step210)) + step111 = vecWrap8((step28).Sub(step211)) + step112 = vecWrap8((step215).Sub(step212)) + step113 = vecWrap8((step214).Sub(step213)) + step114 = vecWrap8((step213).Add(step214)) + step115 = vecWrap8((step212).Add(step215)) + step20 = vecWrap8((step10).Add(step17)) + step21 = vecWrap8((step11).Add(step16)) + step22 = vecWrap8((step12).Add(step15)) + step23 = vecWrap8((step13).Add(step14)) + step24 = vecWrap8((step13).Sub(step14)) + step25 = vecWrap8((step12).Sub(step15)) + step26 = vecWrap8((step11).Sub(step16)) + step27 = vecWrap8((step10).Sub(step17)) + step28 = step18 + step29 = step19 + temp1 = ((step113).Sub(step110)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step110).Add(step113)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step210 = vecWrap8(vecRound8(temp1)) + step213 = vecWrap8(vecRound8(temp2)) + temp1 = ((step112).Sub(step111)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + temp2 = ((step111).Add(step112)).Mul(archsimd.BroadcastInt32x8(cospi16_64)) + step211 = vecWrap8(vecRound8(temp1)) + step212 = vecWrap8(vecRound8(temp2)) + step214 = step114 + step215 = step115 + output0 = vecWrap8((step20).Add(step215)) + output1 = vecWrap8((step21).Add(step214)) + output2 = vecWrap8((step22).Add(step213)) + output3 = vecWrap8((step23).Add(step212)) + output4 = vecWrap8((step24).Add(step211)) + output5 = vecWrap8((step25).Add(step210)) + output6 = vecWrap8((step26).Add(step29)) + output7 = vecWrap8((step27).Add(step28)) + output8 = vecWrap8((step27).Sub(step28)) + output9 = vecWrap8((step26).Sub(step29)) + output10 = vecWrap8((step25).Sub(step210)) + output11 = vecWrap8((step24).Sub(step211)) + output12 = vecWrap8((step23).Sub(step212)) + output13 = vecWrap8((step22).Sub(step213)) + output14 = vecWrap8((step21).Sub(step214)) + output15 = vecWrap8((step20).Sub(step215)) + } + pixel.StorePixels8(dst[0*stride+col:], output0.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[0*stride+col:]))) + pixel.StorePixels8(dst[1*stride+col:], output1.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[1*stride+col:]))) + pixel.StorePixels8(dst[2*stride+col:], output2.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[2*stride+col:]))) + pixel.StorePixels8(dst[3*stride+col:], output3.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[3*stride+col:]))) + pixel.StorePixels8(dst[4*stride+col:], output4.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[4*stride+col:]))) + pixel.StorePixels8(dst[5*stride+col:], output5.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[5*stride+col:]))) + pixel.StorePixels8(dst[6*stride+col:], output6.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[6*stride+col:]))) + pixel.StorePixels8(dst[7*stride+col:], output7.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[7*stride+col:]))) + pixel.StorePixels8(dst[8*stride+col:], output8.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[8*stride+col:]))) + pixel.StorePixels8(dst[9*stride+col:], output9.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[9*stride+col:]))) + pixel.StorePixels8(dst[10*stride+col:], output10.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[10*stride+col:]))) + pixel.StorePixels8(dst[11*stride+col:], output11.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[11*stride+col:]))) + pixel.StorePixels8(dst[12*stride+col:], output12.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[12*stride+col:]))) + pixel.StorePixels8(dst[13*stride+col:], output13.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[13*stride+col:]))) + pixel.StorePixels8(dst[14*stride+col:], output14.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[14*stride+col:]))) + pixel.StorePixels8(dst[15*stride+col:], output15.Add(archsimd.BroadcastInt32x8(32)).ShiftAllRight(6).Add(pixel.LoadPixels8(dst[15*stride+col:]))) + } + return true +} diff --git a/internal/vp9/dsp/highbd_convolve.go b/internal/vp9/dsp/highbd_convolve.go new file mode 100644 index 0000000..3da6cbf --- /dev/null +++ b/internal/vp9/dsp/highbd_convolve.go @@ -0,0 +1,242 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/highbd_convolve.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// High-bit-depth (10-bit / 12-bit) 8-tap subpel convolution kernels. +// Ported verbatim from libvpx v1.16.0 vpx_dsp/vpx_convolve.c. + +const ( + highbdSubpelBits = 4 + highbdSubpelMask = (1 << highbdSubpelBits) - 1 + highbdSubpelTaps = 8 + highbdFilterBits = 7 +) + +func clipPixelHighbd(val int, bd int) uint16 { + if val < 0 { + return 0 + } + maxVal := (1 << uint(bd)) - 1 + if val > maxVal { + return uint16(maxVal) + } + return uint16(val) +} + +func highbdRoundPowerOfTwo(val int, bits uint) int { + return (val + (1 << (bits - 1))) >> bits +} + +func highbdConvolveHoriz(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + xFilters *[16][8]int16, x0Q4, xStepQ4, w, h, bd int, +) { + srcOff -= highbdSubpelTaps/2 - 1 + for range h { + xQ4 := x0Q4 + for x := range w { + s := srcOff + (xQ4 >> highbdSubpelBits) + f := &xFilters[xQ4&highbdSubpelMask] + sum := int(src[s+0])*int(f[0]) + + int(src[s+1])*int(f[1]) + + int(src[s+2])*int(f[2]) + + int(src[s+3])*int(f[3]) + + int(src[s+4])*int(f[4]) + + int(src[s+5])*int(f[5]) + + int(src[s+6])*int(f[6]) + + int(src[s+7])*int(f[7]) + dst[dstOff+x] = clipPixelHighbd(highbdRoundPowerOfTwo(sum, highbdFilterBits), bd) + xQ4 += xStepQ4 + } + srcOff += srcStride + dstOff += dstStride + } +} + +func highbdConvolveAvgHoriz(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + xFilters *[16][8]int16, x0Q4, xStepQ4, w, h, bd int, +) { + srcOff -= highbdSubpelTaps/2 - 1 + for range h { + xQ4 := x0Q4 + for x := range w { + s := srcOff + (xQ4 >> highbdSubpelBits) + f := &xFilters[xQ4&highbdSubpelMask] + sum := int(src[s+0])*int(f[0]) + + int(src[s+1])*int(f[1]) + + int(src[s+2])*int(f[2]) + + int(src[s+3])*int(f[3]) + + int(src[s+4])*int(f[4]) + + int(src[s+5])*int(f[5]) + + int(src[s+6])*int(f[6]) + + int(src[s+7])*int(f[7]) + p := int(clipPixelHighbd(highbdRoundPowerOfTwo(sum, highbdFilterBits), bd)) + dst[dstOff+x] = uint16(highbdRoundPowerOfTwo(int(dst[dstOff+x])+p, 1)) + xQ4 += xStepQ4 + } + srcOff += srcStride + dstOff += dstStride + } +} + +func highbdConvolveVert(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + yFilters *[16][8]int16, y0Q4, yStepQ4, w, h, bd int, +) { + srcOff -= srcStride * (highbdSubpelTaps/2 - 1) + for x := range w { + yQ4 := y0Q4 + for y := range h { + s := srcOff + x + (yQ4>>highbdSubpelBits)*srcStride + f := &yFilters[yQ4&highbdSubpelMask] + sum := int(src[s+0*srcStride])*int(f[0]) + + int(src[s+1*srcStride])*int(f[1]) + + int(src[s+2*srcStride])*int(f[2]) + + int(src[s+3*srcStride])*int(f[3]) + + int(src[s+4*srcStride])*int(f[4]) + + int(src[s+5*srcStride])*int(f[5]) + + int(src[s+6*srcStride])*int(f[6]) + + int(src[s+7*srcStride])*int(f[7]) + dst[dstOff+y*dstStride+x] = clipPixelHighbd(highbdRoundPowerOfTwo(sum, highbdFilterBits), bd) + yQ4 += yStepQ4 + } + } +} + +func highbdConvolveAvgVert(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + yFilters *[16][8]int16, y0Q4, yStepQ4, w, h, bd int, +) { + srcOff -= srcStride * (highbdSubpelTaps/2 - 1) + for x := range w { + yQ4 := y0Q4 + for y := range h { + s := srcOff + x + (yQ4>>highbdSubpelBits)*srcStride + f := &yFilters[yQ4&highbdSubpelMask] + sum := int(src[s+0*srcStride])*int(f[0]) + + int(src[s+1*srcStride])*int(f[1]) + + int(src[s+2*srcStride])*int(f[2]) + + int(src[s+3*srcStride])*int(f[3]) + + int(src[s+4*srcStride])*int(f[4]) + + int(src[s+5*srcStride])*int(f[5]) + + int(src[s+6*srcStride])*int(f[6]) + + int(src[s+7*srcStride])*int(f[7]) + p := int(clipPixelHighbd(highbdRoundPowerOfTwo(sum, highbdFilterBits), bd)) + di := dstOff + y*dstStride + x + dst[di] = uint16(highbdRoundPowerOfTwo(int(dst[di])+p, 1)) + yQ4 += yStepQ4 + } + } +} + +// HighbdConvolveCopy copies a w x h uint16 block. +func HighbdConvolveCopy(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, w, h int, +) { + for range h { + copy(dst[dstOff:dstOff+w], src[srcOff:srcOff+w]) + srcOff += srcStride + dstOff += dstStride + } +} + +// HighbdConvolveAvg averages a w x h uint16 block into dst. +func HighbdConvolveAvg(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, w, h int, +) { + if highbdConvolveAvgSIMD(src, srcOff, srcStride, dst, dstOff, dstStride, w, h) { + return + } + for range h { + for x := range w { + dst[dstOff+x] = uint16(highbdRoundPowerOfTwo(int(dst[dstOff+x])+int(src[srcOff+x]), 1)) + } + srcOff += srcStride + dstOff += dstStride + } +} + +// HighbdConvolve8Horiz applies horizontal 8-tap subpel filtering. +func HighbdConvolve8Horiz(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + filter *[16][8]int16, x0Q4, xStepQ4, w, h, bd int, +) { + if highbdConvolve8HorizSIMD(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, x0Q4, xStepQ4, w, h, bd, false) { + return + } + highbdConvolveHoriz(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, x0Q4, xStepQ4, w, h, bd) +} + +// HighbdConvolve8AvgHoriz applies horizontal 8-tap subpel filtering and averages into dst. +func HighbdConvolve8AvgHoriz(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + filter *[16][8]int16, x0Q4, xStepQ4, w, h, bd int, +) { + if highbdConvolve8HorizSIMD(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, x0Q4, xStepQ4, w, h, bd, true) { + return + } + highbdConvolveAvgHoriz(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, x0Q4, xStepQ4, w, h, bd) +} + +// HighbdConvolve8Vert applies vertical 8-tap subpel filtering. +func HighbdConvolve8Vert(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + filter *[16][8]int16, y0Q4, yStepQ4, w, h, bd int, +) { + if highbdConvolve8VertSIMD(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, y0Q4, yStepQ4, w, h, bd, false) { + return + } + highbdConvolveVert(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, y0Q4, yStepQ4, w, h, bd) +} + +// HighbdConvolve8AvgVert applies vertical 8-tap subpel filtering and averages into dst. +func HighbdConvolve8AvgVert(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + filter *[16][8]int16, y0Q4, yStepQ4, w, h, bd int, +) { + if highbdConvolve8VertSIMD(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, y0Q4, yStepQ4, w, h, bd, true) { + return + } + highbdConvolveAvgVert(src, srcOff, srcStride, dst, dstOff, dstStride, + filter, y0Q4, yStepQ4, w, h, bd) +} + +// HighbdConvolve8 applies separable 2D 8-tap subpel filtering. +func HighbdConvolve8(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + filter *[16][8]int16, x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, bd int, +) { + var temp [64 * 135]uint16 + intermediateHeight := (((h-1)*yStepQ4 + y0Q4) >> highbdSubpelBits) + highbdSubpelTaps + HighbdConvolve8Horiz(src, srcOff-srcStride*(highbdSubpelTaps/2-1), srcStride, + temp[:], 0, 64, filter, x0Q4, xStepQ4, w, intermediateHeight, bd) + HighbdConvolve8Vert(temp[:], 64*(highbdSubpelTaps/2-1), 64, + dst, dstOff, dstStride, filter, y0Q4, yStepQ4, w, h, bd) +} + +// HighbdConvolve8Avg applies separable 2D 8-tap subpel filtering and averages into dst. +func HighbdConvolve8Avg(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + filter *[16][8]int16, x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, bd int, +) { + var temp [64 * 64]uint16 + HighbdConvolve8(src, srcOff, srcStride, temp[:], 0, 64, + filter, x0Q4, xStepQ4, y0Q4, yStepQ4, w, h, bd) + HighbdConvolveAvg(temp[:], 0, 64, dst, dstOff, dstStride, w, h) +} diff --git a/internal/vp9/dsp/highbd_intrapred.go b/internal/vp9/dsp/highbd_intrapred.go new file mode 100644 index 0000000..f7e89ed --- /dev/null +++ b/internal/vp9/dsp/highbd_intrapred.go @@ -0,0 +1,415 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/highbd_intrapred.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/vp9/common" + +// High-bit-depth (10-bit / 12-bit) VP9 intra predictors. +// Ported verbatim from libvpx v1.16.0 vpx_dsp/intrapred.c. +// +// Convention: `above` has top-left at index 0, above[0..bs-1] at indices +// 1..bs, and (for 4x4) above-right at indices 5..8. `left` has left[0..bs-1] +// at indices 0..bs-1. + +func highbdAvg2(a, b uint16) uint16 { + return uint16((int(a) + int(b) + 1) >> 1) +} + +func highbdAvg3(a, b, c uint16) uint16 { + return uint16((int(a) + 2*int(b) + int(c) + 2) >> 2) +} + +func highbdFill16(dst []uint16, val uint16) { + for i := range dst { + dst[i] = val + } +} + +// HighbdIntraPredict runs one VP9 intra predictor on a bs x bs uint16 block +// (bs in {4, 8, 16, 32}). aboveFull[0] is top-left, aboveFull[1..] is above. +func HighbdIntraPredict(dst []uint16, dstOff, stride, bs int, + mode common.PredictionMode, aboveFull []uint16, left []uint16, + haveTop, haveLeft bool, bd int, +) { + above := aboveFull[1:] + topLeft := aboveFull[0] + switch mode { + case common.DcPred: + switch { + case haveTop && haveLeft: + sum := 0 + for i := range bs { + sum += int(above[i]) + int(left[i]) + } + val := uint16((sum + bs) / (2 * bs)) + for r := range bs { + highbdFill16(dst[dstOff+r*stride:dstOff+r*stride+bs], val) + } + case haveTop: + sum := 0 + for i := range bs { + sum += int(above[i]) + } + val := uint16((sum + (bs >> 1)) / bs) + for r := range bs { + highbdFill16(dst[dstOff+r*stride:dstOff+r*stride+bs], val) + } + case haveLeft: + sum := 0 + for i := range bs { + sum += int(left[i]) + } + val := uint16((sum + (bs >> 1)) / bs) + for r := range bs { + highbdFill16(dst[dstOff+r*stride:dstOff+r*stride+bs], val) + } + default: + val := uint16(128 << uint(bd-8)) + for r := range bs { + highbdFill16(dst[dstOff+r*stride:dstOff+r*stride+bs], val) + } + } + case common.VPred: + for r := range bs { + copy(dst[dstOff+r*stride:dstOff+r*stride+bs], above[:bs]) + } + case common.HPred: + for r := range bs { + highbdFill16(dst[dstOff+r*stride:dstOff+r*stride+bs], left[r]) + } + case common.TmPred: + tl := int(topLeft) + for r := range bs { + lr := int(left[r]) - tl + row := dst[dstOff+r*stride:] + for c := range bs { + row[c] = clipPixelHighbd(lr+int(above[c]), bd) + } + } + case common.D45Pred: + if bs == 4 { + highbdD45Pred4x4(dst, dstOff, stride, above) + return + } + highbdD45Pred(dst, dstOff, stride, bs, above) + case common.D63Pred: + if bs == 4 { + highbdD63Pred4x4(dst, dstOff, stride, above) + return + } + highbdD63Pred(dst, dstOff, stride, bs, above) + case common.D117Pred: + if bs == 4 { + highbdD117Pred4x4(dst, dstOff, stride, topLeft, above, left) + return + } + highbdD117Pred(dst, dstOff, stride, bs, topLeft, above, left) + case common.D135Pred: + if bs == 4 { + highbdD135Pred4x4(dst, dstOff, stride, topLeft, above, left) + return + } + highbdD135Pred(dst, dstOff, stride, bs, topLeft, above, left) + case common.D153Pred: + if bs == 4 { + highbdD153Pred4x4(dst, dstOff, stride, topLeft, above, left) + return + } + highbdD153Pred(dst, dstOff, stride, bs, topLeft, above, left) + case common.D207Pred: + if bs == 4 { + highbdD207Pred4x4(dst, dstOff, stride, left) + return + } + highbdD207Pred(dst, dstOff, stride, bs, left) + } +} + +func highbdD207Pred4x4(dst []uint16, off, stride int, left []uint16) { + I, J, K, L := left[0], left[1], left[2], left[3] + dst[off+0*stride+0] = highbdAvg2(I, J) + v := highbdAvg2(J, K) + dst[off+0*stride+2] = v + dst[off+1*stride+0] = v + v = highbdAvg2(K, L) + dst[off+1*stride+2] = v + dst[off+2*stride+0] = v + dst[off+0*stride+1] = highbdAvg3(I, J, K) + v = highbdAvg3(J, K, L) + dst[off+0*stride+3] = v + dst[off+1*stride+1] = v + v = highbdAvg3(K, L, L) + dst[off+1*stride+3] = v + dst[off+2*stride+1] = v + dst[off+2*stride+3] = L + dst[off+2*stride+2] = L + dst[off+3*stride+0] = L + dst[off+3*stride+1] = L + dst[off+3*stride+2] = L + dst[off+3*stride+3] = L +} + +func highbdD63Pred4x4(dst []uint16, off, stride int, above []uint16) { + A, B, C, D := above[0], above[1], above[2], above[3] + E, F, G := above[4], above[5], above[6] + dst[off+0*stride+0] = highbdAvg2(A, B) + v := highbdAvg2(B, C) + dst[off+0*stride+1] = v + dst[off+2*stride+0] = v + v = highbdAvg2(C, D) + dst[off+0*stride+2] = v + dst[off+2*stride+1] = v + v = highbdAvg2(D, E) + dst[off+0*stride+3] = v + dst[off+2*stride+2] = v + dst[off+2*stride+3] = highbdAvg2(E, F) + + dst[off+1*stride+0] = highbdAvg3(A, B, C) + v = highbdAvg3(B, C, D) + dst[off+1*stride+1] = v + dst[off+3*stride+0] = v + v = highbdAvg3(C, D, E) + dst[off+1*stride+2] = v + dst[off+3*stride+1] = v + v = highbdAvg3(D, E, F) + dst[off+1*stride+3] = v + dst[off+3*stride+2] = v + dst[off+3*stride+3] = highbdAvg3(E, F, G) +} + +func highbdD45Pred4x4(dst []uint16, off, stride int, above []uint16) { + A, B, C, D := above[0], above[1], above[2], above[3] + E, F, G, H := above[4], above[5], above[6], above[7] + dst[off+0*stride+0] = highbdAvg3(A, B, C) + v := highbdAvg3(B, C, D) + dst[off+0*stride+1] = v + dst[off+1*stride+0] = v + v = highbdAvg3(C, D, E) + dst[off+0*stride+2] = v + dst[off+1*stride+1] = v + dst[off+2*stride+0] = v + v = highbdAvg3(D, E, F) + dst[off+0*stride+3] = v + dst[off+1*stride+2] = v + dst[off+2*stride+1] = v + dst[off+3*stride+0] = v + v = highbdAvg3(E, F, G) + dst[off+1*stride+3] = v + dst[off+2*stride+2] = v + dst[off+3*stride+1] = v + v = highbdAvg3(F, G, H) + dst[off+2*stride+3] = v + dst[off+3*stride+2] = v + dst[off+3*stride+3] = H +} + +func highbdD117Pred4x4(dst []uint16, off, stride int, X uint16, above, left []uint16) { + I, J, K := left[0], left[1], left[2] + A, B, C, D := above[0], above[1], above[2], above[3] + v := highbdAvg2(X, A) + dst[off+0*stride+0] = v + dst[off+2*stride+1] = v + v = highbdAvg2(A, B) + dst[off+0*stride+1] = v + dst[off+2*stride+2] = v + v = highbdAvg2(B, C) + dst[off+0*stride+2] = v + dst[off+2*stride+3] = v + dst[off+0*stride+3] = highbdAvg2(C, D) + + dst[off+3*stride+0] = highbdAvg3(K, J, I) + dst[off+2*stride+0] = highbdAvg3(J, I, X) + v = highbdAvg3(I, X, A) + dst[off+1*stride+0] = v + dst[off+3*stride+1] = v + v = highbdAvg3(X, A, B) + dst[off+1*stride+1] = v + dst[off+3*stride+2] = v + v = highbdAvg3(A, B, C) + dst[off+1*stride+2] = v + dst[off+3*stride+3] = v + dst[off+1*stride+3] = highbdAvg3(B, C, D) +} + +func highbdD135Pred4x4(dst []uint16, off, stride int, X uint16, above, left []uint16) { + I, J, K, L := left[0], left[1], left[2], left[3] + A, B, C, D := above[0], above[1], above[2], above[3] + dst[off+3*stride+0] = highbdAvg3(J, K, L) + v := highbdAvg3(I, J, K) + dst[off+3*stride+1] = v + dst[off+2*stride+0] = v + v = highbdAvg3(X, I, J) + dst[off+3*stride+2] = v + dst[off+2*stride+1] = v + dst[off+1*stride+0] = v + v = highbdAvg3(A, X, I) + dst[off+3*stride+3] = v + dst[off+2*stride+2] = v + dst[off+1*stride+1] = v + dst[off+0*stride+0] = v + v = highbdAvg3(B, A, X) + dst[off+2*stride+3] = v + dst[off+1*stride+2] = v + dst[off+0*stride+1] = v + v = highbdAvg3(C, B, A) + dst[off+1*stride+3] = v + dst[off+0*stride+2] = v + dst[off+0*stride+3] = highbdAvg3(D, C, B) +} + +func highbdD153Pred4x4(dst []uint16, off, stride int, X uint16, above, left []uint16) { + I, J, K, L := left[0], left[1], left[2], left[3] + A, B, C := above[0], above[1], above[2] + v := highbdAvg2(I, X) + dst[off+0*stride+0] = v + dst[off+1*stride+2] = v + v = highbdAvg2(J, I) + dst[off+1*stride+0] = v + dst[off+2*stride+2] = v + v = highbdAvg2(K, J) + dst[off+2*stride+0] = v + dst[off+3*stride+2] = v + dst[off+3*stride+0] = highbdAvg2(L, K) + + dst[off+0*stride+3] = highbdAvg3(A, B, C) + dst[off+0*stride+2] = highbdAvg3(X, A, B) + v = highbdAvg3(I, X, A) + dst[off+0*stride+1] = v + dst[off+1*stride+3] = v + v = highbdAvg3(J, I, X) + dst[off+1*stride+1] = v + dst[off+2*stride+3] = v + v = highbdAvg3(K, J, I) + dst[off+2*stride+1] = v + dst[off+3*stride+3] = v + dst[off+3*stride+1] = highbdAvg3(L, K, J) +} + +func highbdD207Pred(dst []uint16, off, stride, bs int, left []uint16) { + for r := range bs - 1 { + dst[off+r*stride] = highbdAvg2(left[r], left[r+1]) + } + dst[off+(bs-1)*stride] = left[bs-1] + off++ + for r := range bs - 2 { + dst[off+r*stride] = highbdAvg3(left[r], left[r+1], left[r+2]) + } + dst[off+(bs-2)*stride] = highbdAvg3(left[bs-2], left[bs-1], left[bs-1]) + dst[off+(bs-1)*stride] = left[bs-1] + off++ + for c := range bs - 2 { + dst[off+(bs-1)*stride+c] = left[bs-1] + } + for r := bs - 2; r >= 0; r-- { + for c := range bs - 2 { + dst[off+r*stride+c] = dst[off+(r+1)*stride+c-2] + } + } +} + +func highbdD63Pred(dst []uint16, off, stride, bs int, above []uint16) { + for c := range bs { + dst[off+c] = highbdAvg2(above[c], above[c+1]) + dst[off+stride+c] = highbdAvg3(above[c], above[c+1], above[c+2]) + } + for r, size := 2, bs-2; r < bs; r, size = r+2, size-1 { + copy(dst[off+r*stride:off+r*stride+size], dst[off+(r>>1):off+(r>>1)+size]) + highbdFill16(dst[off+r*stride+size:off+r*stride+bs], above[bs-1]) + copy(dst[off+(r+1)*stride:off+(r+1)*stride+size], dst[off+stride+(r>>1):off+stride+(r>>1)+size]) + highbdFill16(dst[off+(r+1)*stride+size:off+(r+1)*stride+bs], above[bs-1]) + } +} + +func highbdD45Pred(dst []uint16, off, stride, bs int, above []uint16) { + aboveRight := above[bs-1] + row0 := off + for x := range bs - 1 { + dst[off+x] = highbdAvg3(above[x], above[x+1], above[x+2]) + } + dst[off+bs-1] = aboveRight + off += stride + for x, size := 1, bs-2; x < bs; x, size = x+1, size-1 { + copy(dst[off:off+size], dst[row0+x:row0+x+size]) + highbdFill16(dst[off+size:off+bs], aboveRight) + off += stride + } +} + +func highbdD117Pred(dst []uint16, off, stride, bs int, topLeft uint16, above, left []uint16) { + dst[off+0] = highbdAvg2(topLeft, above[0]) + for c := 1; c < bs; c++ { + dst[off+c] = highbdAvg2(above[c-1], above[c]) + } + off += stride + + dst[off+0] = highbdAvg3(left[0], topLeft, above[0]) + dst[off+1] = highbdAvg3(topLeft, above[0], above[1]) + for c := 2; c < bs; c++ { + dst[off+c] = highbdAvg3(above[c-2], above[c-1], above[c]) + } + off += stride + + dst[off+0] = highbdAvg3(topLeft, left[0], left[1]) + for r := 3; r < bs; r++ { + dst[off+(r-2)*stride] = highbdAvg3(left[r-3], left[r-2], left[r-1]) + } + + for r := 2; r < bs; r++ { + for c := 1; c < bs; c++ { + dst[off+c] = dst[off-2*stride+c-1] + } + off += stride + } +} + +func highbdD135Pred(dst []uint16, off, stride, bs int, topLeft uint16, above, left []uint16) { + var border [32 + 32 - 1]uint16 + for i := range bs - 2 { + border[i] = highbdAvg3(left[bs-3-i], left[bs-2-i], left[bs-1-i]) + } + border[bs-2] = highbdAvg3(topLeft, left[0], left[1]) + border[bs-1] = highbdAvg3(left[0], topLeft, above[0]) + border[bs] = highbdAvg3(topLeft, above[0], above[1]) + for i := range bs - 2 { + border[bs+1+i] = highbdAvg3(above[i], above[i+1], above[i+2]) + } + for i := range bs { + copy(dst[off+i*stride:off+i*stride+bs], border[bs-1-i:bs-1-i+bs]) + } +} + +func highbdD153Pred(dst []uint16, off, stride, bs int, topLeft uint16, above, left []uint16) { + dst[off+0] = highbdAvg2(topLeft, left[0]) + for r := 1; r < bs; r++ { + dst[off+r*stride] = highbdAvg2(left[r-1], left[r]) + } + off++ + + dst[off+0] = highbdAvg3(left[0], topLeft, above[0]) + dst[off+stride] = highbdAvg3(topLeft, left[0], left[1]) + for r := 2; r < bs; r++ { + dst[off+r*stride] = highbdAvg3(left[r-2], left[r-1], left[r]) + } + off++ + + dst[off+0] = highbdAvg3(topLeft, above[0], above[1]) + for c := 1; c < bs-2; c++ { + dst[off+c] = highbdAvg3(above[c-1], above[c], above[c+1]) + } + off += stride + + for r := 1; r < bs; r++ { + for c := range bs - 2 { + dst[off+c] = dst[off-stride+c-2] + } + off += stride + } +} diff --git a/internal/vp9/dsp/highbd_inv_txfm.go b/internal/vp9/dsp/highbd_inv_txfm.go new file mode 100644 index 0000000..68e35d6 --- /dev/null +++ b/internal/vp9/dsp/highbd_inv_txfm.go @@ -0,0 +1,786 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/highbd_inv_txfm.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/vp9/common" + +// High-bit-depth (10-bit / 12-bit) VP9 inverse transforms. +// Ported verbatim from libvpx v1.16.0 vpx_dsp/inv_txfm.c. + +func highbdClipPixelAdd(dest uint16, trans int32, bd int) uint16 { + return clipPixelHighbd(int(dest)+int(trans), bd) +} + +func highbdRoundShift(val int32, bits uint) int32 { + return (val + (1 << (bits - 1))) >> bits +} + +func highbdIwht4x4Add(input []int32, dest []uint16, dstOff, stride, eob, bd int) { + if eob <= 1 { + a1 := input[0] >> unitQuantShift + e1 := a1 >> 1 + a1 -= e1 + var tmp [4]int32 + tmp[0] = a1 + tmp[1] = e1 + tmp[2] = e1 + tmp[3] = e1 + for i := range 4 { + e := tmp[i] >> 1 + a := tmp[i] - e + dest[dstOff+0*stride+i] = highbdClipPixelAdd(dest[dstOff+0*stride+i], a, bd) + dest[dstOff+1*stride+i] = highbdClipPixelAdd(dest[dstOff+1*stride+i], e, bd) + dest[dstOff+2*stride+i] = highbdClipPixelAdd(dest[dstOff+2*stride+i], e, bd) + dest[dstOff+3*stride+i] = highbdClipPixelAdd(dest[dstOff+3*stride+i], e, bd) + } + return + } + var output [16]int32 + for i := range 4 { + in := input[i*4:] + a1 := in[0] >> unitQuantShift + c1 := in[1] >> unitQuantShift + d1 := in[2] >> unitQuantShift + b1 := in[3] >> unitQuantShift + a1 += c1 + d1 -= b1 + e1 := (a1 - d1) >> 1 + b1 = e1 - b1 + c1 = e1 - c1 + a1 -= b1 + d1 += c1 + output[i*4+0] = a1 + output[i*4+1] = b1 + output[i*4+2] = c1 + output[i*4+3] = d1 + } + for i := range 4 { + a1 := output[0*4+i] + c1 := output[1*4+i] + d1 := output[2*4+i] + b1 := output[3*4+i] + a1 += c1 + d1 -= b1 + e1 := (a1 - d1) >> 1 + b1 = e1 - b1 + c1 = e1 - c1 + a1 -= b1 + d1 += c1 + dest[dstOff+0*stride+i] = highbdClipPixelAdd(dest[dstOff+0*stride+i], a1, bd) + dest[dstOff+1*stride+i] = highbdClipPixelAdd(dest[dstOff+1*stride+i], b1, bd) + dest[dstOff+2*stride+i] = highbdClipPixelAdd(dest[dstOff+2*stride+i], c1, bd) + dest[dstOff+3*stride+i] = highbdClipPixelAdd(dest[dstOff+3*stride+i], d1, bd) + } +} + +func highbdIdct4(input, output []int32) { + var step [4]int32 + t1 := (int64(input[0]) + int64(input[2])) * cospi16_64 + t2 := (int64(input[0]) - int64(input[2])) * cospi16_64 + step[0] = dctConstRoundShift(t1) + step[1] = dctConstRoundShift(t2) + t1 = int64(input[1])*cospi24_64 - int64(input[3])*cospi8_64 + t2 = int64(input[1])*cospi8_64 + int64(input[3])*cospi24_64 + step[2] = dctConstRoundShift(t1) + step[3] = dctConstRoundShift(t2) + + output[0] = step[0] + step[3] + output[1] = step[1] + step[2] + output[2] = step[1] - step[2] + output[3] = step[0] - step[3] +} + +func highbdIadst4(input, output []int32) { + x0, x1, x2, x3 := input[0], input[1], input[2], input[3] + if x0|x1|x2|x3 == 0 { + output[0], output[1], output[2], output[3] = 0, 0, 0, 0 + return + } + s0 := int64(sinpi1_9) * int64(x0) + s1 := int64(sinpi2_9) * int64(x0) + s2 := int64(sinpi3_9) * int64(x1) + s3 := int64(sinpi4_9) * int64(x2) + s4 := int64(sinpi1_9) * int64(x2) + s5 := int64(sinpi2_9) * int64(x3) + s6 := int64(sinpi4_9) * int64(x3) + s7 := int64(x0 - x2 + x3) + + s0 = s0 + s3 + s5 + s1 = s1 - s4 - s6 + s3 = s2 + s2 = int64(sinpi3_9) * s7 + + output[0] = dctConstRoundShift(s0 + s3) + output[1] = dctConstRoundShift(s1 + s3) + output[2] = dctConstRoundShift(s2) + output[3] = dctConstRoundShift(s0 + s1 - s3) +} + +func highbdIdct8(input, output []int32) { + var step1, step2 [8]int32 + step1[0] = input[0] + step1[2] = input[4] + step1[1] = input[2] + step1[3] = input[6] + t1 := int64(input[1])*cospi28_64 - int64(input[7])*cospi4_64 + t2 := int64(input[1])*cospi4_64 + int64(input[7])*cospi28_64 + step1[4] = dctConstRoundShift(t1) + step1[7] = dctConstRoundShift(t2) + t1 = int64(input[5])*cospi12_64 - int64(input[3])*cospi20_64 + t2 = int64(input[5])*cospi20_64 + int64(input[3])*cospi12_64 + step1[5] = dctConstRoundShift(t1) + step1[6] = dctConstRoundShift(t2) + + highbdIdct4(step1[:4], step1[:4]) + + step2[4] = step1[4] + step1[5] + step2[5] = step1[4] - step1[5] + step2[6] = -step1[6] + step1[7] + step2[7] = step1[6] + step1[7] + + step1[4] = step2[4] + t1 = int64(step2[6]-step2[5]) * cospi16_64 + t2 = int64(step2[5]+step2[6]) * cospi16_64 + step1[5] = dctConstRoundShift(t1) + step1[6] = dctConstRoundShift(t2) + step1[7] = step2[7] + + output[0] = step1[0] + step1[7] + output[1] = step1[1] + step1[6] + output[2] = step1[2] + step1[5] + output[3] = step1[3] + step1[4] + output[4] = step1[3] - step1[4] + output[5] = step1[2] - step1[5] + output[6] = step1[1] - step1[6] + output[7] = step1[0] - step1[7] +} + +func highbdIadst8(input, output []int32) { + x0, x1, x2, x3 := input[7], input[0], input[5], input[2] + x4, x5, x6, x7 := input[3], input[4], input[1], input[6] + if x0|x1|x2|x3|x4|x5|x6|x7 == 0 { + for i := range 8 { + output[i] = 0 + } + return + } + s0 := int64(cospi2_64)*int64(x0) + int64(cospi30_64)*int64(x1) + s1 := int64(cospi30_64)*int64(x0) - int64(cospi2_64)*int64(x1) + s2 := int64(cospi10_64)*int64(x2) + int64(cospi22_64)*int64(x3) + s3 := int64(cospi22_64)*int64(x2) - int64(cospi10_64)*int64(x3) + s4 := int64(cospi18_64)*int64(x4) + int64(cospi14_64)*int64(x5) + s5 := int64(cospi14_64)*int64(x4) - int64(cospi18_64)*int64(x5) + s6 := int64(cospi26_64)*int64(x6) + int64(cospi6_64)*int64(x7) + s7 := int64(cospi6_64)*int64(x6) - int64(cospi26_64)*int64(x7) + + x0 = dctConstRoundShift(s0 + s4) + x1 = dctConstRoundShift(s1 + s5) + x2 = dctConstRoundShift(s2 + s6) + x3 = dctConstRoundShift(s3 + s7) + x4 = dctConstRoundShift(s0 - s4) + x5 = dctConstRoundShift(s1 - s5) + x6 = dctConstRoundShift(s2 - s6) + x7 = dctConstRoundShift(s3 - s7) + + s0, s1, s2, s3 = int64(x0), int64(x1), int64(x2), int64(x3) + s4 = int64(cospi8_64)*int64(x4) + int64(cospi24_64)*int64(x5) + s5 = int64(cospi24_64)*int64(x4) - int64(cospi8_64)*int64(x5) + s6 = int64(-cospi24_64)*int64(x6) + int64(cospi8_64)*int64(x7) + s7 = int64(cospi8_64)*int64(x6) + int64(cospi24_64)*int64(x7) + + x0 = int32(s0 + s2) + x1 = int32(s1 + s3) + x2 = int32(s0 - s2) + x3 = int32(s1 - s3) + x4 = dctConstRoundShift(s4 + s6) + x5 = dctConstRoundShift(s5 + s7) + x6 = dctConstRoundShift(s4 - s6) + x7 = dctConstRoundShift(s5 - s7) + + x2, x3 = dctConstRoundShift(int64(cospi16_64)*int64(x2+x3)), dctConstRoundShift(int64(cospi16_64)*int64(x2-x3)) + x6, x7 = dctConstRoundShift(int64(cospi16_64)*int64(x6+x7)), dctConstRoundShift(int64(cospi16_64)*int64(x6-x7)) + + output[0] = x0 + output[1] = -x4 + output[2] = x6 + output[3] = -x2 + output[4] = x3 + output[5] = -x7 + output[6] = x5 + output[7] = -x1 +} + +func highbdIdct16(input, output []int32) { + var step1, step2 [16]int32 + step1[0] = input[0] + step1[1] = input[8] + step1[2] = input[4] + step1[3] = input[12] + step1[4] = input[2] + step1[5] = input[10] + step1[6] = input[6] + step1[7] = input[14] + step1[8] = input[1] + step1[9] = input[9] + step1[10] = input[5] + step1[11] = input[13] + step1[12] = input[3] + step1[13] = input[11] + step1[14] = input[7] + step1[15] = input[15] + + copy(step2[:8], step1[:8]) + step2[8] = dctConstRoundShift(int64(step1[8])*cospi30_64 - int64(step1[15])*cospi2_64) + step2[15] = dctConstRoundShift(int64(step1[8])*cospi2_64 + int64(step1[15])*cospi30_64) + step2[9] = dctConstRoundShift(int64(step1[9])*cospi14_64 - int64(step1[14])*cospi18_64) + step2[14] = dctConstRoundShift(int64(step1[9])*cospi18_64 + int64(step1[14])*cospi14_64) + step2[10] = dctConstRoundShift(int64(step1[10])*cospi22_64 - int64(step1[13])*cospi10_64) + step2[13] = dctConstRoundShift(int64(step1[10])*cospi10_64 + int64(step1[13])*cospi22_64) + step2[11] = dctConstRoundShift(int64(step1[11])*cospi6_64 - int64(step1[12])*cospi26_64) + step2[12] = dctConstRoundShift(int64(step1[11])*cospi26_64 + int64(step1[12])*cospi6_64) + + copy(step1[:4], step2[:4]) + step1[4] = dctConstRoundShift(int64(step2[4])*cospi28_64 - int64(step2[7])*cospi4_64) + step1[7] = dctConstRoundShift(int64(step2[4])*cospi4_64 + int64(step2[7])*cospi28_64) + step1[5] = dctConstRoundShift(int64(step2[5])*cospi12_64 - int64(step2[6])*cospi20_64) + step1[6] = dctConstRoundShift(int64(step2[5])*cospi20_64 + int64(step2[6])*cospi12_64) + step1[8] = step2[8] + step2[9] + step1[9] = step2[8] - step2[9] + step1[10] = -step2[10] + step2[11] + step1[11] = step2[10] + step2[11] + step1[12] = step2[12] + step2[13] + step1[13] = step2[12] - step2[13] + step1[14] = -step2[14] + step2[15] + step1[15] = step2[14] + step2[15] + + step2[0] = dctConstRoundShift(int64(step1[0]+step1[1]) * cospi16_64) + step2[1] = dctConstRoundShift(int64(step1[0]-step1[1]) * cospi16_64) + step2[2] = dctConstRoundShift(int64(step1[2])*cospi24_64 - int64(step1[3])*cospi8_64) + step2[3] = dctConstRoundShift(int64(step1[2])*cospi8_64 + int64(step1[3])*cospi24_64) + step2[4] = step1[4] + step1[5] + step2[5] = step1[4] - step1[5] + step2[6] = -step1[6] + step1[7] + step2[7] = step1[6] + step1[7] + step2[8] = step1[8] + step2[15] = step1[15] + step2[9] = dctConstRoundShift(-int64(step1[9])*cospi8_64 + int64(step1[14])*cospi24_64) + step2[14] = dctConstRoundShift(int64(step1[9])*cospi24_64 + int64(step1[14])*cospi8_64) + step2[10] = dctConstRoundShift(-int64(step1[10])*cospi24_64 - int64(step1[13])*cospi8_64) + step2[13] = dctConstRoundShift(-int64(step1[10])*cospi8_64 + int64(step1[13])*cospi24_64) + step2[11] = step1[11] + step2[12] = step1[12] + + step1[0] = step2[0] + step2[3] + step1[1] = step2[1] + step2[2] + step1[2] = step2[1] - step2[2] + step1[3] = step2[0] - step2[3] + step1[4] = step2[4] + step1[5] = dctConstRoundShift(int64(step2[6]-step2[5]) * cospi16_64) + step1[6] = dctConstRoundShift(int64(step2[5]+step2[6]) * cospi16_64) + step1[7] = step2[7] + step1[8] = step2[8] + step2[11] + step1[9] = step2[9] + step2[10] + step1[10] = step2[9] - step2[10] + step1[11] = step2[8] - step2[11] + step1[12] = -step2[12] + step2[15] + step1[13] = -step2[13] + step2[14] + step1[14] = step2[13] + step2[14] + step1[15] = step2[12] + step2[15] + + step2[0] = step1[0] + step1[7] + step2[1] = step1[1] + step1[6] + step2[2] = step1[2] + step1[5] + step2[3] = step1[3] + step1[4] + step2[4] = step1[3] - step1[4] + step2[5] = step1[2] - step1[5] + step2[6] = step1[1] - step1[6] + step2[7] = step1[0] - step1[7] + step2[8] = step1[8] + step2[9] = step1[9] + step2[10] = dctConstRoundShift(int64(-step1[10]+step1[13]) * cospi16_64) + step2[13] = dctConstRoundShift(int64(step1[10]+step1[13]) * cospi16_64) + step2[11] = dctConstRoundShift(int64(-step1[11]+step1[12]) * cospi16_64) + step2[12] = dctConstRoundShift(int64(step1[11]+step1[12]) * cospi16_64) + step2[14] = step1[14] + step2[15] = step1[15] + + for i := range 8 { + output[i] = step2[i] + step2[15-i] + output[15-i] = step2[i] - step2[15-i] + } +} + +func highbdIadst16(input, output []int32) { + x0, x1, x2, x3 := input[15], input[0], input[13], input[2] + x4, x5, x6, x7 := input[11], input[4], input[9], input[6] + x8, x9, x10, x11 := input[7], input[8], input[5], input[10] + x12, x13, x14, x15 := input[3], input[12], input[1], input[14] + if x0|x1|x2|x3|x4|x5|x6|x7|x8|x9|x10|x11|x12|x13|x14|x15 == 0 { + for i := range 16 { + output[i] = 0 + } + return + } + s0 := int64(x0)*cospi1_64 + int64(x1)*cospi31_64 + s1 := int64(x0)*cospi31_64 - int64(x1)*cospi1_64 + s2 := int64(x2)*cospi5_64 + int64(x3)*cospi27_64 + s3 := int64(x2)*cospi27_64 - int64(x3)*cospi5_64 + s4 := int64(x4)*cospi9_64 + int64(x5)*cospi23_64 + s5 := int64(x4)*cospi23_64 - int64(x5)*cospi9_64 + s6 := int64(x6)*cospi13_64 + int64(x7)*cospi19_64 + s7 := int64(x6)*cospi19_64 - int64(x7)*cospi13_64 + s8 := int64(x8)*cospi17_64 + int64(x9)*cospi15_64 + s9 := int64(x8)*cospi15_64 - int64(x9)*cospi17_64 + s10 := int64(x10)*cospi21_64 + int64(x11)*cospi11_64 + s11 := int64(x10)*cospi11_64 - int64(x11)*cospi21_64 + s12 := int64(x12)*cospi25_64 + int64(x13)*cospi7_64 + s13 := int64(x12)*cospi7_64 - int64(x13)*cospi25_64 + s14 := int64(x14)*cospi29_64 + int64(x15)*cospi3_64 + s15 := int64(x14)*cospi3_64 - int64(x15)*cospi29_64 + + x0 = dctConstRoundShift(s0 + s8) + x1 = dctConstRoundShift(s1 + s9) + x2 = dctConstRoundShift(s2 + s10) + x3 = dctConstRoundShift(s3 + s11) + x4 = dctConstRoundShift(s4 + s12) + x5 = dctConstRoundShift(s5 + s13) + x6 = dctConstRoundShift(s6 + s14) + x7 = dctConstRoundShift(s7 + s15) + x8 = dctConstRoundShift(s0 - s8) + x9 = dctConstRoundShift(s1 - s9) + x10 = dctConstRoundShift(s2 - s10) + x11 = dctConstRoundShift(s3 - s11) + x12 = dctConstRoundShift(s4 - s12) + x13 = dctConstRoundShift(s5 - s13) + x14 = dctConstRoundShift(s6 - s14) + x15 = dctConstRoundShift(s7 - s15) + + s0, s1, s2, s3 = int64(x0), int64(x1), int64(x2), int64(x3) + s4, s5, s6, s7 = int64(x4), int64(x5), int64(x6), int64(x7) + s8 = int64(x8)*cospi4_64 + int64(x9)*cospi28_64 + s9 = int64(x8)*cospi28_64 - int64(x9)*cospi4_64 + s10 = int64(x10)*cospi20_64 + int64(x11)*cospi12_64 + s11 = int64(x10)*cospi12_64 - int64(x11)*cospi20_64 + s12 = -int64(x12)*cospi28_64 + int64(x13)*cospi4_64 + s13 = int64(x12)*cospi4_64 + int64(x13)*cospi28_64 + s14 = -int64(x14)*cospi12_64 + int64(x15)*cospi20_64 + s15 = int64(x14)*cospi20_64 + int64(x15)*cospi12_64 + + x0 = int32(s0 + s4) + x1 = int32(s1 + s5) + x2 = int32(s2 + s6) + x3 = int32(s3 + s7) + x4 = int32(s0 - s4) + x5 = int32(s1 - s5) + x6 = int32(s2 - s6) + x7 = int32(s3 - s7) + x8 = dctConstRoundShift(s8 + s12) + x9 = dctConstRoundShift(s9 + s13) + x10 = dctConstRoundShift(s10 + s14) + x11 = dctConstRoundShift(s11 + s15) + x12 = dctConstRoundShift(s8 - s12) + x13 = dctConstRoundShift(s9 - s13) + x14 = dctConstRoundShift(s10 - s14) + x15 = dctConstRoundShift(s11 - s15) + + s0, s1, s2, s3 = int64(x0), int64(x1), int64(x2), int64(x3) + s4 = int64(x4)*cospi8_64 + int64(x5)*cospi24_64 + s5 = int64(x4)*cospi24_64 - int64(x5)*cospi8_64 + s6 = -int64(x6)*cospi24_64 + int64(x7)*cospi8_64 + s7 = int64(x6)*cospi8_64 + int64(x7)*cospi24_64 + s8, s9, s10, s11 = int64(x8), int64(x9), int64(x10), int64(x11) + s12 = int64(x12)*cospi8_64 + int64(x13)*cospi24_64 + s13 = int64(x12)*cospi24_64 - int64(x13)*cospi8_64 + s14 = -int64(x14)*cospi24_64 + int64(x15)*cospi8_64 + s15 = int64(x14)*cospi8_64 + int64(x15)*cospi24_64 + + x0 = int32(s0 + s2) + x1 = int32(s1 + s3) + x2 = int32(s0 - s2) + x3 = int32(s1 - s3) + x4 = dctConstRoundShift(s4 + s6) + x5 = dctConstRoundShift(s5 + s7) + x6 = dctConstRoundShift(s4 - s6) + x7 = dctConstRoundShift(s5 - s7) + x8 = int32(s8 + s10) + x9 = int32(s9 + s11) + x10 = int32(s8 - s10) + x11 = int32(s9 - s11) + x12 = dctConstRoundShift(s12 + s14) + x13 = dctConstRoundShift(s13 + s15) + x14 = dctConstRoundShift(s12 - s14) + x15 = dctConstRoundShift(s13 - s15) + + x2, x3 = dctConstRoundShift(int64(-cospi16_64)*int64(x2+x3)), dctConstRoundShift(int64(cospi16_64)*int64(x2-x3)) + x6, x7 = dctConstRoundShift(int64(cospi16_64)*int64(x6+x7)), dctConstRoundShift(int64(cospi16_64)*int64(-x6+x7)) + x10, x11 = dctConstRoundShift(int64(cospi16_64)*int64(x10+x11)), dctConstRoundShift(int64(cospi16_64)*int64(-x10+x11)) + x14, x15 = dctConstRoundShift(int64(-cospi16_64)*int64(x14+x15)), dctConstRoundShift(int64(cospi16_64)*int64(x14-x15)) + + output[0] = x0 + output[1] = -x8 + output[2] = x12 + output[3] = -x4 + output[4] = x6 + output[5] = x14 + output[6] = x10 + output[7] = x2 + output[8] = x3 + output[9] = x11 + output[10] = x15 + output[11] = x7 + output[12] = x5 + output[13] = -x13 + output[14] = x9 + output[15] = -x1 +} + +func highbdIdct32(input, output []int32) { + var step1, step2 [32]int32 + step1[0] = input[0] + step1[1] = input[16] + step1[2] = input[8] + step1[3] = input[24] + step1[4] = input[4] + step1[5] = input[20] + step1[6] = input[12] + step1[7] = input[28] + step1[8] = input[2] + step1[9] = input[18] + step1[10] = input[10] + step1[11] = input[26] + step1[12] = input[6] + step1[13] = input[22] + step1[14] = input[14] + step1[15] = input[30] + + step1[16] = dctConstRoundShift(int64(input[1])*cospi31_64 - int64(input[31])*cospi1_64) + step1[31] = dctConstRoundShift(int64(input[1])*cospi1_64 + int64(input[31])*cospi31_64) + step1[17] = dctConstRoundShift(int64(input[17])*cospi15_64 - int64(input[15])*cospi17_64) + step1[30] = dctConstRoundShift(int64(input[17])*cospi17_64 + int64(input[15])*cospi15_64) + step1[18] = dctConstRoundShift(int64(input[9])*cospi23_64 - int64(input[23])*cospi9_64) + step1[29] = dctConstRoundShift(int64(input[9])*cospi9_64 + int64(input[23])*cospi23_64) + step1[19] = dctConstRoundShift(int64(input[25])*cospi7_64 - int64(input[7])*cospi25_64) + step1[28] = dctConstRoundShift(int64(input[25])*cospi25_64 + int64(input[7])*cospi7_64) + step1[20] = dctConstRoundShift(int64(input[5])*cospi27_64 - int64(input[27])*cospi5_64) + step1[27] = dctConstRoundShift(int64(input[5])*cospi5_64 + int64(input[27])*cospi27_64) + step1[21] = dctConstRoundShift(int64(input[21])*cospi11_64 - int64(input[11])*cospi21_64) + step1[26] = dctConstRoundShift(int64(input[21])*cospi21_64 + int64(input[11])*cospi11_64) + step1[22] = dctConstRoundShift(int64(input[13])*cospi19_64 - int64(input[19])*cospi13_64) + step1[25] = dctConstRoundShift(int64(input[13])*cospi13_64 + int64(input[19])*cospi19_64) + step1[23] = dctConstRoundShift(int64(input[29])*cospi3_64 - int64(input[3])*cospi29_64) + step1[24] = dctConstRoundShift(int64(input[29])*cospi29_64 + int64(input[3])*cospi3_64) + + copy(step2[:8], step1[:8]) + step2[8] = dctConstRoundShift(int64(step1[8])*cospi30_64 - int64(step1[15])*cospi2_64) + step2[15] = dctConstRoundShift(int64(step1[8])*cospi2_64 + int64(step1[15])*cospi30_64) + step2[9] = dctConstRoundShift(int64(step1[9])*cospi14_64 - int64(step1[14])*cospi18_64) + step2[14] = dctConstRoundShift(int64(step1[9])*cospi18_64 + int64(step1[14])*cospi14_64) + step2[10] = dctConstRoundShift(int64(step1[10])*cospi22_64 - int64(step1[13])*cospi10_64) + step2[13] = dctConstRoundShift(int64(step1[10])*cospi10_64 + int64(step1[13])*cospi22_64) + step2[11] = dctConstRoundShift(int64(step1[11])*cospi6_64 - int64(step1[12])*cospi26_64) + step2[12] = dctConstRoundShift(int64(step1[11])*cospi26_64 + int64(step1[12])*cospi6_64) + for i := 16; i < 32; i += 4 { + step2[i] = step1[i] + step1[i+1] + step2[i+1] = step1[i] - step1[i+1] + step2[i+2] = -step1[i+2] + step1[i+3] + step2[i+3] = step1[i+2] + step1[i+3] + } + + copy(step1[:4], step2[:4]) + step1[4] = dctConstRoundShift(int64(step2[4])*cospi28_64 - int64(step2[7])*cospi4_64) + step1[7] = dctConstRoundShift(int64(step2[4])*cospi4_64 + int64(step2[7])*cospi28_64) + step1[5] = dctConstRoundShift(int64(step2[5])*cospi12_64 - int64(step2[6])*cospi20_64) + step1[6] = dctConstRoundShift(int64(step2[5])*cospi20_64 + int64(step2[6])*cospi12_64) + for i := 8; i < 16; i += 4 { + step1[i] = step2[i] + step2[i+1] + step1[i+1] = step2[i] - step2[i+1] + step1[i+2] = -step2[i+2] + step2[i+3] + step1[i+3] = step2[i+2] + step2[i+3] + } + step1[16] = step2[16] + step1[31] = step2[31] + step1[17] = dctConstRoundShift(-int64(step2[17])*cospi4_64 + int64(step2[30])*cospi28_64) + step1[30] = dctConstRoundShift(int64(step2[17])*cospi28_64 + int64(step2[30])*cospi4_64) + step1[18] = dctConstRoundShift(-int64(step2[18])*cospi28_64 - int64(step2[29])*cospi4_64) + step1[29] = dctConstRoundShift(-int64(step2[18])*cospi4_64 + int64(step2[29])*cospi28_64) + step1[19] = step2[19] + step1[20] = step2[20] + step1[21] = dctConstRoundShift(-int64(step2[21])*cospi20_64 + int64(step2[26])*cospi12_64) + step1[26] = dctConstRoundShift(int64(step2[21])*cospi12_64 + int64(step2[26])*cospi20_64) + step1[22] = dctConstRoundShift(-int64(step2[22])*cospi12_64 - int64(step2[25])*cospi20_64) + step1[25] = dctConstRoundShift(-int64(step2[22])*cospi20_64 + int64(step2[25])*cospi12_64) + step1[23] = step2[23] + step1[24] = step2[24] + step1[27] = step2[27] + step1[28] = step2[28] + + step2[0] = dctConstRoundShift(int64(step1[0]+step1[1]) * cospi16_64) + step2[1] = dctConstRoundShift(int64(step1[0]-step1[1]) * cospi16_64) + step2[2] = dctConstRoundShift(int64(step1[2])*cospi24_64 - int64(step1[3])*cospi8_64) + step2[3] = dctConstRoundShift(int64(step1[2])*cospi8_64 + int64(step1[3])*cospi24_64) + step2[4] = step1[4] + step1[5] + step2[5] = step1[4] - step1[5] + step2[6] = -step1[6] + step1[7] + step2[7] = step1[6] + step1[7] + step2[8] = step1[8] + step2[15] = step1[15] + step2[9] = dctConstRoundShift(-int64(step1[9])*cospi8_64 + int64(step1[14])*cospi24_64) + step2[14] = dctConstRoundShift(int64(step1[9])*cospi24_64 + int64(step1[14])*cospi8_64) + step2[10] = dctConstRoundShift(-int64(step1[10])*cospi24_64 - int64(step1[13])*cospi8_64) + step2[13] = dctConstRoundShift(-int64(step1[10])*cospi8_64 + int64(step1[13])*cospi24_64) + step2[11] = step1[11] + step2[12] = step1[12] + for base := 16; base <= 24; base += 8 { + step2[base+0] = step1[base+0] + step1[base+3] + step2[base+1] = step1[base+1] + step1[base+2] + step2[base+2] = step1[base+1] - step1[base+2] + step2[base+3] = step1[base+0] - step1[base+3] + step2[base+4] = -step1[base+4] + step1[base+7] + step2[base+5] = -step1[base+5] + step1[base+6] + step2[base+6] = step1[base+5] + step1[base+6] + step2[base+7] = step1[base+4] + step1[base+7] + } + + step1[0] = step2[0] + step2[3] + step1[1] = step2[1] + step2[2] + step1[2] = step2[1] - step2[2] + step1[3] = step2[0] - step2[3] + step1[4] = step2[4] + step1[5] = dctConstRoundShift(int64(step2[6]-step2[5]) * cospi16_64) + step1[6] = dctConstRoundShift(int64(step2[5]+step2[6]) * cospi16_64) + step1[7] = step2[7] + step1[8] = step2[8] + step2[11] + step1[9] = step2[9] + step2[10] + step1[10] = step2[9] - step2[10] + step1[11] = step2[8] - step2[11] + step1[12] = -step2[12] + step2[15] + step1[13] = -step2[13] + step2[14] + step1[14] = step2[13] + step2[14] + step1[15] = step2[12] + step2[15] + step1[16] = step2[16] + step1[17] = step2[17] + step1[18] = dctConstRoundShift(-int64(step2[18])*cospi8_64 + int64(step2[29])*cospi24_64) + step1[29] = dctConstRoundShift(int64(step2[18])*cospi24_64 + int64(step2[29])*cospi8_64) + step1[19] = dctConstRoundShift(-int64(step2[19])*cospi8_64 + int64(step2[28])*cospi24_64) + step1[28] = dctConstRoundShift(int64(step2[19])*cospi24_64 + int64(step2[28])*cospi8_64) + step1[20] = dctConstRoundShift(-int64(step2[20])*cospi24_64 - int64(step2[27])*cospi8_64) + step1[27] = dctConstRoundShift(-int64(step2[20])*cospi8_64 + int64(step2[27])*cospi24_64) + step1[21] = dctConstRoundShift(-int64(step2[21])*cospi24_64 - int64(step2[26])*cospi8_64) + step1[26] = dctConstRoundShift(-int64(step2[21])*cospi8_64 + int64(step2[26])*cospi24_64) + step1[22] = step2[22] + step1[23] = step2[23] + step1[24] = step2[24] + step1[25] = step2[25] + step1[30] = step2[30] + step1[31] = step2[31] + + for i := range 4 { + step2[i] = step1[i] + step1[7-i] + step2[7-i] = step1[i] - step1[7-i] + } + step2[8] = step1[8] + step2[9] = step1[9] + step2[10] = dctConstRoundShift(int64(-step1[10]+step1[13]) * cospi16_64) + step2[13] = dctConstRoundShift(int64(step1[10]+step1[13]) * cospi16_64) + step2[11] = dctConstRoundShift(int64(-step1[11]+step1[12]) * cospi16_64) + step2[12] = dctConstRoundShift(int64(step1[11]+step1[12]) * cospi16_64) + step2[14] = step1[14] + step2[15] = step1[15] + for i := range 4 { + step2[16+i] = step1[16+i] + step1[23-i] + step2[23-i] = step1[16+i] - step1[23-i] + step2[24+i] = -step1[24+i] + step1[31-i] + step2[31-i] = step1[24+i] + step1[31-i] + } + + for i := range 8 { + step1[i] = step2[i] + step2[15-i] + step1[15-i] = step2[i] - step2[15-i] + } + copy(step1[16:20], step2[16:20]) + for i := range 4 { + step1[20+i] = dctConstRoundShift(int64(-step2[20+i]+step2[27-i]) * cospi16_64) + step1[27-i] = dctConstRoundShift(int64(step2[20+i]+step2[27-i]) * cospi16_64) + } + copy(step1[28:32], step2[28:32]) + + for i := range 16 { + output[i] = step1[i] + step1[31-i] + output[31-i] = step1[i] - step1[31-i] + } +} + +// HighbdInverseTransformAdd applies the VP9 inverse transform (4x4, 8x8, 16x16, +// 32x32, DCT/ADST/WHT) on int32 coefficients and adds the residual into uint16 +// dest, clamping to [0, (1< hi { + return int16(hi) + } + return int16(t) +} + +func highbdAbsDiff(a, b uint16) int { + d := int(a) - int(b) + if d < 0 { + return -d + } + return d +} + +func highbdFilterMask(limit, blimit uint8, + p3, p2, p1, p0, q0, q1, q2, q3 uint16, bd int, +) int8 { + shift := uint(bd - 8) + limit16 := int(limit) << shift + blimit16 := int(blimit) << shift + if highbdAbsDiff(p3, p2) > limit16 || + highbdAbsDiff(p2, p1) > limit16 || + highbdAbsDiff(p1, p0) > limit16 || + highbdAbsDiff(q1, q0) > limit16 || + highbdAbsDiff(q2, q1) > limit16 || + highbdAbsDiff(q3, q2) > limit16 || + highbdAbsDiff(p0, q0)*2+highbdAbsDiff(p1, q1)/2 > blimit16 { + return 0 + } + return -1 +} + +func highbdFlatMask4(thresh uint8, + p3, p2, p1, p0, q0, q1, q2, q3 uint16, bd int, +) int8 { + thresh16 := int(thresh) << uint(bd-8) + if highbdAbsDiff(p1, p0) > thresh16 || + highbdAbsDiff(q1, q0) > thresh16 || + highbdAbsDiff(p2, p0) > thresh16 || + highbdAbsDiff(q2, q0) > thresh16 || + highbdAbsDiff(p3, p0) > thresh16 || + highbdAbsDiff(q3, q0) > thresh16 { + return 0 + } + return -1 +} + +func highbdFlatMask5(thresh uint8, + p4, p3, p2, p1, p0, q0, q1, q2, q3, q4 uint16, bd int, +) int8 { + if highbdFlatMask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3, bd) == 0 { + return 0 + } + thresh16 := int(thresh) << uint(bd-8) + if highbdAbsDiff(p4, p0) > thresh16 || highbdAbsDiff(q4, q0) > thresh16 { + return 0 + } + return -1 +} + +func highbdHevMask(thresh uint8, p1, p0, q0, q1 uint16, bd int) int16 { + thresh16 := int(thresh) << uint(bd-8) + if highbdAbsDiff(p1, p0) > thresh16 || highbdAbsDiff(q1, q0) > thresh16 { + return -1 + } + return 0 +} + +func highbdFilter4(mask int8, thresh uint8, + op1, op0, oq0, oq1 *uint16, bd int, +) { + shift := uint(bd - 8) + bias := int16(0x80 << shift) + ps1 := int16(*op1) - bias + ps0 := int16(*op0) - bias + qs0 := int16(*oq0) - bias + qs1 := int16(*oq1) - bias + hev := highbdHevMask(thresh, *op1, *op0, *oq0, *oq1, bd) + + filter := signedCharClampHigh(int(ps1)-int(qs1), bd) & hev + filter = signedCharClampHigh(int(filter)+3*(int(qs0)-int(ps0)), bd) & int16(mask) + + filter1 := signedCharClampHigh(int(filter)+4, bd) >> 3 + filter2 := signedCharClampHigh(int(filter)+3, bd) >> 3 + + *oq0 = uint16(signedCharClampHigh(int(qs0)-int(filter1), bd) + bias) + *op0 = uint16(signedCharClampHigh(int(ps0)+int(filter2), bd) + bias) + + outer := int16((int(filter1)+1)>>1) & ^hev + *oq1 = uint16(signedCharClampHigh(int(qs1)-int(outer), bd) + bias) + *op1 = uint16(signedCharClampHigh(int(ps1)+int(outer), bd) + bias) +} + +func highbdFilter8(mask int8, thresh uint8, flat int8, + op3, op2, op1, op0, oq0, oq1, oq2, oq3 *uint16, bd int, +) { + if flat != 0 && mask != 0 { + p3, p2, p1, p0 := int(*op3), int(*op2), int(*op1), int(*op0) + q0, q1, q2, q3 := int(*oq0), int(*oq1), int(*oq2), int(*oq3) + *op2 = uint16((p3 + p3 + p3 + 2*p2 + p1 + p0 + q0 + 4) >> 3) + *op1 = uint16((p3 + p3 + p2 + 2*p1 + p0 + q0 + q1 + 4) >> 3) + *op0 = uint16((p3 + p2 + p1 + 2*p0 + q0 + q1 + q2 + 4) >> 3) + *oq0 = uint16((p2 + p1 + p0 + 2*q0 + q1 + q2 + q3 + 4) >> 3) + *oq1 = uint16((p1 + p0 + q0 + 2*q1 + q2 + q3 + q3 + 4) >> 3) + *oq2 = uint16((p0 + q0 + q1 + 2*q2 + q3 + q3 + q3 + 4) >> 3) + } else { + highbdFilter4(mask, thresh, op1, op0, oq0, oq1, bd) + } +} + +func highbdFilter16(mask int8, thresh uint8, flat, flat2 int8, + op7, op6, op5, op4, op3, op2, op1, op0, + oq0, oq1, oq2, oq3, oq4, oq5, oq6, oq7 *uint16, bd int, +) { + if flat2 != 0 && flat != 0 && mask != 0 { + p7, p6, p5, p4 := int(*op7), int(*op6), int(*op5), int(*op4) + p3, p2, p1, p0 := int(*op3), int(*op2), int(*op1), int(*op0) + q0, q1, q2, q3 := int(*oq0), int(*oq1), int(*oq2), int(*oq3) + q4, q5, q6, q7 := int(*oq4), int(*oq5), int(*oq6), int(*oq7) + *op6 = uint16((p7*7 + p6*2 + p5 + p4 + p3 + p2 + p1 + p0 + q0 + 8) >> 4) + *op5 = uint16((p7*6 + p6 + p5*2 + p4 + p3 + p2 + p1 + p0 + q0 + q1 + 8) >> 4) + *op4 = uint16((p7*5 + p6 + p5 + p4*2 + p3 + p2 + p1 + p0 + q0 + q1 + q2 + 8) >> 4) + *op3 = uint16((p7*4 + p6 + p5 + p4 + p3*2 + p2 + p1 + p0 + q0 + q1 + q2 + q3 + 8) >> 4) + *op2 = uint16((p7*3 + p6 + p5 + p4 + p3 + p2*2 + p1 + p0 + q0 + q1 + q2 + q3 + q4 + 8) >> 4) + *op1 = uint16((p7*2 + p6 + p5 + p4 + p3 + p2 + p1*2 + p0 + q0 + q1 + q2 + q3 + q4 + q5 + 8) >> 4) + *op0 = uint16((p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0*2 + q0 + q1 + q2 + q3 + q4 + q5 + q6 + 8) >> 4) + *oq0 = uint16((p6 + p5 + p4 + p3 + p2 + p1 + p0 + q0*2 + q1 + q2 + q3 + q4 + q5 + q6 + q7 + 8) >> 4) + *oq1 = uint16((p5 + p4 + p3 + p2 + p1 + p0 + q0 + q1*2 + q2 + q3 + q4 + q5 + q6 + q7*2 + 8) >> 4) + *oq2 = uint16((p4 + p3 + p2 + p1 + p0 + q0 + q1 + q2*2 + q3 + q4 + q5 + q6 + q7*3 + 8) >> 4) + *oq3 = uint16((p3 + p2 + p1 + p0 + q0 + q1 + q2 + q3*2 + q4 + q5 + q6 + q7*4 + 8) >> 4) + *oq4 = uint16((p2 + p1 + p0 + q0 + q1 + q2 + q3 + q4*2 + q5 + q6 + q7*5 + 8) >> 4) + *oq5 = uint16((p1 + p0 + q0 + q1 + q2 + q3 + q4 + q5*2 + q6 + q7*6 + 8) >> 4) + *oq6 = uint16((p0 + q0 + q1 + q2 + q3 + q4 + q5 + q6*2 + q7*7 + 8) >> 4) + } else { + highbdFilter8(mask, thresh, flat, op3, op2, op1, op0, oq0, oq1, oq2, oq3, bd) + } +} + +func HighbdLpfHorizontal4(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + for i := range 8 { + p := off + i + p3, p2, p1, p0 := s[p-4*pitch], s[p-3*pitch], s[p-2*pitch], s[p-pitch] + q0, q1, q2, q3 := s[p], s[p+pitch], s[p+2*pitch], s[p+3*pitch] + mask := highbdFilterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3, bd) + highbdFilter4(mask, thresh, &s[p-2*pitch], &s[p-pitch], &s[p], &s[p+pitch], bd) + } +} + +func HighbdLpfHorizontal4Dual(s []uint16, off, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, bd int, +) { + HighbdLpfHorizontal4(s, off, pitch, blimit0, limit0, thresh0, bd) + HighbdLpfHorizontal4(s, off+8, pitch, blimit1, limit1, thresh1, bd) +} + +func HighbdLpfVertical4(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + for i := range 8 { + p := off + i*pitch + p3, p2, p1, p0 := s[p-4], s[p-3], s[p-2], s[p-1] + q0, q1, q2, q3 := s[p], s[p+1], s[p+2], s[p+3] + mask := highbdFilterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3, bd) + highbdFilter4(mask, thresh, &s[p-2], &s[p-1], &s[p], &s[p+1], bd) + } +} + +func HighbdLpfVertical4Dual(s []uint16, off, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, bd int, +) { + HighbdLpfVertical4(s, off, pitch, blimit0, limit0, thresh0, bd) + HighbdLpfVertical4(s, off+8*pitch, pitch, blimit1, limit1, thresh1, bd) +} + +func HighbdLpfHorizontal8(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + for i := range 8 { + p := off + i + p3, p2, p1, p0 := s[p-4*pitch], s[p-3*pitch], s[p-2*pitch], s[p-pitch] + q0, q1, q2, q3 := s[p], s[p+pitch], s[p+2*pitch], s[p+3*pitch] + mask := highbdFilterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3, bd) + flat := highbdFlatMask4(1, p3, p2, p1, p0, q0, q1, q2, q3, bd) + highbdFilter8(mask, thresh, flat, + &s[p-4*pitch], &s[p-3*pitch], &s[p-2*pitch], &s[p-pitch], + &s[p], &s[p+pitch], &s[p+2*pitch], &s[p+3*pitch], bd) + } +} + +func HighbdLpfHorizontal8Dual(s []uint16, off, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, bd int, +) { + HighbdLpfHorizontal8(s, off, pitch, blimit0, limit0, thresh0, bd) + HighbdLpfHorizontal8(s, off+8, pitch, blimit1, limit1, thresh1, bd) +} + +func HighbdLpfVertical8(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + for i := range 8 { + p := off + i*pitch + p3, p2, p1, p0 := s[p-4], s[p-3], s[p-2], s[p-1] + q0, q1, q2, q3 := s[p], s[p+1], s[p+2], s[p+3] + mask := highbdFilterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3, bd) + flat := highbdFlatMask4(1, p3, p2, p1, p0, q0, q1, q2, q3, bd) + highbdFilter8(mask, thresh, flat, + &s[p-4], &s[p-3], &s[p-2], &s[p-1], + &s[p], &s[p+1], &s[p+2], &s[p+3], bd) + } +} + +func HighbdLpfVertical8Dual(s []uint16, off, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, bd int, +) { + HighbdLpfVertical8(s, off, pitch, blimit0, limit0, thresh0, bd) + HighbdLpfVertical8(s, off+8*pitch, pitch, blimit1, limit1, thresh1, bd) +} + +func highbdMbLpfHorizontalEdgeW(s []uint16, off, pitch int, + blimit, limit, thresh uint8, count, bd int, +) { + for i := range 8 * count { + p := off + i + p3, p2, p1, p0 := s[p-4*pitch], s[p-3*pitch], s[p-2*pitch], s[p-pitch] + q0, q1, q2, q3 := s[p], s[p+pitch], s[p+2*pitch], s[p+3*pitch] + mask := highbdFilterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3, bd) + flat := highbdFlatMask4(1, p3, p2, p1, p0, q0, q1, q2, q3, bd) + flat2 := highbdFlatMask5(1, + s[p-8*pitch], s[p-7*pitch], s[p-6*pitch], s[p-5*pitch], p0, q0, + s[p+4*pitch], s[p+5*pitch], s[p+6*pitch], s[p+7*pitch], bd) + highbdFilter16(mask, thresh, flat, flat2, + &s[p-8*pitch], &s[p-7*pitch], &s[p-6*pitch], &s[p-5*pitch], + &s[p-4*pitch], &s[p-3*pitch], &s[p-2*pitch], &s[p-pitch], + &s[p], &s[p+pitch], &s[p+2*pitch], &s[p+3*pitch], + &s[p+4*pitch], &s[p+5*pitch], &s[p+6*pitch], &s[p+7*pitch], bd) + } +} + +func HighbdLpfHorizontal16(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + highbdMbLpfHorizontalEdgeW(s, off, pitch, blimit, limit, thresh, 1, bd) +} + +func HighbdLpfHorizontal16Dual(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + highbdMbLpfHorizontalEdgeW(s, off, pitch, blimit, limit, thresh, 2, bd) +} + +func highbdMbLpfVerticalEdgeW(s []uint16, off, pitch int, + blimit, limit, thresh uint8, count, bd int, +) { + for i := range count { + p := off + i*pitch + p3, p2, p1, p0 := s[p-4], s[p-3], s[p-2], s[p-1] + q0, q1, q2, q3 := s[p], s[p+1], s[p+2], s[p+3] + mask := highbdFilterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3, bd) + flat := highbdFlatMask4(1, p3, p2, p1, p0, q0, q1, q2, q3, bd) + flat2 := highbdFlatMask5(1, + s[p-8], s[p-7], s[p-6], s[p-5], p0, q0, + s[p+4], s[p+5], s[p+6], s[p+7], bd) + highbdFilter16(mask, thresh, flat, flat2, + &s[p-8], &s[p-7], &s[p-6], &s[p-5], + &s[p-4], &s[p-3], &s[p-2], &s[p-1], + &s[p], &s[p+1], &s[p+2], &s[p+3], + &s[p+4], &s[p+5], &s[p+6], &s[p+7], bd) + } +} + +func HighbdLpfVertical16(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + highbdMbLpfVerticalEdgeW(s, off, pitch, blimit, limit, thresh, 8, bd) +} + +func HighbdLpfVertical16Dual(s []uint16, off, pitch int, blimit, limit, thresh uint8, bd int) { + highbdMbLpfVerticalEdgeW(s, off, pitch, blimit, limit, thresh, 16, bd) +} diff --git a/internal/vp9/dsp/highbd_simd_arm64.go b/internal/vp9/dsp/highbd_simd_arm64.go new file mode 100644 index 0000000..4263d20 --- /dev/null +++ b/internal/vp9/dsp/highbd_simd_arm64.go @@ -0,0 +1,187 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/highbd_simd_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package dsp + +import ( + "simd/archsimd" +) + +// highbdConvolveAvgSIMD averages w x h uint16 blocks using NEON URHADD +// ((a + b + 1) >> 1) 8 pixels at a time. +func highbdConvolveAvgSIMD(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, w, h int, +) bool { + if w < 8 || w&7 != 0 { + return false + } + for range h { + for x := 0; x < w; x += 8 { + sv := archsimd.LoadUint16x8(src[srcOff+x:]) + dv := archsimd.LoadUint16x8(dst[dstOff+x:]) + dv.Average(sv).Store(dst[dstOff+x:]) + } + srcOff += srcStride + dstOff += dstStride + } + return true +} + +// highbdConvolve8HorizSIMD runs an 8-wide unscaled (xStepQ4 == 16) 8-tap +// horizontal filter on uint16 pixels with int32 accumulation, rounding >> 7, +// and [0, (1<> highbdSubpelBits) + for range h { + for x := 0; x < w; x += 8 { + base := srcOff + x + s0 := archsimd.LoadUint16x8(src[base+0:]).BitsToInt16() + s1 := archsimd.LoadUint16x8(src[base+1:]).BitsToInt16() + s2 := archsimd.LoadUint16x8(src[base+2:]).BitsToInt16() + s3 := archsimd.LoadUint16x8(src[base+3:]).BitsToInt16() + s4 := archsimd.LoadUint16x8(src[base+4:]).BitsToInt16() + s5 := archsimd.LoadUint16x8(src[base+5:]).BitsToInt16() + s6 := archsimd.LoadUint16x8(src[base+6:]).BitsToInt16() + s7 := archsimd.LoadUint16x8(src[base+7:]).BitsToInt16() + + lo := s0.MulWidenLo(t0). + Add(s1.MulWidenLo(t1)). + Add(s2.MulWidenLo(t2)). + Add(s3.MulWidenLo(t3)). + Add(s4.MulWidenLo(t4)). + Add(s5.MulWidenLo(t5)). + Add(s6.MulWidenLo(t6)). + Add(s7.MulWidenLo(t7)). + Add(round).ShiftAllRight(highbdFilterBits). + Min(maxVal).SaturateToUint16() + + hi := s0.HiToLo().MulWidenLo(t0). + Add(s1.HiToLo().MulWidenLo(t1)). + Add(s2.HiToLo().MulWidenLo(t2)). + Add(s3.HiToLo().MulWidenLo(t3)). + Add(s4.HiToLo().MulWidenLo(t4)). + Add(s5.HiToLo().MulWidenLo(t5)). + Add(s6.HiToLo().MulWidenLo(t6)). + Add(s7.HiToLo().MulWidenLo(t7)). + Add(round).ShiftAllRight(highbdFilterBits). + Min(maxVal).SaturateToUint16() + + res := lo.ReshapeToUint64s().InterleaveLo(hi.ReshapeToUint64s()).ReshapeToUint16s() + if avg { + dv := archsimd.LoadUint16x8(dst[dstOff+x:]) + res = dv.Average(res) + } + res.Store(dst[dstOff+x:]) + } + srcOff += srcStride + dstOff += dstStride + } + return true +} + +// highbdConvolve8VertSIMD runs an 8-wide unscaled (yStepQ4 == 16) 8-tap +// vertical filter on uint16 pixels with sliding row registers. +func highbdConvolve8VertSIMD(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + yFilters *[16][8]int16, y0Q4, yStepQ4, w, h, bd int, avg bool, +) bool { + if yStepQ4 != 16 || w < 8 || w&7 != 0 { + return false + } + f := &yFilters[y0Q4&highbdSubpelMask] + t0 := archsimd.BroadcastInt16x8(f[0]) + t1 := archsimd.BroadcastInt16x8(f[1]) + t2 := archsimd.BroadcastInt16x8(f[2]) + t3 := archsimd.BroadcastInt16x8(f[3]) + t4 := archsimd.BroadcastInt16x8(f[4]) + t5 := archsimd.BroadcastInt16x8(f[5]) + t6 := archsimd.BroadcastInt16x8(f[6]) + t7 := archsimd.BroadcastInt16x8(f[7]) + round := archsimd.BroadcastInt32x4(1 << (highbdFilterBits - 1)) + maxVal := archsimd.BroadcastInt32x4(int32((1 << uint(bd)) - 1)) + + srcBase := srcOff - srcStride*(highbdSubpelTaps/2-1) + (y0Q4>>highbdSubpelBits)*srcStride + for x := 0; x < w; x += 8 { + sp := srcBase + x + s0 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + s1 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + s2 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + s3 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + s4 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + s5 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + s6 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + + dp := dstOff + x + for range h { + s7 := archsimd.LoadUint16x8(src[sp:]).BitsToInt16() + sp += srcStride + + lo := s0.MulWidenLo(t0). + Add(s1.MulWidenLo(t1)). + Add(s2.MulWidenLo(t2)). + Add(s3.MulWidenLo(t3)). + Add(s4.MulWidenLo(t4)). + Add(s5.MulWidenLo(t5)). + Add(s6.MulWidenLo(t6)). + Add(s7.MulWidenLo(t7)). + Add(round).ShiftAllRight(highbdFilterBits). + Min(maxVal).SaturateToUint16() + + hi := s0.HiToLo().MulWidenLo(t0). + Add(s1.HiToLo().MulWidenLo(t1)). + Add(s2.HiToLo().MulWidenLo(t2)). + Add(s3.HiToLo().MulWidenLo(t3)). + Add(s4.HiToLo().MulWidenLo(t4)). + Add(s5.HiToLo().MulWidenLo(t5)). + Add(s6.HiToLo().MulWidenLo(t6)). + Add(s7.HiToLo().MulWidenLo(t7)). + Add(round).ShiftAllRight(highbdFilterBits). + Min(maxVal).SaturateToUint16() + + res := lo.ReshapeToUint64s().InterleaveLo(hi.ReshapeToUint64s()).ReshapeToUint16s() + if avg { + dv := archsimd.LoadUint16x8(dst[dp:]) + res = dv.Average(res) + } + res.Store(dst[dp:]) + dp += dstStride + + s0, s1, s2, s3, s4, s5, s6 = s1, s2, s3, s4, s5, s6, s7 + } + } + return true +} diff --git a/internal/vp9/dsp/highbd_simd_other.go b/internal/vp9/dsp/highbd_simd_other.go new file mode 100644 index 0000000..65d62fe --- /dev/null +++ b/internal/vp9/dsp/highbd_simd_other.go @@ -0,0 +1,33 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/highbd_simd_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || !arm64 || purego + +package dsp + +func highbdConvolveAvgSIMD(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, w, h int, +) bool { + return false +} + +func highbdConvolve8HorizSIMD(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + xFilters *[16][8]int16, x0Q4, xStepQ4, w, h, bd int, avg bool, +) bool { + return false +} + +func highbdConvolve8VertSIMD(src []uint16, srcOff, srcStride int, + dst []uint16, dstOff, dstStride int, + yFilters *[16][8]int16, y0Q4, yStepQ4, w, h, bd int, avg bool, +) bool { + return false +} diff --git a/internal/vp9/dsp/iadst16.go b/internal/vp9/dsp/iadst16.go new file mode 100644 index 0000000..9271211 --- /dev/null +++ b/internal/vp9/dsp/iadst16.go @@ -0,0 +1,233 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/iadst16.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// iadst16 is the 16-point 1-D inverse ADST used by intra 16x16 blocks +// under the {ADST_DCT, DCT_ADST, ADST_ADST} transform types. Matches +// iadst16_c in libvpx v1.16.0 vpx_dsp/inv_txfm.c stage-by-stage; the +// bit-reverse input load + sign-mixed output store at the end are the +// libvpx fingerprint to preserve. +func iadst16(input, output []int16) { + x0 := int64(input[15]) + x1 := int64(input[0]) + x2 := int64(input[13]) + x3 := int64(input[2]) + x4 := int64(input[11]) + x5 := int64(input[4]) + x6 := int64(input[9]) + x7 := int64(input[6]) + x8 := int64(input[7]) + x9 := int64(input[8]) + x10 := int64(input[5]) + x11 := int64(input[10]) + x12 := int64(input[3]) + x13 := int64(input[12]) + x14 := int64(input[1]) + x15 := int64(input[14]) + + if x0|x1|x2|x3|x4|x5|x6|x7|x8|x9|x10|x11|x12|x13|x14|x15 == 0 { + for i := range 16 { + output[i] = 0 + } + return + } + + // stage 1 + s0 := x0*cospi1_64 + x1*cospi31_64 + s1 := x0*cospi31_64 - x1*cospi1_64 + s2 := x2*cospi5_64 + x3*cospi27_64 + s3 := x2*cospi27_64 - x3*cospi5_64 + s4 := x4*cospi9_64 + x5*cospi23_64 + s5 := x4*cospi23_64 - x5*cospi9_64 + s6 := x6*cospi13_64 + x7*cospi19_64 + s7 := x6*cospi19_64 - x7*cospi13_64 + s8 := x8*cospi17_64 + x9*cospi15_64 + s9 := x8*cospi15_64 - x9*cospi17_64 + s10 := x10*cospi21_64 + x11*cospi11_64 + s11 := x10*cospi11_64 - x11*cospi21_64 + s12 := x12*cospi25_64 + x13*cospi7_64 + s13 := x12*cospi7_64 - x13*cospi25_64 + s14 := x14*cospi29_64 + x15*cospi3_64 + s15 := x14*cospi3_64 - x15*cospi29_64 + + x0 = int64(int16(dctConstRoundShift(s0 + s8))) + x1 = int64(int16(dctConstRoundShift(s1 + s9))) + x2 = int64(int16(dctConstRoundShift(s2 + s10))) + x3 = int64(int16(dctConstRoundShift(s3 + s11))) + x4 = int64(int16(dctConstRoundShift(s4 + s12))) + x5 = int64(int16(dctConstRoundShift(s5 + s13))) + x6 = int64(int16(dctConstRoundShift(s6 + s14))) + x7 = int64(int16(dctConstRoundShift(s7 + s15))) + x8 = int64(int16(dctConstRoundShift(s0 - s8))) + x9 = int64(int16(dctConstRoundShift(s1 - s9))) + x10 = int64(int16(dctConstRoundShift(s2 - s10))) + x11 = int64(int16(dctConstRoundShift(s3 - s11))) + x12 = int64(int16(dctConstRoundShift(s4 - s12))) + x13 = int64(int16(dctConstRoundShift(s5 - s13))) + x14 = int64(int16(dctConstRoundShift(s6 - s14))) + x15 = int64(int16(dctConstRoundShift(s7 - s15))) + + // stage 2 + s0 = x0 + s1 = x1 + s2 = x2 + s3 = x3 + s4 = x4 + s5 = x5 + s6 = x6 + s7 = x7 + s8 = x8*cospi4_64 + x9*cospi28_64 + s9 = x8*cospi28_64 - x9*cospi4_64 + s10 = x10*cospi20_64 + x11*cospi12_64 + s11 = x10*cospi12_64 - x11*cospi20_64 + s12 = -x12*cospi28_64 + x13*cospi4_64 + s13 = x12*cospi4_64 + x13*cospi28_64 + s14 = -x14*cospi12_64 + x15*cospi20_64 + s15 = x14*cospi20_64 + x15*cospi12_64 + + x0 = int64(int16(s0 + s4)) + x1 = int64(int16(s1 + s5)) + x2 = int64(int16(s2 + s6)) + x3 = int64(int16(s3 + s7)) + x4 = int64(int16(s0 - s4)) + x5 = int64(int16(s1 - s5)) + x6 = int64(int16(s2 - s6)) + x7 = int64(int16(s3 - s7)) + x8 = int64(int16(dctConstRoundShift(s8 + s12))) + x9 = int64(int16(dctConstRoundShift(s9 + s13))) + x10 = int64(int16(dctConstRoundShift(s10 + s14))) + x11 = int64(int16(dctConstRoundShift(s11 + s15))) + x12 = int64(int16(dctConstRoundShift(s8 - s12))) + x13 = int64(int16(dctConstRoundShift(s9 - s13))) + x14 = int64(int16(dctConstRoundShift(s10 - s14))) + x15 = int64(int16(dctConstRoundShift(s11 - s15))) + + // stage 3 + s0 = x0 + s1 = x1 + s2 = x2 + s3 = x3 + s4 = x4*cospi8_64 + x5*cospi24_64 + s5 = x4*cospi24_64 - x5*cospi8_64 + s6 = -x6*cospi24_64 + x7*cospi8_64 + s7 = x6*cospi8_64 + x7*cospi24_64 + s8 = x8 + s9 = x9 + s10 = x10 + s11 = x11 + s12 = x12*cospi8_64 + x13*cospi24_64 + s13 = x12*cospi24_64 - x13*cospi8_64 + s14 = -x14*cospi24_64 + x15*cospi8_64 + s15 = x14*cospi8_64 + x15*cospi24_64 + + x0 = int64(int16(s0 + s2)) + x1 = int64(int16(s1 + s3)) + x2 = int64(int16(s0 - s2)) + x3 = int64(int16(s1 - s3)) + x4 = int64(int16(dctConstRoundShift(s4 + s6))) + x5 = int64(int16(dctConstRoundShift(s5 + s7))) + x6 = int64(int16(dctConstRoundShift(s4 - s6))) + x7 = int64(int16(dctConstRoundShift(s5 - s7))) + x8 = int64(int16(s8 + s10)) + x9 = int64(int16(s9 + s11)) + x10 = int64(int16(s8 - s10)) + x11 = int64(int16(s9 - s11)) + x12 = int64(int16(dctConstRoundShift(s12 + s14))) + x13 = int64(int16(dctConstRoundShift(s13 + s15))) + x14 = int64(int16(dctConstRoundShift(s12 - s14))) + x15 = int64(int16(dctConstRoundShift(s13 - s15))) + + // stage 4 + s2 = -cospi16_64 * (x2 + x3) + s3 = cospi16_64 * (x2 - x3) + s6 = cospi16_64 * (x6 + x7) + s7 = cospi16_64 * (-x6 + x7) + s10 = cospi16_64 * (x10 + x11) + s11 = cospi16_64 * (-x10 + x11) + s14 = -cospi16_64 * (x14 + x15) + s15 = cospi16_64 * (x14 - x15) + + x2 = int64(int16(dctConstRoundShift(s2))) + x3 = int64(int16(dctConstRoundShift(s3))) + x6 = int64(int16(dctConstRoundShift(s6))) + x7 = int64(int16(dctConstRoundShift(s7))) + x10 = int64(int16(dctConstRoundShift(s10))) + x11 = int64(int16(dctConstRoundShift(s11))) + x14 = int64(int16(dctConstRoundShift(s14))) + x15 = int64(int16(dctConstRoundShift(s15))) + + output[0] = int16(x0) + output[1] = -int16(x8) + output[2] = int16(x12) + output[3] = -int16(x4) + output[4] = int16(x6) + output[5] = int16(x14) + output[6] = int16(x10) + output[7] = int16(x2) + output[8] = int16(x3) + output[9] = int16(x11) + output[10] = int16(x15) + output[11] = int16(x7) + output[12] = int16(x5) + output[13] = -int16(x13) + output[14] = int16(x9) + output[15] = -int16(x1) +} + +// iht16x16_256Add is the shared 2-D dispatch body for hybrid DCT/ADST +// pairs. The transform type is switched inside the row and column passes so +// the caller does not pass function values through this hot path. +func iht16x16_256Add(txType int, input []int16, dest []uint8, stride int) { + var out [256]int16 + for i := range 16 { + switch txType { + case 2, 3: + iadst16(input[i*16:i*16+16], out[i*16:i*16+16]) + default: + idct16(input[i*16:i*16+16], out[i*16:i*16+16]) + } + } + var tempIn, tempOut [16]int16 + for i := range 16 { + for j := range 16 { + tempIn[j] = out[j*16+i] + } + switch txType { + case 1, 3: + iadst16(tempIn[:], tempOut[:]) + default: + idct16(tempIn[:], tempOut[:]) + } + for j := range 16 { + pos := j*stride + i + dest[pos] = clipPixelAdd(dest[pos], roundPowerOfTwo(int32(tempOut[j]), 6)) + } + } +} + +// iht16x16_256AddScalar dispatches the 2-D inverse transform for a +// 16x16 intra block. txType is 0..3 in the order (DCT_DCT, ADST_DCT, +// DCT_ADST, ADST_ADST). Matches vp9_iht16x16_256_add_c. +// +// Scalar reference; the exported Iht16x16_256Add wrapper is in +// idct_dispatch_*.go. +func iht16x16_256AddScalar(input []int16, dest []uint8, stride int, txType int) { + switch txType { + case 0: // DCT_DCT + idct16x16Add(input, dest, stride, 16) + case 1: // ADST_DCT + iht16x16_256Add(txType, input, dest, stride) + case 2: // DCT_ADST + iht16x16_256Add(txType, input, dest, stride) + case 3: // ADST_ADST + iht16x16_256Add(txType, input, dest, stride) + } +} diff --git a/internal/vp9/dsp/iadst4.go b/internal/vp9/dsp/iadst4.go new file mode 100644 index 0000000..7974359 --- /dev/null +++ b/internal/vp9/dsp/iadst4.go @@ -0,0 +1,92 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/iadst4.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// Iadst4 is the 4-point 1-D inverse ADST kernel used for intra 4x4 +// blocks under the {ADST_DCT, DCT_ADST, ADST_ADST} transform types. +// Matches iadst4_c in libvpx v1.16.0 vpx_dsp/inv_txfm.c line-for-line. +func Iadst4(input, output []int16) { + x0 := int64(input[0]) + x1 := int64(input[1]) + x2 := int64(input[2]) + x3 := int64(input[3]) + + if x0|x1|x2|x3 == 0 { + output[0] = 0 + output[1] = 0 + output[2] = 0 + output[3] = 0 + return + } + + s0 := sinpi1_9 * x0 + s1 := sinpi2_9 * x0 + s2 := sinpi3_9 * x1 + s3 := sinpi4_9 * x2 + s4 := sinpi1_9 * x2 + s5 := sinpi2_9 * x3 + s6 := sinpi4_9 * x3 + s7 := int64(int16(x0 - x2 + x3)) + + s0 = s0 + s3 + s5 + s1 = s1 - s4 - s6 + s3 = s2 + s2 = sinpi3_9 * s7 + + output[0] = int16(dctConstRoundShift(s0 + s3)) + output[1] = int16(dctConstRoundShift(s1 + s3)) + output[2] = int16(dctConstRoundShift(s2)) + output[3] = int16(dctConstRoundShift(s0 + s1 - s3)) +} + +// Iht4x4_16Add applies a 2-D inverse transform to a 4x4 coefficient +// block and adds the result onto dest. The transform pair is selected +// by txType: (DCT_DCT, ADST_DCT, DCT_ADST, ADST_ADST). Mirrors +// vp9_iht4x4_16_add_c. +func iht4x4_16Add(input []int16, dest []uint8, stride int, txType int) { + rowAdst := txType == 2 || txType == 3 + colAdst := txType == 1 || txType == 3 + + var out [16]int16 + for i := range 4 { + if rowAdst { + Iadst4(input[i*4:i*4+4], out[i*4:i*4+4]) + } else { + idct4(input[i*4:i*4+4], out[i*4:i*4+4]) + } + } + var tempIn, tempOut [4]int16 + for i := range 4 { + for j := range 4 { + tempIn[j] = out[j*4+i] + } + if colAdst { + Iadst4(tempIn[:], tempOut[:]) + } else { + idct4(tempIn[:], tempOut[:]) + } + for j := range 4 { + pos := j*stride + i + dest[pos] = clipPixelAdd(dest[pos], roundPowerOfTwo(int32(tempOut[j]), 4)) + } + } +} + +// iht4x4_16AddScalar dispatches the inverse transform pair for a 4x4 +// intra block. txType is 0..3 in the order (DCT_DCT, ADST_DCT, +// DCT_ADST, ADST_ADST). Matches the dispatch in libvpx's +// vp9_iht4x4_16_add_c. +// +// Scalar reference; the exported Iht4x4_16Add wrapper is in +// idct_dispatch_*.go. +func iht4x4_16AddScalar(input []int16, dest []uint8, stride int, txType int) { + iht4x4_16Add(input, dest, stride, txType) +} diff --git a/internal/vp9/dsp/iadst8.go b/internal/vp9/dsp/iadst8.go new file mode 100644 index 0000000..a96e54d --- /dev/null +++ b/internal/vp9/dsp/iadst8.go @@ -0,0 +1,135 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/iadst8.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// iadst8 is the 8-point 1-D inverse ADST used by intra 8x8 blocks under +// the ADST_DCT / DCT_ADST / ADST_ADST transform types. Matches iadst8_c +// in libvpx v1.16.0 vpx_dsp/inv_txfm.c line-for-line; intermediate +// stages cast through int (i.e. int32 in libvpx, modelled as int64 +// here) and then store-truncate to int16 on every WRAPLOW. +func iadst8(input, output []int16) { + x0 := int64(input[7]) + x1 := int64(input[0]) + x2 := int64(input[5]) + x3 := int64(input[2]) + x4 := int64(input[3]) + x5 := int64(input[4]) + x6 := int64(input[1]) + x7 := int64(input[6]) + + if x0|x1|x2|x3|x4|x5|x6|x7 == 0 { + for i := range 8 { + output[i] = 0 + } + return + } + + // stage 1 + s0 := cospi2_64*x0 + cospi30_64*x1 + s1 := cospi30_64*x0 - cospi2_64*x1 + s2 := cospi10_64*x2 + cospi22_64*x3 + s3 := cospi22_64*x2 - cospi10_64*x3 + s4 := cospi18_64*x4 + cospi14_64*x5 + s5 := cospi14_64*x4 - cospi18_64*x5 + s6 := cospi26_64*x6 + cospi6_64*x7 + s7 := cospi6_64*x6 - cospi26_64*x7 + + x0 = int64(int16(dctConstRoundShift(s0 + s4))) + x1 = int64(int16(dctConstRoundShift(s1 + s5))) + x2 = int64(int16(dctConstRoundShift(s2 + s6))) + x3 = int64(int16(dctConstRoundShift(s3 + s7))) + x4 = int64(int16(dctConstRoundShift(s0 - s4))) + x5 = int64(int16(dctConstRoundShift(s1 - s5))) + x6 = int64(int16(dctConstRoundShift(s2 - s6))) + x7 = int64(int16(dctConstRoundShift(s3 - s7))) + + // stage 2 + s0 = x0 + s1 = x1 + s2 = x2 + s3 = x3 + s4 = cospi8_64*x4 + cospi24_64*x5 + s5 = cospi24_64*x4 - cospi8_64*x5 + s6 = -cospi24_64*x6 + cospi8_64*x7 + s7 = cospi8_64*x6 + cospi24_64*x7 + + x0 = int64(int16(s0 + s2)) + x1 = int64(int16(s1 + s3)) + x2 = int64(int16(s0 - s2)) + x3 = int64(int16(s1 - s3)) + x4 = int64(int16(dctConstRoundShift(s4 + s6))) + x5 = int64(int16(dctConstRoundShift(s5 + s7))) + x6 = int64(int16(dctConstRoundShift(s4 - s6))) + x7 = int64(int16(dctConstRoundShift(s5 - s7))) + + // stage 3 + s2 = cospi16_64 * (x2 + x3) + s3 = cospi16_64 * (x2 - x3) + s6 = cospi16_64 * (x6 + x7) + s7 = cospi16_64 * (x6 - x7) + + x2 = int64(int16(dctConstRoundShift(s2))) + x3 = int64(int16(dctConstRoundShift(s3))) + x6 = int64(int16(dctConstRoundShift(s6))) + x7 = int64(int16(dctConstRoundShift(s7))) + + output[0] = int16(x0) + output[1] = -int16(x4) + output[2] = int16(x6) + output[3] = -int16(x2) + output[4] = int16(x3) + output[5] = -int16(x7) + output[6] = int16(x5) + output[7] = -int16(x1) +} + +// iht8x8_64Add applies a 2-D inverse transform to an 8x8 coefficient +// block and adds the result onto dest. The transform pair is selected +// by txType: (DCT_DCT, ADST_DCT, DCT_ADST, ADST_ADST). Mirrors +// vp9_iht8x8_64_add_c. +func iht8x8_64Add(input []int16, dest []uint8, stride int, txType int) { + rowAdst := txType == 2 || txType == 3 + colAdst := txType == 1 || txType == 3 + + var out [64]int16 + for i := range 8 { + if rowAdst { + iadst8(input[i*8:i*8+8], out[i*8:i*8+8]) + } else { + idct8(input[i*8:i*8+8], out[i*8:i*8+8]) + } + } + var tempIn, tempOut [8]int16 + for i := range 8 { + for j := range 8 { + tempIn[j] = out[j*8+i] + } + if colAdst { + iadst8(tempIn[:], tempOut[:]) + } else { + idct8(tempIn[:], tempOut[:]) + } + for j := range 8 { + pos := j*stride + i + dest[pos] = clipPixelAdd(dest[pos], roundPowerOfTwo(int32(tempOut[j]), 5)) + } + } +} + +// iht8x8_64AddScalar dispatches the 2-D inverse transform for an 8x8 +// intra block. txType is 0..3 in the order (DCT_DCT, ADST_DCT, +// DCT_ADST, ADST_ADST). Matches vp9_iht8x8_64_add_c. +// +// Scalar reference; the exported Iht8x8_64Add wrapper is in +// idct_dispatch_*.go. +func iht8x8_64AddScalar(input []int16, dest []uint8, stride int, txType int) { + iht8x8_64Add(input, dest, stride, txType) +} diff --git a/internal/vp9/dsp/idct16.go b/internal/vp9/dsp/idct16.go new file mode 100644 index 0000000..92cd645 --- /dev/null +++ b/internal/vp9/dsp/idct16.go @@ -0,0 +1,240 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/idct16.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// idct16 implements libvpx's idct16_c — the 16-point 1-D inverse DCT +// used by every Tx16x16 reconstruction. Seven-stage butterfly with the +// bit-reverse permutation applied at stage 1. Matches vpx_dsp/inv_txfm.c +// stage-by-stage; step1 / step2 are int16_t in libvpx so we narrow on +// every store to preserve byte parity. +func idct16(input, output []int16) { + var step1, step2 [16]int16 + + // stage 1 — bit-reverse permutation. Inputs are read as + // step1[k] = input[bitrev(k, 16) / 2] + // matching the literal `input[0/2], input[16/2], ...` form in libvpx. + step1[0] = input[0] + step1[1] = input[8] + step1[2] = input[4] + step1[3] = input[12] + step1[4] = input[2] + step1[5] = input[10] + step1[6] = input[6] + step1[7] = input[14] + step1[8] = input[1] + step1[9] = input[9] + step1[10] = input[5] + step1[11] = input[13] + step1[12] = input[3] + step1[13] = input[11] + step1[14] = input[7] + step1[15] = input[15] + + // stage 2 + step2[0] = step1[0] + step2[1] = step1[1] + step2[2] = step1[2] + step2[3] = step1[3] + step2[4] = step1[4] + step2[5] = step1[5] + step2[6] = step1[6] + step2[7] = step1[7] + + temp1 := int64(step1[8])*cospi30_64 - int64(step1[15])*cospi2_64 + temp2 := int64(step1[8])*cospi2_64 + int64(step1[15])*cospi30_64 + step2[8] = int16(dctConstRoundShift(temp1)) + step2[15] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(step1[9])*cospi14_64 - int64(step1[14])*cospi18_64 + temp2 = int64(step1[9])*cospi18_64 + int64(step1[14])*cospi14_64 + step2[9] = int16(dctConstRoundShift(temp1)) + step2[14] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(step1[10])*cospi22_64 - int64(step1[13])*cospi10_64 + temp2 = int64(step1[10])*cospi10_64 + int64(step1[13])*cospi22_64 + step2[10] = int16(dctConstRoundShift(temp1)) + step2[13] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(step1[11])*cospi6_64 - int64(step1[12])*cospi26_64 + temp2 = int64(step1[11])*cospi26_64 + int64(step1[12])*cospi6_64 + step2[11] = int16(dctConstRoundShift(temp1)) + step2[12] = int16(dctConstRoundShift(temp2)) + + // stage 3 + step1[0] = step2[0] + step1[1] = step2[1] + step1[2] = step2[2] + step1[3] = step2[3] + + temp1 = int64(step2[4])*cospi28_64 - int64(step2[7])*cospi4_64 + temp2 = int64(step2[4])*cospi4_64 + int64(step2[7])*cospi28_64 + step1[4] = int16(dctConstRoundShift(temp1)) + step1[7] = int16(dctConstRoundShift(temp2)) + temp1 = int64(step2[5])*cospi12_64 - int64(step2[6])*cospi20_64 + temp2 = int64(step2[5])*cospi20_64 + int64(step2[6])*cospi12_64 + step1[5] = int16(dctConstRoundShift(temp1)) + step1[6] = int16(dctConstRoundShift(temp2)) + + step1[8] = int16(int64(step2[8]) + int64(step2[9])) + step1[9] = int16(int64(step2[8]) - int64(step2[9])) + step1[10] = int16(-int64(step2[10]) + int64(step2[11])) + step1[11] = int16(int64(step2[10]) + int64(step2[11])) + step1[12] = int16(int64(step2[12]) + int64(step2[13])) + step1[13] = int16(int64(step2[12]) - int64(step2[13])) + step1[14] = int16(-int64(step2[14]) + int64(step2[15])) + step1[15] = int16(int64(step2[14]) + int64(step2[15])) + + // stage 4 + temp1 = (int64(step1[0]) + int64(step1[1])) * cospi16_64 + temp2 = (int64(step1[0]) - int64(step1[1])) * cospi16_64 + step2[0] = int16(dctConstRoundShift(temp1)) + step2[1] = int16(dctConstRoundShift(temp2)) + temp1 = int64(step1[2])*cospi24_64 - int64(step1[3])*cospi8_64 + temp2 = int64(step1[2])*cospi8_64 + int64(step1[3])*cospi24_64 + step2[2] = int16(dctConstRoundShift(temp1)) + step2[3] = int16(dctConstRoundShift(temp2)) + step2[4] = int16(int64(step1[4]) + int64(step1[5])) + step2[5] = int16(int64(step1[4]) - int64(step1[5])) + step2[6] = int16(-int64(step1[6]) + int64(step1[7])) + step2[7] = int16(int64(step1[6]) + int64(step1[7])) + + step2[8] = step1[8] + step2[15] = step1[15] + temp1 = -int64(step1[9])*cospi8_64 + int64(step1[14])*cospi24_64 + temp2 = int64(step1[9])*cospi24_64 + int64(step1[14])*cospi8_64 + step2[9] = int16(dctConstRoundShift(temp1)) + step2[14] = int16(dctConstRoundShift(temp2)) + temp1 = -int64(step1[10])*cospi24_64 - int64(step1[13])*cospi8_64 + temp2 = -int64(step1[10])*cospi8_64 + int64(step1[13])*cospi24_64 + step2[10] = int16(dctConstRoundShift(temp1)) + step2[13] = int16(dctConstRoundShift(temp2)) + step2[11] = step1[11] + step2[12] = step1[12] + + // stage 5 + step1[0] = int16(int64(step2[0]) + int64(step2[3])) + step1[1] = int16(int64(step2[1]) + int64(step2[2])) + step1[2] = int16(int64(step2[1]) - int64(step2[2])) + step1[3] = int16(int64(step2[0]) - int64(step2[3])) + step1[4] = step2[4] + temp1 = (int64(step2[6]) - int64(step2[5])) * cospi16_64 + temp2 = (int64(step2[5]) + int64(step2[6])) * cospi16_64 + step1[5] = int16(dctConstRoundShift(temp1)) + step1[6] = int16(dctConstRoundShift(temp2)) + step1[7] = step2[7] + + step1[8] = int16(int64(step2[8]) + int64(step2[11])) + step1[9] = int16(int64(step2[9]) + int64(step2[10])) + step1[10] = int16(int64(step2[9]) - int64(step2[10])) + step1[11] = int16(int64(step2[8]) - int64(step2[11])) + step1[12] = int16(-int64(step2[12]) + int64(step2[15])) + step1[13] = int16(-int64(step2[13]) + int64(step2[14])) + step1[14] = int16(int64(step2[13]) + int64(step2[14])) + step1[15] = int16(int64(step2[12]) + int64(step2[15])) + + // stage 6 + step2[0] = int16(int64(step1[0]) + int64(step1[7])) + step2[1] = int16(int64(step1[1]) + int64(step1[6])) + step2[2] = int16(int64(step1[2]) + int64(step1[5])) + step2[3] = int16(int64(step1[3]) + int64(step1[4])) + step2[4] = int16(int64(step1[3]) - int64(step1[4])) + step2[5] = int16(int64(step1[2]) - int64(step1[5])) + step2[6] = int16(int64(step1[1]) - int64(step1[6])) + step2[7] = int16(int64(step1[0]) - int64(step1[7])) + step2[8] = step1[8] + step2[9] = step1[9] + temp1 = (-int64(step1[10]) + int64(step1[13])) * cospi16_64 + temp2 = (int64(step1[10]) + int64(step1[13])) * cospi16_64 + step2[10] = int16(dctConstRoundShift(temp1)) + step2[13] = int16(dctConstRoundShift(temp2)) + temp1 = (-int64(step1[11]) + int64(step1[12])) * cospi16_64 + temp2 = (int64(step1[11]) + int64(step1[12])) * cospi16_64 + step2[11] = int16(dctConstRoundShift(temp1)) + step2[12] = int16(dctConstRoundShift(temp2)) + step2[14] = step1[14] + step2[15] = step1[15] + + // stage 7 + output[0] = int16(int64(step2[0]) + int64(step2[15])) + output[1] = int16(int64(step2[1]) + int64(step2[14])) + output[2] = int16(int64(step2[2]) + int64(step2[13])) + output[3] = int16(int64(step2[3]) + int64(step2[12])) + output[4] = int16(int64(step2[4]) + int64(step2[11])) + output[5] = int16(int64(step2[5]) + int64(step2[10])) + output[6] = int16(int64(step2[6]) + int64(step2[9])) + output[7] = int16(int64(step2[7]) + int64(step2[8])) + output[8] = int16(int64(step2[7]) - int64(step2[8])) + output[9] = int16(int64(step2[6]) - int64(step2[9])) + output[10] = int16(int64(step2[5]) - int64(step2[10])) + output[11] = int16(int64(step2[4]) - int64(step2[11])) + output[12] = int16(int64(step2[3]) - int64(step2[12])) + output[13] = int16(int64(step2[2]) - int64(step2[13])) + output[14] = int16(int64(step2[1]) - int64(step2[14])) + output[15] = int16(int64(step2[0]) - int64(step2[15])) +} + +// idct16x16Add is the shared body for the 256/38/10 add wrappers below. +// rowLimit caps how many input rows are run through the row pass; the +// out[] buffer is left zero for rows beyond that, matching libvpx's +// sparse fast paths. +func idct16x16Add(input []int16, dest []uint8, stride, rowLimit int) { + var out [256]int16 + for i := range rowLimit { + idct16(input[i*16:i*16+16], out[i*16:i*16+16]) + } + var tempIn, tempOut [16]int16 + for i := range 16 { + for j := range 16 { + tempIn[j] = out[j*16+i] + } + idct16(tempIn[:], tempOut[:]) + for j := range 16 { + pos := j*stride + i + dest[pos] = clipPixelAdd(dest[pos], roundPowerOfTwo(int32(tempOut[j]), 6)) + } + } +} + +// idct16x16_256AddScalar applies the full 16x16 inverse DCT and adds +// it onto dest. Mirrors vpx_idct16x16_256_add_c. Scalar reference; the +// exported Idct16x16_256Add wrapper is in idct_dispatch_*.go. +func idct16x16_256AddScalar(input []int16, dest []uint8, stride int) { + idct16x16Add(input, dest, stride, 16) +} + +// idct16x16_38AddScalar is the sparse upper-left-8x8 fast path. Scalar +// reference; the exported Idct16x16_38Add wrapper is in +// idct_dispatch_*.go. +func idct16x16_38AddScalar(input []int16, dest []uint8, stride int) { + idct16x16Add(input, dest, stride, 8) +} + +// idct16x16_10AddScalar is the sparser upper-left-4x4 fast path. +// Scalar reference; the exported Idct16x16_10Add wrapper is in +// idct_dispatch_*.go. +func idct16x16_10AddScalar(input []int16, dest []uint8, stride int) { + idct16x16Add(input, dest, stride, 4) +} + +// idct16x16_1AddScalar is the DC-only fast path. Matches +// vpx_idct16x16_1_add_c. Scalar reference; the exported Idct16x16_1Add +// wrapper is in idct_dispatch_*.go. +func idct16x16_1AddScalar(input []int16, dest []uint8, stride int) { + out := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + out = int16(dctConstRoundShift(int64(out) * cospi16_64)) + a1 := roundPowerOfTwo(int32(out), 6) + for j := range 16 { + row := j * stride + for i := range 16 { + dest[row+i] = clipPixelAdd(dest[row+i], a1) + } + } +} diff --git a/internal/vp9/dsp/idct32.go b/internal/vp9/dsp/idct32.go new file mode 100644 index 0000000..108a4b3 --- /dev/null +++ b/internal/vp9/dsp/idct32.go @@ -0,0 +1,440 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/idct32.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// idct32 implements libvpx's idct32_c — the 32-point 1-D inverse DCT +// used by every Tx32x32 reconstruction. Seven butterfly stages with +// bit-reverse-permuted input at stage 1; step1 / step2 are int16_t in +// libvpx, so we narrow on every store to preserve byte parity. +func idct32(input, output []int16) { + var step1, step2 [32]int16 + + // stage 1 + step1[0] = input[0] + step1[1] = input[16] + step1[2] = input[8] + step1[3] = input[24] + step1[4] = input[4] + step1[5] = input[20] + step1[6] = input[12] + step1[7] = input[28] + step1[8] = input[2] + step1[9] = input[18] + step1[10] = input[10] + step1[11] = input[26] + step1[12] = input[6] + step1[13] = input[22] + step1[14] = input[14] + step1[15] = input[30] + + temp1 := int64(input[1])*cospi31_64 - int64(input[31])*cospi1_64 + temp2 := int64(input[1])*cospi1_64 + int64(input[31])*cospi31_64 + step1[16] = int16(dctConstRoundShift(temp1)) + step1[31] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(input[17])*cospi15_64 - int64(input[15])*cospi17_64 + temp2 = int64(input[17])*cospi17_64 + int64(input[15])*cospi15_64 + step1[17] = int16(dctConstRoundShift(temp1)) + step1[30] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(input[9])*cospi23_64 - int64(input[23])*cospi9_64 + temp2 = int64(input[9])*cospi9_64 + int64(input[23])*cospi23_64 + step1[18] = int16(dctConstRoundShift(temp1)) + step1[29] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(input[25])*cospi7_64 - int64(input[7])*cospi25_64 + temp2 = int64(input[25])*cospi25_64 + int64(input[7])*cospi7_64 + step1[19] = int16(dctConstRoundShift(temp1)) + step1[28] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(input[5])*cospi27_64 - int64(input[27])*cospi5_64 + temp2 = int64(input[5])*cospi5_64 + int64(input[27])*cospi27_64 + step1[20] = int16(dctConstRoundShift(temp1)) + step1[27] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(input[21])*cospi11_64 - int64(input[11])*cospi21_64 + temp2 = int64(input[21])*cospi21_64 + int64(input[11])*cospi11_64 + step1[21] = int16(dctConstRoundShift(temp1)) + step1[26] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(input[13])*cospi19_64 - int64(input[19])*cospi13_64 + temp2 = int64(input[13])*cospi13_64 + int64(input[19])*cospi19_64 + step1[22] = int16(dctConstRoundShift(temp1)) + step1[25] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(input[29])*cospi3_64 - int64(input[3])*cospi29_64 + temp2 = int64(input[29])*cospi29_64 + int64(input[3])*cospi3_64 + step1[23] = int16(dctConstRoundShift(temp1)) + step1[24] = int16(dctConstRoundShift(temp2)) + + // stage 2 + step2[0] = step1[0] + step2[1] = step1[1] + step2[2] = step1[2] + step2[3] = step1[3] + step2[4] = step1[4] + step2[5] = step1[5] + step2[6] = step1[6] + step2[7] = step1[7] + + temp1 = int64(step1[8])*cospi30_64 - int64(step1[15])*cospi2_64 + temp2 = int64(step1[8])*cospi2_64 + int64(step1[15])*cospi30_64 + step2[8] = int16(dctConstRoundShift(temp1)) + step2[15] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(step1[9])*cospi14_64 - int64(step1[14])*cospi18_64 + temp2 = int64(step1[9])*cospi18_64 + int64(step1[14])*cospi14_64 + step2[9] = int16(dctConstRoundShift(temp1)) + step2[14] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(step1[10])*cospi22_64 - int64(step1[13])*cospi10_64 + temp2 = int64(step1[10])*cospi10_64 + int64(step1[13])*cospi22_64 + step2[10] = int16(dctConstRoundShift(temp1)) + step2[13] = int16(dctConstRoundShift(temp2)) + + temp1 = int64(step1[11])*cospi6_64 - int64(step1[12])*cospi26_64 + temp2 = int64(step1[11])*cospi26_64 + int64(step1[12])*cospi6_64 + step2[11] = int16(dctConstRoundShift(temp1)) + step2[12] = int16(dctConstRoundShift(temp2)) + + step2[16] = int16(int64(step1[16]) + int64(step1[17])) + step2[17] = int16(int64(step1[16]) - int64(step1[17])) + step2[18] = int16(-int64(step1[18]) + int64(step1[19])) + step2[19] = int16(int64(step1[18]) + int64(step1[19])) + step2[20] = int16(int64(step1[20]) + int64(step1[21])) + step2[21] = int16(int64(step1[20]) - int64(step1[21])) + step2[22] = int16(-int64(step1[22]) + int64(step1[23])) + step2[23] = int16(int64(step1[22]) + int64(step1[23])) + step2[24] = int16(int64(step1[24]) + int64(step1[25])) + step2[25] = int16(int64(step1[24]) - int64(step1[25])) + step2[26] = int16(-int64(step1[26]) + int64(step1[27])) + step2[27] = int16(int64(step1[26]) + int64(step1[27])) + step2[28] = int16(int64(step1[28]) + int64(step1[29])) + step2[29] = int16(int64(step1[28]) - int64(step1[29])) + step2[30] = int16(-int64(step1[30]) + int64(step1[31])) + step2[31] = int16(int64(step1[30]) + int64(step1[31])) + + // stage 3 + step1[0] = step2[0] + step1[1] = step2[1] + step1[2] = step2[2] + step1[3] = step2[3] + + temp1 = int64(step2[4])*cospi28_64 - int64(step2[7])*cospi4_64 + temp2 = int64(step2[4])*cospi4_64 + int64(step2[7])*cospi28_64 + step1[4] = int16(dctConstRoundShift(temp1)) + step1[7] = int16(dctConstRoundShift(temp2)) + temp1 = int64(step2[5])*cospi12_64 - int64(step2[6])*cospi20_64 + temp2 = int64(step2[5])*cospi20_64 + int64(step2[6])*cospi12_64 + step1[5] = int16(dctConstRoundShift(temp1)) + step1[6] = int16(dctConstRoundShift(temp2)) + + step1[8] = int16(int64(step2[8]) + int64(step2[9])) + step1[9] = int16(int64(step2[8]) - int64(step2[9])) + step1[10] = int16(-int64(step2[10]) + int64(step2[11])) + step1[11] = int16(int64(step2[10]) + int64(step2[11])) + step1[12] = int16(int64(step2[12]) + int64(step2[13])) + step1[13] = int16(int64(step2[12]) - int64(step2[13])) + step1[14] = int16(-int64(step2[14]) + int64(step2[15])) + step1[15] = int16(int64(step2[14]) + int64(step2[15])) + + step1[16] = step2[16] + step1[31] = step2[31] + temp1 = -int64(step2[17])*cospi4_64 + int64(step2[30])*cospi28_64 + temp2 = int64(step2[17])*cospi28_64 + int64(step2[30])*cospi4_64 + step1[17] = int16(dctConstRoundShift(temp1)) + step1[30] = int16(dctConstRoundShift(temp2)) + temp1 = -int64(step2[18])*cospi28_64 - int64(step2[29])*cospi4_64 + temp2 = -int64(step2[18])*cospi4_64 + int64(step2[29])*cospi28_64 + step1[18] = int16(dctConstRoundShift(temp1)) + step1[29] = int16(dctConstRoundShift(temp2)) + step1[19] = step2[19] + step1[20] = step2[20] + temp1 = -int64(step2[21])*cospi20_64 + int64(step2[26])*cospi12_64 + temp2 = int64(step2[21])*cospi12_64 + int64(step2[26])*cospi20_64 + step1[21] = int16(dctConstRoundShift(temp1)) + step1[26] = int16(dctConstRoundShift(temp2)) + temp1 = -int64(step2[22])*cospi12_64 - int64(step2[25])*cospi20_64 + temp2 = -int64(step2[22])*cospi20_64 + int64(step2[25])*cospi12_64 + step1[22] = int16(dctConstRoundShift(temp1)) + step1[25] = int16(dctConstRoundShift(temp2)) + step1[23] = step2[23] + step1[24] = step2[24] + step1[27] = step2[27] + step1[28] = step2[28] + + // stage 4 + temp1 = (int64(step1[0]) + int64(step1[1])) * cospi16_64 + temp2 = (int64(step1[0]) - int64(step1[1])) * cospi16_64 + step2[0] = int16(dctConstRoundShift(temp1)) + step2[1] = int16(dctConstRoundShift(temp2)) + temp1 = int64(step1[2])*cospi24_64 - int64(step1[3])*cospi8_64 + temp2 = int64(step1[2])*cospi8_64 + int64(step1[3])*cospi24_64 + step2[2] = int16(dctConstRoundShift(temp1)) + step2[3] = int16(dctConstRoundShift(temp2)) + step2[4] = int16(int64(step1[4]) + int64(step1[5])) + step2[5] = int16(int64(step1[4]) - int64(step1[5])) + step2[6] = int16(-int64(step1[6]) + int64(step1[7])) + step2[7] = int16(int64(step1[6]) + int64(step1[7])) + + step2[8] = step1[8] + step2[15] = step1[15] + temp1 = -int64(step1[9])*cospi8_64 + int64(step1[14])*cospi24_64 + temp2 = int64(step1[9])*cospi24_64 + int64(step1[14])*cospi8_64 + step2[9] = int16(dctConstRoundShift(temp1)) + step2[14] = int16(dctConstRoundShift(temp2)) + temp1 = -int64(step1[10])*cospi24_64 - int64(step1[13])*cospi8_64 + temp2 = -int64(step1[10])*cospi8_64 + int64(step1[13])*cospi24_64 + step2[10] = int16(dctConstRoundShift(temp1)) + step2[13] = int16(dctConstRoundShift(temp2)) + step2[11] = step1[11] + step2[12] = step1[12] + + step2[16] = int16(int64(step1[16]) + int64(step1[19])) + step2[17] = int16(int64(step1[17]) + int64(step1[18])) + step2[18] = int16(int64(step1[17]) - int64(step1[18])) + step2[19] = int16(int64(step1[16]) - int64(step1[19])) + step2[20] = int16(-int64(step1[20]) + int64(step1[23])) + step2[21] = int16(-int64(step1[21]) + int64(step1[22])) + step2[22] = int16(int64(step1[21]) + int64(step1[22])) + step2[23] = int16(int64(step1[20]) + int64(step1[23])) + + step2[24] = int16(int64(step1[24]) + int64(step1[27])) + step2[25] = int16(int64(step1[25]) + int64(step1[26])) + step2[26] = int16(int64(step1[25]) - int64(step1[26])) + step2[27] = int16(int64(step1[24]) - int64(step1[27])) + step2[28] = int16(-int64(step1[28]) + int64(step1[31])) + step2[29] = int16(-int64(step1[29]) + int64(step1[30])) + step2[30] = int16(int64(step1[29]) + int64(step1[30])) + step2[31] = int16(int64(step1[28]) + int64(step1[31])) + + // stage 5 + step1[0] = int16(int64(step2[0]) + int64(step2[3])) + step1[1] = int16(int64(step2[1]) + int64(step2[2])) + step1[2] = int16(int64(step2[1]) - int64(step2[2])) + step1[3] = int16(int64(step2[0]) - int64(step2[3])) + step1[4] = step2[4] + temp1 = (int64(step2[6]) - int64(step2[5])) * cospi16_64 + temp2 = (int64(step2[5]) + int64(step2[6])) * cospi16_64 + step1[5] = int16(dctConstRoundShift(temp1)) + step1[6] = int16(dctConstRoundShift(temp2)) + step1[7] = step2[7] + + step1[8] = int16(int64(step2[8]) + int64(step2[11])) + step1[9] = int16(int64(step2[9]) + int64(step2[10])) + step1[10] = int16(int64(step2[9]) - int64(step2[10])) + step1[11] = int16(int64(step2[8]) - int64(step2[11])) + step1[12] = int16(-int64(step2[12]) + int64(step2[15])) + step1[13] = int16(-int64(step2[13]) + int64(step2[14])) + step1[14] = int16(int64(step2[13]) + int64(step2[14])) + step1[15] = int16(int64(step2[12]) + int64(step2[15])) + + step1[16] = step2[16] + step1[17] = step2[17] + temp1 = -int64(step2[18])*cospi8_64 + int64(step2[29])*cospi24_64 + temp2 = int64(step2[18])*cospi24_64 + int64(step2[29])*cospi8_64 + step1[18] = int16(dctConstRoundShift(temp1)) + step1[29] = int16(dctConstRoundShift(temp2)) + temp1 = -int64(step2[19])*cospi8_64 + int64(step2[28])*cospi24_64 + temp2 = int64(step2[19])*cospi24_64 + int64(step2[28])*cospi8_64 + step1[19] = int16(dctConstRoundShift(temp1)) + step1[28] = int16(dctConstRoundShift(temp2)) + temp1 = -int64(step2[20])*cospi24_64 - int64(step2[27])*cospi8_64 + temp2 = -int64(step2[20])*cospi8_64 + int64(step2[27])*cospi24_64 + step1[20] = int16(dctConstRoundShift(temp1)) + step1[27] = int16(dctConstRoundShift(temp2)) + temp1 = -int64(step2[21])*cospi24_64 - int64(step2[26])*cospi8_64 + temp2 = -int64(step2[21])*cospi8_64 + int64(step2[26])*cospi24_64 + step1[21] = int16(dctConstRoundShift(temp1)) + step1[26] = int16(dctConstRoundShift(temp2)) + step1[22] = step2[22] + step1[23] = step2[23] + step1[24] = step2[24] + step1[25] = step2[25] + step1[30] = step2[30] + step1[31] = step2[31] + + // stage 6 + step2[0] = int16(int64(step1[0]) + int64(step1[7])) + step2[1] = int16(int64(step1[1]) + int64(step1[6])) + step2[2] = int16(int64(step1[2]) + int64(step1[5])) + step2[3] = int16(int64(step1[3]) + int64(step1[4])) + step2[4] = int16(int64(step1[3]) - int64(step1[4])) + step2[5] = int16(int64(step1[2]) - int64(step1[5])) + step2[6] = int16(int64(step1[1]) - int64(step1[6])) + step2[7] = int16(int64(step1[0]) - int64(step1[7])) + step2[8] = step1[8] + step2[9] = step1[9] + temp1 = (-int64(step1[10]) + int64(step1[13])) * cospi16_64 + temp2 = (int64(step1[10]) + int64(step1[13])) * cospi16_64 + step2[10] = int16(dctConstRoundShift(temp1)) + step2[13] = int16(dctConstRoundShift(temp2)) + temp1 = (-int64(step1[11]) + int64(step1[12])) * cospi16_64 + temp2 = (int64(step1[11]) + int64(step1[12])) * cospi16_64 + step2[11] = int16(dctConstRoundShift(temp1)) + step2[12] = int16(dctConstRoundShift(temp2)) + step2[14] = step1[14] + step2[15] = step1[15] + + step2[16] = int16(int64(step1[16]) + int64(step1[23])) + step2[17] = int16(int64(step1[17]) + int64(step1[22])) + step2[18] = int16(int64(step1[18]) + int64(step1[21])) + step2[19] = int16(int64(step1[19]) + int64(step1[20])) + step2[20] = int16(int64(step1[19]) - int64(step1[20])) + step2[21] = int16(int64(step1[18]) - int64(step1[21])) + step2[22] = int16(int64(step1[17]) - int64(step1[22])) + step2[23] = int16(int64(step1[16]) - int64(step1[23])) + + step2[24] = int16(-int64(step1[24]) + int64(step1[31])) + step2[25] = int16(-int64(step1[25]) + int64(step1[30])) + step2[26] = int16(-int64(step1[26]) + int64(step1[29])) + step2[27] = int16(-int64(step1[27]) + int64(step1[28])) + step2[28] = int16(int64(step1[27]) + int64(step1[28])) + step2[29] = int16(int64(step1[26]) + int64(step1[29])) + step2[30] = int16(int64(step1[25]) + int64(step1[30])) + step2[31] = int16(int64(step1[24]) + int64(step1[31])) + + // stage 7 + step1[0] = int16(int64(step2[0]) + int64(step2[15])) + step1[1] = int16(int64(step2[1]) + int64(step2[14])) + step1[2] = int16(int64(step2[2]) + int64(step2[13])) + step1[3] = int16(int64(step2[3]) + int64(step2[12])) + step1[4] = int16(int64(step2[4]) + int64(step2[11])) + step1[5] = int16(int64(step2[5]) + int64(step2[10])) + step1[6] = int16(int64(step2[6]) + int64(step2[9])) + step1[7] = int16(int64(step2[7]) + int64(step2[8])) + step1[8] = int16(int64(step2[7]) - int64(step2[8])) + step1[9] = int16(int64(step2[6]) - int64(step2[9])) + step1[10] = int16(int64(step2[5]) - int64(step2[10])) + step1[11] = int16(int64(step2[4]) - int64(step2[11])) + step1[12] = int16(int64(step2[3]) - int64(step2[12])) + step1[13] = int16(int64(step2[2]) - int64(step2[13])) + step1[14] = int16(int64(step2[1]) - int64(step2[14])) + step1[15] = int16(int64(step2[0]) - int64(step2[15])) + + step1[16] = step2[16] + step1[17] = step2[17] + step1[18] = step2[18] + step1[19] = step2[19] + temp1 = (-int64(step2[20]) + int64(step2[27])) * cospi16_64 + temp2 = (int64(step2[20]) + int64(step2[27])) * cospi16_64 + step1[20] = int16(dctConstRoundShift(temp1)) + step1[27] = int16(dctConstRoundShift(temp2)) + temp1 = (-int64(step2[21]) + int64(step2[26])) * cospi16_64 + temp2 = (int64(step2[21]) + int64(step2[26])) * cospi16_64 + step1[21] = int16(dctConstRoundShift(temp1)) + step1[26] = int16(dctConstRoundShift(temp2)) + temp1 = (-int64(step2[22]) + int64(step2[25])) * cospi16_64 + temp2 = (int64(step2[22]) + int64(step2[25])) * cospi16_64 + step1[22] = int16(dctConstRoundShift(temp1)) + step1[25] = int16(dctConstRoundShift(temp2)) + temp1 = (-int64(step2[23]) + int64(step2[24])) * cospi16_64 + temp2 = (int64(step2[23]) + int64(step2[24])) * cospi16_64 + step1[23] = int16(dctConstRoundShift(temp1)) + step1[24] = int16(dctConstRoundShift(temp2)) + step1[28] = step2[28] + step1[29] = step2[29] + step1[30] = step2[30] + step1[31] = step2[31] + + // final stage + output[0] = int16(int64(step1[0]) + int64(step1[31])) + output[1] = int16(int64(step1[1]) + int64(step1[30])) + output[2] = int16(int64(step1[2]) + int64(step1[29])) + output[3] = int16(int64(step1[3]) + int64(step1[28])) + output[4] = int16(int64(step1[4]) + int64(step1[27])) + output[5] = int16(int64(step1[5]) + int64(step1[26])) + output[6] = int16(int64(step1[6]) + int64(step1[25])) + output[7] = int16(int64(step1[7]) + int64(step1[24])) + output[8] = int16(int64(step1[8]) + int64(step1[23])) + output[9] = int16(int64(step1[9]) + int64(step1[22])) + output[10] = int16(int64(step1[10]) + int64(step1[21])) + output[11] = int16(int64(step1[11]) + int64(step1[20])) + output[12] = int16(int64(step1[12]) + int64(step1[19])) + output[13] = int16(int64(step1[13]) + int64(step1[18])) + output[14] = int16(int64(step1[14]) + int64(step1[17])) + output[15] = int16(int64(step1[15]) + int64(step1[16])) + output[16] = int16(int64(step1[15]) - int64(step1[16])) + output[17] = int16(int64(step1[14]) - int64(step1[17])) + output[18] = int16(int64(step1[13]) - int64(step1[18])) + output[19] = int16(int64(step1[12]) - int64(step1[19])) + output[20] = int16(int64(step1[11]) - int64(step1[20])) + output[21] = int16(int64(step1[10]) - int64(step1[21])) + output[22] = int16(int64(step1[9]) - int64(step1[22])) + output[23] = int16(int64(step1[8]) - int64(step1[23])) + output[24] = int16(int64(step1[7]) - int64(step1[24])) + output[25] = int16(int64(step1[6]) - int64(step1[25])) + output[26] = int16(int64(step1[5]) - int64(step1[26])) + output[27] = int16(int64(step1[4]) - int64(step1[27])) + output[28] = int16(int64(step1[3]) - int64(step1[28])) + output[29] = int16(int64(step1[2]) - int64(step1[29])) + output[30] = int16(int64(step1[1]) - int64(step1[30])) + output[31] = int16(int64(step1[0]) - int64(step1[31])) +} + +// idct32x32Add is the shared body for the 1024/135/34 add wrappers. The +// rowLimit caps the row pass for the sparse fast paths. Matches the +// vpx_idct32x32_{1024,135,34}_add_c structure in vpx_dsp/inv_txfm.c — +// each variant zero-fills the out[] beyond the limit, then runs the +// full column pass. +func idct32x32Add(input []int16, dest []uint8, stride, rowLimit int) { + var out [1024]int16 + for i := range rowLimit { + idct32(input[i*32:i*32+32], out[i*32:i*32+32]) + } + var tempIn, tempOut [32]int16 + for i := range 32 { + for j := range 32 { + tempIn[j] = out[j*32+i] + } + idct32(tempIn[:], tempOut[:]) + for j := range 32 { + pos := j*stride + i + dest[pos] = clipPixelAdd(dest[pos], roundPowerOfTwo(int32(tempOut[j]), 6)) + } + } +} + +// idct32x32_1024AddScalar is the dense 32x32 add. Mirrors +// vpx_idct32x32_1024_add_c. Scalar reference; the exported +// Idct32x32_1024Add wrapper is in idct_dispatch_*.go. +func idct32x32_1024AddScalar(input []int16, dest []uint8, stride int) { + idct32x32Add(input, dest, stride, 32) +} + +// idct32x32_135AddScalar is the sparse-top-left-16x16 fast path. +// Mirrors vpx_idct32x32_135_add_c. Scalar reference; the exported +// Idct32x32_135Add wrapper is in idct_dispatch_*.go. +func idct32x32_135AddScalar(input []int16, dest []uint8, stride int) { + idct32x32Add(input, dest, stride, 16) +} + +// idct32x32_34AddScalar is the sparser top-left-8x8 fast path. +// Mirrors vpx_idct32x32_34_add_c. Scalar reference; the exported +// Idct32x32_34Add wrapper is in idct_dispatch_*.go. +func idct32x32_34AddScalar(input []int16, dest []uint8, stride int) { + idct32x32Add(input, dest, stride, 8) +} + +// idct32x32_1AddScalar is the DC-only fast path. Mirrors +// vpx_idct32x32_1_add_c. Scalar reference; the exported Idct32x32_1Add +// wrapper is in idct_dispatch_*.go. +func idct32x32_1AddScalar(input []int16, dest []uint8, stride int) { + out := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + out = int16(dctConstRoundShift(int64(out) * cospi16_64)) + a1 := roundPowerOfTwo(int32(out), 6) + for j := range 32 { + row := j * stride + for i := range 32 { + dest[row+i] = clipPixelAdd(dest[row+i], a1) + } + } +} diff --git a/internal/vp9/dsp/idct4.go b/internal/vp9/dsp/idct4.go new file mode 100644 index 0000000..2467e3f --- /dev/null +++ b/internal/vp9/dsp/idct4.go @@ -0,0 +1,95 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/idct4.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// idct4 implements libvpx's idct4_c: a 4-point 1-D inverse DCT. Input +// and output are 4 element slices; the caller passes a stride of 1 +// element. Matches the line-by-line structure of vpx_dsp/inv_txfm.c so +// any future intermediate-precision tweak made upstream is easy to +// mirror. +// +// The output slice type is []int16 to match libvpx's tran_low_t in the +// 8-bit (non-highbitdepth) configuration. Intermediate computation is +// done in int64 to model the tran_high_t accumulator. +func idct4(input, output []int16) { + var step [4]int32 + in0 := int64(input[0]) + in1 := int64(input[1]) + in2 := int64(input[2]) + in3 := int64(input[3]) + + // stage 1 + temp1 := (in0 + in2) * cospi16_64 + temp2 := (in0 - in2) * cospi16_64 + step[0] = int32(dctConstRoundShift(temp1)) + step[1] = int32(dctConstRoundShift(temp2)) + temp1 = in1*cospi24_64 - in3*cospi8_64 + temp2 = in1*cospi8_64 + in3*cospi24_64 + step[2] = int32(dctConstRoundShift(temp1)) + step[3] = int32(dctConstRoundShift(temp2)) + + // stage 2 — the libvpx output buffer is int16_t, so the int32 sums + // are truncated to int16 on store. The govpx ports must do the same + // for byte parity. + output[0] = int16(step[0] + step[3]) + output[1] = int16(step[1] + step[2]) + output[2] = int16(step[1] - step[2]) + output[3] = int16(step[0] - step[3]) +} + +// idct4x4_16AddScalar applies the full 4x4 inverse DCT to a +// 16-coefficient block and adds the result onto the dest pixels at the +// given stride. Mirrors vpx_idct4x4_16_add_c: row pass produces a 4x4 +// intermediate, then a column pass with the >>4 normalization shift +// folded into the pixel-add via clip_pixel_add(ROUND_POWER_OF_TWO(., +// 4)). +// +// This is the always-available scalar reference. The exported +// Idct4x4_16Add wrapper lives in idct_dispatch_*.go and routes either +// here or to a NEON kernel. +func idct4x4_16AddScalar(input []int16, dest []uint8, stride int) { + var out [16]int16 + for i := range 4 { + idct4(input[i*4:i*4+4], out[i*4:i*4+4]) + } + var tempIn, tempOut [4]int16 + for i := range 4 { + for j := range 4 { + tempIn[j] = out[j*4+i] + } + idct4(tempIn[:], tempOut[:]) + for j := range 4 { + pos := j*stride + i + dest[pos] = clipPixelAdd(dest[pos], roundPowerOfTwo(int32(tempOut[j]), 4)) + } + } +} + +// idct4x4_1AddScalar handles the common case where only the DC +// coefficient is non-zero. Matches vpx_idct4x4_1_add_c — two +// cospi_16_64 multiplies followed by a single +>>4 broadcast across the +// 4x4 pixel block. +// +// This is the always-available scalar reference. The exported +// Idct4x4_1Add wrapper lives in idct_dispatch_*.go. +func idct4x4_1AddScalar(input []int16, dest []uint8, stride int) { + out := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + out = int16(dctConstRoundShift(int64(out) * cospi16_64)) + a1 := roundPowerOfTwo(int32(out), 4) + + for i := range 4 { + row := i * stride + dest[row+0] = clipPixelAdd(dest[row+0], a1) + dest[row+1] = clipPixelAdd(dest[row+1], a1) + dest[row+2] = clipPixelAdd(dest[row+2], a1) + dest[row+3] = clipPixelAdd(dest[row+3], a1) + } +} diff --git a/internal/vp9/dsp/idct8.go b/internal/vp9/dsp/idct8.go new file mode 100644 index 0000000..af77e60 --- /dev/null +++ b/internal/vp9/dsp/idct8.go @@ -0,0 +1,378 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/idct8.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "encoding/binary" + +// idct8 implements libvpx's idct8_c — the 8-point 1-D inverse DCT used +// by every Tx8x8 reconstruction. Four-stage butterfly with cospi +// multiplies at stages 1, 2 and 3; stages collapse into the final +// output via additions only. Matches vpx_dsp/inv_txfm.c stage-by-stage. +// +// Per libvpx, step1 / step2 are int16_t storage (truncated on store), +// so step values are clamped to the int16 range mid-pipeline — we +// mirror that with explicit int16 narrowing to preserve byte parity. +func idct8(input, output []int16) { + _ = input[7] + _ = output[7] + in0 := int64(input[0]) + in1 := int64(input[1]) + in2 := int64(input[2]) + in3 := int64(input[3]) + in4 := int64(input[4]) + in5 := int64(input[5]) + in6 := int64(input[6]) + in7 := int64(input[7]) + + // stage 1 + s1_0 := int64(int16(in0)) + s1_2 := int64(int16(in4)) + s1_1 := int64(int16(in2)) + s1_3 := int64(int16(in6)) + s1_4 := int64(int16(dctConstRoundShift(in1*cospi28_64 - in7*cospi4_64))) + s1_7 := int64(int16(dctConstRoundShift(in1*cospi4_64 + in7*cospi28_64))) + s1_5 := int64(int16(dctConstRoundShift(in5*cospi12_64 - in3*cospi20_64))) + s1_6 := int64(int16(dctConstRoundShift(in5*cospi20_64 + in3*cospi12_64))) + + // stage 2 + s2_0 := int64(int16(dctConstRoundShift((s1_0 + s1_2) * cospi16_64))) + s2_1 := int64(int16(dctConstRoundShift((s1_0 - s1_2) * cospi16_64))) + s2_2 := int64(int16(dctConstRoundShift(s1_1*cospi24_64 - s1_3*cospi8_64))) + s2_3 := int64(int16(dctConstRoundShift(s1_1*cospi8_64 + s1_3*cospi24_64))) + s2_4 := int64(int16(s1_4 + s1_5)) + s2_5 := int64(int16(s1_4 - s1_5)) + s2_6 := int64(int16(s1_7 - s1_6)) + s2_7 := int64(int16(s1_6 + s1_7)) + + // stage 3 + t0 := int64(int16(s2_0 + s2_3)) + t1 := int64(int16(s2_1 + s2_2)) + t2 := int64(int16(s2_1 - s2_2)) + t3 := int64(int16(s2_0 - s2_3)) + t4 := s2_4 + t5 := int64(int16(dctConstRoundShift((s2_6 - s2_5) * cospi16_64))) + t6 := int64(int16(dctConstRoundShift((s2_5 + s2_6) * cospi16_64))) + t7 := s2_7 + + // stage 4 + output[0] = int16(t0 + t7) + output[1] = int16(t1 + t6) + output[2] = int16(t2 + t5) + output[3] = int16(t3 + t4) + output[4] = int16(t3 - t4) + output[5] = int16(t2 - t5) + output[6] = int16(t1 - t6) + output[7] = int16(t0 - t7) +} + +// idct8x8_64AddScalar applies the full 8x8 inverse DCT to a +// 64-coefficient block and adds the result onto dest. Mirrors +// vpx_idct8x8_64_add_c: row pass into a transposed intermediate, then +// a column pass with ROUND_POWER_OF_TWO(., 5) into clip_pixel_add. +// +// Scalar reference; the exported Idct8x8_64Add wrapper is in +// idct_dispatch_*.go. +func idct8x8_64AddScalar(input []int16, dest []uint8, stride int) { + _ = input[63] + _ = dest[7*stride+7] + var out [64]int16 + for i := range 8 { + row := input[i*8 : i*8+8] + in0, in1, in2, in3 := int64(row[0]), int64(row[1]), int64(row[2]), int64(row[3]) + in4, in5, in6, in7 := int64(row[4]), int64(row[5]), int64(row[6]), int64(row[7]) + if in1|in2|in3|in4|in5|in6|in7 == 0 { + if in0 != 0 { + dc := int16(dctConstRoundShift(in0 * cospi16_64)) + out[0*8+i] = dc + out[1*8+i] = dc + out[2*8+i] = dc + out[3*8+i] = dc + out[4*8+i] = dc + out[5*8+i] = dc + out[6*8+i] = dc + out[7*8+i] = dc + } + continue + } + + s1_4 := int64(int16(dctConstRoundShift(in1*cospi28_64 - in7*cospi4_64))) + s1_7 := int64(int16(dctConstRoundShift(in1*cospi4_64 + in7*cospi28_64))) + s1_5 := int64(int16(dctConstRoundShift(in5*cospi12_64 - in3*cospi20_64))) + s1_6 := int64(int16(dctConstRoundShift(in5*cospi20_64 + in3*cospi12_64))) + + s2_0 := int64(int16(dctConstRoundShift((in0 + in4) * cospi16_64))) + s2_1 := int64(int16(dctConstRoundShift((in0 - in4) * cospi16_64))) + s2_2 := int64(int16(dctConstRoundShift(in2*cospi24_64 - in6*cospi8_64))) + s2_3 := int64(int16(dctConstRoundShift(in2*cospi8_64 + in6*cospi24_64))) + s2_4 := int64(int16(s1_4 + s1_5)) + s2_5 := int64(int16(s1_4 - s1_5)) + s2_6 := int64(int16(s1_7 - s1_6)) + s2_7 := int64(int16(s1_6 + s1_7)) + + t0 := int64(int16(s2_0 + s2_3)) + t1 := int64(int16(s2_1 + s2_2)) + t2 := int64(int16(s2_1 - s2_2)) + t3 := int64(int16(s2_0 - s2_3)) + t5 := int64(int16(dctConstRoundShift((s2_6 - s2_5) * cospi16_64))) + t6 := int64(int16(dctConstRoundShift((s2_5 + s2_6) * cospi16_64))) + + // Write transposed so column pass reads contiguous rows. + out[0*8+i] = int16(t0 + s2_7) + out[1*8+i] = int16(t1 + t6) + out[2*8+i] = int16(t2 + t5) + out[3*8+i] = int16(t3 + s2_4) + out[4*8+i] = int16(t3 - s2_4) + out[5*8+i] = int16(t2 - t5) + out[6*8+i] = int16(t1 - t6) + out[7*8+i] = int16(t0 - s2_7) + } + s1, s2, s3, s4, s5, s6, s7 := stride, 2*stride, 3*stride, 4*stride, 5*stride, 6*stride, 7*stride + for i := range 8 { + col := (*[8]int16)(out[i*8 : i*8+8]) + in0, in1, in2, in3 := int64(col[0]), int64(col[1]), int64(col[2]), int64(col[3]) + in4, in5, in6, in7 := int64(col[4]), int64(col[5]), int64(col[6]), int64(col[7]) + if in1|in2|in3|in4|in5|in6|in7 == 0 { + if in0 != 0 { + dc := roundPowerOfTwo(int32(int16(dctConstRoundShift(in0*cospi16_64))), 5) + dest[i] = clipPixelAdd(dest[i], dc) + dest[s1+i] = clipPixelAdd(dest[s1+i], dc) + dest[s2+i] = clipPixelAdd(dest[s2+i], dc) + dest[s3+i] = clipPixelAdd(dest[s3+i], dc) + dest[s4+i] = clipPixelAdd(dest[s4+i], dc) + dest[s5+i] = clipPixelAdd(dest[s5+i], dc) + dest[s6+i] = clipPixelAdd(dest[s6+i], dc) + dest[s7+i] = clipPixelAdd(dest[s7+i], dc) + } + continue + } + + s1_4 := int64(int16(dctConstRoundShift(in1*cospi28_64 - in7*cospi4_64))) + s1_7 := int64(int16(dctConstRoundShift(in1*cospi4_64 + in7*cospi28_64))) + s1_5 := int64(int16(dctConstRoundShift(in5*cospi12_64 - in3*cospi20_64))) + s1_6 := int64(int16(dctConstRoundShift(in5*cospi20_64 + in3*cospi12_64))) + + s2_0 := int64(int16(dctConstRoundShift((in0 + in4) * cospi16_64))) + s2_1 := int64(int16(dctConstRoundShift((in0 - in4) * cospi16_64))) + s2_2 := int64(int16(dctConstRoundShift(in2*cospi24_64 - in6*cospi8_64))) + s2_3 := int64(int16(dctConstRoundShift(in2*cospi8_64 + in6*cospi24_64))) + s2_4 := int64(int16(s1_4 + s1_5)) + s2_5 := int64(int16(s1_4 - s1_5)) + s2_6 := int64(int16(s1_7 - s1_6)) + s2_7 := int64(int16(s1_6 + s1_7)) + + t0 := int64(int16(s2_0 + s2_3)) + t1 := int64(int16(s2_1 + s2_2)) + t2 := int64(int16(s2_1 - s2_2)) + t3 := int64(int16(s2_0 - s2_3)) + t5 := int64(int16(dctConstRoundShift((s2_6 - s2_5) * cospi16_64))) + t6 := int64(int16(dctConstRoundShift((s2_5 + s2_6) * cospi16_64))) + + dest[i] = clipPixelAdd(dest[i], roundPowerOfTwo(int32(int16(t0+s2_7)), 5)) + dest[s1+i] = clipPixelAdd(dest[s1+i], roundPowerOfTwo(int32(int16(t1+t6)), 5)) + dest[s2+i] = clipPixelAdd(dest[s2+i], roundPowerOfTwo(int32(int16(t2+t5)), 5)) + dest[s3+i] = clipPixelAdd(dest[s3+i], roundPowerOfTwo(int32(int16(t3+s2_4)), 5)) + dest[s4+i] = clipPixelAdd(dest[s4+i], roundPowerOfTwo(int32(int16(t3-s2_4)), 5)) + dest[s5+i] = clipPixelAdd(dest[s5+i], roundPowerOfTwo(int32(int16(t2-t5)), 5)) + dest[s6+i] = clipPixelAdd(dest[s6+i], roundPowerOfTwo(int32(int16(t1-t6)), 5)) + dest[s7+i] = clipPixelAdd(dest[s7+i], roundPowerOfTwo(int32(int16(t0-s2_7)), 5)) + } +} + +// idct8x8_12AddScalar is the sparse fast path used when only the +// top-left 4x4 of the input is non-zero. Matches vpx_idct8x8_12_add_c: +// it skips the lower 4 rows of the row pass and zero-fills out before +// the column pass. +// +// Scalar reference; the exported Idct8x8_12Add wrapper is in +// idct_dispatch_*.go. +func idct8x8_12AddScalar(input []int16, dest []uint8, stride int) { + _ = input[31] + _ = dest[7*stride+7] + var out [32]int16 // 8 columns × 4 non-zero rows (transposed) + for i := range 4 { + row := input[i*8 : i*8+8] + in0, in1, in2, in3 := int64(row[0]), int64(row[1]), int64(row[2]), int64(row[3]) + in4, in5, in6, in7 := int64(row[4]), int64(row[5]), int64(row[6]), int64(row[7]) + if in4|in5|in6|in7 == 0 { + if in1|in2|in3 == 0 { + if in0 != 0 { + dc := int16(dctConstRoundShift(in0 * cospi16_64)) + out[0*4+i] = dc + out[1*4+i] = dc + out[2*4+i] = dc + out[3*4+i] = dc + out[4*4+i] = dc + out[5*4+i] = dc + out[6*4+i] = dc + out[7*4+i] = dc + } + continue + } + s1_4 := int64(int16(dctConstRoundShift(in1 * cospi28_64))) + s1_7 := int64(int16(dctConstRoundShift(in1 * cospi4_64))) + s1_5 := int64(int16(dctConstRoundShift(-in3 * cospi20_64))) + s1_6 := int64(int16(dctConstRoundShift(in3 * cospi12_64))) + + s2_0 := int64(int16(dctConstRoundShift(in0 * cospi16_64))) + s2_2 := int64(int16(dctConstRoundShift(in2 * cospi24_64))) + s2_3 := int64(int16(dctConstRoundShift(in2 * cospi8_64))) + s2_4 := int64(int16(s1_4 + s1_5)) + s2_5 := int64(int16(s1_4 - s1_5)) + s2_6 := int64(int16(s1_7 - s1_6)) + s2_7 := int64(int16(s1_6 + s1_7)) + + t0 := int64(int16(s2_0 + s2_3)) + t1 := int64(int16(s2_0 + s2_2)) + t2 := int64(int16(s2_0 - s2_2)) + t3 := int64(int16(s2_0 - s2_3)) + t5 := int64(int16(dctConstRoundShift((s2_6 - s2_5) * cospi16_64))) + t6 := int64(int16(dctConstRoundShift((s2_5 + s2_6) * cospi16_64))) + + out[0*4+i] = int16(t0 + s2_7) + out[1*4+i] = int16(t1 + t6) + out[2*4+i] = int16(t2 + t5) + out[3*4+i] = int16(t3 + s2_4) + out[4*4+i] = int16(t3 - s2_4) + out[5*4+i] = int16(t2 - t5) + out[6*4+i] = int16(t1 - t6) + out[7*4+i] = int16(t0 - s2_7) + continue + } + + s1_4 := int64(int16(dctConstRoundShift(in1*cospi28_64 - in7*cospi4_64))) + s1_7 := int64(int16(dctConstRoundShift(in1*cospi4_64 + in7*cospi28_64))) + s1_5 := int64(int16(dctConstRoundShift(in5*cospi12_64 - in3*cospi20_64))) + s1_6 := int64(int16(dctConstRoundShift(in5*cospi20_64 + in3*cospi12_64))) + + s2_0 := int64(int16(dctConstRoundShift((in0 + in4) * cospi16_64))) + s2_1 := int64(int16(dctConstRoundShift((in0 - in4) * cospi16_64))) + s2_2 := int64(int16(dctConstRoundShift(in2*cospi24_64 - in6*cospi8_64))) + s2_3 := int64(int16(dctConstRoundShift(in2*cospi8_64 + in6*cospi24_64))) + s2_4 := int64(int16(s1_4 + s1_5)) + s2_5 := int64(int16(s1_4 - s1_5)) + s2_6 := int64(int16(s1_7 - s1_6)) + s2_7 := int64(int16(s1_6 + s1_7)) + + t0 := int64(int16(s2_0 + s2_3)) + t1 := int64(int16(s2_1 + s2_2)) + t2 := int64(int16(s2_1 - s2_2)) + t3 := int64(int16(s2_0 - s2_3)) + t5 := int64(int16(dctConstRoundShift((s2_6 - s2_5) * cospi16_64))) + t6 := int64(int16(dctConstRoundShift((s2_5 + s2_6) * cospi16_64))) + + out[0*4+i] = int16(t0 + s2_7) + out[1*4+i] = int16(t1 + t6) + out[2*4+i] = int16(t2 + t5) + out[3*4+i] = int16(t3 + s2_4) + out[4*4+i] = int16(t3 - s2_4) + out[5*4+i] = int16(t2 - t5) + out[6*4+i] = int16(t1 - t6) + out[7*4+i] = int16(t0 - s2_7) + } + s1, s2, s3, s4, s5, s6, s7 := stride, 2*stride, 3*stride, 4*stride, 5*stride, 6*stride, 7*stride + for i := range 8 { + col := out[i*4 : i*4+4] + in0, in1, in2, in3 := int64(col[0]), int64(col[1]), int64(col[2]), int64(col[3]) + + s1_4 := int64(int16(dctConstRoundShift(in1 * cospi28_64))) + s1_7 := int64(int16(dctConstRoundShift(in1 * cospi4_64))) + s1_5 := int64(int16(dctConstRoundShift(-in3 * cospi20_64))) + s1_6 := int64(int16(dctConstRoundShift(in3 * cospi12_64))) + + s2_0 := int64(int16(dctConstRoundShift(in0 * cospi16_64))) + s2_2 := int64(int16(dctConstRoundShift(in2 * cospi24_64))) + s2_3 := int64(int16(dctConstRoundShift(in2 * cospi8_64))) + s2_4 := int64(int16(s1_4 + s1_5)) + s2_5 := int64(int16(s1_4 - s1_5)) + s2_6 := int64(int16(s1_7 - s1_6)) + s2_7 := int64(int16(s1_6 + s1_7)) + + t0 := int64(int16(s2_0 + s2_3)) + t1 := int64(int16(s2_0 + s2_2)) + t2 := int64(int16(s2_0 - s2_2)) + t3 := int64(int16(s2_0 - s2_3)) + t5 := int64(int16(dctConstRoundShift((s2_6 - s2_5) * cospi16_64))) + t6 := int64(int16(dctConstRoundShift((s2_5 + s2_6) * cospi16_64))) + + dest[i] = clipPixelAdd(dest[i], roundPowerOfTwo(int32(int16(t0+s2_7)), 5)) + dest[s1+i] = clipPixelAdd(dest[s1+i], roundPowerOfTwo(int32(int16(t1+t6)), 5)) + dest[s2+i] = clipPixelAdd(dest[s2+i], roundPowerOfTwo(int32(int16(t2+t5)), 5)) + dest[s3+i] = clipPixelAdd(dest[s3+i], roundPowerOfTwo(int32(int16(t3+s2_4)), 5)) + dest[s4+i] = clipPixelAdd(dest[s4+i], roundPowerOfTwo(int32(int16(t3-s2_4)), 5)) + dest[s5+i] = clipPixelAdd(dest[s5+i], roundPowerOfTwo(int32(int16(t2-t5)), 5)) + dest[s6+i] = clipPixelAdd(dest[s6+i], roundPowerOfTwo(int32(int16(t1-t6)), 5)) + dest[s7+i] = clipPixelAdd(dest[s7+i], roundPowerOfTwo(int32(int16(t0-s2_7)), 5)) + } +} + +// idct8x8_1AddScalar is the DC-only fast path. Matches +// vpx_idct8x8_1_add_c. +// +// Scalar reference; the exported Idct8x8_1Add wrapper is in +// idct_dispatch_*.go. +func idct8x8_1AddScalar(input []int16, dest []uint8, stride int) { + out := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + out = int16(dctConstRoundShift(int64(out) * cospi16_64)) + a1 := roundPowerOfTwo(int32(out), 5) + if a1 == 0 { + return + } + const ( + mask00FF = uint64(0x00ff00ff00ff00ff) + maskFF00 = uint64(0xff00ff00ff00ff00) + bit0100 = uint64(0x0100010001000100) + ones16 = uint64(0x0001000100010001) + ) + if a1 > 0 && a1 <= 255 { + d := uint64(a1) * ones16 + di := 0 + for range 8 { + row := dest[di : di+8] + w := binary.LittleEndian.Uint64(row) + lo := (w & mask00FF) + d + lo = (lo | (((lo & bit0100) >> 8) * 0xff)) & mask00FF + hi := ((w >> 8) & mask00FF) + d + hi = ((hi | (((hi & bit0100) >> 8) * 0xff)) << 8) & maskFF00 + binary.LittleEndian.PutUint64(row, lo|hi) + di += stride + } + return + } + if a1 < 0 && a1 >= -255 { + d := uint64(-a1) * ones16 + di := 0 + for range 8 { + row := dest[di : di+8] + w := binary.LittleEndian.Uint64(row) + lo := ((w & mask00FF) | bit0100) - d + lo = lo & (((lo & bit0100) >> 8) * 0xff) + hi := (((w >> 8) & mask00FF) | bit0100) - d + hi = (hi & (((hi & bit0100) >> 8) * 0xff)) << 8 + binary.LittleEndian.PutUint64(row, lo|hi) + di += stride + } + return + } + di := 0 + for range 8 { + row := dest[di : di+8] + _ = row[7] + row[0] = clipPixelAdd(row[0], a1) + row[1] = clipPixelAdd(row[1], a1) + row[2] = clipPixelAdd(row[2], a1) + row[3] = clipPixelAdd(row[3], a1) + row[4] = clipPixelAdd(row[4], a1) + row[5] = clipPixelAdd(row[5], a1) + row[6] = clipPixelAdd(row[6], a1) + row[7] = clipPixelAdd(row[7], a1) + di += stride + } +} diff --git a/internal/vp9/dsp/idct8_arm64_simd.go b/internal/vp9/dsp/idct8_arm64_simd.go new file mode 100644 index 0000000..6c50d63 --- /dev/null +++ b/internal/vp9/dsp/idct8_arm64_simd.go @@ -0,0 +1,152 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/idct8_arm64_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package dsp + +import ( + "encoding/binary" + "simd/archsimd" + + "github.com/go-avkit/vpx/internal/pixel" +) + +var ( + vCospi4_64 = archsimd.BroadcastInt16x8(int16(cospi4_64)) + vNegCospi4_64 = archsimd.BroadcastInt16x8(int16(-cospi4_64)) + vCospi8_64 = archsimd.BroadcastInt16x8(int16(cospi8_64)) + vNegCospi8_64 = archsimd.BroadcastInt16x8(int16(-cospi8_64)) + vCospi12_64 = archsimd.BroadcastInt16x8(int16(cospi12_64)) + vCospi16_64 = archsimd.BroadcastInt16x8(int16(cospi16_64)) + vCospi20_64 = archsimd.BroadcastInt16x8(int16(cospi20_64)) + vNegCospi20_64 = archsimd.BroadcastInt16x8(int16(-cospi20_64)) + vCospi24_64 = archsimd.BroadcastInt16x8(int16(cospi24_64)) + vCospi28_64 = archsimd.BroadcastInt16x8(int16(cospi28_64)) + idctRight5 = archsimd.BroadcastInt16x8(-5) + idctRight4 = archsimd.BroadcastInt16x8(-4) + idctOne16 = archsimd.BroadcastInt16x8(1) +) + +// Eight-line layout follows goav1's int16 transform pipeline; VP9's +// rotations and wrapping stages remain distinct from AV1's saturation. +func idct8Rotate16(a, b, ka, kb archsimd.Int16x8) archsimd.Int16x8 { + lo := pixel.RoundTransform4(a.MulWidenLo(ka).Add(b.MulWidenLo(kb))).TruncToInt16().ToBits().ReshapeToUint64s() + hi := pixel.RoundTransform4(a.HiToLo().MulWidenLo(ka).Add(b.HiToLo().MulWidenLo(kb))).TruncToInt16().ToBits().ReshapeToUint64s() + return lo.InterleaveLo(hi).ReshapeToUint16s().BitsToInt16() +} + +// idct8PairCos16 computes (a*cospi16 + b*cospi16, a*cospi16 - b*cospi16) +// sharing the two widen-multiplies instead of computing them twice. +func idct8PairCos16(a, b archsimd.Int16x8) (archsimd.Int16x8, archsimd.Int16x8) { + k := vCospi16_64 + alo, blo := a.MulWidenLo(k), b.MulWidenLo(k) + ahi, bhi := a.HiToLo().MulWidenLo(k), b.HiToLo().MulWidenLo(k) + sumLo := pixel.RoundTransform4(alo.Add(blo)).TruncToInt16().ToBits().ReshapeToUint64s() + sumHi := pixel.RoundTransform4(ahi.Add(bhi)).TruncToInt16().ToBits().ReshapeToUint64s() + diffLo := pixel.RoundTransform4(alo.Sub(blo)).TruncToInt16().ToBits().ReshapeToUint64s() + diffHi := pixel.RoundTransform4(ahi.Sub(bhi)).TruncToInt16().ToBits().ReshapeToUint64s() + return sumLo.InterleaveLo(sumHi).ReshapeToUint16s().BitsToInt16(), + diffLo.InterleaveLo(diffHi).ReshapeToUint16s().BitsToInt16() +} + +func idct8Lines16(a0, a1, a2, a3, a4, a5, a6, a7 archsimd.Int16x8) (archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8) { + s4 := idct8Rotate16(a1, a7, vCospi28_64, vNegCospi4_64) + s7 := idct8Rotate16(a1, a7, vCospi4_64, vCospi28_64) + s5 := idct8Rotate16(a5, a3, vCospi12_64, vNegCospi20_64) + s6 := idct8Rotate16(a5, a3, vCospi20_64, vCospi12_64) + t0, t1 := idct8PairCos16(a0, a4) + t2 := idct8Rotate16(a2, a6, vCospi24_64, vNegCospi8_64) + t3 := idct8Rotate16(a2, a6, vCospi8_64, vCospi24_64) + t4, t5, t6, t7 := s4.Add(s5), s4.Sub(s5), s7.Sub(s6), s6.Add(s7) + u0, u1, u2, u3 := t0.Add(t3), t1.Add(t2), t1.Sub(t2), t0.Sub(t3) + u6, u5 := idct8PairCos16(t6, t5) + return u0.Add(t7), u1.Add(u6), u2.Add(u5), u3.Add(t4), u3.Sub(t4), u2.Sub(u5), u1.Sub(u6), u0.Sub(t7) +} + +// idct8Lines16Top4 transforms 8 rows whose high 4 lanes are all zero +// (rows==4 after transpose), avoiding all HiToLo() multiplies in pass 1. +// When columns 4..7 (a4..a7) are also zero (VP9 Idct8x8_12Add, EOB <= 12), +// it takes the 4x-fewer-multiply sparse path. +func idct8Lines16Top4(a0, a1, a2, a3, a4, a5, a6, a7 archsimd.Int16x8) (archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8, archsimd.Int16x8) { + var zero64 archsimd.Uint64x2 + if a4.ToBits().Or(a5.ToBits()).Or(a6.ToBits()).Or(a7.ToBits()).ReshapeToUint64s().GetElem(0) == 0 { + mulLo := func(a, k archsimd.Int16x8) archsimd.Int16x8 { + return pixel.RoundTransform4(a.MulWidenLo(k)).TruncToInt16().ToBits().ReshapeToUint64s().InterleaveLo(zero64).ReshapeToUint16s().BitsToInt16() + } + s4 := mulLo(a1, vCospi28_64) + s7 := mulLo(a1, vCospi4_64) + s5 := mulLo(a3, vNegCospi20_64) + s6 := mulLo(a3, vCospi12_64) + t0 := mulLo(a0, vCospi16_64) + t2 := mulLo(a2, vCospi24_64) + t3 := mulLo(a2, vCospi8_64) + t4, t5, t6, t7 := s4.Add(s5), s4.Sub(s5), s7.Sub(s6), s6.Add(s7) + u0, u1, u2, u3 := t0.Add(t3), t0.Add(t2), t0.Sub(t2), t0.Sub(t3) + alo, blo := t6.MulWidenLo(vCospi16_64), t5.MulWidenLo(vCospi16_64) + u6 := pixel.RoundTransform4(alo.Add(blo)).TruncToInt16().ToBits().ReshapeToUint64s().InterleaveLo(zero64).ReshapeToUint16s().BitsToInt16() + u5 := pixel.RoundTransform4(alo.Sub(blo)).TruncToInt16().ToBits().ReshapeToUint64s().InterleaveLo(zero64).ReshapeToUint16s().BitsToInt16() + return u0.Add(t7), u1.Add(u6), u2.Add(u5), u3.Add(t4), u3.Sub(t4), u2.Sub(u5), u1.Sub(u6), u0.Sub(t7) + } + rotLo := func(a, b, ka, kb archsimd.Int16x8) archsimd.Int16x8 { + return pixel.RoundTransform4(a.MulWidenLo(ka).Add(b.MulWidenLo(kb))).TruncToInt16().ToBits().ReshapeToUint64s().InterleaveLo(zero64).ReshapeToUint16s().BitsToInt16() + } + pairCos16Lo := func(a, b archsimd.Int16x8) (archsimd.Int16x8, archsimd.Int16x8) { + alo, blo := a.MulWidenLo(vCospi16_64), b.MulWidenLo(vCospi16_64) + sum := pixel.RoundTransform4(alo.Add(blo)).TruncToInt16().ToBits().ReshapeToUint64s().InterleaveLo(zero64).ReshapeToUint16s().BitsToInt16() + diff := pixel.RoundTransform4(alo.Sub(blo)).TruncToInt16().ToBits().ReshapeToUint64s().InterleaveLo(zero64).ReshapeToUint16s().BitsToInt16() + return sum, diff + } + s4 := rotLo(a1, a7, vCospi28_64, vNegCospi4_64) + s7 := rotLo(a1, a7, vCospi4_64, vCospi28_64) + s5 := rotLo(a5, a3, vCospi12_64, vNegCospi20_64) + s6 := rotLo(a5, a3, vCospi20_64, vCospi12_64) + t0, t1 := pairCos16Lo(a0, a4) + t2 := rotLo(a2, a6, vCospi24_64, vNegCospi8_64) + t3 := rotLo(a2, a6, vCospi8_64, vCospi24_64) + t4, t5, t6, t7 := s4.Add(s5), s4.Sub(s5), s7.Sub(s6), s6.Add(s7) + u0, u1, u2, u3 := t0.Add(t3), t1.Add(t2), t1.Sub(t2), t0.Sub(t3) + u6, u5 := pairCos16Lo(t6, t5) + return u0.Add(t7), u1.Add(u6), u2.Add(u5), u3.Add(t4), u3.Sub(t4), u2.Sub(u5), u1.Sub(u6), u0.Sub(t7) +} + +func idct8Store16(dst []byte, v archsimd.Int16x8) { + _ = dst[7] + // Split the rounding bit so +16 never overflows signed int16. + v = v.Shift(idctRight5).Add(v.Shift(idctRight4).And(idctOne16)) + p := archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(dst)).ReshapeToUint8s().ExtendLo8ToUint16().BitsToInt16() + binary.LittleEndian.PutUint64(dst, v.Add(p).SaturateToUint8().ReshapeToUint64s().GetElem(0)) +} +func inverseDCT8ARM(input []int16, dst []byte, stride, rows int) bool { + if (rows != 4 && rows != 8) || len(input) < 8*rows || stride < 8 || len(dst) < 7*stride+8 { + return false + } + a0, a1, a2, a3 := archsimd.LoadInt16x8(input), archsimd.LoadInt16x8(input[8:]), archsimd.LoadInt16x8(input[16:]), archsimd.LoadInt16x8(input[24:]) + var a4, a5, a6, a7 archsimd.Int16x8 + if rows == 8 { + a4, a5, a6, a7 = archsimd.LoadInt16x8(input[32:]), archsimd.LoadInt16x8(input[40:]), archsimd.LoadInt16x8(input[48:]), archsimd.LoadInt16x8(input[56:]) + a0, a1, a2, a3, a4, a5, a6, a7 = pixel.Transpose8Int16(a0, a1, a2, a3, a4, a5, a6, a7) + a0, a1, a2, a3, a4, a5, a6, a7 = idct8Lines16(a0, a1, a2, a3, a4, a5, a6, a7) + } else { + a0, a1, a2, a3, a4, a5, a6, a7 = pixel.Transpose8Int16(a0, a1, a2, a3, a4, a5, a6, a7) + a0, a1, a2, a3, a4, a5, a6, a7 = idct8Lines16Top4(a0, a1, a2, a3, a4, a5, a6, a7) + } + a0, a1, a2, a3, a4, a5, a6, a7 = pixel.Transpose8Int16(a0, a1, a2, a3, a4, a5, a6, a7) + a0, a1, a2, a3, a4, a5, a6, a7 = idct8Lines16(a0, a1, a2, a3, a4, a5, a6, a7) + idct8Store16(dst, a0) + idct8Store16(dst[stride:], a1) + idct8Store16(dst[2*stride:], a2) + idct8Store16(dst[3*stride:], a3) + idct8Store16(dst[4*stride:], a4) + idct8Store16(dst[5*stride:], a5) + idct8Store16(dst[6*stride:], a6) + idct8Store16(dst[7*stride:], a7) + return true +} diff --git a/internal/vp9/dsp/idct_core_simd.go b/internal/vp9/dsp/idct_core_simd.go new file mode 100644 index 0000000..d5e5afb --- /dev/null +++ b/internal/vp9/dsp/idct_core_simd.go @@ -0,0 +1,587 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/idct_core_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "simd/archsimd" +) + +func inverseDCT4Go(input []int16, dst []byte, stride, rows int) bool { + if !pixel.Enabled || len(input) < 4*rows || stride < 4 || len(dst) < 3*stride+4 { + return false + } + row := 0 + var input0, input1, input2, input3 archsimd.Int32x4 + input0, input1, input2, input3 = pixel.Transpose4(pixel.Load4(input[(row+0)*4+0:]), pixel.Load4(input[(row+1)*4+0:]), pixel.Load4(input[(row+2)*4+0:]), pixel.Load4(input[(row+3)*4+0:])) + var output0, output1, output2, output3 archsimd.Int32x4 + { + var step0, step1, step2, step3 archsimd.Int32x4 + in0 := input0 + in1 := input1 + in2 := input2 + in3 := input3 + temp1 := ((in0).Add(in2)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 := ((in0).Sub(in2)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step0 = vecRound(temp1) + step1 = vecRound(temp2) + temp1 = pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi24_64), (in3).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi8_64), (in3).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step2 = vecRound(temp1) + step3 = vecRound(temp2) + output0 = vecWrap((step0).Add(step3)) + output1 = vecWrap((step1).Add(step2)) + output2 = vecWrap((step1).Sub(step2)) + output3 = vecWrap((step0).Sub(step3)) + } + input0, input1, input2, input3 = pixel.Transpose4(output0, output1, output2, output3) + col := 0 + { + var step0, step1, step2, step3 archsimd.Int32x4 + in0 := input0 + in1 := input1 + in2 := input2 + in3 := input3 + temp1 := ((in0).Add(in2)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 := ((in0).Sub(in2)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step0 = vecRound(temp1) + step1 = vecRound(temp2) + temp1 = pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi24_64), (in3).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi8_64), (in3).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step2 = vecRound(temp1) + step3 = vecRound(temp2) + output0 = vecWrap((step0).Add(step3)) + output1 = vecWrap((step1).Add(step2)) + output2 = vecWrap((step1).Sub(step2)) + output3 = vecWrap((step0).Sub(step3)) + } + pixel.StorePixels4(dst[0*stride+col:], output0.Add(archsimd.BroadcastInt32x4(8)).ShiftAllRight(4).Add(pixel.LoadPixels4(dst[0*stride+col:]))) + pixel.StorePixels4(dst[1*stride+col:], output1.Add(archsimd.BroadcastInt32x4(8)).ShiftAllRight(4).Add(pixel.LoadPixels4(dst[1*stride+col:]))) + pixel.StorePixels4(dst[2*stride+col:], output2.Add(archsimd.BroadcastInt32x4(8)).ShiftAllRight(4).Add(pixel.LoadPixels4(dst[2*stride+col:]))) + pixel.StorePixels4(dst[3*stride+col:], output3.Add(archsimd.BroadcastInt32x4(8)).ShiftAllRight(4).Add(pixel.LoadPixels4(dst[3*stride+col:]))) + return true +} +func inverseDCT8Go(input []int16, dst []byte, stride, rows int) bool { + if !pixel.Enabled || len(input) < 8*rows || stride < 8 || len(dst) < 7*stride+8 { + return false + } + var tmp [64]int32 + for row := 0; row < rows; row += 4 { + var input0, input1, input2, input3, input4, input5, input6, input7 archsimd.Int32x4 + input0, input1, input2, input3 = pixel.Transpose4(pixel.Load4(input[(row+0)*8+0:]), pixel.Load4(input[(row+1)*8+0:]), pixel.Load4(input[(row+2)*8+0:]), pixel.Load4(input[(row+3)*8+0:])) + input4, input5, input6, input7 = pixel.Transpose4(pixel.Load4(input[(row+0)*8+4:]), pixel.Load4(input[(row+1)*8+4:]), pixel.Load4(input[(row+2)*8+4:]), pixel.Load4(input[(row+3)*8+4:])) + var output0, output1, output2, output3, output4, output5, output6, output7 archsimd.Int32x4 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step20, step21, step22, step23, step24, step25, step26, step27 archsimd.Int32x4 + in0 := input0 + in1 := input1 + in2 := input2 + in3 := input3 + in4 := input4 + in5 := input5 + in6 := input6 + in7 := input7 + step10 = vecWrap(in0) + step12 = vecWrap(in4) + step11 = vecWrap(in2) + step13 = vecWrap(in6) + temp1 := pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi28_64), (in7).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 := pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi4_64), (in7).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step14 = vecWrap(vecRound(temp1)) + step17 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(in5, archsimd.BroadcastInt32x4(cospi12_64), (in3).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(in5, archsimd.BroadcastInt32x4(cospi20_64), (in3).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + temp1 = ((step10).Add(step12)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step10).Sub(step12)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step20 = vecWrap(vecRound(temp1)) + step21 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step11, archsimd.BroadcastInt32x4(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(step11, archsimd.BroadcastInt32x4(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step22 = vecWrap(vecRound(temp1)) + step23 = vecWrap(vecRound(temp2)) + step24 = vecWrap((step14).Add(step15)) + step25 = vecWrap((step14).Sub(step15)) + step26 = vecWrap((step17).Sub(step16)) + step27 = vecWrap((step16).Add(step17)) + step10 = vecWrap((step20).Add(step23)) + step11 = vecWrap((step21).Add(step22)) + step12 = vecWrap((step21).Sub(step22)) + step13 = vecWrap((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + step17 = step27 + output0 = vecWrap((step10).Add(step17)) + output1 = vecWrap((step11).Add(step16)) + output2 = vecWrap((step12).Add(step15)) + output3 = vecWrap((step13).Add(step14)) + output4 = vecWrap((step13).Sub(step14)) + output5 = vecWrap((step12).Sub(step15)) + output6 = vecWrap((step11).Sub(step16)) + output7 = vecWrap((step10).Sub(step17)) + } + { + a, b, c, d := pixel.Transpose4(output0, output1, output2, output3) + a.Store(tmp[(row+0)*8+0:]) + b.Store(tmp[(row+1)*8+0:]) + c.Store(tmp[(row+2)*8+0:]) + d.Store(tmp[(row+3)*8+0:]) + } + { + a, b, c, d := pixel.Transpose4(output4, output5, output6, output7) + a.Store(tmp[(row+0)*8+4:]) + b.Store(tmp[(row+1)*8+4:]) + c.Store(tmp[(row+2)*8+4:]) + d.Store(tmp[(row+3)*8+4:]) + } + } + for col := 0; col < 8; col += 4 { + input0 := archsimd.LoadInt32x4(tmp[0*8+col:]) + input1 := archsimd.LoadInt32x4(tmp[1*8+col:]) + input2 := archsimd.LoadInt32x4(tmp[2*8+col:]) + input3 := archsimd.LoadInt32x4(tmp[3*8+col:]) + input4 := archsimd.LoadInt32x4(tmp[4*8+col:]) + input5 := archsimd.LoadInt32x4(tmp[5*8+col:]) + input6 := archsimd.LoadInt32x4(tmp[6*8+col:]) + input7 := archsimd.LoadInt32x4(tmp[7*8+col:]) + var output0, output1, output2, output3, output4, output5, output6, output7 archsimd.Int32x4 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step20, step21, step22, step23, step24, step25, step26, step27 archsimd.Int32x4 + in0 := input0 + in1 := input1 + in2 := input2 + in3 := input3 + in4 := input4 + in5 := input5 + in6 := input6 + in7 := input7 + step10 = vecWrap(in0) + step12 = vecWrap(in4) + step11 = vecWrap(in2) + step13 = vecWrap(in6) + temp1 := pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi28_64), (in7).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 := pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi4_64), (in7).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step14 = vecWrap(vecRound(temp1)) + step17 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(in5, archsimd.BroadcastInt32x4(cospi12_64), (in3).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(in5, archsimd.BroadcastInt32x4(cospi20_64), (in3).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + temp1 = ((step10).Add(step12)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step10).Sub(step12)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step20 = vecWrap(vecRound(temp1)) + step21 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step11, archsimd.BroadcastInt32x4(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(step11, archsimd.BroadcastInt32x4(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step22 = vecWrap(vecRound(temp1)) + step23 = vecWrap(vecRound(temp2)) + step24 = vecWrap((step14).Add(step15)) + step25 = vecWrap((step14).Sub(step15)) + step26 = vecWrap((step17).Sub(step16)) + step27 = vecWrap((step16).Add(step17)) + step10 = vecWrap((step20).Add(step23)) + step11 = vecWrap((step21).Add(step22)) + step12 = vecWrap((step21).Sub(step22)) + step13 = vecWrap((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + step17 = step27 + output0 = vecWrap((step10).Add(step17)) + output1 = vecWrap((step11).Add(step16)) + output2 = vecWrap((step12).Add(step15)) + output3 = vecWrap((step13).Add(step14)) + output4 = vecWrap((step13).Sub(step14)) + output5 = vecWrap((step12).Sub(step15)) + output6 = vecWrap((step11).Sub(step16)) + output7 = vecWrap((step10).Sub(step17)) + } + pixel.StorePixels4(dst[0*stride+col:], output0.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[0*stride+col:]))) + pixel.StorePixels4(dst[1*stride+col:], output1.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[1*stride+col:]))) + pixel.StorePixels4(dst[2*stride+col:], output2.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[2*stride+col:]))) + pixel.StorePixels4(dst[3*stride+col:], output3.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[3*stride+col:]))) + pixel.StorePixels4(dst[4*stride+col:], output4.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[4*stride+col:]))) + pixel.StorePixels4(dst[5*stride+col:], output5.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[5*stride+col:]))) + pixel.StorePixels4(dst[6*stride+col:], output6.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[6*stride+col:]))) + pixel.StorePixels4(dst[7*stride+col:], output7.Add(archsimd.BroadcastInt32x4(16)).ShiftAllRight(5).Add(pixel.LoadPixels4(dst[7*stride+col:]))) + } + return true +} +func inverseDCT16Go(input []int16, dst []byte, stride, rows int) bool { + if !pixel.Enabled || len(input) < 16*rows || stride < 16 || len(dst) < 15*stride+16 { + return false + } + var tmp [256]int32 + for row := 0; row < rows; row += 4 { + var input0, input1, input2, input3, input4, input5, input6, input7, input8, input9, input10, input11, input12, input13, input14, input15 archsimd.Int32x4 + input0, input1, input2, input3 = pixel.Transpose4(pixel.Load4(input[(row+0)*16+0:]), pixel.Load4(input[(row+1)*16+0:]), pixel.Load4(input[(row+2)*16+0:]), pixel.Load4(input[(row+3)*16+0:])) + input4, input5, input6, input7 = pixel.Transpose4(pixel.Load4(input[(row+0)*16+4:]), pixel.Load4(input[(row+1)*16+4:]), pixel.Load4(input[(row+2)*16+4:]), pixel.Load4(input[(row+3)*16+4:])) + input8, input9, input10, input11 = pixel.Transpose4(pixel.Load4(input[(row+0)*16+8:]), pixel.Load4(input[(row+1)*16+8:]), pixel.Load4(input[(row+2)*16+8:]), pixel.Load4(input[(row+3)*16+8:])) + input12, input13, input14, input15 = pixel.Transpose4(pixel.Load4(input[(row+0)*16+12:]), pixel.Load4(input[(row+1)*16+12:]), pixel.Load4(input[(row+2)*16+12:]), pixel.Load4(input[(row+3)*16+12:])) + var output0, output1, output2, output3, output4, output5, output6, output7, output8, output9, output10, output11, output12, output13, output14, output15 archsimd.Int32x4 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step18, step19, step110, step111, step112, step113, step114, step115, step20, step21, step22, step23, step24, step25, step26, step27, step28, step29, step210, step211, step212, step213, step214, step215 archsimd.Int32x4 + step10 = input0 + step11 = input8 + step12 = input4 + step13 = input12 + step14 = input2 + step15 = input10 + step16 = input6 + step17 = input14 + step18 = input1 + step19 = input9 + step110 = input5 + step111 = input13 + step112 = input3 + step113 = input11 + step114 = input7 + step115 = input15 + step20 = step10 + step21 = step11 + step22 = step12 + step23 = step13 + step24 = step14 + step25 = step15 + step26 = step16 + step27 = step17 + temp1 := pixel.MulAdd4(step18, archsimd.BroadcastInt32x4(cospi30_64), (step115).Mul(archsimd.BroadcastInt32x4(-cospi2_64))) + temp2 := pixel.MulAdd4(step18, archsimd.BroadcastInt32x4(cospi2_64), (step115).Mul(archsimd.BroadcastInt32x4(cospi30_64))) + step28 = vecWrap(vecRound(temp1)) + step215 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step19, archsimd.BroadcastInt32x4(cospi14_64), (step114).Mul(archsimd.BroadcastInt32x4(-cospi18_64))) + temp2 = pixel.MulAdd4(step19, archsimd.BroadcastInt32x4(cospi18_64), (step114).Mul(archsimd.BroadcastInt32x4(cospi14_64))) + step29 = vecWrap(vecRound(temp1)) + step214 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step110, archsimd.BroadcastInt32x4(cospi22_64), (step113).Mul(archsimd.BroadcastInt32x4(-cospi10_64))) + temp2 = pixel.MulAdd4(step110, archsimd.BroadcastInt32x4(cospi10_64), (step113).Mul(archsimd.BroadcastInt32x4(cospi22_64))) + step210 = vecWrap(vecRound(temp1)) + step213 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step111, archsimd.BroadcastInt32x4(cospi6_64), (step112).Mul(archsimd.BroadcastInt32x4(-cospi26_64))) + temp2 = pixel.MulAdd4(step111, archsimd.BroadcastInt32x4(cospi26_64), (step112).Mul(archsimd.BroadcastInt32x4(cospi6_64))) + step211 = vecWrap(vecRound(temp1)) + step212 = vecWrap(vecRound(temp2)) + step10 = step20 + step11 = step21 + step12 = step22 + step13 = step23 + temp1 = pixel.MulAdd4(step24, archsimd.BroadcastInt32x4(cospi28_64), (step27).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 = pixel.MulAdd4(step24, archsimd.BroadcastInt32x4(cospi4_64), (step27).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step14 = vecWrap(vecRound(temp1)) + step17 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step25, archsimd.BroadcastInt32x4(cospi12_64), (step26).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(step25, archsimd.BroadcastInt32x4(cospi20_64), (step26).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + step18 = vecWrap((step28).Add(step29)) + step19 = vecWrap((step28).Sub(step29)) + step110 = vecWrap((step211).Sub(step210)) + step111 = vecWrap((step210).Add(step211)) + step112 = vecWrap((step212).Add(step213)) + step113 = vecWrap((step212).Sub(step213)) + step114 = vecWrap((step215).Sub(step214)) + step115 = vecWrap((step214).Add(step215)) + temp1 = ((step10).Add(step11)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step10).Sub(step11)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step20 = vecWrap(vecRound(temp1)) + step21 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step12, archsimd.BroadcastInt32x4(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(step12, archsimd.BroadcastInt32x4(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step22 = vecWrap(vecRound(temp1)) + step23 = vecWrap(vecRound(temp2)) + step24 = vecWrap((step14).Add(step15)) + step25 = vecWrap((step14).Sub(step15)) + step26 = vecWrap((step17).Sub(step16)) + step27 = vecWrap((step16).Add(step17)) + step28 = step18 + step215 = step115 + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step19), archsimd.BroadcastInt32x4(cospi8_64), (step114).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + temp2 = pixel.MulAdd4(step19, archsimd.BroadcastInt32x4(cospi24_64), (step114).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + step29 = vecWrap(vecRound(temp1)) + step214 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step110), archsimd.BroadcastInt32x4(cospi24_64), (step113).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step110), archsimd.BroadcastInt32x4(cospi8_64), (step113).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step210 = vecWrap(vecRound(temp1)) + step213 = vecWrap(vecRound(temp2)) + step211 = step111 + step212 = step112 + step10 = vecWrap((step20).Add(step23)) + step11 = vecWrap((step21).Add(step22)) + step12 = vecWrap((step21).Sub(step22)) + step13 = vecWrap((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + step17 = step27 + step18 = vecWrap((step28).Add(step211)) + step19 = vecWrap((step29).Add(step210)) + step110 = vecWrap((step29).Sub(step210)) + step111 = vecWrap((step28).Sub(step211)) + step112 = vecWrap((step215).Sub(step212)) + step113 = vecWrap((step214).Sub(step213)) + step114 = vecWrap((step213).Add(step214)) + step115 = vecWrap((step212).Add(step215)) + step20 = vecWrap((step10).Add(step17)) + step21 = vecWrap((step11).Add(step16)) + step22 = vecWrap((step12).Add(step15)) + step23 = vecWrap((step13).Add(step14)) + step24 = vecWrap((step13).Sub(step14)) + step25 = vecWrap((step12).Sub(step15)) + step26 = vecWrap((step11).Sub(step16)) + step27 = vecWrap((step10).Sub(step17)) + step28 = step18 + step29 = step19 + temp1 = ((step113).Sub(step110)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step110).Add(step113)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step210 = vecWrap(vecRound(temp1)) + step213 = vecWrap(vecRound(temp2)) + temp1 = ((step112).Sub(step111)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step111).Add(step112)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step211 = vecWrap(vecRound(temp1)) + step212 = vecWrap(vecRound(temp2)) + step214 = step114 + step215 = step115 + output0 = vecWrap((step20).Add(step215)) + output1 = vecWrap((step21).Add(step214)) + output2 = vecWrap((step22).Add(step213)) + output3 = vecWrap((step23).Add(step212)) + output4 = vecWrap((step24).Add(step211)) + output5 = vecWrap((step25).Add(step210)) + output6 = vecWrap((step26).Add(step29)) + output7 = vecWrap((step27).Add(step28)) + output8 = vecWrap((step27).Sub(step28)) + output9 = vecWrap((step26).Sub(step29)) + output10 = vecWrap((step25).Sub(step210)) + output11 = vecWrap((step24).Sub(step211)) + output12 = vecWrap((step23).Sub(step212)) + output13 = vecWrap((step22).Sub(step213)) + output14 = vecWrap((step21).Sub(step214)) + output15 = vecWrap((step20).Sub(step215)) + } + { + a, b, c, d := pixel.Transpose4(output0, output1, output2, output3) + a.Store(tmp[(row+0)*16+0:]) + b.Store(tmp[(row+1)*16+0:]) + c.Store(tmp[(row+2)*16+0:]) + d.Store(tmp[(row+3)*16+0:]) + } + { + a, b, c, d := pixel.Transpose4(output4, output5, output6, output7) + a.Store(tmp[(row+0)*16+4:]) + b.Store(tmp[(row+1)*16+4:]) + c.Store(tmp[(row+2)*16+4:]) + d.Store(tmp[(row+3)*16+4:]) + } + { + a, b, c, d := pixel.Transpose4(output8, output9, output10, output11) + a.Store(tmp[(row+0)*16+8:]) + b.Store(tmp[(row+1)*16+8:]) + c.Store(tmp[(row+2)*16+8:]) + d.Store(tmp[(row+3)*16+8:]) + } + { + a, b, c, d := pixel.Transpose4(output12, output13, output14, output15) + a.Store(tmp[(row+0)*16+12:]) + b.Store(tmp[(row+1)*16+12:]) + c.Store(tmp[(row+2)*16+12:]) + d.Store(tmp[(row+3)*16+12:]) + } + } + for col := 0; col < 16; col += 4 { + input0 := archsimd.LoadInt32x4(tmp[0*16+col:]) + input1 := archsimd.LoadInt32x4(tmp[1*16+col:]) + input2 := archsimd.LoadInt32x4(tmp[2*16+col:]) + input3 := archsimd.LoadInt32x4(tmp[3*16+col:]) + input4 := archsimd.LoadInt32x4(tmp[4*16+col:]) + input5 := archsimd.LoadInt32x4(tmp[5*16+col:]) + input6 := archsimd.LoadInt32x4(tmp[6*16+col:]) + input7 := archsimd.LoadInt32x4(tmp[7*16+col:]) + input8 := archsimd.LoadInt32x4(tmp[8*16+col:]) + input9 := archsimd.LoadInt32x4(tmp[9*16+col:]) + input10 := archsimd.LoadInt32x4(tmp[10*16+col:]) + input11 := archsimd.LoadInt32x4(tmp[11*16+col:]) + input12 := archsimd.LoadInt32x4(tmp[12*16+col:]) + input13 := archsimd.LoadInt32x4(tmp[13*16+col:]) + input14 := archsimd.LoadInt32x4(tmp[14*16+col:]) + input15 := archsimd.LoadInt32x4(tmp[15*16+col:]) + var output0, output1, output2, output3, output4, output5, output6, output7, output8, output9, output10, output11, output12, output13, output14, output15 archsimd.Int32x4 + { + var step10, step11, step12, step13, step14, step15, step16, step17, step18, step19, step110, step111, step112, step113, step114, step115, step20, step21, step22, step23, step24, step25, step26, step27, step28, step29, step210, step211, step212, step213, step214, step215 archsimd.Int32x4 + step10 = input0 + step11 = input8 + step12 = input4 + step13 = input12 + step14 = input2 + step15 = input10 + step16 = input6 + step17 = input14 + step18 = input1 + step19 = input9 + step110 = input5 + step111 = input13 + step112 = input3 + step113 = input11 + step114 = input7 + step115 = input15 + step20 = step10 + step21 = step11 + step22 = step12 + step23 = step13 + step24 = step14 + step25 = step15 + step26 = step16 + step27 = step17 + temp1 := pixel.MulAdd4(step18, archsimd.BroadcastInt32x4(cospi30_64), (step115).Mul(archsimd.BroadcastInt32x4(-cospi2_64))) + temp2 := pixel.MulAdd4(step18, archsimd.BroadcastInt32x4(cospi2_64), (step115).Mul(archsimd.BroadcastInt32x4(cospi30_64))) + step28 = vecWrap(vecRound(temp1)) + step215 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step19, archsimd.BroadcastInt32x4(cospi14_64), (step114).Mul(archsimd.BroadcastInt32x4(-cospi18_64))) + temp2 = pixel.MulAdd4(step19, archsimd.BroadcastInt32x4(cospi18_64), (step114).Mul(archsimd.BroadcastInt32x4(cospi14_64))) + step29 = vecWrap(vecRound(temp1)) + step214 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step110, archsimd.BroadcastInt32x4(cospi22_64), (step113).Mul(archsimd.BroadcastInt32x4(-cospi10_64))) + temp2 = pixel.MulAdd4(step110, archsimd.BroadcastInt32x4(cospi10_64), (step113).Mul(archsimd.BroadcastInt32x4(cospi22_64))) + step210 = vecWrap(vecRound(temp1)) + step213 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step111, archsimd.BroadcastInt32x4(cospi6_64), (step112).Mul(archsimd.BroadcastInt32x4(-cospi26_64))) + temp2 = pixel.MulAdd4(step111, archsimd.BroadcastInt32x4(cospi26_64), (step112).Mul(archsimd.BroadcastInt32x4(cospi6_64))) + step211 = vecWrap(vecRound(temp1)) + step212 = vecWrap(vecRound(temp2)) + step10 = step20 + step11 = step21 + step12 = step22 + step13 = step23 + temp1 = pixel.MulAdd4(step24, archsimd.BroadcastInt32x4(cospi28_64), (step27).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 = pixel.MulAdd4(step24, archsimd.BroadcastInt32x4(cospi4_64), (step27).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step14 = vecWrap(vecRound(temp1)) + step17 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step25, archsimd.BroadcastInt32x4(cospi12_64), (step26).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(step25, archsimd.BroadcastInt32x4(cospi20_64), (step26).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + step18 = vecWrap((step28).Add(step29)) + step19 = vecWrap((step28).Sub(step29)) + step110 = vecWrap((step211).Sub(step210)) + step111 = vecWrap((step210).Add(step211)) + step112 = vecWrap((step212).Add(step213)) + step113 = vecWrap((step212).Sub(step213)) + step114 = vecWrap((step215).Sub(step214)) + step115 = vecWrap((step214).Add(step215)) + temp1 = ((step10).Add(step11)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step10).Sub(step11)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step20 = vecWrap(vecRound(temp1)) + step21 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step12, archsimd.BroadcastInt32x4(cospi24_64), (step13).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(step12, archsimd.BroadcastInt32x4(cospi8_64), (step13).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step22 = vecWrap(vecRound(temp1)) + step23 = vecWrap(vecRound(temp2)) + step24 = vecWrap((step14).Add(step15)) + step25 = vecWrap((step14).Sub(step15)) + step26 = vecWrap((step17).Sub(step16)) + step27 = vecWrap((step16).Add(step17)) + step28 = step18 + step215 = step115 + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step19), archsimd.BroadcastInt32x4(cospi8_64), (step114).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + temp2 = pixel.MulAdd4(step19, archsimd.BroadcastInt32x4(cospi24_64), (step114).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + step29 = vecWrap(vecRound(temp1)) + step214 = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step110), archsimd.BroadcastInt32x4(cospi24_64), (step113).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step110), archsimd.BroadcastInt32x4(cospi8_64), (step113).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step210 = vecWrap(vecRound(temp1)) + step213 = vecWrap(vecRound(temp2)) + step211 = step111 + step212 = step112 + step10 = vecWrap((step20).Add(step23)) + step11 = vecWrap((step21).Add(step22)) + step12 = vecWrap((step21).Sub(step22)) + step13 = vecWrap((step20).Sub(step23)) + step14 = step24 + temp1 = ((step26).Sub(step25)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step25).Add(step26)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step15 = vecWrap(vecRound(temp1)) + step16 = vecWrap(vecRound(temp2)) + step17 = step27 + step18 = vecWrap((step28).Add(step211)) + step19 = vecWrap((step29).Add(step210)) + step110 = vecWrap((step29).Sub(step210)) + step111 = vecWrap((step28).Sub(step211)) + step112 = vecWrap((step215).Sub(step212)) + step113 = vecWrap((step214).Sub(step213)) + step114 = vecWrap((step213).Add(step214)) + step115 = vecWrap((step212).Add(step215)) + step20 = vecWrap((step10).Add(step17)) + step21 = vecWrap((step11).Add(step16)) + step22 = vecWrap((step12).Add(step15)) + step23 = vecWrap((step13).Add(step14)) + step24 = vecWrap((step13).Sub(step14)) + step25 = vecWrap((step12).Sub(step15)) + step26 = vecWrap((step11).Sub(step16)) + step27 = vecWrap((step10).Sub(step17)) + step28 = step18 + step29 = step19 + temp1 = ((step113).Sub(step110)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step110).Add(step113)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step210 = vecWrap(vecRound(temp1)) + step213 = vecWrap(vecRound(temp2)) + temp1 = ((step112).Sub(step111)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step111).Add(step112)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step211 = vecWrap(vecRound(temp1)) + step212 = vecWrap(vecRound(temp2)) + step214 = step114 + step215 = step115 + output0 = vecWrap((step20).Add(step215)) + output1 = vecWrap((step21).Add(step214)) + output2 = vecWrap((step22).Add(step213)) + output3 = vecWrap((step23).Add(step212)) + output4 = vecWrap((step24).Add(step211)) + output5 = vecWrap((step25).Add(step210)) + output6 = vecWrap((step26).Add(step29)) + output7 = vecWrap((step27).Add(step28)) + output8 = vecWrap((step27).Sub(step28)) + output9 = vecWrap((step26).Sub(step29)) + output10 = vecWrap((step25).Sub(step210)) + output11 = vecWrap((step24).Sub(step211)) + output12 = vecWrap((step23).Sub(step212)) + output13 = vecWrap((step22).Sub(step213)) + output14 = vecWrap((step21).Sub(step214)) + output15 = vecWrap((step20).Sub(step215)) + } + pixel.StorePixels4(dst[0*stride+col:], output0.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[0*stride+col:]))) + pixel.StorePixels4(dst[1*stride+col:], output1.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[1*stride+col:]))) + pixel.StorePixels4(dst[2*stride+col:], output2.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[2*stride+col:]))) + pixel.StorePixels4(dst[3*stride+col:], output3.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[3*stride+col:]))) + pixel.StorePixels4(dst[4*stride+col:], output4.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[4*stride+col:]))) + pixel.StorePixels4(dst[5*stride+col:], output5.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[5*stride+col:]))) + pixel.StorePixels4(dst[6*stride+col:], output6.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[6*stride+col:]))) + pixel.StorePixels4(dst[7*stride+col:], output7.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[7*stride+col:]))) + pixel.StorePixels4(dst[8*stride+col:], output8.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[8*stride+col:]))) + pixel.StorePixels4(dst[9*stride+col:], output9.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[9*stride+col:]))) + pixel.StorePixels4(dst[10*stride+col:], output10.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[10*stride+col:]))) + pixel.StorePixels4(dst[11*stride+col:], output11.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[11*stride+col:]))) + pixel.StorePixels4(dst[12*stride+col:], output12.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[12*stride+col:]))) + pixel.StorePixels4(dst[13*stride+col:], output13.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[13*stride+col:]))) + pixel.StorePixels4(dst[14*stride+col:], output14.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[14*stride+col:]))) + pixel.StorePixels4(dst[15*stride+col:], output15.Add(archsimd.BroadcastInt32x4(32)).ShiftAllRight(6).Add(pixel.LoadPixels4(dst[15*stride+col:]))) + } + return true +} diff --git a/internal/vp9/dsp/idct_dispatch_other.go b/internal/vp9/dsp/idct_dispatch_other.go new file mode 100644 index 0000000..14a79f8 --- /dev/null +++ b/internal/vp9/dsp/idct_dispatch_other.go @@ -0,0 +1,188 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/idct_dispatch_other.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/pixel" + +// Shared Idct/Iwht/Iht dispatchers use Go SIMD when available and +// retain the independent scalar transforms for fallback builds. + +// Idct4x4_16Add applies the full 4x4 inverse DCT to a 16-coefficient +// block and adds the result onto dest. +func Idct4x4_16Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 4, 4, 0) { + return + } + + idct4x4_16AddScalar(input, dest, stride) +} + +// Idct4x4_1Add is the DC-only fast path for the 4x4 inverse DCT. +func Idct4x4_1Add(input []int16, dest []uint8, stride int) { + if pixel.Enabled { + v := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + v = int16(dctConstRoundShift(int64(v) * cospi16_64)) + pixel.AddConstant(dest, stride, dest, stride, 4, 4, int(roundPowerOfTwo(int32(v), 4))) + return + } + + idct4x4_1AddScalar(input, dest, stride) +} + +// Idct8x8_64Add applies the full 8x8 inverse DCT. +func Idct8x8_64Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 8, 8, 0) { + return + } + + idct8x8_64AddScalar(input, dest, stride) +} + +// Idct8x8_12Add is the sparse upper-left-4x4 fast path for the 8x8 +// inverse DCT. +func Idct8x8_12Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 8, 4, 0) { + return + } + + idct8x8_12AddScalar(input, dest, stride) +} + +// Idct8x8_1Add is the DC-only fast path for the 8x8 inverse DCT. +func Idct8x8_1Add(input []int16, dest []uint8, stride int) { + if pixel.Enabled { + v := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + v = int16(dctConstRoundShift(int64(v) * cospi16_64)) + pixel.AddConstant8x8InPlace(dest, stride, int(roundPowerOfTwo(int32(v), 5))) + return + } + + idct8x8_1AddScalar(input, dest, stride) +} + +// Idct16x16_256Add applies the full 16x16 inverse DCT. +func Idct16x16_256Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 16, 16, 0) { + return + } + + idct16x16_256AddScalar(input, dest, stride) +} + +// Idct16x16_38Add is the upper-left-8x8 sparse fast path. +func Idct16x16_38Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 16, 8, 0) { + return + } + + idct16x16_38AddScalar(input, dest, stride) +} + +// Idct16x16_10Add is the upper-left-4x4 sparse fast path. +func Idct16x16_10Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 16, 4, 0) { + return + } + + idct16x16_10AddScalar(input, dest, stride) +} + +// Idct16x16_1Add is the DC-only fast path for the 16x16 inverse DCT. +func Idct16x16_1Add(input []int16, dest []uint8, stride int) { + if pixel.Enabled { + v := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + v = int16(dctConstRoundShift(int64(v) * cospi16_64)) + pixel.AddConstant(dest, stride, dest, stride, 16, 16, int(roundPowerOfTwo(int32(v), 6))) + return + } + + idct16x16_1AddScalar(input, dest, stride) +} + +// Idct32x32_1024Add is the dense 32x32 inverse DCT. +func Idct32x32_1024Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 32, 32, 0) { + return + } + + idct32x32_1024AddScalar(input, dest, stride) +} + +// Idct32x32_135Add is the upper-left-16x16 sparse fast path. +func Idct32x32_135Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 32, 16, 0) { + return + } + + idct32x32_135AddScalar(input, dest, stride) +} + +// Idct32x32_34Add is the upper-left-8x8 sparse fast path. +func Idct32x32_34Add(input []int16, dest []uint8, stride int) { + if inverseTransformGo(input, dest, stride, 32, 8, 0) { + return + } + + idct32x32_34AddScalar(input, dest, stride) +} + +// Idct32x32_1Add is the DC-only fast path for the 32x32 inverse DCT. +func Idct32x32_1Add(input []int16, dest []uint8, stride int) { + if pixel.Enabled { + v := int16(dctConstRoundShift(int64(input[0]) * cospi16_64)) + v = int16(dctConstRoundShift(int64(v) * cospi16_64)) + pixel.AddConstant(dest, stride, dest, stride, 32, 32, int(roundPowerOfTwo(int32(v), 6))) + return + } + + idct32x32_1AddScalar(input, dest, stride) +} + +// Iwht4x4_16Add applies the inverse 4x4 Walsh-Hadamard (lossless). +func Iwht4x4_16Add(input []int16, dest []uint8, stride int) { + if !inverseWHTGo(input, dest, stride, false) { + iwht4x4_16AddScalar(input, dest, stride) + } +} + +// Iwht4x4_1Add is the DC-only fast path for the lossless 4x4 IWHT. +func Iwht4x4_1Add(input []int16, dest []uint8, stride int) { + if !inverseWHTGo(input, dest, stride, true) { + iwht4x4_1AddScalar(input, dest, stride) + } +} + +// Iht4x4_16Add dispatches the 2-D hybrid 4x4 inverse transform. +func Iht4x4_16Add(input []int16, dest []uint8, stride int, txType int) { + if txType >= 0 && txType <= 3 && inverseTransformGo(input, dest, stride, 4, 4, txType) { + return + } + + iht4x4_16AddScalar(input, dest, stride, txType) +} + +// Iht8x8_64Add dispatches the 2-D hybrid 8x8 inverse transform. +func Iht8x8_64Add(input []int16, dest []uint8, stride int, txType int) { + if txType >= 0 && txType <= 3 && inverseTransformGo(input, dest, stride, 8, 8, txType) { + return + } + + iht8x8_64AddScalar(input, dest, stride, txType) +} + +// Iht16x16_256Add dispatches the 2-D hybrid 16x16 inverse transform. +func Iht16x16_256Add(input []int16, dest []uint8, stride int, txType int) { + if txType >= 0 && txType <= 3 && inverseTransformGo(input, dest, stride, 16, 16, txType) { + return + } + + iht16x16_256AddScalar(input, dest, stride, txType) +} diff --git a/internal/vp9/dsp/intra_bridge.go b/internal/vp9/dsp/intra_bridge.go new file mode 100644 index 0000000..d62b5ee --- /dev/null +++ b/internal/vp9/dsp/intra_bridge.go @@ -0,0 +1,22 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/intra_bridge.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/pixel" + +// The SIMD bridge only accepts complete rows. Invalid windows retain the +// original predictor's partial-write/panic behavior. +func intraBridgeWindow(dst []byte, stride, bs int) bool { + return pixel.Enabled && stride >= bs && len(dst) >= bs && stride <= (len(dst)-bs)/(bs-1) +} +func intraBridgeDisjoint(dst []byte, stride, bs int, edge []byte, count int) bool { + return intraBridgeWindow(dst, stride, bs) && len(edge) >= count +} diff --git a/internal/vp9/dsp/intrapred.go b/internal/vp9/dsp/intrapred.go new file mode 100644 index 0000000..145a9d8 --- /dev/null +++ b/internal/vp9/dsp/intrapred.go @@ -0,0 +1,342 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/intrapred.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import "github.com/go-avkit/vpx/internal/pixel" + +// VP9 intra prediction kernels — DC / V / H / TM families and their DC +// fall-back variants (dc_128, dc_left, dc_top). Ported from libvpx +// v1.16.0 vpx_dsp/intrapred.c. Each predictor takes a caller-owned +// destination plane plus the row above and column to the left of the +// block; `above` is read at indices -1 .. bs (the [-1] entry is the +// top-left corner shared with `left`), `left` is read at indices +// 0 .. bs-1. Strides are in pixels. +// +// The 4x4/8x8/16x16/32x32 variants are explicit functions rather than a +// runtime-sized wrapper so the Go inliner and bounds-check elimination +// pass can specialize each size separately. + +func dcPredictor(dst []uint8, stride, bs int, above, left []uint8) { + sum := 0 + for i := range bs { + sum += int(above[i]) + sum += int(left[i]) + } + count := 2 * bs + expected := uint8((sum + (count >> 1)) / count) + fillBlockConstant(dst, stride, bs, expected) +} + +func dcLeftPredictor(dst []uint8, stride, bs int, above, left []uint8) { + _ = above + sum := 0 + for i := range bs { + sum += int(left[i]) + } + expected := uint8((sum + (bs >> 1)) / bs) + fillBlockConstant(dst, stride, bs, expected) +} + +func dcTopPredictor(dst []uint8, stride, bs int, above, left []uint8) { + _ = left + sum := 0 + for i := range bs { + sum += int(above[i]) + } + expected := uint8((sum + (bs >> 1)) / bs) + fillBlockConstant(dst, stride, bs, expected) +} + +func dc128Predictor(dst []uint8, stride, bs int, above, left []uint8) { + _ = above + _ = left + fillBlockConstant(dst, stride, bs, 128) +} + +func vPredictor(dst []uint8, stride, bs int, above, left []uint8) { + _ = left + for r := range bs { + copy(dst[r*stride:r*stride+bs], above[:bs]) + } +} + +func hPredictor4(dst []uint8, stride int, left []uint8) { + for r := range 4 { + row := dst[r*stride:] + _ = row[3] + v := left[r] + row[0], row[1], row[2], row[3] = v, v, v, v + } +} + +func hPredictor8(dst []uint8, stride int, left []uint8) { + for r := range 8 { + row := dst[r*stride:] + _ = row[7] + v := left[r] + row[0], row[1], row[2], row[3] = v, v, v, v + row[4], row[5], row[6], row[7] = v, v, v, v + } +} + +func hPredictor16(dst []uint8, stride int, left []uint8) { + for r := range 16 { + row := dst[r*stride:] + _ = row[15] + v := left[r] + row[0], row[1], row[2], row[3] = v, v, v, v + row[4], row[5], row[6], row[7] = v, v, v, v + row[8], row[9], row[10], row[11] = v, v, v, v + row[12], row[13], row[14], row[15] = v, v, v, v + } +} + +func hPredictor32(dst []uint8, stride int, left []uint8) { + for r := range 32 { + row := dst[r*stride:] + _ = row[31] + v := left[r] + row[0], row[1], row[2], row[3] = v, v, v, v + row[4], row[5], row[6], row[7] = v, v, v, v + row[8], row[9], row[10], row[11] = v, v, v, v + row[12], row[13], row[14], row[15] = v, v, v, v + row[16], row[17], row[18], row[19] = v, v, v, v + row[20], row[21], row[22], row[23] = v, v, v, v + row[24], row[25], row[26], row[27] = v, v, v, v + row[28], row[29], row[30], row[31] = v, v, v, v + } +} + +func fillBlockConstant(dst []uint8, stride, bs int, v uint8) { + row0 := dst[:bs] + for i := range row0 { + row0[i] = v + } + for r := 1; r < bs; r++ { + copy(dst[r*stride:r*stride+bs], row0) + } +} + +// tmPredictor implements True-Motion: pixel(r,c) = clip(left[r] + +// above[c] - above[-1]). Callers must pass a slice whose backing array +// has at least one byte before `above[0]` so the -1 lookup is valid. +func tmPredictor(dst []uint8, stride, bs int, above, left []uint8) { + if intraBridgeDisjoint(dst, stride, bs, above, bs+1) && + intraBridgeDisjoint(dst, stride, bs, left, bs) { + pixel.TMPredict(dst, stride, above[1:], left, above[0], bs) + return + } + // above is provided with above[0]..above[bs+...], and aboveTopLeft is + // passed via above[-1] in libvpx. To keep that contract in Go we + // expect callers to pass a sub-slice where index 0 is the top-left + // corner pixel; ie. the parameter naming changes by one. To preserve + // the same call shape as libvpx, the public entry points below + // reslice into the right offset before invoking the helper. + topLeft := int(above[0]) + above = above[1:] + minAbove, maxAbove := int(above[0]), int(above[0]) + for i := 1; i < bs; i++ { + a := int(above[i]) + if a < minAbove { + minAbove = a + } else if a > maxAbove { + maxAbove = a + } + } + for r := range bs { + base := int(left[r]) - topLeft + row := dst[r*stride : r*stride+bs] + if base+minAbove >= 0 && base+maxAbove <= 255 { + for c := range row { + row[c] = uint8(base + int(above[c])) + } + continue + } + for c := range row { + v := base + int(above[c]) + if v < 0 { + row[c] = 0 + } else if v > 255 { + row[c] = 255 + } else { + row[c] = uint8(v) + } + } + } +} + +// The exported wrappers fix the block size at the type level so the +// compiler can constant-fold the inner loops. above is passed at index +// -1 in libvpx; the Go contract uses a 1-byte prefix so above[0] in +// these functions is the top-left corner and above[1..bs] is the row +// above. left[0..bs-1] is the column to the left. + +// Vpx*Predictor4x4 etc match libvpx's vpx__predictor_4x4_c. + +func VpxDcPredictor4x4(dst []uint8, stride int, above, left []uint8) { + if pixel.Intra4x4DCFill(dst, stride, above[1:], left) { + return + } + dcPredictor(dst, stride, 4, above[1:], left) +} +func VpxDcPredictor8x8(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 8, true, true) { + return + } + dcPredictor(dst, stride, 8, above[1:], left) +} +func VpxDcPredictor16x16(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 16, true, true) { + return + } + dcPredictor(dst, stride, 16, above[1:], left) +} +func VpxDcPredictor32x32(dst []uint8, stride int, above, left []uint8) { + if intraDCFixed(dst, stride, 32, above[1:], left, true, true) { + return + } + dcPredictor(dst, stride, 32, above[1:], left) +} + +func VpxDcLeftPredictor4x4(dst []uint8, stride int, above, left []uint8) { + if intraDCFixed(dst, stride, 4, above[1:], left, false, true) { + return + } + dcLeftPredictor(dst, stride, 4, above[1:], left) +} +func VpxDcLeftPredictor8x8(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 8, false, true) { + return + } + dcLeftPredictor(dst, stride, 8, above[1:], left) +} +func VpxDcLeftPredictor16x16(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 16, false, true) { + return + } + dcLeftPredictor(dst, stride, 16, above[1:], left) +} +func VpxDcLeftPredictor32x32(dst []uint8, stride int, above, left []uint8) { + if intraDCFixed(dst, stride, 32, above[1:], left, false, true) { + return + } + dcLeftPredictor(dst, stride, 32, above[1:], left) +} + +func VpxDcTopPredictor4x4(dst []uint8, stride int, above, left []uint8) { + if intraDCFixed(dst, stride, 4, above[1:], left, true, false) { + return + } + dcTopPredictor(dst, stride, 4, above[1:], left) +} +func VpxDcTopPredictor8x8(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 8, true, false) { + return + } + dcTopPredictor(dst, stride, 8, above[1:], left) +} +func VpxDcTopPredictor16x16(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 16, true, false) { + return + } + dcTopPredictor(dst, stride, 16, above[1:], left) +} +func VpxDcTopPredictor32x32(dst []uint8, stride int, above, left []uint8) { + if intraDCFixed(dst, stride, 32, above[1:], left, true, false) { + return + } + dcTopPredictor(dst, stride, 32, above[1:], left) +} + +func VpxDc128Predictor4x4(dst []uint8, stride int, above, left []uint8) { + if intraDCFixed(dst, stride, 4, above[1:], left, false, false) { + return + } + dc128Predictor(dst, stride, 4, above[1:], left) +} +func VpxDc128Predictor8x8(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 8, false, false) { + return + } + dc128Predictor(dst, stride, 8, above[1:], left) +} +func VpxDc128Predictor16x16(dst []uint8, stride int, above, left []uint8) { + if pixel.IntraDCFill(dst, stride, above[1:], left, 16, false, false) { + return + } + dc128Predictor(dst, stride, 16, above[1:], left) +} +func VpxDc128Predictor32x32(dst []uint8, stride int, above, left []uint8) { + if intraDCFixed(dst, stride, 32, above[1:], left, false, false) { + return + } + dc128Predictor(dst, stride, 32, above[1:], left) +} + +func VpxVPredictor4x4(dst []uint8, stride int, above, left []uint8) { + vPredictor(dst, stride, 4, above[1:], left) +} +func VpxVPredictor8x8(dst []uint8, stride int, above, left []uint8) { + vPredictor(dst, stride, 8, above[1:], left) +} +func VpxVPredictor16x16(dst []uint8, stride int, above, left []uint8) { + if intraVFixed(dst, stride, 16, above[1:]) { + return + } + vPredictor(dst, stride, 16, above[1:], left) +} +func VpxVPredictor32x32(dst []uint8, stride int, above, left []uint8) { + vPredictor(dst, stride, 32, above[1:], left) +} + +func VpxHPredictor4x4(dst []uint8, stride int, above, left []uint8) { + _ = above[0] + hPredictor4(dst, stride, left) +} +func VpxHPredictor8x8(dst []uint8, stride int, above, left []uint8) { + _ = above[0] + if intraHFixed(dst, stride, 8, left) { + return + } + hPredictor8(dst, stride, left) +} +func VpxHPredictor16x16(dst []uint8, stride int, above, left []uint8) { + _ = above[0] + if intraHFixed(dst, stride, 16, left) { + return + } + hPredictor16(dst, stride, left) +} +func VpxHPredictor32x32(dst []uint8, stride int, above, left []uint8) { + _ = above[0] + if intraHFixed(dst, stride, 32, left) { + return + } + hPredictor32(dst, stride, left) +} + +func VpxTmPredictor4x4(dst []uint8, stride int, above, left []uint8) { + tmPredictor(dst, stride, 4, above, left) +} +func VpxTmPredictor8x8(dst []uint8, stride int, above, left []uint8) { + tmPredictor(dst, stride, 8, above, left) +} +func VpxTmPredictor16x16(dst []uint8, stride int, above, left []uint8) { + tmPredictor(dst, stride, 16, above, left) +} +func VpxTmPredictor32x32(dst []uint8, stride int, above, left []uint8) { + if intraBridgeDisjoint(dst, stride, 32, above, 33) && + intraBridgeDisjoint(dst, stride, 32, left, 32) && + intraTM32Fixed(dst, stride, above[1:], left, above[0]) { + return + } + tmPredictor(dst, stride, 32, above, left) +} diff --git a/internal/vp9/dsp/intrapred_4x4.go b/internal/vp9/dsp/intrapred_4x4.go new file mode 100644 index 0000000..3d77ac8 --- /dev/null +++ b/internal/vp9/dsp/intrapred_4x4.go @@ -0,0 +1,177 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/intrapred_4x4.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// VpxD207Predictor4x4 mirrors vpx_d207_predictor_4x4_c. Left-only. +func VpxD207Predictor4x4(dst []uint8, stride int, above, left []uint8) { + _ = above + I, J, K, L := int(left[0]), int(left[1]), int(left[2]), int(left[3]) + dst[0*stride+0] = avg2(I, J) + dst[0*stride+2] = avg2(J, K) + dst[0*stride+1] = avg3(I, J, K) + dst[0*stride+3] = avg3(J, K, L) + dst[1*stride+0] = avg2(J, K) + dst[1*stride+1] = avg3(J, K, L) + dst[1*stride+2] = avg2(K, L) + dst[1*stride+3] = avg3(K, L, L) + dst[2*stride+0] = avg2(K, L) + dst[2*stride+1] = avg3(K, L, L) + dst[2*stride+2] = uint8(L) + dst[2*stride+3] = uint8(L) + dst[3*stride+0] = uint8(L) + dst[3*stride+1] = uint8(L) + dst[3*stride+2] = uint8(L) + dst[3*stride+3] = uint8(L) +} + +// VpxD63Predictor4x4 mirrors vpx_d63_predictor_4x4_c. Above-only. +// Reads above[0..6]. +func VpxD63Predictor4x4(dst []uint8, stride int, aboveFull, left []uint8) { + _ = left + above := aboveFull[1:] + A, B, C, D := int(above[0]), int(above[1]), int(above[2]), int(above[3]) + E, F, G := int(above[4]), int(above[5]), int(above[6]) + dst[0*stride+0] = avg2(A, B) + dst[0*stride+1] = avg2(B, C) + dst[2*stride+0] = avg2(B, C) + dst[0*stride+2] = avg2(C, D) + dst[2*stride+1] = avg2(C, D) + dst[0*stride+3] = avg2(D, E) + dst[2*stride+2] = avg2(D, E) + dst[2*stride+3] = avg2(E, F) + dst[1*stride+0] = avg3(A, B, C) + dst[1*stride+1] = avg3(B, C, D) + dst[3*stride+0] = avg3(B, C, D) + dst[1*stride+2] = avg3(C, D, E) + dst[3*stride+1] = avg3(C, D, E) + dst[1*stride+3] = avg3(D, E, F) + dst[3*stride+2] = avg3(D, E, F) + dst[3*stride+3] = avg3(E, F, G) +} + +// VpxD45Predictor4x4 mirrors vpx_d45_predictor_4x4_c. Above-only. +// Note: differs from VP8 — last cell is the above_right pixel, not an +// AVG3. +func VpxD45Predictor4x4(dst []uint8, stride int, aboveFull, left []uint8) { + _ = left + above := aboveFull[1:] + A, B, C, D := int(above[0]), int(above[1]), int(above[2]), int(above[3]) + E, F, G, H := int(above[4]), int(above[5]), int(above[6]), int(above[7]) + dst[0*stride+0] = avg3(A, B, C) + dst[0*stride+1] = avg3(B, C, D) + dst[1*stride+0] = avg3(B, C, D) + dst[0*stride+2] = avg3(C, D, E) + dst[1*stride+1] = avg3(C, D, E) + dst[2*stride+0] = avg3(C, D, E) + dst[0*stride+3] = avg3(D, E, F) + dst[1*stride+2] = avg3(D, E, F) + dst[2*stride+1] = avg3(D, E, F) + dst[3*stride+0] = avg3(D, E, F) + dst[1*stride+3] = avg3(E, F, G) + dst[2*stride+2] = avg3(E, F, G) + dst[3*stride+1] = avg3(E, F, G) + dst[2*stride+3] = avg3(F, G, H) + dst[3*stride+2] = avg3(F, G, H) + dst[3*stride+3] = uint8(H) // differs from vp8 (which used avg3(G, H, H)) +} + +// VpxD117Predictor4x4 mirrors vpx_d117_predictor_4x4_c. Above + left, +// reads the corner byte. +func VpxD117Predictor4x4(dst []uint8, stride int, aboveFull, left []uint8) { + I, J, K := int(left[0]), int(left[1]), int(left[2]) + X := int(aboveFull[0]) + above := aboveFull[1:] + A, B, C, D := int(above[0]), int(above[1]), int(above[2]), int(above[3]) + dst[0*stride+0] = avg2(X, A) + dst[2*stride+1] = avg2(X, A) + dst[0*stride+1] = avg2(A, B) + dst[2*stride+2] = avg2(A, B) + dst[0*stride+2] = avg2(B, C) + dst[2*stride+3] = avg2(B, C) + dst[0*stride+3] = avg2(C, D) + dst[3*stride+0] = avg3(K, J, I) + dst[2*stride+0] = avg3(J, I, X) + dst[1*stride+0] = avg3(I, X, A) + dst[3*stride+1] = avg3(I, X, A) + dst[1*stride+1] = avg3(X, A, B) + dst[3*stride+2] = avg3(X, A, B) + dst[1*stride+2] = avg3(A, B, C) + dst[3*stride+3] = avg3(A, B, C) + dst[1*stride+3] = avg3(B, C, D) +} + +// VpxD135Predictor4x4 mirrors vpx_d135_predictor_4x4_c. Above + left, +// reads the corner byte. libvpx's DST(x, y) macro is column-then-row; +// we map that to dst[y*stride + x]. +func VpxD135Predictor4x4(dst []uint8, stride int, aboveFull, left []uint8) { + I, J, K, L := int(left[0]), int(left[1]), int(left[2]), int(left[3]) + X := int(aboveFull[0]) + above := aboveFull[1:] + A, B, C, D := int(above[0]), int(above[1]), int(above[2]), int(above[3]) + // DST(0,3) = AVG3(J,K,L) + dst[3*stride+0] = avg3(J, K, L) + // DST(1,3) = DST(0,2) = AVG3(I,J,K) + dst[3*stride+1] = avg3(I, J, K) + dst[2*stride+0] = avg3(I, J, K) + // DST(2,3) = DST(1,2) = DST(0,1) = AVG3(X,I,J) + dst[3*stride+2] = avg3(X, I, J) + dst[2*stride+1] = avg3(X, I, J) + dst[1*stride+0] = avg3(X, I, J) + // DST(3,3) = DST(2,2) = DST(1,1) = DST(0,0) = AVG3(A,X,I) + dst[3*stride+3] = avg3(A, X, I) + dst[2*stride+2] = avg3(A, X, I) + dst[1*stride+1] = avg3(A, X, I) + dst[0*stride+0] = avg3(A, X, I) + // DST(3,2) = DST(2,1) = DST(1,0) = AVG3(B,A,X) + dst[2*stride+3] = avg3(B, A, X) + dst[1*stride+2] = avg3(B, A, X) + dst[0*stride+1] = avg3(B, A, X) + // DST(3,1) = DST(2,0) = AVG3(C,B,A) + dst[1*stride+3] = avg3(C, B, A) + dst[0*stride+2] = avg3(C, B, A) + // DST(3,0) = AVG3(D,C,B) + dst[0*stride+3] = avg3(D, C, B) +} + +// VpxD153Predictor4x4 mirrors vpx_d153_predictor_4x4_c. Above + left, +// reads the corner byte. libvpx's DST(x, y) maps to dst[y*stride + x]. +func VpxD153Predictor4x4(dst []uint8, stride int, aboveFull, left []uint8) { + I, J, K, L := int(left[0]), int(left[1]), int(left[2]), int(left[3]) + X := int(aboveFull[0]) + above := aboveFull[1:] + A, B, C := int(above[0]), int(above[1]), int(above[2]) + // DST(0,0) = DST(2,1) = AVG2(I, X) + dst[0*stride+0] = avg2(I, X) + dst[1*stride+2] = avg2(I, X) + // DST(0,1) = DST(2,2) = AVG2(J, I) + dst[1*stride+0] = avg2(J, I) + dst[2*stride+2] = avg2(J, I) + // DST(0,2) = DST(2,3) = AVG2(K, J) + dst[2*stride+0] = avg2(K, J) + dst[3*stride+2] = avg2(K, J) + // DST(0,3) = AVG2(L, K) + dst[3*stride+0] = avg2(L, K) + // DST(3,0) = AVG3(A, B, C) + dst[0*stride+3] = avg3(A, B, C) + // DST(2,0) = AVG3(X, A, B) + dst[0*stride+2] = avg3(X, A, B) + // DST(1,0) = DST(3,1) = AVG3(I, X, A) + dst[0*stride+1] = avg3(I, X, A) + dst[1*stride+3] = avg3(I, X, A) + // DST(1,1) = DST(3,2) = AVG3(J, I, X) + dst[1*stride+1] = avg3(J, I, X) + dst[2*stride+3] = avg3(J, I, X) + // DST(1,2) = DST(3,3) = AVG3(K, J, I) + dst[2*stride+1] = avg3(K, J, I) + dst[3*stride+3] = avg3(K, J, I) + // DST(1,3) = AVG3(L, K, J) + dst[3*stride+1] = avg3(L, K, J) +} diff --git a/internal/vp9/dsp/intrapred_dir.go b/internal/vp9/dsp/intrapred_dir.go new file mode 100644 index 0000000..367a701 --- /dev/null +++ b/internal/vp9/dsp/intrapred_dir.go @@ -0,0 +1,262 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/intrapred_dir.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// Directional intra predictors (D45 / D63 / D117 / D135 / D153 / D207) +// for VP9 block sizes 8 / 16 / 32. Ported from libvpx v1.16.0 +// vpx_dsp/intrapred.c — the parametric implementations that the +// intra_pred_no_4x4 macro instantiates per size. The hand-coded 4x4 +// variants live alongside in a follow-up to keep this file focused. +// +// AVG2(a,b) = (a + b + 1) >> 1 — rounded mean +// AVG3(a,b,c) = (a + 2*b + c + 2) >> 2 — rounded weighted mean +// +// `above` is passed with the [-1] top-left corner stored at index 0; +// the per-helper code re-slices to above[1:] to match libvpx's signed +// index access pattern. `left` is read 0..bs-1. + +func avg2(a, b int) uint8 { return uint8((a + b + 1) >> 1) } +func avg3(a, b, c int) uint8 { + return uint8((a + 2*b + c + 2) >> 2) +} + +// d207Predictor reproduces vpx_dsp/intrapred.c:d207_predictor. +// `left` only — synthesises a 207° diagonal from the column to the +// left of the block. +func d207Predictor(dst []uint8, stride, bs int, above, left []uint8) { + _ = above + // first column + for r := 0; r < bs-1; r++ { + dst[r*stride] = avg2(int(left[r]), int(left[r+1])) + } + dst[(bs-1)*stride] = left[bs-1] + + // second column + for r := 0; r < bs-2; r++ { + dst[r*stride+1] = avg3(int(left[r]), int(left[r+1]), int(left[r+2])) + } + dst[(bs-2)*stride+1] = avg3(int(left[bs-2]), int(left[bs-1]), int(left[bs-1])) + dst[(bs-1)*stride+1] = left[bs-1] + + // rest of last row + for c := 0; c < bs-2; c++ { + dst[(bs-1)*stride+2+c] = left[bs-1] + } + + // rest fills in via copy-up-2 from the bottom-right corner. + for r := bs - 2; r >= 0; r-- { + for c := 0; c < bs-2; c++ { + dst[r*stride+2+c] = dst[(r+1)*stride+c] + } + } +} + +// d63Predictor reproduces vpx_dsp/intrapred.c:d63_predictor. Above-only +// 63° direction. Needs above[0..2*bs-1]. +func d63Predictor(dst []uint8, stride, bs int, above, left []uint8) { + _ = left + // First two rows are direct averages of the above row. + for c := range bs { + dst[c] = avg2(int(above[c]), int(above[c+1])) + dst[stride+c] = avg3(int(above[c]), int(above[c+1]), int(above[c+2])) + } + for r, size := 2, bs-2; r < bs; r, size = r+2, size-1 { + // Even row: copy from row 0 starting at offset r/2, then pad with above[bs-1]. + copy(dst[(r+0)*stride:(r+0)*stride+size], dst[r>>1:(r>>1)+size]) + for c := size; c < bs; c++ { + dst[(r+0)*stride+c] = above[bs-1] + } + // Odd row: copy from row 1 starting at offset r/2, then pad. + copy(dst[(r+1)*stride:(r+1)*stride+size], dst[stride+(r>>1):stride+(r>>1)+size]) + for c := size; c < bs; c++ { + dst[(r+1)*stride+c] = above[bs-1] + } + } +} + +// d45Predictor reproduces vpx_dsp/intrapred.c:d45_predictor. Above-only +// 45° direction. +func d45Predictor(dst []uint8, stride, bs int, above, left []uint8) { + _ = left + aboveRight := above[bs-1] + for x := 0; x < bs-1; x++ { + dst[x] = avg3(int(above[x]), int(above[x+1]), int(above[x+2])) + } + dst[bs-1] = aboveRight + for x, size := 1, bs-2; x < bs; x, size = x+1, size-1 { + row := dst[x*stride : x*stride+bs] + copy(row[:size], dst[x:x+size]) + for c := size; c < bs; c++ { + row[c] = aboveRight + } + } +} + +// d117Predictor reproduces vpx_dsp/intrapred.c:d117_predictor. Mixed +// above + left; reads above[-1] via the corner byte. The Go signature +// receives `aboveFull` with the corner byte at index 0 and the actual +// row above[0..2*bs-1] at indices 1..2*bs. +func d117Predictor(dst []uint8, stride, bs int, aboveFull, left []uint8) { + cornerByte := aboveFull[0] + above := aboveFull[1:] + // first row + for c := range bs { + var a0 uint8 + if c == 0 { + a0 = cornerByte + } else { + a0 = above[c-1] + } + dst[c] = avg2(int(a0), int(above[c])) + } + // second row + dst[stride+0] = avg3(int(left[0]), int(cornerByte), int(above[0])) + for c := 1; c < bs; c++ { + var a0 uint8 + if c == 1 { + a0 = cornerByte + } else { + a0 = above[c-2] + } + dst[stride+c] = avg3(int(a0), int(above[c-1]), int(above[c])) + } + // rest of first col — libvpx walks dst from the row-2 base; we + // keep dst at the buffer root and account for the offset by adding + // 2 to the row index inside this loop. + dst[2*stride] = avg3(int(cornerByte), int(left[0]), int(left[1])) + for r := 3; r < bs; r++ { + dst[r*stride] = avg3(int(left[r-3]), int(left[r-2]), int(left[r-1])) + } + // the rest of the block + for r := 2; r < bs; r++ { + for c := 1; c < bs; c++ { + dst[r*stride+c] = dst[(r-2)*stride+c-1] + } + } +} + +// d135Predictor reproduces vpx_dsp/intrapred.c:d135_predictor. The Go +// signature receives `aboveFull` with the corner byte at index 0. +func d135Predictor(dst []uint8, stride, bs int, aboveFull, left []uint8) { + cornerByte := aboveFull[0] + above := aboveFull[1:] + var border [69]uint8 // 32+32+padding + for i := 0; i < bs-2; i++ { + border[i] = avg3(int(left[bs-3-i]), int(left[bs-2-i]), int(left[bs-1-i])) + } + border[bs-2] = avg3(int(cornerByte), int(left[0]), int(left[1])) + border[bs-1] = avg3(int(left[0]), int(cornerByte), int(above[0])) + border[bs+0] = avg3(int(cornerByte), int(above[0]), int(above[1])) + for i := 0; i < bs-2; i++ { + border[bs+1+i] = avg3(int(above[i]), int(above[i+1]), int(above[i+2])) + } + for i := range bs { + copy(dst[i*stride:i*stride+bs], border[bs-1-i:]) + } +} + +// d153Predictor reproduces vpx_dsp/intrapred.c:d153_predictor. The Go +// signature receives `aboveFull` with the corner byte at index 0. +func d153Predictor(dst []uint8, stride, bs int, aboveFull, left []uint8) { + cornerByte := aboveFull[0] + above := aboveFull[1:] + // first column + dst[0] = avg2(int(cornerByte), int(left[0])) + for r := 1; r < bs; r++ { + dst[r*stride] = avg2(int(left[r-1]), int(left[r])) + } + // second column + dst[1] = avg3(int(left[0]), int(cornerByte), int(above[0])) + dst[stride+1] = avg3(int(cornerByte), int(left[0]), int(left[1])) + for r := 2; r < bs; r++ { + dst[r*stride+1] = avg3(int(left[r-2]), int(left[r-1]), int(left[r])) + } + // third column onward, row 0 + for c := 0; c < bs-2; c++ { + var a0 uint8 + if c == 0 { + a0 = cornerByte + } else { + a0 = above[c-1] + } + dst[2+c] = avg3(int(a0), int(above[c]), int(above[c+1])) + } + // rest of the block: shift-from-prior-row-by-2 columns + for r := 1; r < bs; r++ { + for c := 0; c < bs-2; c++ { + dst[r*stride+2+c] = dst[(r-1)*stride+c] + } + } +} + +// VpxD207Predictor{8x8,16x16,32x32} wrap the parametric helper. The 4x4 +// path uses a dedicated hand-coded predictor (added separately when the +// decoder needs the 4x4 mode dispatch). + +func VpxD207Predictor8x8(dst []uint8, stride int, above, left []uint8) { + d207Predictor(dst, stride, 8, above[1:], left) +} +func VpxD207Predictor16x16(dst []uint8, stride int, above, left []uint8) { + d207Predictor(dst, stride, 16, above[1:], left) +} +func VpxD207Predictor32x32(dst []uint8, stride int, above, left []uint8) { + d207Predictor(dst, stride, 32, above[1:], left) +} + +func VpxD63Predictor8x8(dst []uint8, stride int, above, left []uint8) { + d63Predictor(dst, stride, 8, above[1:], left) +} +func VpxD63Predictor16x16(dst []uint8, stride int, above, left []uint8) { + d63Predictor(dst, stride, 16, above[1:], left) +} +func VpxD63Predictor32x32(dst []uint8, stride int, above, left []uint8) { + d63Predictor(dst, stride, 32, above[1:], left) +} + +func VpxD45Predictor8x8(dst []uint8, stride int, above, left []uint8) { + d45Predictor(dst, stride, 8, above[1:], left) +} +func VpxD45Predictor16x16(dst []uint8, stride int, above, left []uint8) { + d45Predictor(dst, stride, 16, above[1:], left) +} +func VpxD45Predictor32x32(dst []uint8, stride int, above, left []uint8) { + d45Predictor(dst, stride, 32, above[1:], left) +} + +func VpxD117Predictor8x8(dst []uint8, stride int, above, left []uint8) { + d117Predictor(dst, stride, 8, above, left) +} +func VpxD117Predictor16x16(dst []uint8, stride int, above, left []uint8) { + d117Predictor(dst, stride, 16, above, left) +} +func VpxD117Predictor32x32(dst []uint8, stride int, above, left []uint8) { + d117Predictor(dst, stride, 32, above, left) +} + +func VpxD135Predictor8x8(dst []uint8, stride int, above, left []uint8) { + d135Predictor(dst, stride, 8, above, left) +} +func VpxD135Predictor16x16(dst []uint8, stride int, above, left []uint8) { + d135Predictor(dst, stride, 16, above, left) +} +func VpxD135Predictor32x32(dst []uint8, stride int, above, left []uint8) { + d135Predictor(dst, stride, 32, above, left) +} + +func VpxD153Predictor8x8(dst []uint8, stride int, above, left []uint8) { + d153Predictor(dst, stride, 8, above, left) +} +func VpxD153Predictor16x16(dst []uint8, stride int, above, left []uint8) { + d153Predictor(dst, stride, 16, above, left) +} +func VpxD153Predictor32x32(dst []uint8, stride int, above, left []uint8) { + d153Predictor(dst, stride, 32, above, left) +} diff --git a/internal/vp9/dsp/intrapred_fixed_amd64.go b/internal/vp9/dsp/intrapred_fixed_amd64.go new file mode 100644 index 0000000..9825807 --- /dev/null +++ b/internal/vp9/dsp/intrapred_fixed_amd64.go @@ -0,0 +1,20 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/intrapred_fixed_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package dsp + +import "simd/archsimd" + +func intraSumBytes(v archsimd.Uint8x16) int { + s := v.SumOf8AbsDiff(archsimd.Uint8x16{}) + return int(s.GetElem(0) + s.GetElem(1)) +} diff --git a/internal/vp9/dsp/intrapred_fixed_arm64.go b/internal/vp9/dsp/intrapred_fixed_arm64.go new file mode 100644 index 0000000..20eceaa --- /dev/null +++ b/internal/vp9/dsp/intrapred_fixed_arm64.go @@ -0,0 +1,19 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/intrapred_fixed_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package dsp + +import "simd/archsimd" + +func intraSumBytes(v archsimd.Uint8x16) int { + return int(v.ExtendLo8ToUint16().Add(v.HiToLo().ExtendLo8ToUint16()).ReduceSum()) +} diff --git a/internal/vp9/dsp/intrapred_fixed_simd.go b/internal/vp9/dsp/intrapred_fixed_simd.go new file mode 100644 index 0000000..0d12873 --- /dev/null +++ b/internal/vp9/dsp/intrapred_fixed_simd.go @@ -0,0 +1,159 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/intrapred_fixed_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package dsp + +import ( + "encoding/binary" + "simd/archsimd" + + "github.com/go-avkit/vpx/internal/pixel" +) + +// Fixed-row kernels implement libvpx v1.16.0 vpx_dsp/intrapred.c arithmetic. +// Entry guards prove every complete row and preserve the scalar panic path. +func intraTM32Fixed(dst []byte, stride int, above, left []byte, top byte) bool { + if !pixel.Enabled { + return false + } + a := archsimd.LoadUint8x16Array((*[16]byte)(above[:16])) + b := archsimd.LoadUint8x16Array((*[16]byte)(above[16:32])) + for y := range 32 { + delta := int(left[y]) - int(top) + pos, neg := archsimd.BroadcastUint8x16(byte(max(delta, 0))), archsimd.BroadcastUint8x16(byte(max(-delta, 0))) + row := dst[y*stride : y*stride+32] + a.AddSaturated(pos).SubSaturated(neg).StoreArray((*[16]byte)(row[:16])) + b.AddSaturated(pos).SubSaturated(neg).StoreArray((*[16]byte)(row[16:32])) + } + return true +} +func intraVFixed(dst []byte, stride, n int, above []byte) bool { + if !intraBridgeDisjoint(dst, stride, n, above, n) { + return false + } + switch n { + case 4: + v := binary.LittleEndian.Uint32(above[:4]) + for y := range 4 { + binary.LittleEndian.PutUint32(dst[y*stride:y*stride+4], v) + } + case 8: + v := binary.LittleEndian.Uint64(above[:8]) + for y := range 8 { + binary.LittleEndian.PutUint64(dst[y*stride:y*stride+8], v) + } + case 16: + v := archsimd.LoadUint8x16Array((*[16]byte)(above[:16])) + for y := range 16 { + v.StoreArray((*[16]byte)(dst[y*stride : y*stride+16])) + } + case 32: + a := archsimd.LoadUint8x16Array((*[16]byte)(above[:16])) + b := archsimd.LoadUint8x16Array((*[16]byte)(above[16:32])) + for y := range 32 { + row := dst[y*stride : y*stride+32] + a.StoreArray((*[16]byte)(row[:16])) + b.StoreArray((*[16]byte)(row[16:32])) + } + default: + return false + } + return true +} +func intraHFixed(dst []byte, stride, n int, left []byte) bool { + if !intraBridgeWindow(dst, stride, n) || len(left) < n { + return false + } + switch n { + case 4: + for y := range 4 { + v := uint32(left[y]) * 0x01010101 + binary.LittleEndian.PutUint32(dst[y*stride:y*stride+4], v) + } + case 8: + for y := range 8 { + v := uint64(left[y]) * 0x0101010101010101 + binary.LittleEndian.PutUint64(dst[y*stride:y*stride+8], v) + } + case 16: + for y := range 16 { + v := archsimd.BroadcastUint8x16(left[y]) + v.StoreArray((*[16]byte)(dst[y*stride : y*stride+16])) + } + case 32: + for y := range 32 { + v := archsimd.BroadcastUint8x16(left[y]) + row := dst[y*stride : y*stride+32] + v.StoreArray((*[16]byte)(row[:16])) + v.StoreArray((*[16]byte)(row[16:32])) + } + default: + return false + } + return true +} +func intraEdgeSum(edge []byte, n int) int { + switch n { + case 4: + return intraSumBytes(archsimd.Uint32x4{}.SetElem(0, binary.LittleEndian.Uint32(edge[:4])).ReshapeToUint8s()) + case 8: + return intraSumBytes(archsimd.Uint64x2{}.SetElem(0, binary.LittleEndian.Uint64(edge[:8])).ReshapeToUint8s()) + case 16: + return intraSumBytes(archsimd.LoadUint8x16Array((*[16]byte)(edge[:16]))) + default: + return intraSumBytes(archsimd.LoadUint8x16Array((*[16]byte)(edge[:16]))) + intraSumBytes(archsimd.LoadUint8x16Array((*[16]byte)(edge[16:32]))) + } +} +func intraDCFixed(dst []byte, stride, n int, above, left []byte, up, lf bool) bool { + if !intraBridgeWindow(dst, stride, n) || (up && len(above) < n) || (lf && len(left) < n) { + return false + } + sum, count := 0, 0 + if up { + sum += intraEdgeSum(above, n) + count += n + } + if lf { + sum += intraEdgeSum(left, n) + count += n + } + value := byte(128) + if count > 0 { + value = byte((sum + count/2) / count) + } + v := archsimd.BroadcastUint8x16(value) + switch n { + case 4: + word := v.ReshapeToUint32s().GetElem(0) + for y := range 4 { + binary.LittleEndian.PutUint32(dst[y*stride:y*stride+4], word) + } + case 8: + word := v.ReshapeToUint64s().GetElem(0) + for y := range 8 { + binary.LittleEndian.PutUint64(dst[y*stride:y*stride+8], word) + } + case 16: + for y := range 16 { + v.StoreArray((*[16]byte)(dst[y*stride : y*stride+16])) + } + case 32: + for y := range 32 { + row := dst[y*stride : y*stride+32] + v.StoreArray((*[16]byte)(row[:16])) + v.StoreArray((*[16]byte)(row[16:32])) + } + default: + return false + } + return true +} diff --git a/internal/vp9/dsp/inv_txfm.go b/internal/vp9/dsp/inv_txfm.go new file mode 100644 index 0000000..a20a527 --- /dev/null +++ b/internal/vp9/dsp/inv_txfm.go @@ -0,0 +1,90 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/inv_txfm.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// Ported from libvpx v1.16.0: +// - vpx_dsp/inv_txfm.{h,c} (idct4_c, vpx_idct4x4_16_add_c, vpx_idct4x4_1_add_c, +// iadst4_c, vpx_iwht4x4_16_add_c, vpx_iwht4x4_1_add_c) +// - vpx_dsp/txfm_common.h (cospi / sinpi constants, DCT_CONST_BITS, +// UNIT_QUANT_SHIFT) + +// DCT_CONST_BITS / UNIT_QUANT_SHIFT are the two scaling factors that +// govern intermediate magnitudes through all VP9 inverse transforms. +// Their values are baked into the wire format — changing them changes +// every reconstructed pixel. +const ( + dctConstBits = 14 + unitQuantShift = 2 + dctConstRounding = 1 << (dctConstBits - 1) +) + +// VP9 cospi / sinpi constants from vpx_dsp/txfm_common.h. The cospi_K_64 +// values are 16-bit fixed-point cos((K * pi) / 64) * 2^14 (rounded). They +// appear in every VP9 inverse-transform butterfly; their exact integer +// values are wire-stable so the porting must match upstream byte-for-byte. +const ( + cospi1_64 = 16364 + cospi2_64 = 16305 + cospi3_64 = 16207 + cospi4_64 = 16069 + cospi5_64 = 15893 + cospi6_64 = 15679 + cospi7_64 = 15426 + cospi8_64 = 15137 + cospi9_64 = 14811 + cospi10_64 = 14449 + cospi11_64 = 14053 + cospi12_64 = 13623 + cospi13_64 = 13160 + cospi14_64 = 12665 + cospi15_64 = 12140 + cospi16_64 = 11585 + cospi17_64 = 11003 + cospi18_64 = 10394 + cospi19_64 = 9760 + cospi20_64 = 9102 + cospi21_64 = 8423 + cospi22_64 = 7723 + cospi23_64 = 7005 + cospi24_64 = 6270 + cospi25_64 = 5520 + cospi26_64 = 4756 + cospi27_64 = 3981 + cospi28_64 = 3196 + cospi29_64 = 2404 + cospi30_64 = 1606 + cospi31_64 = 804 + + sinpi1_9 = 5283 + sinpi2_9 = 9929 + sinpi3_9 = 13377 + sinpi4_9 = 15212 +) + +// dctConstRoundShift implements libvpx's dct_const_round_shift: round +// the multiplied coefficient back into the int16 range using a +// half-rounding right shift by DCT_CONST_BITS. +func dctConstRoundShift(input int64) int32 { + return int32((input + dctConstRounding) >> dctConstBits) +} + +// clipPixelAdd mirrors clip_pixel_add: add the residual to the existing +// 8-bit pixel and clamp to [0, 255]. +func clipPixelAdd(dest uint8, trans int32) uint8 { + return uint8(min(max(int32(dest)+trans, 0), 255)) +} + +// roundPowerOfTwo mirrors ROUND_POWER_OF_TWO: signed right shift with +// half-rounding. Used to fold the 1-D transform's normalization factor +// (4 bits for 4x4) back into the pixel domain. +func roundPowerOfTwo(value int32, n uint) int32 { + return (value + (1 << (n - 1))) >> n +} diff --git a/internal/vp9/dsp/iwht4.go b/internal/vp9/dsp/iwht4.go new file mode 100644 index 0000000..d3fb4c5 --- /dev/null +++ b/internal/vp9/dsp/iwht4.go @@ -0,0 +1,90 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/iwht4.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// iwht4x4_16AddScalar is the inverse 4x4 Walsh-Hadamard used by +// lossless VP9. Mirrors vpx_iwht4x4_16_add_c line-for-line: each row +// is unpacked, shifted right by UNIT_QUANT_SHIFT (2 bits), passed +// through the orthonormal 4-point IWHT (3.5 adds + 0.5 shifts per +// pixel per libvpx's comment), then a transpose column pass writes +// back into the pixel buffer with the +clip_pixel_add fold. +// +// Scalar reference; the exported Iwht4x4_16Add wrapper is in +// idct_dispatch_*.go. +func iwht4x4_16AddScalar(input []int16, dest []uint8, stride int) { + var output [16]int16 + + ip := input + op := output[:] + for range 4 { + a1 := int64(ip[0]) >> unitQuantShift + c1 := int64(ip[1]) >> unitQuantShift + d1 := int64(ip[2]) >> unitQuantShift + b1 := int64(ip[3]) >> unitQuantShift + a1 += c1 + d1 -= b1 + e1 := (a1 - d1) >> 1 + b1 = e1 - b1 + c1 = e1 - c1 + a1 -= b1 + d1 += c1 + op[0] = int16(a1) + op[1] = int16(b1) + op[2] = int16(c1) + op[3] = int16(d1) + ip = ip[4:] + op = op[4:] + } + + for i := range 4 { + a1 := int64(output[4*0+i]) + c1 := int64(output[4*1+i]) + d1 := int64(output[4*2+i]) + b1 := int64(output[4*3+i]) + a1 += c1 + d1 -= b1 + e1 := (a1 - d1) >> 1 + b1 = e1 - b1 + c1 = e1 - c1 + a1 -= b1 + d1 += c1 + dest[stride*0+i] = clipPixelAdd(dest[stride*0+i], int32(a1)) + dest[stride*1+i] = clipPixelAdd(dest[stride*1+i], int32(b1)) + dest[stride*2+i] = clipPixelAdd(dest[stride*2+i], int32(c1)) + dest[stride*3+i] = clipPixelAdd(dest[stride*3+i], int32(d1)) + } +} + +// iwht4x4_1AddScalar is the DC-only fast path for the lossless 4x4 +// inverse Walsh-Hadamard. Matches vpx_iwht4x4_1_add_c. +// +// Scalar reference; the exported Iwht4x4_1Add wrapper is in +// idct_dispatch_*.go. +func iwht4x4_1AddScalar(input []int16, dest []uint8, stride int) { + var tmp [4]int16 + + a1 := int64(input[0]) >> unitQuantShift + e1 := a1 >> 1 + a1 -= e1 + tmp[0] = int16(a1) + tmp[1] = int16(e1) + tmp[2] = int16(e1) + tmp[3] = int16(e1) + + for i := range 4 { + e1 := int64(tmp[i]) >> 1 + a1 := int64(tmp[i]) - e1 + dest[stride*0+i] = clipPixelAdd(dest[stride*0+i], int32(a1)) + dest[stride*1+i] = clipPixelAdd(dest[stride*1+i], int32(e1)) + dest[stride*2+i] = clipPixelAdd(dest[stride*2+i], int32(e1)) + dest[stride*3+i] = clipPixelAdd(dest[stride*3+i], int32(e1)) + } +} diff --git a/internal/vp9/dsp/loopfilter.go b/internal/vp9/dsp/loopfilter.go new file mode 100644 index 0000000..ae68e29 --- /dev/null +++ b/internal/vp9/dsp/loopfilter.go @@ -0,0 +1,423 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/loopfilter.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +// signedCharClamp models libvpx's signed_char_clamp helper — clamp into +// the int8 range so the subsequent shift-by-3 acts predictably on the +// sign bits. +func signedCharClamp(t int) int8 { + if t < -128 { + return -128 + } + if t > 127 { + return 127 + } + return int8(t) +} + +func absDiff(a, b uint8) int { + d := int(a) - int(b) + mask := d >> 31 + return (d ^ mask) - mask +} + +// filterMask returns 0xff if the 8-pixel edge needs filtering, 0 +// otherwise. Bit-identical to filter_mask in vpx_dsp/loopfilter.c. +func filterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3 uint8) int8 { + var mask int8 + if absDiff(p3, p2) > int(limit) { + mask |= -1 + } + if absDiff(p2, p1) > int(limit) { + mask |= -1 + } + if absDiff(p1, p0) > int(limit) { + mask |= -1 + } + if absDiff(q1, q0) > int(limit) { + mask |= -1 + } + if absDiff(q2, q1) > int(limit) { + mask |= -1 + } + if absDiff(q3, q2) > int(limit) { + mask |= -1 + } + if absDiff(p0, q0)*2+absDiff(p1, q1)/2 > int(blimit) { + mask |= -1 + } + return ^mask +} + +// flatMask4 returns 0xff if the 8-pixel edge is "flat" enough to swap +// in the 7-tap filter, 0 otherwise. Bit-identical to flat_mask4. +func flatMask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3 uint8) int8 { + var mask int8 + if absDiff(p1, p0) > int(thresh) { + mask |= -1 + } + if absDiff(q1, q0) > int(thresh) { + mask |= -1 + } + if absDiff(p2, p0) > int(thresh) { + mask |= -1 + } + if absDiff(q2, q0) > int(thresh) { + mask |= -1 + } + if absDiff(p3, p0) > int(thresh) { + mask |= -1 + } + if absDiff(q3, q0) > int(thresh) { + mask |= -1 + } + return ^mask +} + +// hevMask returns 0xff if the inner-edge variance is high, signalling +// the filter should also adjust the outer taps. Bit-identical to +// hev_mask. +func hevMask(thresh, p1, p0, q0, q1 uint8) int8 { + var hev int8 + if absDiff(p1, p0) > int(thresh) { + hev |= -1 + } + if absDiff(q1, q0) > int(thresh) { + hev |= -1 + } + return hev +} + +// filter4 is the 4-tap edge filter. Operates in-place on four caller- +// owned pixel slots (p1, p0, q0, q1) referenced by index. Bit-identical +// to filter4 in vpx_dsp/loopfilter.c. +func filter4(mask int8, thresh uint8, dst []uint8, idxP1, idxP0, idxQ0, idxQ1 int) { + op1, op0, oq0, oq1 := dst[idxP1], dst[idxP0], dst[idxQ0], dst[idxQ1] + ps1 := int8(op1 ^ 0x80) + ps0 := int8(op0 ^ 0x80) + qs0 := int8(oq0 ^ 0x80) + qs1 := int8(oq1 ^ 0x80) + hev := hevMask(thresh, op1, op0, oq0, oq1) + + filter := signedCharClamp(int(ps1)-int(qs1)) & hev + filter = signedCharClamp(int(filter)+3*(int(qs0)-int(ps0))) & mask + filter1 := signedCharClamp(int(filter)+4) >> 3 + filter2 := signedCharClamp(int(filter)+3) >> 3 + + dst[idxQ0] = uint8(signedCharClamp(int(qs0)-int(filter1))) ^ 0x80 + dst[idxP0] = uint8(signedCharClamp(int(ps0)+int(filter2))) ^ 0x80 + + outer := (filter1 + 1) >> 1 + outer &= ^hev + + dst[idxQ1] = uint8(signedCharClamp(int(qs1)-int(outer))) ^ 0x80 + dst[idxP1] = uint8(signedCharClamp(int(ps1)+int(outer))) ^ 0x80 +} + +func vpxLpfHorizontal4Scalar(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + for range 8 { + p3 := plane[s-4*pitch] + p2 := plane[s-3*pitch] + p1 := plane[s-2*pitch] + p0 := plane[s-pitch] + q0 := plane[s+0] + q1 := plane[s+1*pitch] + q2 := plane[s+2*pitch] + q3 := plane[s+3*pitch] + mask := filterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3) + if mask != 0 { + filter4(mask, thresh, plane, s-2*pitch, s-pitch, s, s+pitch) + } + s++ + } +} + +func vpxLpfVertical4Scalar(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + for range 8 { + p3 := plane[s-4] + p2 := plane[s-3] + p1 := plane[s-2] + p0 := plane[s-1] + q0 := plane[s+0] + q1 := plane[s+1] + q2 := plane[s+2] + q3 := plane[s+3] + mask := filterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3) + if mask != 0 { + filter4(mask, thresh, plane, s-2, s-1, s, s+1) + } + s += pitch + } +} + +func vpxLpfHorizontal4DualScalar(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + vpxLpfHorizontal4Scalar(plane, s, pitch, blimit0, limit0, thresh0) + vpxLpfHorizontal4Scalar(plane, s+8, pitch, blimit1, limit1, thresh1) +} + +func vpxLpfVertical4DualScalar(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + vpxLpfVertical4Scalar(plane, s, pitch, blimit0, limit0, thresh0) + vpxLpfVertical4Scalar(plane, s+8*pitch, pitch, blimit1, limit1, thresh1) +} + +// filter8 is the 7-tap edge filter applied when the edge meets the +// flat-mask4 criterion. Falls back to filter4 when the criterion fails. +// Operates in-place on eight caller-owned pixel slots via index lookups. +// Bit-identical to filter8 in vpx_dsp/loopfilter.c. +func filter8(mask int8, thresh uint8, flat int8, dst []uint8, + idxP3, idxP2, idxP1, idxP0, idxQ0, idxQ1, idxQ2, idxQ3 int, +) { + if flat != 0 && mask != 0 { + p3, p2, p1, p0 := int(dst[idxP3]), int(dst[idxP2]), int(dst[idxP1]), int(dst[idxP0]) + q0, q1, q2, q3 := int(dst[idxQ0]), int(dst[idxQ1]), int(dst[idxQ2]), int(dst[idxQ3]) + dst[idxP2] = uint8((p3 + p3 + p3 + 2*p2 + p1 + p0 + q0 + 4) >> 3) + dst[idxP1] = uint8((p3 + p3 + p2 + 2*p1 + p0 + q0 + q1 + 4) >> 3) + dst[idxP0] = uint8((p3 + p2 + p1 + 2*p0 + q0 + q1 + q2 + 4) >> 3) + dst[idxQ0] = uint8((p2 + p1 + p0 + 2*q0 + q1 + q2 + q3 + 4) >> 3) + dst[idxQ1] = uint8((p1 + p0 + q0 + 2*q1 + q2 + q3 + q3 + 4) >> 3) + dst[idxQ2] = uint8((p0 + q0 + q1 + 2*q2 + q3 + q3 + q3 + 4) >> 3) + return + } + filter4(mask, thresh, dst, idxP1, idxP0, idxQ0, idxQ1) +} + +// flatMask5 extends flat_mask4 to the wider 16-pixel filter footprint. +// Bit-identical to flat_mask5 in vpx_dsp/loopfilter.c. +func flatMask5(thresh, p4, p3, p2, p1, p0, q0, q1, q2, q3, q4 uint8) int8 { + mask := ^flatMask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3) + if absDiff(p4, p0) > int(thresh) { + mask |= -1 + } + if absDiff(q4, q0) > int(thresh) { + mask |= -1 + } + return ^mask +} + +// filter16 is the 15-tap edge filter applied when both flat_mask4 and +// flat_mask5 pass. Falls back to filter8 otherwise. Operates in-place +// on sixteen caller-owned pixel slots via index lookups. +// Bit-identical to filter16 in vpx_dsp/loopfilter.c. +func filter16(mask int8, thresh uint8, flat, flat2 int8, dst []uint8, + idxP7, idxP6, idxP5, idxP4, idxP3, idxP2, idxP1, idxP0, + idxQ0, idxQ1, idxQ2, idxQ3, idxQ4, idxQ5, idxQ6, idxQ7 int, +) { + if flat2 != 0 && flat != 0 && mask != 0 { + p7, p6, p5, p4 := int(dst[idxP7]), int(dst[idxP6]), int(dst[idxP5]), int(dst[idxP4]) + p3, p2, p1, p0 := int(dst[idxP3]), int(dst[idxP2]), int(dst[idxP1]), int(dst[idxP0]) + q0, q1, q2, q3 := int(dst[idxQ0]), int(dst[idxQ1]), int(dst[idxQ2]), int(dst[idxQ3]) + q4, q5, q6, q7 := int(dst[idxQ4]), int(dst[idxQ5]), int(dst[idxQ6]), int(dst[idxQ7]) + dst[idxP6] = uint8((p7*7 + p6*2 + p5 + p4 + p3 + p2 + p1 + p0 + q0 + 8) >> 4) + dst[idxP5] = uint8((p7*6 + p6 + p5*2 + p4 + p3 + p2 + p1 + p0 + q0 + q1 + 8) >> 4) + dst[idxP4] = uint8((p7*5 + p6 + p5 + p4*2 + p3 + p2 + p1 + p0 + q0 + q1 + q2 + 8) >> 4) + dst[idxP3] = uint8((p7*4 + p6 + p5 + p4 + p3*2 + p2 + p1 + p0 + q0 + q1 + q2 + q3 + 8) >> 4) + dst[idxP2] = uint8((p7*3 + p6 + p5 + p4 + p3 + p2*2 + p1 + p0 + q0 + q1 + q2 + q3 + q4 + 8) >> 4) + dst[idxP1] = uint8((p7*2 + p6 + p5 + p4 + p3 + p2 + p1*2 + p0 + q0 + q1 + q2 + q3 + q4 + q5 + 8) >> 4) + dst[idxP0] = uint8((p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0*2 + q0 + q1 + q2 + q3 + q4 + q5 + q6 + 8) >> 4) + dst[idxQ0] = uint8((p6 + p5 + p4 + p3 + p2 + p1 + p0 + q0*2 + q1 + q2 + q3 + q4 + q5 + q6 + q7 + 8) >> 4) + dst[idxQ1] = uint8((p5 + p4 + p3 + p2 + p1 + p0 + q0 + q1*2 + q2 + q3 + q4 + q5 + q6 + q7*2 + 8) >> 4) + dst[idxQ2] = uint8((p4 + p3 + p2 + p1 + p0 + q0 + q1 + q2*2 + q3 + q4 + q5 + q6 + q7*3 + 8) >> 4) + dst[idxQ3] = uint8((p3 + p2 + p1 + p0 + q0 + q1 + q2 + q3*2 + q4 + q5 + q6 + q7*4 + 8) >> 4) + dst[idxQ4] = uint8((p2 + p1 + p0 + q0 + q1 + q2 + q3 + q4*2 + q5 + q6 + q7*5 + 8) >> 4) + dst[idxQ5] = uint8((p1 + p0 + q0 + q1 + q2 + q3 + q4 + q5*2 + q6 + q7*6 + 8) >> 4) + dst[idxQ6] = uint8((p0 + q0 + q1 + q2 + q3 + q4 + q5 + q6*2 + q7*7 + 8) >> 4) + return + } + filter8(mask, thresh, flat, dst, idxP3, idxP2, idxP1, idxP0, idxQ0, idxQ1, idxQ2, idxQ3) +} + +func vpxLpfHorizontal8Scalar(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + for range 8 { + p3 := plane[s-4*pitch] + p2 := plane[s-3*pitch] + p1 := plane[s-2*pitch] + p0 := plane[s-pitch] + q0 := plane[s+0] + q1 := plane[s+1*pitch] + q2 := plane[s+2*pitch] + q3 := plane[s+3*pitch] + if absDiff(p3, p2) > int(limit) || + absDiff(p2, p1) > int(limit) || + absDiff(p1, p0) > int(limit) || + absDiff(q1, q0) > int(limit) || + absDiff(q2, q1) > int(limit) || + absDiff(q3, q2) > int(limit) || + absDiff(p0, q0)*2+absDiff(p1, q1)/2 > int(blimit) { + s++ + continue + } + if absDiff(p1, p0) <= 1 && + absDiff(q1, q0) <= 1 && + absDiff(p2, p0) <= 1 && + absDiff(q2, q0) <= 1 && + absDiff(p3, p0) <= 1 && + absDiff(q3, q0) <= 1 { + plane[s-3*pitch] = uint8((int(p3)*3 + int(p2)*2 + int(p1) + int(p0) + int(q0) + 4) >> 3) + plane[s-2*pitch] = uint8((int(p3)*2 + int(p2) + int(p1)*2 + int(p0) + int(q0) + int(q1) + 4) >> 3) + plane[s-pitch] = uint8((int(p3) + int(p2) + int(p1) + int(p0)*2 + int(q0) + int(q1) + int(q2) + 4) >> 3) + plane[s] = uint8((int(p2) + int(p1) + int(p0) + int(q0)*2 + int(q1) + int(q2) + int(q3) + 4) >> 3) + plane[s+pitch] = uint8((int(p1) + int(p0) + int(q0) + int(q1)*2 + int(q2) + int(q3)*2 + 4) >> 3) + plane[s+2*pitch] = uint8((int(p0) + int(q0) + int(q1) + int(q2)*2 + int(q3)*3 + 4) >> 3) + } else { + ps1 := int8(p1 ^ 0x80) + ps0 := int8(p0 ^ 0x80) + qs0 := int8(q0 ^ 0x80) + qs1 := int8(q1 ^ 0x80) + hev := hevMask(thresh, p1, p0, q0, q1) + + filter := signedCharClamp(int(ps1)-int(qs1)) & hev + filter = signedCharClamp(int(filter) + 3*(int(qs0)-int(ps0))) + filter1 := signedCharClamp(int(filter)+4) >> 3 + filter2 := signedCharClamp(int(filter)+3) >> 3 + + plane[s] = uint8(signedCharClamp(int(qs0)-int(filter1))) ^ 0x80 + plane[s-pitch] = uint8(signedCharClamp(int(ps0)+int(filter2))) ^ 0x80 + + outer := (filter1 + 1) >> 1 + outer &= ^hev + + plane[s+pitch] = uint8(signedCharClamp(int(qs1)-int(outer))) ^ 0x80 + plane[s-2*pitch] = uint8(signedCharClamp(int(ps1)+int(outer))) ^ 0x80 + } + s++ + } +} + +func vpxLpfVertical8Scalar(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + for range 8 { + p3 := plane[s-4] + p2 := plane[s-3] + p1 := plane[s-2] + p0 := plane[s-1] + q0 := plane[s+0] + q1 := plane[s+1] + q2 := plane[s+2] + q3 := plane[s+3] + if absDiff(p3, p2) > int(limit) || + absDiff(p2, p1) > int(limit) || + absDiff(p1, p0) > int(limit) || + absDiff(q1, q0) > int(limit) || + absDiff(q2, q1) > int(limit) || + absDiff(q3, q2) > int(limit) || + absDiff(p0, q0)*2+absDiff(p1, q1)/2 > int(blimit) { + s += pitch + continue + } + if absDiff(p1, p0) <= 1 && + absDiff(q1, q0) <= 1 && + absDiff(p2, p0) <= 1 && + absDiff(q2, q0) <= 1 && + absDiff(p3, p0) <= 1 && + absDiff(q3, q0) <= 1 { + plane[s-3] = uint8((int(p3)*3 + int(p2)*2 + int(p1) + int(p0) + int(q0) + 4) >> 3) + plane[s-2] = uint8((int(p3)*2 + int(p2) + int(p1)*2 + int(p0) + int(q0) + int(q1) + 4) >> 3) + plane[s-1] = uint8((int(p3) + int(p2) + int(p1) + int(p0)*2 + int(q0) + int(q1) + int(q2) + 4) >> 3) + plane[s] = uint8((int(p2) + int(p1) + int(p0) + int(q0)*2 + int(q1) + int(q2) + int(q3) + 4) >> 3) + plane[s+1] = uint8((int(p1) + int(p0) + int(q0) + int(q1)*2 + int(q2) + int(q3)*2 + 4) >> 3) + plane[s+2] = uint8((int(p0) + int(q0) + int(q1) + int(q2)*2 + int(q3)*3 + 4) >> 3) + } else { + ps1 := int8(p1 ^ 0x80) + ps0 := int8(p0 ^ 0x80) + qs0 := int8(q0 ^ 0x80) + qs1 := int8(q1 ^ 0x80) + hev := hevMask(thresh, p1, p0, q0, q1) + + filter := signedCharClamp(int(ps1)-int(qs1)) & hev + filter = signedCharClamp(int(filter) + 3*(int(qs0)-int(ps0))) + filter1 := signedCharClamp(int(filter)+4) >> 3 + filter2 := signedCharClamp(int(filter)+3) >> 3 + + plane[s] = uint8(signedCharClamp(int(qs0)-int(filter1))) ^ 0x80 + plane[s-1] = uint8(signedCharClamp(int(ps0)+int(filter2))) ^ 0x80 + + outer := (filter1 + 1) >> 1 + outer &= ^hev + + plane[s+1] = uint8(signedCharClamp(int(qs1)-int(outer))) ^ 0x80 + plane[s-2] = uint8(signedCharClamp(int(ps1)+int(outer))) ^ 0x80 + } + s += pitch + } +} + +func vpxLpfHorizontal8DualScalar(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + vpxLpfHorizontal8Scalar(plane, s, pitch, blimit0, limit0, thresh0) + vpxLpfHorizontal8Scalar(plane, s+8, pitch, blimit1, limit1, thresh1) +} + +func vpxLpfVertical8DualScalar(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + vpxLpfVertical8Scalar(plane, s, pitch, blimit0, limit0, thresh0) + vpxLpfVertical8Scalar(plane, s+8*pitch, pitch, blimit1, limit1, thresh1) +} + +// mbLpfHorizontalEdgeW mirrors mb_lpf_horizontal_edge_w. count is 1 +// for the 16-pixel filter and 2 for the dual variant. +func mbLpfHorizontalEdgeW(plane []uint8, s, pitch int, blimit, limit, thresh uint8, count int) { + for i := 0; i < 8*count; i++ { + p3 := plane[s-4*pitch] + p2 := plane[s-3*pitch] + p1 := plane[s-2*pitch] + p0 := plane[s-pitch] + q0 := plane[s+0] + q1 := plane[s+1*pitch] + q2 := plane[s+2*pitch] + q3 := plane[s+3*pitch] + mask := filterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3) + if mask != 0 { + flat := flatMask4(1, p3, p2, p1, p0, q0, q1, q2, q3) + flat2 := flatMask5(1, + plane[s-8*pitch], plane[s-7*pitch], plane[s-6*pitch], plane[s-5*pitch], + p0, q0, + plane[s+4*pitch], plane[s+5*pitch], plane[s+6*pitch], plane[s+7*pitch]) + filter16(mask, thresh, flat, flat2, plane, + s-8*pitch, s-7*pitch, s-6*pitch, s-5*pitch, + s-4*pitch, s-3*pitch, s-2*pitch, s-pitch, + s, s+pitch, s+2*pitch, s+3*pitch, + s+4*pitch, s+5*pitch, s+6*pitch, s+7*pitch) + } + s++ + } +} + +// mbLpfVerticalEdgeW mirrors mb_lpf_vertical_edge_w. count is 8 for +// the 16-pixel filter (covering 8 rows) and 16 for the dual variant. +func mbLpfVerticalEdgeW(plane []uint8, s, pitch int, blimit, limit, thresh uint8, count int) { + for range count { + p3 := plane[s-4] + p2 := plane[s-3] + p1 := plane[s-2] + p0 := plane[s-1] + q0 := plane[s+0] + q1 := plane[s+1] + q2 := plane[s+2] + q3 := plane[s+3] + mask := filterMask(limit, blimit, p3, p2, p1, p0, q0, q1, q2, q3) + if mask != 0 { + flat := flatMask4(1, p3, p2, p1, p0, q0, q1, q2, q3) + flat2 := flatMask5(1, + plane[s-8], plane[s-7], plane[s-6], plane[s-5], + p0, q0, + plane[s+4], plane[s+5], plane[s+6], plane[s+7]) + filter16(mask, thresh, flat, flat2, plane, + s-8, s-7, s-6, s-5, s-4, s-3, s-2, s-1, + s, s+1, s+2, s+3, s+4, s+5, s+6, s+7) + } + s += pitch + } +} diff --git a/internal/vp9/dsp/loopfilter_thr.go b/internal/vp9/dsp/loopfilter_thr.go new file mode 100644 index 0000000..fea78c9 --- /dev/null +++ b/internal/vp9/dsp/loopfilter_thr.go @@ -0,0 +1,220 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/loopfilter_thr.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" +) + +func vpxLpfHorizontal4(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, pitch, 1, 8, int(blimit), int(limit), int(thresh), 4) { + return + } + + vpxLpfHorizontal4Scalar(plane, s, pitch, blimit, limit, thresh) +} + +func vpxLpfVertical4(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, 1, pitch, 8, int(blimit), int(limit), int(thresh), 4) { + return + } + + vpxLpfVertical4Scalar(plane, s, pitch, blimit, limit, thresh) +} + +func vpxLpfHorizontal4Dual(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + if pixel.LoopFilter(plane, s, pitch, 1, 8, int(blimit0), int(limit0), int(thresh0), 4) { + pixel.LoopFilter(plane, s+8*1, pitch, 1, 8, int(blimit1), int(limit1), int(thresh1), 4) + return + } + + vpxLpfHorizontal4DualScalar(plane, s, pitch, blimit0, limit0, thresh0, blimit1, limit1, thresh1) +} + +func vpxLpfVertical4Dual(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + if pixel.LoopFilter(plane, s, 1, pitch, 8, int(blimit0), int(limit0), int(thresh0), 4) { + pixel.LoopFilter(plane, s+8*pitch, 1, pitch, 8, int(blimit1), int(limit1), int(thresh1), 4) + return + } + + vpxLpfVertical4DualScalar(plane, s, pitch, blimit0, limit0, thresh0, blimit1, limit1, thresh1) +} + +func vpxLpfHorizontal8(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, pitch, 1, 8, int(blimit), int(limit), int(thresh), 8) { + return + } + + vpxLpfHorizontal8Scalar(plane, s, pitch, blimit, limit, thresh) +} + +func vpxLpfVertical8(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, 1, pitch, 8, int(blimit), int(limit), int(thresh), 8) { + return + } + + vpxLpfVertical8Scalar(plane, s, pitch, blimit, limit, thresh) +} + +func vpxLpfHorizontal8Dual(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + if blimit0 == blimit1 && limit0 == limit1 && thresh0 == thresh1 && + pixel.LoopFilter(plane, s, pitch, 1, 16, int(blimit0), int(limit0), int(thresh0), 8) { + return + } + if pixel.LoopFilter(plane, s, pitch, 1, 8, int(blimit0), int(limit0), int(thresh0), 8) { + pixel.LoopFilter(plane, s+8*1, pitch, 1, 8, int(blimit1), int(limit1), int(thresh1), 8) + return + } + + vpxLpfHorizontal8DualScalar(plane, s, pitch, blimit0, limit0, thresh0, blimit1, limit1, thresh1) +} + +func vpxLpfVertical8Dual(plane []uint8, s, pitch int, + blimit0, limit0, thresh0, blimit1, limit1, thresh1 uint8, +) { + if blimit0 == blimit1 && limit0 == limit1 && thresh0 == thresh1 && + pixel.LoopFilter(plane, s, 1, pitch, 16, int(blimit0), int(limit0), int(thresh0), 8) { + return + } + if pixel.LoopFilter(plane, s, 1, pitch, 8, int(blimit0), int(limit0), int(thresh0), 8) { + pixel.LoopFilter(plane, s+8*pitch, 1, pitch, 8, int(blimit1), int(limit1), int(thresh1), 8) + return + } + + vpxLpfVertical8DualScalar(plane, s, pitch, blimit0, limit0, thresh0, blimit1, limit1, thresh1) +} + +func vpxLpfHorizontal16(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, pitch, 1, 8, int(blimit), int(limit), int(thresh), 16) { + return + } + + mbLpfHorizontalEdgeW(plane, s, pitch, blimit, limit, thresh, 1) +} + +func vpxLpfHorizontal16Dual(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, pitch, 1, 16, int(blimit), int(limit), int(thresh), 16) { + return + } + + mbLpfHorizontalEdgeW(plane, s, pitch, blimit, limit, thresh, 2) +} + +func vpxLpfVertical16(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, 1, pitch, 8, int(blimit), int(limit), int(thresh), 16) { + return + } + + mbLpfVerticalEdgeW(plane, s, pitch, blimit, limit, thresh, 8) +} + +func vpxLpfVertical16Dual(plane []uint8, s, pitch int, blimit, limit, thresh uint8) { + if pixel.LoopFilter(plane, s, 1, pitch, 16, int(blimit), int(limit), int(thresh), 16) { + return + } + + mbLpfVerticalEdgeW(plane, s, pitch, blimit, limit, thresh, 16) +} + +// LfThresh mirrors libvpx's loop_filter_thresh triplet: the macroblock +// edge limit, the interior limit, and the high-edge-variance threshold +// for one filter level. libvpx stores each value pre-broadcast to a +// SIMD_WIDTH vector; the NEON kernels here dup-load single bytes, so +// the scalar triplet is enough. The three fields are guaranteed to be +// laid out at byte offsets 0/1/2 (asserted in the arm64 dispatch), +// letting kernels take one pointer per filter level exactly like +// libvpx's lfthr pointer-based dispatch. +type LfThresh struct { + Mblim uint8 + Lim uint8 + HevThr uint8 +} + +// Pointer-threshold loopfilter entry points for targets without the +// NEON dispatch: unpack the triplet and defer to the scalar paths. + +// VpxLpfHorizontal4Thr is VpxLpfHorizontal4 taking a per-level +// threshold-triplet pointer. +func VpxLpfHorizontal4Thr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfHorizontal4(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} + +// VpxLpfVertical4Thr is VpxLpfVertical4 taking a threshold pointer. +func VpxLpfVertical4Thr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfVertical4(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} + +// VpxLpfHorizontal4DualThr is VpxLpfHorizontal4Dual taking threshold +// pointers. +func VpxLpfHorizontal4DualThr(plane []uint8, s, pitch int, t0, t1 *LfThresh) { + vpxLpfHorizontal4Dual(plane, s, pitch, + t0.Mblim, t0.Lim, t0.HevThr, t1.Mblim, t1.Lim, t1.HevThr) +} + +// VpxLpfVertical4DualThr is VpxLpfVertical4Dual taking threshold +// pointers. +func VpxLpfVertical4DualThr(plane []uint8, s, pitch int, t0, t1 *LfThresh) { + vpxLpfVertical4Dual(plane, s, pitch, + t0.Mblim, t0.Lim, t0.HevThr, t1.Mblim, t1.Lim, t1.HevThr) +} + +// VpxLpfHorizontal8Thr is VpxLpfHorizontal8 taking a threshold pointer. +func VpxLpfHorizontal8Thr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfHorizontal8(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} + +// VpxLpfVertical8Thr is VpxLpfVertical8 taking a threshold pointer. +func VpxLpfVertical8Thr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfVertical8(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} + +// VpxLpfHorizontal8DualThr is VpxLpfHorizontal8Dual taking threshold +// pointers. +func VpxLpfHorizontal8DualThr(plane []uint8, s, pitch int, t0, t1 *LfThresh) { + vpxLpfHorizontal8Dual(plane, s, pitch, + t0.Mblim, t0.Lim, t0.HevThr, t1.Mblim, t1.Lim, t1.HevThr) +} + +// VpxLpfVertical8DualThr is VpxLpfVertical8Dual taking threshold +// pointers. +func VpxLpfVertical8DualThr(plane []uint8, s, pitch int, t0, t1 *LfThresh) { + vpxLpfVertical8Dual(plane, s, pitch, + t0.Mblim, t0.Lim, t0.HevThr, t1.Mblim, t1.Lim, t1.HevThr) +} + +// VpxLpfHorizontal16Thr is VpxLpfHorizontal16 taking a threshold +// pointer. +func VpxLpfHorizontal16Thr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfHorizontal16(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} + +// VpxLpfHorizontal16DualThr is VpxLpfHorizontal16Dual taking a +// threshold pointer. +func VpxLpfHorizontal16DualThr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfHorizontal16Dual(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} + +// VpxLpfVertical16Thr is VpxLpfVertical16 taking a threshold pointer. +func VpxLpfVertical16Thr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfVertical16(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} + +// VpxLpfVertical16DualThr is VpxLpfVertical16Dual taking a threshold +// pointer. +func VpxLpfVertical16DualThr(plane []uint8, s, pitch int, t *LfThresh) { + vpxLpfVertical16Dual(plane, s, pitch, t.Mblim, t.Lim, t.HevThr) +} diff --git a/internal/vp9/dsp/stubs_nosimd.go b/internal/vp9/dsp/stubs_nosimd.go new file mode 100644 index 0000000..61cc513 --- /dev/null +++ b/internal/vp9/dsp/stubs_nosimd.go @@ -0,0 +1,21 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/stubs_nosimd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build !goexperiment.simd || (!arm64 && !amd64) || purego + +package dsp + +func intraTM32Fixed(_ []byte, _ int, _, _ []byte, _ byte) bool { return false } +func intraVFixed(_ []byte, _, _ int, _ []byte) bool { return false } +func intraHFixed(_ []byte, _, _ int, _ []byte) bool { return false } +func intraDCFixed(_ []byte, _, _ int, _, _ []byte, _, _ bool) bool { return false } + +func inverseTransformGo(_ []int16, _ []byte, _ int, _ int, _ int, _ int) bool { return false } +func inverseWHTGo(_ []int16, _ []byte, _ int, _ bool) bool { return false } diff --git a/internal/vp9/dsp/transform_network_simd.go b/internal/vp9/dsp/transform_network_simd.go new file mode 100644 index 0000000..dfef3ac --- /dev/null +++ b/internal/vp9/dsp/transform_network_simd.go @@ -0,0 +1,806 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/transform_network_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +// Code generated by go run scripts/gensimd.go; DO NOT EDIT. +// Four independent codec transforms per vector; int16 casts wrap exactly. + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "simd/archsimd" +) + +func idct4Vec(input []archsimd.Int32x4, output []archsimd.Int32x4) { + _ = input[3] + _ = output[3] + var step [4]archsimd.Int32x4 + in0 := input[0] + in1 := input[1] + in2 := input[2] + in3 := input[3] + temp1 := ((in0).Add(in2)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 := ((in0).Sub(in2)).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step[0] = vecRound(temp1) + step[1] = vecRound(temp2) + temp1 = pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi24_64), (in3).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi8_64), (in3).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step[2] = vecRound(temp1) + step[3] = vecRound(temp2) + output[0] = vecWrap((step[0]).Add(step[3])) + output[1] = vecWrap((step[1]).Add(step[2])) + output[2] = vecWrap((step[1]).Sub(step[2])) + output[3] = vecWrap((step[0]).Sub(step[3])) +} + +func idct8Vec(input []archsimd.Int32x4, output []archsimd.Int32x4) { + _ = input[7] + _ = output[7] + var step1, step2 [8]archsimd.Int32x4 + in0 := input[0] + in1 := input[1] + in2 := input[2] + in3 := input[3] + in4 := input[4] + in5 := input[5] + in6 := input[6] + in7 := input[7] + step1[0] = vecWrap(in0) + step1[2] = vecWrap(in4) + step1[1] = vecWrap(in2) + step1[3] = vecWrap(in6) + temp1 := pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi28_64), (in7).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 := pixel.MulAdd4(in1, archsimd.BroadcastInt32x4(cospi4_64), (in7).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step1[4] = vecWrap(vecRound(temp1)) + step1[7] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(in5, archsimd.BroadcastInt32x4(cospi12_64), (in3).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(in5, archsimd.BroadcastInt32x4(cospi20_64), (in3).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step1[5] = vecWrap(vecRound(temp1)) + step1[6] = vecWrap(vecRound(temp2)) + temp1 = ((step1[0]).Add(step1[2])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step1[0]).Sub(step1[2])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step2[0] = vecWrap(vecRound(temp1)) + step2[1] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[1], archsimd.BroadcastInt32x4(cospi24_64), (step1[3]).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(step1[1], archsimd.BroadcastInt32x4(cospi8_64), (step1[3]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step2[2] = vecWrap(vecRound(temp1)) + step2[3] = vecWrap(vecRound(temp2)) + step2[4] = vecWrap((step1[4]).Add(step1[5])) + step2[5] = vecWrap((step1[4]).Sub(step1[5])) + step2[6] = vecWrap((step1[7]).Sub(step1[6])) + step2[7] = vecWrap((step1[6]).Add(step1[7])) + step1[0] = vecWrap((step2[0]).Add(step2[3])) + step1[1] = vecWrap((step2[1]).Add(step2[2])) + step1[2] = vecWrap((step2[1]).Sub(step2[2])) + step1[3] = vecWrap((step2[0]).Sub(step2[3])) + step1[4] = step2[4] + temp1 = ((step2[6]).Sub(step2[5])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step2[5]).Add(step2[6])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step1[5] = vecWrap(vecRound(temp1)) + step1[6] = vecWrap(vecRound(temp2)) + step1[7] = step2[7] + output[0] = vecWrap((step1[0]).Add(step1[7])) + output[1] = vecWrap((step1[1]).Add(step1[6])) + output[2] = vecWrap((step1[2]).Add(step1[5])) + output[3] = vecWrap((step1[3]).Add(step1[4])) + output[4] = vecWrap((step1[3]).Sub(step1[4])) + output[5] = vecWrap((step1[2]).Sub(step1[5])) + output[6] = vecWrap((step1[1]).Sub(step1[6])) + output[7] = vecWrap((step1[0]).Sub(step1[7])) +} + +func idct16Vec(input []archsimd.Int32x4, output []archsimd.Int32x4) { + _ = input[15] + _ = output[15] + var step1, step2 [16]archsimd.Int32x4 + step1[0] = input[0] + step1[1] = input[8] + step1[2] = input[4] + step1[3] = input[12] + step1[4] = input[2] + step1[5] = input[10] + step1[6] = input[6] + step1[7] = input[14] + step1[8] = input[1] + step1[9] = input[9] + step1[10] = input[5] + step1[11] = input[13] + step1[12] = input[3] + step1[13] = input[11] + step1[14] = input[7] + step1[15] = input[15] + step2[0] = step1[0] + step2[1] = step1[1] + step2[2] = step1[2] + step2[3] = step1[3] + step2[4] = step1[4] + step2[5] = step1[5] + step2[6] = step1[6] + step2[7] = step1[7] + temp1 := pixel.MulAdd4(step1[8], archsimd.BroadcastInt32x4(cospi30_64), (step1[15]).Mul(archsimd.BroadcastInt32x4(-cospi2_64))) + temp2 := pixel.MulAdd4(step1[8], archsimd.BroadcastInt32x4(cospi2_64), (step1[15]).Mul(archsimd.BroadcastInt32x4(cospi30_64))) + step2[8] = vecWrap(vecRound(temp1)) + step2[15] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[9], archsimd.BroadcastInt32x4(cospi14_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(-cospi18_64))) + temp2 = pixel.MulAdd4(step1[9], archsimd.BroadcastInt32x4(cospi18_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(cospi14_64))) + step2[9] = vecWrap(vecRound(temp1)) + step2[14] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[10], archsimd.BroadcastInt32x4(cospi22_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(-cospi10_64))) + temp2 = pixel.MulAdd4(step1[10], archsimd.BroadcastInt32x4(cospi10_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(cospi22_64))) + step2[10] = vecWrap(vecRound(temp1)) + step2[13] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[11], archsimd.BroadcastInt32x4(cospi6_64), (step1[12]).Mul(archsimd.BroadcastInt32x4(-cospi26_64))) + temp2 = pixel.MulAdd4(step1[11], archsimd.BroadcastInt32x4(cospi26_64), (step1[12]).Mul(archsimd.BroadcastInt32x4(cospi6_64))) + step2[11] = vecWrap(vecRound(temp1)) + step2[12] = vecWrap(vecRound(temp2)) + step1[0] = step2[0] + step1[1] = step2[1] + step1[2] = step2[2] + step1[3] = step2[3] + temp1 = pixel.MulAdd4(step2[4], archsimd.BroadcastInt32x4(cospi28_64), (step2[7]).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 = pixel.MulAdd4(step2[4], archsimd.BroadcastInt32x4(cospi4_64), (step2[7]).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step1[4] = vecWrap(vecRound(temp1)) + step1[7] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step2[5], archsimd.BroadcastInt32x4(cospi12_64), (step2[6]).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(step2[5], archsimd.BroadcastInt32x4(cospi20_64), (step2[6]).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step1[5] = vecWrap(vecRound(temp1)) + step1[6] = vecWrap(vecRound(temp2)) + step1[8] = vecWrap((step2[8]).Add(step2[9])) + step1[9] = vecWrap((step2[8]).Sub(step2[9])) + step1[10] = vecWrap((step2[11]).Sub(step2[10])) + step1[11] = vecWrap((step2[10]).Add(step2[11])) + step1[12] = vecWrap((step2[12]).Add(step2[13])) + step1[13] = vecWrap((step2[12]).Sub(step2[13])) + step1[14] = vecWrap((step2[15]).Sub(step2[14])) + step1[15] = vecWrap((step2[14]).Add(step2[15])) + temp1 = ((step1[0]).Add(step1[1])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step1[0]).Sub(step1[1])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step2[0] = vecWrap(vecRound(temp1)) + step2[1] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[2], archsimd.BroadcastInt32x4(cospi24_64), (step1[3]).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(step1[2], archsimd.BroadcastInt32x4(cospi8_64), (step1[3]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step2[2] = vecWrap(vecRound(temp1)) + step2[3] = vecWrap(vecRound(temp2)) + step2[4] = vecWrap((step1[4]).Add(step1[5])) + step2[5] = vecWrap((step1[4]).Sub(step1[5])) + step2[6] = vecWrap((step1[7]).Sub(step1[6])) + step2[7] = vecWrap((step1[6]).Add(step1[7])) + step2[8] = step1[8] + step2[15] = step1[15] + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step1[9]), archsimd.BroadcastInt32x4(cospi8_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + temp2 = pixel.MulAdd4(step1[9], archsimd.BroadcastInt32x4(cospi24_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + step2[9] = vecWrap(vecRound(temp1)) + step2[14] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step1[10]), archsimd.BroadcastInt32x4(cospi24_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step1[10]), archsimd.BroadcastInt32x4(cospi8_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step2[10] = vecWrap(vecRound(temp1)) + step2[13] = vecWrap(vecRound(temp2)) + step2[11] = step1[11] + step2[12] = step1[12] + step1[0] = vecWrap((step2[0]).Add(step2[3])) + step1[1] = vecWrap((step2[1]).Add(step2[2])) + step1[2] = vecWrap((step2[1]).Sub(step2[2])) + step1[3] = vecWrap((step2[0]).Sub(step2[3])) + step1[4] = step2[4] + temp1 = ((step2[6]).Sub(step2[5])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step2[5]).Add(step2[6])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step1[5] = vecWrap(vecRound(temp1)) + step1[6] = vecWrap(vecRound(temp2)) + step1[7] = step2[7] + step1[8] = vecWrap((step2[8]).Add(step2[11])) + step1[9] = vecWrap((step2[9]).Add(step2[10])) + step1[10] = vecWrap((step2[9]).Sub(step2[10])) + step1[11] = vecWrap((step2[8]).Sub(step2[11])) + step1[12] = vecWrap((step2[15]).Sub(step2[12])) + step1[13] = vecWrap((step2[14]).Sub(step2[13])) + step1[14] = vecWrap((step2[13]).Add(step2[14])) + step1[15] = vecWrap((step2[12]).Add(step2[15])) + step2[0] = vecWrap((step1[0]).Add(step1[7])) + step2[1] = vecWrap((step1[1]).Add(step1[6])) + step2[2] = vecWrap((step1[2]).Add(step1[5])) + step2[3] = vecWrap((step1[3]).Add(step1[4])) + step2[4] = vecWrap((step1[3]).Sub(step1[4])) + step2[5] = vecWrap((step1[2]).Sub(step1[5])) + step2[6] = vecWrap((step1[1]).Sub(step1[6])) + step2[7] = vecWrap((step1[0]).Sub(step1[7])) + step2[8] = step1[8] + step2[9] = step1[9] + temp1 = ((step1[13]).Sub(step1[10])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step1[10]).Add(step1[13])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step2[10] = vecWrap(vecRound(temp1)) + step2[13] = vecWrap(vecRound(temp2)) + temp1 = ((step1[12]).Sub(step1[11])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step1[11]).Add(step1[12])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step2[11] = vecWrap(vecRound(temp1)) + step2[12] = vecWrap(vecRound(temp2)) + step2[14] = step1[14] + step2[15] = step1[15] + output[0] = vecWrap((step2[0]).Add(step2[15])) + output[1] = vecWrap((step2[1]).Add(step2[14])) + output[2] = vecWrap((step2[2]).Add(step2[13])) + output[3] = vecWrap((step2[3]).Add(step2[12])) + output[4] = vecWrap((step2[4]).Add(step2[11])) + output[5] = vecWrap((step2[5]).Add(step2[10])) + output[6] = vecWrap((step2[6]).Add(step2[9])) + output[7] = vecWrap((step2[7]).Add(step2[8])) + output[8] = vecWrap((step2[7]).Sub(step2[8])) + output[9] = vecWrap((step2[6]).Sub(step2[9])) + output[10] = vecWrap((step2[5]).Sub(step2[10])) + output[11] = vecWrap((step2[4]).Sub(step2[11])) + output[12] = vecWrap((step2[3]).Sub(step2[12])) + output[13] = vecWrap((step2[2]).Sub(step2[13])) + output[14] = vecWrap((step2[1]).Sub(step2[14])) + output[15] = vecWrap((step2[0]).Sub(step2[15])) +} + +func idct32Vec(input []archsimd.Int32x4, output []archsimd.Int32x4) { + _ = input[31] + _ = output[31] + var step1, step2 [32]archsimd.Int32x4 + step1[0] = input[0] + step1[1] = input[16] + step1[2] = input[8] + step1[3] = input[24] + step1[4] = input[4] + step1[5] = input[20] + step1[6] = input[12] + step1[7] = input[28] + step1[8] = input[2] + step1[9] = input[18] + step1[10] = input[10] + step1[11] = input[26] + step1[12] = input[6] + step1[13] = input[22] + step1[14] = input[14] + step1[15] = input[30] + temp1 := pixel.MulAdd4(input[1], archsimd.BroadcastInt32x4(cospi31_64), (input[31]).Mul(archsimd.BroadcastInt32x4(-cospi1_64))) + temp2 := pixel.MulAdd4(input[1], archsimd.BroadcastInt32x4(cospi1_64), (input[31]).Mul(archsimd.BroadcastInt32x4(cospi31_64))) + step1[16] = vecWrap(vecRound(temp1)) + step1[31] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(input[17], archsimd.BroadcastInt32x4(cospi15_64), (input[15]).Mul(archsimd.BroadcastInt32x4(-cospi17_64))) + temp2 = pixel.MulAdd4(input[17], archsimd.BroadcastInt32x4(cospi17_64), (input[15]).Mul(archsimd.BroadcastInt32x4(cospi15_64))) + step1[17] = vecWrap(vecRound(temp1)) + step1[30] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(input[9], archsimd.BroadcastInt32x4(cospi23_64), (input[23]).Mul(archsimd.BroadcastInt32x4(-cospi9_64))) + temp2 = pixel.MulAdd4(input[9], archsimd.BroadcastInt32x4(cospi9_64), (input[23]).Mul(archsimd.BroadcastInt32x4(cospi23_64))) + step1[18] = vecWrap(vecRound(temp1)) + step1[29] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(input[25], archsimd.BroadcastInt32x4(cospi7_64), (input[7]).Mul(archsimd.BroadcastInt32x4(-cospi25_64))) + temp2 = pixel.MulAdd4(input[25], archsimd.BroadcastInt32x4(cospi25_64), (input[7]).Mul(archsimd.BroadcastInt32x4(cospi7_64))) + step1[19] = vecWrap(vecRound(temp1)) + step1[28] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(input[5], archsimd.BroadcastInt32x4(cospi27_64), (input[27]).Mul(archsimd.BroadcastInt32x4(-cospi5_64))) + temp2 = pixel.MulAdd4(input[5], archsimd.BroadcastInt32x4(cospi5_64), (input[27]).Mul(archsimd.BroadcastInt32x4(cospi27_64))) + step1[20] = vecWrap(vecRound(temp1)) + step1[27] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(input[21], archsimd.BroadcastInt32x4(cospi11_64), (input[11]).Mul(archsimd.BroadcastInt32x4(-cospi21_64))) + temp2 = pixel.MulAdd4(input[21], archsimd.BroadcastInt32x4(cospi21_64), (input[11]).Mul(archsimd.BroadcastInt32x4(cospi11_64))) + step1[21] = vecWrap(vecRound(temp1)) + step1[26] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(input[13], archsimd.BroadcastInt32x4(cospi19_64), (input[19]).Mul(archsimd.BroadcastInt32x4(-cospi13_64))) + temp2 = pixel.MulAdd4(input[13], archsimd.BroadcastInt32x4(cospi13_64), (input[19]).Mul(archsimd.BroadcastInt32x4(cospi19_64))) + step1[22] = vecWrap(vecRound(temp1)) + step1[25] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(input[29], archsimd.BroadcastInt32x4(cospi3_64), (input[3]).Mul(archsimd.BroadcastInt32x4(-cospi29_64))) + temp2 = pixel.MulAdd4(input[29], archsimd.BroadcastInt32x4(cospi29_64), (input[3]).Mul(archsimd.BroadcastInt32x4(cospi3_64))) + step1[23] = vecWrap(vecRound(temp1)) + step1[24] = vecWrap(vecRound(temp2)) + step2[0] = step1[0] + step2[1] = step1[1] + step2[2] = step1[2] + step2[3] = step1[3] + step2[4] = step1[4] + step2[5] = step1[5] + step2[6] = step1[6] + step2[7] = step1[7] + temp1 = pixel.MulAdd4(step1[8], archsimd.BroadcastInt32x4(cospi30_64), (step1[15]).Mul(archsimd.BroadcastInt32x4(-cospi2_64))) + temp2 = pixel.MulAdd4(step1[8], archsimd.BroadcastInt32x4(cospi2_64), (step1[15]).Mul(archsimd.BroadcastInt32x4(cospi30_64))) + step2[8] = vecWrap(vecRound(temp1)) + step2[15] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[9], archsimd.BroadcastInt32x4(cospi14_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(-cospi18_64))) + temp2 = pixel.MulAdd4(step1[9], archsimd.BroadcastInt32x4(cospi18_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(cospi14_64))) + step2[9] = vecWrap(vecRound(temp1)) + step2[14] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[10], archsimd.BroadcastInt32x4(cospi22_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(-cospi10_64))) + temp2 = pixel.MulAdd4(step1[10], archsimd.BroadcastInt32x4(cospi10_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(cospi22_64))) + step2[10] = vecWrap(vecRound(temp1)) + step2[13] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[11], archsimd.BroadcastInt32x4(cospi6_64), (step1[12]).Mul(archsimd.BroadcastInt32x4(-cospi26_64))) + temp2 = pixel.MulAdd4(step1[11], archsimd.BroadcastInt32x4(cospi26_64), (step1[12]).Mul(archsimd.BroadcastInt32x4(cospi6_64))) + step2[11] = vecWrap(vecRound(temp1)) + step2[12] = vecWrap(vecRound(temp2)) + step2[16] = vecWrap((step1[16]).Add(step1[17])) + step2[17] = vecWrap((step1[16]).Sub(step1[17])) + step2[18] = vecWrap((step1[19]).Sub(step1[18])) + step2[19] = vecWrap((step1[18]).Add(step1[19])) + step2[20] = vecWrap((step1[20]).Add(step1[21])) + step2[21] = vecWrap((step1[20]).Sub(step1[21])) + step2[22] = vecWrap((step1[23]).Sub(step1[22])) + step2[23] = vecWrap((step1[22]).Add(step1[23])) + step2[24] = vecWrap((step1[24]).Add(step1[25])) + step2[25] = vecWrap((step1[24]).Sub(step1[25])) + step2[26] = vecWrap((step1[27]).Sub(step1[26])) + step2[27] = vecWrap((step1[26]).Add(step1[27])) + step2[28] = vecWrap((step1[28]).Add(step1[29])) + step2[29] = vecWrap((step1[28]).Sub(step1[29])) + step2[30] = vecWrap((step1[31]).Sub(step1[30])) + step2[31] = vecWrap((step1[30]).Add(step1[31])) + step1[0] = step2[0] + step1[1] = step2[1] + step1[2] = step2[2] + step1[3] = step2[3] + temp1 = pixel.MulAdd4(step2[4], archsimd.BroadcastInt32x4(cospi28_64), (step2[7]).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 = pixel.MulAdd4(step2[4], archsimd.BroadcastInt32x4(cospi4_64), (step2[7]).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step1[4] = vecWrap(vecRound(temp1)) + step1[7] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step2[5], archsimd.BroadcastInt32x4(cospi12_64), (step2[6]).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(step2[5], archsimd.BroadcastInt32x4(cospi20_64), (step2[6]).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step1[5] = vecWrap(vecRound(temp1)) + step1[6] = vecWrap(vecRound(temp2)) + step1[8] = vecWrap((step2[8]).Add(step2[9])) + step1[9] = vecWrap((step2[8]).Sub(step2[9])) + step1[10] = vecWrap((step2[11]).Sub(step2[10])) + step1[11] = vecWrap((step2[10]).Add(step2[11])) + step1[12] = vecWrap((step2[12]).Add(step2[13])) + step1[13] = vecWrap((step2[12]).Sub(step2[13])) + step1[14] = vecWrap((step2[15]).Sub(step2[14])) + step1[15] = vecWrap((step2[14]).Add(step2[15])) + step1[16] = step2[16] + step1[31] = step2[31] + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[17]), archsimd.BroadcastInt32x4(cospi4_64), (step2[30]).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + temp2 = pixel.MulAdd4(step2[17], archsimd.BroadcastInt32x4(cospi28_64), (step2[30]).Mul(archsimd.BroadcastInt32x4(cospi4_64))) + step1[17] = vecWrap(vecRound(temp1)) + step1[30] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[18]), archsimd.BroadcastInt32x4(cospi28_64), (step2[29]).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[18]), archsimd.BroadcastInt32x4(cospi4_64), (step2[29]).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + step1[18] = vecWrap(vecRound(temp1)) + step1[29] = vecWrap(vecRound(temp2)) + step1[19] = step2[19] + step1[20] = step2[20] + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[21]), archsimd.BroadcastInt32x4(cospi20_64), (step2[26]).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + temp2 = pixel.MulAdd4(step2[21], archsimd.BroadcastInt32x4(cospi12_64), (step2[26]).Mul(archsimd.BroadcastInt32x4(cospi20_64))) + step1[21] = vecWrap(vecRound(temp1)) + step1[26] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[22]), archsimd.BroadcastInt32x4(cospi12_64), (step2[25]).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[22]), archsimd.BroadcastInt32x4(cospi20_64), (step2[25]).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + step1[22] = vecWrap(vecRound(temp1)) + step1[25] = vecWrap(vecRound(temp2)) + step1[23] = step2[23] + step1[24] = step2[24] + step1[27] = step2[27] + step1[28] = step2[28] + temp1 = ((step1[0]).Add(step1[1])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step1[0]).Sub(step1[1])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step2[0] = vecWrap(vecRound(temp1)) + step2[1] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(step1[2], archsimd.BroadcastInt32x4(cospi24_64), (step1[3]).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(step1[2], archsimd.BroadcastInt32x4(cospi8_64), (step1[3]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step2[2] = vecWrap(vecRound(temp1)) + step2[3] = vecWrap(vecRound(temp2)) + step2[4] = vecWrap((step1[4]).Add(step1[5])) + step2[5] = vecWrap((step1[4]).Sub(step1[5])) + step2[6] = vecWrap((step1[7]).Sub(step1[6])) + step2[7] = vecWrap((step1[6]).Add(step1[7])) + step2[8] = step1[8] + step2[15] = step1[15] + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step1[9]), archsimd.BroadcastInt32x4(cospi8_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + temp2 = pixel.MulAdd4(step1[9], archsimd.BroadcastInt32x4(cospi24_64), (step1[14]).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + step2[9] = vecWrap(vecRound(temp1)) + step2[14] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step1[10]), archsimd.BroadcastInt32x4(cospi24_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step1[10]), archsimd.BroadcastInt32x4(cospi8_64), (step1[13]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step2[10] = vecWrap(vecRound(temp1)) + step2[13] = vecWrap(vecRound(temp2)) + step2[11] = step1[11] + step2[12] = step1[12] + step2[16] = vecWrap((step1[16]).Add(step1[19])) + step2[17] = vecWrap((step1[17]).Add(step1[18])) + step2[18] = vecWrap((step1[17]).Sub(step1[18])) + step2[19] = vecWrap((step1[16]).Sub(step1[19])) + step2[20] = vecWrap((step1[23]).Sub(step1[20])) + step2[21] = vecWrap((step1[22]).Sub(step1[21])) + step2[22] = vecWrap((step1[21]).Add(step1[22])) + step2[23] = vecWrap((step1[20]).Add(step1[23])) + step2[24] = vecWrap((step1[24]).Add(step1[27])) + step2[25] = vecWrap((step1[25]).Add(step1[26])) + step2[26] = vecWrap((step1[25]).Sub(step1[26])) + step2[27] = vecWrap((step1[24]).Sub(step1[27])) + step2[28] = vecWrap((step1[31]).Sub(step1[28])) + step2[29] = vecWrap((step1[30]).Sub(step1[29])) + step2[30] = vecWrap((step1[29]).Add(step1[30])) + step2[31] = vecWrap((step1[28]).Add(step1[31])) + step1[0] = vecWrap((step2[0]).Add(step2[3])) + step1[1] = vecWrap((step2[1]).Add(step2[2])) + step1[2] = vecWrap((step2[1]).Sub(step2[2])) + step1[3] = vecWrap((step2[0]).Sub(step2[3])) + step1[4] = step2[4] + temp1 = ((step2[6]).Sub(step2[5])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step2[5]).Add(step2[6])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step1[5] = vecWrap(vecRound(temp1)) + step1[6] = vecWrap(vecRound(temp2)) + step1[7] = step2[7] + step1[8] = vecWrap((step2[8]).Add(step2[11])) + step1[9] = vecWrap((step2[9]).Add(step2[10])) + step1[10] = vecWrap((step2[9]).Sub(step2[10])) + step1[11] = vecWrap((step2[8]).Sub(step2[11])) + step1[12] = vecWrap((step2[15]).Sub(step2[12])) + step1[13] = vecWrap((step2[14]).Sub(step2[13])) + step1[14] = vecWrap((step2[13]).Add(step2[14])) + step1[15] = vecWrap((step2[12]).Add(step2[15])) + step1[16] = step2[16] + step1[17] = step2[17] + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[18]), archsimd.BroadcastInt32x4(cospi8_64), (step2[29]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + temp2 = pixel.MulAdd4(step2[18], archsimd.BroadcastInt32x4(cospi24_64), (step2[29]).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + step1[18] = vecWrap(vecRound(temp1)) + step1[29] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[19]), archsimd.BroadcastInt32x4(cospi8_64), (step2[28]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + temp2 = pixel.MulAdd4(step2[19], archsimd.BroadcastInt32x4(cospi24_64), (step2[28]).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + step1[19] = vecWrap(vecRound(temp1)) + step1[28] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[20]), archsimd.BroadcastInt32x4(cospi24_64), (step2[27]).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[20]), archsimd.BroadcastInt32x4(cospi8_64), (step2[27]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step1[20] = vecWrap(vecRound(temp1)) + step1[27] = vecWrap(vecRound(temp2)) + temp1 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[21]), archsimd.BroadcastInt32x4(cospi24_64), (step2[26]).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + temp2 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(step2[21]), archsimd.BroadcastInt32x4(cospi8_64), (step2[26]).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + step1[21] = vecWrap(vecRound(temp1)) + step1[26] = vecWrap(vecRound(temp2)) + step1[22] = step2[22] + step1[23] = step2[23] + step1[24] = step2[24] + step1[25] = step2[25] + step1[30] = step2[30] + step1[31] = step2[31] + step2[0] = vecWrap((step1[0]).Add(step1[7])) + step2[1] = vecWrap((step1[1]).Add(step1[6])) + step2[2] = vecWrap((step1[2]).Add(step1[5])) + step2[3] = vecWrap((step1[3]).Add(step1[4])) + step2[4] = vecWrap((step1[3]).Sub(step1[4])) + step2[5] = vecWrap((step1[2]).Sub(step1[5])) + step2[6] = vecWrap((step1[1]).Sub(step1[6])) + step2[7] = vecWrap((step1[0]).Sub(step1[7])) + step2[8] = step1[8] + step2[9] = step1[9] + temp1 = ((step1[13]).Sub(step1[10])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step1[10]).Add(step1[13])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step2[10] = vecWrap(vecRound(temp1)) + step2[13] = vecWrap(vecRound(temp2)) + temp1 = ((step1[12]).Sub(step1[11])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step1[11]).Add(step1[12])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step2[11] = vecWrap(vecRound(temp1)) + step2[12] = vecWrap(vecRound(temp2)) + step2[14] = step1[14] + step2[15] = step1[15] + step2[16] = vecWrap((step1[16]).Add(step1[23])) + step2[17] = vecWrap((step1[17]).Add(step1[22])) + step2[18] = vecWrap((step1[18]).Add(step1[21])) + step2[19] = vecWrap((step1[19]).Add(step1[20])) + step2[20] = vecWrap((step1[19]).Sub(step1[20])) + step2[21] = vecWrap((step1[18]).Sub(step1[21])) + step2[22] = vecWrap((step1[17]).Sub(step1[22])) + step2[23] = vecWrap((step1[16]).Sub(step1[23])) + step2[24] = vecWrap((step1[31]).Sub(step1[24])) + step2[25] = vecWrap((step1[30]).Sub(step1[25])) + step2[26] = vecWrap((step1[29]).Sub(step1[26])) + step2[27] = vecWrap((step1[28]).Sub(step1[27])) + step2[28] = vecWrap((step1[27]).Add(step1[28])) + step2[29] = vecWrap((step1[26]).Add(step1[29])) + step2[30] = vecWrap((step1[25]).Add(step1[30])) + step2[31] = vecWrap((step1[24]).Add(step1[31])) + step1[0] = vecWrap((step2[0]).Add(step2[15])) + step1[1] = vecWrap((step2[1]).Add(step2[14])) + step1[2] = vecWrap((step2[2]).Add(step2[13])) + step1[3] = vecWrap((step2[3]).Add(step2[12])) + step1[4] = vecWrap((step2[4]).Add(step2[11])) + step1[5] = vecWrap((step2[5]).Add(step2[10])) + step1[6] = vecWrap((step2[6]).Add(step2[9])) + step1[7] = vecWrap((step2[7]).Add(step2[8])) + step1[8] = vecWrap((step2[7]).Sub(step2[8])) + step1[9] = vecWrap((step2[6]).Sub(step2[9])) + step1[10] = vecWrap((step2[5]).Sub(step2[10])) + step1[11] = vecWrap((step2[4]).Sub(step2[11])) + step1[12] = vecWrap((step2[3]).Sub(step2[12])) + step1[13] = vecWrap((step2[2]).Sub(step2[13])) + step1[14] = vecWrap((step2[1]).Sub(step2[14])) + step1[15] = vecWrap((step2[0]).Sub(step2[15])) + step1[16] = step2[16] + step1[17] = step2[17] + step1[18] = step2[18] + step1[19] = step2[19] + temp1 = ((step2[27]).Sub(step2[20])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step2[20]).Add(step2[27])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step1[20] = vecWrap(vecRound(temp1)) + step1[27] = vecWrap(vecRound(temp2)) + temp1 = ((step2[26]).Sub(step2[21])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step2[21]).Add(step2[26])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step1[21] = vecWrap(vecRound(temp1)) + step1[26] = vecWrap(vecRound(temp2)) + temp1 = ((step2[25]).Sub(step2[22])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step2[22]).Add(step2[25])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step1[22] = vecWrap(vecRound(temp1)) + step1[25] = vecWrap(vecRound(temp2)) + temp1 = ((step2[24]).Sub(step2[23])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + temp2 = ((step2[23]).Add(step2[24])).Mul(archsimd.BroadcastInt32x4(cospi16_64)) + step1[23] = vecWrap(vecRound(temp1)) + step1[24] = vecWrap(vecRound(temp2)) + step1[28] = step2[28] + step1[29] = step2[29] + step1[30] = step2[30] + step1[31] = step2[31] + output[0] = vecWrap((step1[0]).Add(step1[31])) + output[1] = vecWrap((step1[1]).Add(step1[30])) + output[2] = vecWrap((step1[2]).Add(step1[29])) + output[3] = vecWrap((step1[3]).Add(step1[28])) + output[4] = vecWrap((step1[4]).Add(step1[27])) + output[5] = vecWrap((step1[5]).Add(step1[26])) + output[6] = vecWrap((step1[6]).Add(step1[25])) + output[7] = vecWrap((step1[7]).Add(step1[24])) + output[8] = vecWrap((step1[8]).Add(step1[23])) + output[9] = vecWrap((step1[9]).Add(step1[22])) + output[10] = vecWrap((step1[10]).Add(step1[21])) + output[11] = vecWrap((step1[11]).Add(step1[20])) + output[12] = vecWrap((step1[12]).Add(step1[19])) + output[13] = vecWrap((step1[13]).Add(step1[18])) + output[14] = vecWrap((step1[14]).Add(step1[17])) + output[15] = vecWrap((step1[15]).Add(step1[16])) + output[16] = vecWrap((step1[15]).Sub(step1[16])) + output[17] = vecWrap((step1[14]).Sub(step1[17])) + output[18] = vecWrap((step1[13]).Sub(step1[18])) + output[19] = vecWrap((step1[12]).Sub(step1[19])) + output[20] = vecWrap((step1[11]).Sub(step1[20])) + output[21] = vecWrap((step1[10]).Sub(step1[21])) + output[22] = vecWrap((step1[9]).Sub(step1[22])) + output[23] = vecWrap((step1[8]).Sub(step1[23])) + output[24] = vecWrap((step1[7]).Sub(step1[24])) + output[25] = vecWrap((step1[6]).Sub(step1[25])) + output[26] = vecWrap((step1[5]).Sub(step1[26])) + output[27] = vecWrap((step1[4]).Sub(step1[27])) + output[28] = vecWrap((step1[3]).Sub(step1[28])) + output[29] = vecWrap((step1[2]).Sub(step1[29])) + output[30] = vecWrap((step1[1]).Sub(step1[30])) + output[31] = vecWrap((step1[0]).Sub(step1[31])) +} + +func Iadst4Vec(input []archsimd.Int32x4, output []archsimd.Int32x4) { + _ = input[3] + _ = output[3] + x0 := input[0] + x1 := input[1] + x2 := input[2] + x3 := input[3] + s0 := (archsimd.BroadcastInt32x4(sinpi1_9)).Mul(x0) + s1 := (archsimd.BroadcastInt32x4(sinpi2_9)).Mul(x0) + s2 := (archsimd.BroadcastInt32x4(sinpi3_9)).Mul(x1) + s3 := (archsimd.BroadcastInt32x4(sinpi4_9)).Mul(x2) + s4 := (archsimd.BroadcastInt32x4(sinpi1_9)).Mul(x2) + s5 := (archsimd.BroadcastInt32x4(sinpi2_9)).Mul(x3) + s6 := (archsimd.BroadcastInt32x4(sinpi4_9)).Mul(x3) + s7 := vecWrap(((x0).Sub(x2)).Add(x3)) + s0 = ((s0).Add(s3)).Add(s5) + s1 = ((s1).Sub(s4)).Sub(s6) + s3 = s2 + s2 = (archsimd.BroadcastInt32x4(sinpi3_9)).Mul(s7) + output[0] = vecWrap(vecRound((s0).Add(s3))) + output[1] = vecWrap(vecRound((s1).Add(s3))) + output[2] = vecWrap(vecRound(s2)) + output[3] = vecWrap(vecRound(((s0).Add(s1)).Sub(s3))) +} + +func iadst8Vec(input []archsimd.Int32x4, output []archsimd.Int32x4) { + _ = input[7] + _ = output[7] + x0 := input[7] + x1 := input[0] + x2 := input[5] + x3 := input[2] + x4 := input[3] + x5 := input[4] + x6 := input[1] + x7 := input[6] + s0 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi2_64), x0, (archsimd.BroadcastInt32x4(cospi30_64)).Mul(x1)) + s1 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi30_64), x0, (archsimd.BroadcastInt32x4(cospi2_64)).Mul(archsimd.Int32x4{}.Sub(x1))) + s2 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi10_64), x2, (archsimd.BroadcastInt32x4(cospi22_64)).Mul(x3)) + s3 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi22_64), x2, (archsimd.BroadcastInt32x4(cospi10_64)).Mul(archsimd.Int32x4{}.Sub(x3))) + s4 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi18_64), x4, (archsimd.BroadcastInt32x4(cospi14_64)).Mul(x5)) + s5 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi14_64), x4, (archsimd.BroadcastInt32x4(cospi18_64)).Mul(archsimd.Int32x4{}.Sub(x5))) + s6 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi26_64), x6, (archsimd.BroadcastInt32x4(cospi6_64)).Mul(x7)) + s7 := pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi6_64), x6, (archsimd.BroadcastInt32x4(cospi26_64)).Mul(archsimd.Int32x4{}.Sub(x7))) + x0 = vecWrap(vecRound((s0).Add(s4))) + x1 = vecWrap(vecRound((s1).Add(s5))) + x2 = vecWrap(vecRound((s2).Add(s6))) + x3 = vecWrap(vecRound((s3).Add(s7))) + x4 = vecWrap(vecRound((s0).Sub(s4))) + x5 = vecWrap(vecRound((s1).Sub(s5))) + x6 = vecWrap(vecRound((s2).Sub(s6))) + x7 = vecWrap(vecRound((s3).Sub(s7))) + s0 = x0 + s1 = x1 + s2 = x2 + s3 = x3 + s4 = pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi8_64), x4, (archsimd.BroadcastInt32x4(cospi24_64)).Mul(x5)) + s5 = pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi24_64), x4, (archsimd.BroadcastInt32x4(cospi8_64)).Mul(archsimd.Int32x4{}.Sub(x5))) + s6 = pixel.MulAdd4(archsimd.BroadcastInt32x4(-cospi24_64), x6, (archsimd.BroadcastInt32x4(cospi8_64)).Mul(x7)) + s7 = pixel.MulAdd4(archsimd.BroadcastInt32x4(cospi8_64), x6, (archsimd.BroadcastInt32x4(cospi24_64)).Mul(x7)) + x0 = vecWrap((s0).Add(s2)) + x1 = vecWrap((s1).Add(s3)) + x2 = vecWrap((s0).Sub(s2)) + x3 = vecWrap((s1).Sub(s3)) + x4 = vecWrap(vecRound((s4).Add(s6))) + x5 = vecWrap(vecRound((s5).Add(s7))) + x6 = vecWrap(vecRound((s4).Sub(s6))) + x7 = vecWrap(vecRound((s5).Sub(s7))) + s2 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x2).Add(x3))) + s3 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x2).Sub(x3))) + s6 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x6).Add(x7))) + s7 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x6).Sub(x7))) + x2 = vecWrap(vecRound(s2)) + x3 = vecWrap(vecRound(s3)) + x6 = vecWrap(vecRound(s6)) + x7 = vecWrap(vecRound(s7)) + output[0] = vecWrap(x0) + output[1] = archsimd.Int32x4{}.Sub(vecWrap(x4)) + output[2] = vecWrap(x6) + output[3] = archsimd.Int32x4{}.Sub(vecWrap(x2)) + output[4] = vecWrap(x3) + output[5] = archsimd.Int32x4{}.Sub(vecWrap(x7)) + output[6] = vecWrap(x5) + output[7] = archsimd.Int32x4{}.Sub(vecWrap(x1)) +} + +func iadst16Vec(input []archsimd.Int32x4, output []archsimd.Int32x4) { + _ = input[15] + _ = output[15] + x0 := input[15] + x1 := input[0] + x2 := input[13] + x3 := input[2] + x4 := input[11] + x5 := input[4] + x6 := input[9] + x7 := input[6] + x8 := input[7] + x9 := input[8] + x10 := input[5] + x11 := input[10] + x12 := input[3] + x13 := input[12] + x14 := input[1] + x15 := input[14] + s0 := pixel.MulAdd4(x0, archsimd.BroadcastInt32x4(cospi1_64), (x1).Mul(archsimd.BroadcastInt32x4(cospi31_64))) + s1 := pixel.MulAdd4(x0, archsimd.BroadcastInt32x4(cospi31_64), (x1).Mul(archsimd.BroadcastInt32x4(-cospi1_64))) + s2 := pixel.MulAdd4(x2, archsimd.BroadcastInt32x4(cospi5_64), (x3).Mul(archsimd.BroadcastInt32x4(cospi27_64))) + s3 := pixel.MulAdd4(x2, archsimd.BroadcastInt32x4(cospi27_64), (x3).Mul(archsimd.BroadcastInt32x4(-cospi5_64))) + s4 := pixel.MulAdd4(x4, archsimd.BroadcastInt32x4(cospi9_64), (x5).Mul(archsimd.BroadcastInt32x4(cospi23_64))) + s5 := pixel.MulAdd4(x4, archsimd.BroadcastInt32x4(cospi23_64), (x5).Mul(archsimd.BroadcastInt32x4(-cospi9_64))) + s6 := pixel.MulAdd4(x6, archsimd.BroadcastInt32x4(cospi13_64), (x7).Mul(archsimd.BroadcastInt32x4(cospi19_64))) + s7 := pixel.MulAdd4(x6, archsimd.BroadcastInt32x4(cospi19_64), (x7).Mul(archsimd.BroadcastInt32x4(-cospi13_64))) + s8 := pixel.MulAdd4(x8, archsimd.BroadcastInt32x4(cospi17_64), (x9).Mul(archsimd.BroadcastInt32x4(cospi15_64))) + s9 := pixel.MulAdd4(x8, archsimd.BroadcastInt32x4(cospi15_64), (x9).Mul(archsimd.BroadcastInt32x4(-cospi17_64))) + s10 := pixel.MulAdd4(x10, archsimd.BroadcastInt32x4(cospi21_64), (x11).Mul(archsimd.BroadcastInt32x4(cospi11_64))) + s11 := pixel.MulAdd4(x10, archsimd.BroadcastInt32x4(cospi11_64), (x11).Mul(archsimd.BroadcastInt32x4(-cospi21_64))) + s12 := pixel.MulAdd4(x12, archsimd.BroadcastInt32x4(cospi25_64), (x13).Mul(archsimd.BroadcastInt32x4(cospi7_64))) + s13 := pixel.MulAdd4(x12, archsimd.BroadcastInt32x4(cospi7_64), (x13).Mul(archsimd.BroadcastInt32x4(-cospi25_64))) + s14 := pixel.MulAdd4(x14, archsimd.BroadcastInt32x4(cospi29_64), (x15).Mul(archsimd.BroadcastInt32x4(cospi3_64))) + s15 := pixel.MulAdd4(x14, archsimd.BroadcastInt32x4(cospi3_64), (x15).Mul(archsimd.BroadcastInt32x4(-cospi29_64))) + x0 = vecWrap(vecRound((s0).Add(s8))) + x1 = vecWrap(vecRound((s1).Add(s9))) + x2 = vecWrap(vecRound((s2).Add(s10))) + x3 = vecWrap(vecRound((s3).Add(s11))) + x4 = vecWrap(vecRound((s4).Add(s12))) + x5 = vecWrap(vecRound((s5).Add(s13))) + x6 = vecWrap(vecRound((s6).Add(s14))) + x7 = vecWrap(vecRound((s7).Add(s15))) + x8 = vecWrap(vecRound((s0).Sub(s8))) + x9 = vecWrap(vecRound((s1).Sub(s9))) + x10 = vecWrap(vecRound((s2).Sub(s10))) + x11 = vecWrap(vecRound((s3).Sub(s11))) + x12 = vecWrap(vecRound((s4).Sub(s12))) + x13 = vecWrap(vecRound((s5).Sub(s13))) + x14 = vecWrap(vecRound((s6).Sub(s14))) + x15 = vecWrap(vecRound((s7).Sub(s15))) + s0 = x0 + s1 = x1 + s2 = x2 + s3 = x3 + s4 = x4 + s5 = x5 + s6 = x6 + s7 = x7 + s8 = pixel.MulAdd4(x8, archsimd.BroadcastInt32x4(cospi4_64), (x9).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + s9 = pixel.MulAdd4(x8, archsimd.BroadcastInt32x4(cospi28_64), (x9).Mul(archsimd.BroadcastInt32x4(-cospi4_64))) + s10 = pixel.MulAdd4(x10, archsimd.BroadcastInt32x4(cospi20_64), (x11).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + s11 = pixel.MulAdd4(x10, archsimd.BroadcastInt32x4(cospi12_64), (x11).Mul(archsimd.BroadcastInt32x4(-cospi20_64))) + s12 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(x12), archsimd.BroadcastInt32x4(cospi28_64), (x13).Mul(archsimd.BroadcastInt32x4(cospi4_64))) + s13 = pixel.MulAdd4(x12, archsimd.BroadcastInt32x4(cospi4_64), (x13).Mul(archsimd.BroadcastInt32x4(cospi28_64))) + s14 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(x14), archsimd.BroadcastInt32x4(cospi12_64), (x15).Mul(archsimd.BroadcastInt32x4(cospi20_64))) + s15 = pixel.MulAdd4(x14, archsimd.BroadcastInt32x4(cospi20_64), (x15).Mul(archsimd.BroadcastInt32x4(cospi12_64))) + x0 = vecWrap((s0).Add(s4)) + x1 = vecWrap((s1).Add(s5)) + x2 = vecWrap((s2).Add(s6)) + x3 = vecWrap((s3).Add(s7)) + x4 = vecWrap((s0).Sub(s4)) + x5 = vecWrap((s1).Sub(s5)) + x6 = vecWrap((s2).Sub(s6)) + x7 = vecWrap((s3).Sub(s7)) + x8 = vecWrap(vecRound((s8).Add(s12))) + x9 = vecWrap(vecRound((s9).Add(s13))) + x10 = vecWrap(vecRound((s10).Add(s14))) + x11 = vecWrap(vecRound((s11).Add(s15))) + x12 = vecWrap(vecRound((s8).Sub(s12))) + x13 = vecWrap(vecRound((s9).Sub(s13))) + x14 = vecWrap(vecRound((s10).Sub(s14))) + x15 = vecWrap(vecRound((s11).Sub(s15))) + s0 = x0 + s1 = x1 + s2 = x2 + s3 = x3 + s4 = pixel.MulAdd4(x4, archsimd.BroadcastInt32x4(cospi8_64), (x5).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + s5 = pixel.MulAdd4(x4, archsimd.BroadcastInt32x4(cospi24_64), (x5).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + s6 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(x6), archsimd.BroadcastInt32x4(cospi24_64), (x7).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + s7 = pixel.MulAdd4(x6, archsimd.BroadcastInt32x4(cospi8_64), (x7).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + s8 = x8 + s9 = x9 + s10 = x10 + s11 = x11 + s12 = pixel.MulAdd4(x12, archsimd.BroadcastInt32x4(cospi8_64), (x13).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + s13 = pixel.MulAdd4(x12, archsimd.BroadcastInt32x4(cospi24_64), (x13).Mul(archsimd.BroadcastInt32x4(-cospi8_64))) + s14 = pixel.MulAdd4(archsimd.Int32x4{}.Sub(x14), archsimd.BroadcastInt32x4(cospi24_64), (x15).Mul(archsimd.BroadcastInt32x4(cospi8_64))) + s15 = pixel.MulAdd4(x14, archsimd.BroadcastInt32x4(cospi8_64), (x15).Mul(archsimd.BroadcastInt32x4(cospi24_64))) + x0 = vecWrap((s0).Add(s2)) + x1 = vecWrap((s1).Add(s3)) + x2 = vecWrap((s0).Sub(s2)) + x3 = vecWrap((s1).Sub(s3)) + x4 = vecWrap(vecRound((s4).Add(s6))) + x5 = vecWrap(vecRound((s5).Add(s7))) + x6 = vecWrap(vecRound((s4).Sub(s6))) + x7 = vecWrap(vecRound((s5).Sub(s7))) + x8 = vecWrap((s8).Add(s10)) + x9 = vecWrap((s9).Add(s11)) + x10 = vecWrap((s8).Sub(s10)) + x11 = vecWrap((s9).Sub(s11)) + x12 = vecWrap(vecRound((s12).Add(s14))) + x13 = vecWrap(vecRound((s13).Add(s15))) + x14 = vecWrap(vecRound((s12).Sub(s14))) + x15 = vecWrap(vecRound((s13).Sub(s15))) + s2 = (archsimd.BroadcastInt32x4(-cospi16_64)).Mul(((x2).Add(x3))) + s3 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x2).Sub(x3))) + s6 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x6).Add(x7))) + s7 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x7).Sub(x6))) + s10 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x10).Add(x11))) + s11 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x11).Sub(x10))) + s14 = (archsimd.BroadcastInt32x4(-cospi16_64)).Mul(((x14).Add(x15))) + s15 = (archsimd.BroadcastInt32x4(cospi16_64)).Mul(((x14).Sub(x15))) + x2 = vecWrap(vecRound(s2)) + x3 = vecWrap(vecRound(s3)) + x6 = vecWrap(vecRound(s6)) + x7 = vecWrap(vecRound(s7)) + x10 = vecWrap(vecRound(s10)) + x11 = vecWrap(vecRound(s11)) + x14 = vecWrap(vecRound(s14)) + x15 = vecWrap(vecRound(s15)) + output[0] = vecWrap(x0) + output[1] = archsimd.Int32x4{}.Sub(vecWrap(x8)) + output[2] = vecWrap(x12) + output[3] = archsimd.Int32x4{}.Sub(vecWrap(x4)) + output[4] = vecWrap(x6) + output[5] = vecWrap(x14) + output[6] = vecWrap(x10) + output[7] = vecWrap(x2) + output[8] = vecWrap(x3) + output[9] = vecWrap(x11) + output[10] = vecWrap(x15) + output[11] = vecWrap(x7) + output[12] = vecWrap(x5) + output[13] = archsimd.Int32x4{}.Sub(vecWrap(x13)) + output[14] = vecWrap(x9) + output[15] = archsimd.Int32x4{}.Sub(vecWrap(x1)) +} diff --git a/internal/vp9/dsp/transform_simd.go b/internal/vp9/dsp/transform_simd.go new file mode 100644 index 0000000..66c1e3d --- /dev/null +++ b/internal/vp9/dsp/transform_simd.go @@ -0,0 +1,134 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/transform_simd.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && (arm64 || amd64) && !purego + +package dsp + +import ( + "github.com/go-avkit/vpx/internal/pixel" + "simd/archsimd" +) + +func vecRound(v archsimd.Int32x4) archsimd.Int32x4 { return pixel.RoundTransform4(v) } +func vecWrap(v archsimd.Int32x4) archsimd.Int32x4 { return pixel.WrapTransform4(v) } +func inverseNetwork(in, out []archsimd.Int32x4, n int, adst bool) { + switch n { + case 4: + if adst { + Iadst4Vec(in, out) + } else { + idct4Vec(in, out) + } + case 8: + if adst { + iadst8Vec(in, out) + } else { + idct8Vec(in, out) + } + case 16: + if adst { + iadst16Vec(in, out) + } else { + idct16Vec(in, out) + } + case 32: + idct32Vec(in, out) + } +} +func inverseTransformGo(input []int16, dst []byte, stride, n, rows, tx int) bool { + if !pixel.Enabled || len(input) < n*rows || stride < n || len(dst) < (n-1)*stride+n { + return false + } + if tx == 0 { + if inverseDCTWideGo(input, dst, stride, n, rows) { + return true + } + switch n { + case 4: + return inverseDCT4Go(input, dst, stride, rows) + case 8: + return inverseDCT8Go(input, dst, stride, rows) + case 16: + return inverseDCT16Go(input, dst, stride, rows) + } + } + return inverseTransformGenericGo(input, dst, stride, n, rows, tx) +} + +func inverseTransformGenericGo(input []int16, dst []byte, stride, n, rows, tx int) bool { + var tmp [1024]int32 + var in, out [32]archsimd.Int32x4 + for row := 0; row < rows; row += 4 { + for j := 0; j < n; j += 4 { + in[j], in[j+1], in[j+2], in[j+3] = pixel.Transpose4(pixel.Load4(input[(row+0)*n+j:]), pixel.Load4(input[(row+1)*n+j:]), pixel.Load4(input[(row+2)*n+j:]), pixel.Load4(input[(row+3)*n+j:])) + } + inverseNetwork(in[:], out[:], n, tx == 2 || tx == 3) + for j := 0; j < n; j += 4 { + a, b, c, d := pixel.Transpose4(out[j], out[j+1], out[j+2], out[j+3]) + a.Store(tmp[(row+0)*n+j:]) + b.Store(tmp[(row+1)*n+j:]) + c.Store(tmp[(row+2)*n+j:]) + d.Store(tmp[(row+3)*n+j:]) + } + } + shift := uint64(6) + if n == 4 { + shift = 4 + } else if n == 8 { + shift = 5 + } + bias := archsimd.BroadcastInt32x4(int32(1 << (shift - 1))) + for col := 0; col < n; col += 4 { + for row := range n { + in[row] = archsimd.LoadInt32x4(tmp[row*n+col:]) + } + inverseNetwork(in[:], out[:], n, tx == 1 || tx == 3) + for row := range n { + d := dst[row*stride+col:] + v := out[row].Add(bias).ShiftAllRight(shift).Add(pixel.LoadPixels4(d)) + pixel.StorePixels4(d, v) + } + } + return true +} + +// Inverse lossless WHT uses reversible lifting and wraps after the row pass. +func inverseWHTGo(input []int16, dst []byte, stride int, dc bool) bool { + if !pixel.Enabled { + return false + } + var onlyDC [16]int16 + if dc { + onlyDC[0] = input[0] + input = onlyDC[:] + } + a, c, d, b := pixel.Transpose4(pixel.Load4(input).ShiftAllRight(2), pixel.Load4(input[4:]).ShiftAllRight(2), pixel.Load4(input[8:]).ShiftAllRight(2), pixel.Load4(input[12:]).ShiftAllRight(2)) + a = a.Add(c) + d = d.Sub(b) + e := a.Sub(d).ShiftAllRight(1) + b = e.Sub(b) + c = e.Sub(c) + a = a.Sub(b) + d = d.Add(c) + a, c, d, b = pixel.Transpose4(vecWrap(a), vecWrap(b), vecWrap(c), vecWrap(d)) + a = a.Add(c) + d = d.Sub(b) + e = a.Sub(d).ShiftAllRight(1) + b = e.Sub(b) + c = e.Sub(c) + a = a.Sub(b) + d = d.Add(c) + pixel.StorePixels4(dst, a.Add(pixel.LoadPixels4(dst))) + pixel.StorePixels4(dst[stride:], b.Add(pixel.LoadPixels4(dst[stride:]))) + pixel.StorePixels4(dst[2*stride:], c.Add(pixel.LoadPixels4(dst[2*stride:]))) + pixel.StorePixels4(dst[3*stride:], d.Add(pixel.LoadPixels4(dst[3*stride:]))) + return true +} diff --git a/internal/vp9/dsp/transform_wide_amd64.go b/internal/vp9/dsp/transform_wide_amd64.go new file mode 100644 index 0000000..63e8a32 --- /dev/null +++ b/internal/vp9/dsp/transform_wide_amd64.go @@ -0,0 +1,23 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/transform_wide_amd64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && amd64 && !purego + +package dsp + +func inverseDCTWideGo(input []int16, dst []byte, stride, n, rows int) bool { + switch n { + case 8: + return inverseDCT8AVX2(input, dst, stride, rows) + case 16: + return inverseDCT16AVX2(input, dst, stride, rows) + } + return false +} diff --git a/internal/vp9/dsp/transform_wide_arm64.go b/internal/vp9/dsp/transform_wide_arm64.go new file mode 100644 index 0000000..e957827 --- /dev/null +++ b/internal/vp9/dsp/transform_wide_arm64.go @@ -0,0 +1,20 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/dsp/transform_wide_arm64.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +//go:build goexperiment.simd && arm64 && !purego + +package dsp + +func inverseDCTWideGo(input []int16, dst []byte, stride, n, rows int) bool { + if n == 8 { + return inverseDCT8ARM(input, dst, stride, rows) + } + return false +} diff --git a/internal/vp9/rtp/rtp.go b/internal/vp9/rtp/rtp.go new file mode 100644 index 0000000..868b306 --- /dev/null +++ b/internal/vp9/rtp/rtp.go @@ -0,0 +1,652 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/rtp/rtp.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Package rtp implements VP9 RTP payload descriptors and frame fragment +// assembly. libvpx v1.16.0 does not provide these RTP packetization helpers; +// the wire format follows RFC 9628. +package rtp + +import ( + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" + vpxrtp "github.com/go-avkit/vpx/internal/vpx/rtp" +) + +const ( + vp9RTPFlagPictureID = 0x80 + vp9RTPFlagInterPicturePredicted = 0x40 + vp9RTPFlagLayerIndices = 0x20 + vp9RTPFlagFlexibleMode = 0x10 + vp9RTPFlagStartOfFrame = 0x08 + vp9RTPFlagEndOfFrame = 0x04 + vp9RTPFlagScalabilityStructure = 0x02 + vp9RTPFlagNotRefUpperSpatial = 0x01 +) + +const ( + // MaxReferenceIndices is the maximum number of reference-index + // entries in a VP9 RTP payload descriptor or scalability-structure entry. + MaxReferenceIndices = 3 + // MaxSpatialLayers is the maximum number of spatial layers described + // by a VP9 RTP scalability structure. + MaxSpatialLayers = 8 +) + +// PayloadDescriptor describes the VP9 RTP payload descriptor from RFC +// 9628. It is the bytes after the RTP header and before the raw VP9 payload. +type PayloadDescriptor struct { + PictureIDPresent bool + PictureID uint16 + PictureID15Bit bool + + InterPicturePredicted bool + LayerIndicesPresent bool + FlexibleMode bool + StartOfFrame bool + EndOfFrame bool + ScalabilityStructurePresent bool + NotRefForUpperSpatialLayer bool + + TemporalID uint8 + SwitchingUpPoint bool + SpatialID uint8 + InterLayerDependency bool + TL0PICIDX uint8 + ReferenceIndexCount int + ReferenceIndices [MaxReferenceIndices]uint8 + ScalabilityStructure ScalabilityStructure +} + +// ScalabilityStructure describes the optional VP9 RTP scalability +// structure. SpatialLayerCount defaults to one when marshaling. +type ScalabilityStructure struct { + SpatialLayerCount int + ResolutionPresent bool + Width [MaxSpatialLayers]uint16 + Height [MaxSpatialLayers]uint16 + + PictureGroupPresent bool + PictureGroups []PictureGroup +} + +// PictureGroup describes one picture-group entry in a VP9 RTP +// scalability structure. +type PictureGroup struct { + TemporalID uint8 + SwitchingUpPoint bool + ReferenceIndexCount int + ReferenceIndices [MaxReferenceIndices]uint8 +} + +// Size returns the number of bytes needed to marshal d, excluding the raw VP9 +// payload bytes. +func (d PayloadDescriptor) Size() (int, error) { + if err := d.validate(); err != nil { + return 0, err + } + size := 1 + if d.PictureIDPresent { + pidSize, err := d.pictureID().Size() + if err != nil { + return 0, err + } + size += pidSize + } + if d.LayerIndicesPresent { + size++ + if !d.FlexibleMode { + size++ + } + } + if d.InterPicturePredicted && d.FlexibleMode { + size += d.ReferenceIndexCount + } + if d.ScalabilityStructurePresent { + ssSize, err := d.ScalabilityStructure.size() + if err != nil { + return 0, err + } + size += ssSize + } + return size, nil +} + +// MarshalInto writes d into dst and returns the descriptor length. If dst is +// too small, it returns the required descriptor length and [vpxerrors.ErrBufferTooSmall]. +func (d PayloadDescriptor) MarshalInto(dst []byte) (int, error) { + need, err := d.Size() + if err != nil { + return 0, err + } + if len(dst) < need { + return need, vpxerrors.ErrBufferTooSmall + } + + var first byte + if d.PictureIDPresent { + first |= vp9RTPFlagPictureID + } + if d.InterPicturePredicted { + first |= vp9RTPFlagInterPicturePredicted + } + if d.LayerIndicesPresent { + first |= vp9RTPFlagLayerIndices + } + if d.FlexibleMode { + first |= vp9RTPFlagFlexibleMode + } + if d.StartOfFrame { + first |= vp9RTPFlagStartOfFrame + } + if d.EndOfFrame { + first |= vp9RTPFlagEndOfFrame + } + if d.ScalabilityStructurePresent { + first |= vp9RTPFlagScalabilityStructure + } + if d.NotRefForUpperSpatialLayer { + first |= vp9RTPFlagNotRefUpperSpatial + } + + dst[0] = first + off := 1 + if d.PictureIDPresent { + n, err := d.pictureID().MarshalInto(dst[off:]) + if err != nil { + return 0, err + } + off += n + } + if d.LayerIndicesPresent { + layer := d.TemporalID<<5 | d.SpatialID<<1 + if d.SwitchingUpPoint { + layer |= 0x10 + } + if d.InterLayerDependency { + layer |= 0x01 + } + dst[off] = layer + off++ + if !d.FlexibleMode { + dst[off] = d.TL0PICIDX + off++ + } + } + if d.InterPicturePredicted && d.FlexibleMode { + for i := 0; i < d.ReferenceIndexCount; i++ { + ref := d.ReferenceIndices[i] << 1 + if i+1 < d.ReferenceIndexCount { + ref |= 0x01 + } + dst[off] = ref + off++ + } + } + if d.ScalabilityStructurePresent { + off += d.ScalabilityStructure.marshalInto(dst[off:]) + } + return need, nil +} + +// Marshal returns d as a newly allocated VP9 RTP payload descriptor. +func (d PayloadDescriptor) Marshal() ([]byte, error) { + return vpxrtp.MarshalDescriptor(d) +} + +// ParsePayloadDescriptor parses the VP9 RTP payload descriptor at the +// front of packet and returns the descriptor plus the remaining raw VP9 +// payload bytes. +func ParsePayloadDescriptor(packet []byte) (PayloadDescriptor, []byte, error) { + if len(packet) == 0 { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + first := packet[0] + d := PayloadDescriptor{ + PictureIDPresent: first&vp9RTPFlagPictureID != 0, + InterPicturePredicted: first&vp9RTPFlagInterPicturePredicted != 0, + LayerIndicesPresent: first&vp9RTPFlagLayerIndices != 0, + FlexibleMode: first&vp9RTPFlagFlexibleMode != 0, + StartOfFrame: first&vp9RTPFlagStartOfFrame != 0, + EndOfFrame: first&vp9RTPFlagEndOfFrame != 0, + ScalabilityStructurePresent: first&vp9RTPFlagScalabilityStructure != 0, + NotRefForUpperSpatialLayer: first&vp9RTPFlagNotRefUpperSpatial != 0, + } + if d.FlexibleMode && !d.PictureIDPresent { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + + off := 1 + if d.PictureIDPresent { + pid, n, err := vpxrtp.ParsePictureID(packet[off:], vpxerrors.ErrInvalidVP9Data) + if err != nil { + return PayloadDescriptor{}, nil, err + } + d.setPictureID(pid) + off += n + } + if d.LayerIndicesPresent { + if off >= len(packet) { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + layer := packet[off] + off++ + d.TemporalID = layer >> 5 + d.SwitchingUpPoint = layer&0x10 != 0 + d.SpatialID = (layer >> 1) & 0x07 + d.InterLayerDependency = layer&0x01 != 0 + if !d.InterPicturePredicted && d.TemporalID != 0 { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + if d.SpatialID == 0 && d.InterLayerDependency { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + if !d.FlexibleMode { + if off >= len(packet) { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + d.TL0PICIDX = packet[off] + off++ + } + } + if d.InterPicturePredicted && d.FlexibleMode { + for i := 0; ; i++ { + if i == MaxReferenceIndices || off >= len(packet) { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + ref := packet[off] + off++ + pdiff := ref >> 1 + if pdiff == 0 { + return PayloadDescriptor{}, nil, vpxerrors.ErrInvalidVP9Data + } + d.ReferenceIndices[i] = pdiff + d.ReferenceIndexCount = i + 1 + if ref&0x01 == 0 { + break + } + } + } + if d.ScalabilityStructurePresent { + ss, n, err := parseScalabilityStructure(packet[off:]) + if err != nil { + return PayloadDescriptor{}, nil, err + } + d.ScalabilityStructure = ss + off += n + } + return d, packet[off:], nil +} + +// FrameAssemblySize validates an ordered set of VP9 RTP payload bodies +// for one frame and returns the raw VP9 frame size. +// +// The caller owns RTP sequence-number validation, loss handling, and jitter +// buffering. Payloads must be in decode order and must include the marker bit +// value from each RTP header. For spatial scalability, the final packet of a +// non-highest spatial-layer frame has E=true and Marker=false; this helper +// therefore rejects early Marker bits but does not require Marker on the last +// fragment. +func FrameAssemblySize(payloads []vpxrtp.PayloadFragment) (int, error) { + if len(payloads) == 0 { + return 0, vpxerrors.ErrInvalidVP9Data + } + total := 0 + validate := vp9FrameAssemblyValidator() + for i := range payloads { + desc, fragment, err := ParsePayloadDescriptor(payloads[i].Payload) + if err != nil { + return 0, err + } + if len(fragment) == 0 { + return 0, vpxerrors.ErrInvalidVP9Data + } + if i+1 < len(payloads) && payloads[i].Marker { + return 0, vpxerrors.ErrInvalidVP9Data + } + if err := validate(i, len(payloads), desc); err != nil { + return 0, err + } + total, err = vpxrtp.AddPayloadSize(total, len(fragment)) + if err != nil { + return 0, err + } + } + return total, nil +} + +// AssembleFrameInto writes the raw VP9 frame carried by payloads into +// dst and returns the frame length. On [vpxerrors.ErrBufferTooSmall], the returned +// length is the required capacity. +func AssembleFrameInto(dst []byte, payloads []vpxrtp.PayloadFragment) (int, error) { + need, err := FrameAssemblySize(payloads) + if err != nil { + return 0, err + } + if len(dst) < need { + return need, vpxerrors.ErrBufferTooSmall + } + return vpxrtp.AssemblePayloadFragmentsInto(dst, payloads, need, + parseVP9PayloadFragment) +} + +// AssembleFrame returns the raw VP9 frame carried by an ordered set of +// RTP payload bodies. +func AssembleFrame(payloads []vpxrtp.PayloadFragment) ([]byte, error) { + need, err := FrameAssemblySize(payloads) + if err != nil { + return nil, err + } + return vpxrtp.AssemblePayloadFragments(payloads, need, parseVP9PayloadFragment) +} + +func parseVP9PayloadFragment(payload []byte) ([]byte, error) { + _, fragment, err := ParsePayloadDescriptor(payload) + if err != nil { + return nil, err + } + return fragment, nil +} + +func vp9FrameAssemblyValidator() vpxrtp.FragmentValidator[PayloadDescriptor] { + var base PayloadDescriptor + return func(i, fragments int, desc PayloadDescriptor) error { + if desc.StartOfFrame != (i == 0) || desc.EndOfFrame != (i == fragments-1) { + return vpxerrors.ErrInvalidVP9Data + } + if err := validatePacketizerDescriptor(desc); err != nil { + return vpxerrors.ErrInvalidVP9Data + } + if i == 0 { + base = desc + base.StartOfFrame = false + base.EndOfFrame = false + return nil + } + if !sameFrameDescriptorForAssembly(base, desc) { + return vpxerrors.ErrInvalidVP9Data + } + return nil + } +} + +func validatePacketizerDescriptor(desc PayloadDescriptor) error { + return desc.validate() +} + +func sameFrameDescriptorForAssembly(base, desc PayloadDescriptor) bool { + desc.StartOfFrame = false + desc.EndOfFrame = false + if desc.ScalabilityStructurePresent { + return sameFrameDescriptor(base, desc) + } + base.ScalabilityStructurePresent = false + base.ScalabilityStructure = ScalabilityStructure{} + return sameFrameDescriptor(base, desc) +} + +func sameFrameDescriptor(base, desc PayloadDescriptor) bool { + desc.StartOfFrame = false + desc.EndOfFrame = false + return base.PictureIDPresent == desc.PictureIDPresent && + base.PictureID == desc.PictureID && + base.PictureID15Bit == desc.PictureID15Bit && + base.InterPicturePredicted == desc.InterPicturePredicted && + base.LayerIndicesPresent == desc.LayerIndicesPresent && + base.FlexibleMode == desc.FlexibleMode && + base.ScalabilityStructurePresent == desc.ScalabilityStructurePresent && + base.NotRefForUpperSpatialLayer == desc.NotRefForUpperSpatialLayer && + base.TemporalID == desc.TemporalID && + base.SwitchingUpPoint == desc.SwitchingUpPoint && + base.SpatialID == desc.SpatialID && + base.InterLayerDependency == desc.InterLayerDependency && + base.TL0PICIDX == desc.TL0PICIDX && + base.ReferenceIndexCount == desc.ReferenceIndexCount && + base.ReferenceIndices == desc.ReferenceIndices && + sameScalabilityStructure(base.ScalabilityStructure, desc.ScalabilityStructure) +} + +func sameScalabilityStructure(a, b ScalabilityStructure) bool { + if a.SpatialLayerCount != b.SpatialLayerCount || + a.ResolutionPresent != b.ResolutionPresent || + a.Width != b.Width || + a.Height != b.Height || + a.PictureGroupPresent != b.PictureGroupPresent || + len(a.PictureGroups) != len(b.PictureGroups) { + return false + } + for i := range a.PictureGroups { + if a.PictureGroups[i] != b.PictureGroups[i] { + return false + } + } + return true +} + +func (d PayloadDescriptor) validate() error { + if err := d.pictureID().Validate(); err != nil { + return err + } + if d.FlexibleMode && !d.PictureIDPresent { + return vpxerrors.ErrInvalidConfig + } + if d.LayerIndicesPresent { + if d.TemporalID > 7 || d.SpatialID > 7 { + return vpxerrors.ErrInvalidConfig + } + if !d.InterPicturePredicted && d.TemporalID != 0 { + return vpxerrors.ErrInvalidConfig + } + if d.SpatialID == 0 && d.InterLayerDependency { + return vpxerrors.ErrInvalidConfig + } + if d.FlexibleMode && d.TL0PICIDX != 0 { + return vpxerrors.ErrInvalidConfig + } + } else if d.TemporalID != 0 || d.SwitchingUpPoint || d.SpatialID != 0 || + d.InterLayerDependency || d.TL0PICIDX != 0 { + return vpxerrors.ErrInvalidConfig + } + if d.InterPicturePredicted && d.FlexibleMode { + if d.ReferenceIndexCount <= 0 || d.ReferenceIndexCount > MaxReferenceIndices { + return vpxerrors.ErrInvalidConfig + } + for i := 0; i < d.ReferenceIndexCount; i++ { + if d.ReferenceIndices[i] == 0 || d.ReferenceIndices[i] > 0x7f { + return vpxerrors.ErrInvalidConfig + } + } + } else if d.ReferenceIndexCount != 0 { + return vpxerrors.ErrInvalidConfig + } + if !d.ScalabilityStructurePresent && !d.ScalabilityStructure.isZero() { + return vpxerrors.ErrInvalidConfig + } + return nil +} + +func (d PayloadDescriptor) pictureID() vpxrtp.PictureID { + return vpxrtp.PictureID{ + Present: d.PictureIDPresent, + Value: d.PictureID, + FifteenBit: d.PictureID15Bit, + } +} + +func (d *PayloadDescriptor) setPictureID(pid vpxrtp.PictureID) { + d.PictureIDPresent = pid.Present + d.PictureID = pid.Value + d.PictureID15Bit = pid.FifteenBit +} + +func (ss ScalabilityStructure) size() (int, error) { + layerCount, err := ss.normalizedSpatialLayerCount() + if err != nil { + return 0, err + } + size := 1 + if ss.ResolutionPresent { + for i := range layerCount { + if ss.Width[i] == 0 || ss.Height[i] == 0 { + return 0, vpxerrors.ErrInvalidConfig + } + } + size += layerCount * 4 + } + if ss.PictureGroupPresent { + if len(ss.PictureGroups) > 255 { + return 0, vpxerrors.ErrInvalidConfig + } + size++ + for i := range ss.PictureGroups { + group := ss.PictureGroups[i] + if group.TemporalID > 7 || + group.ReferenceIndexCount < 0 || + group.ReferenceIndexCount > MaxReferenceIndices { + return 0, vpxerrors.ErrInvalidConfig + } + size++ + for j := 0; j < group.ReferenceIndexCount; j++ { + if group.ReferenceIndices[j] == 0 { + return 0, vpxerrors.ErrInvalidConfig + } + size++ + } + } + } else if len(ss.PictureGroups) != 0 { + return 0, vpxerrors.ErrInvalidConfig + } + return size, nil +} + +func (ss ScalabilityStructure) marshalInto(dst []byte) int { + layerCount, _ := ss.normalizedSpatialLayerCount() + dst[0] = byte(layerCount-1) << 5 + if ss.ResolutionPresent { + dst[0] |= 0x10 + } + if ss.PictureGroupPresent { + dst[0] |= 0x08 + } + + off := 1 + if ss.ResolutionPresent { + for i := range layerCount { + dst[off] = byte(ss.Width[i] >> 8) + dst[off+1] = byte(ss.Width[i]) + dst[off+2] = byte(ss.Height[i] >> 8) + dst[off+3] = byte(ss.Height[i]) + off += 4 + } + } + if ss.PictureGroupPresent { + dst[off] = byte(len(ss.PictureGroups)) + off++ + for i := range ss.PictureGroups { + group := ss.PictureGroups[i] + dst[off] = group.TemporalID<<5 | byte(group.ReferenceIndexCount)<<2 + if group.SwitchingUpPoint { + dst[off] |= 0x10 + } + off++ + for j := 0; j < group.ReferenceIndexCount; j++ { + dst[off] = group.ReferenceIndices[j] + off++ + } + } + } + return off +} + +func (ss ScalabilityStructure) normalizedSpatialLayerCount() (int, error) { + if ss.SpatialLayerCount == 0 { + return 1, nil + } + if ss.SpatialLayerCount < 0 || ss.SpatialLayerCount > MaxSpatialLayers { + return 0, vpxerrors.ErrInvalidConfig + } + return ss.SpatialLayerCount, nil +} + +func (ss ScalabilityStructure) isZero() bool { + if ss.SpatialLayerCount != 0 || ss.ResolutionPresent || ss.PictureGroupPresent || + len(ss.PictureGroups) != 0 { + return false + } + for i := range MaxSpatialLayers { + if ss.Width[i] != 0 || ss.Height[i] != 0 { + return false + } + } + return true +} + +func parseScalabilityStructure(packet []byte) (ScalabilityStructure, int, error) { + if len(packet) == 0 { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + header := packet[0] + off := 1 + ss := ScalabilityStructure{ + SpatialLayerCount: int(header>>5) + 1, + ResolutionPresent: header&0x10 != 0, + PictureGroupPresent: header&0x08 != 0, + } + if ss.ResolutionPresent { + need := ss.SpatialLayerCount * 4 + if len(packet)-off < need { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + for i := 0; i < ss.SpatialLayerCount; i++ { + ss.Width[i] = uint16(packet[off])<<8 | uint16(packet[off+1]) + ss.Height[i] = uint16(packet[off+2])<<8 | uint16(packet[off+3]) + if ss.Width[i] == 0 || ss.Height[i] == 0 { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + off += 4 + } + } + if ss.PictureGroupPresent { + if off >= len(packet) { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + count := int(packet[off]) + off++ + if len(packet)-off < count { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + if count != 0 { + ss.PictureGroups = make([]PictureGroup, count) + } + for i := range count { + if off >= len(packet) { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + header := packet[off] + off++ + group := PictureGroup{ + TemporalID: header >> 5, + SwitchingUpPoint: header&0x10 != 0, + ReferenceIndexCount: int((header >> 2) & 0x03), + } + if len(packet)-off < group.ReferenceIndexCount { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + for j := 0; j < group.ReferenceIndexCount; j++ { + ref := packet[off] + off++ + if ref == 0 { + return ScalabilityStructure{}, 0, vpxerrors.ErrInvalidVP9Data + } + group.ReferenceIndices[j] = ref + } + ss.PictureGroups[i] = group + } + } + return ss, off, nil +} diff --git a/internal/vp9/tables/coef_probs.go b/internal/vp9/tables/coef_probs.go new file mode 100644 index 0000000..1685cea --- /dev/null +++ b/internal/vp9/tables/coef_probs.go @@ -0,0 +1,853 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/coef_probs.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Code generated by gen_coef_probs.go from libvpx v1.16.0 +// vp9/common/vp9_entropy.c. DO NOT EDIT. + +package tables + +// Default coefficient probabilities seed FrameContext.CoefProbs. +// Layout per table: +// [PLANE_TYPES=2][REF_TYPES=2][COEF_BANDS=6][COEFF_CONTEXTS=6][UNCONSTRAINED_NODES=3] +// Band 0 only uses contexts 0..2; the remaining three slots are +// zero-padded to match libvpx's rectangular vp9_coeff_probs_model +// storage shape. + +// DefaultCoefProbs4x4 mirrors libvpx's default_coef_probs_4x4 with band-0 zero padding. +var DefaultCoefProbs4x4 = [2][2][6][6][3]uint8{ + { + { + { + {195, 29, 183}, + {84, 49, 136}, + {8, 42, 71}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {31, 107, 169}, + {35, 99, 159}, + {17, 82, 140}, + {8, 66, 114}, + {2, 44, 76}, + {1, 19, 32}, + }, + { + {40, 132, 201}, + {29, 114, 187}, + {13, 91, 157}, + {7, 75, 127}, + {3, 58, 95}, + {1, 28, 47}, + }, + { + {69, 142, 221}, + {42, 122, 201}, + {15, 91, 159}, + {6, 67, 121}, + {1, 42, 77}, + {1, 17, 31}, + }, + { + {102, 148, 228}, + {67, 117, 204}, + {17, 82, 154}, + {6, 59, 114}, + {2, 39, 75}, + {1, 15, 29}, + }, + { + {156, 57, 233}, + {119, 57, 212}, + {58, 48, 163}, + {29, 40, 124}, + {12, 30, 81}, + {3, 12, 31}, + }, + }, + { + { + {191, 107, 226}, + {124, 117, 204}, + {25, 99, 155}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {29, 148, 210}, + {37, 126, 194}, + {8, 93, 157}, + {2, 68, 118}, + {1, 39, 69}, + {1, 17, 33}, + }, + { + {41, 151, 213}, + {27, 123, 193}, + {3, 82, 144}, + {1, 58, 105}, + {1, 32, 60}, + {1, 13, 26}, + }, + { + {59, 159, 220}, + {23, 126, 198}, + {4, 88, 151}, + {1, 66, 114}, + {1, 38, 71}, + {1, 18, 34}, + }, + { + {114, 136, 232}, + {51, 114, 207}, + {11, 83, 155}, + {3, 56, 105}, + {1, 33, 65}, + {1, 17, 34}, + }, + { + {149, 65, 234}, + {121, 57, 215}, + {61, 49, 166}, + {28, 36, 114}, + {12, 25, 76}, + {3, 16, 42}, + }, + }, + }, + { + { + { + {214, 49, 220}, + {132, 63, 188}, + {42, 65, 137}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {85, 137, 221}, + {104, 131, 216}, + {49, 111, 192}, + {21, 87, 155}, + {2, 49, 87}, + {1, 16, 28}, + }, + { + {89, 163, 230}, + {90, 137, 220}, + {29, 100, 183}, + {10, 70, 135}, + {2, 42, 81}, + {1, 17, 33}, + }, + { + {108, 167, 237}, + {55, 133, 222}, + {15, 97, 179}, + {4, 72, 135}, + {1, 45, 85}, + {1, 19, 38}, + }, + { + {124, 146, 240}, + {66, 124, 224}, + {17, 88, 175}, + {4, 58, 122}, + {1, 36, 75}, + {1, 18, 37}, + }, + { + {141, 79, 241}, + {126, 70, 227}, + {66, 58, 182}, + {30, 44, 136}, + {12, 34, 96}, + {2, 20, 47}, + }, + }, + { + { + {229, 99, 249}, + {143, 111, 235}, + {46, 109, 192}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {82, 158, 236}, + {94, 146, 224}, + {25, 117, 191}, + {9, 87, 149}, + {3, 56, 99}, + {1, 33, 57}, + }, + { + {83, 167, 237}, + {68, 145, 222}, + {10, 103, 177}, + {2, 72, 131}, + {1, 41, 79}, + {1, 20, 39}, + }, + { + {99, 167, 239}, + {47, 141, 224}, + {10, 104, 178}, + {2, 73, 133}, + {1, 44, 85}, + {1, 22, 47}, + }, + { + {127, 145, 243}, + {71, 129, 228}, + {17, 93, 177}, + {3, 61, 124}, + {1, 41, 84}, + {1, 21, 52}, + }, + { + {157, 78, 244}, + {140, 72, 231}, + {69, 58, 184}, + {31, 44, 137}, + {14, 38, 105}, + {8, 23, 61}, + }, + }, + }, +} + +// DefaultCoefProbs8x8 mirrors libvpx's default_coef_probs_8x8 with band-0 zero padding. +var DefaultCoefProbs8x8 = [2][2][6][6][3]uint8{ + { + { + { + {125, 34, 187}, + {52, 41, 133}, + {6, 31, 56}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {37, 109, 153}, + {51, 102, 147}, + {23, 87, 128}, + {8, 67, 101}, + {1, 41, 63}, + {1, 19, 29}, + }, + { + {31, 154, 185}, + {17, 127, 175}, + {6, 96, 145}, + {2, 73, 114}, + {1, 51, 82}, + {1, 28, 45}, + }, + { + {23, 163, 200}, + {10, 131, 185}, + {2, 93, 148}, + {1, 67, 111}, + {1, 41, 69}, + {1, 14, 24}, + }, + { + {29, 176, 217}, + {12, 145, 201}, + {3, 101, 156}, + {1, 69, 111}, + {1, 39, 63}, + {1, 14, 23}, + }, + { + {57, 192, 233}, + {25, 154, 215}, + {6, 109, 167}, + {3, 78, 118}, + {1, 48, 69}, + {1, 21, 29}, + }, + }, + { + { + {202, 105, 245}, + {108, 106, 216}, + {18, 90, 144}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {33, 172, 219}, + {64, 149, 206}, + {14, 117, 177}, + {5, 90, 141}, + {2, 61, 95}, + {1, 37, 57}, + }, + { + {33, 179, 220}, + {11, 140, 198}, + {1, 89, 148}, + {1, 60, 104}, + {1, 33, 57}, + {1, 12, 21}, + }, + { + {30, 181, 221}, + {8, 141, 198}, + {1, 87, 145}, + {1, 58, 100}, + {1, 31, 55}, + {1, 12, 20}, + }, + { + {32, 186, 224}, + {7, 142, 198}, + {1, 86, 143}, + {1, 58, 100}, + {1, 31, 55}, + {1, 12, 22}, + }, + { + {57, 192, 227}, + {20, 143, 204}, + {3, 96, 154}, + {1, 68, 112}, + {1, 42, 69}, + {1, 19, 32}, + }, + }, + }, + { + { + { + {212, 35, 215}, + {113, 47, 169}, + {29, 48, 105}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {74, 129, 203}, + {106, 120, 203}, + {49, 107, 178}, + {19, 84, 144}, + {4, 50, 84}, + {1, 15, 25}, + }, + { + {71, 172, 217}, + {44, 141, 209}, + {15, 102, 173}, + {6, 76, 133}, + {2, 51, 89}, + {1, 24, 42}, + }, + { + {64, 185, 231}, + {31, 148, 216}, + {8, 103, 175}, + {3, 74, 131}, + {1, 46, 81}, + {1, 18, 30}, + }, + { + {65, 196, 235}, + {25, 157, 221}, + {5, 105, 174}, + {1, 67, 120}, + {1, 38, 69}, + {1, 15, 30}, + }, + { + {65, 204, 238}, + {30, 156, 224}, + {7, 107, 177}, + {2, 70, 124}, + {1, 42, 73}, + {1, 18, 34}, + }, + }, + { + { + {225, 86, 251}, + {144, 104, 235}, + {42, 99, 181}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {85, 175, 239}, + {112, 165, 229}, + {29, 136, 200}, + {12, 103, 162}, + {6, 77, 123}, + {2, 53, 84}, + }, + { + {75, 183, 239}, + {30, 155, 221}, + {3, 106, 171}, + {1, 74, 128}, + {1, 44, 76}, + {1, 17, 28}, + }, + { + {73, 185, 240}, + {27, 159, 222}, + {2, 107, 172}, + {1, 75, 127}, + {1, 42, 73}, + {1, 17, 29}, + }, + { + {62, 190, 238}, + {21, 159, 222}, + {2, 107, 172}, + {1, 72, 122}, + {1, 40, 71}, + {1, 18, 32}, + }, + { + {61, 199, 240}, + {27, 161, 226}, + {4, 113, 180}, + {1, 76, 129}, + {1, 46, 80}, + {1, 23, 41}, + }, + }, + }, +} + +// DefaultCoefProbs16x16 mirrors libvpx's default_coef_probs_16x16 with band-0 zero padding. +var DefaultCoefProbs16x16 = [2][2][6][6][3]uint8{ + { + { + { + {7, 27, 153}, + {5, 30, 95}, + {1, 16, 30}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {50, 75, 127}, + {57, 75, 124}, + {27, 67, 108}, + {10, 54, 86}, + {1, 33, 52}, + {1, 12, 18}, + }, + { + {43, 125, 151}, + {26, 108, 148}, + {7, 83, 122}, + {2, 59, 89}, + {1, 38, 60}, + {1, 17, 27}, + }, + { + {23, 144, 163}, + {13, 112, 154}, + {2, 75, 117}, + {1, 50, 81}, + {1, 31, 51}, + {1, 14, 23}, + }, + { + {18, 162, 185}, + {6, 123, 171}, + {1, 78, 125}, + {1, 51, 86}, + {1, 31, 54}, + {1, 14, 23}, + }, + { + {15, 199, 227}, + {3, 150, 204}, + {1, 91, 146}, + {1, 55, 95}, + {1, 30, 53}, + {1, 11, 20}, + }, + }, + { + { + {19, 55, 240}, + {19, 59, 196}, + {3, 52, 105}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {41, 166, 207}, + {104, 153, 199}, + {31, 123, 181}, + {14, 101, 152}, + {5, 72, 106}, + {1, 36, 52}, + }, + { + {35, 176, 211}, + {12, 131, 190}, + {2, 88, 144}, + {1, 60, 101}, + {1, 36, 60}, + {1, 16, 28}, + }, + { + {28, 183, 213}, + {8, 134, 191}, + {1, 86, 142}, + {1, 56, 96}, + {1, 30, 53}, + {1, 12, 20}, + }, + { + {20, 190, 215}, + {4, 135, 192}, + {1, 84, 139}, + {1, 53, 91}, + {1, 28, 49}, + {1, 11, 20}, + }, + { + {13, 196, 216}, + {2, 137, 192}, + {1, 86, 143}, + {1, 57, 99}, + {1, 32, 56}, + {1, 13, 24}, + }, + }, + }, + { + { + { + {211, 29, 217}, + {96, 47, 156}, + {22, 43, 87}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {78, 120, 193}, + {111, 116, 186}, + {46, 102, 164}, + {15, 80, 128}, + {2, 49, 76}, + {1, 18, 28}, + }, + { + {71, 161, 203}, + {42, 132, 192}, + {10, 98, 150}, + {3, 69, 109}, + {1, 44, 70}, + {1, 18, 29}, + }, + { + {57, 186, 211}, + {30, 140, 196}, + {4, 93, 146}, + {1, 62, 102}, + {1, 38, 65}, + {1, 16, 27}, + }, + { + {47, 199, 217}, + {14, 145, 196}, + {1, 88, 142}, + {1, 57, 98}, + {1, 36, 62}, + {1, 15, 26}, + }, + { + {26, 219, 229}, + {5, 155, 207}, + {1, 94, 151}, + {1, 60, 104}, + {1, 36, 62}, + {1, 16, 28}, + }, + }, + { + { + {233, 29, 248}, + {146, 47, 220}, + {43, 52, 140}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {100, 163, 232}, + {179, 161, 222}, + {63, 142, 204}, + {37, 113, 174}, + {26, 89, 137}, + {18, 68, 97}, + }, + { + {85, 181, 230}, + {32, 146, 209}, + {7, 100, 164}, + {3, 71, 121}, + {1, 45, 77}, + {1, 18, 30}, + }, + { + {65, 187, 230}, + {20, 148, 207}, + {2, 97, 159}, + {1, 68, 116}, + {1, 40, 70}, + {1, 14, 29}, + }, + { + {40, 194, 227}, + {8, 147, 204}, + {1, 94, 155}, + {1, 65, 112}, + {1, 39, 66}, + {1, 14, 26}, + }, + { + {16, 208, 228}, + {3, 151, 207}, + {1, 98, 160}, + {1, 67, 117}, + {1, 41, 74}, + {1, 17, 31}, + }, + }, + }, +} + +// DefaultCoefProbs32x32 mirrors libvpx's default_coef_probs_32x32 with band-0 zero padding. +var DefaultCoefProbs32x32 = [2][2][6][6][3]uint8{ + { + { + { + {17, 38, 140}, + {7, 34, 80}, + {1, 17, 29}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {37, 75, 128}, + {41, 76, 128}, + {26, 66, 116}, + {12, 52, 94}, + {2, 32, 55}, + {1, 10, 16}, + }, + { + {50, 127, 154}, + {37, 109, 152}, + {16, 82, 121}, + {5, 59, 85}, + {1, 35, 54}, + {1, 13, 20}, + }, + { + {40, 142, 167}, + {17, 110, 157}, + {2, 71, 112}, + {1, 44, 72}, + {1, 27, 45}, + {1, 11, 17}, + }, + { + {30, 175, 188}, + {9, 124, 169}, + {1, 74, 116}, + {1, 48, 78}, + {1, 30, 49}, + {1, 11, 18}, + }, + { + {10, 222, 223}, + {2, 150, 194}, + {1, 83, 128}, + {1, 48, 79}, + {1, 27, 45}, + {1, 11, 17}, + }, + }, + { + { + {36, 41, 235}, + {29, 36, 193}, + {10, 27, 111}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {85, 165, 222}, + {177, 162, 215}, + {110, 135, 195}, + {57, 113, 168}, + {23, 83, 120}, + {10, 49, 61}, + }, + { + {85, 190, 223}, + {36, 139, 200}, + {5, 90, 146}, + {1, 60, 103}, + {1, 38, 65}, + {1, 18, 30}, + }, + { + {72, 202, 223}, + {23, 141, 199}, + {2, 86, 140}, + {1, 56, 97}, + {1, 36, 61}, + {1, 16, 27}, + }, + { + {55, 218, 225}, + {13, 145, 200}, + {1, 86, 141}, + {1, 57, 99}, + {1, 35, 61}, + {1, 13, 22}, + }, + { + {15, 235, 212}, + {1, 132, 184}, + {1, 84, 139}, + {1, 57, 97}, + {1, 34, 56}, + {1, 14, 23}, + }, + }, + }, + { + { + { + {181, 21, 201}, + {61, 37, 123}, + {10, 38, 71}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {47, 106, 172}, + {95, 104, 173}, + {42, 93, 159}, + {18, 77, 131}, + {4, 50, 81}, + {1, 17, 23}, + }, + { + {62, 147, 199}, + {44, 130, 189}, + {28, 102, 154}, + {18, 75, 115}, + {2, 44, 65}, + {1, 12, 19}, + }, + { + {55, 153, 210}, + {24, 130, 194}, + {3, 93, 146}, + {1, 61, 97}, + {1, 31, 50}, + {1, 10, 16}, + }, + { + {49, 186, 223}, + {17, 148, 204}, + {1, 96, 142}, + {1, 53, 83}, + {1, 26, 44}, + {1, 11, 17}, + }, + { + {13, 217, 212}, + {2, 136, 180}, + {1, 78, 124}, + {1, 50, 83}, + {1, 29, 49}, + {1, 14, 23}, + }, + }, + { + { + {197, 13, 247}, + {82, 17, 222}, + {25, 17, 162}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + }, + { + {126, 186, 247}, + {234, 191, 243}, + {176, 177, 234}, + {104, 158, 220}, + {66, 128, 186}, + {55, 90, 137}, + }, + { + {111, 197, 242}, + {46, 158, 219}, + {9, 104, 171}, + {2, 65, 125}, + {1, 44, 80}, + {1, 17, 91}, + }, + { + {104, 208, 245}, + {39, 168, 224}, + {3, 109, 162}, + {1, 79, 124}, + {1, 50, 102}, + {1, 43, 102}, + }, + { + {84, 220, 246}, + {31, 177, 231}, + {2, 115, 180}, + {1, 79, 134}, + {1, 55, 77}, + {1, 60, 79}, + }, + { + {43, 243, 240}, + {8, 180, 217}, + {1, 115, 166}, + {1, 84, 121}, + {1, 51, 67}, + {1, 16, 6}, + }, + }, + }, +} diff --git a/internal/vp9/tables/default_probs.go b/internal/vp9/tables/default_probs.go new file mode 100644 index 0000000..ca8000b --- /dev/null +++ b/internal/vp9/tables/default_probs.go @@ -0,0 +1,124 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/default_probs.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// VP9 default probability tables. Ported byte-for-byte from libvpx +// v1.16.0 vp9/common/vp9_entropymode.c. These seed every per-frame +// FRAME_CONTEXT when the decoder starts a new key/intra-only frame or +// when frame_context_idx forces a reset. +// +// Wire-stable: a single byte off in any of these would skew every +// boolean-coded decode the compressed header doesn't explicitly +// override. + +// DefaultIntraInter mirrors default_intra_inter_p. +var DefaultIntraInter = [4]uint8{9, 102, 187, 225} + +// DefaultCompInter mirrors default_comp_inter_p. +var DefaultCompInter = [5]uint8{239, 183, 119, 96, 41} + +// DefaultCompRef mirrors default_comp_ref_p. +var DefaultCompRef = [5]uint8{50, 126, 123, 221, 226} + +// DefaultSingleRef mirrors default_single_ref_p (REF_CONTEXTS × 2). +var DefaultSingleRef = [5][2]uint8{ + {33, 16}, {77, 74}, {142, 142}, {172, 170}, {238, 247}, +} + +// DefaultSkipProbs mirrors default_skip_probs. +var DefaultSkipProbs = [3]uint8{192, 128, 64} + +// DefaultSwitchableInterpProb mirrors default_switchable_interp_prob — +// (SWITCHABLE_FILTER_CONTEXTS = 4) × (SWITCHABLE_FILTERS-1 = 2). +var DefaultSwitchableInterpProb = [4][2]uint8{ + {235, 162}, + {36, 255}, + {34, 3}, + {149, 144}, +} + +// DefaultPartitionProbs mirrors default_partition_probs — +// PARTITION_CONTEXTS=16 × (PARTITION_TYPES-1=3). +var DefaultPartitionProbs = [16][3]uint8{ + // 8x8 -> 4x4 + {199, 122, 141}, + {147, 63, 159}, + {148, 133, 118}, + {121, 104, 114}, + // 16x16 -> 8x8 + {174, 73, 87}, + {92, 41, 83}, + {82, 99, 50}, + {53, 39, 39}, + // 32x32 -> 16x16 + {177, 58, 59}, + {68, 26, 63}, + {52, 79, 25}, + {17, 14, 12}, + // 64x64 -> 32x32 + {222, 34, 30}, + {72, 16, 44}, + {58, 32, 12}, + {10, 7, 6}, +} + +// DefaultInterModeProbs mirrors default_inter_mode_probs — +// INTER_MODE_CONTEXTS=7 × (INTER_MODES-1=3). +var DefaultInterModeProbs = [7][3]uint8{ + {2, 173, 34}, + {7, 145, 85}, + {7, 166, 63}, + {7, 94, 66}, + {8, 64, 46}, + {17, 81, 31}, + {25, 29, 30}, +} + +// DefaultTxProbs mirrors libvpx's default_tx_probs — the seed for +// FRAME_CONTEXT.tx_probs. Layout matches the struct tx_probs triangle. +var ( + DefaultTxProbsP32x32 = [2][3]uint8{ + {3, 136, 37}, + {5, 52, 13}, + } + DefaultTxProbsP16x16 = [2][2]uint8{ + {20, 152}, + {15, 101}, + } + DefaultTxProbsP8x8 = [2][1]uint8{ + {100}, + {66}, + } +) + +// DefaultIfYProbs mirrors default_if_y_probs — the inter-frame intra +// Y-mode probability table indexed by block-size group. +var DefaultIfYProbs = [4][9]uint8{ + {65, 32, 18, 144, 162, 194, 41, 51, 98}, + {132, 68, 18, 165, 217, 196, 45, 40, 78}, + {173, 80, 19, 176, 240, 193, 64, 35, 46}, + {221, 135, 38, 194, 248, 121, 96, 85, 29}, +} + +// DefaultIfUvProbs mirrors default_if_uv_probs — the inter-frame intra +// UV-mode probability table indexed by the selected Y mode. +var DefaultIfUvProbs = [10][9]uint8{ + {120, 7, 76, 176, 208, 126, 28, 54, 103}, + {48, 12, 154, 155, 139, 90, 34, 117, 119}, + {67, 6, 25, 204, 243, 158, 13, 21, 96}, + {97, 5, 44, 131, 176, 139, 48, 68, 97}, + {83, 5, 42, 156, 111, 152, 26, 49, 152}, + {80, 5, 58, 178, 74, 83, 33, 62, 145}, + {86, 5, 32, 154, 192, 168, 14, 22, 163}, + {85, 5, 32, 156, 216, 148, 19, 29, 73}, + {77, 7, 64, 116, 132, 122, 37, 126, 120}, + {101, 21, 107, 181, 192, 103, 19, 67, 125}, +} diff --git a/internal/vp9/tables/detok_tables.go b/internal/vp9/tables/detok_tables.go new file mode 100644 index 0000000..ca70612 --- /dev/null +++ b/internal/vp9/tables/detok_tables.go @@ -0,0 +1,301 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/detok_tables.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Code generated by gen_detok_tables.go from libvpx v1.16.0 +// vp9/common/vp9_entropy.c. DO NOT EDIT. + +package tables + +// VP9 token-tail probability blobs used during detokenize. +// Mirrors vp9_cat{1..6}_prob, vp9_pareto8_full, and the +// vp9_coefband_trans_{4x4,8x8plus} band-translate maps. + +// Cat1Prob mirrors libvpx's vp9_cat1_prob. +var Cat1Prob = [1]uint8{159} + +// Cat2Prob mirrors libvpx's vp9_cat2_prob. +var Cat2Prob = [2]uint8{165, 145} + +// Cat3Prob mirrors libvpx's vp9_cat3_prob. +var Cat3Prob = [3]uint8{173, 148, 140} + +// Cat4Prob mirrors libvpx's vp9_cat4_prob. +var Cat4Prob = [4]uint8{176, 155, 140, 135} + +// Cat5Prob mirrors libvpx's vp9_cat5_prob. +var Cat5Prob = [5]uint8{180, 157, 141, 134, 130} + +// Cat6Prob mirrors libvpx's vp9_cat6_prob. +var Cat6Prob = [14]uint8{254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129} + +// CoefbandTrans4x4 mirrors libvpx's vp9_coefband_trans_4x4. +var CoefbandTrans4x4 = [16]uint8{0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5} + +// CoefbandTrans8x8Plus mirrors libvpx's vp9_coefband_trans_8x8plus. +var CoefbandTrans8x8Plus = [1024]uint8{0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + +// Pareto8Full mirrors libvpx's vp9_pareto8_full[255][8]. +var Pareto8Full = [255][8]uint8{ + {3, 86, 128, 6, 86, 23, 88, 29}, + {6, 86, 128, 11, 87, 42, 91, 52}, + {9, 86, 129, 17, 88, 61, 94, 76}, + {12, 86, 129, 22, 88, 77, 97, 93}, + {15, 87, 129, 28, 89, 93, 100, 110}, + {17, 87, 129, 33, 90, 105, 103, 123}, + {20, 88, 130, 38, 91, 118, 106, 136}, + {23, 88, 130, 43, 91, 128, 108, 146}, + {26, 89, 131, 48, 92, 139, 111, 156}, + {28, 89, 131, 53, 93, 147, 114, 163}, + {31, 90, 131, 58, 94, 156, 117, 171}, + {34, 90, 131, 62, 94, 163, 119, 177}, + {37, 90, 132, 66, 95, 171, 122, 184}, + {39, 90, 132, 70, 96, 177, 124, 189}, + {42, 91, 132, 75, 97, 183, 127, 194}, + {44, 91, 132, 79, 97, 188, 129, 198}, + {47, 92, 133, 83, 98, 193, 132, 202}, + {49, 92, 133, 86, 99, 197, 134, 205}, + {52, 93, 133, 90, 100, 201, 137, 208}, + {54, 93, 133, 94, 100, 204, 139, 211}, + {57, 94, 134, 98, 101, 208, 142, 214}, + {59, 94, 134, 101, 102, 211, 144, 216}, + {62, 94, 135, 105, 103, 214, 146, 218}, + {64, 94, 135, 108, 103, 216, 148, 220}, + {66, 95, 135, 111, 104, 219, 151, 222}, + {68, 95, 135, 114, 105, 221, 153, 223}, + {71, 96, 136, 117, 106, 224, 155, 225}, + {73, 96, 136, 120, 106, 225, 157, 226}, + {76, 97, 136, 123, 107, 227, 159, 228}, + {78, 97, 136, 126, 108, 229, 160, 229}, + {80, 98, 137, 129, 109, 231, 162, 231}, + {82, 98, 137, 131, 109, 232, 164, 232}, + {84, 98, 138, 134, 110, 234, 166, 233}, + {86, 98, 138, 137, 111, 235, 168, 234}, + {89, 99, 138, 140, 112, 236, 170, 235}, + {91, 99, 138, 142, 112, 237, 171, 235}, + {93, 100, 139, 145, 113, 238, 173, 236}, + {95, 100, 139, 147, 114, 239, 174, 237}, + {97, 101, 140, 149, 115, 240, 176, 238}, + {99, 101, 140, 151, 115, 241, 177, 238}, + {101, 102, 140, 154, 116, 242, 179, 239}, + {103, 102, 140, 156, 117, 242, 180, 239}, + {105, 103, 141, 158, 118, 243, 182, 240}, + {107, 103, 141, 160, 118, 243, 183, 240}, + {109, 104, 141, 162, 119, 244, 185, 241}, + {111, 104, 141, 164, 119, 244, 186, 241}, + {113, 104, 142, 166, 120, 245, 187, 242}, + {114, 104, 142, 168, 121, 245, 188, 242}, + {116, 105, 143, 170, 122, 246, 190, 243}, + {118, 105, 143, 171, 122, 246, 191, 243}, + {120, 106, 143, 173, 123, 247, 192, 244}, + {121, 106, 143, 175, 124, 247, 193, 244}, + {123, 107, 144, 177, 125, 248, 195, 244}, + {125, 107, 144, 178, 125, 248, 196, 244}, + {127, 108, 145, 180, 126, 249, 197, 245}, + {128, 108, 145, 181, 127, 249, 198, 245}, + {130, 109, 145, 183, 128, 249, 199, 245}, + {132, 109, 145, 184, 128, 249, 200, 245}, + {134, 110, 146, 186, 129, 250, 201, 246}, + {135, 110, 146, 187, 130, 250, 202, 246}, + {137, 111, 147, 189, 131, 251, 203, 246}, + {138, 111, 147, 190, 131, 251, 204, 246}, + {140, 112, 147, 192, 132, 251, 205, 247}, + {141, 112, 147, 193, 132, 251, 206, 247}, + {143, 113, 148, 194, 133, 251, 207, 247}, + {144, 113, 148, 195, 134, 251, 207, 247}, + {146, 114, 149, 197, 135, 252, 208, 248}, + {147, 114, 149, 198, 135, 252, 209, 248}, + {149, 115, 149, 199, 136, 252, 210, 248}, + {150, 115, 149, 200, 137, 252, 210, 248}, + {152, 115, 150, 201, 138, 252, 211, 248}, + {153, 115, 150, 202, 138, 252, 212, 248}, + {155, 116, 151, 204, 139, 253, 213, 249}, + {156, 116, 151, 205, 139, 253, 213, 249}, + {158, 117, 151, 206, 140, 253, 214, 249}, + {159, 117, 151, 207, 141, 253, 215, 249}, + {161, 118, 152, 208, 142, 253, 216, 249}, + {162, 118, 152, 209, 142, 253, 216, 249}, + {163, 119, 153, 210, 143, 253, 217, 249}, + {164, 119, 153, 211, 143, 253, 217, 249}, + {166, 120, 153, 212, 144, 254, 218, 250}, + {167, 120, 153, 212, 145, 254, 219, 250}, + {168, 121, 154, 213, 146, 254, 220, 250}, + {169, 121, 154, 214, 146, 254, 220, 250}, + {171, 122, 155, 215, 147, 254, 221, 250}, + {172, 122, 155, 216, 147, 254, 221, 250}, + {173, 123, 155, 217, 148, 254, 222, 250}, + {174, 123, 155, 217, 149, 254, 222, 250}, + {176, 124, 156, 218, 150, 254, 223, 250}, + {177, 124, 156, 219, 150, 254, 223, 250}, + {178, 125, 157, 220, 151, 254, 224, 251}, + {179, 125, 157, 220, 151, 254, 224, 251}, + {180, 126, 157, 221, 152, 254, 225, 251}, + {181, 126, 157, 221, 152, 254, 225, 251}, + {183, 127, 158, 222, 153, 254, 226, 251}, + {184, 127, 158, 223, 154, 254, 226, 251}, + {185, 128, 159, 224, 155, 255, 227, 251}, + {186, 128, 159, 224, 155, 255, 227, 251}, + {187, 129, 160, 225, 156, 255, 228, 251}, + {188, 130, 160, 225, 156, 255, 228, 251}, + {189, 131, 160, 226, 157, 255, 228, 251}, + {190, 131, 160, 226, 158, 255, 228, 251}, + {191, 132, 161, 227, 159, 255, 229, 251}, + {192, 132, 161, 227, 159, 255, 229, 251}, + {193, 133, 162, 228, 160, 255, 230, 252}, + {194, 133, 162, 229, 160, 255, 230, 252}, + {195, 134, 163, 230, 161, 255, 231, 252}, + {196, 134, 163, 230, 161, 255, 231, 252}, + {197, 135, 163, 231, 162, 255, 231, 252}, + {198, 135, 163, 231, 162, 255, 231, 252}, + {199, 136, 164, 232, 163, 255, 232, 252}, + {200, 136, 164, 232, 164, 255, 232, 252}, + {201, 137, 165, 233, 165, 255, 233, 252}, + {201, 137, 165, 233, 165, 255, 233, 252}, + {202, 138, 166, 233, 166, 255, 233, 252}, + {203, 138, 166, 233, 166, 255, 233, 252}, + {204, 139, 166, 234, 167, 255, 234, 252}, + {205, 139, 166, 234, 167, 255, 234, 252}, + {206, 140, 167, 235, 168, 255, 235, 252}, + {206, 140, 167, 235, 168, 255, 235, 252}, + {207, 141, 168, 236, 169, 255, 235, 252}, + {208, 141, 168, 236, 170, 255, 235, 252}, + {209, 142, 169, 237, 171, 255, 236, 252}, + {209, 143, 169, 237, 171, 255, 236, 252}, + {210, 144, 169, 237, 172, 255, 236, 252}, + {211, 144, 169, 237, 172, 255, 236, 252}, + {212, 145, 170, 238, 173, 255, 237, 252}, + {213, 145, 170, 238, 173, 255, 237, 252}, + {214, 146, 171, 239, 174, 255, 237, 253}, + {214, 146, 171, 239, 174, 255, 237, 253}, + {215, 147, 172, 240, 175, 255, 238, 253}, + {215, 147, 172, 240, 175, 255, 238, 253}, + {216, 148, 173, 240, 176, 255, 238, 253}, + {217, 148, 173, 240, 176, 255, 238, 253}, + {218, 149, 173, 241, 177, 255, 239, 253}, + {218, 149, 173, 241, 178, 255, 239, 253}, + {219, 150, 174, 241, 179, 255, 239, 253}, + {219, 151, 174, 241, 179, 255, 239, 253}, + {220, 152, 175, 242, 180, 255, 240, 253}, + {221, 152, 175, 242, 180, 255, 240, 253}, + {222, 153, 176, 242, 181, 255, 240, 253}, + {222, 153, 176, 242, 181, 255, 240, 253}, + {223, 154, 177, 243, 182, 255, 240, 253}, + {223, 154, 177, 243, 182, 255, 240, 253}, + {224, 155, 178, 244, 183, 255, 241, 253}, + {224, 155, 178, 244, 183, 255, 241, 253}, + {225, 156, 178, 244, 184, 255, 241, 253}, + {225, 157, 178, 244, 184, 255, 241, 253}, + {226, 158, 179, 244, 185, 255, 242, 253}, + {227, 158, 179, 244, 185, 255, 242, 253}, + {228, 159, 180, 245, 186, 255, 242, 253}, + {228, 159, 180, 245, 186, 255, 242, 253}, + {229, 160, 181, 245, 187, 255, 242, 253}, + {229, 160, 181, 245, 187, 255, 242, 253}, + {230, 161, 182, 246, 188, 255, 243, 253}, + {230, 162, 182, 246, 188, 255, 243, 253}, + {231, 163, 183, 246, 189, 255, 243, 253}, + {231, 163, 183, 246, 189, 255, 243, 253}, + {232, 164, 184, 247, 190, 255, 243, 253}, + {232, 164, 184, 247, 190, 255, 243, 253}, + {233, 165, 185, 247, 191, 255, 244, 253}, + {233, 165, 185, 247, 191, 255, 244, 253}, + {234, 166, 185, 247, 192, 255, 244, 253}, + {234, 167, 185, 247, 192, 255, 244, 253}, + {235, 168, 186, 248, 193, 255, 244, 253}, + {235, 168, 186, 248, 193, 255, 244, 253}, + {236, 169, 187, 248, 194, 255, 244, 253}, + {236, 169, 187, 248, 194, 255, 244, 253}, + {236, 170, 188, 248, 195, 255, 245, 253}, + {236, 170, 188, 248, 195, 255, 245, 253}, + {237, 171, 189, 249, 196, 255, 245, 254}, + {237, 172, 189, 249, 196, 255, 245, 254}, + {238, 173, 190, 249, 197, 255, 245, 254}, + {238, 173, 190, 249, 197, 255, 245, 254}, + {239, 174, 191, 249, 198, 255, 245, 254}, + {239, 174, 191, 249, 198, 255, 245, 254}, + {240, 175, 192, 249, 199, 255, 246, 254}, + {240, 176, 192, 249, 199, 255, 246, 254}, + {240, 177, 193, 250, 200, 255, 246, 254}, + {240, 177, 193, 250, 200, 255, 246, 254}, + {241, 178, 194, 250, 201, 255, 246, 254}, + {241, 178, 194, 250, 201, 255, 246, 254}, + {242, 179, 195, 250, 202, 255, 246, 254}, + {242, 180, 195, 250, 202, 255, 246, 254}, + {242, 181, 196, 250, 203, 255, 247, 254}, + {242, 181, 196, 250, 203, 255, 247, 254}, + {243, 182, 197, 251, 204, 255, 247, 254}, + {243, 183, 197, 251, 204, 255, 247, 254}, + {244, 184, 198, 251, 205, 255, 247, 254}, + {244, 184, 198, 251, 205, 255, 247, 254}, + {244, 185, 199, 251, 206, 255, 247, 254}, + {244, 185, 199, 251, 206, 255, 247, 254}, + {245, 186, 200, 251, 207, 255, 247, 254}, + {245, 187, 200, 251, 207, 255, 247, 254}, + {246, 188, 201, 252, 207, 255, 248, 254}, + {246, 188, 201, 252, 207, 255, 248, 254}, + {246, 189, 202, 252, 208, 255, 248, 254}, + {246, 190, 202, 252, 208, 255, 248, 254}, + {247, 191, 203, 252, 209, 255, 248, 254}, + {247, 191, 203, 252, 209, 255, 248, 254}, + {247, 192, 204, 252, 210, 255, 248, 254}, + {247, 193, 204, 252, 210, 255, 248, 254}, + {248, 194, 205, 252, 211, 255, 248, 254}, + {248, 194, 205, 252, 211, 255, 248, 254}, + {248, 195, 206, 252, 212, 255, 249, 254}, + {248, 196, 206, 252, 212, 255, 249, 254}, + {249, 197, 207, 253, 213, 255, 249, 254}, + {249, 197, 207, 253, 213, 255, 249, 254}, + {249, 198, 208, 253, 214, 255, 249, 254}, + {249, 199, 209, 253, 214, 255, 249, 254}, + {250, 200, 210, 253, 215, 255, 249, 254}, + {250, 200, 210, 253, 215, 255, 249, 254}, + {250, 201, 211, 253, 215, 255, 249, 254}, + {250, 202, 211, 253, 215, 255, 249, 254}, + {250, 203, 212, 253, 216, 255, 249, 254}, + {250, 203, 212, 253, 216, 255, 249, 254}, + {251, 204, 213, 253, 217, 255, 250, 254}, + {251, 205, 213, 253, 217, 255, 250, 254}, + {251, 206, 214, 254, 218, 255, 250, 254}, + {251, 206, 215, 254, 218, 255, 250, 254}, + {252, 207, 216, 254, 219, 255, 250, 254}, + {252, 208, 216, 254, 219, 255, 250, 254}, + {252, 209, 217, 254, 220, 255, 250, 254}, + {252, 210, 217, 254, 220, 255, 250, 254}, + {252, 211, 218, 254, 221, 255, 250, 254}, + {252, 212, 218, 254, 221, 255, 250, 254}, + {253, 213, 219, 254, 222, 255, 250, 254}, + {253, 213, 220, 254, 222, 255, 250, 254}, + {253, 214, 221, 254, 223, 255, 250, 254}, + {253, 215, 221, 254, 223, 255, 250, 254}, + {253, 216, 222, 254, 224, 255, 251, 254}, + {253, 217, 223, 254, 224, 255, 251, 254}, + {253, 218, 224, 254, 225, 255, 251, 254}, + {253, 219, 224, 254, 225, 255, 251, 254}, + {254, 220, 225, 254, 225, 255, 251, 254}, + {254, 221, 226, 254, 225, 255, 251, 254}, + {254, 222, 227, 255, 226, 255, 251, 254}, + {254, 223, 227, 255, 226, 255, 251, 254}, + {254, 224, 228, 255, 227, 255, 251, 254}, + {254, 225, 229, 255, 227, 255, 251, 254}, + {254, 226, 230, 255, 228, 255, 251, 254}, + {254, 227, 230, 255, 229, 255, 251, 254}, + {255, 228, 231, 255, 230, 255, 251, 254}, + {255, 229, 232, 255, 230, 255, 251, 254}, + {255, 230, 233, 255, 231, 255, 252, 254}, + {255, 231, 234, 255, 231, 255, 252, 254}, + {255, 232, 235, 255, 232, 255, 252, 254}, + {255, 233, 236, 255, 232, 255, 252, 254}, + {255, 235, 237, 255, 233, 255, 252, 254}, + {255, 236, 238, 255, 234, 255, 252, 254}, + {255, 238, 240, 255, 235, 255, 252, 255}, + {255, 239, 241, 255, 235, 255, 252, 254}, + {255, 241, 243, 255, 236, 255, 252, 254}, + {255, 243, 245, 255, 237, 255, 252, 254}, + {255, 246, 247, 255, 239, 255, 253, 255}, +} diff --git a/internal/vp9/tables/filters.go b/internal/vp9/tables/filters.go new file mode 100644 index 0000000..af3c7b7 --- /dev/null +++ b/internal/vp9/tables/filters.go @@ -0,0 +1,142 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/filters.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// VP9 subpel interpolation filter tables ported byte-for-byte from +// libvpx v1.16.0 vp9/common/vp9_filter.c. Each filter is an 8-tap +// kernel sampled at 16 subpel positions (1/16-pel precision). The +// taps sum to 128 = 2^FILTER_BITS so a convolve normalizes by >>7. + +// Subpel constants from vpx_dsp/vpx_filter.h. These ARE wire-stable — +// they are part of how the VP9 motion compensator interprets MVs. +const ( + FilterBits = 7 + SubpelBits = 4 + SubpelMask = (1 << SubpelBits) - 1 + SubpelShifts = 1 << SubpelBits + SubpelTaps = 8 +) + +// BilinearFilters is the 8-tap bilinear filter (only the inner two +// taps are non-zero). Used by the predictor when bilinear interp is +// configured. +var BilinearFilters = [SubpelShifts][SubpelTaps]int16{ + {0, 0, 0, 128, 0, 0, 0, 0}, + {0, 0, 0, 120, 8, 0, 0, 0}, + {0, 0, 0, 112, 16, 0, 0, 0}, + {0, 0, 0, 104, 24, 0, 0, 0}, + {0, 0, 0, 96, 32, 0, 0, 0}, + {0, 0, 0, 88, 40, 0, 0, 0}, + {0, 0, 0, 80, 48, 0, 0, 0}, + {0, 0, 0, 72, 56, 0, 0, 0}, + {0, 0, 0, 64, 64, 0, 0, 0}, + {0, 0, 0, 56, 72, 0, 0, 0}, + {0, 0, 0, 48, 80, 0, 0, 0}, + {0, 0, 0, 40, 88, 0, 0, 0}, + {0, 0, 0, 32, 96, 0, 0, 0}, + {0, 0, 0, 24, 104, 0, 0, 0}, + {0, 0, 0, 16, 112, 0, 0, 0}, + {0, 0, 0, 8, 120, 0, 0, 0}, +} + +// SubPelFilters8 is the regular Lagrangian 8-tap subpel filter. This is +// the default for VP9 inter prediction. +var SubPelFilters8 = [SubpelShifts][SubpelTaps]int16{ + {0, 0, 0, 128, 0, 0, 0, 0}, + {0, 1, -5, 126, 8, -3, 1, 0}, + {-1, 3, -10, 122, 18, -6, 2, 0}, + {-1, 4, -13, 118, 27, -9, 3, -1}, + {-1, 4, -16, 112, 37, -11, 4, -1}, + {-1, 5, -18, 105, 48, -14, 4, -1}, + {-1, 5, -19, 97, 58, -16, 5, -1}, + {-1, 6, -19, 88, 68, -18, 5, -1}, + {-1, 6, -19, 78, 78, -19, 6, -1}, + {-1, 5, -18, 68, 88, -19, 6, -1}, + {-1, 5, -16, 58, 97, -19, 5, -1}, + {-1, 4, -14, 48, 105, -18, 5, -1}, + {-1, 4, -11, 37, 112, -16, 4, -1}, + {-1, 3, -9, 27, 118, -13, 4, -1}, + {0, 2, -6, 18, 122, -10, 3, -1}, + {0, 1, -3, 8, 126, -5, 1, 0}, +} + +// SubPelFilters8s is the sharp DCT-based 8-tap subpel filter. +var SubPelFilters8s = [SubpelShifts][SubpelTaps]int16{ + {0, 0, 0, 128, 0, 0, 0, 0}, + {-1, 3, -7, 127, 8, -3, 1, 0}, + {-2, 5, -13, 125, 17, -6, 3, -1}, + {-3, 7, -17, 121, 27, -10, 5, -2}, + {-4, 9, -20, 115, 37, -13, 6, -2}, + {-4, 10, -23, 108, 48, -16, 8, -3}, + {-4, 10, -24, 100, 59, -19, 9, -3}, + {-4, 11, -24, 90, 70, -21, 10, -4}, + {-4, 11, -23, 80, 80, -23, 11, -4}, + {-4, 10, -21, 70, 90, -24, 11, -4}, + {-3, 9, -19, 59, 100, -24, 10, -4}, + {-3, 8, -16, 48, 108, -23, 10, -4}, + {-2, 6, -13, 37, 115, -20, 9, -4}, + {-2, 5, -10, 27, 121, -17, 7, -3}, + {-1, 3, -6, 17, 125, -13, 5, -2}, + {0, 1, -3, 8, 127, -7, 3, -1}, +} + +// SubPelFilters8lp is the smooth (low-pass) 8-tap subpel filter +// (freqmultiplier = 0.5 in libvpx's comment). +var SubPelFilters8lp = [SubpelShifts][SubpelTaps]int16{ + {0, 0, 0, 128, 0, 0, 0, 0}, + {-3, -1, 32, 64, 38, 1, -3, 0}, + {-2, -2, 29, 63, 41, 2, -3, 0}, + {-2, -2, 26, 63, 43, 4, -4, 0}, + {-2, -3, 24, 62, 46, 5, -4, 0}, + {-2, -3, 21, 60, 49, 7, -4, 0}, + {-1, -4, 18, 59, 51, 9, -4, 0}, + {-1, -4, 16, 57, 53, 12, -4, -1}, + {-1, -4, 14, 55, 55, 14, -4, -1}, + {-1, -4, 12, 53, 57, 16, -4, -1}, + {0, -4, 9, 51, 59, 18, -4, -1}, + {0, -4, 7, 49, 60, 21, -3, -2}, + {0, -4, 5, 46, 62, 24, -3, -2}, + {0, -4, 4, 43, 63, 26, -2, -2}, + {0, -3, 2, 41, 63, 29, -2, -2}, + {0, -3, 1, 38, 64, 32, -1, -3}, +} + +// SubPelFilters4 is the 4-tap subpel filter (inner taps only). +var SubPelFilters4 = [SubpelShifts][SubpelTaps]int16{ + {0, 0, 0, 128, 0, 0, 0, 0}, + {0, 0, -4, 126, 8, -2, 0, 0}, + {0, 0, -6, 120, 18, -4, 0, 0}, + {0, 0, -8, 114, 28, -6, 0, 0}, + {0, 0, -10, 108, 36, -6, 0, 0}, + {0, 0, -12, 102, 46, -8, 0, 0}, + {0, 0, -12, 94, 56, -10, 0, 0}, + {0, 0, -12, 84, 66, -10, 0, 0}, + {0, 0, -12, 76, 76, -12, 0, 0}, + {0, 0, -10, 66, 84, -12, 0, 0}, + {0, 0, -10, 56, 94, -12, 0, 0}, + {0, 0, -8, 46, 102, -12, 0, 0}, + {0, 0, -6, 36, 108, -10, 0, 0}, + {0, 0, -6, 28, 114, -8, 0, 0}, + {0, 0, -4, 18, 120, -6, 0, 0}, + {0, 0, -2, 8, 126, -4, 0, 0}, +} + +// FilterKernels mirrors vp9_filter_kernels: ordered as +// EIGHTTAP, EIGHTTAP_SMOOTH, EIGHTTAP_SHARP, BILINEAR, FOURTAP. +// Decoder uses the first 4; the FOURTAP variant supports the +// frame scaling path. +var FilterKernels = [5]*[SubpelShifts][SubpelTaps]int16{ + &SubPelFilters8, + &SubPelFilters8lp, + &SubPelFilters8s, + &BilinearFilters, + &SubPelFilters4, +} diff --git a/internal/vp9/tables/kf_probs.go b/internal/vp9/tables/kf_probs.go new file mode 100644 index 0000000..95d6e77 --- /dev/null +++ b/internal/vp9/tables/kf_probs.go @@ -0,0 +1,172 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/kf_probs.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Code generated by gen_kf_probs.go from libvpx v1.16.0 +// vp9/common/vp9_entropymode.c. DO NOT EDIT. + +package tables + +// KfYModeProb mirrors libvpx's vp9_kf_y_mode_prob. +var KfYModeProb = [10][10][9]uint8{ + { + {137, 30, 42, 148, 151, 207, 70, 52, 91}, + {92, 45, 102, 136, 116, 180, 74, 90, 100}, + {73, 32, 19, 187, 222, 215, 46, 34, 100}, + {91, 30, 32, 116, 121, 186, 93, 86, 94}, + {72, 35, 36, 149, 68, 206, 68, 63, 105}, + {73, 31, 28, 138, 57, 124, 55, 122, 151}, + {67, 23, 21, 140, 126, 197, 40, 37, 171}, + {86, 27, 28, 128, 154, 212, 45, 43, 53}, + {74, 32, 27, 107, 86, 160, 63, 134, 102}, + {59, 67, 44, 140, 161, 202, 78, 67, 119}, + }, + { + {63, 36, 126, 146, 123, 158, 60, 90, 96}, + {43, 46, 168, 134, 107, 128, 69, 142, 92}, + {44, 29, 68, 159, 201, 177, 50, 57, 77}, + {58, 38, 76, 114, 97, 172, 78, 133, 92}, + {46, 41, 76, 140, 63, 184, 69, 112, 57}, + {38, 32, 85, 140, 46, 112, 54, 151, 133}, + {39, 27, 61, 131, 110, 175, 44, 75, 136}, + {52, 30, 74, 113, 130, 175, 51, 64, 58}, + {47, 35, 80, 100, 74, 143, 64, 163, 74}, + {36, 61, 116, 114, 128, 162, 80, 125, 82}, + }, + { + {82, 26, 26, 171, 208, 204, 44, 32, 105}, + {55, 44, 68, 166, 179, 192, 57, 57, 108}, + {42, 26, 11, 199, 241, 228, 23, 15, 85}, + {68, 42, 19, 131, 160, 199, 55, 52, 83}, + {58, 50, 25, 139, 115, 232, 39, 52, 118}, + {50, 35, 33, 153, 104, 162, 64, 59, 131}, + {44, 24, 16, 150, 177, 202, 33, 19, 156}, + {55, 27, 12, 153, 203, 218, 26, 27, 49}, + {53, 49, 21, 110, 116, 168, 59, 80, 76}, + {38, 72, 19, 168, 203, 212, 50, 50, 107}, + }, + { + {103, 26, 36, 129, 132, 201, 83, 80, 93}, + {59, 38, 83, 112, 103, 162, 98, 136, 90}, + {62, 30, 23, 158, 200, 207, 59, 57, 50}, + {67, 30, 29, 84, 86, 191, 102, 91, 59}, + {60, 32, 33, 112, 71, 220, 64, 89, 104}, + {53, 26, 34, 130, 56, 149, 84, 120, 103}, + {53, 21, 23, 133, 109, 210, 56, 77, 172}, + {77, 19, 29, 112, 142, 228, 55, 66, 36}, + {61, 29, 29, 93, 97, 165, 83, 175, 162}, + {47, 47, 43, 114, 137, 181, 100, 99, 95}, + }, + { + {69, 23, 29, 128, 83, 199, 46, 44, 101}, + {53, 40, 55, 139, 69, 183, 61, 80, 110}, + {40, 29, 19, 161, 180, 207, 43, 24, 91}, + {60, 34, 19, 105, 61, 198, 53, 64, 89}, + {52, 31, 22, 158, 40, 209, 58, 62, 89}, + {44, 31, 29, 147, 46, 158, 56, 102, 198}, + {35, 19, 12, 135, 87, 209, 41, 45, 167}, + {55, 25, 21, 118, 95, 215, 38, 39, 66}, + {51, 38, 25, 113, 58, 164, 70, 93, 97}, + {47, 54, 34, 146, 108, 203, 72, 103, 151}, + }, + { + {64, 19, 37, 156, 66, 138, 49, 95, 133}, + {46, 27, 80, 150, 55, 124, 55, 121, 135}, + {36, 23, 27, 165, 149, 166, 54, 64, 118}, + {53, 21, 36, 131, 63, 163, 60, 109, 81}, + {40, 26, 35, 154, 40, 185, 51, 97, 123}, + {35, 19, 34, 179, 19, 97, 48, 129, 124}, + {36, 20, 26, 136, 62, 164, 33, 77, 154}, + {45, 18, 32, 130, 90, 157, 40, 79, 91}, + {45, 26, 28, 129, 45, 129, 49, 147, 123}, + {38, 44, 51, 136, 74, 162, 57, 97, 121}, + }, + { + {75, 17, 22, 136, 138, 185, 32, 34, 166}, + {56, 39, 58, 133, 117, 173, 48, 53, 187}, + {35, 21, 12, 161, 212, 207, 20, 23, 145}, + {56, 29, 19, 117, 109, 181, 55, 68, 112}, + {47, 29, 17, 153, 64, 220, 59, 51, 114}, + {46, 16, 24, 136, 76, 147, 41, 64, 172}, + {34, 17, 11, 108, 152, 187, 13, 15, 209}, + {51, 24, 14, 115, 133, 209, 32, 26, 104}, + {55, 30, 18, 122, 79, 179, 44, 88, 116}, + {37, 49, 25, 129, 168, 164, 41, 54, 148}, + }, + { + {82, 22, 32, 127, 143, 213, 39, 41, 70}, + {62, 44, 61, 123, 105, 189, 48, 57, 64}, + {47, 25, 17, 175, 222, 220, 24, 30, 86}, + {68, 36, 17, 106, 102, 206, 59, 74, 74}, + {57, 39, 23, 151, 68, 216, 55, 63, 58}, + {49, 30, 35, 141, 70, 168, 82, 40, 115}, + {51, 25, 15, 136, 129, 202, 38, 35, 139}, + {68, 26, 16, 111, 141, 215, 29, 28, 28}, + {59, 39, 19, 114, 75, 180, 77, 104, 42}, + {40, 61, 26, 126, 152, 206, 61, 59, 93}, + }, + { + {78, 23, 39, 111, 117, 170, 74, 124, 94}, + {48, 34, 86, 101, 92, 146, 78, 179, 134}, + {47, 22, 24, 138, 187, 178, 68, 69, 59}, + {56, 25, 33, 105, 112, 187, 95, 177, 129}, + {48, 31, 27, 114, 63, 183, 82, 116, 56}, + {43, 28, 37, 121, 63, 123, 61, 192, 169}, + {42, 17, 24, 109, 97, 177, 56, 76, 122}, + {58, 18, 28, 105, 139, 182, 70, 92, 63}, + {46, 23, 32, 74, 86, 150, 67, 183, 88}, + {36, 38, 48, 92, 122, 165, 88, 137, 91}, + }, + { + {65, 70, 60, 155, 159, 199, 61, 60, 81}, + {44, 78, 115, 132, 119, 173, 71, 112, 93}, + {39, 38, 21, 184, 227, 206, 42, 32, 64}, + {58, 47, 36, 124, 137, 193, 80, 82, 78}, + {49, 50, 35, 144, 95, 205, 63, 78, 59}, + {41, 53, 52, 148, 71, 142, 65, 128, 51}, + {40, 36, 28, 143, 143, 202, 40, 55, 137}, + {52, 34, 29, 129, 183, 227, 42, 35, 43}, + {42, 44, 44, 104, 105, 164, 64, 130, 80}, + {43, 81, 53, 140, 169, 204, 68, 84, 72}, + }, +} + +// KfUvModeProb mirrors libvpx's vp9_kf_uv_mode_prob. +var KfUvModeProb = [10][9]uint8{ + {144, 11, 54, 157, 195, 130, 46, 58, 108}, + {118, 15, 123, 148, 131, 101, 44, 93, 131}, + {113, 12, 23, 188, 226, 142, 26, 32, 125}, + {120, 11, 50, 123, 163, 135, 64, 77, 103}, + {113, 9, 36, 155, 111, 157, 32, 44, 161}, + {116, 9, 55, 176, 76, 96, 37, 61, 149}, + {115, 9, 28, 141, 161, 167, 21, 25, 193}, + {120, 12, 32, 145, 195, 142, 32, 38, 86}, + {116, 12, 64, 120, 140, 125, 49, 115, 121}, + {102, 19, 66, 162, 182, 122, 35, 59, 128}, +} + +// KfPartitionProbs mirrors libvpx's vp9_kf_partition_probs. +var KfPartitionProbs = [16][3]uint8{ + {158, 97, 94}, + {93, 24, 99}, + {85, 119, 44}, + {62, 59, 67}, + {149, 53, 53}, + {94, 20, 48}, + {83, 53, 24}, + {52, 18, 18}, + {150, 40, 39}, + {78, 12, 26}, + {67, 33, 11}, + {24, 7, 5}, + {174, 35, 49}, + {68, 11, 27}, + {57, 15, 9}, + {12, 3, 3}, +} diff --git a/internal/vp9/tables/mode_context.go b/internal/vp9/tables/mode_context.go new file mode 100644 index 0000000..0fb2c91 --- /dev/null +++ b/internal/vp9/tables/mode_context.go @@ -0,0 +1,80 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/mode_context.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// VP9 motion-vector reference mode-context lookup tables. Ported +// byte-for-byte from libvpx v1.16.0 vp9/common/vp9_mvref_common.h — +// motion_vector_context enum, mode_2_counter[14], counter_to_context[19]. +// +// The neighbor walk in find_mv_refs_idx accumulates a context counter +// over the 8-neighbor scan (1 per NEWMV, 3 per ZEROMV, 9 per intra, +// 0 per NEAR/NEAREST). The resulting value (0..18) indexes +// CounterToContext to pick one of the seven motion_vector_context +// states the inter-mode tree consults. + +// VP9 motion-vector context states, mirroring the +// motion_vector_context enum. +const ( + BothZero = 0 + ZeroPlusPredicted = 1 + BothPredicted = 2 + NewPlusNonIntra = 3 + BothNew = 4 + IntraPlusNonIntra = 5 + BothIntra = 6 + InvalidCase = 9 +) + +// Mode2Counter mirrors libvpx's mode_2_counter[MB_MODE_COUNT]. +// 9 for any intra mode, 0 for NEAREST/NEAR, 3 for ZEROMV, 1 for +// NEWMV. The MB_MODE_COUNT layout follows PREDICTION_MODE: intra +// modes 0..9 then NEARESTMV(10), NEARMV(11), ZEROMV(12), NEWMV(13). +var Mode2Counter = [14]uint8{ + 9, // DcPred + 9, // VPred + 9, // HPred + 9, // D45Pred + 9, // D135Pred + 9, // D117Pred + 9, // D153Pred + 9, // D207Pred + 9, // D63Pred + 9, // TmPred + 0, // NearestMv + 0, // NearMv + 3, // ZeroMv + 1, // NewMv +} + +// CounterToContext mirrors libvpx's counter_to_context[19]. Index it +// with the accumulated neighbor-walk counter to pick the matching +// motion_vector_context state. +var CounterToContext = [19]uint8{ + BothPredicted, // 0 + NewPlusNonIntra, // 1 + BothNew, // 2 + ZeroPlusPredicted, // 3 + NewPlusNonIntra, // 4 + InvalidCase, // 5 + BothZero, // 6 + InvalidCase, // 7 + InvalidCase, // 8 + IntraPlusNonIntra, // 9 + IntraPlusNonIntra, // 10 + InvalidCase, // 11 + IntraPlusNonIntra, // 12 + InvalidCase, // 13 + InvalidCase, // 14 + InvalidCase, // 15 + InvalidCase, // 16 + InvalidCase, // 17 + BothIntra, // 18 +} diff --git a/internal/vp9/tables/mv_default.go b/internal/vp9/tables/mv_default.go new file mode 100644 index 0000000..d78fea2 --- /dev/null +++ b/internal/vp9/tables/mv_default.go @@ -0,0 +1,113 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/mv_default.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// VP9 motion-vector default probabilities and the canonical MV token +// trees that drive read_mv / read_mv_component / read_mv_class / +// read_mv_class0_fp via the boolean range coder. Ported byte-for-byte +// from libvpx v1.16.0 vp9/common/vp9_entropymv.c. + +// MV joint type values mirroring vp9_entropymv.h's MV_JOINT_*. +const ( + MvJointZero = 0 + MvJointHnzVz = 1 + MvJointHzVnz = 2 + MvJointHnzVnz = 3 +) + +// MvJointTree mirrors libvpx's vp9_mv_joint_tree — a 4-leaf binary +// tree over the four MV_JOINT codes. +var MvJointTree = [6]int8{ + -MvJointZero, 2, + -MvJointHnzVz, 4, + -MvJointHzVnz, -MvJointHnzVnz, +} + +// MV class enum values mirror MV_CLASS_0..MV_CLASS_10. +const ( + MvClass0 = 0 + MvClass1 = 1 + MvClass2 = 2 + MvClass3 = 3 + MvClass4 = 4 + MvClass5 = 5 + MvClass6 = 6 + MvClass7 = 7 + MvClass8 = 8 + MvClass9 = 9 + MvClass10 = 10 +) + +// MvClassTree mirrors libvpx's vp9_mv_class_tree — 11 classes. +var MvClassTree = [20]int8{ + -MvClass0, 2, -MvClass1, 4, 6, + 8, -MvClass2, -MvClass3, 10, 12, + -MvClass4, -MvClass5, -MvClass6, 14, 16, + 18, -MvClass7, -MvClass8, -MvClass9, -MvClass10, +} + +// MvClass0Tree mirrors libvpx's vp9_mv_class0_tree — a 2-leaf binary +// tree (single bit). +var MvClass0Tree = [2]int8{-0, -1} + +// MvFpTree mirrors libvpx's vp9_mv_fp_tree — fractional-pel position +// over 4 leaves. +var MvFpTree = [6]int8{ + -0, 2, + -1, 4, + -2, -3, +} + +// DefaultNmvComponent mirrors one of the two nmv_component blocks +// inside libvpx's default_nmv_context. The component struct layout +// matches the libvpx struct field order so the matching Go type in +// internal/vp9/decoder/compressed_mv.go can be seeded directly. +type DefaultNmvComponent struct { + Sign uint8 + Classes [10]uint8 + Class0 [1]uint8 + Bits [10]uint8 + Class0Fp [2][3]uint8 + Fp [3]uint8 + Class0Hp uint8 + Hp uint8 +} + +// DefaultNmvJoints mirrors libvpx's default_nmv_context.joints. +var DefaultNmvJoints = [3]uint8{32, 64, 96} + +// DefaultNmvComps mirrors libvpx's default_nmv_context.comps — +// (vertical, horizontal) seed probabilities for the motion-vector +// boolean coder. +var DefaultNmvComps = [2]DefaultNmvComponent{ + { + // Vertical component + Sign: 128, + Classes: [10]uint8{224, 144, 192, 168, 192, 176, 192, 198, 198, 245}, + Class0: [1]uint8{216}, + Bits: [10]uint8{136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, + Class0Fp: [2][3]uint8{{128, 128, 64}, {96, 112, 64}}, + Fp: [3]uint8{64, 96, 64}, + Class0Hp: 160, + Hp: 128, + }, + { + // Horizontal component + Sign: 128, + Classes: [10]uint8{216, 128, 176, 160, 176, 176, 192, 198, 198, 208}, + Class0: [1]uint8{208}, + Bits: [10]uint8{136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, + Class0Fp: [2][3]uint8{{128, 128, 64}, {96, 112, 64}}, + Fp: [3]uint8{64, 96, 64}, + Class0Hp: 160, + Hp: 128, + }, +} diff --git a/internal/vp9/tables/mvref_blocks.go b/internal/vp9/tables/mvref_blocks.go new file mode 100644 index 0000000..604414e --- /dev/null +++ b/internal/vp9/tables/mvref_blocks.go @@ -0,0 +1,39 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/mvref_blocks.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Code generated by gen_mvref_blocks.go from libvpx v1.16.0 +// vp9/common/vp9_mvref_common.h. DO NOT EDIT. + +package tables + +// Position mirrors libvpx's struct position — a signed (row,col) +// pair used to address an 8x8 neighbor in the mode-info ring. +type Position struct { + Row, Col int8 +} + +// MvRefBlocks mirrors libvpx's mv_ref_blocks[BLOCK_SIZES][8] — +// the eight-neighbor scan order the MV-ref candidate search uses +// per block size to find inter predictors. +var MvRefBlocks = [13][8]Position{ + {{-1, 0}, {0, -1}, {-1, -1}, {-2, 0}, {0, -2}, {-2, -1}, {-1, -2}, {-2, -2}}, + {{-1, 0}, {0, -1}, {-1, -1}, {-2, 0}, {0, -2}, {-2, -1}, {-1, -2}, {-2, -2}}, + {{-1, 0}, {0, -1}, {-1, -1}, {-2, 0}, {0, -2}, {-2, -1}, {-1, -2}, {-2, -2}}, + {{-1, 0}, {0, -1}, {-1, -1}, {-2, 0}, {0, -2}, {-2, -1}, {-1, -2}, {-2, -2}}, + {{0, -1}, {-1, 0}, {1, -1}, {-1, -1}, {0, -2}, {-2, 0}, {-2, -1}, {-1, -2}}, + {{-1, 0}, {0, -1}, {-1, 1}, {-1, -1}, {-2, 0}, {0, -2}, {-1, -2}, {-2, -1}}, + {{-1, 0}, {0, -1}, {-1, 1}, {1, -1}, {-1, -1}, {-3, 0}, {0, -3}, {-3, -3}}, + {{0, -1}, {-1, 0}, {2, -1}, {-1, -1}, {-1, 1}, {0, -3}, {-3, 0}, {-3, -3}}, + {{-1, 0}, {0, -1}, {-1, 2}, {-1, -1}, {1, -1}, {-3, 0}, {0, -3}, {-3, -3}}, + {{-1, 1}, {1, -1}, {-1, 2}, {2, -1}, {-1, -1}, {-3, 0}, {0, -3}, {-3, -3}}, + {{0, -1}, {-1, 0}, {4, -1}, {-1, 2}, {-1, -1}, {0, -3}, {-3, 0}, {2, -1}}, + {{-1, 0}, {0, -1}, {-1, 4}, {2, -1}, {-1, -1}, {-3, 0}, {0, -3}, {-1, 2}}, + {{-1, 3}, {3, -1}, {-1, 4}, {4, -1}, {-1, -1}, {-1, 0}, {0, -1}, {-1, 6}}, +} diff --git a/internal/vp9/tables/quant.go b/internal/vp9/tables/quant.go new file mode 100644 index 0000000..b63e3f6 --- /dev/null +++ b/internal/vp9/tables/quant.go @@ -0,0 +1,176 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/quant.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package tables + +// Ported byte-for-byte from libvpx v1.16.0 vp9/common/vp9_quant_common.c. +// +// dc_qlookup / ac_qlookup map an 8-bit quantizer index to the actual +// dequant multiplier used to reconstruct transform coefficients. Public VP9 +// support uses the 8-bit profile 0 tables; the 10-bit and 12-bit tables are +// retained as libvpx-derived data for unsupported profile-family parsing. + +// QindexRange is the number of valid qindex values, 0..255 inclusive. +const ( + MinQ = 0 + MaxQ = 255 + QindexRange = MaxQ - MinQ + 1 +) + +// DcQLookup8 is the DC dequant table for 8-bit profile 0/1 streams. +var DcQLookup8 = [QindexRange]int16{ + 4, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, + 19, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, + 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, + 43, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 53, + 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, + 66, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 74, 75, 76, + 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 85, 85, 87, 88, + 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 107, 108, 110, + 111, 113, 114, 116, 117, 118, 120, 121, 123, 125, 127, 129, 131, 134, + 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 161, 164, + 166, 169, 172, 174, 177, 180, 182, 185, 187, 190, 192, 195, 199, 202, + 205, 208, 211, 214, 217, 220, 223, 226, 230, 233, 237, 240, 243, 247, + 250, 253, 257, 261, 265, 269, 272, 276, 280, 284, 288, 292, 296, 300, + 304, 309, 313, 317, 322, 326, 330, 335, 340, 344, 349, 354, 359, 364, + 369, 374, 379, 384, 389, 395, 400, 406, 411, 417, 423, 429, 435, 441, + 447, 454, 461, 467, 475, 482, 489, 497, 505, 513, 522, 530, 539, 549, + 559, 569, 579, 590, 602, 614, 626, 640, 654, 668, 684, 700, 717, 736, + 755, 775, 796, 819, 843, 869, 896, 925, 955, 988, 1022, 1058, 1098, 1139, + 1184, 1232, 1282, 1336, +} + +// DcQLookup10 is the DC dequant table for 10-bit streams (profile 2). +var DcQLookup10 = [QindexRange]int16{ + 4, 9, 10, 13, 15, 17, 20, 22, 25, 28, 31, 34, 37, + 40, 43, 47, 50, 53, 57, 60, 64, 68, 71, 75, 78, 82, + 86, 90, 93, 97, 101, 105, 109, 113, 116, 120, 124, 128, 132, + 136, 140, 143, 147, 151, 155, 159, 163, 166, 170, 174, 178, 182, + 185, 189, 193, 197, 200, 204, 208, 212, 215, 219, 223, 226, 230, + 233, 237, 241, 244, 248, 251, 255, 259, 262, 266, 269, 273, 276, + 280, 283, 287, 290, 293, 297, 300, 304, 307, 310, 314, 317, 321, + 324, 327, 331, 334, 337, 343, 350, 356, 362, 369, 375, 381, 387, + 394, 400, 406, 412, 418, 424, 430, 436, 442, 448, 454, 460, 466, + 472, 478, 484, 490, 499, 507, 516, 525, 533, 542, 550, 559, 567, + 576, 584, 592, 601, 609, 617, 625, 634, 644, 655, 666, 676, 687, + 698, 708, 718, 729, 739, 749, 759, 770, 782, 795, 807, 819, 831, + 844, 856, 868, 880, 891, 906, 920, 933, 947, 961, 975, 988, 1001, + 1015, 1030, 1045, 1061, 1076, 1090, 1105, 1120, 1137, 1153, 1170, 1186, 1202, + 1218, 1236, 1253, 1271, 1288, 1306, 1323, 1342, 1361, 1379, 1398, 1416, 1436, + 1456, 1476, 1496, 1516, 1537, 1559, 1580, 1601, 1624, 1647, 1670, 1692, 1717, + 1741, 1766, 1791, 1817, 1844, 1871, 1900, 1929, 1958, 1990, 2021, 2054, 2088, + 2123, 2159, 2197, 2236, 2276, 2319, 2363, 2410, 2458, 2508, 2561, 2616, 2675, + 2737, 2802, 2871, 2944, 3020, 3102, 3188, 3280, 3375, 3478, 3586, 3702, 3823, + 3953, 4089, 4236, 4394, 4559, 4737, 4929, 5130, 5347, +} + +// DcQLookup12 is the DC dequant table for 12-bit streams (profile 3). +var DcQLookup12 = [QindexRange]int16{ + 4, 12, 18, 25, 33, 41, 50, 60, 70, 80, 91, + 103, 115, 127, 140, 153, 166, 180, 194, 208, 222, 237, + 251, 266, 281, 296, 312, 327, 343, 358, 374, 390, 405, + 421, 437, 453, 469, 484, 500, 516, 532, 548, 564, 580, + 596, 611, 627, 643, 659, 674, 690, 706, 721, 737, 752, + 768, 783, 798, 814, 829, 844, 859, 874, 889, 904, 919, + 934, 949, 964, 978, 993, 1008, 1022, 1037, 1051, 1065, 1080, + 1094, 1108, 1122, 1136, 1151, 1165, 1179, 1192, 1206, 1220, 1234, + 1248, 1261, 1275, 1288, 1302, 1315, 1329, 1342, 1368, 1393, 1419, + 1444, 1469, 1494, 1519, 1544, 1569, 1594, 1618, 1643, 1668, 1692, + 1717, 1741, 1765, 1789, 1814, 1838, 1862, 1885, 1909, 1933, 1957, + 1992, 2027, 2061, 2096, 2130, 2165, 2199, 2233, 2267, 2300, 2334, + 2367, 2400, 2434, 2467, 2499, 2532, 2575, 2618, 2661, 2704, 2746, + 2788, 2830, 2872, 2913, 2954, 2995, 3036, 3076, 3127, 3177, 3226, + 3275, 3324, 3373, 3421, 3469, 3517, 3565, 3621, 3677, 3733, 3788, + 3843, 3897, 3951, 4005, 4058, 4119, 4181, 4241, 4301, 4361, 4420, + 4479, 4546, 4612, 4677, 4742, 4807, 4871, 4942, 5013, 5083, 5153, + 5222, 5291, 5367, 5442, 5517, 5591, 5665, 5745, 5825, 5905, 5984, + 6063, 6149, 6234, 6319, 6404, 6495, 6587, 6678, 6769, 6867, 6966, + 7064, 7163, 7269, 7376, 7483, 7599, 7715, 7832, 7958, 8085, 8214, + 8352, 8492, 8635, 8788, 8945, 9104, 9275, 9450, 9639, 9832, 10031, + 10245, 10465, 10702, 10946, 11210, 11482, 11776, 12081, 12409, 12750, 13118, + 13501, 13913, 14343, 14807, 15290, 15812, 16356, 16943, 17575, 18237, 18949, + 19718, 20521, 21387, +} + +// AcQLookup8 is the AC dequant table for 8-bit profile 0/1 streams. +var AcQLookup8 = [QindexRange]int16{ + 4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 104, 106, 108, 110, 112, 114, 116, 118, + 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, + 146, 148, 150, 152, 155, 158, 161, 164, 167, 170, 173, 176, 179, + 182, 185, 188, 191, 194, 197, 200, 203, 207, 211, 215, 219, 223, + 227, 231, 235, 239, 243, 247, 251, 255, 260, 265, 270, 275, 280, + 285, 290, 295, 300, 305, 311, 317, 323, 329, 335, 341, 347, 353, + 359, 366, 373, 380, 387, 394, 401, 408, 416, 424, 432, 440, 448, + 456, 465, 474, 483, 492, 501, 510, 520, 530, 540, 550, 560, 571, + 582, 593, 604, 615, 627, 639, 651, 663, 676, 689, 702, 715, 729, + 743, 757, 771, 786, 801, 816, 832, 848, 864, 881, 898, 915, 933, + 951, 969, 988, 1007, 1026, 1046, 1066, 1087, 1108, 1129, 1151, 1173, 1196, + 1219, 1243, 1267, 1292, 1317, 1343, 1369, 1396, 1423, 1451, 1479, 1508, 1537, + 1567, 1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828, +} + +// AcQLookup10 is the AC dequant table for 10-bit streams (profile 2). +var AcQLookup10 = [QindexRange]int16{ + 4, 9, 11, 13, 16, 18, 21, 24, 27, 30, 33, 37, 40, + 44, 48, 51, 55, 59, 63, 67, 71, 75, 79, 83, 88, 92, + 96, 100, 105, 109, 114, 118, 122, 127, 131, 136, 140, 145, 149, + 154, 158, 163, 168, 172, 177, 181, 186, 190, 195, 199, 204, 208, + 213, 217, 222, 226, 231, 235, 240, 244, 249, 253, 258, 262, 267, + 271, 275, 280, 284, 289, 293, 297, 302, 306, 311, 315, 319, 324, + 328, 332, 337, 341, 345, 349, 354, 358, 362, 367, 371, 375, 379, + 384, 388, 392, 396, 401, 409, 417, 425, 433, 441, 449, 458, 466, + 474, 482, 490, 498, 506, 514, 523, 531, 539, 547, 555, 563, 571, + 579, 588, 596, 604, 616, 628, 640, 652, 664, 676, 688, 700, 713, + 725, 737, 749, 761, 773, 785, 797, 809, 825, 841, 857, 873, 889, + 905, 922, 938, 954, 970, 986, 1002, 1018, 1038, 1058, 1078, 1098, 1118, + 1138, 1158, 1178, 1198, 1218, 1242, 1266, 1290, 1314, 1338, 1362, 1386, 1411, + 1435, 1463, 1491, 1519, 1547, 1575, 1603, 1631, 1663, 1695, 1727, 1759, 1791, + 1823, 1859, 1895, 1931, 1967, 2003, 2039, 2079, 2119, 2159, 2199, 2239, 2283, + 2327, 2371, 2415, 2459, 2507, 2555, 2603, 2651, 2703, 2755, 2807, 2859, 2915, + 2971, 3027, 3083, 3143, 3203, 3263, 3327, 3391, 3455, 3523, 3591, 3659, 3731, + 3803, 3876, 3952, 4028, 4104, 4184, 4264, 4348, 4432, 4516, 4604, 4692, 4784, + 4876, 4972, 5068, 5168, 5268, 5372, 5476, 5584, 5692, 5804, 5916, 6032, 6148, + 6268, 6388, 6512, 6640, 6768, 6900, 7036, 7172, 7312, +} + +// AcQLookup12 is the AC dequant table for 12-bit streams (profile 3). +var AcQLookup12 = [QindexRange]int16{ + 4, 13, 19, 27, 35, 44, 54, 64, 75, 87, 99, + 112, 126, 139, 154, 168, 183, 199, 214, 230, 247, 263, + 280, 297, 314, 331, 349, 366, 384, 402, 420, 438, 456, + 475, 493, 511, 530, 548, 567, 586, 604, 623, 642, 660, + 679, 698, 716, 735, 753, 772, 791, 809, 828, 846, 865, + 884, 902, 920, 939, 957, 976, 994, 1012, 1030, 1049, 1067, + 1085, 1103, 1121, 1139, 1157, 1175, 1193, 1211, 1229, 1246, 1264, + 1282, 1299, 1317, 1335, 1352, 1370, 1387, 1405, 1422, 1440, 1457, + 1474, 1491, 1509, 1526, 1543, 1560, 1577, 1595, 1627, 1660, 1693, + 1725, 1758, 1791, 1824, 1856, 1889, 1922, 1954, 1987, 2020, 2052, + 2085, 2118, 2150, 2183, 2216, 2248, 2281, 2313, 2346, 2378, 2411, + 2459, 2508, 2556, 2605, 2653, 2701, 2750, 2798, 2847, 2895, 2943, + 2992, 3040, 3088, 3137, 3185, 3234, 3298, 3362, 3426, 3491, 3555, + 3619, 3684, 3748, 3812, 3876, 3941, 4005, 4069, 4149, 4230, 4310, + 4390, 4470, 4550, 4631, 4711, 4791, 4871, 4967, 5064, 5160, 5256, + 5352, 5448, 5544, 5641, 5737, 5849, 5961, 6073, 6185, 6297, 6410, + 6522, 6650, 6778, 6906, 7034, 7162, 7290, 7435, 7579, 7723, 7867, + 8011, 8155, 8315, 8475, 8635, 8795, 8956, 9132, 9308, 9484, 9660, + 9836, 10028, 10220, 10412, 10604, 10812, 11020, 11228, 11437, 11661, 11885, + 12109, 12333, 12573, 12813, 13053, 13309, 13565, 13821, 14093, 14365, 14637, + 14925, 15213, 15502, 15806, 16110, 16414, 16734, 17054, 17390, 17726, 18062, + 18414, 18766, 19134, 19502, 19886, 20270, 20670, 21070, 21486, 21902, 22334, + 22766, 23214, 23662, 24126, 24590, 25070, 25551, 26047, 26559, 27071, 27599, + 28143, 28687, 29247, +} diff --git a/internal/vp9/tables/scan.go b/internal/vp9/tables/scan.go new file mode 100644 index 0000000..5a42840 --- /dev/null +++ b/internal/vp9/tables/scan.go @@ -0,0 +1,652 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vp9/tables/scan.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Code generated by gen_scan.go from libvpx v1.16.0 +// vp9/common/vp9_scan.c. DO NOT EDIT. + +package tables + +// ColScan16x16 mirrors libvpx col_scan_16x16. +var ColScan16x16 = [256]int16{ + 0, 16, 32, 48, 1, 64, 17, 80, 33, 96, 49, 2, 65, 112, 18, 81, + 34, 128, 50, 97, 3, 66, 144, 19, 113, 35, 82, 160, 98, 51, 129, 4, + 67, 176, 20, 114, 145, 83, 36, 99, 130, 52, 192, 5, 161, 68, 115, 21, + 146, 84, 208, 177, 37, 131, 100, 53, 162, 224, 69, 6, 116, 193, 147, 85, + 22, 240, 132, 38, 178, 101, 163, 54, 209, 117, 70, 7, 148, 194, 86, 179, + 225, 23, 133, 39, 164, 8, 102, 210, 241, 55, 195, 118, 149, 71, 180, 24, + 87, 226, 134, 165, 211, 40, 103, 56, 72, 150, 196, 242, 119, 9, 181, 227, + 88, 166, 25, 135, 41, 104, 212, 57, 151, 197, 120, 73, 243, 182, 136, 167, + 213, 89, 10, 228, 105, 152, 198, 26, 42, 121, 183, 244, 168, 58, 137, 229, + 74, 214, 90, 153, 199, 184, 11, 106, 245, 27, 122, 230, 169, 43, 215, 59, + 200, 138, 185, 246, 75, 12, 91, 154, 216, 231, 107, 28, 44, 201, 123, 170, + 60, 247, 232, 76, 139, 13, 92, 217, 186, 248, 155, 108, 29, 124, 45, 202, + 233, 171, 61, 14, 77, 140, 15, 249, 93, 30, 187, 156, 218, 46, 109, 125, + 62, 172, 78, 203, 31, 141, 234, 94, 47, 188, 63, 157, 110, 250, 219, 79, + 126, 204, 173, 142, 95, 189, 111, 235, 158, 220, 251, 127, 174, 143, 205, 236, + 159, 190, 221, 252, 175, 206, 237, 191, 253, 222, 238, 207, 254, 223, 239, 255, +} + +// ColScan16x16Neighbors mirrors libvpx col_scan_16x16_neighbors. +var ColScan16x16Neighbors = [514]int16{ + 0, 0, 0, 0, 16, 16, 32, 32, 0, 0, 48, 48, 1, 1, 64, 64, + 17, 17, 80, 80, 33, 33, 1, 1, 49, 49, 96, 96, 2, 2, 65, 65, + 18, 18, 112, 112, 34, 34, 81, 81, 2, 2, 50, 50, 128, 128, 3, 3, + 97, 97, 19, 19, 66, 66, 144, 144, 82, 82, 35, 35, 113, 113, 3, 3, + 51, 51, 160, 160, 4, 4, 98, 98, 129, 129, 67, 67, 20, 20, 83, 83, + 114, 114, 36, 36, 176, 176, 4, 4, 145, 145, 52, 52, 99, 99, 5, 5, + 130, 130, 68, 68, 192, 192, 161, 161, 21, 21, 115, 115, 84, 84, 37, 37, + 146, 146, 208, 208, 53, 53, 5, 5, 100, 100, 177, 177, 131, 131, 69, 69, + 6, 6, 224, 224, 116, 116, 22, 22, 162, 162, 85, 85, 147, 147, 38, 38, + 193, 193, 101, 101, 54, 54, 6, 6, 132, 132, 178, 178, 70, 70, 163, 163, + 209, 209, 7, 7, 117, 117, 23, 23, 148, 148, 7, 7, 86, 86, 194, 194, + 225, 225, 39, 39, 179, 179, 102, 102, 133, 133, 55, 55, 164, 164, 8, 8, + 71, 71, 210, 210, 118, 118, 149, 149, 195, 195, 24, 24, 87, 87, 40, 40, + 56, 56, 134, 134, 180, 180, 226, 226, 103, 103, 8, 8, 165, 165, 211, 211, + 72, 72, 150, 150, 9, 9, 119, 119, 25, 25, 88, 88, 196, 196, 41, 41, + 135, 135, 181, 181, 104, 104, 57, 57, 227, 227, 166, 166, 120, 120, 151, 151, + 197, 197, 73, 73, 9, 9, 212, 212, 89, 89, 136, 136, 182, 182, 10, 10, + 26, 26, 105, 105, 167, 167, 228, 228, 152, 152, 42, 42, 121, 121, 213, 213, + 58, 58, 198, 198, 74, 74, 137, 137, 183, 183, 168, 168, 10, 10, 90, 90, + 229, 229, 11, 11, 106, 106, 214, 214, 153, 153, 27, 27, 199, 199, 43, 43, + 184, 184, 122, 122, 169, 169, 230, 230, 59, 59, 11, 11, 75, 75, 138, 138, + 200, 200, 215, 215, 91, 91, 12, 12, 28, 28, 185, 185, 107, 107, 154, 154, + 44, 44, 231, 231, 216, 216, 60, 60, 123, 123, 12, 12, 76, 76, 201, 201, + 170, 170, 232, 232, 139, 139, 92, 92, 13, 13, 108, 108, 29, 29, 186, 186, + 217, 217, 155, 155, 45, 45, 13, 13, 61, 61, 124, 124, 14, 14, 233, 233, + 77, 77, 14, 14, 171, 171, 140, 140, 202, 202, 30, 30, 93, 93, 109, 109, + 46, 46, 156, 156, 62, 62, 187, 187, 15, 15, 125, 125, 218, 218, 78, 78, + 31, 31, 172, 172, 47, 47, 141, 141, 94, 94, 234, 234, 203, 203, 63, 63, + 110, 110, 188, 188, 157, 157, 126, 126, 79, 79, 173, 173, 95, 95, 219, 219, + 142, 142, 204, 204, 235, 235, 111, 111, 158, 158, 127, 127, 189, 189, 220, 220, + 143, 143, 174, 174, 205, 205, 236, 236, 159, 159, 190, 190, 221, 221, 175, 175, + 237, 237, 206, 206, 222, 222, 191, 191, 238, 238, 207, 207, 223, 223, 239, 239, + 0, 0, +} + +// ColScan4x4 mirrors libvpx col_scan_4x4. +var ColScan4x4 = [16]int16{ + 0, 4, 8, 1, 12, 5, 9, 2, 13, 6, 10, 3, 7, 14, 11, 15, +} + +// ColScan4x4Neighbors mirrors libvpx col_scan_4x4_neighbors. +var ColScan4x4Neighbors = [34]int16{ + 0, 0, 0, 0, 4, 4, 0, 0, 8, 8, 1, 1, 5, 5, 1, 1, + 9, 9, 2, 2, 6, 6, 2, 2, 3, 3, 10, 10, 7, 7, 11, 11, + 0, 0, +} + +// ColScan8x8 mirrors libvpx col_scan_8x8. +var ColScan8x8 = [64]int16{ + 0, 8, 16, 1, 24, 9, 32, 17, 2, 40, 25, 10, 33, 18, 48, 3, + 26, 41, 11, 56, 19, 34, 4, 49, 27, 42, 12, 35, 20, 57, 50, 28, + 5, 43, 13, 36, 58, 51, 21, 44, 6, 29, 59, 37, 14, 52, 22, 7, + 45, 60, 30, 15, 38, 53, 23, 46, 31, 61, 39, 54, 47, 62, 55, 63, +} + +// ColScan8x8Neighbors mirrors libvpx col_scan_8x8_neighbors. +var ColScan8x8Neighbors = [130]int16{ + 0, 0, 0, 0, 8, 8, 0, 0, 16, 16, 1, 1, 24, 24, 9, 9, + 1, 1, 32, 32, 17, 17, 2, 2, 25, 25, 10, 10, 40, 40, 2, 2, + 18, 18, 33, 33, 3, 3, 48, 48, 11, 11, 26, 26, 3, 3, 41, 41, + 19, 19, 34, 34, 4, 4, 27, 27, 12, 12, 49, 49, 42, 42, 20, 20, + 4, 4, 35, 35, 5, 5, 28, 28, 50, 50, 43, 43, 13, 13, 36, 36, + 5, 5, 21, 21, 51, 51, 29, 29, 6, 6, 44, 44, 14, 14, 6, 6, + 37, 37, 52, 52, 22, 22, 7, 7, 30, 30, 45, 45, 15, 15, 38, 38, + 23, 23, 53, 53, 31, 31, 46, 46, 39, 39, 54, 54, 47, 47, 55, 55, + 0, 0, +} + +// DefaultScan16x16 mirrors libvpx default_scan_16x16. +var DefaultScan16x16 = [256]int16{ + 0, 16, 1, 32, 17, 2, 48, 33, 18, 3, 64, 34, 49, 19, 65, 80, + 50, 4, 35, 66, 20, 81, 96, 51, 5, 36, 82, 97, 67, 112, 21, 52, + 98, 37, 83, 113, 6, 68, 128, 53, 22, 99, 114, 84, 7, 129, 38, 69, + 100, 115, 144, 130, 85, 54, 23, 8, 145, 39, 70, 116, 101, 131, 160, 146, + 55, 86, 24, 71, 132, 117, 161, 40, 9, 102, 147, 176, 162, 87, 56, 25, + 133, 118, 177, 148, 72, 103, 41, 163, 10, 192, 178, 88, 57, 134, 149, 119, + 26, 164, 73, 104, 193, 42, 179, 208, 11, 135, 89, 165, 120, 150, 58, 194, + 180, 27, 74, 209, 105, 151, 136, 43, 90, 224, 166, 195, 181, 121, 210, 59, + 12, 152, 106, 167, 196, 75, 137, 225, 211, 240, 182, 122, 91, 28, 197, 13, + 226, 168, 183, 153, 44, 212, 138, 107, 241, 60, 29, 123, 198, 184, 227, 169, + 242, 76, 213, 154, 45, 92, 14, 199, 139, 61, 228, 214, 170, 185, 243, 108, + 77, 155, 30, 15, 200, 229, 124, 215, 244, 93, 46, 186, 171, 201, 109, 140, + 230, 62, 216, 245, 31, 125, 78, 156, 231, 47, 187, 202, 217, 94, 246, 141, + 63, 232, 172, 110, 247, 157, 79, 218, 203, 126, 233, 188, 248, 95, 173, 142, + 219, 111, 249, 234, 158, 127, 189, 204, 250, 235, 143, 174, 220, 205, 159, 251, + 190, 221, 175, 236, 237, 191, 206, 252, 222, 253, 207, 238, 223, 254, 239, 255, +} + +// DefaultScan16x16Neighbors mirrors libvpx default_scan_16x16_neighbors. +var DefaultScan16x16Neighbors = [514]int16{ + 0, 0, 0, 0, 0, 0, 16, 16, 1, 16, 1, 1, 32, 32, 17, 32, + 2, 17, 2, 2, 48, 48, 18, 33, 33, 48, 3, 18, 49, 64, 64, 64, + 34, 49, 3, 3, 19, 34, 50, 65, 4, 19, 65, 80, 80, 80, 35, 50, + 4, 4, 20, 35, 66, 81, 81, 96, 51, 66, 96, 96, 5, 20, 36, 51, + 82, 97, 21, 36, 67, 82, 97, 112, 5, 5, 52, 67, 112, 112, 37, 52, + 6, 21, 83, 98, 98, 113, 68, 83, 6, 6, 113, 128, 22, 37, 53, 68, + 84, 99, 99, 114, 128, 128, 114, 129, 69, 84, 38, 53, 7, 22, 7, 7, + 129, 144, 23, 38, 54, 69, 100, 115, 85, 100, 115, 130, 144, 144, 130, 145, + 39, 54, 70, 85, 8, 23, 55, 70, 116, 131, 101, 116, 145, 160, 24, 39, + 8, 8, 86, 101, 131, 146, 160, 160, 146, 161, 71, 86, 40, 55, 9, 24, + 117, 132, 102, 117, 161, 176, 132, 147, 56, 71, 87, 102, 25, 40, 147, 162, + 9, 9, 176, 176, 162, 177, 72, 87, 41, 56, 118, 133, 133, 148, 103, 118, + 10, 25, 148, 163, 57, 72, 88, 103, 177, 192, 26, 41, 163, 178, 192, 192, + 10, 10, 119, 134, 73, 88, 149, 164, 104, 119, 134, 149, 42, 57, 178, 193, + 164, 179, 11, 26, 58, 73, 193, 208, 89, 104, 135, 150, 120, 135, 27, 42, + 74, 89, 208, 208, 150, 165, 179, 194, 165, 180, 105, 120, 194, 209, 43, 58, + 11, 11, 136, 151, 90, 105, 151, 166, 180, 195, 59, 74, 121, 136, 209, 224, + 195, 210, 224, 224, 166, 181, 106, 121, 75, 90, 12, 27, 181, 196, 12, 12, + 210, 225, 152, 167, 167, 182, 137, 152, 28, 43, 196, 211, 122, 137, 91, 106, + 225, 240, 44, 59, 13, 28, 107, 122, 182, 197, 168, 183, 211, 226, 153, 168, + 226, 241, 60, 75, 197, 212, 138, 153, 29, 44, 76, 91, 13, 13, 183, 198, + 123, 138, 45, 60, 212, 227, 198, 213, 154, 169, 169, 184, 227, 242, 92, 107, + 61, 76, 139, 154, 14, 29, 14, 14, 184, 199, 213, 228, 108, 123, 199, 214, + 228, 243, 77, 92, 30, 45, 170, 185, 155, 170, 185, 200, 93, 108, 124, 139, + 214, 229, 46, 61, 200, 215, 229, 244, 15, 30, 109, 124, 62, 77, 140, 155, + 215, 230, 31, 46, 171, 186, 186, 201, 201, 216, 78, 93, 230, 245, 125, 140, + 47, 62, 216, 231, 156, 171, 94, 109, 231, 246, 141, 156, 63, 78, 202, 217, + 187, 202, 110, 125, 217, 232, 172, 187, 232, 247, 79, 94, 157, 172, 126, 141, + 203, 218, 95, 110, 233, 248, 218, 233, 142, 157, 111, 126, 173, 188, 188, 203, + 234, 249, 219, 234, 127, 142, 158, 173, 204, 219, 189, 204, 143, 158, 235, 250, + 174, 189, 205, 220, 159, 174, 220, 235, 221, 236, 175, 190, 190, 205, 236, 251, + 206, 221, 237, 252, 191, 206, 222, 237, 207, 222, 238, 253, 223, 238, 239, 254, + 0, 0, +} + +// DefaultScan32x32 mirrors libvpx default_scan_32x32. +var DefaultScan32x32 = [1024]int16{ + 0, 32, 1, 64, 33, 2, 96, 65, 34, 128, 3, 97, 66, 160, 129, 35, + 98, 4, 67, 130, 161, 192, 36, 99, 224, 5, 162, 193, 68, 131, 37, 100, + 225, 194, 256, 163, 69, 132, 6, 226, 257, 288, 195, 101, 164, 38, 258, 7, + 227, 289, 133, 320, 70, 196, 165, 290, 259, 228, 39, 321, 102, 352, 8, 197, + 71, 134, 322, 291, 260, 353, 384, 229, 166, 103, 40, 354, 323, 292, 135, 385, + 198, 261, 72, 9, 416, 167, 386, 355, 230, 324, 104, 293, 41, 417, 199, 136, + 262, 387, 448, 325, 356, 10, 73, 418, 231, 168, 449, 294, 388, 105, 419, 263, + 42, 200, 357, 450, 137, 480, 74, 326, 232, 11, 389, 169, 295, 420, 106, 451, + 481, 358, 264, 327, 201, 43, 138, 512, 482, 390, 296, 233, 170, 421, 75, 452, + 359, 12, 513, 265, 483, 328, 107, 202, 514, 544, 422, 391, 453, 139, 44, 234, + 484, 297, 360, 171, 76, 515, 545, 266, 329, 454, 13, 423, 203, 108, 546, 485, + 576, 298, 235, 140, 361, 330, 172, 547, 45, 455, 267, 577, 486, 77, 204, 362, + 608, 14, 299, 578, 109, 236, 487, 609, 331, 141, 579, 46, 15, 173, 610, 363, + 78, 205, 16, 110, 237, 611, 142, 47, 174, 79, 206, 17, 111, 238, 48, 143, + 80, 175, 112, 207, 49, 18, 239, 81, 113, 19, 50, 82, 114, 51, 83, 115, + 640, 516, 392, 268, 144, 20, 672, 641, 548, 517, 424, 393, 300, 269, 176, 145, + 52, 21, 704, 673, 642, 580, 549, 518, 456, 425, 394, 332, 301, 270, 208, 177, + 146, 84, 53, 22, 736, 705, 674, 643, 612, 581, 550, 519, 488, 457, 426, 395, + 364, 333, 302, 271, 240, 209, 178, 147, 116, 85, 54, 23, 737, 706, 675, 613, + 582, 551, 489, 458, 427, 365, 334, 303, 241, 210, 179, 117, 86, 55, 738, 707, + 614, 583, 490, 459, 366, 335, 242, 211, 118, 87, 739, 615, 491, 367, 243, 119, + 768, 644, 520, 396, 272, 148, 24, 800, 769, 676, 645, 552, 521, 428, 397, 304, + 273, 180, 149, 56, 25, 832, 801, 770, 708, 677, 646, 584, 553, 522, 460, 429, + 398, 336, 305, 274, 212, 181, 150, 88, 57, 26, 864, 833, 802, 771, 740, 709, + 678, 647, 616, 585, 554, 523, 492, 461, 430, 399, 368, 337, 306, 275, 244, 213, + 182, 151, 120, 89, 58, 27, 865, 834, 803, 741, 710, 679, 617, 586, 555, 493, + 462, 431, 369, 338, 307, 245, 214, 183, 121, 90, 59, 866, 835, 742, 711, 618, + 587, 494, 463, 370, 339, 246, 215, 122, 91, 867, 743, 619, 495, 371, 247, 123, + 896, 772, 648, 524, 400, 276, 152, 28, 928, 897, 804, 773, 680, 649, 556, 525, + 432, 401, 308, 277, 184, 153, 60, 29, 960, 929, 898, 836, 805, 774, 712, 681, + 650, 588, 557, 526, 464, 433, 402, 340, 309, 278, 216, 185, 154, 92, 61, 30, + 992, 961, 930, 899, 868, 837, 806, 775, 744, 713, 682, 651, 620, 589, 558, 527, + 496, 465, 434, 403, 372, 341, 310, 279, 248, 217, 186, 155, 124, 93, 62, 31, + 993, 962, 931, 869, 838, 807, 745, 714, 683, 621, 590, 559, 497, 466, 435, 373, + 342, 311, 249, 218, 187, 125, 94, 63, 994, 963, 870, 839, 746, 715, 622, 591, + 498, 467, 374, 343, 250, 219, 126, 95, 995, 871, 747, 623, 499, 375, 251, 127, + 900, 776, 652, 528, 404, 280, 156, 932, 901, 808, 777, 684, 653, 560, 529, 436, + 405, 312, 281, 188, 157, 964, 933, 902, 840, 809, 778, 716, 685, 654, 592, 561, + 530, 468, 437, 406, 344, 313, 282, 220, 189, 158, 996, 965, 934, 903, 872, 841, + 810, 779, 748, 717, 686, 655, 624, 593, 562, 531, 500, 469, 438, 407, 376, 345, + 314, 283, 252, 221, 190, 159, 997, 966, 935, 873, 842, 811, 749, 718, 687, 625, + 594, 563, 501, 470, 439, 377, 346, 315, 253, 222, 191, 998, 967, 874, 843, 750, + 719, 626, 595, 502, 471, 378, 347, 254, 223, 999, 875, 751, 627, 503, 379, 255, + 904, 780, 656, 532, 408, 284, 936, 905, 812, 781, 688, 657, 564, 533, 440, 409, + 316, 285, 968, 937, 906, 844, 813, 782, 720, 689, 658, 596, 565, 534, 472, 441, + 410, 348, 317, 286, 1000, 969, 938, 907, 876, 845, 814, 783, 752, 721, 690, 659, + 628, 597, 566, 535, 504, 473, 442, 411, 380, 349, 318, 287, 1001, 970, 939, 877, + 846, 815, 753, 722, 691, 629, 598, 567, 505, 474, 443, 381, 350, 319, 1002, 971, + 878, 847, 754, 723, 630, 599, 506, 475, 382, 351, 1003, 879, 755, 631, 507, 383, + 908, 784, 660, 536, 412, 940, 909, 816, 785, 692, 661, 568, 537, 444, 413, 972, + 941, 910, 848, 817, 786, 724, 693, 662, 600, 569, 538, 476, 445, 414, 1004, 973, + 942, 911, 880, 849, 818, 787, 756, 725, 694, 663, 632, 601, 570, 539, 508, 477, + 446, 415, 1005, 974, 943, 881, 850, 819, 757, 726, 695, 633, 602, 571, 509, 478, + 447, 1006, 975, 882, 851, 758, 727, 634, 603, 510, 479, 1007, 883, 759, 635, 511, + 912, 788, 664, 540, 944, 913, 820, 789, 696, 665, 572, 541, 976, 945, 914, 852, + 821, 790, 728, 697, 666, 604, 573, 542, 1008, 977, 946, 915, 884, 853, 822, 791, + 760, 729, 698, 667, 636, 605, 574, 543, 1009, 978, 947, 885, 854, 823, 761, 730, + 699, 637, 606, 575, 1010, 979, 886, 855, 762, 731, 638, 607, 1011, 887, 763, 639, + 916, 792, 668, 948, 917, 824, 793, 700, 669, 980, 949, 918, 856, 825, 794, 732, + 701, 670, 1012, 981, 950, 919, 888, 857, 826, 795, 764, 733, 702, 671, 1013, 982, + 951, 889, 858, 827, 765, 734, 703, 1014, 983, 890, 859, 766, 735, 1015, 891, 767, + 920, 796, 952, 921, 828, 797, 984, 953, 922, 860, 829, 798, 1016, 985, 954, 923, + 892, 861, 830, 799, 1017, 986, 955, 893, 862, 831, 1018, 987, 894, 863, 1019, 895, + 924, 956, 925, 988, 957, 926, 1020, 989, 958, 927, 1021, 990, 959, 1022, 991, 1023, +} + +// DefaultScan32x32Neighbors mirrors libvpx default_scan_32x32_neighbors. +var DefaultScan32x32Neighbors = [2050]int16{ + 0, 0, 0, 0, 0, 0, 32, 32, 1, 32, 1, 1, 64, 64, 33, 64, + 2, 33, 96, 96, 2, 2, 65, 96, 34, 65, 128, 128, 97, 128, 3, 34, + 66, 97, 3, 3, 35, 66, 98, 129, 129, 160, 160, 160, 4, 35, 67, 98, + 192, 192, 4, 4, 130, 161, 161, 192, 36, 67, 99, 130, 5, 36, 68, 99, + 193, 224, 162, 193, 224, 224, 131, 162, 37, 68, 100, 131, 5, 5, 194, 225, + 225, 256, 256, 256, 163, 194, 69, 100, 132, 163, 6, 37, 226, 257, 6, 6, + 195, 226, 257, 288, 101, 132, 288, 288, 38, 69, 164, 195, 133, 164, 258, 289, + 227, 258, 196, 227, 7, 38, 289, 320, 70, 101, 320, 320, 7, 7, 165, 196, + 39, 70, 102, 133, 290, 321, 259, 290, 228, 259, 321, 352, 352, 352, 197, 228, + 134, 165, 71, 102, 8, 39, 322, 353, 291, 322, 260, 291, 103, 134, 353, 384, + 166, 197, 229, 260, 40, 71, 8, 8, 384, 384, 135, 166, 354, 385, 323, 354, + 198, 229, 292, 323, 72, 103, 261, 292, 9, 40, 385, 416, 167, 198, 104, 135, + 230, 261, 355, 386, 416, 416, 293, 324, 324, 355, 9, 9, 41, 72, 386, 417, + 199, 230, 136, 167, 417, 448, 262, 293, 356, 387, 73, 104, 387, 418, 231, 262, + 10, 41, 168, 199, 325, 356, 418, 449, 105, 136, 448, 448, 42, 73, 294, 325, + 200, 231, 10, 10, 357, 388, 137, 168, 263, 294, 388, 419, 74, 105, 419, 450, + 449, 480, 326, 357, 232, 263, 295, 326, 169, 200, 11, 42, 106, 137, 480, 480, + 450, 481, 358, 389, 264, 295, 201, 232, 138, 169, 389, 420, 43, 74, 420, 451, + 327, 358, 11, 11, 481, 512, 233, 264, 451, 482, 296, 327, 75, 106, 170, 201, + 482, 513, 512, 512, 390, 421, 359, 390, 421, 452, 107, 138, 12, 43, 202, 233, + 452, 483, 265, 296, 328, 359, 139, 170, 44, 75, 483, 514, 513, 544, 234, 265, + 297, 328, 422, 453, 12, 12, 391, 422, 171, 202, 76, 107, 514, 545, 453, 484, + 544, 544, 266, 297, 203, 234, 108, 139, 329, 360, 298, 329, 140, 171, 515, 546, + 13, 44, 423, 454, 235, 266, 545, 576, 454, 485, 45, 76, 172, 203, 330, 361, + 576, 576, 13, 13, 267, 298, 546, 577, 77, 108, 204, 235, 455, 486, 577, 608, + 299, 330, 109, 140, 547, 578, 14, 45, 14, 14, 141, 172, 578, 609, 331, 362, + 46, 77, 173, 204, 15, 15, 78, 109, 205, 236, 579, 610, 110, 141, 15, 46, + 142, 173, 47, 78, 174, 205, 16, 16, 79, 110, 206, 237, 16, 47, 111, 142, + 48, 79, 143, 174, 80, 111, 175, 206, 17, 48, 17, 17, 207, 238, 49, 80, + 81, 112, 18, 18, 18, 49, 50, 81, 82, 113, 19, 50, 51, 82, 83, 114, + 608, 608, 484, 515, 360, 391, 236, 267, 112, 143, 19, 19, 640, 640, 609, 640, + 516, 547, 485, 516, 392, 423, 361, 392, 268, 299, 237, 268, 144, 175, 113, 144, + 20, 51, 20, 20, 672, 672, 641, 672, 610, 641, 548, 579, 517, 548, 486, 517, + 424, 455, 393, 424, 362, 393, 300, 331, 269, 300, 238, 269, 176, 207, 145, 176, + 114, 145, 52, 83, 21, 52, 21, 21, 704, 704, 673, 704, 642, 673, 611, 642, + 580, 611, 549, 580, 518, 549, 487, 518, 456, 487, 425, 456, 394, 425, 363, 394, + 332, 363, 301, 332, 270, 301, 239, 270, 208, 239, 177, 208, 146, 177, 115, 146, + 84, 115, 53, 84, 22, 53, 22, 22, 705, 736, 674, 705, 643, 674, 581, 612, + 550, 581, 519, 550, 457, 488, 426, 457, 395, 426, 333, 364, 302, 333, 271, 302, + 209, 240, 178, 209, 147, 178, 85, 116, 54, 85, 23, 54, 706, 737, 675, 706, + 582, 613, 551, 582, 458, 489, 427, 458, 334, 365, 303, 334, 210, 241, 179, 210, + 86, 117, 55, 86, 707, 738, 583, 614, 459, 490, 335, 366, 211, 242, 87, 118, + 736, 736, 612, 643, 488, 519, 364, 395, 240, 271, 116, 147, 23, 23, 768, 768, + 737, 768, 644, 675, 613, 644, 520, 551, 489, 520, 396, 427, 365, 396, 272, 303, + 241, 272, 148, 179, 117, 148, 24, 55, 24, 24, 800, 800, 769, 800, 738, 769, + 676, 707, 645, 676, 614, 645, 552, 583, 521, 552, 490, 521, 428, 459, 397, 428, + 366, 397, 304, 335, 273, 304, 242, 273, 180, 211, 149, 180, 118, 149, 56, 87, + 25, 56, 25, 25, 832, 832, 801, 832, 770, 801, 739, 770, 708, 739, 677, 708, + 646, 677, 615, 646, 584, 615, 553, 584, 522, 553, 491, 522, 460, 491, 429, 460, + 398, 429, 367, 398, 336, 367, 305, 336, 274, 305, 243, 274, 212, 243, 181, 212, + 150, 181, 119, 150, 88, 119, 57, 88, 26, 57, 26, 26, 833, 864, 802, 833, + 771, 802, 709, 740, 678, 709, 647, 678, 585, 616, 554, 585, 523, 554, 461, 492, + 430, 461, 399, 430, 337, 368, 306, 337, 275, 306, 213, 244, 182, 213, 151, 182, + 89, 120, 58, 89, 27, 58, 834, 865, 803, 834, 710, 741, 679, 710, 586, 617, + 555, 586, 462, 493, 431, 462, 338, 369, 307, 338, 214, 245, 183, 214, 90, 121, + 59, 90, 835, 866, 711, 742, 587, 618, 463, 494, 339, 370, 215, 246, 91, 122, + 864, 864, 740, 771, 616, 647, 492, 523, 368, 399, 244, 275, 120, 151, 27, 27, + 896, 896, 865, 896, 772, 803, 741, 772, 648, 679, 617, 648, 524, 555, 493, 524, + 400, 431, 369, 400, 276, 307, 245, 276, 152, 183, 121, 152, 28, 59, 28, 28, + 928, 928, 897, 928, 866, 897, 804, 835, 773, 804, 742, 773, 680, 711, 649, 680, + 618, 649, 556, 587, 525, 556, 494, 525, 432, 463, 401, 432, 370, 401, 308, 339, + 277, 308, 246, 277, 184, 215, 153, 184, 122, 153, 60, 91, 29, 60, 29, 29, + 960, 960, 929, 960, 898, 929, 867, 898, 836, 867, 805, 836, 774, 805, 743, 774, + 712, 743, 681, 712, 650, 681, 619, 650, 588, 619, 557, 588, 526, 557, 495, 526, + 464, 495, 433, 464, 402, 433, 371, 402, 340, 371, 309, 340, 278, 309, 247, 278, + 216, 247, 185, 216, 154, 185, 123, 154, 92, 123, 61, 92, 30, 61, 30, 30, + 961, 992, 930, 961, 899, 930, 837, 868, 806, 837, 775, 806, 713, 744, 682, 713, + 651, 682, 589, 620, 558, 589, 527, 558, 465, 496, 434, 465, 403, 434, 341, 372, + 310, 341, 279, 310, 217, 248, 186, 217, 155, 186, 93, 124, 62, 93, 31, 62, + 962, 993, 931, 962, 838, 869, 807, 838, 714, 745, 683, 714, 590, 621, 559, 590, + 466, 497, 435, 466, 342, 373, 311, 342, 218, 249, 187, 218, 94, 125, 63, 94, + 963, 994, 839, 870, 715, 746, 591, 622, 467, 498, 343, 374, 219, 250, 95, 126, + 868, 899, 744, 775, 620, 651, 496, 527, 372, 403, 248, 279, 124, 155, 900, 931, + 869, 900, 776, 807, 745, 776, 652, 683, 621, 652, 528, 559, 497, 528, 404, 435, + 373, 404, 280, 311, 249, 280, 156, 187, 125, 156, 932, 963, 901, 932, 870, 901, + 808, 839, 777, 808, 746, 777, 684, 715, 653, 684, 622, 653, 560, 591, 529, 560, + 498, 529, 436, 467, 405, 436, 374, 405, 312, 343, 281, 312, 250, 281, 188, 219, + 157, 188, 126, 157, 964, 995, 933, 964, 902, 933, 871, 902, 840, 871, 809, 840, + 778, 809, 747, 778, 716, 747, 685, 716, 654, 685, 623, 654, 592, 623, 561, 592, + 530, 561, 499, 530, 468, 499, 437, 468, 406, 437, 375, 406, 344, 375, 313, 344, + 282, 313, 251, 282, 220, 251, 189, 220, 158, 189, 127, 158, 965, 996, 934, 965, + 903, 934, 841, 872, 810, 841, 779, 810, 717, 748, 686, 717, 655, 686, 593, 624, + 562, 593, 531, 562, 469, 500, 438, 469, 407, 438, 345, 376, 314, 345, 283, 314, + 221, 252, 190, 221, 159, 190, 966, 997, 935, 966, 842, 873, 811, 842, 718, 749, + 687, 718, 594, 625, 563, 594, 470, 501, 439, 470, 346, 377, 315, 346, 222, 253, + 191, 222, 967, 998, 843, 874, 719, 750, 595, 626, 471, 502, 347, 378, 223, 254, + 872, 903, 748, 779, 624, 655, 500, 531, 376, 407, 252, 283, 904, 935, 873, 904, + 780, 811, 749, 780, 656, 687, 625, 656, 532, 563, 501, 532, 408, 439, 377, 408, + 284, 315, 253, 284, 936, 967, 905, 936, 874, 905, 812, 843, 781, 812, 750, 781, + 688, 719, 657, 688, 626, 657, 564, 595, 533, 564, 502, 533, 440, 471, 409, 440, + 378, 409, 316, 347, 285, 316, 254, 285, 968, 999, 937, 968, 906, 937, 875, 906, + 844, 875, 813, 844, 782, 813, 751, 782, 720, 751, 689, 720, 658, 689, 627, 658, + 596, 627, 565, 596, 534, 565, 503, 534, 472, 503, 441, 472, 410, 441, 379, 410, + 348, 379, 317, 348, 286, 317, 255, 286, 969, 1000, 938, 969, 907, 938, 845, 876, + 814, 845, 783, 814, 721, 752, 690, 721, 659, 690, 597, 628, 566, 597, 535, 566, + 473, 504, 442, 473, 411, 442, 349, 380, 318, 349, 287, 318, 970, 1001, 939, 970, + 846, 877, 815, 846, 722, 753, 691, 722, 598, 629, 567, 598, 474, 505, 443, 474, + 350, 381, 319, 350, 971, 1002, 847, 878, 723, 754, 599, 630, 475, 506, 351, 382, + 876, 907, 752, 783, 628, 659, 504, 535, 380, 411, 908, 939, 877, 908, 784, 815, + 753, 784, 660, 691, 629, 660, 536, 567, 505, 536, 412, 443, 381, 412, 940, 971, + 909, 940, 878, 909, 816, 847, 785, 816, 754, 785, 692, 723, 661, 692, 630, 661, + 568, 599, 537, 568, 506, 537, 444, 475, 413, 444, 382, 413, 972, 1003, 941, 972, + 910, 941, 879, 910, 848, 879, 817, 848, 786, 817, 755, 786, 724, 755, 693, 724, + 662, 693, 631, 662, 600, 631, 569, 600, 538, 569, 507, 538, 476, 507, 445, 476, + 414, 445, 383, 414, 973, 1004, 942, 973, 911, 942, 849, 880, 818, 849, 787, 818, + 725, 756, 694, 725, 663, 694, 601, 632, 570, 601, 539, 570, 477, 508, 446, 477, + 415, 446, 974, 1005, 943, 974, 850, 881, 819, 850, 726, 757, 695, 726, 602, 633, + 571, 602, 478, 509, 447, 478, 975, 1006, 851, 882, 727, 758, 603, 634, 479, 510, + 880, 911, 756, 787, 632, 663, 508, 539, 912, 943, 881, 912, 788, 819, 757, 788, + 664, 695, 633, 664, 540, 571, 509, 540, 944, 975, 913, 944, 882, 913, 820, 851, + 789, 820, 758, 789, 696, 727, 665, 696, 634, 665, 572, 603, 541, 572, 510, 541, + 976, 1007, 945, 976, 914, 945, 883, 914, 852, 883, 821, 852, 790, 821, 759, 790, + 728, 759, 697, 728, 666, 697, 635, 666, 604, 635, 573, 604, 542, 573, 511, 542, + 977, 1008, 946, 977, 915, 946, 853, 884, 822, 853, 791, 822, 729, 760, 698, 729, + 667, 698, 605, 636, 574, 605, 543, 574, 978, 1009, 947, 978, 854, 885, 823, 854, + 730, 761, 699, 730, 606, 637, 575, 606, 979, 1010, 855, 886, 731, 762, 607, 638, + 884, 915, 760, 791, 636, 667, 916, 947, 885, 916, 792, 823, 761, 792, 668, 699, + 637, 668, 948, 979, 917, 948, 886, 917, 824, 855, 793, 824, 762, 793, 700, 731, + 669, 700, 638, 669, 980, 1011, 949, 980, 918, 949, 887, 918, 856, 887, 825, 856, + 794, 825, 763, 794, 732, 763, 701, 732, 670, 701, 639, 670, 981, 1012, 950, 981, + 919, 950, 857, 888, 826, 857, 795, 826, 733, 764, 702, 733, 671, 702, 982, 1013, + 951, 982, 858, 889, 827, 858, 734, 765, 703, 734, 983, 1014, 859, 890, 735, 766, + 888, 919, 764, 795, 920, 951, 889, 920, 796, 827, 765, 796, 952, 983, 921, 952, + 890, 921, 828, 859, 797, 828, 766, 797, 984, 1015, 953, 984, 922, 953, 891, 922, + 860, 891, 829, 860, 798, 829, 767, 798, 985, 1016, 954, 985, 923, 954, 861, 892, + 830, 861, 799, 830, 986, 1017, 955, 986, 862, 893, 831, 862, 987, 1018, 863, 894, + 892, 923, 924, 955, 893, 924, 956, 987, 925, 956, 894, 925, 988, 1019, 957, 988, + 926, 957, 895, 926, 989, 1020, 958, 989, 927, 958, 990, 1021, 959, 990, 991, 1022, + 0, 0, +} + +// DefaultScan4x4 mirrors libvpx default_scan_4x4. +var DefaultScan4x4 = [16]int16{ + 0, 4, 1, 5, 8, 2, 12, 9, 3, 6, 13, 10, 7, 14, 11, 15, +} + +// DefaultScan4x4Neighbors mirrors libvpx default_scan_4x4_neighbors. +var DefaultScan4x4Neighbors = [34]int16{ + 0, 0, 0, 0, 0, 0, 1, 4, 4, 4, 1, 1, 8, 8, 5, 8, + 2, 2, 2, 5, 9, 12, 6, 9, 3, 6, 10, 13, 7, 10, 11, 14, + 0, 0, +} + +// DefaultScan8x8 mirrors libvpx default_scan_8x8. +var DefaultScan8x8 = [64]int16{ + 0, 8, 1, 16, 9, 2, 17, 24, 10, 3, 18, 25, 32, 11, 4, 26, + 33, 19, 40, 12, 34, 27, 5, 41, 20, 48, 13, 35, 42, 28, 21, 6, + 49, 56, 36, 43, 29, 7, 14, 50, 57, 44, 22, 37, 15, 51, 58, 30, + 45, 23, 52, 59, 38, 31, 60, 53, 46, 39, 61, 54, 47, 62, 55, 63, +} + +// DefaultScan8x8Neighbors mirrors libvpx default_scan_8x8_neighbors. +var DefaultScan8x8Neighbors = [130]int16{ + 0, 0, 0, 0, 0, 0, 8, 8, 1, 8, 1, 1, 9, 16, 16, 16, + 2, 9, 2, 2, 10, 17, 17, 24, 24, 24, 3, 10, 3, 3, 18, 25, + 25, 32, 11, 18, 32, 32, 4, 11, 26, 33, 19, 26, 4, 4, 33, 40, + 12, 19, 40, 40, 5, 12, 27, 34, 34, 41, 20, 27, 13, 20, 5, 5, + 41, 48, 48, 48, 28, 35, 35, 42, 21, 28, 6, 6, 6, 13, 42, 49, + 49, 56, 36, 43, 14, 21, 29, 36, 7, 14, 43, 50, 50, 57, 22, 29, + 37, 44, 15, 22, 44, 51, 51, 58, 30, 37, 23, 30, 52, 59, 45, 52, + 38, 45, 31, 38, 53, 60, 46, 53, 39, 46, 54, 61, 47, 54, 55, 62, + 0, 0, +} + +// RowScan16x16 mirrors libvpx row_scan_16x16. +var RowScan16x16 = [256]int16{ + 0, 1, 2, 16, 3, 17, 4, 18, 32, 5, 33, 19, 6, 34, 48, 20, + 49, 7, 35, 21, 50, 64, 8, 36, 65, 22, 51, 37, 80, 9, 66, 52, + 23, 38, 81, 67, 10, 53, 24, 82, 68, 96, 39, 11, 54, 83, 97, 69, + 25, 98, 84, 40, 112, 55, 12, 70, 99, 113, 85, 26, 41, 56, 114, 100, + 13, 71, 128, 86, 27, 115, 101, 129, 42, 57, 72, 116, 14, 87, 130, 102, + 144, 73, 131, 117, 28, 58, 15, 88, 43, 145, 103, 132, 146, 118, 74, 160, + 89, 133, 104, 29, 59, 147, 119, 44, 161, 148, 90, 105, 134, 162, 120, 176, + 75, 135, 149, 30, 60, 163, 177, 45, 121, 91, 106, 164, 178, 150, 192, 136, + 165, 179, 31, 151, 193, 76, 122, 61, 137, 194, 107, 152, 180, 208, 46, 166, + 167, 195, 92, 181, 138, 209, 123, 153, 224, 196, 77, 168, 210, 182, 240, 108, + 197, 62, 154, 225, 183, 169, 211, 47, 139, 93, 184, 226, 212, 241, 198, 170, + 124, 155, 199, 78, 213, 185, 109, 227, 200, 63, 228, 242, 140, 214, 171, 186, + 156, 229, 243, 125, 94, 201, 244, 215, 216, 230, 141, 187, 202, 79, 172, 110, + 157, 245, 217, 231, 95, 246, 232, 126, 203, 247, 233, 173, 218, 142, 111, 158, + 188, 248, 127, 234, 219, 249, 189, 204, 143, 174, 159, 250, 235, 205, 220, 175, + 190, 251, 221, 191, 206, 236, 207, 237, 252, 222, 253, 223, 238, 239, 254, 255, +} + +// RowScan16x16Neighbors mirrors libvpx row_scan_16x16_neighbors. +var RowScan16x16Neighbors = [514]int16{ + 0, 0, 0, 0, 1, 1, 0, 0, 2, 2, 16, 16, 3, 3, 17, 17, + 16, 16, 4, 4, 32, 32, 18, 18, 5, 5, 33, 33, 32, 32, 19, 19, + 48, 48, 6, 6, 34, 34, 20, 20, 49, 49, 48, 48, 7, 7, 35, 35, + 64, 64, 21, 21, 50, 50, 36, 36, 64, 64, 8, 8, 65, 65, 51, 51, + 22, 22, 37, 37, 80, 80, 66, 66, 9, 9, 52, 52, 23, 23, 81, 81, + 67, 67, 80, 80, 38, 38, 10, 10, 53, 53, 82, 82, 96, 96, 68, 68, + 24, 24, 97, 97, 83, 83, 39, 39, 96, 96, 54, 54, 11, 11, 69, 69, + 98, 98, 112, 112, 84, 84, 25, 25, 40, 40, 55, 55, 113, 113, 99, 99, + 12, 12, 70, 70, 112, 112, 85, 85, 26, 26, 114, 114, 100, 100, 128, 128, + 41, 41, 56, 56, 71, 71, 115, 115, 13, 13, 86, 86, 129, 129, 101, 101, + 128, 128, 72, 72, 130, 130, 116, 116, 27, 27, 57, 57, 14, 14, 87, 87, + 42, 42, 144, 144, 102, 102, 131, 131, 145, 145, 117, 117, 73, 73, 144, 144, + 88, 88, 132, 132, 103, 103, 28, 28, 58, 58, 146, 146, 118, 118, 43, 43, + 160, 160, 147, 147, 89, 89, 104, 104, 133, 133, 161, 161, 119, 119, 160, 160, + 74, 74, 134, 134, 148, 148, 29, 29, 59, 59, 162, 162, 176, 176, 44, 44, + 120, 120, 90, 90, 105, 105, 163, 163, 177, 177, 149, 149, 176, 176, 135, 135, + 164, 164, 178, 178, 30, 30, 150, 150, 192, 192, 75, 75, 121, 121, 60, 60, + 136, 136, 193, 193, 106, 106, 151, 151, 179, 179, 192, 192, 45, 45, 165, 165, + 166, 166, 194, 194, 91, 91, 180, 180, 137, 137, 208, 208, 122, 122, 152, 152, + 208, 208, 195, 195, 76, 76, 167, 167, 209, 209, 181, 181, 224, 224, 107, 107, + 196, 196, 61, 61, 153, 153, 224, 224, 182, 182, 168, 168, 210, 210, 46, 46, + 138, 138, 92, 92, 183, 183, 225, 225, 211, 211, 240, 240, 197, 197, 169, 169, + 123, 123, 154, 154, 198, 198, 77, 77, 212, 212, 184, 184, 108, 108, 226, 226, + 199, 199, 62, 62, 227, 227, 241, 241, 139, 139, 213, 213, 170, 170, 185, 185, + 155, 155, 228, 228, 242, 242, 124, 124, 93, 93, 200, 200, 243, 243, 214, 214, + 215, 215, 229, 229, 140, 140, 186, 186, 201, 201, 78, 78, 171, 171, 109, 109, + 156, 156, 244, 244, 216, 216, 230, 230, 94, 94, 245, 245, 231, 231, 125, 125, + 202, 202, 246, 246, 232, 232, 172, 172, 217, 217, 141, 141, 110, 110, 157, 157, + 187, 187, 247, 247, 126, 126, 233, 233, 218, 218, 248, 248, 188, 188, 203, 203, + 142, 142, 173, 173, 158, 158, 249, 249, 234, 234, 204, 204, 219, 219, 174, 174, + 189, 189, 250, 250, 220, 220, 190, 190, 205, 205, 235, 235, 206, 206, 236, 236, + 251, 251, 221, 221, 252, 252, 222, 222, 237, 237, 238, 238, 253, 253, 254, 254, + 0, 0, +} + +// RowScan4x4 mirrors libvpx row_scan_4x4. +var RowScan4x4 = [16]int16{ + 0, 1, 4, 2, 5, 3, 6, 8, 9, 7, 12, 10, 13, 11, 14, 15, +} + +// RowScan4x4Neighbors mirrors libvpx row_scan_4x4_neighbors. +var RowScan4x4Neighbors = [34]int16{ + 0, 0, 0, 0, 0, 0, 1, 1, 4, 4, 2, 2, 5, 5, 4, 4, + 8, 8, 6, 6, 8, 8, 9, 9, 12, 12, 10, 10, 13, 13, 14, 14, + 0, 0, +} + +// RowScan8x8 mirrors libvpx row_scan_8x8. +var RowScan8x8 = [64]int16{ + 0, 1, 2, 8, 9, 3, 16, 10, 4, 17, 11, 24, 5, 18, 25, 12, + 19, 26, 32, 6, 13, 20, 33, 27, 7, 34, 40, 21, 28, 41, 14, 35, + 48, 42, 29, 36, 49, 22, 43, 15, 56, 37, 50, 44, 30, 57, 23, 51, + 58, 45, 38, 52, 31, 59, 53, 46, 60, 39, 61, 47, 54, 55, 62, 63, +} + +// RowScan8x8Neighbors mirrors libvpx row_scan_8x8_neighbors. +var RowScan8x8Neighbors = [130]int16{ + 0, 0, 0, 0, 1, 1, 0, 0, 8, 8, 2, 2, 8, 8, 9, 9, + 3, 3, 16, 16, 10, 10, 16, 16, 4, 4, 17, 17, 24, 24, 11, 11, + 18, 18, 25, 25, 24, 24, 5, 5, 12, 12, 19, 19, 32, 32, 26, 26, + 6, 6, 33, 33, 32, 32, 20, 20, 27, 27, 40, 40, 13, 13, 34, 34, + 40, 40, 41, 41, 28, 28, 35, 35, 48, 48, 21, 21, 42, 42, 14, 14, + 48, 48, 36, 36, 49, 49, 43, 43, 29, 29, 56, 56, 22, 22, 50, 50, + 57, 57, 44, 44, 37, 37, 51, 51, 30, 30, 58, 58, 52, 52, 45, 45, + 59, 59, 38, 38, 60, 60, 46, 46, 53, 53, 54, 54, 61, 61, 62, 62, + 0, 0, +} + +// ColIScan16x16 mirrors libvpx vp9_col_iscan_16x16. +var ColIScan16x16 = [256]int16{ + 1, 5, 12, 21, 32, 44, 60, 76, 86, 110, 131, 151, 166, 182, 196, 199, + 2, 7, 15, 24, 35, 48, 65, 82, 96, 115, 136, 154, 172, 189, 202, 213, + 3, 9, 17, 26, 39, 53, 68, 84, 102, 117, 137, 158, 173, 191, 206, 217, + 4, 11, 19, 30, 42, 56, 72, 90, 104, 120, 142, 160, 177, 195, 209, 219, + 6, 13, 22, 33, 46, 59, 75, 94, 105, 124, 145, 165, 180, 197, 211, 224, + 8, 16, 27, 38, 50, 64, 79, 97, 113, 130, 147, 167, 183, 201, 216, 229, + 10, 20, 29, 40, 55, 70, 87, 103, 118, 133, 152, 171, 188, 207, 221, 231, + 14, 25, 36, 47, 61, 74, 92, 109, 123, 138, 155, 175, 190, 208, 225, 236, + 18, 31, 41, 54, 67, 83, 99, 116, 127, 143, 162, 181, 198, 214, 228, 238, + 23, 37, 49, 63, 77, 93, 106, 121, 134, 148, 168, 187, 204, 220, 233, 241, + 28, 45, 57, 71, 85, 100, 114, 128, 141, 157, 176, 194, 210, 227, 237, 245, + 34, 52, 69, 80, 95, 111, 126, 139, 150, 163, 185, 203, 218, 230, 242, 248, + 43, 62, 78, 91, 107, 122, 135, 149, 161, 174, 192, 212, 226, 239, 246, 252, + 51, 73, 88, 101, 119, 129, 146, 159, 169, 184, 205, 223, 234, 243, 250, 254, + 58, 81, 98, 112, 132, 144, 156, 170, 179, 193, 215, 232, 240, 247, 251, 255, + 66, 89, 108, 125, 140, 153, 164, 178, 186, 200, 222, 235, 244, 249, 253, 256, +} + +// ColIScan4x4 mirrors libvpx vp9_col_iscan_4x4. +var ColIScan4x4 = [16]int16{ + 1, 4, 8, 12, 2, 6, 10, 13, 3, 7, 11, 15, 5, 9, 14, 16, +} + +// ColIScan8x8 mirrors libvpx vp9_col_iscan_8x8. +var ColIScan8x8 = [64]int16{ + 1, 4, 9, 16, 23, 33, 41, 48, 2, 6, 12, 19, 27, 35, 45, 52, + 3, 8, 14, 21, 29, 39, 47, 55, 5, 11, 17, 25, 32, 42, 51, 57, + 7, 13, 22, 28, 36, 44, 53, 59, 10, 18, 26, 34, 40, 49, 56, 61, + 15, 24, 31, 38, 46, 54, 60, 63, 20, 30, 37, 43, 50, 58, 62, 64, +} + +// DefaultIScan16x16 mirrors libvpx vp9_default_iscan_16x16. +var DefaultIScan16x16 = [256]int16{ + 1, 3, 6, 10, 18, 25, 37, 45, 56, 73, 89, 105, 129, 144, 167, 180, + 2, 5, 9, 14, 21, 31, 41, 55, 67, 80, 97, 114, 142, 155, 179, 197, + 4, 8, 12, 19, 26, 34, 47, 58, 72, 87, 102, 120, 149, 165, 187, 202, + 7, 13, 17, 24, 32, 40, 54, 65, 79, 93, 111, 128, 154, 170, 194, 209, + 11, 15, 20, 29, 38, 48, 59, 68, 85, 99, 115, 134, 162, 177, 199, 215, + 16, 22, 27, 35, 44, 53, 66, 78, 92, 107, 121, 141, 166, 186, 206, 222, + 23, 28, 33, 42, 49, 61, 74, 86, 100, 117, 131, 152, 176, 191, 212, 226, + 30, 36, 43, 50, 60, 70, 82, 96, 109, 126, 140, 156, 183, 198, 218, 230, + 39, 46, 52, 62, 69, 81, 94, 106, 119, 135, 151, 169, 192, 208, 224, 235, + 51, 57, 64, 75, 84, 95, 110, 118, 130, 148, 164, 178, 200, 214, 229, 239, + 63, 71, 77, 88, 98, 108, 123, 132, 146, 160, 173, 189, 211, 223, 236, 243, + 76, 83, 91, 103, 113, 125, 139, 147, 158, 174, 188, 203, 220, 231, 241, 246, + 90, 101, 112, 124, 133, 143, 157, 168, 181, 190, 204, 217, 232, 238, 247, 251, + 104, 116, 127, 137, 150, 163, 172, 184, 195, 205, 216, 225, 237, 242, 249, 253, + 122, 136, 145, 159, 171, 182, 193, 201, 210, 219, 228, 234, 244, 245, 252, 255, + 138, 153, 161, 175, 185, 196, 207, 213, 221, 227, 233, 240, 248, 250, 254, 256, +} + +// DefaultIScan32x32 mirrors libvpx vp9_default_iscan_32x32. +var DefaultIScan32x32 = [1024]int16{ + 1, 3, 6, 11, 18, 26, 39, 48, 63, 84, 102, 122, 146, 171, 194, 205, + 211, 220, 230, 234, 246, 258, 276, 300, 343, 357, 378, 406, 456, 472, 496, 528, + 2, 5, 9, 16, 23, 31, 46, 59, 75, 93, 113, 134, 159, 185, 204, 216, + 223, 229, 235, 238, 257, 275, 299, 318, 356, 377, 405, 427, 471, 495, 527, 552, + 4, 8, 13, 19, 29, 37, 53, 65, 83, 103, 119, 143, 165, 190, 209, 218, + 225, 232, 236, 239, 274, 298, 317, 330, 376, 404, 426, 441, 494, 526, 551, 568, + 7, 12, 17, 24, 32, 44, 61, 74, 91, 110, 127, 151, 174, 197, 212, 221, + 227, 233, 237, 240, 297, 316, 329, 336, 403, 425, 440, 448, 525, 550, 567, 576, + 10, 15, 20, 30, 38, 51, 66, 79, 96, 117, 135, 158, 180, 202, 215, 224, + 245, 256, 273, 296, 342, 355, 375, 402, 455, 470, 493, 524, 583, 597, 618, 646, + 14, 21, 27, 36, 45, 55, 73, 86, 106, 124, 141, 164, 183, 206, 217, 226, + 255, 272, 295, 315, 354, 374, 401, 424, 469, 492, 523, 549, 596, 617, 645, 667, + 22, 28, 34, 43, 54, 64, 81, 95, 114, 133, 152, 173, 191, 210, 219, 228, + 271, 294, 314, 328, 373, 400, 423, 439, 491, 522, 548, 566, 616, 644, 666, 681, + 25, 33, 40, 49, 58, 72, 89, 105, 121, 140, 160, 179, 198, 213, 222, 231, + 293, 313, 327, 335, 399, 422, 438, 447, 521, 547, 565, 575, 643, 665, 680, 688, + 35, 41, 47, 57, 69, 82, 97, 112, 131, 148, 168, 187, 244, 254, 270, 292, + 341, 353, 372, 398, 454, 468, 490, 520, 582, 595, 615, 642, 694, 706, 724, 748, + 42, 50, 56, 68, 78, 92, 108, 125, 139, 162, 178, 195, 253, 269, 291, 312, + 352, 371, 397, 421, 467, 489, 519, 546, 594, 614, 641, 664, 705, 723, 747, 766, + 52, 60, 67, 77, 90, 100, 120, 132, 150, 169, 182, 201, 268, 290, 311, 326, + 370, 396, 420, 437, 488, 518, 545, 564, 613, 640, 663, 679, 722, 746, 765, 778, + 62, 70, 76, 88, 101, 115, 130, 145, 163, 181, 192, 208, 289, 310, 325, 334, + 395, 419, 436, 446, 517, 544, 563, 574, 639, 662, 678, 687, 745, 764, 777, 784, + 71, 80, 87, 98, 109, 123, 138, 156, 243, 252, 267, 288, 340, 351, 369, 394, + 453, 466, 487, 516, 581, 593, 612, 638, 693, 704, 721, 744, 789, 799, 814, 834, + 85, 94, 104, 111, 126, 142, 155, 172, 251, 266, 287, 309, 350, 368, 393, 418, + 465, 486, 515, 543, 592, 611, 637, 661, 703, 720, 743, 763, 798, 813, 833, 849, + 99, 107, 116, 128, 144, 157, 170, 186, 265, 286, 308, 324, 367, 392, 417, 435, + 485, 514, 542, 562, 610, 636, 660, 677, 719, 742, 762, 776, 812, 832, 848, 859, + 118, 129, 137, 149, 161, 176, 189, 199, 285, 307, 323, 333, 391, 416, 434, 445, + 513, 541, 561, 573, 635, 659, 676, 686, 741, 761, 775, 783, 831, 847, 858, 864, + 136, 147, 153, 166, 242, 250, 264, 284, 339, 349, 366, 390, 452, 464, 484, 512, + 580, 591, 609, 634, 692, 702, 718, 740, 788, 797, 811, 830, 868, 876, 888, 904, + 154, 167, 175, 184, 249, 263, 283, 306, 348, 365, 389, 415, 463, 483, 511, 540, + 590, 608, 633, 658, 701, 717, 739, 760, 796, 810, 829, 846, 875, 887, 903, 916, + 177, 188, 196, 203, 262, 282, 305, 322, 364, 388, 414, 433, 482, 510, 539, 560, + 607, 632, 657, 675, 716, 738, 759, 774, 809, 828, 845, 857, 886, 902, 915, 924, + 193, 200, 207, 214, 281, 304, 321, 332, 387, 413, 432, 444, 509, 538, 559, 572, + 631, 656, 674, 685, 737, 758, 773, 782, 827, 844, 856, 863, 901, 914, 923, 928, + 241, 248, 261, 280, 338, 347, 363, 386, 451, 462, 481, 508, 579, 589, 606, 630, + 691, 700, 715, 736, 787, 795, 808, 826, 867, 874, 885, 900, 931, 937, 946, 958, + 247, 260, 279, 303, 346, 362, 385, 412, 461, 480, 507, 537, 588, 605, 629, 655, + 699, 714, 735, 757, 794, 807, 825, 843, 873, 884, 899, 913, 936, 945, 957, 967, + 259, 278, 302, 320, 361, 384, 411, 431, 479, 506, 536, 558, 604, 628, 654, 673, + 713, 734, 756, 772, 806, 824, 842, 855, 883, 898, 912, 922, 944, 956, 966, 973, + 277, 301, 319, 331, 383, 410, 430, 443, 505, 535, 557, 571, 627, 653, 672, 684, + 733, 755, 771, 781, 823, 841, 854, 862, 897, 911, 921, 927, 955, 965, 972, 976, + 337, 345, 360, 382, 450, 460, 478, 504, 578, 587, 603, 626, 690, 698, 712, 732, + 786, 793, 805, 822, 866, 872, 882, 896, 930, 935, 943, 954, 978, 982, 988, 996, + 344, 359, 381, 409, 459, 477, 503, 534, 586, 602, 625, 652, 697, 711, 731, 754, + 792, 804, 821, 840, 871, 881, 895, 910, 934, 942, 953, 964, 981, 987, 995, 1002, + 358, 380, 408, 429, 476, 502, 533, 556, 601, 624, 651, 671, 710, 730, 753, 770, + 803, 820, 839, 853, 880, 894, 909, 920, 941, 952, 963, 971, 986, 994, 1001, 1006, + 379, 407, 428, 442, 501, 532, 555, 570, 623, 650, 670, 683, 729, 752, 769, 780, + 819, 838, 852, 861, 893, 908, 919, 926, 951, 962, 970, 975, 993, 1000, 1005, 1008, + 449, 458, 475, 500, 577, 585, 600, 622, 689, 696, 709, 728, 785, 791, 802, 818, + 865, 870, 879, 892, 929, 933, 940, 950, 977, 980, 985, 992, 1009, 1011, 1014, 1018, + 457, 474, 499, 531, 584, 599, 621, 649, 695, 708, 727, 751, 790, 801, 817, 837, + 869, 878, 891, 907, 932, 939, 949, 961, 979, 984, 991, 999, 1010, 1013, 1017, 1021, + 473, 498, 530, 554, 598, 620, 648, 669, 707, 726, 750, 768, 800, 816, 836, 851, + 877, 890, 906, 918, 938, 948, 960, 969, 983, 990, 998, 1004, 1012, 1016, 1020, 1023, + 497, 529, 553, 569, 619, 647, 668, 682, 725, 749, 767, 779, 815, 835, 850, 860, + 889, 905, 917, 925, 947, 959, 968, 974, 989, 997, 1003, 1007, 1015, 1019, 1022, 1024, +} + +// DefaultIScan4x4 mirrors libvpx vp9_default_iscan_4x4. +var DefaultIScan4x4 = [16]int16{ + 1, 3, 6, 9, 2, 4, 10, 13, 5, 8, 12, 15, 7, 11, 14, 16, +} + +// DefaultIScan8x8 mirrors libvpx vp9_default_iscan_8x8. +var DefaultIScan8x8 = [64]int16{ + 1, 3, 6, 10, 15, 23, 32, 38, 2, 5, 9, 14, 20, 27, 39, 45, + 4, 7, 11, 18, 25, 31, 43, 50, 8, 12, 16, 22, 30, 37, 48, 54, + 13, 17, 21, 28, 35, 44, 53, 58, 19, 24, 29, 36, 42, 49, 57, 61, + 26, 33, 40, 46, 51, 56, 60, 63, 34, 41, 47, 52, 55, 59, 62, 64, +} + +// RowIScan16x16 mirrors libvpx vp9_row_iscan_16x16. +var RowIScan16x16 = [256]int16{ + 1, 2, 3, 5, 7, 10, 13, 18, 23, 30, 37, 44, 55, 65, 77, 87, + 4, 6, 8, 12, 16, 20, 26, 33, 39, 49, 60, 69, 85, 100, 116, 131, + 9, 11, 14, 19, 24, 28, 34, 43, 52, 61, 73, 89, 104, 120, 143, 168, + 15, 17, 21, 27, 32, 38, 45, 54, 62, 74, 86, 101, 117, 136, 162, 186, + 22, 25, 31, 36, 41, 48, 56, 66, 75, 82, 95, 113, 134, 155, 180, 206, + 29, 35, 40, 46, 51, 59, 68, 78, 88, 97, 107, 122, 147, 170, 197, 213, + 42, 47, 50, 57, 64, 71, 80, 91, 99, 108, 123, 139, 160, 183, 208, 223, + 53, 58, 63, 70, 76, 84, 94, 103, 111, 121, 135, 151, 177, 196, 216, 227, + 67, 72, 79, 83, 92, 98, 109, 114, 128, 137, 149, 169, 189, 203, 222, 233, + 81, 90, 93, 102, 106, 115, 126, 132, 140, 152, 163, 178, 193, 209, 224, 235, + 96, 105, 110, 118, 124, 129, 144, 145, 156, 166, 176, 191, 207, 220, 234, 240, + 112, 119, 125, 130, 141, 148, 158, 165, 171, 182, 192, 204, 225, 231, 241, 244, + 127, 133, 138, 146, 154, 161, 175, 179, 185, 198, 205, 217, 232, 238, 245, 247, + 142, 150, 157, 167, 173, 181, 190, 200, 201, 211, 221, 229, 239, 243, 250, 252, + 153, 164, 172, 184, 187, 194, 202, 212, 215, 219, 228, 237, 246, 248, 253, 254, + 159, 174, 188, 195, 199, 210, 214, 218, 226, 230, 236, 242, 249, 251, 255, 256, +} + +// RowIScan4x4 mirrors libvpx vp9_row_iscan_4x4. +var RowIScan4x4 = [16]int16{ + 1, 2, 4, 6, 3, 5, 7, 10, 8, 9, 12, 14, 11, 13, 15, 16, +} + +// RowIScan8x8 mirrors libvpx vp9_row_iscan_8x8. +var RowIScan8x8 = [64]int16{ + 1, 2, 3, 6, 9, 13, 20, 25, 4, 5, 8, 11, 16, 21, 31, 40, + 7, 10, 14, 17, 22, 28, 38, 47, 12, 15, 18, 24, 29, 35, 45, 53, + 19, 23, 26, 32, 36, 42, 51, 58, 27, 30, 34, 39, 44, 50, 56, 60, + 33, 37, 43, 48, 52, 55, 61, 62, 41, 46, 49, 54, 57, 59, 63, 64, +} diff --git a/internal/vpx/buffers/aligned.go b/internal/vpx/buffers/aligned.go new file mode 100644 index 0000000..89d2217 --- /dev/null +++ b/internal/vpx/buffers/aligned.go @@ -0,0 +1,160 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/buffers/aligned.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package buffers + +import ( + "math/bits" + "reflect" +) + +// NewAligned returns a byte slice whose first element is aligned to align. +// It allocates backing memory and is intended for initialization-time buffers. +func NewAligned(size int, align int) []byte { + if size <= 0 { + return nil + } + if align <= 1 { + return make([]byte, size) + } + if align&(align-1) != 0 { + align = nextPowerOfTwo(align) + } + buf := make([]byte, size+align-1) + ptr := reflect.ValueOf(buf).Pointer() + off := int((uintptr(align) - ptr&uintptr(align-1)) & uintptr(align-1)) + return buf[off : off+size] +} + +func nextPowerOfTwo(v int) int { + if v <= 1 { + return 1 + } + // Changed from govpx v0.5.3, whose `v >> 32` does not compile where int is 32 bits. + return 1 << bits.Len(uint(v-1)) +} + +// EnsureCapacity returns buf sliced to size, growing it with make when needed. +func EnsureCapacity(buf []byte, size int) []byte { + if cap(buf) < size { + return make([]byte, size) + } + return buf[:size] +} + +// EnsureLen returns buf sliced to size, growing it with make when needed. +// Existing elements are not cleared when storage is reused. +func EnsureLen[S ~[]E, E any](buf S, size int) S { + if cap(buf) < size { + return make(S, size) + } + return buf[:size] +} + +// EnsureLenZeroed returns buf sliced to size and cleared. It grows with make +// when needed; reused storage is zeroed before it is returned. +func EnsureLenZeroed[S ~[]E, E any](buf S, size int) S { + if cap(buf) < size { + return make(S, size) + } + buf = buf[:size] + clear(buf) + return buf +} + +// ByteSliceAligned reports whether buf starts on an align-byte boundary. +func ByteSliceAligned(buf []byte, align int) bool { + if align <= 1 || len(buf) == 0 { + return true + } + if align&(align-1) != 0 { + align = nextPowerOfTwo(align) + } + return reflect.ValueOf(buf).Pointer()%uintptr(align) == 0 +} + +// AlignmentPadding returns the prefix needed to align buf to align bytes. +func AlignmentPadding(buf []byte, align int) int { + if align <= 1 || len(buf) == 0 { + return 0 + } + ptr := reflect.ValueOf(buf).Pointer() + rem := ptr % uintptr(align) + if rem == 0 { + return 0 + } + return int(uintptr(align) - rem) +} + +// AlignOffsetForSlice returns the smallest offset >= off where &buf[offset] +// is aligned to align bytes. +func AlignOffsetForSlice(buf []byte, off, align int) int { + if align <= 1 || len(buf) == 0 { + return off + } + ptr := reflect.ValueOf(buf).Pointer() + uintptr(off) + rem := ptr % uintptr(align) + if rem == 0 { + return off + } + return off + int(uintptr(align)-rem) +} + +// Align rounds v up to an align-byte boundary. Callers pass power-of-two +// alignments, matching the VPx frame-buffer layout contracts. +func Align(v, align int) int { + if align <= 1 { + return v + } + return (v + align - 1) &^ (align - 1) +} + +// RoundUp rounds v up to the next multiple of align. +func RoundUp(v, align int) int { + if align <= 1 { + return v + } + r := v % align + if r == 0 { + return v + } + return v + align - r +} + +// PlaneLen returns the backing bytes needed for rows of a visible-width plane +// stored in a larger stride. It counts only the visible bytes on the last row. +func PlaneLen(stride, rows, visibleWidth int) int { + if rows <= 0 { + return 0 + } + return stride*(rows-1) + visibleWidth +} + +// Chroma420Dimensions returns the 4:2:0 chroma plane dimensions for a luma +// rectangle of width by height pixels. +func Chroma420Dimensions(width, height int) (int, int) { + uvWidth := width/2 + width%2 + uvHeight := height/2 + height%2 + return uvWidth, uvHeight +} + +// Fill writes value to every byte in buf. +func Fill(buf []byte, value byte) { + if len(buf) < 64 { + for i := range buf { + buf[i] = value + } + return + } + buf[0] = value + for filled := 1; filled < len(buf); { + filled += copy(buf[filled:], buf[:filled]) + } +} diff --git a/internal/vpx/buffers/planes.go b/internal/vpx/buffers/planes.go new file mode 100644 index 0000000..9a2c99b --- /dev/null +++ b/internal/vpx/buffers/planes.go @@ -0,0 +1,32 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/buffers/planes.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package buffers + +// CopyPlane copies the visible width by height rectangle from src into dst. +// Both planes may have larger strides than the visible width. +func CopyPlane(dst []byte, dstStride int, src []byte, srcStride int, width int, height int) { + for row := range height { + copy(dst[row*dstStride:row*dstStride+width], src[row*srcStride:row*srcStride+width]) + } +} + +// AveragePlaneInto replaces dst with the rounded average of dst and src for +// the visible width by height rectangle. It mirrors VPx compound prediction's +// byte average: (dst + src + 1) >> 1. +func AveragePlaneInto(dst []byte, dstStride int, src []byte, srcStride int, width int, height int) { + for row := range height { + dstRow := dst[row*dstStride:] + srcRow := src[row*srcStride:] + for col := range width { + dstRow[col] = byte((int(dstRow[col]) + int(srcRow[col]) + 1) >> 1) + } + } +} diff --git a/internal/vpx/codecapi/codec.go b/internal/vpx/codecapi/codec.go new file mode 100644 index 0000000..f0ff2ca --- /dev/null +++ b/internal/vpx/codecapi/codec.go @@ -0,0 +1,56 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/codecapi/codec.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codecapi + +const ( + // UpstreamLibvpxVersion is the libvpx release tag used for parity + // porting and the oracle test corpus. Matches the tag pinned by + // internal/coracle. + UpstreamLibvpxVersion = "v1.16.0" +) + +// Codec identifies a codec family supported by govpx. +type Codec int + +const ( + // CodecVP8 selects the VP8 bitstream format. + CodecVP8 Codec = iota + 1 + // CodecVP9 selects the VP9 profile 0 bitstream format. Other VP9 + // profiles are outside the package scope. + CodecVP9 +) + +// String returns the canonical lowercase name for a Codec, matching +// libvpx's vpx_codec_iface_name short tags. Useful for log lines and +// error messages. +func (c Codec) String() string { + switch c { + case CodecVP8: + return "vp8" + case CodecVP9: + return "vp9" + } + return "unknown" +} + +const ( + MaxVP8Dimension = 16383 + MaxVP9Dimension = 65536 + MaxQuantizer = 63 + MaxARNRFrames = 15 + DefaultDropFramesWaterMark = 60 + LibvpxDefaultBufferSizeMs = 6000 + LibvpxDefaultBufferInitialMs = 4000 + LibvpxDefaultBufferOptimalMs = 5000 + MaxRateControlOvershootPct = 100 + MaxRateControlUndershootPct = 100 + LibvpxIntMax = 0x7fffffff +) diff --git a/internal/vpx/codecapi/image.go b/internal/vpx/codecapi/image.go new file mode 100644 index 0000000..6e6b00f --- /dev/null +++ b/internal/vpx/codecapi/image.go @@ -0,0 +1,176 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/codecapi/image.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codecapi + +import ( + vp8common "github.com/go-avkit/vpx/internal/vp8/common" + "github.com/go-avkit/vpx/internal/vpx/buffers" +) + +// ChromaSubsampling identifies the chroma plane subsampling of an [Image]. +// The zero value is [Subsampling420] (I420), preserving full backwards +// compatibility with existing callers that leave the field unset. +type ChromaSubsampling uint8 + +const ( + // Subsampling420 is 4:2:0 chroma subsampling (half width, half height). + Subsampling420 ChromaSubsampling = iota + // Subsampling422 is 4:2:2 chroma subsampling (half width, full height). + Subsampling422 + // Subsampling440 is 4:4:0 chroma subsampling (full width, half height). + Subsampling440 + // Subsampling444 is 4:4:4 / RGB (full width, full height). + Subsampling444 +) + +// Shifts returns the (subsamplingX, subsamplingY) right-shift counts. +func (s ChromaSubsampling) Shifts() (int, int) { + switch s { + case Subsampling422: + return 1, 0 + case Subsampling440: + return 0, 1 + case Subsampling444: + return 0, 0 + default: + return 1, 1 + } +} + +// ChromaDimensions returns the visible chroma plane dimensions for a luma +// plane of size width x height. +func (s ChromaSubsampling) ChromaDimensions(width, height int) (int, int) { + ssX, ssY := s.Shifts() + return (width + (1 << ssX) - 1) >> ssX, (height + (1 << ssY) - 1) >> ssY +} + +// ChromaSubsamplingFromShifts maps VP9 (subsamplingX, subsamplingY) flags to +// a [ChromaSubsampling] enum value. +func ChromaSubsamplingFromShifts(ssX, ssY uint8) ChromaSubsampling { + switch { + case ssX == 1 && ssY == 0: + return Subsampling422 + case ssX == 0 && ssY == 1: + return Subsampling440 + case ssX == 0 && ssY == 0: + return Subsampling444 + default: + return Subsampling420 + } +} + +// Image is a planar YUV/RGB image (8-bit I420 by default; 8-bit +// I422/I440/I444 for VP9 Profile 1; 10-bit or 12-bit via Y16/U16/V16 when +// BitDepth is 10 or 12 for VP9 Profile 2/3). +// +// Plane slices may include stride padding. Width and Height define the +// visible image size, and callers must honor the per-plane strides. For 8-bit +// images (BitDepth == 0 or 8), Y, U, and V carry pixel bytes and strides are +// in bytes. For 10/12-bit images (BitDepth == 10 or 12), Y16, U16, and V16 +// carry uint16 samples in [0, (1< 8 { + if len(img.Y16) < buffers.PlaneLen(img.YStride, height, width) { + return false + } + if len(img.U16) < buffers.PlaneLen(img.UStride, uvHeight, uvWidth) { + return false + } + if len(img.V16) < buffers.PlaneLen(img.VStride, uvHeight, uvWidth) { + return false + } + return true + } + if len(img.Y) < buffers.PlaneLen(img.YStride, height, width) { + return false + } + if len(img.U) < buffers.PlaneLen(img.UStride, uvHeight, uvWidth) { + return false + } + if len(img.V) < buffers.PlaneLen(img.VStride, uvHeight, uvWidth) { + return false + } + return true +} + +// PublicImageFromVP8 wraps an internal VP8 image view as a public Image. +func PublicImageFromVP8(src *vp8common.Image) Image { + if src == nil { + return Image{} + } + return Image{ + Width: src.Width, + Height: src.Height, + Y: src.Y, + U: src.U, + V: src.V, + YStride: src.YStride, + UStride: src.UStride, + VStride: src.VStride, + } +} diff --git a/internal/vpx/codecapi/options.go b/internal/vpx/codecapi/options.go new file mode 100644 index 0000000..6dc1dc4 --- /dev/null +++ b/internal/vpx/codecapi/options.go @@ -0,0 +1,107 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/codecapi/options.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codecapi + +import ( + vpxrtp "github.com/go-avkit/vpx/internal/vpx/rtp" +) + +// RTPPayloadFragment is one RTP payload body plus the RTP marker-bit value +// the caller should put in the RTP header for that body. +type RTPPayloadFragment = vpxrtp.PayloadFragment + +// RateControlMode selects the encoder bitrate-control strategy. +type RateControlMode int + +const ( + // RateControlVBR selects variable bitrate mode. + RateControlVBR RateControlMode = iota + // RateControlCBR selects constant bitrate mode. + RateControlCBR + // RateControlCQ selects constrained-quality mode. + RateControlCQ + // RateControlQ selects libvpx VPX_Q constant-quality mode. + RateControlQ +) + +// RealtimeFrameDropMode selects how SetRealtimeTarget changes frame dropping. +type RealtimeFrameDropMode int + +const ( + // RealtimeFrameDropUnchanged leaves the current frame-drop setting intact. + RealtimeFrameDropUnchanged RealtimeFrameDropMode = iota + // RealtimeFrameDropDisabled disables realtime frame dropping. + RealtimeFrameDropDisabled + // RealtimeFrameDropEnabled enables realtime frame dropping. + RealtimeFrameDropEnabled +) + +// Deadline selects the encoder speed/quality operating mode. +type Deadline int + +const ( + // DeadlineBestQuality favors quality and exhaustive decisions. + DeadlineBestQuality Deadline = iota + // DeadlineGoodQuality favors quality with bounded speed features. + DeadlineGoodQuality + // DeadlineRealtime favors low-latency realtime decisions. + DeadlineRealtime +) + +// ScalingMode mirrors libvpx's vpx_scaling_mode_t enum (vpx/vp8cx.h). +type ScalingMode int + +const ( + ScalingNormal ScalingMode = 0 + ScalingFourFive ScalingMode = 1 + ScalingThreeFive ScalingMode = 2 + ScalingOneTwo ScalingMode = 3 +) + +// Tuning selects the encoder's visual quality model. +type Tuning int + +const ( + TunePSNR Tuning = iota + TuneSSIM +) + +// EncodeFlags controls per-frame reference and packet behavior. +type EncodeFlags uint32 + +const ( + EncodeForceKeyFrame EncodeFlags = 1 << iota + EncodeInvisibleFrame + EncodeNoReferenceLast + EncodeNoReferenceGolden + EncodeNoReferenceAltRef + EncodeNoUpdateLast + EncodeNoUpdateGolden + EncodeNoUpdateAltRef + EncodeNoUpdateEntropy + EncodeForceGoldenFrame + EncodeForceAltRefFrame +) + +// PostProcessFlag selects optional libvpx-style decoder postprocessing. +type PostProcessFlag uint32 + +const ( + PostProcessDeblock PostProcessFlag = 1 << iota + PostProcessDemacroblock + PostProcessAddNoise + PostProcessMFQE + + AllPostProcessFlags = PostProcessDeblock | PostProcessDemacroblock | PostProcessAddNoise | PostProcessMFQE +) + +// VP8Decryptor mirrors libvpx v1.16.0 vpx_decrypt_cb (vpx/vpx_decoder.h). +type VP8Decryptor func(state any, src []byte, dst []byte, count int) diff --git a/internal/vpx/codecapi/phase_stats.go b/internal/vpx/codecapi/phase_stats.go new file mode 100644 index 0000000..e4dd424 --- /dev/null +++ b/internal/vpx/codecapi/phase_stats.go @@ -0,0 +1,247 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/codecapi/phase_stats.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codecapi + +// EncoderPhaseStats accumulates opt-in coarse encoder phase timing in +// nanoseconds and counters for the SAD/subpel search hot path when govpx is +// built with the govpx_phase_stats tag. Normal builds compile the option path +// out of VP8 encode hot paths: no clock reads, counter writes, or nil-check +// branches. The caller owns the value, may [EncoderPhaseStats.Reset] it between +// warmup and measurement, and may sample it concurrently with EncodeInto only +// under its own synchronization. +type EncoderPhaseStats struct { + // InterReconstructNS is time spent rebuilding inter-frame prediction and + // residual planes. + InterReconstructNS int64 `json:"inter_reconstruct_ns"` + // KeyReconstructNS is time spent rebuilding key-frame prediction and + // residual planes. + KeyReconstructNS int64 `json:"key_reconstruct_ns"` + // LoopFilterPickNS is time spent selecting loop-filter parameters. + LoopFilterPickNS int64 `json:"loop_filter_pick_ns"` + // LoopFilterApplyNS is time spent applying the loop filter to committed + // frames. + LoopFilterApplyNS int64 `json:"loop_filter_apply_ns"` + // PacketWriteNS is time spent packing VP8 frame data. + PacketWriteNS int64 `json:"packet_write_ns"` + // InterAttempts counts inter-frame encode attempts, including recodes. + InterAttempts int64 `json:"inter_attempts"` + // KeyAttempts counts key-frame encode attempts, including recodes. + KeyAttempts int64 `json:"key_attempts"` + // VP9PreEncodeDrops counts VP9 frames skipped before mode search. + VP9PreEncodeDrops int64 `json:"vp9_pre_encode_drops"` + // VP9PreEncodeDropNegativeBuffer counts pre-encode drops from negative CBR buffer. + VP9PreEncodeDropNegativeBuffer int64 `json:"vp9_pre_encode_drop_negative_buffer"` + // VP9PreEncodeDropWatermarkDecimation counts pre-encode drops from CBR decimation. + VP9PreEncodeDropWatermarkDecimation int64 `json:"vp9_pre_encode_drop_watermark_decimation"` + // VP9PostEncodeDrops counts VP9 frames encoded and then discarded by CBR. + VP9PostEncodeDrops int64 `json:"vp9_post_encode_drops"` + // VP9PostEncodeDropBits counts encoded bits spent on VP9 post-encode drops. + VP9PostEncodeDropBits int64 `json:"vp9_post_encode_drop_bits"` + // VP9CountNS is time spent in VP9's count/tokencollect mode-tree pre-pass. + VP9CountNS int64 `json:"vp9_count_ns"` + // VP9HeaderWriteNS is time spent packing VP9 compressed and uncompressed headers. + VP9HeaderWriteNS int64 `json:"vp9_header_write_ns"` + // VP9TileWriteNS is time spent writing VP9 tile data and replaying staged tokens. + VP9TileWriteNS int64 `json:"vp9_tile_write_ns"` + // VP9LoopFilterPickNS is time spent in VP9's post-tile loop-filter picker. + VP9LoopFilterPickNS int64 `json:"vp9_loop_filter_pick_ns"` + // VP9LoopFilterApplyNS is time spent applying VP9's committed loop filter. + VP9LoopFilterApplyNS int64 `json:"vp9_loop_filter_apply_ns"` + + // LoopFilterTrials counts candidate filter-strength evaluations. + LoopFilterTrials int64 `json:"loop_filter_trials"` + // LoopFilterTrialCopyNS is time spent copying trial frame buffers. + LoopFilterTrialCopyNS int64 `json:"loop_filter_trial_copy_ns"` + // LoopFilterTrialFilterNS is time spent filtering trial frame buffers. + LoopFilterTrialFilterNS int64 `json:"loop_filter_trial_filter_ns"` + // LoopFilterTrialSSENS is time spent scoring loop-filter trials. + LoopFilterTrialSSENS int64 `json:"loop_filter_trial_sse_ns"` + + // InterRDCoeffCacheRequests counts inter RD coefficient-cache lookups. + InterRDCoeffCacheRequests int64 `json:"inter_rd_coeff_cache_requests"` + // InterRDCoeffCacheDCTHits counts cached DCT/residual reuse hits. + InterRDCoeffCacheDCTHits int64 `json:"inter_rd_coeff_cache_dct_hits"` + // InterCoefTokenRecords counts token-rate records produced during inter RD. + InterCoefTokenRecords int64 `json:"inter_coef_token_records"` + + // FullPelSADCalls counts full-pixel SAD search invocations. + FullPelSADCalls int64 `json:"fullpel_sad_calls"` + // FullPelSADCandidates counts full-pixel candidate positions scored. + FullPelSADCandidates int64 `json:"fullpel_sad_candidates"` + // FullPelBatchCalls counts vectorized multi-candidate SAD batches. + FullPelBatchCalls int64 `json:"fullpel_batch_calls"` + // VP9FullPelSAD* count VP9 full-pixel SAD calls/candidates by call site. + VP9FullPelSADZeroCalls int64 `json:"vp9_fullpel_sad_zero_calls"` + VP9FullPelSADZeroCandidates int64 `json:"vp9_fullpel_sad_zero_candidates"` + VP9FullPelSADSeedCalls int64 `json:"vp9_fullpel_sad_seed_calls"` + VP9FullPelSADSeedCandidates int64 `json:"vp9_fullpel_sad_seed_candidates"` + VP9FullPelSADHintCalls int64 `json:"vp9_fullpel_sad_hint_calls"` + VP9FullPelSADHintCandidates int64 `json:"vp9_fullpel_sad_hint_candidates"` + VP9FullPelSADPatternCalls int64 `json:"vp9_fullpel_sad_pattern_calls"` + VP9FullPelSADPatternCandidates int64 `json:"vp9_fullpel_sad_pattern_candidates"` + VP9FullPelSADFullRDCalls int64 `json:"vp9_fullpel_sad_fullrd_calls"` + VP9FullPelSADFullRDCandidates int64 `json:"vp9_fullpel_sad_fullrd_candidates"` + VP9FullPelSADOtherCalls int64 `json:"vp9_fullpel_sad_other_calls"` + VP9FullPelSADOtherCandidates int64 `json:"vp9_fullpel_sad_other_candidates"` + // VP9FullPelSearches counts VP9 full-pixel motion-search invocations. + VP9FullPelSearches int64 `json:"vp9_fullpel_searches"` + // VP9FullPelSearchSkipMVPart counts searches skipped by variance-partition MVs. + VP9FullPelSearchSkipMVPart int64 `json:"vp9_fullpel_search_skip_mvpart"` + // VP9FullPelSearchSkipIntPro counts searches skipped by int-pro estimation. + VP9FullPelSearchSkipIntPro int64 `json:"vp9_fullpel_search_skip_intpro"` + // VP9FullPelSearch* count VP9 full-pixel searches by block size. + VP9FullPelSearch64x64 int64 `json:"vp9_fullpel_search_64x64"` + VP9FullPelSearch32x32 int64 `json:"vp9_fullpel_search_32x32"` + VP9FullPelSearch32x16 int64 `json:"vp9_fullpel_search_32x16"` + VP9FullPelSearch16x32 int64 `json:"vp9_fullpel_search_16x32"` + VP9FullPelSearch16x16 int64 `json:"vp9_fullpel_search_16x16"` + VP9FullPelSearch16x8 int64 `json:"vp9_fullpel_search_16x8"` + VP9FullPelSearch8x16 int64 `json:"vp9_fullpel_search_8x16"` + VP9FullPelSearch8x8 int64 `json:"vp9_fullpel_search_8x8"` + // FullPelBoundsRejects counts full-pixel candidates outside legal bounds. + FullPelBoundsRejects int64 `json:"fullpel_bounds_rejects"` + // FullPelEarlyBreaks counts SAD evaluations stopped by an existing best. + FullPelEarlyBreaks int64 `json:"fullpel_early_breaks"` + // SubpelCandidates counts sub-pixel candidate positions scored. + SubpelCandidates int64 `json:"subpel_candidates"` + // SubpelVarianceCalls counts sub-pixel variance evaluations. + SubpelVarianceCalls int64 `json:"subpel_variance_calls"` + // SubpelCacheHits counts sub-pixel predictor-cache hits. + SubpelCacheHits int64 `json:"subpel_cache_hits"` + // SubpelBoundsRejects counts sub-pixel candidates outside legal bounds. + SubpelBoundsRejects int64 `json:"subpel_bounds_rejects"` + // SubpelEarlyBreaks counts sub-pixel evaluations stopped by an existing best. + SubpelEarlyBreaks int64 `json:"subpel_early_breaks"` + + // VP9ModeBlocks counts write_modes_b-equivalent VP9 mode-block visits. + VP9ModeBlocks int64 `json:"vp9_mode_blocks"` + // VP9FrameTiles counts VP9 tile writer entries. + VP9FrameTiles int64 `json:"vp9_frame_tiles"` + // VP9FrameTilesCountPass counts VP9 tile writer entries in the count pre-pass. + VP9FrameTilesCountPass int64 `json:"vp9_frame_tiles_count_pass"` + // VP9FrameTilesWritePass counts VP9 tile writer entries in the bitstream pass. + VP9FrameTilesWritePass int64 `json:"vp9_frame_tiles_write_pass"` + // VP9ModeSBs counts recursive write_modes_sb-equivalent VP9 superblock visits. + VP9ModeSBs int64 `json:"vp9_mode_sbs"` + // VP9ModeSBsCountPass counts VP9 superblock visits in the count pre-pass. + VP9ModeSBsCountPass int64 `json:"vp9_mode_sbs_count_pass"` + // VP9ModeSBsWritePass counts VP9 superblock visits in the bitstream pass. + VP9ModeSBsWritePass int64 `json:"vp9_mode_sbs_write_pass"` + // VP9ModeBlocksCountPass counts VP9 mode-block visits in the count pre-pass. + VP9ModeBlocksCountPass int64 `json:"vp9_mode_blocks_count_pass"` + // VP9ModeBlocksWritePass counts VP9 mode-block visits in the bitstream pass. + VP9ModeBlocksWritePass int64 `json:"vp9_mode_blocks_write_pass"` + // VP9ModeBlock* count VP9 leaf block-size visits. + VP9ModeBlock64x64 int64 `json:"vp9_mode_block_64x64"` + VP9ModeBlock32x32 int64 `json:"vp9_mode_block_32x32"` + VP9ModeBlock32x16 int64 `json:"vp9_mode_block_32x16"` + VP9ModeBlock16x32 int64 `json:"vp9_mode_block_16x32"` + VP9ModeBlock16x16 int64 `json:"vp9_mode_block_16x16"` + VP9ModeBlock16x8 int64 `json:"vp9_mode_block_16x8"` + VP9ModeBlock8x16 int64 `json:"vp9_mode_block_8x16"` + VP9ModeBlock8x8 int64 `json:"vp9_mode_block_8x8"` + VP9ModeBlockSub8 int64 `json:"vp9_mode_block_sub8"` + // VP9InterModePicks counts VP9 realtime inter-mode picker calls. + VP9InterModePicks int64 `json:"vp9_inter_mode_picks"` + // VP9InterModePicksCountPass counts inter-mode picks in the count pre-pass. + VP9InterModePicksCountPass int64 `json:"vp9_inter_mode_picks_count_pass"` + // VP9InterModePicksWritePass counts inter-mode picks in the bitstream pass. + VP9InterModePicksWritePass int64 `json:"vp9_inter_mode_picks_write_pass"` + // VP9InterLeafCacheStores counts count-pass inter leaf decisions cached. + VP9InterLeafCacheStores int64 `json:"vp9_inter_leaf_cache_stores"` + // VP9InterLeafCacheReplayHits counts write-pass leaf-decision replay hits. + VP9InterLeafCacheReplayHits int64 `json:"vp9_inter_leaf_cache_replay_hits"` + // VP9InterLeafCacheReplayMisses counts write-pass leaf-decision replay misses. + VP9InterLeafCacheReplayMisses int64 `json:"vp9_inter_leaf_cache_replay_misses"` + // VP9VarPartChooseCalls counts 64x64 variance-partition prepass invocations. + VP9VarPartChooseCalls int64 `json:"vp9_varpart_choose_calls"` + // VP9VarPartCacheHits counts choose_partitioning SB-cache hits. + VP9VarPartCacheHits int64 `json:"vp9_varpart_cache_hits"` + // VP9VarPartCacheMisses counts choose_partitioning SB-cache misses. + VP9VarPartCacheMisses int64 `json:"vp9_varpart_cache_misses"` + // VP9VarPartMergedSBs counts computed SB flags merged from threaded count workers. + VP9VarPartMergedSBs int64 `json:"vp9_varpart_merged_sbs"` + // VP9VarPartChooseCountPass counts variance-partition invocations in the count pre-pass. + VP9VarPartChooseCountPass int64 `json:"vp9_varpart_choose_count_pass"` + // VP9VarPartChooseWritePass counts variance-partition invocations in the bitstream pass. + VP9VarPartChooseWritePass int64 `json:"vp9_varpart_choose_write_pass"` + // VP9VarPartCopyHits counts choose_partitioning copy_partitioning successes. + VP9VarPartCopyHits int64 `json:"vp9_varpart_copy_hits"` + // VP9VarPartContentState* count choose_partitioning content-state inputs. + VP9VarPartContentStateInvalid int64 `json:"vp9_varpart_content_state_invalid"` + VP9VarPartContentStateLowSadLowSumdiff int64 `json:"vp9_varpart_content_state_low_sad_low_sumdiff"` + VP9VarPartContentStateLowSadHighSumdiff int64 `json:"vp9_varpart_content_state_low_sad_high_sumdiff"` + VP9VarPartContentStateHighSadLowSumdiff int64 `json:"vp9_varpart_content_state_high_sad_low_sumdiff"` + VP9VarPartContentStateHighSadHighSumdiff int64 `json:"vp9_varpart_content_state_high_sad_high_sumdiff"` + VP9VarPartContentStateLowVarHighSumdiff int64 `json:"vp9_varpart_content_state_low_var_high_sumdiff"` + VP9VarPartContentStateVeryHighSad int64 `json:"vp9_varpart_content_state_very_high_sad"` + // VP9VarPart* split counters instrument choose_partitioning's variance tree. + VP9VarPartYSADValid int64 `json:"vp9_varpart_ysad_valid"` + VP9VarPartYSADSelect64x64 int64 `json:"vp9_varpart_ysad_select_64x64"` + VP9VarPartCopyPartitionSelect int64 `json:"vp9_varpart_copy_partition_select"` + VP9VarPartForceSplit64 int64 `json:"vp9_varpart_force_split_64"` + VP9VarPartForceSplit32 int64 `json:"vp9_varpart_force_split_32"` + VP9VarPartForceSplit16 int64 `json:"vp9_varpart_force_split_16"` + VP9VarPartForceSplit16Variance int64 `json:"vp9_varpart_force_split_16_variance"` + VP9VarPartForceSplit16Minmax int64 `json:"vp9_varpart_force_split_16_minmax"` + VP9VarPartThreshold2Count int64 `json:"vp9_varpart_threshold2_count"` + VP9VarPartThreshold2Sum int64 `json:"vp9_varpart_threshold2_sum"` + VP9VarPartVar16Samples int64 `json:"vp9_varpart_var16_samples"` + VP9VarPartVar16Sum int64 `json:"vp9_varpart_var16_sum"` + VP9VarPartForce16VarianceSum int64 `json:"vp9_varpart_force16_variance_sum"` + VP9VarPartForce16ThresholdSum int64 `json:"vp9_varpart_force16_threshold_sum"` + VP9VarPartSetVTCalls int64 `json:"vp9_varpart_setvt_calls"` + VP9VarPartSetVT64x64 int64 `json:"vp9_varpart_setvt_64x64"` + VP9VarPartSetVT32x32 int64 `json:"vp9_varpart_setvt_32x32"` + VP9VarPartSetVT16x16 int64 `json:"vp9_varpart_setvt_16x16"` + VP9VarPartSetVT8x8 int64 `json:"vp9_varpart_setvt_8x8"` + VP9VarPartSetVTForceSplit int64 `json:"vp9_varpart_setvt_force_split"` + VP9VarPartSetVTForceSplit64x64 int64 `json:"vp9_varpart_setvt_force_split_64x64"` + VP9VarPartSetVTForceSplit32x32 int64 `json:"vp9_varpart_setvt_force_split_32x32"` + VP9VarPartSetVTForceSplit16x16 int64 `json:"vp9_varpart_setvt_force_split_16x16"` + VP9VarPartSetVTSelect int64 `json:"vp9_varpart_setvt_select"` + VP9VarPartSetVTSplit int64 `json:"vp9_varpart_setvt_split"` + // VP9InterPredictionBlocks counts VP9 inter-predictor block builds. + VP9InterPredictionBlocks int64 `json:"vp9_inter_prediction_blocks"` + // VP9InterPredictPlaneCalls counts VP9 per-plane inter-predictor calls. + VP9InterPredictPlaneCalls int64 `json:"vp9_inter_predict_plane_calls"` + // VP9InterPredictionVarianceCalls counts VP9 predictor+variance scoring calls. + VP9InterPredictionVarianceCalls int64 `json:"vp9_inter_prediction_variance_calls"` + // VP9InterPredictor* count libvpx inter_predictor dispatch keys. + VP9InterPredictorCopy int64 `json:"vp9_inter_predictor_copy"` + VP9InterPredictorAvg int64 `json:"vp9_inter_predictor_avg"` + VP9InterPredictorVert int64 `json:"vp9_inter_predictor_vert"` + VP9InterPredictorAvgVert int64 `json:"vp9_inter_predictor_avg_vert"` + VP9InterPredictorHoriz int64 `json:"vp9_inter_predictor_horiz"` + VP9InterPredictorAvgHoriz int64 `json:"vp9_inter_predictor_avg_horiz"` + VP9InterPredictor2D int64 `json:"vp9_inter_predictor_2d"` + VP9InterPredictorAvg2D int64 `json:"vp9_inter_predictor_avg_2d"` + + // VP9TileWorker* count persistent tile-worker scheduling activity. + VP9TileWorkerCountEpochs int64 `json:"vp9_tile_worker_count_epochs"` + VP9TileWorkerEncodeEpochs int64 `json:"vp9_tile_worker_encode_epochs"` + VP9TileWorkerWakeSignals int64 `json:"vp9_tile_worker_wake_signals"` + VP9TileWorkerParks int64 `json:"vp9_tile_worker_parks"` + VP9TileWorkerWaitSpins int64 `json:"vp9_tile_worker_wait_spins"` + VP9TileWorkerWaitGoscheds int64 `json:"vp9_tile_worker_wait_goscheds"` + VP9TileWorkerCountJobRuns int64 `json:"vp9_tile_worker_count_job_runs"` + VP9TileWorkerEncodeJobRuns int64 `json:"vp9_tile_worker_encode_job_runs"` + VP9RowWorkerCountEpochs int64 `json:"vp9_row_worker_count_epochs"` + VP9RowWorkerCountJobs int64 `json:"vp9_row_worker_count_jobs"` +} + +// Reset clears all accumulated phase counters. +func (s *EncoderPhaseStats) Reset() { + if s == nil { + return + } + *s = EncoderPhaseStats{} +} diff --git a/internal/vpx/codecapi/streaminfo.go b/internal/vpx/codecapi/streaminfo.go new file mode 100644 index 0000000..9e3c0b5 --- /dev/null +++ b/internal/vpx/codecapi/streaminfo.go @@ -0,0 +1,79 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/codecapi/streaminfo.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codecapi + +import ( + vp8dec "github.com/go-avkit/vpx/internal/vp8/decoder" + + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" +) + +// StreamInfo describes the VP8 frame-header fields that can be read +// without fully decoding a packet. +type StreamInfo struct { + Width int + Height int + Profile int + KeyFrame bool + ShowFrame bool + FirstPartitionSize int +} + +// ReferenceFlags is a bit mask of VP8 reference buffers. +type ReferenceFlags uint8 + +const ( + ReferenceFlagLast ReferenceFlags = 1 << iota + ReferenceFlagGolden + ReferenceFlagAltRef +) + +// ReferenceFrame selects one VP8 reference buffer. +type ReferenceFrame ReferenceFlags + +const ( + ReferenceLast ReferenceFrame = ReferenceFrame(ReferenceFlagLast) + ReferenceGolden ReferenceFrame = ReferenceFrame(ReferenceFlagGolden) + ReferenceAltRef ReferenceFrame = ReferenceFrame(ReferenceFlagAltRef) +) + +// FrameInfo describes the most recently decoded VP8 frame. +type FrameInfo struct { + Width int + Height int + KeyFrame bool + ShowFrame bool + Corrupted bool + Quantizer int + InternalQuantizer int + RefUpdates ReferenceFlags + RefUsed ReferenceFlags + PTS uint64 +} + +func PeekVP8FrameHeader(packet []byte) (vp8dec.FrameHeader, StreamInfo, error) { + header, err := vp8dec.ParseFrameHeader(packet) + if err != nil { + return vp8dec.FrameHeader{}, StreamInfo{}, vpxerrors.ErrInvalidData + } + return header, StreamInfoFromInternal(vp8dec.StreamInfoFromFrameHeader(header)), nil +} + +func StreamInfoFromInternal(info vp8dec.StreamInfo) StreamInfo { + return StreamInfo{ + Width: info.Width, + Height: info.Height, + Profile: info.Profile, + KeyFrame: info.KeyFrame, + ShowFrame: info.ShowFrame, + FirstPartitionSize: info.FirstPartitionSize, + } +} diff --git a/internal/vpx/codecapi/timing.go b/internal/vpx/codecapi/timing.go new file mode 100644 index 0000000..e131836 --- /dev/null +++ b/internal/vpx/codecapi/timing.go @@ -0,0 +1,33 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/codecapi/timing.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codecapi + +import ( + "runtime" +) + +// RuntimeProcYield performs a brief non-preemptive CPU spin pause during +// wavefront/worker waits. +// +//go:noinline +func RuntimeProcYield(cycles uint32) { + for i := range cycles { + if i == ^uint32(0) { + runtime.Gosched() + } + } +} + +const ( + LibvpxTimestampTicksPerSecond = int64(10000000) + LibvpxInitialFirstTimestamp = int64(0x7fffffff) + MaxInt64Value = int64(^uint64(0) >> 1) +) diff --git a/internal/vpx/codecapi/worker_wake.go b/internal/vpx/codecapi/worker_wake.go new file mode 100644 index 0000000..d5c61a3 --- /dev/null +++ b/internal/vpx/codecapi/worker_wake.go @@ -0,0 +1,20 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/codecapi/worker_wake.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +package codecapi + +const EncoderCacheLineSize = 64 + +const ( + RowWorkerIdleSpinBudget = 2048 + VP9WorkerIdleSpinBudget = 2048 + RowWorkerIdleSchedulerBackoff = 4096 + WorkerWakeShutdownEpoch = ^uint64(0) +) diff --git a/internal/vpx/errors/errors.go b/internal/vpx/errors/errors.go new file mode 100644 index 0000000..b94abf9 --- /dev/null +++ b/internal/vpx/errors/errors.go @@ -0,0 +1,29 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/errors/errors.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Package errors holds shared sentinel errors for internal VPx packages. +package errors + +import ( + "errors" +) + +var ( + ErrInvalidData = errors.New("govpx: invalid VP8 data") + ErrNeedKeyFrame = errors.New("govpx: need VP8 keyframe") + + ErrBufferTooSmall = errors.New("govpx: output buffer too small") + ErrFrameRejected = errors.New("govpx: VP8 frame rejected by decoder options") + ErrInvalidConfig = errors.New("govpx: invalid config") + + ErrClosed = errors.New("govpx: codec is closed") + ErrInvalidVP9Data = errors.New("govpx: invalid VP9 data") + ErrVP9NotImplemented = errors.New("govpx: VP9 packet outside implemented profile 0 scope") +) diff --git a/internal/vpx/rtp/rtp.go b/internal/vpx/rtp/rtp.go new file mode 100644 index 0000000..04794ba --- /dev/null +++ b/internal/vpx/rtp/rtp.go @@ -0,0 +1,272 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, internal/vpx/rtp/rtp.go. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. + +// Package rtp holds shared mechanical helpers for RTP payload assembly. +package rtp + +import ( + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" +) + +// PayloadFragment is one RTP payload body plus the RTP marker-bit value +// the caller should put in the RTP header for that body. +// +// Payload contains codec-specific payload-descriptor bytes followed by the +// codec payload fragment. It does not include an RTP header. +type PayloadFragment struct { + Payload []byte + Marker bool +} + +// PayloadDescriptor is the shared mechanical contract for codec RTP payload +// descriptors. Codec packages own descriptor syntax and validation. +type PayloadDescriptor interface { + Size() (int, error) + MarshalInto([]byte) (int, error) +} + +// MarshalDescriptor returns desc as a newly allocated RTP payload descriptor. +// Codec packages own descriptor syntax; this helper owns the repeated +// size-allocate-marshal shape. +func MarshalDescriptor[D PayloadDescriptor](desc D) ([]byte, error) { + need, err := desc.Size() + if err != nil { + return nil, err + } + out := make([]byte, need) + _, err = desc.MarshalInto(out) + if err != nil { + return nil, err + } + return out, nil +} + +// PictureID is the shared RFC VPx RTP PictureID encoding. VP8 and VP9 expose +// codec-specific descriptor structs, but the PictureID wire format is the same: +// one byte for 7-bit IDs or two bytes with the high marker bit set for 15-bit +// IDs. +type PictureID struct { + Present bool + Value uint16 + FifteenBit bool +} + +// Size returns the number of bytes needed for p, or zero when no PictureID is +// present. +func (p PictureID) Size() (int, error) { + if err := p.Validate(); err != nil { + return 0, err + } + if !p.Present { + return 0, nil + } + if p.FifteenBit { + return 2, nil + } + return 1, nil +} + +// MarshalInto writes p into dst and returns the number of bytes written. +func (p PictureID) MarshalInto(dst []byte) (int, error) { + need, err := p.Size() + if err != nil { + return 0, err + } + if need == 0 { + return 0, nil + } + if len(dst) < need { + return need, vpxerrors.ErrBufferTooSmall + } + if p.FifteenBit { + dst[0] = 0x80 | byte(p.Value>>8) + dst[1] = byte(p.Value) + return 2, nil + } + dst[0] = byte(p.Value) + return 1, nil +} + +// Validate rejects impossible PictureID field combinations. +func (p PictureID) Validate() error { + if p.FifteenBit && !p.Present { + return vpxerrors.ErrInvalidConfig + } + if p.Present { + if p.FifteenBit { + if p.Value > 0x7fff { + return vpxerrors.ErrInvalidConfig + } + } else if p.Value > 0x7f { + return vpxerrors.ErrInvalidConfig + } + } else if p.Value != 0 { + return vpxerrors.ErrInvalidConfig + } + return nil +} + +// ParsePictureID parses a present PictureID field and returns the value and +// number of bytes consumed. invalidData preserves the codec-specific parse +// sentinel used by the caller. +func ParsePictureID(packet []byte, invalidData error) (PictureID, int, error) { + if len(packet) == 0 { + return PictureID{}, 0, invalidData + } + pid := packet[0] + if pid&0x80 == 0 { + return PictureID{Present: true, Value: uint16(pid)}, 1, nil + } + if len(packet) < 2 { + return PictureID{}, 0, invalidData + } + return PictureID{ + Present: true, + Value: uint16(pid&0x7f)<<8 | uint16(packet[1]), + FifteenBit: true, + }, 2, nil +} + +// LastFragment reports whether i is the final fragment index in a packetized +// frame of n fragments. +func LastFragment(i, n int) bool { + return i == n-1 +} + +// MarkerMatchesFragmentIndex reports whether the RTP marker bit is set only +// on the final fragment of the frame. +func MarkerMatchesFragmentIndex(payloads []PayloadFragment, i int) bool { + return payloads[i].Marker == LastFragment(i, len(payloads)) +} + +// PayloadFragmentParser returns the codec payload bytes from one RTP payload +// body after validating and stripping the codec-specific descriptor. +type PayloadFragmentParser func([]byte) ([]byte, error) + +// PayloadParser returns the codec descriptor and codec payload fragment from +// one RTP payload body. +type PayloadParser[D any] func([]byte) (D, []byte, error) + +// FragmentValidator validates codec-specific descriptor sequence rules for +// payload fragment i of fragments. +type FragmentValidator[D any] func(i, fragments int, desc D) error + +// FrameAssemblySize validates ordered RTP payload bodies and returns the +// concatenated codec payload size. Codec packages supply descriptor parsing +// and sequence validation; this helper owns marker-bit, empty-fragment, and +// overflow checks. +func FrameAssemblySize[D any](payloads []PayloadFragment, invalidData error, + parse PayloadParser[D], validate FragmentValidator[D], +) (int, error) { + if len(payloads) == 0 { + return 0, invalidData + } + total := 0 + for i := range payloads { + desc, fragment, err := parse(payloads[i].Payload) + if err != nil { + return 0, err + } + if len(fragment) == 0 { + return 0, invalidData + } + if !MarkerMatchesFragmentIndex(payloads, i) { + return 0, invalidData + } + if err := validate(i, len(payloads), desc); err != nil { + return 0, err + } + total, err = AddPayloadSize(total, len(fragment)) + if err != nil { + return 0, err + } + } + return total, nil +} + +// AssembleFrameInto validates payloads, strips codec descriptors, and copies +// the concatenated codec payload into dst. +func AssembleFrameInto[D any](dst []byte, payloads []PayloadFragment, + invalidData error, parse PayloadParser[D], validate FragmentValidator[D], +) (int, error) { + need, err := FrameAssemblySize(payloads, invalidData, parse, validate) + if err != nil { + return 0, err + } + if len(dst) < need { + return need, vpxerrors.ErrBufferTooSmall + } + return AssemblePayloadFragmentsInto(dst, payloads, need, payloadParser(parse)) +} + +// AssembleFrame validates payloads and returns the concatenated codec payload. +func AssembleFrame[D any](payloads []PayloadFragment, invalidData error, + parse PayloadParser[D], validate FragmentValidator[D], +) ([]byte, error) { + need, err := FrameAssemblySize(payloads, invalidData, parse, validate) + if err != nil { + return nil, err + } + return AssemblePayloadFragments(payloads, need, payloadParser(parse)) +} + +func payloadParser[D any](parse PayloadParser[D]) PayloadFragmentParser { + return func(payload []byte) ([]byte, error) { + _, fragment, err := parse(payload) + if err != nil { + return nil, err + } + return fragment, nil + } +} + +// AssemblePayloadFragmentsInto copies codec payload fragments into dst. The +// caller remains responsible for codec-specific descriptor and sequence +// validation before calling this helper. +func AssemblePayloadFragmentsInto(dst []byte, payloads []PayloadFragment, + size int, parse PayloadFragmentParser, +) (int, error) { + off := 0 + for i := range payloads { + fragment, err := parse(payloads[i].Payload) + if err != nil { + return 0, err + } + if len(fragment) > len(dst)-off { + return size, vpxerrors.ErrBufferTooSmall + } + copy(dst[off:], fragment) + off += len(fragment) + } + return size, nil +} + +// AssemblePayloadFragments returns the concatenated codec payload carried by +// payloads. The caller supplies the already validated frame size. +func AssemblePayloadFragments(payloads []PayloadFragment, size int, + parse PayloadFragmentParser, +) ([]byte, error) { + out := make([]byte, size) + _, err := AssemblePayloadFragmentsInto(out, payloads, size, parse) + if err != nil { + return nil, err + } + return out, nil +} + +// AddPayloadSize adds n to total while rejecting negative sizes and int +// overflow. +func AddPayloadSize(total, n int) (int, error) { + maxInt := int(^uint(0) >> 1) + if n < 0 || total > maxInt-n { + return 0, vpxerrors.ErrInvalidConfig + } + return total + n, nil +} diff --git a/options_test.go b/options_test.go new file mode 100644 index 0000000..e9a7579 --- /dev/null +++ b/options_test.go @@ -0,0 +1,36 @@ +// Copyright (c) 2026, go-avkit +// SPDX-License-Identifier: BSD-3-Clause + +package vpx_test + +import ( + "testing" + + "github.com/go-avkit/vpx/vp8" + "github.com/go-avkit/vpx/vp9" +) + +// A negative thread count or size cap is refused by New, with no decoder. +func TestNewRefusesBadOptions(t *testing.T) { + for _, o := range []vp8.Options{{Threads: -1}, {MaxWidth: -1}, {MaxHeight: -1}} { + if d, err := vp8.New(o); err == nil || d != nil { + t.Errorf("vp8.New(%+v) = %v, %v; want a refusal", o, d, err) + } + } + if d, err := vp8.New(vp8.Options{Threads: 2, MaxWidth: 64, MaxHeight: 64}); err != nil || d == nil { + t.Fatalf("vp8.New(valid) = %v, %v", d, err) + } else { + d.Close() + } + + for _, o := range []vp9.Options{{Threads: -1}} { + if d, err := vp9.New(o); err == nil || d != nil { + t.Errorf("vp9.New(%+v) = %v, %v; want a refusal", o, d, err) + } + } + if d, err := vp9.New(vp9.Options{Threads: 2, RowMT: true, MaxWidth: 64, MaxHeight: 64}); err != nil || d == nil { + t.Fatalf("vp9.New(valid) = %v, %v", d, err) + } else { + d.Close() + } +} diff --git a/testdata/fuzz/FuzzVP8Decode/first-two-packets b/testdata/fuzz/FuzzVP8Decode/first-two-packets new file mode 100644 index 0000000..2d7c1ac --- /dev/null +++ b/testdata/fuzz/FuzzVP8Decode/first-two-packets @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("P\x1d\x00\x9d\x01*\xb0\x00\x90\x00\x00\a\b\x85\x85\x88\x85\x84\x88\x02\x02\x03U҂\xf1\x8e\xd1\x00\x13\xee\x83\x17p\xd0\xf84ܞ\x9aozk\xb0&3\xf7\xe1\xbaY\xef\x1e\x97\xe6\xc4NIr\"mr\x1a\xebSH2:\"DZa\xc5\x1fز\xf3<\xb6@{{\x83t\xb8V\xfbܬ\x00\x01U\xfc\x9dڜ_\xf0\xfez\xf1Ě\xa9\x04\n\xfdQ\xe2\xcadW\xda\\\f\x16\x95TyH\xdc,&\xf9'R\x1f\xc2\xd6nܦ\xae\x95\x02\xff\xaf\xa7ݡ\xb1~\x03\x8d\x98\x14l\x809\x86e\x133\xad\xdc.\x84\xaa\xa8\xaa\xe4\x93\x10\x18\xca1\xe8\xa2\x1bI\x9e\xc0\xe2\x94ƀp\xe0\xf8A\x91\x92ī\xf1Fދ\xfe<>-\xc0\xb4\x90\xc3b\xef\xc7\xfb\x8f\xe0\x13y\x0fRd\xfb+e\x17o%*\x9c\xfb\x98\x86\xb4\t\x8b7gT2~\xcc\a\xff\xb4\x15\xd0\x110.\x0f\x12\xc9\xff\xfd\x9biDe`\xfe\xff\xabR\x8a\x9a1\xbd̍\x1e15\x8a'2\x9d\xd2\xca\xc8&\n\xe2J\x12\xba;\x8b\x89\xa1;\x05T\x96\xcc\xe6jV>\xcd\xd6\x13F@!d\v\xa3\xf9\n\x9a\xb4f\xe3[6\xea\nV\xbf\xf3\xacB\xcdz6\xce\xc3K\x15k\xdbn#\x94iD\xd4BQ\x8f!AJ$\x15\r\xea;_\xdd\xc2\xf1\x0f\x9bsI>\x82\x16Dw\x0f\x805\x04\x1a\x7f\xb3\x17\xac\xf98\xc9Wt\xcd\x03\x95\xbb\xec\xe4S*o\xf1Q\x12\xd7x\xaf:w\x86!\xfa\xa8\x05\x99\x9ațNr\xc9\xd5u~\x7f\t\xdf\x02pY\xc4(\x04\x88OY\xe80\xc9f\xa2Q\xef@ż\xact\x03\xffj\xb2\xd4\x1a;,Jf\xa8\xed\x18b\x93J\xcb\a\x86{p\x0f\xb0^\xa6\xdd\xe1\x1a\x99\xd3*\xf7\x98\x06\x93\xbf\xa7\x8e\x13PD\xbc\xce6\x17\x1b\x1f\x15\xb3\">و㤡`\xde7S\v\xbe\f\xe8\xd0\xfa\xdd\x1f\xa6\xda\xf7\xb3\x97D\xf1#)\xee\xbf\xf6\xf2\x1d\xd8X \xd7w\xa6\xf9\xb0k\xcd\xda\x06\xc0/P\x95\xc6\a*\xbfF'YR\xc3\xc7\xe6\xd7\xcb\x00Sv>DO\xabM\xbd\xff]\xea\xf3\xa9\x14\x0eM\xb9\xe4ޞ\xb0\xa7\xf1Ay0\xa4\xa8.\xb5B@\b\xf8\x00\xbf\xdc\xe4\xe0\xffT\x1b4\xe2\xed,\x03\x96\x9e\xb9\xeamF\xa9Ql\xff\xa2ф\v\xa9\xd5ҵ\bb\x17\x7f\\\xcc\xdb\\+\xe1*mE\xf8\xf02X\xb4\xc86,\xa6\x1bćM)\xe6/;.Ҁu\xf9\x81\".^a\xf7\xac\xb0\xb65\xd88\xa8\xf4\xef\xac\xe7:\x87\xff\r\x84\x94Lm\x81\x01Ѓe\x16W\xb4l\x8e\x00") +[]byte("Q\f\x00\x00\x10\x10\x00\x1e\xcb\x03\xdc\xc3\xed\xef\x1d0\xe3EȆ\xa6\xa4\x9c\x8er\xee\xaeFySX\v\x01\xb1\xf4\x06\\\xc0\x18\xb8+\xa0\x00?\x06\x9a(U;_+\x02\x14\x03\x93\xdf\t\xe3\"#SӨ\x844\x05\r\xec\xa9Ir\xee\x9fJ\x0e\xbe\x98\xbc\x01\b\x9e\xd5j\xb2G\f\x19\xe0`>P!\x18\xdcNνl\xe9\xa9@\xf3x\x97\xf9q\xe0\x182\xad\xac\xf8?B\xa7C+2\xbd\xadw\xb5\x87\xf8\xe0\xfe~\x93\xb7\xfe@\x19)NK\x80w\x0f\xa8\xc0\x17\xa1\xf1\xb8Ol\xee\b\xe6x\x98Eq\xbf\xea\xe94:IDȱy\\\x147\xf4w\xf8\x8f\xda\xe6\x8el \xf7u5\x8cCI!4\xb0\x19\x16/+\x9ad\x8f9E\x9bz'\x96\xc6M\x95\xdc\x03l\xea\xea`\xa8\x16\xb4$\xa6\x9ahI\xcb\xf2\"\xb5\xda-\xd2\f\xadW\xbaZ\x8d\xa0\n\x981d\xad\x9a\xa0k@͐\xba\x16\xc5\"\x92p\x00\x0e\xfdpJHX\xa7\xe6\x1cJ\xc3\a\xe9\xe09\x1e\x968\x8c^\xc1[&C\xd9\xc0") diff --git a/testdata/fuzz/FuzzVP9Decode/first-two-packets b/testdata/fuzz/FuzzVP9Decode/first-two-packets new file mode 100644 index 0000000..bcb2082 --- /dev/null +++ b/testdata/fuzz/FuzzVP9Decode/first-two-packets @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x82I\x83B\x00\x00p\x00t\x008$\x1c\x18\x06\x00\x00\xf00a\xf0j\x8a^q\xf4^\xcd\xf5\xca\xf0\x00\x00\x15\x1b_\xbb'0{\xb3Ar?\xf7\x8fZd\x857c\x80d>텎\xf4\xdb\xc6\xf9\xe6\x12XKsv2e.Y\xf6ﹶlS\x94\xd0'\xdbGje\xe3\x92\r\r\xa8;\xea\x12\xc4&ek\x89\xf0\xb3_{I\x10\xc3*\xaf\x9c\x0e\xb6\x9a={\x97)\xf4\xf8\xff\x04\xc7\xf4_\xe2\xa2\x00") +[]byte("\x86\x00@\x92\x98\x00B@\x00\x03 \x00\x00\"\x01\xff\xfb\xf9\xbfl돧s\xb2\x1d\a8\xb4\xeeS\xd3\xcaNk\x98\xe2\x80c\x19\x9f'\x9a\xee\x1d\xda5\x9f\x0f\x8cdWH\x06j\x01ʳ+Sl\xcdTR\xff\xeb\xc9\x1a\x94\x7f\xc5y\x15\xbbT\xfe\xfa\xeb\x83X\xa0") diff --git a/testdata/libvpx/vp80-00-comprehensive-001.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-001.ivf.md5 new file mode 100644 index 0000000..a9eb7e7 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-001.ivf.md5 @@ -0,0 +1,29 @@ +83c78b5db579710f61f9354d5c51e8c8 vp80-00-comprehensive-001-176x144-0001.i420 +8d089d226f52d6cdaffdb3fcc080b75b vp80-00-comprehensive-001-176x144-0002.i420 +acaae81ca812145e85e0be83bdf54226 vp80-00-comprehensive-001-176x144-0003.i420 +e94651d798b6bf5f09a9bba10cacaf7a vp80-00-comprehensive-001-176x144-0004.i420 +60c2607913e528d501962bf407341731 vp80-00-comprehensive-001-176x144-0005.i420 +e683f2bf28b31e36db88087bd03b6917 vp80-00-comprehensive-001-176x144-0006.i420 +0c2923785051bc9b90c2447a85527764 vp80-00-comprehensive-001-176x144-0007.i420 +1bc97b6b2e4ca36b149c3768495747ac vp80-00-comprehensive-001-176x144-0008.i420 +0586d948ed3fd479c6dd08055973bcb4 vp80-00-comprehensive-001-176x144-0009.i420 +c9a1198e1680487c77a2d1631695aeec vp80-00-comprehensive-001-176x144-0010.i420 +547d8ffce9c085231c74717a9b815625 vp80-00-comprehensive-001-176x144-0011.i420 +d31c02a5591eb7bd8e73703252e1a1ab vp80-00-comprehensive-001-176x144-0012.i420 +23bafc8e22b2ed7e8c5e52369095cd30 vp80-00-comprehensive-001-176x144-0013.i420 +9725d52d7810a19b20dcc9bb0fa36abd vp80-00-comprehensive-001-176x144-0014.i420 +7aefaabdcd2595939fd05078d01b484b vp80-00-comprehensive-001-176x144-0015.i420 +828e758d6f0b29b2693b2dc6b09249a6 vp80-00-comprehensive-001-176x144-0016.i420 +53f09380dde1420ba270b74d8819537c vp80-00-comprehensive-001-176x144-0017.i420 +09791a7db3bc28258350cfdc95d8f224 vp80-00-comprehensive-001-176x144-0018.i420 +2050271dc4ba3f3e427cf8088c96e28d vp80-00-comprehensive-001-176x144-0019.i420 +4e69d3f7cea45844b740368fcd4dd815 vp80-00-comprehensive-001-176x144-0020.i420 +4ed07697e239b7f12ee6a97ad09c08fb vp80-00-comprehensive-001-176x144-0021.i420 +1437c129bfbda63ca1d39a94ee91b097 vp80-00-comprehensive-001-176x144-0022.i420 +4fc951bf45e164b711591155a59c73fa vp80-00-comprehensive-001-176x144-0023.i420 +97d1007e27b4b9072751e87e8d1f1415 vp80-00-comprehensive-001-176x144-0024.i420 +18c809835dcc3d30c93ae1be569dcd24 vp80-00-comprehensive-001-176x144-0025.i420 +de0fd0035a542791c4dda5735657efc5 vp80-00-comprehensive-001-176x144-0026.i420 +27a70ff95d0cfa10f54652c9fb8a9db2 vp80-00-comprehensive-001-176x144-0027.i420 +2285b9324ec91099626191f769962e44 vp80-00-comprehensive-001-176x144-0028.i420 +56794d911b02190212bca92f88ad60c6 vp80-00-comprehensive-001-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-002.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-002.ivf.md5 new file mode 100644 index 0000000..111cae4 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-002.ivf.md5 @@ -0,0 +1,49 @@ +872e9922f37f0e92c767d33e0a15b8e0 vp80-00-comprehensive-002-176x144-0001.i420 +ea5ad6c6ee4355018fc0ba83b5172836 vp80-00-comprehensive-002-176x144-0002.i420 +fe744612b2167c9ba6e1dc81c031e16a vp80-00-comprehensive-002-176x144-0003.i420 +744359695caee3f32307a2d7eef09e85 vp80-00-comprehensive-002-176x144-0004.i420 +07211ac8d8bae4d931ade402ff6e3c12 vp80-00-comprehensive-002-176x144-0005.i420 +2ce02854f228b1378d9dc34cab8d343b vp80-00-comprehensive-002-176x144-0006.i420 +af5222ad42c4f22f22fbf19c26c02dcb vp80-00-comprehensive-002-176x144-0007.i420 +88538d39f2647df8fedf15bd1b767bbf vp80-00-comprehensive-002-176x144-0008.i420 +d0d936471dd4e9922eb067c0f09eacab vp80-00-comprehensive-002-176x144-0009.i420 +03cb1f5c5026e96f6e686aa1fa9b1028 vp80-00-comprehensive-002-176x144-0010.i420 +2ebe35e23d2244c5b0f777fbc01f8f37 vp80-00-comprehensive-002-176x144-0011.i420 +f9314f5ea91ebbaaed6e37ca0701ed67 vp80-00-comprehensive-002-176x144-0012.i420 +37dca7530d09fd1e8bad154b9e312ea2 vp80-00-comprehensive-002-176x144-0013.i420 +9841dc8ff6424abe362c4dfe03b5fbd0 vp80-00-comprehensive-002-176x144-0014.i420 +72bd0b70c576dfb544f622c488217491 vp80-00-comprehensive-002-176x144-0015.i420 +309b21c126153f20f312e38a8dad44e1 vp80-00-comprehensive-002-176x144-0016.i420 +0acbb170ede66ebdae4e9d8e56908f75 vp80-00-comprehensive-002-176x144-0017.i420 +318c9c3e531d00734b5f78433da176c9 vp80-00-comprehensive-002-176x144-0018.i420 +0388dfdb2a792148b44bdb705cc2df99 vp80-00-comprehensive-002-176x144-0019.i420 +f440adff2b44888becbf3ca16e425441 vp80-00-comprehensive-002-176x144-0020.i420 +ac41431627d8d1712d40412ab8c3200c vp80-00-comprehensive-002-176x144-0021.i420 +417e1abbfe2a078663dae688ae4a9bb1 vp80-00-comprehensive-002-176x144-0022.i420 +73d493bdf4a29d5cfeec610109f582a8 vp80-00-comprehensive-002-176x144-0023.i420 +3c026a536ef36467d4a9db6bcc20cec1 vp80-00-comprehensive-002-176x144-0024.i420 +57836430f2f10862b84541d99cca062c vp80-00-comprehensive-002-176x144-0025.i420 +04ad6fa97e1ff49931b574bdaaddd5db vp80-00-comprehensive-002-176x144-0026.i420 +e94f2ec4cbf2b9067a4a4307eadebb6f vp80-00-comprehensive-002-176x144-0027.i420 +e3542cdee672d97c65ab06dbe611247d vp80-00-comprehensive-002-176x144-0028.i420 +6c83c6c76aa8bf73646eb7a714cb42bf vp80-00-comprehensive-002-176x144-0029.i420 +b5f64c6fc6d0c777a0a0b9097862f171 vp80-00-comprehensive-002-176x144-0030.i420 +293dccaf5027759679bb9e8696b6381a vp80-00-comprehensive-002-176x144-0031.i420 +1a3d015ff9b164cb7922aef0aeac520e vp80-00-comprehensive-002-176x144-0032.i420 +93f9152d9425f0ec43160a0c01c485b2 vp80-00-comprehensive-002-176x144-0033.i420 +c7c4a8f78f781f70cedc44edc1d06911 vp80-00-comprehensive-002-176x144-0034.i420 +21330442d5bef415fd765759d867c98b vp80-00-comprehensive-002-176x144-0035.i420 +6164258040f85206a3833aeb4f27a34f vp80-00-comprehensive-002-176x144-0036.i420 +3213e1405dfe6588a7334a8bc2b1e47f vp80-00-comprehensive-002-176x144-0037.i420 +a619fa73f0081a349dfa2b000de19045 vp80-00-comprehensive-002-176x144-0038.i420 +1f3cec4bb793dc4a118ddcf500090f37 vp80-00-comprehensive-002-176x144-0039.i420 +12308ec77632ca10f1451aec8e62b82f vp80-00-comprehensive-002-176x144-0040.i420 +018c7f50ed4a494a9fcd32fdfed6705f vp80-00-comprehensive-002-176x144-0041.i420 +a7282728fbd7e0b49a6967b0ea4e1f61 vp80-00-comprehensive-002-176x144-0042.i420 +6aa15ab83e82f246ee9c7b7a040bfaac vp80-00-comprehensive-002-176x144-0043.i420 +e4c17d2603e03753d54a142491cf5dc0 vp80-00-comprehensive-002-176x144-0044.i420 +0a7331aa707e42e732f04e9175438195 vp80-00-comprehensive-002-176x144-0045.i420 +b522cfa3f3c706d1901231bb9e6b4b8a vp80-00-comprehensive-002-176x144-0046.i420 +7b2a70e47d9af98cfa6216ed2a7d528c vp80-00-comprehensive-002-176x144-0047.i420 +b56e22bc9beacff9c3207b2757fc7f94 vp80-00-comprehensive-002-176x144-0048.i420 +a3dfc9461c0480cf56ee465ddabf0de1 vp80-00-comprehensive-002-176x144-0049.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-003.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-003.ivf.md5 new file mode 100644 index 0000000..5a55656 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-003.ivf.md5 @@ -0,0 +1,49 @@ +96e6ce168b5ef377053e86ab5484e7f9 vp80-00-comprehensive-003-176x144-0001.i420 +10fd750292d8522ab7ee577043604789 vp80-00-comprehensive-003-176x144-0002.i420 +e040995173dc5c85abbbe38f6823ff9a vp80-00-comprehensive-003-176x144-0003.i420 +5aa18f4fbd8b5b887d74f84cc92075dc vp80-00-comprehensive-003-176x144-0004.i420 +f0dc7f520e88b94e5cb924d804b0472a vp80-00-comprehensive-003-176x144-0005.i420 +2375955dce3bb0a824779a800cd1555b vp80-00-comprehensive-003-176x144-0006.i420 +3e96a0e477de39530e1950cff284a854 vp80-00-comprehensive-003-176x144-0007.i420 +6cd40fa8a89221f2b990bd8af2a9ee14 vp80-00-comprehensive-003-176x144-0008.i420 +0b929243ceeffce836279e2aa84647cd vp80-00-comprehensive-003-176x144-0009.i420 +1e95f0ad25fe033076b57c3852bb3550 vp80-00-comprehensive-003-176x144-0010.i420 +81aa93a3f9c56d2aa4b8285d3507e6b4 vp80-00-comprehensive-003-176x144-0011.i420 +cf9947a302dec306d7f487cf3a2731b0 vp80-00-comprehensive-003-176x144-0012.i420 +3b9ca47752db95a049678da07974b476 vp80-00-comprehensive-003-176x144-0013.i420 +aa6788405dc47dd44867fca6c95ba3d9 vp80-00-comprehensive-003-176x144-0014.i420 +276d1c62b908c081c7bbb78f943b0de1 vp80-00-comprehensive-003-176x144-0015.i420 +eb006b6218e457fd794e9b3a5dfbf638 vp80-00-comprehensive-003-176x144-0016.i420 +9dd5312833e770286c5aa5436a00376e vp80-00-comprehensive-003-176x144-0017.i420 +7899278e66aa255ce5bf69a6e1137d0f vp80-00-comprehensive-003-176x144-0018.i420 +0ac7d062ea7550fa0717723b1272abc2 vp80-00-comprehensive-003-176x144-0019.i420 +d8f1bb881a46ecafcbbe457a004a71f1 vp80-00-comprehensive-003-176x144-0020.i420 +cc3a04b98159189a74b5241df540d8fb vp80-00-comprehensive-003-176x144-0021.i420 +4e29eb2c8c465ae9ffcfa28ec0b3694b vp80-00-comprehensive-003-176x144-0022.i420 +608fb6ba526e6aa4ad1c0290aedaa69d vp80-00-comprehensive-003-176x144-0023.i420 +4acc6a73547be6310b9a275436c55805 vp80-00-comprehensive-003-176x144-0024.i420 +482cf409b86242d30f3a78a6c85364df vp80-00-comprehensive-003-176x144-0025.i420 +a22cb76770f112eb1169218cc87c1e4f vp80-00-comprehensive-003-176x144-0026.i420 +e74675b051ff05e178a9a24893721d99 vp80-00-comprehensive-003-176x144-0027.i420 +ee5061bff62c8c8603b7bc2bb2bb29e8 vp80-00-comprehensive-003-176x144-0028.i420 +a3c0ab11f338bd488c69f2b62e1e5a74 vp80-00-comprehensive-003-176x144-0029.i420 +9f6b7e30e0ed4e272393b9a9957752e1 vp80-00-comprehensive-003-176x144-0030.i420 +9cce9f2ffff1766d05bda04e46eff997 vp80-00-comprehensive-003-176x144-0031.i420 +5105a2ba923bc6f21ea3d32ab1bc7bf8 vp80-00-comprehensive-003-176x144-0032.i420 +957d619a1001e2b5e52db166b66b7f50 vp80-00-comprehensive-003-176x144-0033.i420 +fdb4e71cddeec8a321d9c8d4ffc506ce vp80-00-comprehensive-003-176x144-0034.i420 +9ee646940fb8ac2312d29e9f1c3b6d40 vp80-00-comprehensive-003-176x144-0035.i420 +a110e81d2105beae81cd36b15bc5ac2f vp80-00-comprehensive-003-176x144-0036.i420 +804b6d8fc99fadb9c6bfdae3becee6b5 vp80-00-comprehensive-003-176x144-0037.i420 +e217627bbaeebf30456e38aeb1f0746b vp80-00-comprehensive-003-176x144-0038.i420 +56468a2c548dd3085b4bce88c4a1e41d vp80-00-comprehensive-003-176x144-0039.i420 +ef170e7f21e2b262525b43d6b25dec4c vp80-00-comprehensive-003-176x144-0040.i420 +3acc3c47def8a0fa0561eaacaf9e41a1 vp80-00-comprehensive-003-176x144-0041.i420 +0c3e2187f13e4504fb4b246706bba83c vp80-00-comprehensive-003-176x144-0042.i420 +397326a22e6e49487309c39d64037df8 vp80-00-comprehensive-003-176x144-0043.i420 +95236c1319b6f1f692b3998547811ee7 vp80-00-comprehensive-003-176x144-0044.i420 +5aff1957504884abf74d6fb74b74b032 vp80-00-comprehensive-003-176x144-0045.i420 +6de06343435a8926a746037cab5f633c vp80-00-comprehensive-003-176x144-0046.i420 +3de68e05ddf2c60ee9110048ceefeb6a vp80-00-comprehensive-003-176x144-0047.i420 +e637fef689edad6ffd6eeb4a29004bf7 vp80-00-comprehensive-003-176x144-0048.i420 +bb809114af8df5cb4ed82d3a1d11a673 vp80-00-comprehensive-003-176x144-0049.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-004.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-004.ivf.md5 new file mode 100644 index 0000000..e5a85a7 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-004.ivf.md5 @@ -0,0 +1,29 @@ +83c78b5db579710f61f9354d5c51e8c8 vp80-00-comprehensive-004-176x144-0001.i420 +d173eb8a8211a05672b43206609c9034 vp80-00-comprehensive-004-176x144-0002.i420 +204e3e91613d647d30244c00fa2b9563 vp80-00-comprehensive-004-176x144-0003.i420 +3cc1a395bd10a49b006741778285925b vp80-00-comprehensive-004-176x144-0004.i420 +024548b00dea4f104d6b9a728be05786 vp80-00-comprehensive-004-176x144-0005.i420 +01401e9418f2e00ab4ffdb3296d40ffa vp80-00-comprehensive-004-176x144-0006.i420 +35d8b3c1ef9cb864315b7502b93629b2 vp80-00-comprehensive-004-176x144-0007.i420 +aeb44f0fe4c2eecb26c0bd657d65b00b vp80-00-comprehensive-004-176x144-0008.i420 +42e40bed012bacf59f0c41d4cfd3e52a vp80-00-comprehensive-004-176x144-0009.i420 +9796191fa2bd4572123ea043396e8485 vp80-00-comprehensive-004-176x144-0010.i420 +2d6d68b902129f3c3f1730e73b98f9c9 vp80-00-comprehensive-004-176x144-0011.i420 +ba348b89248b92d0b86d794dc413e6a0 vp80-00-comprehensive-004-176x144-0012.i420 +5ce49bf164033d49bef1b23120d202d6 vp80-00-comprehensive-004-176x144-0013.i420 +54837a426c63a9c40ef8750232615dad vp80-00-comprehensive-004-176x144-0014.i420 +350bcddf9a34f5003f6f655aaa020a00 vp80-00-comprehensive-004-176x144-0015.i420 +babb82b1e2ca9315816b6f43b8ef84a0 vp80-00-comprehensive-004-176x144-0016.i420 +c770825785c51fa374fd5bb08ff9f536 vp80-00-comprehensive-004-176x144-0017.i420 +e9e0f92e416fcd27ca2e93a0804ac938 vp80-00-comprehensive-004-176x144-0018.i420 +e0f2b89423da549eaa8b2b89f956f0f8 vp80-00-comprehensive-004-176x144-0019.i420 +9926b7e13b51115735eb0af8bb5e4ea1 vp80-00-comprehensive-004-176x144-0020.i420 +d6b30a058b854c54068ebfc2b05f8fa0 vp80-00-comprehensive-004-176x144-0021.i420 +a03048df79e41ada8a3ecc15a85e3f94 vp80-00-comprehensive-004-176x144-0022.i420 +34bef9af0633a43434841fd5189c161c vp80-00-comprehensive-004-176x144-0023.i420 +219b447552b1ee409c1b9b56176d36bf vp80-00-comprehensive-004-176x144-0024.i420 +95ea99459eaebc2f7233feeaf0549224 vp80-00-comprehensive-004-176x144-0025.i420 +34e08ce4067ca67ee9014cf628b6bb1c vp80-00-comprehensive-004-176x144-0026.i420 +066c09a20d11b9dc3fa6972fd7f242c4 vp80-00-comprehensive-004-176x144-0027.i420 +aed02c1951070ae5febea21ad54add55 vp80-00-comprehensive-004-176x144-0028.i420 +f5a0fde2d818c4aaabd29b069ced6aea vp80-00-comprehensive-004-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-005.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-005.ivf.md5 new file mode 100644 index 0000000..9a8a4c5 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-005.ivf.md5 @@ -0,0 +1,49 @@ +e7a4be434df4bb524ba56a03cba901f4 vp80-00-comprehensive-005-176x144-0001.i420 +d903ade6d49e51485627c044fbb2190c vp80-00-comprehensive-005-176x144-0002.i420 +af07ee39629b852870104cb9a9dde9e3 vp80-00-comprehensive-005-176x144-0003.i420 +388a5f736db2de15342b62294fda4c82 vp80-00-comprehensive-005-176x144-0004.i420 +a072600936aa77738fa2fa88ba212849 vp80-00-comprehensive-005-176x144-0005.i420 +0f96b1fb05b92498c0e1fcb6552e7e79 vp80-00-comprehensive-005-176x144-0006.i420 +68b0db002a0127ee79a7c70062aa8c3a vp80-00-comprehensive-005-176x144-0007.i420 +f9bc8edfeb9ceca9227a20cdab6788de vp80-00-comprehensive-005-176x144-0008.i420 +bfe2115b000565abc3dce1d38f804ed7 vp80-00-comprehensive-005-176x144-0009.i420 +67f17f96177f5464af1b97452560d2af vp80-00-comprehensive-005-176x144-0010.i420 +658278016e5409b69d014fab0d94d0ea vp80-00-comprehensive-005-176x144-0011.i420 +04dfd36afa0ddf22993d21c0a0fc715e vp80-00-comprehensive-005-176x144-0012.i420 +088e5a7cc75a895f01f7a4362f104bc1 vp80-00-comprehensive-005-176x144-0013.i420 +fb622a1a421b3689950f1adde9296dbb vp80-00-comprehensive-005-176x144-0014.i420 +3711ac7adc816614a2efda9e138f53fc vp80-00-comprehensive-005-176x144-0015.i420 +8e6fe3e68ccf53f23dd430b611fbfa6d vp80-00-comprehensive-005-176x144-0016.i420 +1c77dd651cd38d3308671f0705d29926 vp80-00-comprehensive-005-176x144-0017.i420 +bb5d7afccebc5d8a29f5980d21530d61 vp80-00-comprehensive-005-176x144-0018.i420 +e51f2eeb39afa50ea243eaca39974f82 vp80-00-comprehensive-005-176x144-0019.i420 +7a73b1546fb5d8d4b05ebd4c839f74f8 vp80-00-comprehensive-005-176x144-0020.i420 +62a0db46717d7fb6523c62968fd3bc85 vp80-00-comprehensive-005-176x144-0021.i420 +98d6e520a164c42c5d19167c0ad48b22 vp80-00-comprehensive-005-176x144-0022.i420 +9749a21ea432221323c1a6b61ea59d51 vp80-00-comprehensive-005-176x144-0023.i420 +45fa9a9583db0139611b860bed8f6bc1 vp80-00-comprehensive-005-176x144-0024.i420 +aac06fe351759ca81a5028f2f4a7b534 vp80-00-comprehensive-005-176x144-0025.i420 +7b7c7c16a377d61b6fe474541a18f0cd vp80-00-comprehensive-005-176x144-0026.i420 +2a84883fdfa8450d46b8b9352b7d5a87 vp80-00-comprehensive-005-176x144-0027.i420 +3fc42d7dd6fa25ec17d8f2881f81b376 vp80-00-comprehensive-005-176x144-0028.i420 +bfb243be1eada17adab5580b748248e7 vp80-00-comprehensive-005-176x144-0029.i420 +531fd799989db62210efc1999397d280 vp80-00-comprehensive-005-176x144-0030.i420 +1c1e68673b295e17fca1b14d1eb1995e vp80-00-comprehensive-005-176x144-0031.i420 +12ee0f8810a1a3574337ef98987cf919 vp80-00-comprehensive-005-176x144-0032.i420 +0c6ef1cec243c552e83054d5ac56a8c1 vp80-00-comprehensive-005-176x144-0033.i420 +cf0af3fb96e57143d335086485fbfa5c vp80-00-comprehensive-005-176x144-0034.i420 +f5df68bb123d1f2f59ba471fbd118a9e vp80-00-comprehensive-005-176x144-0035.i420 +0b4a0cf5dd7968fd26959ad2849655b0 vp80-00-comprehensive-005-176x144-0036.i420 +0ba766224688a95bfa43ac2453555972 vp80-00-comprehensive-005-176x144-0037.i420 +ef3f9fd7e5509bb880377fa1997d318c vp80-00-comprehensive-005-176x144-0038.i420 +d7486c3176cef98c0046522acbdaa4f0 vp80-00-comprehensive-005-176x144-0039.i420 +f8dd15973993f4a2acd1d34b3610622e vp80-00-comprehensive-005-176x144-0040.i420 +e99b7f294e6bdd9ae18f013f62174fcd vp80-00-comprehensive-005-176x144-0041.i420 +68ccf7e14a1055b24c5faf1b3a1888e7 vp80-00-comprehensive-005-176x144-0042.i420 +2f230afb6e5c67e4b7e000317638e919 vp80-00-comprehensive-005-176x144-0043.i420 +9cab31ac76ed26a879ac8b88bf7d33a1 vp80-00-comprehensive-005-176x144-0044.i420 +1e2affc0f458808b4564bd0453565a81 vp80-00-comprehensive-005-176x144-0045.i420 +79669092f6c73053c3de6d0d1408cc8c vp80-00-comprehensive-005-176x144-0046.i420 +7b27977ba84341b9af4d58a7864f763a vp80-00-comprehensive-005-176x144-0047.i420 +2481a387d65e7a16fe831b8da2200985 vp80-00-comprehensive-005-176x144-0048.i420 +fa5e3bc265877b30ca71de0a2b14663b vp80-00-comprehensive-005-176x144-0049.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-006.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-006.ivf.md5 new file mode 100644 index 0000000..0d17100 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-006.ivf.md5 @@ -0,0 +1,48 @@ +9ca5df27b0158aca2a38dff946f58c41 vp80-00-comprehensive-006-175x143-0001.i420 +627129a99538ec1ac51be910ca92ebc4 vp80-00-comprehensive-006-175x143-0002.i420 +6c2df1f21af317aa5bb68b161ca96c70 vp80-00-comprehensive-006-175x143-0003.i420 +d66db823863838ca5b7f9125609e7de3 vp80-00-comprehensive-006-175x143-0004.i420 +ecc970f8846290c0b7bf8d0865975cb7 vp80-00-comprehensive-006-175x143-0005.i420 +2fe7575c448562e291933e297335e1c8 vp80-00-comprehensive-006-175x143-0006.i420 +e2a6fb8af11f65ce1153d6021df39e5f vp80-00-comprehensive-006-175x143-0007.i420 +4536008cd0a425c9a9d93cbb3e8ba640 vp80-00-comprehensive-006-175x143-0008.i420 +478f042fff1cf0b6fd2eed391879c7ba vp80-00-comprehensive-006-175x143-0009.i420 +f079ee39021b1dd730f80bfaff9a6ae4 vp80-00-comprehensive-006-175x143-0010.i420 +cb9b166c785ceabecf79e12e6068d4e4 vp80-00-comprehensive-006-175x143-0011.i420 +6bd6f77dc9c45cec08949a42aa1c2653 vp80-00-comprehensive-006-175x143-0012.i420 +1433577eb50b3270c0f1d6d26fb26277 vp80-00-comprehensive-006-175x143-0013.i420 +2765b207d230efd9a3e2e93c641b8553 vp80-00-comprehensive-006-175x143-0014.i420 +a67e2f6bcf3b03e250c0ad8f1384ffb6 vp80-00-comprehensive-006-175x143-0015.i420 +b5ea80e2dbffefdd8a613c25ee7f5f0c vp80-00-comprehensive-006-175x143-0016.i420 +e4b58bf735a8258842ad3c364eb9418c vp80-00-comprehensive-006-175x143-0017.i420 +8e5fc5d4c78eb495f62e4a014a6a2a6c vp80-00-comprehensive-006-175x143-0018.i420 +53bee2faf4cfae16037cda36a6194a57 vp80-00-comprehensive-006-175x143-0019.i420 +e5c2e1de872a7107f80966ae857557d4 vp80-00-comprehensive-006-175x143-0020.i420 +882e46851681e6e3b376b5d1d9e139fb vp80-00-comprehensive-006-175x143-0021.i420 +40b199fe02b5885947af22ce1314a085 vp80-00-comprehensive-006-175x143-0022.i420 +942b79dd5360c2a114db760424620a84 vp80-00-comprehensive-006-175x143-0023.i420 +fe9f69dd6fc113ceec9127d9e12b3958 vp80-00-comprehensive-006-175x143-0024.i420 +db13edae7e8e8a91d1ec84227c8f818f vp80-00-comprehensive-006-175x143-0025.i420 +1963ea61c3e93150f7604ee6fa09b12c vp80-00-comprehensive-006-175x143-0026.i420 +8cf43556160454d2353cedb9ba5675aa vp80-00-comprehensive-006-175x143-0027.i420 +a5e6b5b00fea3d9b1bdbd01fda712f27 vp80-00-comprehensive-006-175x143-0028.i420 +35f006cb6e570999b9011282c49c6d22 vp80-00-comprehensive-006-175x143-0029.i420 +d884d482371cb2727e26475bb390d38b vp80-00-comprehensive-006-175x143-0030.i420 +a7233206056d3af69c6cff343b57de84 vp80-00-comprehensive-006-175x143-0031.i420 +437492f3e594576e1c17065e0091aa2d vp80-00-comprehensive-006-175x143-0032.i420 +47f0677d9aff054056a194755628fdb8 vp80-00-comprehensive-006-175x143-0033.i420 +fc93105a16501763a6e6ba3445ee6f32 vp80-00-comprehensive-006-175x143-0034.i420 +68612903d08399e0f0d9e28c1f18f6ea vp80-00-comprehensive-006-175x143-0035.i420 +a340fbba24c73372e6248f10e878f11b vp80-00-comprehensive-006-175x143-0036.i420 +58c3561b06f9d866587f728877c08860 vp80-00-comprehensive-006-175x143-0037.i420 +f2dd2a029515ad9c0655ccf86a2c524b vp80-00-comprehensive-006-175x143-0038.i420 +789d43f63cbb302dad9f3e4b33713746 vp80-00-comprehensive-006-175x143-0039.i420 +d8f979aca1774470269283da048a505b vp80-00-comprehensive-006-175x143-0040.i420 +ecc06e2175290319cb36614370c8ad62 vp80-00-comprehensive-006-175x143-0041.i420 +5ba26b83766b666007b502a7194170e3 vp80-00-comprehensive-006-175x143-0042.i420 +8163a20e9a345b70579c625c50e7ec73 vp80-00-comprehensive-006-175x143-0043.i420 +1f1a497d768c4bcd57de11b21baf9138 vp80-00-comprehensive-006-175x143-0044.i420 +a21e9a52a982675815c9937b49ebb0ff vp80-00-comprehensive-006-175x143-0045.i420 +dcc0bd83ce31ac99577cd2f9ced69096 vp80-00-comprehensive-006-175x143-0046.i420 +df36b27588b8515580d5015e5f66dbf9 vp80-00-comprehensive-006-175x143-0047.i420 +156a6351549949953ce3197b990760a9 vp80-00-comprehensive-006-175x143-0048.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-007.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-007.ivf.md5 new file mode 100644 index 0000000..3a914af --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-007.ivf.md5 @@ -0,0 +1,29 @@ +98bd0af6928c144888a9c320270e9f0e vp80-00-comprehensive-007-176x144-0001.i420 +9ff7cff703d58481acd233451388377c vp80-00-comprehensive-007-176x144-0002.i420 +e4cd8815527846cc782ea61ef5a46e49 vp80-00-comprehensive-007-176x144-0003.i420 +db45275b87e194e5b505dd8c47da4f5d vp80-00-comprehensive-007-176x144-0004.i420 +c889d0f7bd34faf4df0e0a9eb9fc292a vp80-00-comprehensive-007-176x144-0005.i420 +4dbfb1727baf9b75980e7fdd44ca0924 vp80-00-comprehensive-007-176x144-0006.i420 +5f217ac95c891dc81f7193fc5352d582 vp80-00-comprehensive-007-176x144-0007.i420 +11166789635e472f629510f551b11e2c vp80-00-comprehensive-007-176x144-0008.i420 +336e6e42e67e1ccb7cda6298cb63f192 vp80-00-comprehensive-007-176x144-0009.i420 +02dbcff56882e304d5043d0f9b1ff9ff vp80-00-comprehensive-007-176x144-0010.i420 +fe033ea2c6b8b81a9328b470f8b0d6bb vp80-00-comprehensive-007-176x144-0011.i420 +0e3330fe9a7c0439ff53f18f0d15eb48 vp80-00-comprehensive-007-176x144-0012.i420 +6c0d7e042a3bb32a128c4a405f59b426 vp80-00-comprehensive-007-176x144-0013.i420 +7e51afc33dbf4b77fc5735f5d9ec0248 vp80-00-comprehensive-007-176x144-0014.i420 +a8381f193f34a5071b8eeba7f5cd1968 vp80-00-comprehensive-007-176x144-0015.i420 +501a7914b47ff85c24f0533ee98b9fe9 vp80-00-comprehensive-007-176x144-0016.i420 +00bd5fbb7e3b66514e6c77c3a5f118c3 vp80-00-comprehensive-007-176x144-0017.i420 +23e296d12a45909cadda252b9f4e67bd vp80-00-comprehensive-007-176x144-0018.i420 +fa0b5c69bacf766551bebdde0910eb9f vp80-00-comprehensive-007-176x144-0019.i420 +f5cc24d10d58ebc50503ca321db708cc vp80-00-comprehensive-007-176x144-0020.i420 +3997eb9ff6231dee9e23752776113cd6 vp80-00-comprehensive-007-176x144-0021.i420 +68d4c9cd494d91dd70e7a94c7a4b9a12 vp80-00-comprehensive-007-176x144-0022.i420 +647b34f3aa7318adce68803ba00104fb vp80-00-comprehensive-007-176x144-0023.i420 +ffed5301bd6fddd1d24d12e6096cc8a6 vp80-00-comprehensive-007-176x144-0024.i420 +9511388180811c10d166886868d6e71c vp80-00-comprehensive-007-176x144-0025.i420 +a9b330803b8ccd91596591c0449423ab vp80-00-comprehensive-007-176x144-0026.i420 +69b192888cda09dac658d5820183a2e8 vp80-00-comprehensive-007-176x144-0027.i420 +8886e5851e60a7474cc9e214ba6373ad vp80-00-comprehensive-007-176x144-0028.i420 +f59e354deedb129a90ab3922838b03d3 vp80-00-comprehensive-007-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-008.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-008.ivf.md5 new file mode 100644 index 0000000..d9ee105 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-008.ivf.md5 @@ -0,0 +1,2 @@ +7146d3a72b6cb8e43ee5280ef8d661fe vp80-00-comprehensive-008-1432x888-0001.i420 +5a537e9710158efb5ad2683a1d3b4c72 vp80-00-comprehensive-008-1432x888-0002.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-009.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-009.ivf.md5 new file mode 100644 index 0000000..fc6ef8c --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-009.ivf.md5 @@ -0,0 +1,49 @@ +b3a3121c796a60c88988fef5240a07fe vp80-00-comprehensive-009-176x144-0001.i420 +f25147764829cf837e00b8fd6383e2c4 vp80-00-comprehensive-009-176x144-0002.i420 +1b1552291a89c97d5deea145ab0ac0cd vp80-00-comprehensive-009-176x144-0003.i420 +0b2e75bbbe8f4248eb1519b6542efc96 vp80-00-comprehensive-009-176x144-0004.i420 +99e8fc68547e119253ee3b8d79efa774 vp80-00-comprehensive-009-176x144-0005.i420 +3aaf9210819238da7f704339bd8f262c vp80-00-comprehensive-009-176x144-0006.i420 +de80b11f4c325e6d467d4abe5ad0db51 vp80-00-comprehensive-009-176x144-0007.i420 +93d2fba68721768018b35ccac27b6bb1 vp80-00-comprehensive-009-176x144-0008.i420 +07d7d4f8ad4151a013b652bec21ea9b8 vp80-00-comprehensive-009-176x144-0009.i420 +aaa95e4d39aa31cf68fdb8da268827e5 vp80-00-comprehensive-009-176x144-0010.i420 +3607fcda0733e0b0fd10a8f7fbe6e39e vp80-00-comprehensive-009-176x144-0011.i420 +6d8cc24ea3b9827ef0147c8b7cc6938d vp80-00-comprehensive-009-176x144-0012.i420 +977a6b65d41b1b70dd4df9f526045675 vp80-00-comprehensive-009-176x144-0013.i420 +9258b0e5fc2217c3aebbd96bb06c937a vp80-00-comprehensive-009-176x144-0014.i420 +887378a3aad18346a3827cd0aadc6873 vp80-00-comprehensive-009-176x144-0015.i420 +c2a3ff302d74eefd0855f2c862766aca vp80-00-comprehensive-009-176x144-0016.i420 +1a7d835f5a977e1fd8cc37bdd8d029ca vp80-00-comprehensive-009-176x144-0017.i420 +232be1f7e334001c3abbed550cc60c34 vp80-00-comprehensive-009-176x144-0018.i420 +e8cb3470b9a3ffbc7014793514dc89cf vp80-00-comprehensive-009-176x144-0019.i420 +54b20adca41910f003790a975ff7b50d vp80-00-comprehensive-009-176x144-0020.i420 +2c5fce4dcdd538f1d9377fa071f3d615 vp80-00-comprehensive-009-176x144-0021.i420 +d559840da8cef1f0b1379a592f708f0a vp80-00-comprehensive-009-176x144-0022.i420 +ffab5f1060938a62cf8ef9df30ec8a33 vp80-00-comprehensive-009-176x144-0023.i420 +b7d93c8eda8cce4d387f2ea78c415704 vp80-00-comprehensive-009-176x144-0024.i420 +7840aa27333e6350d114b256ab4304f1 vp80-00-comprehensive-009-176x144-0025.i420 +dc1f3b125177d0ad7f53dd058bba03e7 vp80-00-comprehensive-009-176x144-0026.i420 +37134fcaad963a22f4df04c0765af455 vp80-00-comprehensive-009-176x144-0027.i420 +4dc062fb76943a75e7b2428e5babbb3c vp80-00-comprehensive-009-176x144-0028.i420 +dfda91bc05efc72073a2b6b62f294327 vp80-00-comprehensive-009-176x144-0029.i420 +7ffc690c63a1c54e35978336dc5828a3 vp80-00-comprehensive-009-176x144-0030.i420 +9ae31bacbc097c2ccf1500ff89882e46 vp80-00-comprehensive-009-176x144-0031.i420 +1450c24713dcad41aeba1c44007bf12f vp80-00-comprehensive-009-176x144-0032.i420 +f125bb52b8a1b11e076de55cca1069ee vp80-00-comprehensive-009-176x144-0033.i420 +555e1f2a6d293a0bdc9f92e9c3b3118d vp80-00-comprehensive-009-176x144-0034.i420 +ec9a8d577a07a4f0d5deae63b3cea6dd vp80-00-comprehensive-009-176x144-0035.i420 +a54f74e0ee329db4a78851bb7e54b2ba vp80-00-comprehensive-009-176x144-0036.i420 +99fcfe7ed9028bc443a790f9cf8eb812 vp80-00-comprehensive-009-176x144-0037.i420 +b9b994ffbe0150945b752a2120b4a475 vp80-00-comprehensive-009-176x144-0038.i420 +f00d70d8a28cecaaec1eb84592e3f6c3 vp80-00-comprehensive-009-176x144-0039.i420 +3bc8ed07fc92c4d339164891e6624306 vp80-00-comprehensive-009-176x144-0040.i420 +d755777560d745d6bdfa01b9e9cbbcc0 vp80-00-comprehensive-009-176x144-0041.i420 +bcefb5ef8fae173e413406b4a60e2255 vp80-00-comprehensive-009-176x144-0042.i420 +fb47098c334b82764e30819066b13096 vp80-00-comprehensive-009-176x144-0043.i420 +9e31f68fc96045bba43cf1253eedc419 vp80-00-comprehensive-009-176x144-0044.i420 +53522d46d2ba91ab23693db7d41ecda7 vp80-00-comprehensive-009-176x144-0045.i420 +d66a074ebe6123590622e5cb308d75e5 vp80-00-comprehensive-009-176x144-0046.i420 +6574fce175632a22fcc05b47157318e4 vp80-00-comprehensive-009-176x144-0047.i420 +31f7fb05d060c1dea46044787772baaf vp80-00-comprehensive-009-176x144-0048.i420 +cec733062ae526ae71b39ae0dc402482 vp80-00-comprehensive-009-176x144-0049.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-010.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-010.ivf.md5 new file mode 100644 index 0000000..93e4373 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-010.ivf.md5 @@ -0,0 +1,57 @@ +3441ec1a9b9d325c9aeda44e3b68377d vp80-00-comprehensive-010-320x240-0001.i420 +bff86a84fd673394f45c09d19a1ee0ac vp80-00-comprehensive-010-320x240-0002.i420 +8cd920f0de408e8cd883f9241680ff80 vp80-00-comprehensive-010-320x240-0003.i420 +d1b27cbb40859bbbb6da40dce6ddbf1b vp80-00-comprehensive-010-320x240-0004.i420 +ca102ed86e45fe452f55a2cf0253de21 vp80-00-comprehensive-010-320x240-0005.i420 +ac7630be64017becd6e958df360263b5 vp80-00-comprehensive-010-320x240-0006.i420 +a044041ede746687d33ba6342d8d3edb vp80-00-comprehensive-010-320x240-0007.i420 +75d7c0eec357afd0c2d54e769f551b20 vp80-00-comprehensive-010-320x240-0008.i420 +eebd916e4fba53a66fc8e6ab98091a0f vp80-00-comprehensive-010-320x240-0009.i420 +c0044160a944dcac81efe9f63def4bc2 vp80-00-comprehensive-010-320x240-0010.i420 +9ba8b2ccbea045b39bd150ea383abc00 vp80-00-comprehensive-010-320x240-0011.i420 +8d7654804fc62f7d52d5bf3d47f536e9 vp80-00-comprehensive-010-320x240-0012.i420 +9fd6cd81fbe6cfc43e03cdf166c7ea93 vp80-00-comprehensive-010-320x240-0013.i420 +a1a494064dba27238005227c0808c5f6 vp80-00-comprehensive-010-320x240-0014.i420 +b8dca72164ea72b3f257c97c3ad87416 vp80-00-comprehensive-010-320x240-0015.i420 +90ae005c0f3ddb4318318805b8fc29cf vp80-00-comprehensive-010-320x240-0016.i420 +8183e7b60f18887a9530a7905db4b417 vp80-00-comprehensive-010-320x240-0017.i420 +1650ad1fff9076141f59b660c562f0f2 vp80-00-comprehensive-010-320x240-0018.i420 +e9ee675cafd270c366ac9d3ced5af879 vp80-00-comprehensive-010-320x240-0019.i420 +2257172d6e8628b4dd4d9bf97e9ee2c3 vp80-00-comprehensive-010-320x240-0020.i420 +577438f88feca7a876381a6fcf094684 vp80-00-comprehensive-010-320x240-0021.i420 +4b37e90eb35cba66d31616169020c039 vp80-00-comprehensive-010-320x240-0022.i420 +2c631ab87b8d3b7df13f888e3d6f1690 vp80-00-comprehensive-010-320x240-0023.i420 +e0d46e04d6a57b20c2b056cd0a0ca1ec vp80-00-comprehensive-010-320x240-0024.i420 +65bd3e207b8ed966b71f40a04f1900b8 vp80-00-comprehensive-010-320x240-0025.i420 +fd842606a20fb297463b7b3dd6efa2c2 vp80-00-comprehensive-010-320x240-0026.i420 +778cd96eabe785320254db7692583f47 vp80-00-comprehensive-010-320x240-0027.i420 +094272ad385a64fbc70a62f958e27eff vp80-00-comprehensive-010-320x240-0028.i420 +cf5f7b3b94a00938b633ea1d9aa8e8dc vp80-00-comprehensive-010-320x240-0029.i420 +032e2f3649484ca17c739cf89052de77 vp80-00-comprehensive-010-320x240-0030.i420 +9afe92189c21675745609e3b21a75941 vp80-00-comprehensive-010-320x240-0031.i420 +a5e087c496798bfbc64d6c26eee0b3af vp80-00-comprehensive-010-320x240-0032.i420 +efb2716347ba2e01f7dc103d2a6cebb4 vp80-00-comprehensive-010-320x240-0033.i420 +c83541678dcca8937e372102bc4d1f68 vp80-00-comprehensive-010-320x240-0034.i420 +3401ed97a9296610c8473dcf03e13f20 vp80-00-comprehensive-010-320x240-0035.i420 +35af1327fafe026b6539951a9baee282 vp80-00-comprehensive-010-320x240-0036.i420 +f320e2d64192849c08c4c5e6d79e4ecf vp80-00-comprehensive-010-320x240-0037.i420 +5a661af83f451d8651cf081399d451b2 vp80-00-comprehensive-010-320x240-0038.i420 +625d271b60d91229699f1de35d232b13 vp80-00-comprehensive-010-320x240-0039.i420 +8e504154fa8eba5f9807bf40c647eea8 vp80-00-comprehensive-010-320x240-0040.i420 +094ecb39a65c71e85d15a587472bb336 vp80-00-comprehensive-010-320x240-0041.i420 +4d08bfe5771f00e13646be49e3471c4c vp80-00-comprehensive-010-320x240-0042.i420 +20841206e07721fb631088d492622543 vp80-00-comprehensive-010-320x240-0043.i420 +edf969142e1b053f951c1a5756f2b5d9 vp80-00-comprehensive-010-320x240-0044.i420 +4959a13f20311d9b435e501fd753c94b vp80-00-comprehensive-010-320x240-0045.i420 +a7f34e6c985d630af07a9f6dc47ea50e vp80-00-comprehensive-010-320x240-0046.i420 +96f6667d849f3abe4e85e3ce368b76ee vp80-00-comprehensive-010-320x240-0047.i420 +a47d443c8aa5f2d2e3b44deab3f4f8e7 vp80-00-comprehensive-010-320x240-0048.i420 +4ebda78d96facc4472ecdb4f667be0c6 vp80-00-comprehensive-010-320x240-0049.i420 +6ba744c47edab85c6e77584e35e1b735 vp80-00-comprehensive-010-320x240-0050.i420 +4d2e6882f15356171e4383111ec70e6e vp80-00-comprehensive-010-320x240-0051.i420 +85077fc81dff947b1251bfbd981aaf52 vp80-00-comprehensive-010-320x240-0052.i420 +f03e8879a5218387c502eaab31682df9 vp80-00-comprehensive-010-320x240-0053.i420 +90f6128298cb52f769d697f9f842df27 vp80-00-comprehensive-010-320x240-0054.i420 +700a705680c1a940141bc03ae5de391b vp80-00-comprehensive-010-320x240-0055.i420 +049b3df3ed9673ab8e0f0d0d896f65c2 vp80-00-comprehensive-010-320x240-0056.i420 +ca8c3e5509211dc92078371f06dc8635 vp80-00-comprehensive-010-320x240-0057.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-011.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-011.ivf.md5 new file mode 100644 index 0000000..3c048d2 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-011.ivf.md5 @@ -0,0 +1,29 @@ +83c78b5db579710f61f9354d5c51e8c8 vp80-00-comprehensive-011-176x144-0001.i420 +9b755a63c7c5352660a265f6e24991e1 vp80-00-comprehensive-011-176x144-0002.i420 +a591f0b04447d6d6dd9bb990502594aa vp80-00-comprehensive-011-176x144-0003.i420 +6ebbd38d20a4104a842c66df53a8b86e vp80-00-comprehensive-011-176x144-0004.i420 +a114c37e74a4252ed66c5c4e7c8df84b vp80-00-comprehensive-011-176x144-0005.i420 +4bad182348dcfb627b3e15bc228a3c8f vp80-00-comprehensive-011-176x144-0006.i420 +a843b5c80266f890044a4ba1f59de8ed vp80-00-comprehensive-011-176x144-0007.i420 +34816d9129f252afcbd56d6ad1df94c7 vp80-00-comprehensive-011-176x144-0008.i420 +7d7d46cd08e18aea6fc52c0ec58a4803 vp80-00-comprehensive-011-176x144-0009.i420 +c96c3357d89534fce32251a0d52c68c5 vp80-00-comprehensive-011-176x144-0010.i420 +5eb1329f955ab80696d8220605a51552 vp80-00-comprehensive-011-176x144-0011.i420 +68b3d5162cd5b004a6dfeac705c75afa vp80-00-comprehensive-011-176x144-0012.i420 +b79647c678fbbb9ffbd8c4ff63c05e43 vp80-00-comprehensive-011-176x144-0013.i420 +4566eb5f995852d72b6913d2ca2e321c vp80-00-comprehensive-011-176x144-0014.i420 +02e7e951ac9e42eafb1260defaecf685 vp80-00-comprehensive-011-176x144-0015.i420 +ddbfa0f81a009c41271c9aa587e88baa vp80-00-comprehensive-011-176x144-0016.i420 +27d31dba74cb2170c456830a9f888c0b vp80-00-comprehensive-011-176x144-0017.i420 +0537650a41bb087a5fd33d6347fe9036 vp80-00-comprehensive-011-176x144-0018.i420 +df2205297d4f00164a3440c8fa1ac4ee vp80-00-comprehensive-011-176x144-0019.i420 +9942b757bd3839c1cd6b1068c68967f2 vp80-00-comprehensive-011-176x144-0020.i420 +d9284e1e989cd38d0226b1a3c6e89409 vp80-00-comprehensive-011-176x144-0021.i420 +12427a3fdc22461fe9d6ff9dd5863bef vp80-00-comprehensive-011-176x144-0022.i420 +63f75f2a63630347671c0e6dd2f88bcb vp80-00-comprehensive-011-176x144-0023.i420 +b161169a678e3959b492d83a03d47dee vp80-00-comprehensive-011-176x144-0024.i420 +50a6d4c8722197f0abd1028b968dce58 vp80-00-comprehensive-011-176x144-0025.i420 +c0f81ef6b25034cff00db1e3c369be97 vp80-00-comprehensive-011-176x144-0026.i420 +01b502a4b69d5be7a82f292e735aa087 vp80-00-comprehensive-011-176x144-0027.i420 +6bbff03307f93a654e4529e2a5092887 vp80-00-comprehensive-011-176x144-0028.i420 +17ef5fd4bd1cc6030e1370a43f1d19bf vp80-00-comprehensive-011-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-012.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-012.ivf.md5 new file mode 100644 index 0000000..2e726a5 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-012.ivf.md5 @@ -0,0 +1,29 @@ +cc3069a59b6f4319761af2b39923a6e5 vp80-00-comprehensive-012-176x144-0001.i420 +c0bc935941d994c6af6a864f02a90a62 vp80-00-comprehensive-012-176x144-0002.i420 +5b6073ce4a03967aa87e56dfa27e32c2 vp80-00-comprehensive-012-176x144-0003.i420 +5310a9d6bf938ed89b10727f11e131c4 vp80-00-comprehensive-012-176x144-0004.i420 +290fb1310ea10b862b51d37ff9d79f7c vp80-00-comprehensive-012-176x144-0005.i420 +0ca1accba77dc867df682b8e3768d6e2 vp80-00-comprehensive-012-176x144-0006.i420 +2a90659dd4cd5d2f825641be55609d97 vp80-00-comprehensive-012-176x144-0007.i420 +e003db31fbfeab54385252e8c64197fc vp80-00-comprehensive-012-176x144-0008.i420 +0778609bd9626652e8a8dd07d5ef9f45 vp80-00-comprehensive-012-176x144-0009.i420 +36eecf49c4aa2d8c3f232a1dbbb5f4ca vp80-00-comprehensive-012-176x144-0010.i420 +f69f30dd8ebb7db4c51e0371f6a23736 vp80-00-comprehensive-012-176x144-0011.i420 +e9d5293db5122b9683a0853c2ef678cb vp80-00-comprehensive-012-176x144-0012.i420 +75d6a09bca67a82c8aacabb710558330 vp80-00-comprehensive-012-176x144-0013.i420 +973d73aa4bb4e3de2cb1ba97685e08ca vp80-00-comprehensive-012-176x144-0014.i420 +daf9ce67baaaa02bc56f49b540f22a30 vp80-00-comprehensive-012-176x144-0015.i420 +d08fd3b942e1219132015819c553f2c2 vp80-00-comprehensive-012-176x144-0016.i420 +0aeea73b030e47bbd80bb0fb33fb6ebd vp80-00-comprehensive-012-176x144-0017.i420 +6e9f5f98fffe27abfae52304c693ae44 vp80-00-comprehensive-012-176x144-0018.i420 +961c71a47741a1ac47fcaebf958647c8 vp80-00-comprehensive-012-176x144-0019.i420 +e75e53160b9f33eca0dfba999d8002eb vp80-00-comprehensive-012-176x144-0020.i420 +ebb5d79336f75c44a09971dbba6947f3 vp80-00-comprehensive-012-176x144-0021.i420 +f02317fae5e143103a114ca692b58c25 vp80-00-comprehensive-012-176x144-0022.i420 +8282867aa63fa23c48cc0216e21933cc vp80-00-comprehensive-012-176x144-0023.i420 +d0d74ebbf56ca62825641028b66cdb20 vp80-00-comprehensive-012-176x144-0024.i420 +a8df24b0a22fe4fb334ea7063cba8754 vp80-00-comprehensive-012-176x144-0025.i420 +8a570e42ad6ab42ead80b5022c2eb2f1 vp80-00-comprehensive-012-176x144-0026.i420 +dae566f13fa69de11db3ba7673e6211d vp80-00-comprehensive-012-176x144-0027.i420 +914ed8403cdbf4c54d0b9cb1eeee6832 vp80-00-comprehensive-012-176x144-0028.i420 +18aa8d4bfe06a04ec4e9ccf9c7a92643 vp80-00-comprehensive-012-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-013.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-013.ivf.md5 new file mode 100644 index 0000000..b3ee5eb --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-013.ivf.md5 @@ -0,0 +1,29 @@ +ad137b9eae93daed28fe31fd5165b4d0 vp80-00-comprehensive-013-176x144-0001.i420 +7cd527f647680c0eb305050d27fb8092 vp80-00-comprehensive-013-176x144-0002.i420 +f306e07a2e86c82a8cc1333be3812326 vp80-00-comprehensive-013-176x144-0003.i420 +4ffd6065ef6af716fdb7388479cf300e vp80-00-comprehensive-013-176x144-0004.i420 +e776c698ae335107d5794c02cf00d3ee vp80-00-comprehensive-013-176x144-0005.i420 +c0043e3283b96a4aa58d2265b007e67e vp80-00-comprehensive-013-176x144-0006.i420 +235dd358e6adb3e144d7d957458e74a0 vp80-00-comprehensive-013-176x144-0007.i420 +4d34b966a406e7c2d5cef029ddc76021 vp80-00-comprehensive-013-176x144-0008.i420 +65f9eb823a63e17710b111892c415b70 vp80-00-comprehensive-013-176x144-0009.i420 +84d4a1d510d1c1aa8f3e7232d574ba9d vp80-00-comprehensive-013-176x144-0010.i420 +f3218df364f0e283df56b5d4a9cdfca9 vp80-00-comprehensive-013-176x144-0011.i420 +3079d93a140b51fe3e7b4889fd5fdd24 vp80-00-comprehensive-013-176x144-0012.i420 +4b76d7f904960792b78378c95453b77a vp80-00-comprehensive-013-176x144-0013.i420 +26cdd39f9cd862b383352bf769d212a0 vp80-00-comprehensive-013-176x144-0014.i420 +d98dbe7d7b8a5ccc50cb3a2e3dcacec8 vp80-00-comprehensive-013-176x144-0015.i420 +a931f142064062d7d2d1245278c6edd9 vp80-00-comprehensive-013-176x144-0016.i420 +0c6dae06c59c040801be386d7e883f52 vp80-00-comprehensive-013-176x144-0017.i420 +cec4a68182fb14185360f57de81e73cb vp80-00-comprehensive-013-176x144-0018.i420 +7e819d1d928f974f25d45023a89a6765 vp80-00-comprehensive-013-176x144-0019.i420 +6d9a9fd28212940497f881ef4886d756 vp80-00-comprehensive-013-176x144-0020.i420 +f22969fc06edc0c9190cae8bb22243ae vp80-00-comprehensive-013-176x144-0021.i420 +2fcd676dbf66f842e91649a3d6c80f50 vp80-00-comprehensive-013-176x144-0022.i420 +ce16e8920e91ec208dfb241addfc612b vp80-00-comprehensive-013-176x144-0023.i420 +3a205f364751ff5e72d7da20e5713f53 vp80-00-comprehensive-013-176x144-0024.i420 +2305bcde500197d7697eec4ba89f1533 vp80-00-comprehensive-013-176x144-0025.i420 +23712ae207ea2381f886ed038ec3852b vp80-00-comprehensive-013-176x144-0026.i420 +7197e717541573be07f9cda50ba524a9 vp80-00-comprehensive-013-176x144-0027.i420 +3f3e3ec6d1d6f49021affbadb75c1fda vp80-00-comprehensive-013-176x144-0028.i420 +424fe8391a419b005a6f142ec65d802b vp80-00-comprehensive-013-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-014.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-014.ivf.md5 new file mode 100644 index 0000000..91fe9b6 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-014.ivf.md5 @@ -0,0 +1,49 @@ +7a0356dc950e79744d79c98e391ebee9 vp80-00-comprehensive-014-175x143-0001.i420 +96e221e75c290dd847b8e55865073366 vp80-00-comprehensive-014-175x143-0002.i420 +67638290841837c90f180a01094f9191 vp80-00-comprehensive-014-175x143-0003.i420 +93c8e234e123f7a641c5eb44903b75ab vp80-00-comprehensive-014-175x143-0004.i420 +b4fa5ce6089221863002019d99ae7f9d vp80-00-comprehensive-014-175x143-0005.i420 +5d3b48fbb681ef2b6a0a5e60c03ee5bd vp80-00-comprehensive-014-175x143-0006.i420 +26635956a9ed343428b36947723b4b94 vp80-00-comprehensive-014-175x143-0007.i420 +18e9b11e10350ab20b89482c5d1c5cea vp80-00-comprehensive-014-175x143-0008.i420 +44fe40a7ce85552ccf95a451c5732e57 vp80-00-comprehensive-014-175x143-0009.i420 +f38758bf6d522023961d08719e92d3ce vp80-00-comprehensive-014-175x143-0010.i420 +28a2a9ebb3633a0822c9a283ab1ddea6 vp80-00-comprehensive-014-175x143-0011.i420 +4b4485c9419710ad6d3e6aa11fe3a91b vp80-00-comprehensive-014-175x143-0012.i420 +e3f6850a934c6e3e2fed3026e1e53066 vp80-00-comprehensive-014-175x143-0013.i420 +4acff1abe788a4944474b82d10af172d vp80-00-comprehensive-014-175x143-0014.i420 +4cbfcc008923e8303df170d4e7b1cf34 vp80-00-comprehensive-014-175x143-0015.i420 +dde5de0c676f60b4cea26bbf024bbfb7 vp80-00-comprehensive-014-175x143-0016.i420 +fe1b0890eef18cd4989d251dbc3b7ef2 vp80-00-comprehensive-014-175x143-0017.i420 +462303741de9904a13bd46534010f588 vp80-00-comprehensive-014-175x143-0018.i420 +7ab2068505dbccdf522a08a65373b6b6 vp80-00-comprehensive-014-175x143-0019.i420 +cb63092b6880bbdbaa40b40d738aa4dd vp80-00-comprehensive-014-175x143-0020.i420 +dca7556869370de600afbda82bb45fae vp80-00-comprehensive-014-175x143-0021.i420 +5f5cae9db9e3aa3f300706ebc3874987 vp80-00-comprehensive-014-175x143-0022.i420 +eaf7ba4f48eb5722c09420f2be4bc5f3 vp80-00-comprehensive-014-175x143-0023.i420 +dd5b43b72c8b9c3ad53afef0f8869a68 vp80-00-comprehensive-014-175x143-0024.i420 +f5d81cadb4b1f69e9700293e38ea36a2 vp80-00-comprehensive-014-175x143-0025.i420 +1e56a6becf3099db71fbc7a996c4fbba vp80-00-comprehensive-014-175x143-0026.i420 +7e0676c4af74b59d9560d8b42d400de2 vp80-00-comprehensive-014-175x143-0027.i420 +6717c3c344b45e9e202e808d19c9baa8 vp80-00-comprehensive-014-175x143-0028.i420 +42b92f6fbd4cc5d4cf4f9b364a8a7741 vp80-00-comprehensive-014-175x143-0029.i420 +6caca9fcc03e8b9d326aec18eaaae928 vp80-00-comprehensive-014-175x143-0030.i420 +cfa2798d156cabe81160c00939102d90 vp80-00-comprehensive-014-175x143-0031.i420 +5d018cfac7da660819da2e5d25e8126e vp80-00-comprehensive-014-175x143-0032.i420 +761b7b2b64b22abadb89c58ab294520b vp80-00-comprehensive-014-175x143-0033.i420 +4e066fa627d4dbf3635148eb6b2a0477 vp80-00-comprehensive-014-175x143-0034.i420 +e0d6dd242cb99c7bc9826a05895344c5 vp80-00-comprehensive-014-175x143-0035.i420 +84e7beedcba6da53feb722f30211d2f8 vp80-00-comprehensive-014-175x143-0036.i420 +af49b3fcc56b02ca746792b1d3bbe1c8 vp80-00-comprehensive-014-175x143-0037.i420 +cdd9f17b4501bc7f7bedb70f2e33f282 vp80-00-comprehensive-014-175x143-0038.i420 +69d853dfd9b09d299faec521acb4e765 vp80-00-comprehensive-014-175x143-0039.i420 +c3497292359c1a1de81cd5fb062e5175 vp80-00-comprehensive-014-175x143-0040.i420 +0e3994e4a62d8c922dbde51186615ea7 vp80-00-comprehensive-014-175x143-0041.i420 +86bc5561c72bd17e7473f54f6b6311f1 vp80-00-comprehensive-014-175x143-0042.i420 +0c747481e3dc575c6aad4507f8e62d8e vp80-00-comprehensive-014-175x143-0043.i420 +6779dfe5b6a7d4ba5ae5355058f54bc9 vp80-00-comprehensive-014-175x143-0044.i420 +d7d4e85f48d38c1106a031bd9b57d909 vp80-00-comprehensive-014-175x143-0045.i420 +a0ab20a38891925fd77ac2b075f0046f vp80-00-comprehensive-014-175x143-0046.i420 +88655045ce8c5cb4c4aa3a5071f1beba vp80-00-comprehensive-014-175x143-0047.i420 +7e849d493185a8f782b53a71151bae26 vp80-00-comprehensive-014-175x143-0048.i420 +a5b9a0cbfac73d2227118c0718cf9d14 vp80-00-comprehensive-014-175x143-0049.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-015.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-015.ivf.md5 new file mode 100644 index 0000000..9a22a01 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-015.ivf.md5 @@ -0,0 +1,260 @@ +6b4c7cc0c6a7218362e43cffef6618c9 vp80-00-comprehensive-015-320x240-0001.i420 +e132a7b1bb4fb15b1019092aedc0e599 vp80-00-comprehensive-015-320x240-0002.i420 +b36975db60f24088d95385ff7e8b7b8a vp80-00-comprehensive-015-320x240-0003.i420 +4ae6a13ae0435afb2eac66f15a07b143 vp80-00-comprehensive-015-320x240-0004.i420 +d1de33515e29053171c9fbe969a33fa1 vp80-00-comprehensive-015-320x240-0005.i420 +cf01450481865c10765995a3b92b440f vp80-00-comprehensive-015-320x240-0006.i420 +274461d33aeab30885b23bf2818ad150 vp80-00-comprehensive-015-320x240-0007.i420 +cb434c5a829b3d6d15a6e76f05abd51f vp80-00-comprehensive-015-320x240-0008.i420 +512019fa16b1cd6bf308c91d6577cf2a vp80-00-comprehensive-015-320x240-0009.i420 +2d1174741c144b2162806373d0092739 vp80-00-comprehensive-015-320x240-0010.i420 +8ec38a17566342a35598bd5ab6d290d5 vp80-00-comprehensive-015-320x240-0011.i420 +262b71c9874cc7a5138b12b294575572 vp80-00-comprehensive-015-320x240-0012.i420 +bfe5e37095dc450dc717fda5ef77b6fe vp80-00-comprehensive-015-320x240-0013.i420 +7fbcdb00872206a597bb69ebe9221b03 vp80-00-comprehensive-015-320x240-0014.i420 +b599ac8568b6780dec25de4211e071ef vp80-00-comprehensive-015-320x240-0015.i420 +797085b07f4c1e4f4b0116d329403cf8 vp80-00-comprehensive-015-320x240-0016.i420 +a0d0821365658bee14767698877cc066 vp80-00-comprehensive-015-320x240-0017.i420 +286a917e787d474eb78b4797a0909a5e vp80-00-comprehensive-015-320x240-0018.i420 +3548a320f6954c40a00ddf2e4ee212bd vp80-00-comprehensive-015-320x240-0019.i420 +80af737ca733afa28fdae06421b3cf8d vp80-00-comprehensive-015-320x240-0020.i420 +f31a2b62cb69bc680b314a033f91881b vp80-00-comprehensive-015-320x240-0021.i420 +02e4a780b3a0d83a8897988ef17b548c vp80-00-comprehensive-015-320x240-0022.i420 +844929e7492b389fc520c5f75d37aa77 vp80-00-comprehensive-015-320x240-0023.i420 +558ac4c1c11da425baf832a73e1ac2da vp80-00-comprehensive-015-320x240-0024.i420 +41b21109a7aa5f163ac0967ecd11f792 vp80-00-comprehensive-015-320x240-0025.i420 +a2a050c04eaa97db43a5a0a96d20a143 vp80-00-comprehensive-015-320x240-0026.i420 +18d1881d44ab9dc959c34d92c0cabd36 vp80-00-comprehensive-015-320x240-0027.i420 +53618af318cd187b4fcd5a3c22d3ab79 vp80-00-comprehensive-015-320x240-0028.i420 +8028e6a6a6dadc8331e39cff1ba2b899 vp80-00-comprehensive-015-320x240-0029.i420 +2c32a58d68595ff4100cec4fc1637c55 vp80-00-comprehensive-015-320x240-0030.i420 +8ecc02d32f36edd167cabe2a7bc66683 vp80-00-comprehensive-015-320x240-0031.i420 +7caa9ce69ac9f71170a69fbcef4c4b34 vp80-00-comprehensive-015-320x240-0032.i420 +df06a6a8a81979c39f2c3546eb03a3c2 vp80-00-comprehensive-015-320x240-0033.i420 +2bfd578fa08335e975d498e11eadc8bc vp80-00-comprehensive-015-320x240-0034.i420 +0d78c5656d56e423ff31cab09855a335 vp80-00-comprehensive-015-320x240-0035.i420 +7152d9e35748a7ec2e8da37f0b943325 vp80-00-comprehensive-015-320x240-0036.i420 +eb9e0e5cba76f0819da6256136ffd4e3 vp80-00-comprehensive-015-320x240-0037.i420 +c4e5ef875132c06a80f0afb3ee894684 vp80-00-comprehensive-015-320x240-0038.i420 +d2feb49297dd2f0a532479341d607e64 vp80-00-comprehensive-015-320x240-0039.i420 +d092d165608f405161fbf73a19df26ca vp80-00-comprehensive-015-320x240-0040.i420 +cb228940384c3021af42b0ab81c65d7a vp80-00-comprehensive-015-320x240-0041.i420 +426decfbf29a025a7a5e376951c34b83 vp80-00-comprehensive-015-320x240-0042.i420 +42c25e24bfd048bde0f9105d934cb81e vp80-00-comprehensive-015-320x240-0043.i420 +4bf37f8ccb2c4f42fa64a52a4699883f vp80-00-comprehensive-015-320x240-0044.i420 +5a00d85407910d4170d11511f03cc3a7 vp80-00-comprehensive-015-320x240-0045.i420 +032072b8713a2cd7434b5be706a8667d vp80-00-comprehensive-015-320x240-0046.i420 +e729c561b318aa14d7dbf96299c4675d vp80-00-comprehensive-015-320x240-0047.i420 +e7e1d71c1c59bb759c89f15c6e8970f0 vp80-00-comprehensive-015-320x240-0048.i420 +9c04011f4d92257a6dc112c5acad0f59 vp80-00-comprehensive-015-320x240-0049.i420 +ca7c7cbf52dd7af9a62212f3a9bd1f74 vp80-00-comprehensive-015-320x240-0050.i420 +3cc9c4d3857d692e0dbfee682d63d32c vp80-00-comprehensive-015-320x240-0051.i420 +1188fc9620cf0d23af21d8823c127b80 vp80-00-comprehensive-015-320x240-0052.i420 +c614690b8d4d3bea47f1b236ff32d1d8 vp80-00-comprehensive-015-320x240-0053.i420 +d6ccde3360e6a05b61013e85f96de9e9 vp80-00-comprehensive-015-320x240-0054.i420 +7f11cacc42d14121aeab487975ec190b vp80-00-comprehensive-015-320x240-0055.i420 +cdd8b538ff107f88c5f0dc7128bc331e vp80-00-comprehensive-015-320x240-0056.i420 +f43a387e9bb2f4db387d3f44da16457b vp80-00-comprehensive-015-320x240-0057.i420 +b7ba01b86fce2252105f99848e2ac95c vp80-00-comprehensive-015-320x240-0058.i420 +094200f775b6ced838d0c37e0d0b34e6 vp80-00-comprehensive-015-320x240-0059.i420 +b2d2fa96666b96b7cb624133cf404b09 vp80-00-comprehensive-015-320x240-0060.i420 +d935644161a2b06f0efc75dc6d0fcf46 vp80-00-comprehensive-015-320x240-0061.i420 +2a3be6460f313d7fdd6f6f9c70092a50 vp80-00-comprehensive-015-320x240-0062.i420 +f8254b6469b807ce0e9a1ea4b98a59db vp80-00-comprehensive-015-320x240-0063.i420 +43639a3293ec640b203e0c8a97e6f45e vp80-00-comprehensive-015-320x240-0064.i420 +055762cccc279c8dd27450ec1d512d5f vp80-00-comprehensive-015-320x240-0065.i420 +a90dac910f3cdd216293bebc46b36501 vp80-00-comprehensive-015-320x240-0066.i420 +3531ef2a4a59271f89ca0972b65d06aa vp80-00-comprehensive-015-320x240-0067.i420 +1f87adde14795639105be714247d0bd0 vp80-00-comprehensive-015-320x240-0068.i420 +e991cdd7912266937ca6f0d59199645b vp80-00-comprehensive-015-320x240-0069.i420 +5b98019db0fca644da5ee73e0160c7c5 vp80-00-comprehensive-015-320x240-0070.i420 +6276f3907e4bb87885d21e11150d044d vp80-00-comprehensive-015-320x240-0071.i420 +985785d7a788dcc07bd5fb72d3dc758e vp80-00-comprehensive-015-320x240-0072.i420 +3379548a573d068d47d5f54aaf79c8a9 vp80-00-comprehensive-015-320x240-0073.i420 +a2b36848e7d19383cfabf8bdcabd241a vp80-00-comprehensive-015-320x240-0074.i420 +0aeda76888a5a2426ae3b390e38aba52 vp80-00-comprehensive-015-320x240-0075.i420 +2c652e7850ccc10cbc7a3266f1fb6c00 vp80-00-comprehensive-015-320x240-0076.i420 +5dfc9e4dce69f1f644fad5b69c0b4008 vp80-00-comprehensive-015-320x240-0077.i420 +da775fc1469012a0c717ebe5dc940e26 vp80-00-comprehensive-015-320x240-0078.i420 +6185a863f7d023ddb2b049e265aab1bb vp80-00-comprehensive-015-320x240-0079.i420 +7a56397397191ab1b7c93a4bdc9b57c1 vp80-00-comprehensive-015-320x240-0080.i420 +3e95a3f2c2660dc28ec64efef29615f0 vp80-00-comprehensive-015-320x240-0081.i420 +b9ba03bd7c09224174368a60af389b9c vp80-00-comprehensive-015-320x240-0082.i420 +bfd23a13e077843506a01e44adb27c04 vp80-00-comprehensive-015-320x240-0083.i420 +9025dff58a57abcc25da69fd233e312a vp80-00-comprehensive-015-320x240-0084.i420 +ba4b91b0fe4d36f77b62ec3fe7b10a96 vp80-00-comprehensive-015-320x240-0085.i420 +7955419ff2bc42b703dfc976576a5bd4 vp80-00-comprehensive-015-320x240-0086.i420 +36d6a723ebb35c45128bfa8a7bba0d49 vp80-00-comprehensive-015-320x240-0087.i420 +77503cc79e3cb0fc74745bac967fee1d vp80-00-comprehensive-015-320x240-0088.i420 +a05af40cb4fc009fe94be6dbf148b453 vp80-00-comprehensive-015-320x240-0089.i420 +35bc39585679f7c07f1b196879719ce6 vp80-00-comprehensive-015-320x240-0090.i420 +48831c2e2212134ab192a123e847c157 vp80-00-comprehensive-015-320x240-0091.i420 +c09c37f9fd929185452a8beb3c61b839 vp80-00-comprehensive-015-320x240-0092.i420 +c534a38d586f3cac998240a7013c636c vp80-00-comprehensive-015-320x240-0093.i420 +b598c6999442cf0c53ed6a19d1215eb8 vp80-00-comprehensive-015-320x240-0094.i420 +c639685c8f4af3d006df1833950943aa vp80-00-comprehensive-015-320x240-0095.i420 +351e1c089ba5b9024de6e311c4a4afd3 vp80-00-comprehensive-015-320x240-0096.i420 +67d8ea902179548d0b01544249b2411f vp80-00-comprehensive-015-320x240-0097.i420 +3717ddf0edbb2020a5b974678d358d25 vp80-00-comprehensive-015-320x240-0098.i420 +85f7c6861241e3f43fc63c397c8c3c37 vp80-00-comprehensive-015-320x240-0099.i420 +c5b23b4d3d141d8cfbc5354ca1cfd34d vp80-00-comprehensive-015-320x240-0100.i420 +c2e42fa6b11cdc3abcf3ee0c3f75a459 vp80-00-comprehensive-015-320x240-0101.i420 +34df411aa928d5df3628644d9a38c768 vp80-00-comprehensive-015-320x240-0102.i420 +a768b448b6c894d9b927bc880249079a vp80-00-comprehensive-015-320x240-0103.i420 +a2e9ad0d0ad733b8ccacf0379b05f6f9 vp80-00-comprehensive-015-320x240-0104.i420 +4b485e9496ab4d417b8cffaf8754f5cb vp80-00-comprehensive-015-320x240-0105.i420 +47007fabfacd9e9c5a3997fb70d45895 vp80-00-comprehensive-015-320x240-0106.i420 +4962433241c7509801b46bea70f38269 vp80-00-comprehensive-015-320x240-0107.i420 +7b4593b45606650e78aec67722cfc2bf vp80-00-comprehensive-015-320x240-0108.i420 +882bcbf7d2c12e93df2fbebc6ac19dd8 vp80-00-comprehensive-015-320x240-0109.i420 +a2998a9c648817236bfffdae454f9fa1 vp80-00-comprehensive-015-320x240-0110.i420 +56775760fa99e9a9b7293ddc78a44ece vp80-00-comprehensive-015-320x240-0111.i420 +bb245d095424c28dd2ace22a5a511d6a vp80-00-comprehensive-015-320x240-0112.i420 +598c54d2b207190ed549dec7390a4190 vp80-00-comprehensive-015-320x240-0113.i420 +c73f16b2709527fce3d725ade5aab2fc vp80-00-comprehensive-015-320x240-0114.i420 +32dcad6eb17bee583884029fe18c07a7 vp80-00-comprehensive-015-320x240-0115.i420 +a1297c404a0d22e0e8e1e4ef67696606 vp80-00-comprehensive-015-320x240-0116.i420 +2fef1ac7becf9b8c9f3ac2310f444e3b vp80-00-comprehensive-015-320x240-0117.i420 +0f03614ed3daec6c37c5b564ad24f595 vp80-00-comprehensive-015-320x240-0118.i420 +9b175a6353ec377da408b0cf03388081 vp80-00-comprehensive-015-320x240-0119.i420 +37b991b4a216a4847d0768a3b878284a vp80-00-comprehensive-015-320x240-0120.i420 +faafcd544080a6a4f87a0d0a393ba37b vp80-00-comprehensive-015-320x240-0121.i420 +43ede087f37c1b0392829bbc668242fc vp80-00-comprehensive-015-320x240-0122.i420 +b7ed1274016c4d1810d8999d495b7370 vp80-00-comprehensive-015-320x240-0123.i420 +22af7bfc83c6e1f2eff2ae26e115b446 vp80-00-comprehensive-015-320x240-0124.i420 +969b22455f3be057036ddd5a329b1de3 vp80-00-comprehensive-015-320x240-0125.i420 +63c24b8a3d6c3a4c2fd47c48860abff9 vp80-00-comprehensive-015-320x240-0126.i420 +b407ddc89c538d7b6fb70e48493f872c vp80-00-comprehensive-015-320x240-0127.i420 +5de69fb9e1cd425cd3931116803f5391 vp80-00-comprehensive-015-320x240-0128.i420 +07fc7a5cb360edae97db999c2a8d2716 vp80-00-comprehensive-015-320x240-0129.i420 +602a17c58cac811e6e71e33448931ce5 vp80-00-comprehensive-015-320x240-0130.i420 +44087725484198c8e846d112583e574b vp80-00-comprehensive-015-320x240-0131.i420 +0d81da0d23d196ff972894878bd17b73 vp80-00-comprehensive-015-320x240-0132.i420 +b3cd65f1bd2274895e54da99bb4c4f07 vp80-00-comprehensive-015-320x240-0133.i420 +ae8ca35672d8352af49f37f5174c8fbd vp80-00-comprehensive-015-320x240-0134.i420 +9eea1ff900cf680e8208cd5d07a4d284 vp80-00-comprehensive-015-320x240-0135.i420 +5a47f272dfda3fe61955875f761a71f2 vp80-00-comprehensive-015-320x240-0136.i420 +544558333008db01451c886ac0b62c47 vp80-00-comprehensive-015-320x240-0137.i420 +5f8e4f3b11d7f5a28ff5cd9f3a6853bb vp80-00-comprehensive-015-320x240-0138.i420 +e9bc3da7060457f2d52a5bf6fe3bb515 vp80-00-comprehensive-015-320x240-0139.i420 +6aea6851a092260ae6594c6d9170ea8e vp80-00-comprehensive-015-320x240-0140.i420 +38e7fa5bea809a984a5f810940ca0e49 vp80-00-comprehensive-015-320x240-0141.i420 +9e8a23ac9067a1acf8472d7aa3b9811e vp80-00-comprehensive-015-320x240-0142.i420 +6f25f5873afd5c341ca6b3eb284be809 vp80-00-comprehensive-015-320x240-0143.i420 +40c3240e6cde94aae793a52cb46487da vp80-00-comprehensive-015-320x240-0144.i420 +b7f1f13842fbf0c6e085280eb89b956f vp80-00-comprehensive-015-320x240-0145.i420 +1f059372d8bf4dadf78d8e215bbf9786 vp80-00-comprehensive-015-320x240-0146.i420 +50c1d6b76930e765bff5ecbaaae686fe vp80-00-comprehensive-015-320x240-0147.i420 +5bd8cb05ebc034192e08ca8ce18a7964 vp80-00-comprehensive-015-320x240-0148.i420 +ffc0c20b07e26857dc4f2c079a2ad675 vp80-00-comprehensive-015-320x240-0149.i420 +5dafb6ac0953c254182dba124e213c07 vp80-00-comprehensive-015-320x240-0150.i420 +c774ed25712a38603fe2e224802768cb vp80-00-comprehensive-015-320x240-0151.i420 +de549cc803a6138d483be15b28ef2286 vp80-00-comprehensive-015-320x240-0152.i420 +c963d9bc79c1dd2a47f7f8424c56239e vp80-00-comprehensive-015-320x240-0153.i420 +9df993e0bef1bedbce1a6b596f2c64f4 vp80-00-comprehensive-015-320x240-0154.i420 +875792bde0f45358009b506840be68e1 vp80-00-comprehensive-015-320x240-0155.i420 +7f8c57083d2df08db6287cb025260788 vp80-00-comprehensive-015-320x240-0156.i420 +47eb13bc0942b5cafeea324fc5bf5cd5 vp80-00-comprehensive-015-320x240-0157.i420 +d89129c7528ff7372f23d1191c75e336 vp80-00-comprehensive-015-320x240-0158.i420 +bdd14e38b00075d8da485d1517dbbd65 vp80-00-comprehensive-015-320x240-0159.i420 +0e8e21a50a5dd1ac6fc881ad38ec38bd vp80-00-comprehensive-015-320x240-0160.i420 +a0fce98c23a053b4073715c554b9dc44 vp80-00-comprehensive-015-320x240-0161.i420 +18bda80360c72d04c60016682b1f6c8d vp80-00-comprehensive-015-320x240-0162.i420 +306d7556c18dcf58c8183959d1c34c2a vp80-00-comprehensive-015-320x240-0163.i420 +7ada9d23b96ef41322497d1077b00c4d vp80-00-comprehensive-015-320x240-0164.i420 +d7df0508be4bd0c3e83f346f0b9a1868 vp80-00-comprehensive-015-320x240-0165.i420 +749725f425f6fd4a79269bca900d09ae vp80-00-comprehensive-015-320x240-0166.i420 +ed30973158a576e2919e2fcfd00987fc vp80-00-comprehensive-015-320x240-0167.i420 +2486d8b742ccc50cf8683af7f4502aec vp80-00-comprehensive-015-320x240-0168.i420 +bdfb21e4236c904aeacd7b094fcffe98 vp80-00-comprehensive-015-320x240-0169.i420 +df2ef3e452731053ade82506c013164e vp80-00-comprehensive-015-320x240-0170.i420 +4695bfd9aa8e5667572f8f2142c6e538 vp80-00-comprehensive-015-320x240-0171.i420 +649f5315cff1d28f0183144bf4d4eea4 vp80-00-comprehensive-015-320x240-0172.i420 +450e987b9d6075d32e21d030bc385833 vp80-00-comprehensive-015-320x240-0173.i420 +7aec79b25dabfcc2eb2f32e7dbff85f2 vp80-00-comprehensive-015-320x240-0174.i420 +c9c2a96239ad556a2ee496d7c4c965c1 vp80-00-comprehensive-015-320x240-0175.i420 +3a038e48aa1238b62d431823653bc45a vp80-00-comprehensive-015-320x240-0176.i420 +6d5c8de6a281dbce68998b2c38063f33 vp80-00-comprehensive-015-320x240-0177.i420 +045032f57d6a50ae148f4372f5083a62 vp80-00-comprehensive-015-320x240-0178.i420 +5f39172951e083e712c3b1c528e61a4f vp80-00-comprehensive-015-320x240-0179.i420 +5a49eea76b6a86e305fb207fc1479264 vp80-00-comprehensive-015-320x240-0180.i420 +33ca5fb5f3e4ff3a24235da71c5730d5 vp80-00-comprehensive-015-320x240-0181.i420 +81f231d20426c5cbd02a85a425f5d0b8 vp80-00-comprehensive-015-320x240-0182.i420 +302d94aa9a8d3828cf74c8b2b7e7fdd5 vp80-00-comprehensive-015-320x240-0183.i420 +c56f4f0c32b0f2c409b64ed10216a40a vp80-00-comprehensive-015-320x240-0184.i420 +9cf7f51e1527f11c38c395bac94849d9 vp80-00-comprehensive-015-320x240-0185.i420 +0f17e427d14db658131eb0ccdc2a97ef vp80-00-comprehensive-015-320x240-0186.i420 +2624dd6b8e4e95770f132d90aa6f6119 vp80-00-comprehensive-015-320x240-0187.i420 +9ddabfd5f803014443c2a0686869c546 vp80-00-comprehensive-015-320x240-0188.i420 +0170cb86a377d791d7cbee2af0836db7 vp80-00-comprehensive-015-320x240-0189.i420 +f43a7c63bcafb51ead65e2831610612c vp80-00-comprehensive-015-320x240-0190.i420 +e7000913b11bdeb74ba4eca110df8470 vp80-00-comprehensive-015-320x240-0191.i420 +a4208c5fcd101ceb5a976838ae9a811f vp80-00-comprehensive-015-320x240-0192.i420 +8ddcb546ac632c967e879fb5101afa24 vp80-00-comprehensive-015-320x240-0193.i420 +547007771194373dd246586744130f7c vp80-00-comprehensive-015-320x240-0194.i420 +3608a46fee2731341ae9f71d3a80918a vp80-00-comprehensive-015-320x240-0195.i420 +758692e173552eb3439a572c953dda0f vp80-00-comprehensive-015-320x240-0196.i420 +481f456d6c6ac2e0325acba5eeabcd26 vp80-00-comprehensive-015-320x240-0197.i420 +c749a3ef8641d5ec4f25c611ffad1000 vp80-00-comprehensive-015-320x240-0198.i420 +93f089f7f1e78b1a4185c0b0d99875fb vp80-00-comprehensive-015-320x240-0199.i420 +1159712bb4dbaed38d2a7558335f4037 vp80-00-comprehensive-015-320x240-0200.i420 +e8dab85a977f525d4d9b448e4278a34b vp80-00-comprehensive-015-320x240-0201.i420 +780055af1414e7693777a18428b20a07 vp80-00-comprehensive-015-320x240-0202.i420 +59252515451fd96ca3f1194d5aadc3a7 vp80-00-comprehensive-015-320x240-0203.i420 +0a977d6db761c149316417988657610a vp80-00-comprehensive-015-320x240-0204.i420 +ed81d3a10369c12543f9bb6822a249b6 vp80-00-comprehensive-015-320x240-0205.i420 +341e844231f6b55ee3c1eb22ca1bac8e vp80-00-comprehensive-015-320x240-0206.i420 +d0a180c7d15e30a71e297fda0452c153 vp80-00-comprehensive-015-320x240-0207.i420 +58d6f2522ecd8e5fea34cc9f10da2a88 vp80-00-comprehensive-015-320x240-0208.i420 +dc8f96811577f4fd3e6624abae42f449 vp80-00-comprehensive-015-320x240-0209.i420 +3624a2e95f94a0a4413e464f4bf93dcd vp80-00-comprehensive-015-320x240-0210.i420 +cb0deeb5f2d570ca23e3be3ab9231fe9 vp80-00-comprehensive-015-320x240-0211.i420 +5080848626a52e30eb0f64f234ca3e57 vp80-00-comprehensive-015-320x240-0212.i420 +a31c9fe4255318d86e7855f01588220f vp80-00-comprehensive-015-320x240-0213.i420 +6c25fd8d1f0e898f6078decc4220d47d vp80-00-comprehensive-015-320x240-0214.i420 +77e52da08ab57ba5784ce42872cc01cb vp80-00-comprehensive-015-320x240-0215.i420 +b4a87059745b3b862ef7431a9630f16a vp80-00-comprehensive-015-320x240-0216.i420 +1dadc814514ef00f11010df21d8a9494 vp80-00-comprehensive-015-320x240-0217.i420 +5c816a0bbc8ed8fca166aa454093cb59 vp80-00-comprehensive-015-320x240-0218.i420 +10320c174423d1712d9ce812701bcaf9 vp80-00-comprehensive-015-320x240-0219.i420 +279c9398657af129e072165f41e0fb8c vp80-00-comprehensive-015-320x240-0220.i420 +49d88374bc4d965d3cee3274c7cd9906 vp80-00-comprehensive-015-320x240-0221.i420 +48871e22f635f50569dea1bd5ca40d5c vp80-00-comprehensive-015-320x240-0222.i420 +3b8396580f8fbd99daca4df13662f1fc vp80-00-comprehensive-015-320x240-0223.i420 +569245e1bf3cb42aa95f765a8449980f vp80-00-comprehensive-015-320x240-0224.i420 +c5cab497d244447df0ab832dcc9c5968 vp80-00-comprehensive-015-320x240-0225.i420 +0a98ca4f1d771c4bc0286b825d085955 vp80-00-comprehensive-015-320x240-0226.i420 +e4a55f175c3933f02ccf74ccf2961da2 vp80-00-comprehensive-015-320x240-0227.i420 +462dca7f377d708e753ef0bbde19a090 vp80-00-comprehensive-015-320x240-0228.i420 +6f1680f498b0ed6f89a834b5700cc48a vp80-00-comprehensive-015-320x240-0229.i420 +996414e2e3a4bac5868ceeb25b84e6e4 vp80-00-comprehensive-015-320x240-0230.i420 +6ecb4d4b857578d32f716c56dc7e6be9 vp80-00-comprehensive-015-320x240-0231.i420 +e05c8e33157e20c8e8f255e937d6b6cb vp80-00-comprehensive-015-320x240-0232.i420 +6542744da147d16533e41dad287a54fc vp80-00-comprehensive-015-320x240-0233.i420 +bb4b6921d2855025fbcaff4c12299d02 vp80-00-comprehensive-015-320x240-0234.i420 +6bc3e605759725012f7e44f1285b0899 vp80-00-comprehensive-015-320x240-0235.i420 +0be37ecb7cec0cf8a0f9bbc3c590ba98 vp80-00-comprehensive-015-320x240-0236.i420 +4f1103e5923ba8dea3e99c8b75eaed3c vp80-00-comprehensive-015-320x240-0237.i420 +220a8fb0409112c4f4ee769880717fea vp80-00-comprehensive-015-320x240-0238.i420 +e4c612263cfbc0f41283fd1e88e2ff52 vp80-00-comprehensive-015-320x240-0239.i420 +ede2bc67ad87cd78191b742dd56419b5 vp80-00-comprehensive-015-320x240-0240.i420 +ded6a1d0690603aea233e4d624aa60a9 vp80-00-comprehensive-015-320x240-0241.i420 +59c8b53e47ebdab696547a887163b272 vp80-00-comprehensive-015-320x240-0242.i420 +985f8afbc6df2d64d601d2fdc93571d7 vp80-00-comprehensive-015-320x240-0243.i420 +e595f0aa7b6b62094f0ad84252105f55 vp80-00-comprehensive-015-320x240-0244.i420 +c2fe4382a1740bcfc2f4c3573c6c3176 vp80-00-comprehensive-015-320x240-0245.i420 +880d8c906a8b39a61b68eb0ada857e5f vp80-00-comprehensive-015-320x240-0246.i420 +9a3ca55d2d75e3c41a86aea2ec87ff76 vp80-00-comprehensive-015-320x240-0247.i420 +f800751663dbefa61c33c3ebbd5430b4 vp80-00-comprehensive-015-320x240-0248.i420 +d904333c0c76235c8ffdfc81dffddb46 vp80-00-comprehensive-015-320x240-0249.i420 +6a633a9a7686a9a02bd252ec8bcff4fc vp80-00-comprehensive-015-320x240-0250.i420 +930d06ecc252a911a60c2d9d4f2618e6 vp80-00-comprehensive-015-320x240-0251.i420 +bb146a4410c34bba74883d8ae478f47b vp80-00-comprehensive-015-320x240-0252.i420 +be8ab9fc95685ebec64ff1f8129afa35 vp80-00-comprehensive-015-320x240-0253.i420 +d1f871ea3ceb38bf2b6d00ebfc38187a vp80-00-comprehensive-015-320x240-0254.i420 +ba33366e050a5f5abbf8202e0afbb9e8 vp80-00-comprehensive-015-320x240-0255.i420 +f706356e12cf4082337bb8f7a5a10673 vp80-00-comprehensive-015-320x240-0256.i420 +6e8200d3c1cccc0f810985ea2a2030f6 vp80-00-comprehensive-015-320x240-0257.i420 +caafdc1810556197df6f42336edcc07b vp80-00-comprehensive-015-320x240-0258.i420 +5321ff525f5bb5063443a3dc43fc42af vp80-00-comprehensive-015-320x240-0259.i420 +c24bdd3b935f7ca6e9e105b1ae8504db vp80-00-comprehensive-015-320x240-0260.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-016.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-016.ivf.md5 new file mode 100644 index 0000000..fa3d8ee --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-016.ivf.md5 @@ -0,0 +1,29 @@ +905a823da31f71f9c25ebb8dfc9ddd3c vp80-00-comprehensive-016-176x144-0001.i420 +9a1b97859b2f774954dbf96f45a22a0a vp80-00-comprehensive-016-176x144-0002.i420 +f0f5651b32577549dc2e6e3050125229 vp80-00-comprehensive-016-176x144-0003.i420 +9edf800d31dc653a23ed71d0f3fc32e4 vp80-00-comprehensive-016-176x144-0004.i420 +78dd1fa96e63c177f2b90d702c92f48c vp80-00-comprehensive-016-176x144-0005.i420 +e1cec336383c4ea63ccaff8bfa5c8e24 vp80-00-comprehensive-016-176x144-0006.i420 +e8b5a454e178ab7ba9b83dfc10b4171e vp80-00-comprehensive-016-176x144-0007.i420 +572dbaaf319f1681749135c49940c64e vp80-00-comprehensive-016-176x144-0008.i420 +b0e8313de033cc75a78532789bb6a3cb vp80-00-comprehensive-016-176x144-0009.i420 +ffc5581d83ff67b549d63c7de1a1e8cb vp80-00-comprehensive-016-176x144-0010.i420 +8ae3fcd3d74947d434b7c5f9ee08bbbf vp80-00-comprehensive-016-176x144-0011.i420 +3adff74d92ae0a463dddc6f89965f706 vp80-00-comprehensive-016-176x144-0012.i420 +f08355430fdf5bb16a91eef05f03186b vp80-00-comprehensive-016-176x144-0013.i420 +d477eb8150a1a94dd6af7f067e8c0429 vp80-00-comprehensive-016-176x144-0014.i420 +f860f225e27871a17060373b79007ec6 vp80-00-comprehensive-016-176x144-0015.i420 +22a25c07ac5e7c67df793e0d3169386c vp80-00-comprehensive-016-176x144-0016.i420 +a96f9cef4efe74db0cce039c85c03c4d vp80-00-comprehensive-016-176x144-0017.i420 +ff9c93cbc364976044144ee631f89bd2 vp80-00-comprehensive-016-176x144-0018.i420 +3a6b43090adb6c8b5188d544a08295a8 vp80-00-comprehensive-016-176x144-0019.i420 +7f41a10ada80865d24585860065aa5e4 vp80-00-comprehensive-016-176x144-0020.i420 +099847f606672fd065e6841000cafcb3 vp80-00-comprehensive-016-176x144-0021.i420 +fbf543c12ce48633e6d10717862c35a7 vp80-00-comprehensive-016-176x144-0022.i420 +1b9956d8a6c45e39d219da33ff7c334a vp80-00-comprehensive-016-176x144-0023.i420 +911eb8f478485c0f4eef1d03f53aa80b vp80-00-comprehensive-016-176x144-0024.i420 +b801570a437439ce12c5037df0235742 vp80-00-comprehensive-016-176x144-0025.i420 +8d231805d741abe79670a0e9f13712ea vp80-00-comprehensive-016-176x144-0026.i420 +87bfcc2c88c4471067c07fbcf635870d vp80-00-comprehensive-016-176x144-0027.i420 +d51b6999afde880bc77597063b58d28f vp80-00-comprehensive-016-176x144-0028.i420 +c69c07a34bfad3b5a95b19a84e991c13 vp80-00-comprehensive-016-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-017.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-017.ivf.md5 new file mode 100644 index 0000000..20281fe --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-017.ivf.md5 @@ -0,0 +1,29 @@ +905a823da31f71f9c25ebb8dfc9ddd3c vp80-00-comprehensive-017-176x144-0001.i420 +f0f411dd067bff05d5d9c64e3f52a4b1 vp80-00-comprehensive-017-176x144-0002.i420 +c8696f8fa56b4adf18f3db0c384d968f vp80-00-comprehensive-017-176x144-0003.i420 +5772aa26a95092b4a8a117e97d6dde49 vp80-00-comprehensive-017-176x144-0004.i420 +fc52254ea1cbcc2e7a5b126d8c44a023 vp80-00-comprehensive-017-176x144-0005.i420 +bf6208554657f568ad69d5c60f692fdb vp80-00-comprehensive-017-176x144-0006.i420 +3a68eef642b250177592455f4aa925d9 vp80-00-comprehensive-017-176x144-0007.i420 +98102b7bd56cbe456d86c93e8cdd48eb vp80-00-comprehensive-017-176x144-0008.i420 +59d54b7d97600b2890c8abab2af9a7dc vp80-00-comprehensive-017-176x144-0009.i420 +ba4b4bb534ee2a00f418828b9723d996 vp80-00-comprehensive-017-176x144-0010.i420 +feb1115136fa96d5e9425ac18261de7c vp80-00-comprehensive-017-176x144-0011.i420 +ef7eb6dc656c2bd7447c7d8f650108c1 vp80-00-comprehensive-017-176x144-0012.i420 +89ec385a0d34c8fd5b1334d8756c96b9 vp80-00-comprehensive-017-176x144-0013.i420 +27bc439dd8e6d50c3c7a6e0b390e7418 vp80-00-comprehensive-017-176x144-0014.i420 +ec36c065d8b668fabb6b16ecc01eea0a vp80-00-comprehensive-017-176x144-0015.i420 +5c94f9b441fc70f62856c835f9e9ad50 vp80-00-comprehensive-017-176x144-0016.i420 +4b6c1bd876b00052b39e6ca91cad9c05 vp80-00-comprehensive-017-176x144-0017.i420 +1099121afd681cf3218dffb9714a0fd7 vp80-00-comprehensive-017-176x144-0018.i420 +d0c1de888fab35f33c1148dc80494d20 vp80-00-comprehensive-017-176x144-0019.i420 +745941ea768d06ea27c3fbca782e3591 vp80-00-comprehensive-017-176x144-0020.i420 +09f85054f188da6f7260debf6b71bbb1 vp80-00-comprehensive-017-176x144-0021.i420 +2bdd642a7551681f1ca9680a0d9183a8 vp80-00-comprehensive-017-176x144-0022.i420 +054aba9db9790a0f1c79db491a6cac6d vp80-00-comprehensive-017-176x144-0023.i420 +fa4b52162f6da0c15100f4382d92d7e4 vp80-00-comprehensive-017-176x144-0024.i420 +88c589535811dd394bd1723172329629 vp80-00-comprehensive-017-176x144-0025.i420 +c11cc1a30199d46db048120969dc4118 vp80-00-comprehensive-017-176x144-0026.i420 +c61207280f40620f8cd5e962f3aa160f vp80-00-comprehensive-017-176x144-0027.i420 +8a721ecbad0b2f17aabb2d06e27c00aa vp80-00-comprehensive-017-176x144-0028.i420 +da32f1d272e065cd31415b23f86837cc vp80-00-comprehensive-017-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-00-comprehensive-018.ivf.md5 b/testdata/libvpx/vp80-00-comprehensive-018.ivf.md5 new file mode 100644 index 0000000..f6fbd01 --- /dev/null +++ b/testdata/libvpx/vp80-00-comprehensive-018.ivf.md5 @@ -0,0 +1,28 @@ +8d089d226f52d6cdaffdb3fcc080b75b vp80-00-comprehensive-018-176x144-0002.i420 +acaae81ca812145e85e0be83bdf54226 vp80-00-comprehensive-018-176x144-0003.i420 +e94651d798b6bf5f09a9bba10cacaf7a vp80-00-comprehensive-018-176x144-0004.i420 +60c2607913e528d501962bf407341731 vp80-00-comprehensive-018-176x144-0005.i420 +e683f2bf28b31e36db88087bd03b6917 vp80-00-comprehensive-018-176x144-0006.i420 +0c2923785051bc9b90c2447a85527764 vp80-00-comprehensive-018-176x144-0007.i420 +1bc97b6b2e4ca36b149c3768495747ac vp80-00-comprehensive-018-176x144-0008.i420 +0586d948ed3fd479c6dd08055973bcb4 vp80-00-comprehensive-018-176x144-0009.i420 +c9a1198e1680487c77a2d1631695aeec vp80-00-comprehensive-018-176x144-0010.i420 +547d8ffce9c085231c74717a9b815625 vp80-00-comprehensive-018-176x144-0011.i420 +d31c02a5591eb7bd8e73703252e1a1ab vp80-00-comprehensive-018-176x144-0012.i420 +23bafc8e22b2ed7e8c5e52369095cd30 vp80-00-comprehensive-018-176x144-0013.i420 +9725d52d7810a19b20dcc9bb0fa36abd vp80-00-comprehensive-018-176x144-0014.i420 +7aefaabdcd2595939fd05078d01b484b vp80-00-comprehensive-018-176x144-0015.i420 +828e758d6f0b29b2693b2dc6b09249a6 vp80-00-comprehensive-018-176x144-0016.i420 +53f09380dde1420ba270b74d8819537c vp80-00-comprehensive-018-176x144-0017.i420 +09791a7db3bc28258350cfdc95d8f224 vp80-00-comprehensive-018-176x144-0018.i420 +2050271dc4ba3f3e427cf8088c96e28d vp80-00-comprehensive-018-176x144-0019.i420 +4e69d3f7cea45844b740368fcd4dd815 vp80-00-comprehensive-018-176x144-0020.i420 +4ed07697e239b7f12ee6a97ad09c08fb vp80-00-comprehensive-018-176x144-0021.i420 +1437c129bfbda63ca1d39a94ee91b097 vp80-00-comprehensive-018-176x144-0022.i420 +4fc951bf45e164b711591155a59c73fa vp80-00-comprehensive-018-176x144-0023.i420 +97d1007e27b4b9072751e87e8d1f1415 vp80-00-comprehensive-018-176x144-0024.i420 +18c809835dcc3d30c93ae1be569dcd24 vp80-00-comprehensive-018-176x144-0025.i420 +de0fd0035a542791c4dda5735657efc5 vp80-00-comprehensive-018-176x144-0026.i420 +27a70ff95d0cfa10f54652c9fb8a9db2 vp80-00-comprehensive-018-176x144-0027.i420 +2285b9324ec91099626191f769962e44 vp80-00-comprehensive-018-176x144-0028.i420 +56794d911b02190212bca92f88ad60c6 vp80-00-comprehensive-018-176x144-0029.i420 diff --git a/testdata/libvpx/vp80-01-intra-1400.ivf.md5 b/testdata/libvpx/vp80-01-intra-1400.ivf.md5 new file mode 100644 index 0000000..2a4a785 --- /dev/null +++ b/testdata/libvpx/vp80-01-intra-1400.ivf.md5 @@ -0,0 +1,10 @@ +f6bf9ee8cacfe78711b794ef217fad3a vp80-01-intra-1400-176x144-0001.i420 +dfa87e2039ce5384a90aefeee6a321ac vp80-01-intra-1400-176x144-0002.i420 +8ad92ea0e0716cc01b04d7651449af5c vp80-01-intra-1400-176x144-0003.i420 +4883a8b7b0bd53cc4d5a36c3c982c00e vp80-01-intra-1400-176x144-0004.i420 +1a0ded3e3dc4266c1e6e9647979fedd6 vp80-01-intra-1400-176x144-0005.i420 +eee625d77ee793de5992a3b0471fd35e vp80-01-intra-1400-176x144-0006.i420 +53c1527761d749a58ab291619826f546 vp80-01-intra-1400-176x144-0007.i420 +8cf27bd8ebb2c395cebcb61f94ec7d1e vp80-01-intra-1400-176x144-0008.i420 +803bd7b0324011dffd85c1065a1efd8e vp80-01-intra-1400-176x144-0009.i420 +44031b338240cb244fc98348c65e9405 vp80-01-intra-1400-176x144-0010.i420 diff --git a/testdata/libvpx/vp80-01-intra-1411.ivf.md5 b/testdata/libvpx/vp80-01-intra-1411.ivf.md5 new file mode 100644 index 0000000..12a51b0 --- /dev/null +++ b/testdata/libvpx/vp80-01-intra-1411.ivf.md5 @@ -0,0 +1,30 @@ +9e3fb414a3853f97767bfcfcbe35474a vp80-01-intra-1411-96x96-0001.i420 +5feda57010332dc47cc306d13e5cfcbb vp80-01-intra-1411-96x96-0002.i420 +9397014f1dc7646af7eaa8668ed8a936 vp80-01-intra-1411-96x96-0003.i420 +9456e0d90c4d4786280aa5fd066a8de9 vp80-01-intra-1411-96x96-0004.i420 +c7cf9fbdd50b8b9b257cab50ab975604 vp80-01-intra-1411-96x96-0005.i420 +77a28e1c423dac184212ad23df69ae31 vp80-01-intra-1411-96x96-0006.i420 +6adc154ffd4dbdff6b153452943a4dc8 vp80-01-intra-1411-96x96-0007.i420 +cded6d3d481bb425ed6a8ba132b7ee12 vp80-01-intra-1411-96x96-0008.i420 +dd9bfa470810ba76dd1b93dbf1b89faf vp80-01-intra-1411-96x96-0009.i420 +7d98e517328253831f5123ead9388b7e vp80-01-intra-1411-96x96-0010.i420 +1c4e0cdc1714906a73d0e74a72f91264 vp80-01-intra-1411-96x96-0011.i420 +ed3e4d1cac88e804ca92c65fbe4cec97 vp80-01-intra-1411-96x96-0012.i420 +8e634b55c1b7a33e4c1c273d86181b8f vp80-01-intra-1411-96x96-0013.i420 +9090a8254bb28917a0ec02b184c1b864 vp80-01-intra-1411-96x96-0014.i420 +3cef6a9182c5cd9e00c9fe3d1cc397b6 vp80-01-intra-1411-96x96-0015.i420 +10e8858bbd9031629316c6a96d11650b vp80-01-intra-1411-96x96-0016.i420 +019ceea1e53661d04939f073aa54c5a2 vp80-01-intra-1411-96x96-0017.i420 +289af682ee1368d783013a9fa207d0f3 vp80-01-intra-1411-96x96-0018.i420 +2734a0b3430918ad4e2401586e3034e6 vp80-01-intra-1411-96x96-0019.i420 +44c21ccca341e4418cb0d343b61e01bb vp80-01-intra-1411-96x96-0020.i420 +cf95a6502c6857d3793eb3667a53fcb9 vp80-01-intra-1411-96x96-0021.i420 +fd20d94a51ca4272a2cc375e4ffdeaee vp80-01-intra-1411-96x96-0022.i420 +35992234924076efa65b28e71bd8c15d vp80-01-intra-1411-96x96-0023.i420 +1fa5b53c0ee066245518b1322448e891 vp80-01-intra-1411-96x96-0024.i420 +99cedf7ede7bd73b233d6e2c2decf8bb vp80-01-intra-1411-96x96-0025.i420 +9f6fced5c08e89499383f9eca0cfe67a vp80-01-intra-1411-96x96-0026.i420 +4f586505f4a70e0879332d8cfef234de vp80-01-intra-1411-96x96-0027.i420 +996144942d39a1d86fa6b47937e17a49 vp80-01-intra-1411-96x96-0028.i420 +1c3a8527b1bb3d0ba5006061b5a79042 vp80-01-intra-1411-96x96-0029.i420 +dfc27842805332145dd31d79d6e98a9d vp80-01-intra-1411-96x96-0030.i420 diff --git a/testdata/libvpx/vp80-01-intra-1416.ivf.md5 b/testdata/libvpx/vp80-01-intra-1416.ivf.md5 new file mode 100644 index 0000000..0359c8a --- /dev/null +++ b/testdata/libvpx/vp80-01-intra-1416.ivf.md5 @@ -0,0 +1 @@ +cffd1299fa7a0330264cb411d9482bb0 vp80-01-intra-1416-176x144-0001.i420 diff --git a/testdata/libvpx/vp80-01-intra-1417.ivf.md5 b/testdata/libvpx/vp80-01-intra-1417.ivf.md5 new file mode 100644 index 0000000..ae6c083 --- /dev/null +++ b/testdata/libvpx/vp80-01-intra-1417.ivf.md5 @@ -0,0 +1 @@ +0e6c13a78a203d95fe12d206a432f642 vp80-01-intra-1417-176x144-0001.i420 diff --git a/testdata/libvpx/vp80-02-inter-1402.ivf.md5 b/testdata/libvpx/vp80-02-inter-1402.ivf.md5 new file mode 100644 index 0000000..7d1bf38 --- /dev/null +++ b/testdata/libvpx/vp80-02-inter-1402.ivf.md5 @@ -0,0 +1,10 @@ +f6bf9ee8cacfe78711b794ef217fad3a vp80-02-inter-1402-176x144-0001.i420 +7388ed03cf502fff8b2c95013943641c vp80-02-inter-1402-176x144-0002.i420 +e61af9d26723cbd3a07e7cb28264f0e0 vp80-02-inter-1402-176x144-0003.i420 +fb0f04b0a2af9cb835b8aca5d73d3eea vp80-02-inter-1402-176x144-0004.i420 +bab7ab0f8dca7b29190652173b8fcd55 vp80-02-inter-1402-176x144-0005.i420 +ead765480a5645c7994fa02a3211472d vp80-02-inter-1402-176x144-0006.i420 +06ae2733b5de55e88a7053fa3905f90b vp80-02-inter-1402-176x144-0007.i420 +b38b5b1227514dfd2a57c556e52cfe7c vp80-02-inter-1402-176x144-0008.i420 +186582f7607fc54604bcdb4b5df501e6 vp80-02-inter-1402-176x144-0009.i420 +868a308b2ee12530487bd9933184d941 vp80-02-inter-1402-176x144-0010.i420 diff --git a/testdata/libvpx/vp80-02-inter-1412.ivf.md5 b/testdata/libvpx/vp80-02-inter-1412.ivf.md5 new file mode 100644 index 0000000..01e8960 --- /dev/null +++ b/testdata/libvpx/vp80-02-inter-1412.ivf.md5 @@ -0,0 +1,30 @@ +9e3fb414a3853f97767bfcfcbe35474a vp80-02-inter-1412-96x96-0001.i420 +511f9edc39f669ee0b0ede3bdc769e3d vp80-02-inter-1412-96x96-0002.i420 +2eea394563f05d06eb54863501b21fdb vp80-02-inter-1412-96x96-0003.i420 +42f8f37a5fd3af5d36d2fbf9b7218a76 vp80-02-inter-1412-96x96-0004.i420 +6209e60d40e92b9c021e77256a639169 vp80-02-inter-1412-96x96-0005.i420 +4db951c7a6fae45cfc4e4b1c8ebe53db vp80-02-inter-1412-96x96-0006.i420 +c9aa5b9854fcf971e668c2cdbe317add vp80-02-inter-1412-96x96-0007.i420 +1fc9ff766a19ad152ac4dc73d470a4f0 vp80-02-inter-1412-96x96-0008.i420 +afcf703cf07255465c284d5e620b67af vp80-02-inter-1412-96x96-0009.i420 +e63f356d85864d6c3f83118475beab77 vp80-02-inter-1412-96x96-0010.i420 +6d1e4da848221f7ffedf3abbd83076f1 vp80-02-inter-1412-96x96-0011.i420 +cee92e094b3c9faf0ed465a69e71c8d7 vp80-02-inter-1412-96x96-0012.i420 +41176c32853b9fec95da88b974c5dc2a vp80-02-inter-1412-96x96-0013.i420 +b31cca2da24c5ebb9351b9b723772f28 vp80-02-inter-1412-96x96-0014.i420 +ea3d66b8e1888e73bfb03a0a379652e9 vp80-02-inter-1412-96x96-0015.i420 +d0911f8e5453530613a7532819813eda vp80-02-inter-1412-96x96-0016.i420 +bbbaaee4ccfeecf31f0520d00113ec6a vp80-02-inter-1412-96x96-0017.i420 +d0846a234053b89be0579d1643d129ac vp80-02-inter-1412-96x96-0018.i420 +734cd2e7f437f4e77a7a1bed9d256713 vp80-02-inter-1412-96x96-0019.i420 +73897d4ff43f1f537d62dfb33410cc21 vp80-02-inter-1412-96x96-0020.i420 +4ac47f1861abfe77e89650b3eea5fb82 vp80-02-inter-1412-96x96-0021.i420 +06452b9c764f265350151960ebd959db vp80-02-inter-1412-96x96-0022.i420 +358315372f6bd06cfb2806ce6ce45ffb vp80-02-inter-1412-96x96-0023.i420 +52060aeb60a84848f4efdc04ebdbdf24 vp80-02-inter-1412-96x96-0024.i420 +89480650a79eeb2a2aa9f3f07d14dfe3 vp80-02-inter-1412-96x96-0025.i420 +d8e134702bcf3aaf502560cb67650071 vp80-02-inter-1412-96x96-0026.i420 +cd011e9a30bb12360f8677e6aae8a115 vp80-02-inter-1412-96x96-0027.i420 +edf0bec80aebf551c0b02cdc174ce218 vp80-02-inter-1412-96x96-0028.i420 +44c5ec48f19f01f85c6cebccde2840e6 vp80-02-inter-1412-96x96-0029.i420 +eb70cb6f71fef8ca6b754e37f59197a3 vp80-02-inter-1412-96x96-0030.i420 diff --git a/testdata/libvpx/vp80-02-inter-1418.ivf.md5 b/testdata/libvpx/vp80-02-inter-1418.ivf.md5 new file mode 100644 index 0000000..994bbba --- /dev/null +++ b/testdata/libvpx/vp80-02-inter-1418.ivf.md5 @@ -0,0 +1,108 @@ +235ea785ad6c2d238fda94e05ad4a1a3 vp80-02-inter-1418-200x200-0001.i420 +58900b40a6cf40557107d944f6a49e17 vp80-02-inter-1418-200x200-0002.i420 +24252cdd25951a954fcc5f2bbd99e91e vp80-02-inter-1418-200x200-0003.i420 +6e47b9a51ab5320bca353f600a7dbbef vp80-02-inter-1418-200x200-0004.i420 +1a67dbb61077e57b94f4144feab44c85 vp80-02-inter-1418-200x200-0005.i420 +7d2dce620640141a76e40b28f5938977 vp80-02-inter-1418-200x200-0006.i420 +41e1aa0ed9decefc89f20b8255f213e5 vp80-02-inter-1418-200x200-0007.i420 +331b5041714a11bd46963850fd139aba vp80-02-inter-1418-200x200-0008.i420 +dfb23167d957ddd6f26f94207da92445 vp80-02-inter-1418-200x200-0009.i420 +236a118ed5f74be1d07a76bc381599b4 vp80-02-inter-1418-200x200-0010.i420 +92cc8ad634a7ea795b3a6a44d0d34ad7 vp80-02-inter-1418-200x200-0011.i420 +36fb3dd4ee5b32feecee17c776233cf2 vp80-02-inter-1418-200x200-0012.i420 +405c43ec608cdfb6db797873fa2e53dd vp80-02-inter-1418-200x200-0013.i420 +25307f0d589171c136918c82495be0ed vp80-02-inter-1418-200x200-0014.i420 +53f10ce418d844eb6769dc8e6ddc2595 vp80-02-inter-1418-200x200-0015.i420 +01db8b6c38dcd53607a91078142defd0 vp80-02-inter-1418-200x200-0016.i420 +4f27e665c77596132b9b14f20ac6f756 vp80-02-inter-1418-200x200-0017.i420 +cf5af6014734180bf0c6b89c03e3b8a2 vp80-02-inter-1418-200x200-0018.i420 +da6f436fc3b97243395ba229fcecdd4b vp80-02-inter-1418-200x200-0019.i420 +5f3644d72b873125496ce6861895af05 vp80-02-inter-1418-200x200-0020.i420 +1a4ff2e75946120d4f00da2298fc93ee vp80-02-inter-1418-200x200-0021.i420 +aa309f500430dee6124823e7b8bc50d4 vp80-02-inter-1418-200x200-0022.i420 +34689b0eb9a2bbe94004494a709eb0ea vp80-02-inter-1418-200x200-0023.i420 +4b7e6079d3087d91554d2517457f1a98 vp80-02-inter-1418-200x200-0024.i420 +904acde8b5527831bcc194cd4c0c3f33 vp80-02-inter-1418-200x200-0025.i420 +98866a3c4c76b7023da680a567eeb066 vp80-02-inter-1418-200x200-0026.i420 +5c518dae8cbf0ab3343e6e29f79b151e vp80-02-inter-1418-200x200-0027.i420 +89eacff280899753ffabd106a5c00bb4 vp80-02-inter-1418-200x200-0028.i420 +89a121d7c2deaff5204c00fe8efb5eee vp80-02-inter-1418-200x200-0029.i420 +adc3c32d58fb39a19adf6d3a8159305a vp80-02-inter-1418-200x200-0030.i420 +08f689e96a2e692b64c1eb70226dfb7e vp80-02-inter-1418-200x200-0031.i420 +c7569c95d31d2ddd971d2c62037f3f94 vp80-02-inter-1418-200x200-0032.i420 +e94c940debea9292eb09fb583d8a3369 vp80-02-inter-1418-200x200-0033.i420 +1d1468a1d401cdefb333d03cf3e3260b vp80-02-inter-1418-200x200-0034.i420 +ce9a5fd13cbd77f89fa02bc8714c3a6a vp80-02-inter-1418-200x200-0035.i420 +06fc2463320afef9c7f04e8ef0def238 vp80-02-inter-1418-200x200-0036.i420 +de20f96d88703fd5526e47c3b4d713a2 vp80-02-inter-1418-200x200-0037.i420 +b216813a92045b9629569b091021eff8 vp80-02-inter-1418-200x200-0038.i420 +c5ad0d5932cee72d196b7322e99be228 vp80-02-inter-1418-200x200-0039.i420 +337edfbf3dafc0d03c9e9fc6b7a037af vp80-02-inter-1418-200x200-0040.i420 +6570ab1151871c70322612af61dd1484 vp80-02-inter-1418-200x200-0041.i420 +aeb4c002e057bbca94e07296369f0926 vp80-02-inter-1418-200x200-0042.i420 +933687524897537c538ecd9012ab421d vp80-02-inter-1418-200x200-0043.i420 +4702bf75cb9717e3bcb0d76dc3008417 vp80-02-inter-1418-200x200-0044.i420 +c6b1a4970907d6d7450168f8e9242f48 vp80-02-inter-1418-200x200-0045.i420 +cda71bad390fc4eb1075fda871183d2d vp80-02-inter-1418-200x200-0046.i420 +6a6efb5e2afd1d5aa0f2a08f42599b62 vp80-02-inter-1418-200x200-0047.i420 +a4343c0dba7472a4a19c8dd80b228602 vp80-02-inter-1418-200x200-0048.i420 +cd9bcfc728c1131146fb240e09ae9a80 vp80-02-inter-1418-200x200-0049.i420 +66d64cc8c0ea4d1484015769481e9091 vp80-02-inter-1418-200x200-0050.i420 +781ed45b81c4625d4ab592b33ebf416b vp80-02-inter-1418-200x200-0051.i420 +a19dff1226c67bd41917e412e4da5b3d vp80-02-inter-1418-200x200-0052.i420 +80e690b6ce78a9d7fd7be16fbc4555e7 vp80-02-inter-1418-200x200-0053.i420 +5b61592cfb02eb25964d5a9a4981e2cc vp80-02-inter-1418-200x200-0054.i420 +d06f33db1bbb43cb1e4582f49ba25492 vp80-02-inter-1418-200x200-0055.i420 +1f416dd9e5dc6559ccab9af5a2f5218f vp80-02-inter-1418-200x200-0056.i420 +ad1deeb2cb26bcad494628125a06f418 vp80-02-inter-1418-200x200-0057.i420 +f91a68285886cc104366ed85db6a37d9 vp80-02-inter-1418-200x200-0058.i420 +a7c4a653f2627d453af2262516ac50d1 vp80-02-inter-1418-200x200-0059.i420 +f94473cc7a987d52900ef1eced6029ca vp80-02-inter-1418-200x200-0060.i420 +d66c8c0fa6c9ff804e4488256cb7b4ab vp80-02-inter-1418-200x200-0061.i420 +ea7deb35072cc2dc6b58d40dc57f5e3e vp80-02-inter-1418-200x200-0062.i420 +523c09fc9b1eb81c419e79ad2b41c9c8 vp80-02-inter-1418-200x200-0063.i420 +4fb6a3844aefba710d6e0c0956fa0ce9 vp80-02-inter-1418-200x200-0064.i420 +609e9798d817c71fb66b186367d970fd vp80-02-inter-1418-200x200-0065.i420 +87e70baea58f7765d0ffc0dabec1d655 vp80-02-inter-1418-200x200-0066.i420 +aa17defa87579494f56c98303924825d vp80-02-inter-1418-200x200-0067.i420 +54b0479073a9e2ed949cbde28f065604 vp80-02-inter-1418-200x200-0068.i420 +8e30ef59f4dcc02d7ac0dee5c9cd10cd vp80-02-inter-1418-200x200-0069.i420 +8ed1fb2b5d0454f238dc45b6fd92e5f3 vp80-02-inter-1418-200x200-0070.i420 +6a2646a23fefbe54ff109b4f4bc18c18 vp80-02-inter-1418-200x200-0071.i420 +c4711377f2f2b6aafd08b4484d69341d vp80-02-inter-1418-200x200-0072.i420 +76dff3edb61753dfb304028b542fbe11 vp80-02-inter-1418-200x200-0073.i420 +5cd48490e96eb83ec6e600351c705bff vp80-02-inter-1418-200x200-0074.i420 +148a22af4c4c0a6a86fac4d2a800eec7 vp80-02-inter-1418-200x200-0075.i420 +327c4c87376aa305dcc57c75f94bcd8c vp80-02-inter-1418-200x200-0076.i420 +7b5c968bdcd7e08f8dd5822e45cbb20e vp80-02-inter-1418-200x200-0077.i420 +367e040b98db96ea734dcc07932a35da vp80-02-inter-1418-200x200-0078.i420 +2bafeedb4cd2e7fe40d3ccdb5ba076c6 vp80-02-inter-1418-200x200-0079.i420 +34cf6962d55b91ece5e5ff72b80bb0a7 vp80-02-inter-1418-200x200-0080.i420 +39d851a270262ea22fcc990efc888a79 vp80-02-inter-1418-200x200-0081.i420 +e369145d24f88f7f5f6343e07539d209 vp80-02-inter-1418-200x200-0082.i420 +3bf9f31efd7e4347647658d0d438f233 vp80-02-inter-1418-200x200-0083.i420 +49244d077474bea1c2310b05e38b4a84 vp80-02-inter-1418-200x200-0084.i420 +646b71a47d20f147b08bcdfa9efc6d15 vp80-02-inter-1418-200x200-0085.i420 +5e75ce1d76d0a2af9deef6de14fc09b5 vp80-02-inter-1418-200x200-0086.i420 +4844ced977a1efcfad02029810d70143 vp80-02-inter-1418-200x200-0087.i420 +15bbeeae7ca7d9bf2f27a5fb1b608603 vp80-02-inter-1418-200x200-0088.i420 +13550bf82daf61a8758ad827033f936b vp80-02-inter-1418-200x200-0089.i420 +99643ed3c3d3af9e8508eb49dd642216 vp80-02-inter-1418-200x200-0090.i420 +863171594ce411f26f20747b8deda5a9 vp80-02-inter-1418-200x200-0091.i420 +8a65a6841f669c49e17b940e59727185 vp80-02-inter-1418-200x200-0092.i420 +aab9fc4c81478347d8c35bb027411df1 vp80-02-inter-1418-200x200-0093.i420 +1a6d08bfa5e2e8cecc474f0f4b617f2c vp80-02-inter-1418-200x200-0094.i420 +2406eb3740fca544a84fb39868143187 vp80-02-inter-1418-200x200-0095.i420 +163f987bb485a18f9b100a017584a058 vp80-02-inter-1418-200x200-0096.i420 +3edaf8beff17c855c0b672c0f0037486 vp80-02-inter-1418-200x200-0097.i420 +4fe49310a52f168f20c1c1146d3b1197 vp80-02-inter-1418-200x200-0098.i420 +02acdd7689dfdfa71b07c5d0fcc4cfb9 vp80-02-inter-1418-200x200-0099.i420 +892338ddff526666ae11d3be33775103 vp80-02-inter-1418-200x200-0100.i420 +004a1a460a8899a9f67a9a7cbaf1a4b9 vp80-02-inter-1418-200x200-0101.i420 +2b1e71934bce00485d8c8d4c03a8b11e vp80-02-inter-1418-200x200-0102.i420 +5afcd8efaecf41d057852edde6e3f7d1 vp80-02-inter-1418-200x200-0103.i420 +7dd489bc18b067e69a2ecd2f24cd362f vp80-02-inter-1418-200x200-0104.i420 +0a3a3ad86bbfa527f5ebf4095e90f198 vp80-02-inter-1418-200x200-0105.i420 +b022fa5979a4d276c4cb2df0e410a46b vp80-02-inter-1418-200x200-0106.i420 +0feb4d9e7e4f26b8542985226769c71c vp80-02-inter-1418-200x200-0107.i420 +db9dfddd53fb1ef24ef5666a33d3f9ae vp80-02-inter-1418-200x200-0108.i420 diff --git a/testdata/libvpx/vp80-02-inter-1424.ivf.md5 b/testdata/libvpx/vp80-02-inter-1424.ivf.md5 new file mode 100644 index 0000000..e3fcf88 --- /dev/null +++ b/testdata/libvpx/vp80-02-inter-1424.ivf.md5 @@ -0,0 +1,14 @@ +83418598f1e6bb119a72d0d1c6eb972d vp80-02-inter-1424-176x144-0001.i420 +75d660555d57f46253622b3ddbf63445 vp80-02-inter-1424-176x144-0002.i420 +69bc2e4aef6e69a933fd51d4f81eb6ed vp80-02-inter-1424-176x144-0003.i420 +3246305ae4cb515c388a11177e238f76 vp80-02-inter-1424-176x144-0004.i420 +18ac68b51c6df48b17553da62574603f vp80-02-inter-1424-176x144-0005.i420 +6830bc95f0c7f81a037105b731dcbd7e vp80-02-inter-1424-176x144-0006.i420 +c220cc00b87718cf430c9d7d4d106ba2 vp80-02-inter-1424-176x144-0007.i420 +971a8181cd53b0b0cca32c9dc4f4c875 vp80-02-inter-1424-176x144-0008.i420 +c91c2e2bdfda9ce3f36542a3fda52d08 vp80-02-inter-1424-176x144-0009.i420 +9177869d65f973751e211dc5d198131f vp80-02-inter-1424-176x144-0010.i420 +37dafb77add2d1ccee99c50b630ce11e vp80-02-inter-1424-176x144-0011.i420 +4e861191f9280ec58d423b8dbf84545a vp80-02-inter-1424-176x144-0012.i420 +b317ba38d1592a2784605f563321dee2 vp80-02-inter-1424-176x144-0013.i420 +9e4117ba293d950af0c547a8a5b95cf1 vp80-02-inter-1424-176x144-0014.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-01.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-01.ivf.md5 new file mode 100644 index 0000000..97aeb18 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-01.ivf.md5 @@ -0,0 +1 @@ +db954c077b7a3f34a448ceaacf8f525c vp80-03-segmentation-01-160x160-0001.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-02.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-02.ivf.md5 new file mode 100644 index 0000000..153bf3f --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-02.ivf.md5 @@ -0,0 +1 @@ +4d2d65efeee1c83772c33a13446bd1a4 vp80-03-segmentation-02-160x160-0001.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-03.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-03.ivf.md5 new file mode 100644 index 0000000..7a31f26 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-03.ivf.md5 @@ -0,0 +1 @@ +73d864433691f8db43257b88495ac8c3 vp80-03-segmentation-03-160x160-0001.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-04.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-04.ivf.md5 new file mode 100644 index 0000000..cf33d2a --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-04.ivf.md5 @@ -0,0 +1 @@ +7f846c8bd7cdfe61f8542f382f9d8eeb vp80-03-segmentation-04-1280x720-0001.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1401.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1401.ivf.md5 new file mode 100644 index 0000000..9c94e2c --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1401.ivf.md5 @@ -0,0 +1,10 @@ +f6bf9ee8cacfe78711b794ef217fad3a vp80-03-segmentation-1401-176x144-0001.i420 +322ec8fb0c35b9b5e7b69df6267cdf01 vp80-03-segmentation-1401-176x144-0002.i420 +a3b915ef2691a8cb55a7b522d1c6c168 vp80-03-segmentation-1401-176x144-0003.i420 +2a7496d2577d5e9b092c83277c9b1abf vp80-03-segmentation-1401-176x144-0004.i420 +3faa0a651701a583d71f0ca2c9af56c1 vp80-03-segmentation-1401-176x144-0005.i420 +1b940a201712cb681f789b8629ede946 vp80-03-segmentation-1401-176x144-0006.i420 +e0666b36a5a19a1d1739e8d614b34b2c vp80-03-segmentation-1401-176x144-0007.i420 +7a0f2331eb272e27a1af706ff8b7acf1 vp80-03-segmentation-1401-176x144-0008.i420 +085b098331e1f7c04c86ca18d04896b9 vp80-03-segmentation-1401-176x144-0009.i420 +8630a00746c39b579484c9335604d3b7 vp80-03-segmentation-1401-176x144-0010.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1403.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1403.ivf.md5 new file mode 100644 index 0000000..a3c451b --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1403.ivf.md5 @@ -0,0 +1,10 @@ +f6bf9ee8cacfe78711b794ef217fad3a vp80-03-segmentation-1403-176x144-0001.i420 +11a597e8f1a7bb2616c8fcb348368955 vp80-03-segmentation-1403-176x144-0002.i420 +2b86a4d9d4c39a6d66edb98b0b3892bb vp80-03-segmentation-1403-176x144-0003.i420 +f2a50bfd5757b876d14d5b5b9b26627a vp80-03-segmentation-1403-176x144-0004.i420 +28bd40badf8bcb0f342e766ae7372af7 vp80-03-segmentation-1403-176x144-0005.i420 +7ba3d2234f00c1e50731d022a6b4f09b vp80-03-segmentation-1403-176x144-0006.i420 +53c920bce887874593ad39b28467cf0d vp80-03-segmentation-1403-176x144-0007.i420 +0bed10004cf5d4186e1af68117263aef vp80-03-segmentation-1403-176x144-0008.i420 +314a96a690ed0920a942d39fbd29100e vp80-03-segmentation-1403-176x144-0009.i420 +e44287103e8451a4d5b07fe32aa2a0b3 vp80-03-segmentation-1403-176x144-0010.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1407.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1407.ivf.md5 new file mode 100644 index 0000000..7f4d3bb --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1407.ivf.md5 @@ -0,0 +1,20 @@ +fc7906f4560e68ba1e1c416243195ccb vp80-03-segmentation-1407-352x288-0001.i420 +702bc6257a3764ceaed73915c3b434c8 vp80-03-segmentation-1407-352x288-0002.i420 +02610071abfb9564c7c118d5f02a99ae vp80-03-segmentation-1407-352x288-0003.i420 +0e207bebccbabfb1385ea9ccdf5c3bec vp80-03-segmentation-1407-352x288-0004.i420 +c39c73768451c123d60bd16d6afbcc3d vp80-03-segmentation-1407-352x288-0005.i420 +057b46bdf053f7a883b0f6f40c45b07d vp80-03-segmentation-1407-352x288-0006.i420 +daedb4c7faf442946bc5aa65ecc61f48 vp80-03-segmentation-1407-352x288-0007.i420 +dfd006269e51e7e385adbe3260e18aae vp80-03-segmentation-1407-352x288-0008.i420 +b2ce06e97d0288380c78f9402f46783f vp80-03-segmentation-1407-352x288-0009.i420 +6fe7ccf0de58fe1490d7ca6af189aa8b vp80-03-segmentation-1407-352x288-0010.i420 +bb538da277db80de271111ee3a5a67b2 vp80-03-segmentation-1407-352x288-0011.i420 +202c88e05957dd9d839e1772a19bd15c vp80-03-segmentation-1407-352x288-0012.i420 +184cc4abc649fd75eee12a472d949bff vp80-03-segmentation-1407-352x288-0013.i420 +1a3672119f2e20b2aafbb11bec54efda vp80-03-segmentation-1407-352x288-0014.i420 +49d4bd322ad6ff6f5de50bfa85bc6777 vp80-03-segmentation-1407-352x288-0015.i420 +0bfe3912ff22b920ad171307088c4f23 vp80-03-segmentation-1407-352x288-0016.i420 +c8d4cb587684dcc0801e05fe7ad2b362 vp80-03-segmentation-1407-352x288-0017.i420 +2cc4440ebd53fa2fac5b131bb20b2d9f vp80-03-segmentation-1407-352x288-0018.i420 +55126cd1a61a7450cc69316d242114c0 vp80-03-segmentation-1407-352x288-0019.i420 +a20fa0f4f130987f485a98dec2c5654f vp80-03-segmentation-1407-352x288-0020.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1408.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1408.ivf.md5 new file mode 100644 index 0000000..fef9792 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1408.ivf.md5 @@ -0,0 +1,20 @@ +fc7906f4560e68ba1e1c416243195ccb vp80-03-segmentation-1408-352x288-0001.i420 +702bc6257a3764ceaed73915c3b434c8 vp80-03-segmentation-1408-352x288-0002.i420 +02610071abfb9564c7c118d5f02a99ae vp80-03-segmentation-1408-352x288-0003.i420 +0e207bebccbabfb1385ea9ccdf5c3bec vp80-03-segmentation-1408-352x288-0004.i420 +c39c73768451c123d60bd16d6afbcc3d vp80-03-segmentation-1408-352x288-0005.i420 +057b46bdf053f7a883b0f6f40c45b07d vp80-03-segmentation-1408-352x288-0006.i420 +daedb4c7faf442946bc5aa65ecc61f48 vp80-03-segmentation-1408-352x288-0007.i420 +dfd006269e51e7e385adbe3260e18aae vp80-03-segmentation-1408-352x288-0008.i420 +b2ce06e97d0288380c78f9402f46783f vp80-03-segmentation-1408-352x288-0009.i420 +6fe7ccf0de58fe1490d7ca6af189aa8b vp80-03-segmentation-1408-352x288-0010.i420 +bb538da277db80de271111ee3a5a67b2 vp80-03-segmentation-1408-352x288-0011.i420 +202c88e05957dd9d839e1772a19bd15c vp80-03-segmentation-1408-352x288-0012.i420 +184cc4abc649fd75eee12a472d949bff vp80-03-segmentation-1408-352x288-0013.i420 +1a3672119f2e20b2aafbb11bec54efda vp80-03-segmentation-1408-352x288-0014.i420 +6d6cd5a9d99aa691b74ef0feb5b688ae vp80-03-segmentation-1408-352x288-0015.i420 +5e76b3fe9042f75471d57328bbb27e7d vp80-03-segmentation-1408-352x288-0016.i420 +b8255a0921fc603f0ff2c6265f1a4999 vp80-03-segmentation-1408-352x288-0017.i420 +d56c06775d6605c829f5e0b43e36c039 vp80-03-segmentation-1408-352x288-0018.i420 +644cd756c994d3268dc93d3a1d598234 vp80-03-segmentation-1408-352x288-0019.i420 +950b4ce41ee99cfe543e1f3105662c8a vp80-03-segmentation-1408-352x288-0020.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1409.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1409.ivf.md5 new file mode 100644 index 0000000..c3e0234 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1409.ivf.md5 @@ -0,0 +1,20 @@ +fc7906f4560e68ba1e1c416243195ccb vp80-03-segmentation-1409-352x288-0001.i420 +702bc6257a3764ceaed73915c3b434c8 vp80-03-segmentation-1409-352x288-0002.i420 +02610071abfb9564c7c118d5f02a99ae vp80-03-segmentation-1409-352x288-0003.i420 +64f197f24ac72d9ecd66187aaea473f2 vp80-03-segmentation-1409-352x288-0004.i420 +56e462cf567264491b1dfe9eed5b767f vp80-03-segmentation-1409-352x288-0005.i420 +d4f29f87013f87c78efcbd58e5cb44f5 vp80-03-segmentation-1409-352x288-0006.i420 +432c9874463e3927c52e548ea66666d0 vp80-03-segmentation-1409-352x288-0007.i420 +11becf0a7087df01b178bcf2dfde7f15 vp80-03-segmentation-1409-352x288-0008.i420 +b2f23ea2ed306b0523608c5ff9c49df2 vp80-03-segmentation-1409-352x288-0009.i420 +25256f1a52e2915e9e38c94c20b17a86 vp80-03-segmentation-1409-352x288-0010.i420 +40965786148ae8df0cd19b976006d38e vp80-03-segmentation-1409-352x288-0011.i420 +4c9f28fc78c877167982df4e6a3f281b vp80-03-segmentation-1409-352x288-0012.i420 +d8c4a68e3466087d5cac6019dfba6303 vp80-03-segmentation-1409-352x288-0013.i420 +19f7d3455087e0702dd8b6a7b94cf3e4 vp80-03-segmentation-1409-352x288-0014.i420 +f7d9964841867af06965b00ff392a657 vp80-03-segmentation-1409-352x288-0015.i420 +0287d5151829d1499f820edb7b99b751 vp80-03-segmentation-1409-352x288-0016.i420 +d2fb21889678c217c11b8b764b631e54 vp80-03-segmentation-1409-352x288-0017.i420 +323af420b0ad40cc22efd1567791286d vp80-03-segmentation-1409-352x288-0018.i420 +39dd4ad98b167264ab3c2b4ecbe9ee4e vp80-03-segmentation-1409-352x288-0019.i420 +599f9be3e55296942d8d5558c92168a7 vp80-03-segmentation-1409-352x288-0020.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1410.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1410.ivf.md5 new file mode 100644 index 0000000..07f6426 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1410.ivf.md5 @@ -0,0 +1,30 @@ +fc7906f4560e68ba1e1c416243195ccb vp80-03-segmentation-1410-352x288-0001.i420 +702bc6257a3764ceaed73915c3b434c8 vp80-03-segmentation-1410-352x288-0002.i420 +02610071abfb9564c7c118d5f02a99ae vp80-03-segmentation-1410-352x288-0003.i420 +7477eb6a0e71d460614cb809e0565295 vp80-03-segmentation-1410-352x288-0004.i420 +2f4cee0630941db2ba751d0d27067cec vp80-03-segmentation-1410-352x288-0005.i420 +b62031d2d33ff5fd67d58e63fbf0efbd vp80-03-segmentation-1410-352x288-0006.i420 +b2c0d0a9dbb5d0c8548bef7e8c6f9fec vp80-03-segmentation-1410-352x288-0007.i420 +46952ef67227c1b6cd894a898960c150 vp80-03-segmentation-1410-352x288-0008.i420 +dcd8345e560c2b9ab081d3416f4846ad vp80-03-segmentation-1410-352x288-0009.i420 +d224ea975b348b91b2e3c37a905b9d22 vp80-03-segmentation-1410-352x288-0010.i420 +de4765a9068b5bfe9a7e382ef6249d39 vp80-03-segmentation-1410-352x288-0011.i420 +bdae01e1fa6219f6f2fda3fd544839d0 vp80-03-segmentation-1410-352x288-0012.i420 +957620789667ee8f4ae276a5fe712600 vp80-03-segmentation-1410-352x288-0013.i420 +f34b8d655647a1fc398a22372152047f vp80-03-segmentation-1410-352x288-0014.i420 +6019c3233c00cfca911c16be59de1688 vp80-03-segmentation-1410-352x288-0015.i420 +69d6c4e3143d0bc697a69723ccdc2199 vp80-03-segmentation-1410-352x288-0016.i420 +25294de7f97d7ca3d5b61cb4c31ffc14 vp80-03-segmentation-1410-352x288-0017.i420 +d2a6828be746965a7a587a0aa0e8271f vp80-03-segmentation-1410-352x288-0018.i420 +19534c7239561f46b8bd0eeadfeee0f4 vp80-03-segmentation-1410-352x288-0019.i420 +a41fcd9f392b180f5e7471b082ceb892 vp80-03-segmentation-1410-352x288-0020.i420 +152a738ee44c7f94b1448bcf59e49597 vp80-03-segmentation-1410-352x288-0021.i420 +03ee78024cb3f9ea66e9ed650f7466ed vp80-03-segmentation-1410-352x288-0022.i420 +7c5f50d7350468a9e899d532f54a0406 vp80-03-segmentation-1410-352x288-0023.i420 +4ce25acfb76ab8532cea59f2b11a5089 vp80-03-segmentation-1410-352x288-0024.i420 +0fec22baf6f174ae726d0d47a5de0b1d vp80-03-segmentation-1410-352x288-0025.i420 +3e77e695266a51aa4418a96aa7d3033b vp80-03-segmentation-1410-352x288-0026.i420 +0abcd4c1872f3dafcc3fc84934e3fb53 vp80-03-segmentation-1410-352x288-0027.i420 +26674772aed297c7af9e62d91dd9e39a vp80-03-segmentation-1410-352x288-0028.i420 +1b1bf4ba265d562b7fe739f34956e0e4 vp80-03-segmentation-1410-352x288-0029.i420 +e00af4a7365cefcda93e781e4d0f7ac6 vp80-03-segmentation-1410-352x288-0030.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1413.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1413.ivf.md5 new file mode 100644 index 0000000..0f718f2 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1413.ivf.md5 @@ -0,0 +1,30 @@ +9e3fb414a3853f97767bfcfcbe35474a vp80-03-segmentation-1413-96x96-0001.i420 +43c5f17cea1520125f6e4b5050c5cc67 vp80-03-segmentation-1413-96x96-0002.i420 +465ca16ad5cfcce5a952629a8c652427 vp80-03-segmentation-1413-96x96-0003.i420 +14740e2f255a8ab60fe6667e552f5dfe vp80-03-segmentation-1413-96x96-0004.i420 +10a1ca2e2c7a0423fadeb5138de8593d vp80-03-segmentation-1413-96x96-0005.i420 +602b329a9f002971e17eba0f75704c11 vp80-03-segmentation-1413-96x96-0006.i420 +d4a42e895c25006bd0f486c19c0ff586 vp80-03-segmentation-1413-96x96-0007.i420 +7c0c07a671421f5c532e210840498cc6 vp80-03-segmentation-1413-96x96-0008.i420 +7c4b96b73c1ef25244b03a10f068baad vp80-03-segmentation-1413-96x96-0009.i420 +0d0742bc71c74cd6de563c939f9554d3 vp80-03-segmentation-1413-96x96-0010.i420 +68b202a1ffec9b2042553e44206f0d06 vp80-03-segmentation-1413-96x96-0011.i420 +a6dba214982071e8581b8b3d8cefce24 vp80-03-segmentation-1413-96x96-0012.i420 +74f8e168182a3862624470fa863d81d1 vp80-03-segmentation-1413-96x96-0013.i420 +c7377df8ebad92dd3fe4c2dbfbbe4ac4 vp80-03-segmentation-1413-96x96-0014.i420 +2d822d021d673175c718c5d2abd2b840 vp80-03-segmentation-1413-96x96-0015.i420 +82f9fc04aa2866ea9b7055171c328317 vp80-03-segmentation-1413-96x96-0016.i420 +35a28307fd5980b8d38b5e34fc1b356c vp80-03-segmentation-1413-96x96-0017.i420 +10420d092c53b958dc6b3c6bea8ef59d vp80-03-segmentation-1413-96x96-0018.i420 +bbae22ff2b8eb281cf657446fe445278 vp80-03-segmentation-1413-96x96-0019.i420 +45a2b1073dedf9e58bcac57edf2dfc7b vp80-03-segmentation-1413-96x96-0020.i420 +9b1b953231d0324607d56604d8fadd6c vp80-03-segmentation-1413-96x96-0021.i420 +3350d05002d813234912a81e375347d4 vp80-03-segmentation-1413-96x96-0022.i420 +1025b471b9c79fce2728c434b012934c vp80-03-segmentation-1413-96x96-0023.i420 +8f516a965b1f1e72bcec515e35b34f17 vp80-03-segmentation-1413-96x96-0024.i420 +73d0fe9646b89f5399081b62e0563f2a vp80-03-segmentation-1413-96x96-0025.i420 +471c4dedc8222ff30014f6b7e61f9e65 vp80-03-segmentation-1413-96x96-0026.i420 +a54483cc912ae7679fb6a8f3284e7da7 vp80-03-segmentation-1413-96x96-0027.i420 +6da4a34eb64e7a80fcbbf0d823670409 vp80-03-segmentation-1413-96x96-0028.i420 +98eba40a248706654f67b6a5c069047c vp80-03-segmentation-1413-96x96-0029.i420 +438ee491bac5e7893d61b065c1f52377 vp80-03-segmentation-1413-96x96-0030.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1414.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1414.ivf.md5 new file mode 100644 index 0000000..63e6459 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1414.ivf.md5 @@ -0,0 +1,30 @@ +86b326657b824f74041a71f6c58d45f2 vp80-03-segmentation-1414-320x240-0001.i420 +7399d9dc81bdf63e7552ad8f59be3a44 vp80-03-segmentation-1414-320x240-0002.i420 +feda0af8355c62b2c7d25b882d3d0cd5 vp80-03-segmentation-1414-320x240-0003.i420 +74b7ceb820d23ff072f2dc8699b7b3fd vp80-03-segmentation-1414-320x240-0004.i420 +51100944a45c042653f52963e85c0304 vp80-03-segmentation-1414-320x240-0005.i420 +6acb03384f7556a884879c71e15ff9d3 vp80-03-segmentation-1414-320x240-0006.i420 +b8fca743257dee3661b45b22be837ec8 vp80-03-segmentation-1414-320x240-0007.i420 +f4f47932bdf5efaecb5f34eda7f0784e vp80-03-segmentation-1414-320x240-0008.i420 +1d4216e91a96382d069ab022c07cdab8 vp80-03-segmentation-1414-320x240-0009.i420 +9756cb733146d622e4129c9449582a9f vp80-03-segmentation-1414-320x240-0010.i420 +ab01528ff0a6920f27984abee86eaff8 vp80-03-segmentation-1414-320x240-0011.i420 +f1ea445051e4877e0e3573f915cc9c92 vp80-03-segmentation-1414-320x240-0012.i420 +1401fa86c42d5c5b1c7055b7f2310286 vp80-03-segmentation-1414-320x240-0013.i420 +7dfda2745b963668b8070616f33c2bb6 vp80-03-segmentation-1414-320x240-0014.i420 +6aa4eb752ccb78cf2738684c2ad94de6 vp80-03-segmentation-1414-320x240-0015.i420 +002e7dd8c3907666eab07995687a593b vp80-03-segmentation-1414-320x240-0016.i420 +1b6c5d0146b1a033f21c6bc323a2342c vp80-03-segmentation-1414-320x240-0017.i420 +6a08caaf167ba61e426ab5b6731374ca vp80-03-segmentation-1414-320x240-0018.i420 +9402e34881d6d5af3c524e1e18459cfb vp80-03-segmentation-1414-320x240-0019.i420 +a3fe2770715ee5a73b81ba4d1d17ac82 vp80-03-segmentation-1414-320x240-0020.i420 +6e369a0de0f02b6775ad35ebb0eb10ca vp80-03-segmentation-1414-320x240-0021.i420 +1bc2c3a7f8fdd652c6e0b91daec63a6d vp80-03-segmentation-1414-320x240-0022.i420 +66a7c8ca4442a0ef0a46f1379d6afc1d vp80-03-segmentation-1414-320x240-0023.i420 +092e806883c2f4b556366b6e66314396 vp80-03-segmentation-1414-320x240-0024.i420 +f36904541c502246bc9561509dc0ab0e vp80-03-segmentation-1414-320x240-0025.i420 +281c60104209a39972614837fbad0f3d vp80-03-segmentation-1414-320x240-0026.i420 +99b2800f587338d41d103bd10470e510 vp80-03-segmentation-1414-320x240-0027.i420 +3aacf4d7735a3bd423ff3c03ee728d56 vp80-03-segmentation-1414-320x240-0028.i420 +695257dd1dc0ee757f5bc17d6bb8bb13 vp80-03-segmentation-1414-320x240-0029.i420 +ccd33afc02bb70e55faf5edd18cd8270 vp80-03-segmentation-1414-320x240-0030.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1415.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1415.ivf.md5 new file mode 100644 index 0000000..ec72c56 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1415.ivf.md5 @@ -0,0 +1,30 @@ +86b326657b824f74041a71f6c58d45f2 vp80-03-segmentation-1415-320x240-0001.i420 +c32f27070a4b1fd1f448a1a0d14f2e6e vp80-03-segmentation-1415-320x240-0002.i420 +307f76e05b1bb643c0a8966a22bffa59 vp80-03-segmentation-1415-320x240-0003.i420 +ff66d82139760be520b51af3187a29db vp80-03-segmentation-1415-320x240-0004.i420 +7cab036d76e861114065ef75e1d5849b vp80-03-segmentation-1415-320x240-0005.i420 +58125d2ad8c4ba3f21efb3b5f145e7ea vp80-03-segmentation-1415-320x240-0006.i420 +f69c82320168e282740da610b7d53966 vp80-03-segmentation-1415-320x240-0007.i420 +cc86c751e306a41e7022e897063b8fdf vp80-03-segmentation-1415-320x240-0008.i420 +07a2735610089eb8b8ded50918cb58cb vp80-03-segmentation-1415-320x240-0009.i420 +a3dcfdea7515c6764734765ea3ac2993 vp80-03-segmentation-1415-320x240-0010.i420 +bc87ee14fe537b7297b92b797eddce0f vp80-03-segmentation-1415-320x240-0011.i420 +73a2a6c37b622b67be7b7627392ac000 vp80-03-segmentation-1415-320x240-0012.i420 +fc3e247e6188097c426bd6f615fb90c4 vp80-03-segmentation-1415-320x240-0013.i420 +b2e94790615d7266b105b3f5cc5ec3fd vp80-03-segmentation-1415-320x240-0014.i420 +cec23ed073eeff49c40661cf2615f551 vp80-03-segmentation-1415-320x240-0015.i420 +f6c541e722b6cb0ee70d59d2cb6aa6dc vp80-03-segmentation-1415-320x240-0016.i420 +a8a2eb380148a9bd6dea86d6bb3a4a13 vp80-03-segmentation-1415-320x240-0017.i420 +c939327ef1abb178cc30d637f8c54d7f vp80-03-segmentation-1415-320x240-0018.i420 +9402e34881d6d5af3c524e1e18459cfb vp80-03-segmentation-1415-320x240-0019.i420 +a3fe2770715ee5a73b81ba4d1d17ac82 vp80-03-segmentation-1415-320x240-0020.i420 +6e369a0de0f02b6775ad35ebb0eb10ca vp80-03-segmentation-1415-320x240-0021.i420 +4f5cf7169528a1623319453a9e498106 vp80-03-segmentation-1415-320x240-0022.i420 +4f2332140d3d228bda028d89f4c6b14c vp80-03-segmentation-1415-320x240-0023.i420 +bda074a4021061f5282052cd30791732 vp80-03-segmentation-1415-320x240-0024.i420 +f36904541c502246bc9561509dc0ab0e vp80-03-segmentation-1415-320x240-0025.i420 +281c60104209a39972614837fbad0f3d vp80-03-segmentation-1415-320x240-0026.i420 +99b2800f587338d41d103bd10470e510 vp80-03-segmentation-1415-320x240-0027.i420 +b6d0d81ddc4c1dc09717c039ea1b7ede vp80-03-segmentation-1415-320x240-0028.i420 +f6a40696a124eea55a0314402a80c581 vp80-03-segmentation-1415-320x240-0029.i420 +1d7a57ed0cba3956df46d691517ea439 vp80-03-segmentation-1415-320x240-0030.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1425.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1425.ivf.md5 new file mode 100644 index 0000000..b340d5f --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1425.ivf.md5 @@ -0,0 +1,14 @@ +414c7d9298764dc6c55eda34fdd0e1bd vp80-03-segmentation-1425-176x144-0001.i420 +37796f21db11019b94e9065b17993098 vp80-03-segmentation-1425-176x144-0002.i420 +3f0caa6019e88885922236fbf159a60d vp80-03-segmentation-1425-176x144-0003.i420 +ec4c947771711ebb38cabe4778ca1e44 vp80-03-segmentation-1425-176x144-0004.i420 +464fb1eb6afa9ad43c0b3b1814f640cd vp80-03-segmentation-1425-212x173-0005.i420 +19e65273049db802ef1a89d397341053 vp80-03-segmentation-1425-212x173-0006.i420 +2db2f9968b49deed68f464c2ab26115d vp80-03-segmentation-1425-212x173-0007.i420 +cee4099543592340270b1be3f4adc5c5 vp80-03-segmentation-1425-212x173-0008.i420 +2f30e74107c4120505f105a07f87dd74 vp80-03-segmentation-1425-212x173-0009.i420 +8967ec5e6b18df38058866509f66031b vp80-03-segmentation-1425-282x231-0010.i420 +82300343b2b600c664cef97cc897ebb0 vp80-03-segmentation-1425-282x231-0011.i420 +6b2f97762a7cf3bb98f0d9ff4e6968cf vp80-03-segmentation-1425-282x231-0012.i420 +71a6c54082ba87f89d44e37f3f201ade vp80-03-segmentation-1425-282x231-0013.i420 +9af73c78cc298e0e6d92423224c35e8c vp80-03-segmentation-1425-282x231-0014.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1426.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1426.ivf.md5 new file mode 100644 index 0000000..6e25dfa --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1426.ivf.md5 @@ -0,0 +1,13 @@ +9dbdbadd7b24d08de2a4f1975c76a9c8 vp80-03-segmentation-1426-352x288-0001.i420 +c490b134c7ae8cbc75ed28316d7159c0 vp80-03-segmentation-1426-352x288-0002.i420 +f8892cfea4484a80881f41d2583a92ad vp80-03-segmentation-1426-352x288-0003.i420 +60aa6ec0b2c0f6deb03ceb53ddc8221f vp80-03-segmentation-1426-352x288-0004.i420 +8779384ed5e447003924bfdc51abb025 vp80-03-segmentation-1426-352x288-0005.i420 +b43445c996e1f664b54fbb9638b5d437 vp80-03-segmentation-1426-352x288-0006.i420 +39f107acf2504d8e353a7253bef8602e vp80-03-segmentation-1426-352x288-0007.i420 +0f45dd7d60257de10619884d2287b122 vp80-03-segmentation-1426-352x288-0008.i420 +d83c6f091a27a46f19939bcf14f993f5 vp80-03-segmentation-1426-352x288-0009.i420 +31436af77d537e00f80896d9c16c9df9 vp80-03-segmentation-1426-352x288-0010.i420 +a8f733e52d609760befe5eea99288ed7 vp80-03-segmentation-1426-352x288-0011.i420 +e8c8201e1f1027bde23d74a57e129ef8 vp80-03-segmentation-1426-352x288-0012.i420 +0c39acff6873896e93eec2113486f6c4 vp80-03-segmentation-1426-352x288-0013.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1427.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1427.ivf.md5 new file mode 100644 index 0000000..b6355b6 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1427.ivf.md5 @@ -0,0 +1,12 @@ +4d3eae9b5f8816765e727a1c54d4932a vp80-03-segmentation-1427-352x288-0001.i420 +c7121baa74341909e5571ec41678735f vp80-03-segmentation-1427-352x288-0002.i420 +bca61a3d73ed79baa9d65aac52fce8a2 vp80-03-segmentation-1427-352x288-0003.i420 +b919fe293998b549e8352b7a581880e0 vp80-03-segmentation-1427-352x288-0004.i420 +c375995906cf96004e653237c6e01344 vp80-03-segmentation-1427-352x288-0005.i420 +98a48318895e65fe5e90fc865f1c7f3c vp80-03-segmentation-1427-352x288-0006.i420 +6c85b1defeadd27d139837cdeba4e504 vp80-03-segmentation-1427-352x288-0007.i420 +fb0147af1da120e3480bca83d9cc744b vp80-03-segmentation-1427-352x288-0008.i420 +3e3fd6c3574ef00357570c2dfae758ac vp80-03-segmentation-1427-352x288-0009.i420 +879f0c93f75fbc2c7cc43ae8c177132e vp80-03-segmentation-1427-352x288-0010.i420 +e0a8dfb44ce28e95e8655df3110cdcb3 vp80-03-segmentation-1427-352x288-0011.i420 +7c154ba270084523a772ee0992ba8117 vp80-03-segmentation-1427-352x288-0012.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1432.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1432.ivf.md5 new file mode 100644 index 0000000..663704a --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1432.ivf.md5 @@ -0,0 +1,10 @@ +da71784871e53a2afd58cef8742a3328 vp80-03-segmentation-1432-352x288-0001.i420 +2e74b74d39c53bf5aeb70059d7c3f066 vp80-03-segmentation-1432-352x288-0002.i420 +a7ef9a33116e7f268a9d0353c72b7eec vp80-03-segmentation-1432-352x288-0003.i420 +c978f04c55e4eac8858448bba3566bb0 vp80-03-segmentation-1432-352x288-0004.i420 +a507fe4e90ec54a2b0895d1c6952d8fd vp80-03-segmentation-1432-352x288-0005.i420 +93a07eebf28a2056f99f1c4ddf5f97c1 vp80-03-segmentation-1432-352x288-0006.i420 +91eac571b73feccd7f00c516b3cb6c77 vp80-03-segmentation-1432-352x288-0007.i420 +71b16d414340ee078327f0fecab94e96 vp80-03-segmentation-1432-352x288-0008.i420 +4929d24a4b459bb40db45b1e2c50b53e vp80-03-segmentation-1432-352x288-0009.i420 +d7d6bd890dd1be1db24c6fb3862e76a9 vp80-03-segmentation-1432-352x288-0010.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1435.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1435.ivf.md5 new file mode 100644 index 0000000..2470bd7 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1435.ivf.md5 @@ -0,0 +1,13 @@ +d11362811a2d7b7cfc16455507e67dc0 vp80-03-segmentation-1435-352x288-0001.i420 +0b23298e4fa8aa271565c24c2623cae0 vp80-03-segmentation-1435-352x288-0002.i420 +679b21c2d5a12c6c65a83d3018ed17e0 vp80-03-segmentation-1435-352x288-0003.i420 +c7b4c759a006a7377b5ac83431fad2b6 vp80-03-segmentation-1435-352x288-0004.i420 +12a97331d01f248de4618c3868cd0256 vp80-03-segmentation-1435-352x288-0005.i420 +e9507dae7e7531e93998b61517c0b52d vp80-03-segmentation-1435-352x288-0006.i420 +1e418492ef8a725dc89ef282a8104f50 vp80-03-segmentation-1435-352x288-0007.i420 +812d0acd34fead519bbd4ffd5fb165ff vp80-03-segmentation-1435-352x288-0008.i420 +343096fa722cf323b0a3ce6249e56d2e vp80-03-segmentation-1435-352x288-0009.i420 +2cf4ad94c598296e4be117965248367b vp80-03-segmentation-1435-352x288-0010.i420 +572b2258e59b63bc7d7da0345710fbfa vp80-03-segmentation-1435-352x288-0011.i420 +b3886bcfb8f00738cc8330981fc96f27 vp80-03-segmentation-1435-352x288-0012.i420 +7759b9beaec852805f2138b40a42bd9a vp80-03-segmentation-1435-352x288-0013.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1436.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1436.ivf.md5 new file mode 100644 index 0000000..52e2be0 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1436.ivf.md5 @@ -0,0 +1,2 @@ +44ed1dfb57028e6cd6ce6a1caab507b8 vp80-03-segmentation-1436-352x288-0001.i420 +3226bbf3c5153251971507f12a2be82a vp80-03-segmentation-1436-282x231-0002.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1437.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1437.ivf.md5 new file mode 100644 index 0000000..6770b03 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1437.ivf.md5 @@ -0,0 +1,15 @@ +302654961919ccd6eb2b6115a5948ba4 vp80-03-segmentation-1437-352x288-0001.i420 +2e87e0e4656b42808e09e43863867a64 vp80-03-segmentation-1437-352x288-0002.i420 +e9d2e4365ddeef5762dae759aa9d72af vp80-03-segmentation-1437-352x288-0003.i420 +058b8fbab2ec0ff0a5ccfebf408e98a7 vp80-03-segmentation-1437-352x288-0004.i420 +f9d75fdda6c4e69232106d3b43550df1 vp80-03-segmentation-1437-352x288-0005.i420 +d36f34b75416b8466dcf0bc4e9adb8c5 vp80-03-segmentation-1437-352x288-0006.i420 +ead7c5b7843ec7d2ec2ba69c773d14ee vp80-03-segmentation-1437-352x288-0007.i420 +69d6c8c90e7ce64f9f0548b2668d2f49 vp80-03-segmentation-1437-352x288-0008.i420 +4d7db70268f8349dff383fb139d8bbda vp80-03-segmentation-1437-352x288-0009.i420 +e5408ea98e610d99f90ca3fbe4207adc vp80-03-segmentation-1437-352x288-0010.i420 +30ca1cfed72e9dba86a528d574567305 vp80-03-segmentation-1437-352x288-0011.i420 +e6a85645e604eb218e9648c7214c1479 vp80-03-segmentation-1437-352x288-0012.i420 +e80799a748cd5ba4ca6c586e8773cf03 vp80-03-segmentation-1437-352x288-0013.i420 +9fd81b260767d9500806fc70a8a4730c vp80-03-segmentation-1437-352x288-0014.i420 +5c4ec5c95330d3c81e4ff498fc3199e2 vp80-03-segmentation-1437-352x288-0015.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1441.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1441.ivf.md5 new file mode 100644 index 0000000..c551823 --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1441.ivf.md5 @@ -0,0 +1,14 @@ +02071dd6b597fdb533d9cd2d3583b0ca vp80-03-segmentation-1441-352x288-0001.i420 +392745b581e77c88597ae7bbd80bdb3e vp80-03-segmentation-1441-352x288-0002.i420 +8acfd7d8d8885e35083f825403f8b592 vp80-03-segmentation-1441-352x288-0003.i420 +4fc11e16d74cd58797fdf9432e2cdc5f vp80-03-segmentation-1441-352x288-0004.i420 +155aeb8d3da4d2f13623eac4a8f8fbe5 vp80-03-segmentation-1441-352x288-0005.i420 +c64174f73ee9b0ba4c041e115a80b2bf vp80-03-segmentation-1441-352x288-0006.i420 +9a43417f36f1e14fd648972c758caad5 vp80-03-segmentation-1441-352x288-0007.i420 +a7390cd1bdba9a49d080a2c8fc2e51d2 vp80-03-segmentation-1441-352x288-0008.i420 +3d9f008821a5c14ea828e84058aa6bcc vp80-03-segmentation-1441-352x288-0009.i420 +9c3654fab423e8a4b1c747149fe9ff7e vp80-03-segmentation-1441-352x288-0010.i420 +abeaa9ca867705b53eeffc27d8571976 vp80-03-segmentation-1441-352x288-0011.i420 +5b54250ee60896d04ce82302ec530d9c vp80-03-segmentation-1441-352x288-0012.i420 +f4d969a0ea694c058f4841d499136d7e vp80-03-segmentation-1441-352x288-0013.i420 +ec538a185ab700f05a89bd6a25f26cc9 vp80-03-segmentation-1441-352x288-0014.i420 diff --git a/testdata/libvpx/vp80-03-segmentation-1442.ivf.md5 b/testdata/libvpx/vp80-03-segmentation-1442.ivf.md5 new file mode 100644 index 0000000..01ff31f --- /dev/null +++ b/testdata/libvpx/vp80-03-segmentation-1442.ivf.md5 @@ -0,0 +1,13 @@ +3099c130869de3cb48f9946a895e0e66 vp80-03-segmentation-1442-352x288-0001.i420 +38103341ed0c7309dd12b27f89086690 vp80-03-segmentation-1442-352x288-0002.i420 +6f1f906967f0b23ba840ec2dd8686f25 vp80-03-segmentation-1442-352x288-0003.i420 +2be59e4f48f484d69bac9c3b1841b01e vp80-03-segmentation-1442-352x288-0004.i420 +c28694304799fd9c189622fe485bc5ec vp80-03-segmentation-1442-352x288-0005.i420 +18d153847e2e243edac65b67a6a6440c vp80-03-segmentation-1442-352x288-0006.i420 +951e16f416613d6129935fe57a72fd3a vp80-03-segmentation-1442-352x288-0007.i420 +5d8fd80ffe20584656c26e876368a3b7 vp80-03-segmentation-1442-352x288-0008.i420 +7f97665ce3d71619c344c8722145b8de vp80-03-segmentation-1442-352x288-0009.i420 +3386368e34ad5dcf96bdefa7053274b6 vp80-03-segmentation-1442-352x288-0010.i420 +867fe4ab98ab2a93ca0a7e21ea8f6077 vp80-03-segmentation-1442-352x288-0011.i420 +0edd44986d6cf02d3d04c9d9b92f597a vp80-03-segmentation-1442-352x288-0012.i420 +b56a7d97acf87f61bbbd910dd3bee02c vp80-03-segmentation-1442-352x288-0013.i420 diff --git a/testdata/libvpx/vp80-04-partitions-1404.ivf.md5 b/testdata/libvpx/vp80-04-partitions-1404.ivf.md5 new file mode 100644 index 0000000..10a17da --- /dev/null +++ b/testdata/libvpx/vp80-04-partitions-1404.ivf.md5 @@ -0,0 +1,20 @@ +f6bf9ee8cacfe78711b794ef217fad3a vp80-04-partitions-1404-176x144-0001.i420 +7388ed03cf502fff8b2c95013943641c vp80-04-partitions-1404-176x144-0002.i420 +e61af9d26723cbd3a07e7cb28264f0e0 vp80-04-partitions-1404-176x144-0003.i420 +fb0f04b0a2af9cb835b8aca5d73d3eea vp80-04-partitions-1404-176x144-0004.i420 +bab7ab0f8dca7b29190652173b8fcd55 vp80-04-partitions-1404-176x144-0005.i420 +ead765480a5645c7994fa02a3211472d vp80-04-partitions-1404-176x144-0006.i420 +06ae2733b5de55e88a7053fa3905f90b vp80-04-partitions-1404-176x144-0007.i420 +b38b5b1227514dfd2a57c556e52cfe7c vp80-04-partitions-1404-176x144-0008.i420 +186582f7607fc54604bcdb4b5df501e6 vp80-04-partitions-1404-176x144-0009.i420 +868a308b2ee12530487bd9933184d941 vp80-04-partitions-1404-176x144-0010.i420 +900f37d19a15258a2cbcf0cf8e18907a vp80-04-partitions-1404-176x144-0011.i420 +78f6e07afbdc69b2fc24ef3f41d1d7d2 vp80-04-partitions-1404-176x144-0012.i420 +21a8638d1ceef828e6ea0b6bf82da23e vp80-04-partitions-1404-176x144-0013.i420 +e334a1daa66bf6db4cd588974ea28eb8 vp80-04-partitions-1404-176x144-0014.i420 +d93c351321efee8a7962af686c564b28 vp80-04-partitions-1404-176x144-0015.i420 +cc83636092d59a6c81a8358232f16f99 vp80-04-partitions-1404-176x144-0016.i420 +ef3085518587bf1393b53ff75211b290 vp80-04-partitions-1404-176x144-0017.i420 +ae574f967d4ed38f743c1685d717f17e vp80-04-partitions-1404-176x144-0018.i420 +7a51369b286a13f56df1e03901cfe5a9 vp80-04-partitions-1404-176x144-0019.i420 +ab8a76a7cd776aa789a306a37f29ee9b vp80-04-partitions-1404-176x144-0020.i420 diff --git a/testdata/libvpx/vp80-04-partitions-1405.ivf.md5 b/testdata/libvpx/vp80-04-partitions-1405.ivf.md5 new file mode 100644 index 0000000..edcd511 --- /dev/null +++ b/testdata/libvpx/vp80-04-partitions-1405.ivf.md5 @@ -0,0 +1,20 @@ +f6bf9ee8cacfe78711b794ef217fad3a vp80-04-partitions-1405-176x144-0001.i420 +7388ed03cf502fff8b2c95013943641c vp80-04-partitions-1405-176x144-0002.i420 +3990dbf9b170bf8c15b48e19a166fd6c vp80-04-partitions-1405-176x144-0003.i420 +0ef2885654831d926723a04923ffb776 vp80-04-partitions-1405-176x144-0004.i420 +a877d5f1fbc24e8d20c37e19162e695c vp80-04-partitions-1405-176x144-0005.i420 +8b5d4d3b2e4d7a9ccf94ab4cb03ddbe2 vp80-04-partitions-1405-176x144-0006.i420 +cbe5ae7e8dc43a717978e8462e4abc1a vp80-04-partitions-1405-176x144-0007.i420 +8d5e2e62c0e128f3d88e04a901943410 vp80-04-partitions-1405-176x144-0008.i420 +6ce75ac3d6c61f5b9a8fce1cc94ecd96 vp80-04-partitions-1405-176x144-0009.i420 +e3a99202d0215f31cc9a6b186e411903 vp80-04-partitions-1405-176x144-0010.i420 +56a607e54c282581cecafb38b6268809 vp80-04-partitions-1405-176x144-0011.i420 +49a2cac707c65c9bea3ce6709a792260 vp80-04-partitions-1405-176x144-0012.i420 +d27496d737b7e5351e65fabc9a4e4abe vp80-04-partitions-1405-176x144-0013.i420 +9c0c49c2d1b657cc448d844e80707da2 vp80-04-partitions-1405-176x144-0014.i420 +c3f1eea63c4d1bf1520a00a1fcff33f9 vp80-04-partitions-1405-176x144-0015.i420 +ec42e91b3ca56476ca52d811bb24230d vp80-04-partitions-1405-176x144-0016.i420 +6407d566392d5060ebb54e29327d2e4d vp80-04-partitions-1405-176x144-0017.i420 +328ed84a3260bc98b166a0a0c0c27541 vp80-04-partitions-1405-176x144-0018.i420 +d41af216335e688cdf90512cc53aa99f vp80-04-partitions-1405-176x144-0019.i420 +f122e9150fcd07e256e79dae2e8bcb24 vp80-04-partitions-1405-176x144-0020.i420 diff --git a/testdata/libvpx/vp80-04-partitions-1406.ivf.md5 b/testdata/libvpx/vp80-04-partitions-1406.ivf.md5 new file mode 100644 index 0000000..011b23f --- /dev/null +++ b/testdata/libvpx/vp80-04-partitions-1406.ivf.md5 @@ -0,0 +1,20 @@ +f6bf9ee8cacfe78711b794ef217fad3a vp80-04-partitions-1406-176x144-0001.i420 +7388ed03cf502fff8b2c95013943641c vp80-04-partitions-1406-176x144-0002.i420 +3990dbf9b170bf8c15b48e19a166fd6c vp80-04-partitions-1406-176x144-0003.i420 +5a427ebf7468c08c7f261dc4cd89f62f vp80-04-partitions-1406-176x144-0004.i420 +d7ea8dff2dc5ac4d0a6fed163f000384 vp80-04-partitions-1406-176x144-0005.i420 +1c9440a2fa48e5f03a0464b0ca7b2f8e vp80-04-partitions-1406-176x144-0006.i420 +a82076c48a8e39054ff08739b97c43c2 vp80-04-partitions-1406-176x144-0007.i420 +6fed41ac39658b161c5db87bb731856a vp80-04-partitions-1406-176x144-0008.i420 +4d2f80ed79a790c431a2812c3f057bab vp80-04-partitions-1406-176x144-0009.i420 +73e9f675e1d73c05dd31ec0154f3225d vp80-04-partitions-1406-176x144-0010.i420 +fe1382bea3f76d668014abff0d3de7f9 vp80-04-partitions-1406-176x144-0011.i420 +65b667cf1d84b7259e4a411059809d83 vp80-04-partitions-1406-176x144-0012.i420 +12f0b63876cd6e52d7d0c1bb71302654 vp80-04-partitions-1406-176x144-0013.i420 +2cbe922073282aea70cfeaf402322297 vp80-04-partitions-1406-176x144-0014.i420 +cca094b2081c5c76d95df9935c191bd2 vp80-04-partitions-1406-176x144-0015.i420 +94f8f151edf56636f4ce8f973d400ceb vp80-04-partitions-1406-176x144-0016.i420 +acf21934fde3cb405885a784f1bae02d vp80-04-partitions-1406-176x144-0017.i420 +7dbe116bc86da136b6c00b262ac5946a vp80-04-partitions-1406-176x144-0018.i420 +8959a3325ff0e5c9a04540c6362aa003 vp80-04-partitions-1406-176x144-0019.i420 +6f3d145876c7f597e20abef9d7ec09de vp80-04-partitions-1406-176x144-0020.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1428.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1428.ivf.md5 new file mode 100644 index 0000000..7b021a8 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1428.ivf.md5 @@ -0,0 +1,13 @@ +4b761fd4bad0a897790f1a3ea3e77418 vp80-05-sharpness-1428-352x288-0001.i420 +e4b804e34f6555b96c050a7d19d2638d vp80-05-sharpness-1428-352x288-0002.i420 +62aa23f3d4a27e3fc89499eeb4e69da1 vp80-05-sharpness-1428-352x288-0003.i420 +70f4a5c20f3c7e73c9aefc01d397565c vp80-05-sharpness-1428-352x288-0004.i420 +efe64ba2292dbf76d1eb48153f39d48e vp80-05-sharpness-1428-352x288-0005.i420 +7e48fa9a7958a524b80de3815915ae01 vp80-05-sharpness-1428-352x288-0006.i420 +46b13e0e6a2ebcdfc27cb7a17fea9659 vp80-05-sharpness-1428-352x288-0007.i420 +b10d8abf376f40d74dd055f7304bd592 vp80-05-sharpness-1428-352x288-0008.i420 +83e79ecdb9c7b8249291df6a8aa64c7c vp80-05-sharpness-1428-352x288-0009.i420 +2db12acf3786458c4c4073b51b63a629 vp80-05-sharpness-1428-352x288-0010.i420 +0e62bab84b44e98f591ba76b526bf704 vp80-05-sharpness-1428-352x288-0011.i420 +b339602d9422e419c25b24713b079e59 vp80-05-sharpness-1428-352x288-0012.i420 +88161231dae923c0ebae1f835504ab2c vp80-05-sharpness-1428-352x288-0013.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1429.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1429.ivf.md5 new file mode 100644 index 0000000..51a5269 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1429.ivf.md5 @@ -0,0 +1,12 @@ +80bb723c921963e9d885c3aa86e27f75 vp80-05-sharpness-1429-352x288-0001.i420 +a2a8a85599817ae4f7a9de21ef9daa41 vp80-05-sharpness-1429-352x288-0002.i420 +e5ef52d047e4a50a29056dc43f076d74 vp80-05-sharpness-1429-352x288-0003.i420 +1f05f5540c86e9867b5619fd3062b5b7 vp80-05-sharpness-1429-352x288-0004.i420 +2ab0c1d4d7f515b35b47f5b9fbae7fec vp80-05-sharpness-1429-352x288-0005.i420 +4f1f847992757ccc3ed26c2eaa882033 vp80-05-sharpness-1429-352x288-0006.i420 +1626308d1a4c0d9df5e4f885a4194bb7 vp80-05-sharpness-1429-352x288-0007.i420 +c124ea072cd1c6ad345449e7c73b7fe4 vp80-05-sharpness-1429-352x288-0008.i420 +a6365989d9cfc876d7263315a4ccbe96 vp80-05-sharpness-1429-352x288-0009.i420 +bd690592fd4777ebe2a3f15d77dc1f1d vp80-05-sharpness-1429-352x288-0010.i420 +f2af06c5dbbd7353321c5e9ab781e72e vp80-05-sharpness-1429-352x288-0011.i420 +ee43a9c0850c485b2f3b2e7942ab57ab vp80-05-sharpness-1429-352x288-0012.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1430.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1430.ivf.md5 new file mode 100644 index 0000000..9cd8e01 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1430.ivf.md5 @@ -0,0 +1,14 @@ +cd89b5ee26c8fb5d0dd63d90a2d4676b vp80-05-sharpness-1430-352x288-0001.i420 +cd89b5ee26c8fb5d0dd63d90a2d4676b vp80-05-sharpness-1430-352x288-0002.i420 +cd89b5ee26c8fb5d0dd63d90a2d4676b vp80-05-sharpness-1430-352x288-0003.i420 +cd89b5ee26c8fb5d0dd63d90a2d4676b vp80-05-sharpness-1430-352x288-0004.i420 +a867fb406038135604751b05879f887c vp80-05-sharpness-1430-352x288-0005.i420 +b5b611cd802975877dd9ee8f56ca1d0f vp80-05-sharpness-1430-352x288-0006.i420 +0ff27a892b6ada7f1b9a3d7b73ec2a23 vp80-05-sharpness-1430-352x288-0007.i420 +d5d6627e414b32a56212fbf2dd90ada7 vp80-05-sharpness-1430-352x288-0008.i420 +e6682737f43fe78d88a3e80232cf1e53 vp80-05-sharpness-1430-352x288-0009.i420 +40b6a845f71974f46df94fc9089f9750 vp80-05-sharpness-1430-352x288-0010.i420 +f3e9f49e2b6bcb9f00b1c1aa3a75db58 vp80-05-sharpness-1430-352x288-0011.i420 +500c7519e237ae964ccb4e51f1fe8c6a vp80-05-sharpness-1430-352x288-0012.i420 +0d593f660136c5836b6689fe8d6eda97 vp80-05-sharpness-1430-352x288-0013.i420 +1acbad331cbaa12dbcd31b575f4a7369 vp80-05-sharpness-1430-352x288-0014.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1431.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1431.ivf.md5 new file mode 100644 index 0000000..501b525 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1431.ivf.md5 @@ -0,0 +1,12 @@ +fde9f00f2225ee16119c7bd9aba95e8f vp80-05-sharpness-1431-352x288-0001.i420 +a3b9c3a81e554143d796b955287ce394 vp80-05-sharpness-1431-352x288-0002.i420 +3fd3dcd15e1c1feceb797423acc84279 vp80-05-sharpness-1431-352x288-0003.i420 +73e8d0581ecd597b631c44c87538df4c vp80-05-sharpness-1431-352x288-0004.i420 +a1ad02d87c8097fcb6849ad1f3175a99 vp80-05-sharpness-1431-352x288-0005.i420 +22987509b24eb85ab822b109a9c30134 vp80-05-sharpness-1431-352x288-0006.i420 +50f0792ddab06f5b2b5d1ea046b0dc2f vp80-05-sharpness-1431-352x288-0007.i420 +0410fd7cf0dd8c808f31f4ace3a2a528 vp80-05-sharpness-1431-352x288-0008.i420 +e5825a2a8b80e99c488c79c0d6bb06b9 vp80-05-sharpness-1431-352x288-0009.i420 +5c471ac607f398b5ab9675be7db1d617 vp80-05-sharpness-1431-352x288-0010.i420 +30221012329b586bdd30aed9965574e7 vp80-05-sharpness-1431-352x288-0011.i420 +09c8c8573cbd498a61d11bbfd1d903bc vp80-05-sharpness-1431-352x288-0012.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1433.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1433.ivf.md5 new file mode 100644 index 0000000..2d93efc --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1433.ivf.md5 @@ -0,0 +1,13 @@ +44ed1dfb57028e6cd6ce6a1caab507b8 vp80-05-sharpness-1433-352x288-0001.i420 +29cc0d824048f48dafc6d30463beeec3 vp80-05-sharpness-1433-352x288-0002.i420 +db154a02a9c82d16608c6e5515e56229 vp80-05-sharpness-1433-352x288-0003.i420 +4120fdb6f5d80ed64802528abbb58d72 vp80-05-sharpness-1433-352x288-0004.i420 +b77331ee232eec3a1669b4a2e3a90551 vp80-05-sharpness-1433-352x288-0005.i420 +69a93d67eb09e55d0d2c53f1882166eb vp80-05-sharpness-1433-352x288-0006.i420 +f4a886ae796f3a2ec90fb6a0e909db7c vp80-05-sharpness-1433-352x288-0007.i420 +403df7b674fe6df540eff4106343f1c0 vp80-05-sharpness-1433-352x288-0008.i420 +282cee55e69581e6f23b864bd4c9b7c7 vp80-05-sharpness-1433-352x288-0009.i420 +226811bea41b649b9390078880fcbfa4 vp80-05-sharpness-1433-352x288-0010.i420 +1002e96ccc2c245b63efa553a1ca5413 vp80-05-sharpness-1433-352x288-0011.i420 +e425f4979e33d064886865ca414e57a9 vp80-05-sharpness-1433-352x288-0012.i420 +905a74de189cbbfc0273fc1a02f905e5 vp80-05-sharpness-1433-352x288-0013.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1434.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1434.ivf.md5 new file mode 100644 index 0000000..14e6f95 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1434.ivf.md5 @@ -0,0 +1,15 @@ +c974c57b86a9953a11976aa3bbd4486b vp80-05-sharpness-1434-352x288-0001.i420 +b620a5b8e5dd84c1807ab15be90911fe vp80-05-sharpness-1434-352x288-0002.i420 +acff92046386dadbb82a20254d459895 vp80-05-sharpness-1434-352x288-0003.i420 +f8a01f5fc8c3b97176f580869d06445d vp80-05-sharpness-1434-352x288-0004.i420 +952b8c3d469350a9044ad9e6ddda2450 vp80-05-sharpness-1434-352x288-0005.i420 +8a22d7f281ca27f08fc0952fa9dba048 vp80-05-sharpness-1434-352x288-0006.i420 +5cd787c9324f38a0cec2d729eff1c9b9 vp80-05-sharpness-1434-352x288-0007.i420 +318bb3c9fef19056676cc59d4c5829e4 vp80-05-sharpness-1434-352x288-0008.i420 +6544454b81375fc55acdb3c0a23b5cef vp80-05-sharpness-1434-352x288-0009.i420 +2d904ae6a9bf261f9fb4f40430845bfa vp80-05-sharpness-1434-352x288-0010.i420 +3e69e37e5e9b9b87073cd1e2f3d15087 vp80-05-sharpness-1434-352x288-0011.i420 +121bce3cbe88cafb5992909d58e0eaf3 vp80-05-sharpness-1434-352x288-0012.i420 +29f840bdd1170e22145ce48829b69097 vp80-05-sharpness-1434-352x288-0013.i420 +704729e22abd88f6b164bbcccafb1d60 vp80-05-sharpness-1434-352x288-0014.i420 +5c495b9400bf1285d40e825412a3b53d vp80-05-sharpness-1434-352x288-0015.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1438.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1438.ivf.md5 new file mode 100644 index 0000000..73b4e00 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1438.ivf.md5 @@ -0,0 +1,11 @@ +7150f392cb757d528ced58da272ed8c7 vp80-05-sharpness-1438-352x288-0001.i420 +bf1a9c79ea5d1013badc53501da4c340 vp80-05-sharpness-1438-352x288-0002.i420 +af9aacad4e131ad9290d841bb400d80d vp80-05-sharpness-1438-352x288-0003.i420 +73fb51057d75cd064f1598d6ad2f78cc vp80-05-sharpness-1438-352x288-0004.i420 +c71726683f80909ab18d5ed2456e619f vp80-05-sharpness-1438-352x288-0005.i420 +52a2dae9a2a83de953c51f5d52a4d9f5 vp80-05-sharpness-1438-352x288-0006.i420 +8680f06d677a33537383a62533220e2a vp80-05-sharpness-1438-352x288-0007.i420 +058694162eeaf2538415b96c44b7a6f6 vp80-05-sharpness-1438-352x288-0008.i420 +eacb58bf30a6d823086449403767566e vp80-05-sharpness-1438-352x288-0009.i420 +97d0d067b59ba977e6073cf16864bd1b vp80-05-sharpness-1438-352x288-0010.i420 +78f19e4f3d1b276e2eaa55e3055f97f2 vp80-05-sharpness-1438-352x288-0011.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1439.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1439.ivf.md5 new file mode 100644 index 0000000..33f4830 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1439.ivf.md5 @@ -0,0 +1,15 @@ +9fdd433ef7e48c9a9c47a52af7bcfb47 vp80-05-sharpness-1439-352x288-0001.i420 +0d48e4d193f8f7965f2938d8e1971997 vp80-05-sharpness-1439-352x288-0003.i420 +bcd2fb4b7e2cc05bf7f849cb4ea72a77 vp80-05-sharpness-1439-352x288-0004.i420 +3ed2abad2ae23646d7be21237980f878 vp80-05-sharpness-1439-352x288-0005.i420 +508713a03c7d9c890239e9939161b68b vp80-05-sharpness-1439-352x288-0006.i420 +4c26c442d2146f292c62e9736d3cc588 vp80-05-sharpness-1439-352x288-0007.i420 +53450569679f0aa19a4ab411f80edd57 vp80-05-sharpness-1439-352x288-0008.i420 +2e8ec607190953cf9338c24333876193 vp80-05-sharpness-1439-352x288-0009.i420 +27cb77dfa2db9755bac901c0ffe340da vp80-05-sharpness-1439-352x288-0010.i420 +55e1fefac9034daf6e5a08d45e22ec53 vp80-05-sharpness-1439-352x288-0011.i420 +bb41a75a3de7355056c13e7497887170 vp80-05-sharpness-1439-352x288-0012.i420 +3c2d6a4ac15634d691cc2b83a2a3b46f vp80-05-sharpness-1439-352x288-0013.i420 +afa600b0ac6678615f3d7846d2225d8c vp80-05-sharpness-1439-352x288-0014.i420 +9278361cc5fa67358d724e0b48e81488 vp80-05-sharpness-1439-352x288-0015.i420 +8e93a902bbc0fd66bb35a3a7ab5e3be4 vp80-05-sharpness-1439-352x288-0016.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1440.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1440.ivf.md5 new file mode 100644 index 0000000..c3ecaf0 --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1440.ivf.md5 @@ -0,0 +1,13 @@ +44ed1dfb57028e6cd6ce6a1caab507b8 vp80-05-sharpness-1440-352x288-0001.i420 +1c5ed03cdc99978adad6392c2745a68a vp80-05-sharpness-1440-352x288-0002.i420 +e07059e6296854458576d6dcf061fd44 vp80-05-sharpness-1440-352x288-0003.i420 +e96846318c0d29f4ce469684281edc21 vp80-05-sharpness-1440-352x288-0004.i420 +461e09c29838a2addb63a89b9ffdc8ab vp80-05-sharpness-1440-352x288-0005.i420 +6687d324eb58ffaa0d652fac0bbb4b60 vp80-05-sharpness-1440-352x288-0006.i420 +5c606822ab408f7ec8d8d533b842bab8 vp80-05-sharpness-1440-352x288-0007.i420 +9c2a0561c9605dc235a1b7b9ca5a5e3e vp80-05-sharpness-1440-352x288-0008.i420 +020825c0e38b45d01fc14959396cda8f vp80-05-sharpness-1440-352x288-0009.i420 +b2d22674ad667cb98b036c199ed828ee vp80-05-sharpness-1440-352x288-0010.i420 +9794d5e2a8de9d3c7e73941a5ee053b1 vp80-05-sharpness-1440-352x288-0011.i420 +75aeb4838901ced6d8cfa036f0590815 vp80-05-sharpness-1440-352x288-0012.i420 +be34271c25688531527e6fcc72ba7051 vp80-05-sharpness-1440-352x288-0013.i420 diff --git a/testdata/libvpx/vp80-05-sharpness-1443.ivf.md5 b/testdata/libvpx/vp80-05-sharpness-1443.ivf.md5 new file mode 100644 index 0000000..0e6bddb --- /dev/null +++ b/testdata/libvpx/vp80-05-sharpness-1443.ivf.md5 @@ -0,0 +1,8 @@ +422da402610c203be2cf67da9f4afc50 vp80-05-sharpness-1443-1920x96-0001.i420 +3498e9f8deba3d1db0865ab9669bd7d8 vp80-05-sharpness-1443-1920x96-0002.i420 +36c74aac8e1bbf561f672385ff7c9a4f vp80-05-sharpness-1443-1920x96-0003.i420 +d5bd1ffd856ac40f877e1d9b450ef8ca vp80-05-sharpness-1443-1920x96-0004.i420 +3ee0ec18408b177747dc093752933cdc vp80-05-sharpness-1443-1920x96-0005.i420 +f0895db59366ab6a92fa058646cdf727 vp80-05-sharpness-1443-1920x96-0006.i420 +15c6a815dc554555f0f6b581f528b829 vp80-05-sharpness-1443-1920x96-0007.i420 +67845f2e5fc3ac14ba055a03bc43b328 vp80-05-sharpness-1443-1920x96-0008.i420 diff --git a/testdata/libvpx/vp80-06-smallsize.ivf.md5 b/testdata/libvpx/vp80-06-smallsize.ivf.md5 new file mode 100644 index 0000000..d327a8c --- /dev/null +++ b/testdata/libvpx/vp80-06-smallsize.ivf.md5 @@ -0,0 +1,360 @@ +21bf22853b4c68b6bd2dcb58e7d8e6fe vp80-06-smallsize-16x16-0001.i420 +ee34c1e2f44ac8b29c9849562c320a38 vp80-06-smallsize-16x16-0002.i420 +f850a56a8a94e76202fab9969829057b vp80-06-smallsize-16x16-0003.i420 +5b5b6ad4ceac4bf797aa923ce64f4338 vp80-06-smallsize-16x16-0004.i420 +3e0670739a9d64a12f0ad51a6309be44 vp80-06-smallsize-16x16-0005.i420 +1df4a35d62ea240e8c93e83437380ff2 vp80-06-smallsize-16x16-0006.i420 +b5e1d68db1ff90bae071b6f7d8ac418d vp80-06-smallsize-16x16-0007.i420 +1985eba1484d3f90832fb7151bf3ddb1 vp80-06-smallsize-16x16-0008.i420 +45dc58b52816ed1a8043ae371be6bbb9 vp80-06-smallsize-16x16-0009.i420 +e8d7a996673b8101a3177addd17012fa vp80-06-smallsize-16x16-0010.i420 +29fe15ce0cde661c122d4c99c87dc50b vp80-06-smallsize-16x16-0011.i420 +ba0dcadc1b1106d217a9175b521a6182 vp80-06-smallsize-16x16-0012.i420 +66b0f901cfae2b16b953ffeea88d3a41 vp80-06-smallsize-16x16-0013.i420 +484f381ed86f877c24ab5a110a1906e7 vp80-06-smallsize-16x16-0014.i420 +9f386cbf48b2c9d650b27a9adde588ea vp80-06-smallsize-16x16-0015.i420 +55be13543b18a4244544b46659883160 vp80-06-smallsize-16x16-0016.i420 +eb439518638e0fe9568070151ca76a1d vp80-06-smallsize-16x16-0017.i420 +6001f58277f65fb48537e453275bd86e vp80-06-smallsize-16x16-0018.i420 +d672e4af89db08361aa70f85f60e5146 vp80-06-smallsize-16x16-0019.i420 +b0e8789af41a70eb32f2c34bb488c4cc vp80-06-smallsize-16x16-0020.i420 +a75ad2b7519577a4f37a078a897872c5 vp80-06-smallsize-16x16-0021.i420 +ed0940744722bfec21b0b9c7ecf0373f vp80-06-smallsize-16x16-0022.i420 +a927b62a5e848c269ae89f5d0e162695 vp80-06-smallsize-16x16-0023.i420 +7e60d456092d991d3d5b380280b878a1 vp80-06-smallsize-16x16-0024.i420 +17bbb406b67d4ae8aeeca896444544b6 vp80-06-smallsize-16x16-0025.i420 +a8b1b02ee592bce75b371a3d08d492af vp80-06-smallsize-16x16-0026.i420 +d4fcf9254af7f35cc6722540ed330b97 vp80-06-smallsize-16x16-0027.i420 +60f83c1ce3154b15350ea57f55cad589 vp80-06-smallsize-16x16-0028.i420 +c375504e90cb98dd9d813f7a5cc3cd2b vp80-06-smallsize-16x16-0029.i420 +c56e7910a2795d570242ca931ca0c21c vp80-06-smallsize-16x16-0030.i420 +345319476b84895208b5713f9908a557 vp80-06-smallsize-16x16-0031.i420 +9029f78870121e06310b1e309503cbaa vp80-06-smallsize-16x16-0032.i420 +e99dd521d72de2488b6f399d69af2966 vp80-06-smallsize-16x16-0033.i420 +69589097728647a6a384f3f899b8d4b9 vp80-06-smallsize-16x16-0034.i420 +ade75dc566e229bb06a8b797ceac7926 vp80-06-smallsize-16x16-0035.i420 +42807f45ac2f10e855e373202f7573e6 vp80-06-smallsize-16x16-0036.i420 +8e272abc194e18fad7ccacf17678e963 vp80-06-smallsize-16x16-0037.i420 +25a6e304bbe917e144e182cf89c9c5fb vp80-06-smallsize-16x16-0038.i420 +7bd535f82729fedaf952a126a1f60f4f vp80-06-smallsize-16x16-0039.i420 +29bbdb77a5c6cc15edb15d77122e67cc vp80-06-smallsize-16x16-0040.i420 +86c999d90d31a9a6c86b121686d46ed7 vp80-06-smallsize-16x16-0041.i420 +2fbe22e4504b625d18cd944af89b97e6 vp80-06-smallsize-16x16-0042.i420 +b9c270e0a84fe614ef57211e332bd213 vp80-06-smallsize-16x16-0043.i420 +29f0c1196ee2a230aa4abbd4039ec5c2 vp80-06-smallsize-16x16-0044.i420 +12eb6aafa50335b3e22b88a59ae1abcf vp80-06-smallsize-16x16-0045.i420 +fe107168ef3879ac9d8cb08d2c322602 vp80-06-smallsize-16x16-0046.i420 +39ecedfb362a7e6f081fbc7c5b8b2427 vp80-06-smallsize-16x16-0047.i420 +aaf126ba3943c3dcdf6fb1d73a5c1aca vp80-06-smallsize-16x16-0048.i420 +c65b431b38bfce3cc108b77211c0dc79 vp80-06-smallsize-16x16-0049.i420 +3d772ca951148b47ad82947fa7f14d46 vp80-06-smallsize-16x16-0050.i420 +1192b37944597db83824964da7732c0f vp80-06-smallsize-16x16-0051.i420 +4444a35c40a84041625750333f940111 vp80-06-smallsize-16x16-0052.i420 +d67df60c129ba1bc6813e8ef9b008f99 vp80-06-smallsize-16x16-0053.i420 +cc02b639d555cb53acbee09ee6966417 vp80-06-smallsize-16x16-0054.i420 +c97e337f23992ba853b53296705b19e4 vp80-06-smallsize-16x16-0055.i420 +f1e2dfd2f0d48d161419c1ee3cf0a3e1 vp80-06-smallsize-16x16-0056.i420 +f9269e490b48e29a573e21fc92f6d983 vp80-06-smallsize-16x16-0057.i420 +dad586da3e855bbab1096974d22f560a vp80-06-smallsize-16x16-0058.i420 +2dbfb5d6a8e42a08727ddccfe0447ba1 vp80-06-smallsize-16x16-0059.i420 +7ac8741e44a4d0a87f30e731cb3e5678 vp80-06-smallsize-16x16-0060.i420 +45409e7ea99d68332e5cac95d42125e7 vp80-06-smallsize-16x16-0061.i420 +4e23d261a963244861d0a716da2a81df vp80-06-smallsize-16x16-0062.i420 +a18a0967504fa481245fd4dad10a929f vp80-06-smallsize-16x16-0063.i420 +b2f2b5053f2873c3f283b29bc216508b vp80-06-smallsize-16x16-0064.i420 +a0bba5b29612f7a0f719d796d038775e vp80-06-smallsize-16x16-0065.i420 +442aa8a7e462ee5a134cd1efdc55ed5b vp80-06-smallsize-16x16-0066.i420 +7f174649c220ec54a510feef79b01d05 vp80-06-smallsize-16x16-0067.i420 +00c394d3298f42adcf1b118e96df7858 vp80-06-smallsize-16x16-0068.i420 +84f49f80d1493f74b89bb77807c2b8dc vp80-06-smallsize-16x16-0069.i420 +e94d5612f3babbd9282aeaeb7cc63778 vp80-06-smallsize-16x16-0070.i420 +e94d5612f3babbd9282aeaeb7cc63778 vp80-06-smallsize-16x16-0071.i420 +e94d5612f3babbd9282aeaeb7cc63778 vp80-06-smallsize-16x16-0072.i420 +0d2f56f1905ba3fa426b22c4516f5716 vp80-06-smallsize-16x16-0073.i420 +0d2f56f1905ba3fa426b22c4516f5716 vp80-06-smallsize-16x16-0074.i420 +e94d5612f3babbd9282aeaeb7cc63778 vp80-06-smallsize-16x16-0075.i420 +abaf16217a8e0f97e77fce4abb5c3416 vp80-06-smallsize-16x16-0076.i420 +5cf1e125952f8308f057914dc9b5dcfc vp80-06-smallsize-16x16-0077.i420 +d793d566e0c1ee3555a157ab326f5fb8 vp80-06-smallsize-16x16-0078.i420 +d793d566e0c1ee3555a157ab326f5fb8 vp80-06-smallsize-16x16-0079.i420 +774c1d070350a027c5bfc51e95c027da vp80-06-smallsize-16x16-0080.i420 +76739d20ecf58048048f040db7e4aa80 vp80-06-smallsize-16x16-0081.i420 +76739d20ecf58048048f040db7e4aa80 vp80-06-smallsize-16x16-0082.i420 +7f9860e0101f9e3518f8df78d95cc991 vp80-06-smallsize-16x16-0083.i420 +4aeab2390afc4db690ce186a625fd054 vp80-06-smallsize-16x16-0084.i420 +3b6f6a906bde62164e7c71fa57e15e44 vp80-06-smallsize-16x16-0085.i420 +e8b53739f0fbe81dbbcb31f552fcc259 vp80-06-smallsize-16x16-0086.i420 +8875fe4fe7372d50c7e2d2880d76fff6 vp80-06-smallsize-16x16-0087.i420 +9db403539a386642500a58d7a871d352 vp80-06-smallsize-16x16-0088.i420 +d3d6a83c0c1702b214c28d2fc78b82af vp80-06-smallsize-16x16-0089.i420 +4bdb1edd41dc5cd6ff911970ac8b0d65 vp80-06-smallsize-16x16-0090.i420 +679bbb9cf00e72182b0336e818d485f1 vp80-06-smallsize-16x16-0091.i420 +78e5a07e4b5538db4fc251380aae1cdf vp80-06-smallsize-16x16-0092.i420 +385e4293a1ea802a7a49201a5a4e61b3 vp80-06-smallsize-16x16-0093.i420 +f3bebd799be65e7e9e82d79bdc0f0c89 vp80-06-smallsize-16x16-0094.i420 +54c0e0f38c007fdd6c555129b01dee47 vp80-06-smallsize-16x16-0095.i420 +4f06f98331153e76ef72a09327886512 vp80-06-smallsize-16x16-0096.i420 +b49cfad213ff650bd8d28154cecd836b vp80-06-smallsize-16x16-0097.i420 +b4b404acddea9bee28995d88df14f1e0 vp80-06-smallsize-16x16-0098.i420 +279af6c4c61af513206c49f967a11d0a vp80-06-smallsize-16x16-0099.i420 +604429e2e41d5ca850258460bccde1ae vp80-06-smallsize-16x16-0100.i420 +80c60769badc1da146c377606ea8a54f vp80-06-smallsize-16x16-0101.i420 +82525c5b0f9919aa65655cd05a5e7620 vp80-06-smallsize-16x16-0102.i420 +d3f3a40acd456c4ff0a40d15247af0ca vp80-06-smallsize-16x16-0103.i420 +eba309010b235e63a7f67cdbf010585c vp80-06-smallsize-16x16-0104.i420 +296227536cff54d8d9bd31bdf455613d vp80-06-smallsize-16x16-0105.i420 +504a7c725380e912b7e96269cdbe402a vp80-06-smallsize-16x16-0106.i420 +4d3afa477f52fcf4e9cd0cf891c57d2e vp80-06-smallsize-16x16-0107.i420 +576e55955a77dd1cc95d027c3a82eea4 vp80-06-smallsize-16x16-0108.i420 +516c889f1e9619e21d22a109d4012bbd vp80-06-smallsize-16x16-0109.i420 +4b18bf1b659aa9144355a3fd43ea41d2 vp80-06-smallsize-16x16-0110.i420 +c33391d26c1a01a00f0fc0a979818315 vp80-06-smallsize-16x16-0111.i420 +e3328066677830fc5dce11e7441d548e vp80-06-smallsize-16x16-0112.i420 +19e7d261745aa5e55541ce027a80787e vp80-06-smallsize-16x16-0113.i420 +82bd8f498cc1ac81b2daa934b3d5e652 vp80-06-smallsize-16x16-0114.i420 +641788cc2dafaa6d685f8b55b793d5bf vp80-06-smallsize-16x16-0115.i420 +50282b98bf1fe5a7791436534afcdbc6 vp80-06-smallsize-16x16-0116.i420 +7754a810d19ab88fb93c9b0f5b87b1e0 vp80-06-smallsize-16x16-0117.i420 +c393955ab670f92f6ce5bcac769e7dd1 vp80-06-smallsize-16x16-0118.i420 +9c732c21e391f63e878834a4e736351e vp80-06-smallsize-16x16-0119.i420 +54d29a0f4ba50c9ceb6651e4dce71286 vp80-06-smallsize-16x16-0120.i420 +d9f0fc5d636a9f2491fcfc8dfa7aec8a vp80-06-smallsize-16x16-0121.i420 +692952f3809d526a38d42244e57808db vp80-06-smallsize-16x16-0122.i420 +58e68b53749faaa4d1d49a5e696acf7d vp80-06-smallsize-16x16-0123.i420 +d9193a5855c3fe79868e35426d3feca1 vp80-06-smallsize-16x16-0124.i420 +c2beb7ab6b3d70d16bcc50d9028e77ef vp80-06-smallsize-16x16-0125.i420 +e472eb91ae02f91f599d91a2ae3158e3 vp80-06-smallsize-16x16-0126.i420 +506f23fb222ecd38c51a2f90726f0418 vp80-06-smallsize-16x16-0127.i420 +d577b9ab0b8e0abab109ee522219b8d7 vp80-06-smallsize-16x16-0128.i420 +7b287efc7702a541834534537b78aaf5 vp80-06-smallsize-16x16-0129.i420 +571ac8835bc1b6d5ff0b04da3014a90c vp80-06-smallsize-16x16-0130.i420 +22e2742aea096b9fafce69d0a8166d2c vp80-06-smallsize-16x16-0131.i420 +907de0f5c5cb5a5fcf65f3e56979b681 vp80-06-smallsize-16x16-0132.i420 +e20ec4b9fad8e5fc9c801aec6b1fe2e0 vp80-06-smallsize-16x16-0133.i420 +db92d94f391659a8af36fced8475b280 vp80-06-smallsize-16x16-0134.i420 +247ad715c7c332d899d5aa6186c9705f vp80-06-smallsize-16x16-0135.i420 +e600f0081064bcec905d470c014928a0 vp80-06-smallsize-16x16-0136.i420 +b32c6735e5c6793a3801c85b4dae2c6a vp80-06-smallsize-16x16-0137.i420 +e131bdf5127dc83bdf7970eb9138776f vp80-06-smallsize-16x16-0138.i420 +fc8eee7781eae30cd1601656775fc9f1 vp80-06-smallsize-16x16-0139.i420 +d3374f21640a9b22d4dfd0ee2ea8d08c vp80-06-smallsize-16x16-0140.i420 +35620ea2f3a57bed0252d79d9d81abe6 vp80-06-smallsize-16x16-0141.i420 +8914b34b636e4985275992254f0bc5fb vp80-06-smallsize-16x16-0142.i420 +f5230eed0aa8dd3599c3bd2467bd40b0 vp80-06-smallsize-16x16-0143.i420 +9ff0390ca17a075b12f577e0644ade8b vp80-06-smallsize-16x16-0144.i420 +4062d671b0d589f9e5f613b248e663ec vp80-06-smallsize-16x16-0145.i420 +cbd82bd2340557b51c0c26cba69a5692 vp80-06-smallsize-16x16-0146.i420 +8973278b4ddd64ce79c40a834f84d8c0 vp80-06-smallsize-16x16-0147.i420 +7c4cedc6d8e071741deeb15f1e222e89 vp80-06-smallsize-16x16-0148.i420 +5bf1ea48607f95ae198ebc6451da3f5a vp80-06-smallsize-16x16-0149.i420 +dd6dac93b1f1b31e041155656e0c3374 vp80-06-smallsize-16x16-0150.i420 +3c153b643e9235430e1debe72fffb82d vp80-06-smallsize-16x16-0151.i420 +4b7e20dcdc0254e52f024e8e99942f8f vp80-06-smallsize-16x16-0152.i420 +8a919638b51f20d89878c5e482d9c532 vp80-06-smallsize-16x16-0153.i420 +7021d4e4bb1b9fc9331984b09930819d vp80-06-smallsize-16x16-0154.i420 +67b98acced623bd6eb33386d18731bed vp80-06-smallsize-16x16-0155.i420 +9e7f90435c323c3edf9361f04d766621 vp80-06-smallsize-16x16-0156.i420 +883a4dd739351f70e3d97040f5222864 vp80-06-smallsize-16x16-0157.i420 +883a4dd739351f70e3d97040f5222864 vp80-06-smallsize-16x16-0158.i420 +883a4dd739351f70e3d97040f5222864 vp80-06-smallsize-16x16-0159.i420 +883a4dd739351f70e3d97040f5222864 vp80-06-smallsize-16x16-0160.i420 +8347f2d78969047f1f4d71c2c9416194 vp80-06-smallsize-16x16-0161.i420 +217346be95161f98c46a83b3d1212d8e vp80-06-smallsize-16x16-0162.i420 +e5ab39eed57231b7ccbfd7b4375d06e8 vp80-06-smallsize-16x16-0163.i420 +c244a06dc1468ecc8b0c9e9d2786f795 vp80-06-smallsize-16x16-0164.i420 +85e431fe142b843f8fa202f1b5c4f691 vp80-06-smallsize-16x16-0165.i420 +a954dacc36355fa685f6777ef942c004 vp80-06-smallsize-16x16-0166.i420 +7ff2dc8990555f8e1d47e82e3a77ff36 vp80-06-smallsize-16x16-0167.i420 +f7c8224ca6cccf22535dcfe687224305 vp80-06-smallsize-16x16-0168.i420 +6703782266c35247a512450b47212aa9 vp80-06-smallsize-16x16-0169.i420 +aaf40098cd5e503dfa912c88a3b9fdbe vp80-06-smallsize-16x16-0170.i420 +a1a2d225928b99779c97b09240eacb54 vp80-06-smallsize-16x16-0171.i420 +f0c3ad2702560245ea68c838cce54846 vp80-06-smallsize-16x16-0172.i420 +378a993cf77b6af42c300b56d4da69c6 vp80-06-smallsize-16x16-0173.i420 +b03590805ae8997e7a2a3506811f4fdf vp80-06-smallsize-16x16-0174.i420 +a2c276d5fc21b19f6a30aae23255463c vp80-06-smallsize-16x16-0175.i420 +34dd70da066f83ed4009c77eda20e9da vp80-06-smallsize-16x16-0176.i420 +73557483a13e45aad31b3e7ab448c9b7 vp80-06-smallsize-16x16-0177.i420 +53abdf89d5b5d7bb8222ce322143585c vp80-06-smallsize-16x16-0178.i420 +1ded0c1e24123606081ca8262f12f9b8 vp80-06-smallsize-16x16-0179.i420 +38ea135688a506ba68693b77507829c1 vp80-06-smallsize-16x16-0180.i420 +e92f76d49b81a7f10e0c2b56d8a82f57 vp80-06-smallsize-16x16-0181.i420 +090aa4aae6a66d82c283084f77b2437c vp80-06-smallsize-16x16-0182.i420 +c84bd7538e0d3a14851bcc787c69bcdd vp80-06-smallsize-16x16-0183.i420 +5ebac5c74138e2dc41aaeaa085c34051 vp80-06-smallsize-16x16-0184.i420 +40607209bdd076d60625166fad53bdd7 vp80-06-smallsize-16x16-0185.i420 +aadeb98306aa2ed7081c2c719bce5f2e vp80-06-smallsize-16x16-0186.i420 +32930f70495d422d69558b6dd6fa33cd vp80-06-smallsize-16x16-0187.i420 +79127ecd940f8f046999fa636c7b93ef vp80-06-smallsize-16x16-0188.i420 +47d9a86a887c4792e7c11429283fc8d5 vp80-06-smallsize-16x16-0189.i420 +225088b7707ebfb5b15fc1331fbf1d69 vp80-06-smallsize-16x16-0190.i420 +8bcdc1c7318d858e0b76528bf97bfae6 vp80-06-smallsize-16x16-0191.i420 +78b57629f4d05bf69bbc968ada73153b vp80-06-smallsize-16x16-0192.i420 +052f11fdf8742b4207840d6ad83216cf vp80-06-smallsize-16x16-0193.i420 +5669fad11ab448a8ce78d23ff20381d9 vp80-06-smallsize-16x16-0194.i420 +34bd8c3eeb53b2a849dc1d3b274b53a5 vp80-06-smallsize-16x16-0195.i420 +881d4b94bcc3665a63fa4f5fab904ac3 vp80-06-smallsize-16x16-0196.i420 +8ea1d68ea9b938fa2b7641582ca849f0 vp80-06-smallsize-16x16-0197.i420 +33a7a251b8b6e144b86026095cda2850 vp80-06-smallsize-16x16-0198.i420 +f0d8f5d04a358d6e08d719dd2484a3ec vp80-06-smallsize-16x16-0199.i420 +f583798f1f5acd30342c58f482fed46a vp80-06-smallsize-16x16-0200.i420 +fd22fc192f59b1271b4f0265c2d10588 vp80-06-smallsize-16x16-0201.i420 +bd769d7e807bad8bbd4d55128a67cc53 vp80-06-smallsize-16x16-0202.i420 +700c21ada024dae24113c5e502a83e76 vp80-06-smallsize-16x16-0203.i420 +a395df1869538ae53de4a1bad12f86d7 vp80-06-smallsize-16x16-0204.i420 +7344be493d7842535472178f3ae4586c vp80-06-smallsize-16x16-0205.i420 +a2666422abb8c8c86edacdc1a3d41c1e vp80-06-smallsize-16x16-0206.i420 +fce3cf56ef98fbc546575ddf678997a8 vp80-06-smallsize-16x16-0207.i420 +b9676fe73ef3f6fdcd95d18d6cd8f4a7 vp80-06-smallsize-16x16-0208.i420 +8e7787ffad5b67533a0b5c8052edd82a vp80-06-smallsize-16x16-0209.i420 +2348b6c0f734327abbef7cf9318746b1 vp80-06-smallsize-16x16-0210.i420 +bf3b0a3e011dbf78d8a1a2fc64205786 vp80-06-smallsize-16x16-0211.i420 +0421e8861814f12d559d8f97acfce53e vp80-06-smallsize-16x16-0212.i420 +3797ff8ee3decea541100e0f8b3272cc vp80-06-smallsize-16x16-0213.i420 +85015585f276d9249bdf96274e3db8c7 vp80-06-smallsize-16x16-0214.i420 +19beffc0ba2f8b85f0b9bdcd54fa7cf7 vp80-06-smallsize-16x16-0215.i420 +25e99ea0be3ce90a221d0ebef4d7930f vp80-06-smallsize-16x16-0216.i420 +a5842c3c631063a5d23147d13eeb69d7 vp80-06-smallsize-16x16-0217.i420 +6130a90075161fa0f9d1d9d2aeab762a vp80-06-smallsize-16x16-0218.i420 +3332acaab21586f550bc31bbaf43269c vp80-06-smallsize-16x16-0219.i420 +3fd97b055d9416ce0815a5042561d351 vp80-06-smallsize-16x16-0220.i420 +ccae9068c16b9e3e4f5e14305d822a8c vp80-06-smallsize-16x16-0221.i420 +069aec9eea2768a2e82a6e349e4dc291 vp80-06-smallsize-16x16-0222.i420 +04016b9dff55386f0975ad2dd29b8f60 vp80-06-smallsize-16x16-0223.i420 +43347544ee0cbd16bf60da99dd570b98 vp80-06-smallsize-16x16-0224.i420 +aaf0d327a9658f4a4589de4f267762d8 vp80-06-smallsize-16x16-0225.i420 +1f145f0218c72eb0ea164da00f861793 vp80-06-smallsize-16x16-0226.i420 +c3817783a9deb4dc2bb8d31f4c2a8ef6 vp80-06-smallsize-16x16-0227.i420 +56098b765a226376b4c10928404eaad3 vp80-06-smallsize-16x16-0228.i420 +37a622c36e153facaac9c9f85c82af2f vp80-06-smallsize-16x16-0229.i420 +a0687b5040bfcd696503e87e61a81ba8 vp80-06-smallsize-16x16-0230.i420 +f643c92b1925ce7ce86794b48d2609d8 vp80-06-smallsize-16x16-0231.i420 +c25a561113dc841e320e20db1f24aac0 vp80-06-smallsize-16x16-0232.i420 +12f126f3939a1c0f33b16932a55027a5 vp80-06-smallsize-16x16-0233.i420 +a7c21d9ac52e25f74b5f085a70f8d994 vp80-06-smallsize-16x16-0234.i420 +2a204449cc72918802caafd72d47f82e vp80-06-smallsize-16x16-0235.i420 +aa3ebf37fdeb2055d32e81b0df627f3b vp80-06-smallsize-16x16-0236.i420 +89fb8c849e9ad95b192f27509e69839d vp80-06-smallsize-16x16-0237.i420 +8fe965297aea089a6656ee820865da07 vp80-06-smallsize-16x16-0238.i420 +83d247f4ce3779ee3e7c8befbddf4b7d vp80-06-smallsize-16x16-0239.i420 +7204210953ed67522eb5f438b735d6fa vp80-06-smallsize-16x16-0240.i420 +91a49c7fdcf58a87b99dc709d235154a vp80-06-smallsize-16x16-0241.i420 +80bc3f5b446c7d303b5896e467c52c47 vp80-06-smallsize-16x16-0242.i420 +a331a5a0ab70223512230816ff263e99 vp80-06-smallsize-16x16-0243.i420 +de95db047fc8d734ffc5a678f7d16422 vp80-06-smallsize-16x16-0244.i420 +5c930ea107155bbd170996fbf85ed44d vp80-06-smallsize-16x16-0245.i420 +643e58e0a10e0286ce5e5d4a140c7100 vp80-06-smallsize-16x16-0246.i420 +643e58e0a10e0286ce5e5d4a140c7100 vp80-06-smallsize-16x16-0247.i420 +ae8841fcc22d69527cf2ffcd7042eb02 vp80-06-smallsize-16x16-0248.i420 +ec6c670baa4afa0820e7c236da3ed8a1 vp80-06-smallsize-16x16-0249.i420 +2adc986635824aa4edecbe5073143c1d vp80-06-smallsize-16x16-0250.i420 +c088a719bf2d1351c5a8415f4bdb4d1a vp80-06-smallsize-16x16-0251.i420 +b362d705fbacaa164860d30b54de91ec vp80-06-smallsize-16x16-0252.i420 +e164258767bb2f8bad421c99948bdc03 vp80-06-smallsize-16x16-0253.i420 +e164258767bb2f8bad421c99948bdc03 vp80-06-smallsize-16x16-0254.i420 +19834d60ebda2c826c363c033da4e5dd vp80-06-smallsize-16x16-0255.i420 +161c0024e6f20c0d93929c093065894b vp80-06-smallsize-16x16-0256.i420 +a7848e8dd85604af32ccd3b312332c5b vp80-06-smallsize-16x16-0257.i420 +3a67129acb8255b1198cc3f62f8ae067 vp80-06-smallsize-16x16-0258.i420 +6d308492b38bcbbc6bd22ed2431f10b2 vp80-06-smallsize-16x16-0259.i420 +57e9b6d4f63a7afefc81b883f1ce3132 vp80-06-smallsize-16x16-0260.i420 +5d2fddd76a83c5a4b361b72506f222ce vp80-06-smallsize-16x16-0261.i420 +5d2fddd76a83c5a4b361b72506f222ce vp80-06-smallsize-16x16-0262.i420 +ed54f9b38445950a07631c3741a52720 vp80-06-smallsize-16x16-0263.i420 +369713bfd17b991003840a55d548229c vp80-06-smallsize-16x16-0264.i420 +25a0f4179701bb81756505d358fa1802 vp80-06-smallsize-16x16-0265.i420 +25a0f4179701bb81756505d358fa1802 vp80-06-smallsize-16x16-0266.i420 +25a0f4179701bb81756505d358fa1802 vp80-06-smallsize-16x16-0267.i420 +f2610c5b90d7e00da31c50e7eb541871 vp80-06-smallsize-16x16-0268.i420 +c730f1319bd6b9668f5f1a5350b85a8b vp80-06-smallsize-16x16-0269.i420 +877e95ce21fd22d461e2d1e76c785b57 vp80-06-smallsize-16x16-0270.i420 +7d7cd6e404099c78f1926d92e3d7e954 vp80-06-smallsize-16x16-0271.i420 +49e3563f8011db9473db6fe5db3d2fed vp80-06-smallsize-16x16-0272.i420 +5da8b9eda6b5070736c3a54ae52c643b vp80-06-smallsize-16x16-0273.i420 +9dd48a3a8acabde4a07a5dd445c8bfc9 vp80-06-smallsize-16x16-0274.i420 +714fa970db0c82aff490cbfa4bd69cb7 vp80-06-smallsize-16x16-0275.i420 +fb1de1c1c2e0528103f0b910a95a569c vp80-06-smallsize-16x16-0276.i420 +b4bcef56995478943e99d81ed5166f9c vp80-06-smallsize-16x16-0277.i420 +fd105615211bc9898fe0c00fa58924d4 vp80-06-smallsize-16x16-0278.i420 +f11655c73bba3208a31a1aabe2c14db5 vp80-06-smallsize-16x16-0279.i420 +f27e9e2b31158acab2cb079512ebe824 vp80-06-smallsize-16x16-0280.i420 +e98d00aab58eac90663904509e4e3743 vp80-06-smallsize-16x16-0281.i420 +c729294512e0c89a72f025d3b975bcb3 vp80-06-smallsize-16x16-0282.i420 +027868db93693dd7cc64fe366e0f5795 vp80-06-smallsize-16x16-0283.i420 +d113acc28975231d2b5bf7f08c529f0f vp80-06-smallsize-16x16-0284.i420 +9573081c0d8ae769fd613c75e7091f10 vp80-06-smallsize-16x16-0285.i420 +0a754b349fa34de5ee1b30ef36d1aa45 vp80-06-smallsize-16x16-0286.i420 +0924bdafb55f6825389c6210a3338f4d vp80-06-smallsize-16x16-0287.i420 +5252be89df52aebc997afc65ea12f7df vp80-06-smallsize-16x16-0288.i420 +f397e081227522dd2ebb4451ce4f8376 vp80-06-smallsize-16x16-0289.i420 +2cd9e6c737c89bd1f698aa0ddc9e66b3 vp80-06-smallsize-16x16-0290.i420 +bc112f970d244b2050f2b62f0280027b vp80-06-smallsize-16x16-0291.i420 +c0e16c53342c2b0946488ad02d935439 vp80-06-smallsize-16x16-0292.i420 +4233ac4554f50f2f7f79270c6bc876cb vp80-06-smallsize-16x16-0293.i420 +e9a5e7320e88152d06585b0ee378ff8b vp80-06-smallsize-16x16-0294.i420 +2c9cf67eacfe8322ca0f046204f1587c vp80-06-smallsize-16x16-0295.i420 +02ebb5a2fde6f13c21fa5cc31183b35a vp80-06-smallsize-16x16-0296.i420 +e281b65b1124512c0c5d10b538e02d08 vp80-06-smallsize-16x16-0297.i420 +e7f4ad8700f2a96596b5355a54c71796 vp80-06-smallsize-16x16-0298.i420 +1629287083e712d93d0346c933b8a3be vp80-06-smallsize-16x16-0299.i420 +2dec9e5438ad6edcd0bba4fa0f08cb91 vp80-06-smallsize-16x16-0300.i420 +754c963c82096eb4155b7589dcdde6f6 vp80-06-smallsize-16x16-0301.i420 +591330fac89d41d1988b4638cb55f744 vp80-06-smallsize-16x16-0302.i420 +50456c044f2264e9127211ff861cea5c vp80-06-smallsize-16x16-0303.i420 +5c7f0744f11f8178357a770cc8952bda vp80-06-smallsize-16x16-0304.i420 +8584d8be13b0c4377479838035efe208 vp80-06-smallsize-16x16-0305.i420 +d53ade9f811105e24a8ac6ef49b64d13 vp80-06-smallsize-16x16-0306.i420 +e20d43657b1637c77f870dea5afbcc76 vp80-06-smallsize-16x16-0307.i420 +394bc1010ffc94b3ee32c3efb613f58a vp80-06-smallsize-16x16-0308.i420 +289fb0217bc2bea6424d41d0813b7e1a vp80-06-smallsize-16x16-0309.i420 +4ce104f34af0b3638cb9f2e0fa18b5f3 vp80-06-smallsize-16x16-0310.i420 +f59dcd4f7861bdf65b028625a6f95393 vp80-06-smallsize-16x16-0311.i420 +14b3d2bf64c94da777ed504a444c70e3 vp80-06-smallsize-16x16-0312.i420 +6f468b8d024e5a663213eb8a1668ff4e vp80-06-smallsize-16x16-0313.i420 +33d62a51a63ed2401d5b31782c160c7d vp80-06-smallsize-16x16-0314.i420 +f661433a4b220e0bc0225c1593b935c1 vp80-06-smallsize-16x16-0315.i420 +148b6310741a7de3e4b9abdb9d602bb4 vp80-06-smallsize-16x16-0316.i420 +3993b2bd425890ed8707c578aa82270e vp80-06-smallsize-16x16-0317.i420 +ea7ae7c6db269886d3686e7de3ebbaf1 vp80-06-smallsize-16x16-0318.i420 +31d255dc39117a006d378b3cbaa827de vp80-06-smallsize-16x16-0319.i420 +5b0f8b5a4fbea206ba376f09b19d318a vp80-06-smallsize-16x16-0320.i420 +ad610182cad0099b930a35f90506f26d vp80-06-smallsize-16x16-0321.i420 +f3586e4cfbcf8153b1d51782706f29ff vp80-06-smallsize-16x16-0322.i420 +f4bd7dca03eaad64cc800e41440b78e5 vp80-06-smallsize-16x16-0323.i420 +e7a50e5fc11c4146d44514d2b710ce43 vp80-06-smallsize-16x16-0324.i420 +500ed71bc07b5c1c3cf39faf0f60310d vp80-06-smallsize-16x16-0325.i420 +92f0a53774e60302521aa71521e21f56 vp80-06-smallsize-16x16-0326.i420 +4fae6b608874e0f0ec7ef0c12d982733 vp80-06-smallsize-16x16-0327.i420 +d4eafda9209fa6a2d293181cfa1f6f73 vp80-06-smallsize-16x16-0328.i420 +2542ec377f8cb22fa6e146f847cd5326 vp80-06-smallsize-16x16-0329.i420 +81a1af877ad07d0fe0c4c255e5f91615 vp80-06-smallsize-16x16-0330.i420 +5e356821e3ccd912cad1d8d72e3b995d vp80-06-smallsize-16x16-0331.i420 +a235c0190317e275b1f2bb144ef96088 vp80-06-smallsize-16x16-0332.i420 +bc59651de2ebb0392ae6ff978b7de759 vp80-06-smallsize-16x16-0333.i420 +2c07ffdf8b3af9a9bedc5c25fca558b1 vp80-06-smallsize-16x16-0334.i420 +c8ba80e4f1735fc83b5ad524eac36422 vp80-06-smallsize-16x16-0335.i420 +2bc5c23d956d045cec0339e221dabf13 vp80-06-smallsize-16x16-0336.i420 +eba388f3a937fe9d0e5c2e48c97ef137 vp80-06-smallsize-16x16-0337.i420 +eba388f3a937fe9d0e5c2e48c97ef137 vp80-06-smallsize-16x16-0338.i420 +eba388f3a937fe9d0e5c2e48c97ef137 vp80-06-smallsize-16x16-0339.i420 +521ec0ae5affc2a27e577551f0889dc2 vp80-06-smallsize-16x16-0340.i420 +521ec0ae5affc2a27e577551f0889dc2 vp80-06-smallsize-16x16-0341.i420 +799f82525e69cdfa7ad2f68db13370d8 vp80-06-smallsize-16x16-0342.i420 +799f82525e69cdfa7ad2f68db13370d8 vp80-06-smallsize-16x16-0343.i420 +799f82525e69cdfa7ad2f68db13370d8 vp80-06-smallsize-16x16-0344.i420 +b2e0c785feeb240aab9ce64f3c968661 vp80-06-smallsize-16x16-0345.i420 +b2e0c785feeb240aab9ce64f3c968661 vp80-06-smallsize-16x16-0346.i420 +bd5f6e0851327d2955fb1afc9bccaeda vp80-06-smallsize-16x16-0347.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0348.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0349.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0350.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0351.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0352.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0353.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0354.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0355.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0356.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0357.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0358.i420 +4fc6e3d3b36a9dff86c890685547cbce vp80-06-smallsize-16x16-0359.i420 +09f6da54d62bde706adafa6a39235085 vp80-06-smallsize-16x16-0360.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-00.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-00.webm.md5 new file mode 100644 index 0000000..aa90d5a --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-00.webm.md5 @@ -0,0 +1,2 @@ +c3fbb7abbdb5bd4ed4a7e34768c17df1 vp90-2-00-quantizer-00-352x288-0001.i420 +08203c2595bdb2d58ead6f921345d699 vp90-2-00-quantizer-00-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-01.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-01.webm.md5 new file mode 100644 index 0000000..85e12ba --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-01.webm.md5 @@ -0,0 +1,2 @@ +f041b870cf9236d5f22e2b08a77d5958 vp90-2-00-quantizer-01-352x288-0001.i420 +cbdb7526986ae15592891488c9afc84c vp90-2-00-quantizer-01-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-02.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-02.webm.md5 new file mode 100644 index 0000000..e1bbcaa --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-02.webm.md5 @@ -0,0 +1,2 @@ +98048cfdb4af5059f4085c5acc94ef8f vp90-2-00-quantizer-02-352x288-0001.i420 +8160183e1eed1d0af4427be216b8b9f7 vp90-2-00-quantizer-02-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-03.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-03.webm.md5 new file mode 100644 index 0000000..fb6f597 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-03.webm.md5 @@ -0,0 +1,2 @@ +15c548208f5eda243a151a42f4d64855 vp90-2-00-quantizer-03-352x288-0001.i420 +e96d463dc8e9b27b1c2ec40f77eee6ef vp90-2-00-quantizer-03-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-04.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-04.webm.md5 new file mode 100644 index 0000000..fbe7558 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-04.webm.md5 @@ -0,0 +1,2 @@ +928c64a0747ac57ab50c1520d694fea7 vp90-2-00-quantizer-04-352x288-0001.i420 +a6f6daa293231e95ef30ed168f582c84 vp90-2-00-quantizer-04-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-05.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-05.webm.md5 new file mode 100644 index 0000000..4977060 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-05.webm.md5 @@ -0,0 +1,2 @@ +082460718b7d7046c8fb23184b7f71ca vp90-2-00-quantizer-05-352x288-0001.i420 +4a41aad51c40a92df72333e13f47d3fe vp90-2-00-quantizer-05-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-06.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-06.webm.md5 new file mode 100644 index 0000000..2a90a40 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-06.webm.md5 @@ -0,0 +1,2 @@ +cfca1bed96ff62a69b2d841fda01c6b9 vp90-2-00-quantizer-06-352x288-0001.i420 +9b4d61f1b998745c108f8eb67925e03d vp90-2-00-quantizer-06-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-07.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-07.webm.md5 new file mode 100644 index 0000000..6b77e7f --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-07.webm.md5 @@ -0,0 +1,2 @@ +6f5122064bead9d9882bec2698a6ed9c vp90-2-00-quantizer-07-352x288-0001.i420 +50dae67d2f57a76eece210dee8b6df9e vp90-2-00-quantizer-07-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-08.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-08.webm.md5 new file mode 100644 index 0000000..d0dba67 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-08.webm.md5 @@ -0,0 +1,2 @@ +eb3d6985fcda5d93dd62d53354e8a093 vp90-2-00-quantizer-08-352x288-0001.i420 +5b1f5b7780b4cafe1f75e56a0b526643 vp90-2-00-quantizer-08-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-09.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-09.webm.md5 new file mode 100644 index 0000000..a1d78c2 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-09.webm.md5 @@ -0,0 +1,2 @@ +d7ccaf28c59875fe91983def5490d2b1 vp90-2-00-quantizer-09-352x288-0001.i420 +bd98fe9492054826748de840b4495309 vp90-2-00-quantizer-09-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-10.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-10.webm.md5 new file mode 100644 index 0000000..cc8a716 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-10.webm.md5 @@ -0,0 +1,2 @@ +20dda6231f9801c9c237c6d09d9939b6 vp90-2-00-quantizer-10-352x288-0001.i420 +23c91e93807fb9a4ed5bd5bdd449d99f vp90-2-00-quantizer-10-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-11.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-11.webm.md5 new file mode 100644 index 0000000..39464f2 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-11.webm.md5 @@ -0,0 +1,2 @@ +960833315ebcdee97f46c4d98d0f3fef vp90-2-00-quantizer-11-352x288-0001.i420 +eec40507d17b64b7895a61cb87b2096a vp90-2-00-quantizer-11-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-12.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-12.webm.md5 new file mode 100644 index 0000000..57e7dbe --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-12.webm.md5 @@ -0,0 +1,2 @@ +6533224d3b6ba1ec0dd973bbe56c6349 vp90-2-00-quantizer-12-352x288-0001.i420 +12ceadc6d28327a24a75f8c40b6084d1 vp90-2-00-quantizer-12-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-13.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-13.webm.md5 new file mode 100644 index 0000000..03acb52 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-13.webm.md5 @@ -0,0 +1,2 @@ +7268de6756014f79a56dcf010c52a97f vp90-2-00-quantizer-13-352x288-0001.i420 +9e39e9b0e2295b8460dfa05f44762771 vp90-2-00-quantizer-13-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-14.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-14.webm.md5 new file mode 100644 index 0000000..2525db5 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-14.webm.md5 @@ -0,0 +1,2 @@ +57e9e333c641fa952f7485b788df225a vp90-2-00-quantizer-14-352x288-0001.i420 +551f0cea83dcdf4540c3983736757874 vp90-2-00-quantizer-14-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-15.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-15.webm.md5 new file mode 100644 index 0000000..c6e5377 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-15.webm.md5 @@ -0,0 +1,2 @@ +17a0a2842856b9e89aede237648d5dda vp90-2-00-quantizer-15-352x288-0001.i420 +c9fcade888a38621bebe3d4b41664245 vp90-2-00-quantizer-15-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-16.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-16.webm.md5 new file mode 100644 index 0000000..c1abf24 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-16.webm.md5 @@ -0,0 +1,2 @@ +6cc2089e9a3d352fe10b59ccd935c677 vp90-2-00-quantizer-16-352x288-0001.i420 +d165bf7b9cb901e121a65038758d8613 vp90-2-00-quantizer-16-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-17.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-17.webm.md5 new file mode 100644 index 0000000..40d8f03 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-17.webm.md5 @@ -0,0 +1,2 @@ +bc80511c83162c09661f155cd29f6dd8 vp90-2-00-quantizer-17-352x288-0001.i420 +a62f1cbdb3f86d2fb4c880cfd917def5 vp90-2-00-quantizer-17-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-18.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-18.webm.md5 new file mode 100644 index 0000000..3cb5fbe --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-18.webm.md5 @@ -0,0 +1,2 @@ +b2d350f6faa41cb50c2e8a9907d0f4a5 vp90-2-00-quantizer-18-352x288-0001.i420 +39b4380d16bc8e093dd4dba475175fb3 vp90-2-00-quantizer-18-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-19.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-19.webm.md5 new file mode 100644 index 0000000..36dbdac --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-19.webm.md5 @@ -0,0 +1,2 @@ +441e09be3c15fcb240afd74bb7a10a72 vp90-2-00-quantizer-19-352x288-0001.i420 +32ae5dac876ca5d5ae6ab7c74f4dc25d vp90-2-00-quantizer-19-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-20.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-20.webm.md5 new file mode 100644 index 0000000..ca80f66 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-20.webm.md5 @@ -0,0 +1,2 @@ +7786eb9944dba0553e129133523a98c1 vp90-2-00-quantizer-20-352x288-0001.i420 +206d888f8453427f10a40aa8bf5f6df0 vp90-2-00-quantizer-20-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-21.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-21.webm.md5 new file mode 100644 index 0000000..b31ac9e --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-21.webm.md5 @@ -0,0 +1,2 @@ +aab95e195be71feca050a839d7b3154d vp90-2-00-quantizer-21-352x288-0001.i420 +02a05d699bbbdc477e34bb0dad9f0391 vp90-2-00-quantizer-21-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-22.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-22.webm.md5 new file mode 100644 index 0000000..8f50f51 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-22.webm.md5 @@ -0,0 +1,2 @@ +41f853c3ee2d4611b645cc643d82e287 vp90-2-00-quantizer-22-352x288-0001.i420 +1c240c653110ff8609ca0f0287a6496d vp90-2-00-quantizer-22-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-23.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-23.webm.md5 new file mode 100644 index 0000000..ea0aaaa --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-23.webm.md5 @@ -0,0 +1,2 @@ +bc5b07369df50c8f97ce1a377fe513cf vp90-2-00-quantizer-23-352x288-0001.i420 +ce62ddb4f3e305d0f8587ae8bb44cc79 vp90-2-00-quantizer-23-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-24.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-24.webm.md5 new file mode 100644 index 0000000..49f378f --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-24.webm.md5 @@ -0,0 +1,2 @@ +982d54041221c977b6f0e37a9236cc76 vp90-2-00-quantizer-24-352x288-0001.i420 +57631e7f13f645c834e2944ebfd6d40e vp90-2-00-quantizer-24-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-25.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-25.webm.md5 new file mode 100644 index 0000000..90ed556 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-25.webm.md5 @@ -0,0 +1,2 @@ +b0fb55f3f2f56b3d27038e83c10123ce vp90-2-00-quantizer-25-352x288-0001.i420 +9fcac3becdcc2d30d778a55eca4c2018 vp90-2-00-quantizer-25-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-26.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-26.webm.md5 new file mode 100644 index 0000000..dbec99c --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-26.webm.md5 @@ -0,0 +1,2 @@ +4f645e0f354da77b9e2f2a6753c361da vp90-2-00-quantizer-26-352x288-0001.i420 +b7542998ec298273ca662bc9b658d10e vp90-2-00-quantizer-26-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-27.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-27.webm.md5 new file mode 100644 index 0000000..14ec691 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-27.webm.md5 @@ -0,0 +1,2 @@ +6edc96a3747cad43828397045764206e vp90-2-00-quantizer-27-352x288-0001.i420 +5fbc65d20fdca1abd69079851ce676d3 vp90-2-00-quantizer-27-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-28.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-28.webm.md5 new file mode 100644 index 0000000..0e2d177 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-28.webm.md5 @@ -0,0 +1,2 @@ +5db3e910e70da38bb91d01d73acc33dd vp90-2-00-quantizer-28-352x288-0001.i420 +b920ee7f7e61b7fdf9f44b1f738d0292 vp90-2-00-quantizer-28-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-29.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-29.webm.md5 new file mode 100644 index 0000000..1187388 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-29.webm.md5 @@ -0,0 +1,2 @@ +3cb3e310be5305077efa6216f6f10654 vp90-2-00-quantizer-29-352x288-0001.i420 +692d3e098af5978fe1a898ebc1a66a7a vp90-2-00-quantizer-29-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-30.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-30.webm.md5 new file mode 100644 index 0000000..39a6f82 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-30.webm.md5 @@ -0,0 +1,2 @@ +e3b3cea66ea38c5dfba1aa73bb4c611d vp90-2-00-quantizer-30-352x288-0001.i420 +42bb3e54b19c3f4c4f7ee3a6ba012e19 vp90-2-00-quantizer-30-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-31.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-31.webm.md5 new file mode 100644 index 0000000..9d84937 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-31.webm.md5 @@ -0,0 +1,2 @@ +2523e9ecfd3781eafcd7da192dc105e9 vp90-2-00-quantizer-31-352x288-0001.i420 +6d5feea012b9a1f51fc643633e728764 vp90-2-00-quantizer-31-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-32.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-32.webm.md5 new file mode 100644 index 0000000..5e6cdde --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-32.webm.md5 @@ -0,0 +1,2 @@ +0a0305eba36500ebf6cc6cc0f01f5a3b vp90-2-00-quantizer-32-352x288-0001.i420 +2c76bcd6763467f9057a726fbcf50ab1 vp90-2-00-quantizer-32-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-33.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-33.webm.md5 new file mode 100644 index 0000000..4604865 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-33.webm.md5 @@ -0,0 +1,2 @@ +c68433e0e94047c220be9b629334f744 vp90-2-00-quantizer-33-352x288-0001.i420 +fcfa4dff7a39bc9c5e315849ecbb46ea vp90-2-00-quantizer-33-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-34.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-34.webm.md5 new file mode 100644 index 0000000..42ec3bd --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-34.webm.md5 @@ -0,0 +1,2 @@ +ad9dc2f912c137b014a33e2792c88a25 vp90-2-00-quantizer-34-352x288-0001.i420 +11221ee4ea5c776f43af68756682cd5a vp90-2-00-quantizer-34-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-35.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-35.webm.md5 new file mode 100644 index 0000000..7467703 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-35.webm.md5 @@ -0,0 +1,2 @@ +75031f898cccf303a64ab46b1f815389 vp90-2-00-quantizer-35-352x288-0001.i420 +a4fc864e7fbc470dfcab6207e0eea152 vp90-2-00-quantizer-35-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-36.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-36.webm.md5 new file mode 100644 index 0000000..f83c5fd --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-36.webm.md5 @@ -0,0 +1,2 @@ +c7824af009fde6cafdd8d39fae6bb6cf vp90-2-00-quantizer-36-352x288-0001.i420 +516a82d5fc4dfa3daf713ed2ec36041b vp90-2-00-quantizer-36-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-37.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-37.webm.md5 new file mode 100644 index 0000000..56ae9cf --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-37.webm.md5 @@ -0,0 +1,2 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-00-quantizer-37-352x288-0001.i420 +fb23e0bc64728a492a33d985032f21b8 vp90-2-00-quantizer-37-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-38.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-38.webm.md5 new file mode 100644 index 0000000..5c70650 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-38.webm.md5 @@ -0,0 +1,2 @@ +8347bfb891317e89ef66781d6c28e24f vp90-2-00-quantizer-38-352x288-0001.i420 +a5722f824d32deac042513a1a7dcdcd0 vp90-2-00-quantizer-38-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-39.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-39.webm.md5 new file mode 100644 index 0000000..7c9fece --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-39.webm.md5 @@ -0,0 +1,2 @@ +018968f97fac3bdff146cf22c1da5ef0 vp90-2-00-quantizer-39-352x288-0001.i420 +ca8b09b01e5132183395e238f1c7901e vp90-2-00-quantizer-39-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-40.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-40.webm.md5 new file mode 100644 index 0000000..6b3c92a --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-40.webm.md5 @@ -0,0 +1,2 @@ +792660f6589ad5340be4bd0554435866 vp90-2-00-quantizer-40-352x288-0001.i420 +68c84c8a15d679e0a73678b93215c62c vp90-2-00-quantizer-40-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-41.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-41.webm.md5 new file mode 100644 index 0000000..7df4a7f --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-41.webm.md5 @@ -0,0 +1,2 @@ +a456bdfc6c1c07b4cb3a3848843743b9 vp90-2-00-quantizer-41-352x288-0001.i420 +fe41a12b8cb6bc5667ba2179e076f3b0 vp90-2-00-quantizer-41-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-42.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-42.webm.md5 new file mode 100644 index 0000000..4abe677 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-42.webm.md5 @@ -0,0 +1,2 @@ +f016dd8431694d989700fb1ba71a5b2d vp90-2-00-quantizer-42-352x288-0001.i420 +e89c3c5b935157b40f2fb0ab92415828 vp90-2-00-quantizer-42-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-43.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-43.webm.md5 new file mode 100644 index 0000000..2db4096 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-43.webm.md5 @@ -0,0 +1,2 @@ +7b8ab82625f3006bac89d4fb5197e71c vp90-2-00-quantizer-43-352x288-0001.i420 +18bd3716045563dfba2c72b640b3274b vp90-2-00-quantizer-43-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-44.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-44.webm.md5 new file mode 100644 index 0000000..aa705be --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-44.webm.md5 @@ -0,0 +1,2 @@ +66fde04d8320c750e56406feefd29979 vp90-2-00-quantizer-44-352x288-0001.i420 +f9d01d8fc1722ec345e624e14b404215 vp90-2-00-quantizer-44-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-45.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-45.webm.md5 new file mode 100644 index 0000000..4472c2f --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-45.webm.md5 @@ -0,0 +1,2 @@ +cc97597b015896d73f3e60e7ae44c4da vp90-2-00-quantizer-45-352x288-0001.i420 +fea98bc508f92135641ab99762444b14 vp90-2-00-quantizer-45-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-46.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-46.webm.md5 new file mode 100644 index 0000000..bb306b1 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-46.webm.md5 @@ -0,0 +1,2 @@ +79ed95c741178bb3c0954f1f6f8e21a3 vp90-2-00-quantizer-46-352x288-0001.i420 +f02a06a5e2b5b7619c9a52c5bea0564d vp90-2-00-quantizer-46-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-47.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-47.webm.md5 new file mode 100644 index 0000000..5734952 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-47.webm.md5 @@ -0,0 +1,2 @@ +9b98e948b8c2a822f21bd8419e6f4410 vp90-2-00-quantizer-47-352x288-0001.i420 +491382d68c16c2a3c6f1746598bc4a97 vp90-2-00-quantizer-47-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-48.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-48.webm.md5 new file mode 100644 index 0000000..0b79523 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-48.webm.md5 @@ -0,0 +1,2 @@ +f0f095b0edae7262f44d7ed7ef84ded4 vp90-2-00-quantizer-48-352x288-0001.i420 +0e833889ccac81d60251007d1baf6500 vp90-2-00-quantizer-48-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-49.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-49.webm.md5 new file mode 100644 index 0000000..72f8300 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-49.webm.md5 @@ -0,0 +1,2 @@ +6c1b7b7827617fb9b8417aca2cfdbcaa vp90-2-00-quantizer-49-352x288-0001.i420 +4c1fc8a89297fdcf79f0faabd42b8684 vp90-2-00-quantizer-49-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-50.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-50.webm.md5 new file mode 100644 index 0000000..f104046 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-50.webm.md5 @@ -0,0 +1,2 @@ +ca6142db68463487bc28c888ab38476c vp90-2-00-quantizer-50-352x288-0001.i420 +02a71153ec70f569524c3d814cb62f86 vp90-2-00-quantizer-50-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-51.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-51.webm.md5 new file mode 100644 index 0000000..7874a6f --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-51.webm.md5 @@ -0,0 +1,2 @@ +eece2627df1ddf0872256eb92352e179 vp90-2-00-quantizer-51-352x288-0001.i420 +0ee9f221246ad747250e4b5e8ba586e2 vp90-2-00-quantizer-51-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-52.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-52.webm.md5 new file mode 100644 index 0000000..d5092d6 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-52.webm.md5 @@ -0,0 +1,2 @@ +7290039d974c4e50db9d69f9864bcdbe vp90-2-00-quantizer-52-352x288-0001.i420 +264765de9d02503038a4da54133b9f85 vp90-2-00-quantizer-52-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-53.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-53.webm.md5 new file mode 100644 index 0000000..3566f61 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-53.webm.md5 @@ -0,0 +1,2 @@ +917af24da66f143a56a01eb2c2254285 vp90-2-00-quantizer-53-352x288-0001.i420 +45a05d3bc644420519619e4115662a70 vp90-2-00-quantizer-53-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-54.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-54.webm.md5 new file mode 100644 index 0000000..96fdd4b --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-54.webm.md5 @@ -0,0 +1,2 @@ +6fea2820bb10a9dec9add4d2452b01f5 vp90-2-00-quantizer-54-352x288-0001.i420 +74675169a4bfc2ff5463c4db5d85a79f vp90-2-00-quantizer-54-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-55.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-55.webm.md5 new file mode 100644 index 0000000..ec38867 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-55.webm.md5 @@ -0,0 +1,2 @@ +11e5d196f6537fb7d85988d90195e556 vp90-2-00-quantizer-55-352x288-0001.i420 +8536106795f7c93c5a43a11493527469 vp90-2-00-quantizer-55-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-56.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-56.webm.md5 new file mode 100644 index 0000000..a93ced9 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-56.webm.md5 @@ -0,0 +1,2 @@ +40839b7a3a40ec10f96b8a75224f646d vp90-2-00-quantizer-56-352x288-0001.i420 +11408dd73e8c45ddaab99f5c9650102b vp90-2-00-quantizer-56-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-57.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-57.webm.md5 new file mode 100644 index 0000000..1979cd8 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-57.webm.md5 @@ -0,0 +1,2 @@ +d0e9fa03dd48da4592ebaadb4e3794e0 vp90-2-00-quantizer-57-352x288-0001.i420 +5172e29b1e04cd543833d6a68aab297c vp90-2-00-quantizer-57-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-58.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-58.webm.md5 new file mode 100644 index 0000000..cb06866 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-58.webm.md5 @@ -0,0 +1,2 @@ +bef4a27d460e7697e038fe6f1c8bd597 vp90-2-00-quantizer-58-352x288-0001.i420 +124674686cafc5f2ff5bc7ea412b8f3b vp90-2-00-quantizer-58-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-59.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-59.webm.md5 new file mode 100644 index 0000000..240ea59 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-59.webm.md5 @@ -0,0 +1,2 @@ +ae9d99e9d16ef20073300559566844ae vp90-2-00-quantizer-59-352x288-0001.i420 +da9405e5a6bfe4ed18d927ba2004008e vp90-2-00-quantizer-59-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-60.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-60.webm.md5 new file mode 100644 index 0000000..550fee9 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-60.webm.md5 @@ -0,0 +1,2 @@ +9e66bb8e1b5e206ea4afe4bf2d335ac5 vp90-2-00-quantizer-60-352x288-0001.i420 +092b74c905c12c1e87e90f5a79857736 vp90-2-00-quantizer-60-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-61.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-61.webm.md5 new file mode 100644 index 0000000..2e3edd3 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-61.webm.md5 @@ -0,0 +1,2 @@ +d062dc6be246c8042744018765ef50a8 vp90-2-00-quantizer-61-352x288-0001.i420 +45fd9cbacb6a91060a7e49a58a85869d vp90-2-00-quantizer-61-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-62.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-62.webm.md5 new file mode 100644 index 0000000..1d266b3 --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-62.webm.md5 @@ -0,0 +1,2 @@ +62f7e42fe653e81c5a65a25389e045b5 vp90-2-00-quantizer-62-352x288-0001.i420 +cb0cdd0b25689e0a43328550011d960d vp90-2-00-quantizer-62-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-00-quantizer-63.webm.md5 b/testdata/libvpx/vp90-2-00-quantizer-63.webm.md5 new file mode 100644 index 0000000..b5d122f --- /dev/null +++ b/testdata/libvpx/vp90-2-00-quantizer-63.webm.md5 @@ -0,0 +1,2 @@ +8467643dceff827e04acd82eeff1d1b0 vp90-2-00-quantizer-63-352x288-0001.i420 +c786f49d66f4dfd685dea9605821a19f vp90-2-00-quantizer-63-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-01-sharpness-1.webm.md5 b/testdata/libvpx/vp90-2-01-sharpness-1.webm.md5 new file mode 100644 index 0000000..1db2ed2 --- /dev/null +++ b/testdata/libvpx/vp90-2-01-sharpness-1.webm.md5 @@ -0,0 +1,10 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-01-sharpness-1-352x288-0001.i420 +aa20a75be3a316193496706c9f760d08 vp90-2-01-sharpness-1-352x288-0002.i420 +95567be97a64d3c9efe45f2524116a2e vp90-2-01-sharpness-1-352x288-0003.i420 +219e86cd6b3cca312856eead21776b1c vp90-2-01-sharpness-1-352x288-0004.i420 +4a67fd359ca362398e97c15eb018a2bb vp90-2-01-sharpness-1-352x288-0005.i420 +9916d4e359274d690827f0eb22547423 vp90-2-01-sharpness-1-352x288-0006.i420 +a07785b52561150c48f1a8eff89d5d75 vp90-2-01-sharpness-1-352x288-0007.i420 +a3382a92982953dfa20018e5ac975b51 vp90-2-01-sharpness-1-352x288-0008.i420 +911836989ca7b148438aa3ec7fc7e303 vp90-2-01-sharpness-1-352x288-0009.i420 +5627b981e3fc9e4401d35d3a5ab25917 vp90-2-01-sharpness-1-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-01-sharpness-2.webm.md5 b/testdata/libvpx/vp90-2-01-sharpness-2.webm.md5 new file mode 100644 index 0000000..cb4d78e --- /dev/null +++ b/testdata/libvpx/vp90-2-01-sharpness-2.webm.md5 @@ -0,0 +1,10 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-01-sharpness-2-352x288-0001.i420 +cd94572239817ae7c9b07de739c3272b vp90-2-01-sharpness-2-352x288-0002.i420 +383cf752d457e122b5ff49d08960208e vp90-2-01-sharpness-2-352x288-0003.i420 +1c0a6ec9cd3ce29b8b004e7526f1b07e vp90-2-01-sharpness-2-352x288-0004.i420 +91c42a8a108d67947cabfc2a5a80df66 vp90-2-01-sharpness-2-352x288-0005.i420 +08c57fc1f3fec0305883315a66c714d1 vp90-2-01-sharpness-2-352x288-0006.i420 +70cb8d8dc83eac82f2d3c4b0376bb1aa vp90-2-01-sharpness-2-352x288-0007.i420 +ffd62a9ef829ec81f0f74f740488a41f vp90-2-01-sharpness-2-352x288-0008.i420 +bab0aa23b5854e2a70926046e4618710 vp90-2-01-sharpness-2-352x288-0009.i420 +fec456f38f2a43661e786a8d5f67ed15 vp90-2-01-sharpness-2-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-01-sharpness-3.webm.md5 b/testdata/libvpx/vp90-2-01-sharpness-3.webm.md5 new file mode 100644 index 0000000..5f66ebd --- /dev/null +++ b/testdata/libvpx/vp90-2-01-sharpness-3.webm.md5 @@ -0,0 +1,10 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-01-sharpness-3-352x288-0001.i420 +0d487a146393a0b8b84b4be1b371b507 vp90-2-01-sharpness-3-352x288-0002.i420 +68372e191eba620a431cfff226026ac3 vp90-2-01-sharpness-3-352x288-0003.i420 +de7fd274460e36b983fe93acc208d72f vp90-2-01-sharpness-3-352x288-0004.i420 +afbd36c61bab65b98ff9acf08e215721 vp90-2-01-sharpness-3-352x288-0005.i420 +e1e9fc2ab4e7a187a8d8d84aae48d6b9 vp90-2-01-sharpness-3-352x288-0006.i420 +11d95de6a9cc5e00511e99534779faac vp90-2-01-sharpness-3-352x288-0007.i420 +cd2f5539fdfc2d8eefe6b6da28c13398 vp90-2-01-sharpness-3-352x288-0008.i420 +a8b3aeed41da7aeb8d5b962ee4a4af93 vp90-2-01-sharpness-3-352x288-0009.i420 +4283670bd1c1c506ef18d3dafca22035 vp90-2-01-sharpness-3-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-01-sharpness-4.webm.md5 b/testdata/libvpx/vp90-2-01-sharpness-4.webm.md5 new file mode 100644 index 0000000..dc3f2c1 --- /dev/null +++ b/testdata/libvpx/vp90-2-01-sharpness-4.webm.md5 @@ -0,0 +1,10 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-01-sharpness-4-352x288-0001.i420 +8bad76c55b5149169d64ce6512521de6 vp90-2-01-sharpness-4-352x288-0002.i420 +c1d986e1f9bf46382e598ba289b9bd7c vp90-2-01-sharpness-4-352x288-0003.i420 +86c097ac6069c786023d3561dae68bac vp90-2-01-sharpness-4-352x288-0004.i420 +8c238a2831b8c7c49736b6de6ff76ed8 vp90-2-01-sharpness-4-352x288-0005.i420 +cb5a038ed0a74a317ee72dae93a7ee3e vp90-2-01-sharpness-4-352x288-0006.i420 +f8fe330a257e3e4e4c39c1c12820a654 vp90-2-01-sharpness-4-352x288-0007.i420 +a73e2fcdcbb9334c0c123f8276a2c881 vp90-2-01-sharpness-4-352x288-0008.i420 +24fccece8ee639e4d0e00e4060e1db0c vp90-2-01-sharpness-4-352x288-0009.i420 +46d6e9aad69a39c718c5fd1e41e86e6e vp90-2-01-sharpness-4-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-01-sharpness-5.webm.md5 b/testdata/libvpx/vp90-2-01-sharpness-5.webm.md5 new file mode 100644 index 0000000..a545e7c --- /dev/null +++ b/testdata/libvpx/vp90-2-01-sharpness-5.webm.md5 @@ -0,0 +1,10 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-01-sharpness-5-352x288-0001.i420 +f1ce0a5d57a46c9ff1331804b7b03fdb vp90-2-01-sharpness-5-352x288-0002.i420 +0364a085b06bee6b980189cf5378eda9 vp90-2-01-sharpness-5-352x288-0003.i420 +4b5358698d734b0ae210909a913d4c1e vp90-2-01-sharpness-5-352x288-0004.i420 +dc22565aaceee77b15fd8ab3c84bd5e0 vp90-2-01-sharpness-5-352x288-0005.i420 +5f6340b656536292b46ba9a647aeb6e4 vp90-2-01-sharpness-5-352x288-0006.i420 +b7d4bce9a04b2a6caa45801be15e331e vp90-2-01-sharpness-5-352x288-0007.i420 +534c851cfe59ffc047815ece98d8cede vp90-2-01-sharpness-5-352x288-0008.i420 +786b0e1564d5c71aabfc2dd528cff4e7 vp90-2-01-sharpness-5-352x288-0009.i420 +cac0366209cf471bb7cc3e64966cbbd4 vp90-2-01-sharpness-5-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-01-sharpness-6.webm.md5 b/testdata/libvpx/vp90-2-01-sharpness-6.webm.md5 new file mode 100644 index 0000000..0c36072 --- /dev/null +++ b/testdata/libvpx/vp90-2-01-sharpness-6.webm.md5 @@ -0,0 +1,10 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-01-sharpness-6-352x288-0001.i420 +45d9ca07ed04210b1ebc743169bc8ec4 vp90-2-01-sharpness-6-352x288-0002.i420 +5b646cc309a711f1d8814f925002d8c4 vp90-2-01-sharpness-6-352x288-0003.i420 +34db8db727fa1ded0a55cc7cf85be249 vp90-2-01-sharpness-6-352x288-0004.i420 +54173d08afe6369b16a9c0c9cc6ce04d vp90-2-01-sharpness-6-352x288-0005.i420 +76275b0a478cdb3c1fb527ebbce023c3 vp90-2-01-sharpness-6-352x288-0006.i420 +e7643cdf0c42f2af700d8730bfc1a453 vp90-2-01-sharpness-6-352x288-0007.i420 +6e53097e56f680cb658d63100e7736f7 vp90-2-01-sharpness-6-352x288-0008.i420 +1a407c3c8ea1d5245ae68c5ce7de70e1 vp90-2-01-sharpness-6-352x288-0009.i420 +6cbca24912cadf09b20be74f14e359c9 vp90-2-01-sharpness-6-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-01-sharpness-7.webm.md5 b/testdata/libvpx/vp90-2-01-sharpness-7.webm.md5 new file mode 100644 index 0000000..6c94a52 --- /dev/null +++ b/testdata/libvpx/vp90-2-01-sharpness-7.webm.md5 @@ -0,0 +1,10 @@ +a2e5c820fd9733e18f9349fb658ca281 vp90-2-01-sharpness-7-352x288-0001.i420 +f719d0be18d16a448b4e7da3e2d9bf28 vp90-2-01-sharpness-7-352x288-0002.i420 +83ee8ebc0ca796782a2376a76f2ffc26 vp90-2-01-sharpness-7-352x288-0003.i420 +7cf5afdbc229e1af50a5377cfc23d831 vp90-2-01-sharpness-7-352x288-0004.i420 +44244e896e0362f6376ba5afa563ba8b vp90-2-01-sharpness-7-352x288-0005.i420 +df5f518d44eb6cb91b2df5a30d27ef82 vp90-2-01-sharpness-7-352x288-0006.i420 +43cc3f151b8337aca7ee659c8abeb783 vp90-2-01-sharpness-7-352x288-0007.i420 +4e89573470d9b97464e10806fc81aa8b vp90-2-01-sharpness-7-352x288-0008.i420 +62e0ba70f07ece8d85372f0a42e83a9a vp90-2-01-sharpness-7-352x288-0009.i420 +45ac2928acb11326f6c4a21401f3609c vp90-2-01-sharpness-7-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x08.webm.md5 new file mode 100644 index 0000000..c74db82 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x08.webm.md5 @@ -0,0 +1,10 @@ +52def242c36123e5a8f5f53d6a971399 vp90-2-02-size-08x08-8x8-0001.i420 +79c93360fbd47179400414bbfee0901c vp90-2-02-size-08x08-8x8-0002.i420 +c3b1947c79537baa7838905276276a91 vp90-2-02-size-08x08-8x8-0003.i420 +20f35e501bdee0bc63e87b9240265c25 vp90-2-02-size-08x08-8x8-0004.i420 +5e8f1c464bafd54833c51860906b5368 vp90-2-02-size-08x08-8x8-0005.i420 +f57b592600dfc99e634a083278af769a vp90-2-02-size-08x08-8x8-0006.i420 +7b02191f85590cbad3f148c7b92d6436 vp90-2-02-size-08x08-8x8-0007.i420 +b0a1c9870447a1744f64cd4087ef55ee vp90-2-02-size-08x08-8x8-0008.i420 +c82712b1ba7a95efb67cbdde0ad708b6 vp90-2-02-size-08x08-8x8-0009.i420 +89f4539f8d7a7b45a91fd2f46335988e vp90-2-02-size-08x08-8x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x10.webm.md5 new file mode 100644 index 0000000..c051eb9 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x10.webm.md5 @@ -0,0 +1,10 @@ +ea3e0f807304b0eb2d3e329b0124f75c vp90-2-02-size-08x10-8x10-0001.i420 +8d13cf682d63e7eb13094f55d67fc458 vp90-2-02-size-08x10-8x10-0002.i420 +e729cc6c3684c94a8f6118c618efc3ea vp90-2-02-size-08x10-8x10-0003.i420 +ac43a0ace8e4112e877c2491ecc14fb5 vp90-2-02-size-08x10-8x10-0004.i420 +53695f90b88d8e8cb838f0faec3238d3 vp90-2-02-size-08x10-8x10-0005.i420 +40afd1c4dfd4a2e3b31631c46d252bcc vp90-2-02-size-08x10-8x10-0006.i420 +2b656f76f2e84d2f82d9bda2b5be94d3 vp90-2-02-size-08x10-8x10-0007.i420 +b22f004d678d047bc401be5e040cf883 vp90-2-02-size-08x10-8x10-0008.i420 +57c840319abfb9c31013fbde54de3fb0 vp90-2-02-size-08x10-8x10-0009.i420 +0f3dfc156216d7cfb6fd1d8c77dadab9 vp90-2-02-size-08x10-8x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x16.webm.md5 new file mode 100644 index 0000000..d95f639 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x16.webm.md5 @@ -0,0 +1,10 @@ +0553e56a9d89aea496421885aab491f5 vp90-2-02-size-08x16-8x16-0001.i420 +b2a14cf676f7ebf3c50450050f76ad16 vp90-2-02-size-08x16-8x16-0002.i420 +a308d981e09b50571fb0c8ebdcefe505 vp90-2-02-size-08x16-8x16-0003.i420 +d592ec625a0ac0373e82610c3eed9864 vp90-2-02-size-08x16-8x16-0004.i420 +acd19642455e643023b4fb882c3891ba vp90-2-02-size-08x16-8x16-0005.i420 +5af5390fd8c29b795e0ddf83f3f34284 vp90-2-02-size-08x16-8x16-0006.i420 +473505aa2a76231725cf2107d6c9dbef vp90-2-02-size-08x16-8x16-0007.i420 +84860db6887e320f2d64f80cf0032e57 vp90-2-02-size-08x16-8x16-0008.i420 +408e9cf60e99ae99d204ff08f3196d1a vp90-2-02-size-08x16-8x16-0009.i420 +d8af96b79258f9382e911ed38340bdf5 vp90-2-02-size-08x16-8x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x18.webm.md5 new file mode 100644 index 0000000..d22d06a --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x18.webm.md5 @@ -0,0 +1,10 @@ +4c41f93b1b280b37bc77d7047435eaa4 vp90-2-02-size-08x18-8x18-0001.i420 +c9c80fdba2ebc2b8c3490ae35e34f84f vp90-2-02-size-08x18-8x18-0002.i420 +089d86acb3263fa5ef4f591a7f44556d vp90-2-02-size-08x18-8x18-0003.i420 +938fca6d93b83484144f5054e4838a41 vp90-2-02-size-08x18-8x18-0004.i420 +e0592e2ac9f5e09525ce0d3904cadf47 vp90-2-02-size-08x18-8x18-0005.i420 +ea43ff5d1330986e60c08567262ea764 vp90-2-02-size-08x18-8x18-0006.i420 +08b40fe109ee90188f1cba9bbb1b376e vp90-2-02-size-08x18-8x18-0007.i420 +b067068a2a7e36d5c5b5b405a1e73a18 vp90-2-02-size-08x18-8x18-0008.i420 +9cf2d350296288803434b7451bd2be85 vp90-2-02-size-08x18-8x18-0009.i420 +3c785e21dc228d6396738fbfcb470289 vp90-2-02-size-08x18-8x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x32.webm.md5 new file mode 100644 index 0000000..32a5a7b --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x32.webm.md5 @@ -0,0 +1,10 @@ +f92a7777fd69aa2f2914d9a41c4828ba vp90-2-02-size-08x32-8x32-0001.i420 +62e1cc73487d2249a88a60e35a22d9c7 vp90-2-02-size-08x32-8x32-0002.i420 +aa2619b605cb65eda15fdd99d5775550 vp90-2-02-size-08x32-8x32-0003.i420 +e6f0a491c543b835d0cefe5ca62c3dbe vp90-2-02-size-08x32-8x32-0004.i420 +361be1a06913c398f09494ca1b2d288f vp90-2-02-size-08x32-8x32-0005.i420 +0497bf849a973357c0ccb8d43f5bd8b4 vp90-2-02-size-08x32-8x32-0006.i420 +5ac6ac523147c409dd00820622161dd7 vp90-2-02-size-08x32-8x32-0007.i420 +7d07245574a46c524360f09be29a5f19 vp90-2-02-size-08x32-8x32-0008.i420 +fcfa7fbcaf42f81e4e34a4ee5a029ca1 vp90-2-02-size-08x32-8x32-0009.i420 +336e3fe4f15d3d6c82d82b1855dcfeb4 vp90-2-02-size-08x32-8x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x34.webm.md5 new file mode 100644 index 0000000..626dce9 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x34.webm.md5 @@ -0,0 +1,10 @@ +f3f2cd8f157466ff23dace85d77367ce vp90-2-02-size-08x34-8x34-0001.i420 +639d9b70a14062e95559c12d2b597f91 vp90-2-02-size-08x34-8x34-0002.i420 +b2ee07a6656af583f19593229fa11848 vp90-2-02-size-08x34-8x34-0003.i420 +74e3b5ab4c798a0afe745694e871bbd5 vp90-2-02-size-08x34-8x34-0004.i420 +35f1c30d0f8678f319a392a6c53b5989 vp90-2-02-size-08x34-8x34-0005.i420 +07e2b4c0b92a394bfb11124fe80476f0 vp90-2-02-size-08x34-8x34-0006.i420 +7864bd20dfc5280e5f027d67ea22bf30 vp90-2-02-size-08x34-8x34-0007.i420 +10a2925a7b91dfa9b82de76069388fd4 vp90-2-02-size-08x34-8x34-0008.i420 +79cc7f7a149e8d6e04e065f75e63733c vp90-2-02-size-08x34-8x34-0009.i420 +6453d10d97532d9bb03f7c06cba9fca0 vp90-2-02-size-08x34-8x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x64.webm.md5 new file mode 100644 index 0000000..f66d0c7 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x64.webm.md5 @@ -0,0 +1,10 @@ +764bd02b781a38c621a109c12f3d9393 vp90-2-02-size-08x64-8x64-0001.i420 +79496bd2b9212026af816b3b7a0587d5 vp90-2-02-size-08x64-8x64-0002.i420 +2a3afd47ba3d075033fd94d5c3746c45 vp90-2-02-size-08x64-8x64-0003.i420 +fca00cad8d37a6646337baebadd0ca31 vp90-2-02-size-08x64-8x64-0004.i420 +aca376fb3f8a5ef670ecc2430037262a vp90-2-02-size-08x64-8x64-0005.i420 +7e6c8d96d1e24855c3e380f1bf2ce02c vp90-2-02-size-08x64-8x64-0006.i420 +09e051241972969d439f27f324d78490 vp90-2-02-size-08x64-8x64-0007.i420 +2566b2a425caaba41305bf04ff10ea01 vp90-2-02-size-08x64-8x64-0008.i420 +db3995bedee42ada1b4ee63c339daf1b vp90-2-02-size-08x64-8x64-0009.i420 +b00b8f1bf4fd907f0487738f5b5442c6 vp90-2-02-size-08x64-8x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-08x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-08x66.webm.md5 new file mode 100644 index 0000000..0c4649c --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-08x66.webm.md5 @@ -0,0 +1,10 @@ +df20e8df89449fe50bb610e95a449a95 vp90-2-02-size-08x66-8x66-0001.i420 +18f1a66d463274d1b0489f3a50e86857 vp90-2-02-size-08x66-8x66-0002.i420 +b0cc102875a94c9a92e53826617adbe9 vp90-2-02-size-08x66-8x66-0003.i420 +dfece7c17b4b149283ef51bdc1bd440e vp90-2-02-size-08x66-8x66-0004.i420 +6e346884f67be259fcabe493109cb63c vp90-2-02-size-08x66-8x66-0005.i420 +6d282127311eb2d958377490d7cb77f0 vp90-2-02-size-08x66-8x66-0006.i420 +637ac8b14ca5ddbaf7b8910406c3cd08 vp90-2-02-size-08x66-8x66-0007.i420 +e7980f3fcb36969da0d218c4389fa9e8 vp90-2-02-size-08x66-8x66-0008.i420 +730a1c95b9fb165f6e1a2f33a0d25de0 vp90-2-02-size-08x66-8x66-0009.i420 +7bd8424d0783b1c8ad617e17408371bb vp90-2-02-size-08x66-8x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x08.webm.md5 new file mode 100644 index 0000000..2f8e4be --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x08.webm.md5 @@ -0,0 +1,10 @@ +e1e66a88615da98523ef887f1463fc42 vp90-2-02-size-10x08-10x8-0001.i420 +549842fa98c8faf572882d38b0aae390 vp90-2-02-size-10x08-10x8-0002.i420 +17ee85785517705fdc78c6122a4b2548 vp90-2-02-size-10x08-10x8-0003.i420 +1143391d419dac30a6c11f366157c974 vp90-2-02-size-10x08-10x8-0004.i420 +b62d2a962c4c36809ef75a610106715c vp90-2-02-size-10x08-10x8-0005.i420 +e6f143ca33fbc0e776bb149950cdedff vp90-2-02-size-10x08-10x8-0006.i420 +01716a1077ec66df00474fd4510d2789 vp90-2-02-size-10x08-10x8-0007.i420 +8cb5b6a865fa2cbb15f0d7736fda88a6 vp90-2-02-size-10x08-10x8-0008.i420 +0fb9fd883e895a540fe1704dddbbab04 vp90-2-02-size-10x08-10x8-0009.i420 +150a3b99aa24ef102c92f87c8adb4386 vp90-2-02-size-10x08-10x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x10.webm.md5 new file mode 100644 index 0000000..13ae622 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x10.webm.md5 @@ -0,0 +1,10 @@ +083d638f2e147295d817bb14fff5e4f4 vp90-2-02-size-10x10-10x10-0001.i420 +6dbdc445b6fd6bb99f2025cc2a40977e vp90-2-02-size-10x10-10x10-0002.i420 +41714089383b181d64fbfa7de5904608 vp90-2-02-size-10x10-10x10-0003.i420 +11fdb8465e1599f7a9227706646d2cba vp90-2-02-size-10x10-10x10-0004.i420 +907876b3342a10040db0851a936af4e3 vp90-2-02-size-10x10-10x10-0005.i420 +e7b18d47d06b25de205d873d3d941640 vp90-2-02-size-10x10-10x10-0006.i420 +523ce7413c8da7f6a657a9b661f36c44 vp90-2-02-size-10x10-10x10-0007.i420 +23caff863af875c66c903662a3e1e6a1 vp90-2-02-size-10x10-10x10-0008.i420 +ed4cc5557203e5b7a119112ee9ceb00b vp90-2-02-size-10x10-10x10-0009.i420 +4bb78a996be3188888d1c60e11a08e1b vp90-2-02-size-10x10-10x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x16.webm.md5 new file mode 100644 index 0000000..b614000 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x16.webm.md5 @@ -0,0 +1,10 @@ +fab07d6209d2413e0a434e1aaaa12154 vp90-2-02-size-10x16-10x16-0001.i420 +f9ffffdb96f98527ba2e553d1265edbb vp90-2-02-size-10x16-10x16-0002.i420 +56a992264cf7da2b23dd97435e9d0365 vp90-2-02-size-10x16-10x16-0003.i420 +b1db980423d8004bd45a789b02b92a65 vp90-2-02-size-10x16-10x16-0004.i420 +b29496aedc7026566367b634f55ebb28 vp90-2-02-size-10x16-10x16-0005.i420 +2bc9def672da4a2fc17cbd669e2b8081 vp90-2-02-size-10x16-10x16-0006.i420 +8c54721514cdf577a52a8668b9135f13 vp90-2-02-size-10x16-10x16-0007.i420 +2efab81d5e039d82b3bc7b0303b022c4 vp90-2-02-size-10x16-10x16-0008.i420 +bd0f42b91b5d126fd0baec765b1096ad vp90-2-02-size-10x16-10x16-0009.i420 +c6bfea2735a629167bc6a7a7c76eb7f3 vp90-2-02-size-10x16-10x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x18.webm.md5 new file mode 100644 index 0000000..0639abf --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x18.webm.md5 @@ -0,0 +1,10 @@ +0e9182e214aae732d94d007e5fe44888 vp90-2-02-size-10x18-10x18-0001.i420 +2630e2674b5611d68218fddac08815e2 vp90-2-02-size-10x18-10x18-0002.i420 +d5cdd7d6a3de17939f60bb60ef6877da vp90-2-02-size-10x18-10x18-0003.i420 +29d1961096061029e78963fa82581eca vp90-2-02-size-10x18-10x18-0004.i420 +5c2629f8aa59757f6b4aafa9f6cbcba1 vp90-2-02-size-10x18-10x18-0005.i420 +1f1a8b61e4fbd6222ddf42e9d0a07032 vp90-2-02-size-10x18-10x18-0006.i420 +cfb9771190ac2d0129907102d6abb63f vp90-2-02-size-10x18-10x18-0007.i420 +cd98dd856ba573a26a943cbe53221f26 vp90-2-02-size-10x18-10x18-0008.i420 +ca13c161f067c4a4ce22bd58a2aca55b vp90-2-02-size-10x18-10x18-0009.i420 +de4bd1a474a76a35b796a5fc45b4f893 vp90-2-02-size-10x18-10x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x32.webm.md5 new file mode 100644 index 0000000..aca6be0 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x32.webm.md5 @@ -0,0 +1,10 @@ +622e6407a051ea08706394d03330ffbf vp90-2-02-size-10x32-10x32-0001.i420 +1841a0daf7c3ef7be94e01fdb1d3968a vp90-2-02-size-10x32-10x32-0002.i420 +37790e6cb2415f7add0ac5d3ab354755 vp90-2-02-size-10x32-10x32-0003.i420 +91485880e17c292096a7335566d3648f vp90-2-02-size-10x32-10x32-0004.i420 +eb6f74983d5fd13d6bd90afbce8836e1 vp90-2-02-size-10x32-10x32-0005.i420 +0069ab5ff7f0d4d601f7d0f9b7a08338 vp90-2-02-size-10x32-10x32-0006.i420 +dbf04254765f7497070387e8c34895c6 vp90-2-02-size-10x32-10x32-0007.i420 +410a9b2d9855b2c29618070994adae96 vp90-2-02-size-10x32-10x32-0008.i420 +7e7f34effd90209f29f1b9ae01488b3b vp90-2-02-size-10x32-10x32-0009.i420 +471530f74082c01c9b0f1fcf3d240d77 vp90-2-02-size-10x32-10x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x34.webm.md5 new file mode 100644 index 0000000..1bd82bf --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x34.webm.md5 @@ -0,0 +1,10 @@ +bfeeaf51f972fd0dfe9ee757083cbb54 vp90-2-02-size-10x34-10x34-0001.i420 +10cd4ed6d762004846412d9cd0caa407 vp90-2-02-size-10x34-10x34-0002.i420 +04cca4008d656ed180de88dd2ddb4f21 vp90-2-02-size-10x34-10x34-0003.i420 +ec777e377836895748c06849fa35ed2d vp90-2-02-size-10x34-10x34-0004.i420 +b55633d0f9239dff3e45a4abce4a35a7 vp90-2-02-size-10x34-10x34-0005.i420 +063c3ab4b4c599942c3a8a5b7bfe5029 vp90-2-02-size-10x34-10x34-0006.i420 +07b920169d32b5fc51d5b9ae16fef5bf vp90-2-02-size-10x34-10x34-0007.i420 +8d49e727db9d3072b5ab7bab2133d9be vp90-2-02-size-10x34-10x34-0008.i420 +17441437203447e946a57d2f96966332 vp90-2-02-size-10x34-10x34-0009.i420 +5d3f14af0e5cd81d0c7d2059f13efa5a vp90-2-02-size-10x34-10x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x64.webm.md5 new file mode 100644 index 0000000..26da4b6 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x64.webm.md5 @@ -0,0 +1,10 @@ +835254d0eecb17bed1f2b0f3a1638165 vp90-2-02-size-10x64-10x64-0001.i420 +c0c95ce9890eab339a0e0f8b26cb095c vp90-2-02-size-10x64-10x64-0002.i420 +f0337d645ade07cb716952b0d19352e8 vp90-2-02-size-10x64-10x64-0003.i420 +7e3deb21cb3f0ead90c8af94464cde14 vp90-2-02-size-10x64-10x64-0004.i420 +c6b1ca6cfce358c411c0637c581157c8 vp90-2-02-size-10x64-10x64-0005.i420 +10fce3f11f1ce90286ff4d74fe44fcfd vp90-2-02-size-10x64-10x64-0006.i420 +ee0565a1f121bc905a35550619127a50 vp90-2-02-size-10x64-10x64-0007.i420 +0624b601d379616eb792c94be60b6c91 vp90-2-02-size-10x64-10x64-0008.i420 +a1bb79cdf347548f1103f580f2b6930f vp90-2-02-size-10x64-10x64-0009.i420 +40e96e16c7e065aa7932e5aa57f32398 vp90-2-02-size-10x64-10x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-10x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-10x66.webm.md5 new file mode 100644 index 0000000..40a8a9a --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-10x66.webm.md5 @@ -0,0 +1,10 @@ +1bd8b2d3bf679c4b925780bf82e12fae vp90-2-02-size-10x66-10x66-0001.i420 +a0254b4cd4928fe1080cd6f8828288a9 vp90-2-02-size-10x66-10x66-0002.i420 +e416e99644cca481dc2806708d716ecb vp90-2-02-size-10x66-10x66-0003.i420 +b1ed3203ffc77ed814f1cda7bfe721d2 vp90-2-02-size-10x66-10x66-0004.i420 +0ff7b9d84765f7b0b0650775ba72b334 vp90-2-02-size-10x66-10x66-0005.i420 +8b6cd91e035bad19b46b132bd411231d vp90-2-02-size-10x66-10x66-0006.i420 +c714759a9a64402043ad00e5677c954c vp90-2-02-size-10x66-10x66-0007.i420 +8e4738010b724ce66bcd0a5d5afcfbc1 vp90-2-02-size-10x66-10x66-0008.i420 +998a7aab8ed94f4b69bed39fb487f8d5 vp90-2-02-size-10x66-10x66-0009.i420 +9964683a15a65c032631a4f608e6009b vp90-2-02-size-10x66-10x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-130x132.webm.md5 b/testdata/libvpx/vp90-2-02-size-130x132.webm.md5 new file mode 100644 index 0000000..451d950 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-130x132.webm.md5 @@ -0,0 +1,10 @@ +8faddcc51f9bff5759dc15c7e6f5ce3f vp90_2_02_size_130x132.webm-130x132-0001.i420 +74fe93bd53a03c466da40d67431b6d41 vp90_2_02_size_130x132.webm-130x132-0002.i420 +3a40cd8fdab88af3d15b5d4af7d62245 vp90_2_02_size_130x132.webm-130x132-0003.i420 +5c232e8e11f4254f9bf437dcf91418b9 vp90_2_02_size_130x132.webm-130x132-0004.i420 +eb7f2d1700705697d05e322abe12d732 vp90_2_02_size_130x132.webm-130x132-0005.i420 +f3accfe25de02102fd996622f9b43499 vp90_2_02_size_130x132.webm-130x132-0006.i420 +270a3780fc7b84afbe8a340bc2e61871 vp90_2_02_size_130x132.webm-130x132-0007.i420 +c169f3a5d566a1a4afde6c309f1e4644 vp90_2_02_size_130x132.webm-130x132-0008.i420 +48b6fefacb63f286096fb0b65f8bc7c4 vp90_2_02_size_130x132.webm-130x132-0009.i420 +fcc24b1b542545bab9e45b9d79f6b41f vp90_2_02_size_130x132.webm-130x132-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-132x130.webm.md5 b/testdata/libvpx/vp90-2-02-size-132x130.webm.md5 new file mode 100644 index 0000000..415deb4 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-132x130.webm.md5 @@ -0,0 +1,10 @@ +d75a9541df281c3fb1cd24f8be0788b3 vp90_2_02_size_132x130.webm-132x130-0001.i420 +a060549076fbf8856925c7f4a0e007b3 vp90_2_02_size_132x130.webm-132x130-0002.i420 +73ecf525a1a395deed6a7256e2c501d0 vp90_2_02_size_132x130.webm-132x130-0003.i420 +ec636e97f829b3457b7adda98c1c3580 vp90_2_02_size_132x130.webm-132x130-0004.i420 +f56f3f415b6b5d12fb5824aa82365cb3 vp90_2_02_size_132x130.webm-132x130-0005.i420 +376735c39fea4c2f48b8d2d260f9b73e vp90_2_02_size_132x130.webm-132x130-0006.i420 +c616f543aaa73342b561f08ec24d9792 vp90_2_02_size_132x130.webm-132x130-0007.i420 +b86a6ecf6e5df70b9505861bcc8ac95e vp90_2_02_size_132x130.webm-132x130-0008.i420 +1d9bc98446d2068fe37abc60abce0d28 vp90_2_02_size_132x130.webm-132x130-0009.i420 +febd071a35d2407e29f72c46f14f4667 vp90_2_02_size_132x130.webm-132x130-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-132x132.webm.md5 b/testdata/libvpx/vp90-2-02-size-132x132.webm.md5 new file mode 100644 index 0000000..cb04a76 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-132x132.webm.md5 @@ -0,0 +1,10 @@ +5dc0ef6d1452bf220dfe752b9c0a6081 vp90_2_02_size_132x132.webm-132x132-0001.i420 +cdec24d8945577908cd05a3254edc1ea vp90_2_02_size_132x132.webm-132x132-0002.i420 +ce4978e6ab380156c33943b225145af2 vp90_2_02_size_132x132.webm-132x132-0003.i420 +516c9256ab785f04f41fa7b44ac89e6d vp90_2_02_size_132x132.webm-132x132-0004.i420 +16071c396c07639360260d6544bbc198 vp90_2_02_size_132x132.webm-132x132-0005.i420 +8876317adaf2ee98682b0dbfa50b9cbc vp90_2_02_size_132x132.webm-132x132-0006.i420 +a30299b275dfd0a08191f6a9f6633138 vp90_2_02_size_132x132.webm-132x132-0007.i420 +49b3e47e41d00cc283d3906bde82abc7 vp90_2_02_size_132x132.webm-132x132-0008.i420 +a922b8d8d9883b5fd05358724a1a84c2 vp90_2_02_size_132x132.webm-132x132-0009.i420 +1bc5c3b99f979087cd6065a9894b0d6d vp90_2_02_size_132x132.webm-132x132-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x08.webm.md5 new file mode 100644 index 0000000..3e3e92a --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x08.webm.md5 @@ -0,0 +1,10 @@ +68dccd167f9aa18df0840ebb8715eb68 vp90-2-02-size-16x08-16x8-0001.i420 +65c90bb99fdbee7abf21031d34cb18dc vp90-2-02-size-16x08-16x8-0002.i420 +9ef1feb2dcbd4d73f3ee84e9e1cd2668 vp90-2-02-size-16x08-16x8-0003.i420 +b6281f7c88e9aa132d3902046f8cde5a vp90-2-02-size-16x08-16x8-0004.i420 +4b439b716a294bddf9f56a229705907b vp90-2-02-size-16x08-16x8-0005.i420 +d42c0a6f0d24522c90bc2233bc1df2c7 vp90-2-02-size-16x08-16x8-0006.i420 +74b763a5a12c4c4a581efb1818a92970 vp90-2-02-size-16x08-16x8-0007.i420 +0c3a0916ddfda5abdd3ac382f036e71f vp90-2-02-size-16x08-16x8-0008.i420 +26ff590e8ae726f70e8b36f5eaee7a19 vp90-2-02-size-16x08-16x8-0009.i420 +30fa5810995d7132387ea585c4a1cc3a vp90-2-02-size-16x08-16x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x10.webm.md5 new file mode 100644 index 0000000..9e00483 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x10.webm.md5 @@ -0,0 +1,10 @@ +fb3cad61d7d9eb511758dbf87dd8abe1 vp90-2-02-size-16x10-16x10-0001.i420 +4fbc1aa5559c8db2930803893bd6ba75 vp90-2-02-size-16x10-16x10-0002.i420 +2d8e2ee04dcc6097ca9e3f27070cdcc8 vp90-2-02-size-16x10-16x10-0003.i420 +05d419f1322855ba3620665b68ce9910 vp90-2-02-size-16x10-16x10-0004.i420 +b004f8d88cb2c94f4e9a13cfa5bd480a vp90-2-02-size-16x10-16x10-0005.i420 +9d9dec90e2213c0411939131aa9adf7f vp90-2-02-size-16x10-16x10-0006.i420 +a00874356ff1b1e9da1a400424661f8d vp90-2-02-size-16x10-16x10-0007.i420 +fda587eb6323cd98c773f05905ac1794 vp90-2-02-size-16x10-16x10-0008.i420 +781c63d221a04d8130806c799d16753a vp90-2-02-size-16x10-16x10-0009.i420 +f346e311829f3789dc5a94da48ada5f4 vp90-2-02-size-16x10-16x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x16.webm.md5 new file mode 100644 index 0000000..11de2b8 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x16.webm.md5 @@ -0,0 +1,10 @@ +b5c9daafa548e54a8e33e9881fda33f4 vp90-2-02-size-16x16-16x16-0001.i420 +1193acd7ea4b7aac968e35ef83c64378 vp90-2-02-size-16x16-16x16-0002.i420 +cd0e42c0b5a8b3be6f0e1d224062bf99 vp90-2-02-size-16x16-16x16-0003.i420 +ed79c71d17f68f86cbfa75ea2bfe97f3 vp90-2-02-size-16x16-16x16-0004.i420 +1502a859c7e07b31faad5b80e3e27cf7 vp90-2-02-size-16x16-16x16-0005.i420 +df3f093da914ea947db93c3baa188ecb vp90-2-02-size-16x16-16x16-0006.i420 +480f86eb183b99277c1b38fdaafe2970 vp90-2-02-size-16x16-16x16-0007.i420 +023e0114282e04963f0f52e00e65ac61 vp90-2-02-size-16x16-16x16-0008.i420 +e67f29cf0acc7f9b553458e1e5c59ebf vp90-2-02-size-16x16-16x16-0009.i420 +a779a14ba718f0c1df8a7edc9467d12e vp90-2-02-size-16x16-16x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x18.webm.md5 new file mode 100644 index 0000000..7dcc81a --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x18.webm.md5 @@ -0,0 +1,10 @@ +5156b11cd9995d0c1638c9b0d2b0786c vp90-2-02-size-16x18-16x18-0001.i420 +ef78557f93fb3ea770c7d49ab60edf21 vp90-2-02-size-16x18-16x18-0002.i420 +f31fb9bb14566e4538a45ac7bf398b2a vp90-2-02-size-16x18-16x18-0003.i420 +97633875537f76ade183e975fa91b0fb vp90-2-02-size-16x18-16x18-0004.i420 +602cf54f9af852175173c21abd63796f vp90-2-02-size-16x18-16x18-0005.i420 +0b3741a6842cb65d6d21eda891882033 vp90-2-02-size-16x18-16x18-0006.i420 +44240a27a6b6d36c9661d499fb965f87 vp90-2-02-size-16x18-16x18-0007.i420 +9050f263f9a4767f9323ec8aa42cf7e6 vp90-2-02-size-16x18-16x18-0008.i420 +57fa3a8494375f588a95376bc0c3cb28 vp90-2-02-size-16x18-16x18-0009.i420 +084595f2a65aa10e7d3845044a0e7213 vp90-2-02-size-16x18-16x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x32.webm.md5 new file mode 100644 index 0000000..f7b1555 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x32.webm.md5 @@ -0,0 +1,10 @@ +c73d611490a5ddec6c690589deaf5e86 vp90-2-02-size-16x32-16x32-0001.i420 +5d8eaeb222aa64abda59ce7b09b2f6d9 vp90-2-02-size-16x32-16x32-0002.i420 +34321856b8dd5bbb9b63db04d3532289 vp90-2-02-size-16x32-16x32-0003.i420 +947337d2fec8a09242f60e31e99f4065 vp90-2-02-size-16x32-16x32-0004.i420 +bb7d92f6fc055f0cf0e97bd2be56cc9e vp90-2-02-size-16x32-16x32-0005.i420 +5d343c82bcdd0e9d08581043cddfd0ca vp90-2-02-size-16x32-16x32-0006.i420 +612ded93207712e4916d584cc4a7b87c vp90-2-02-size-16x32-16x32-0007.i420 +6ba5e0d19893e1b96f5ca86e0bfd7e18 vp90-2-02-size-16x32-16x32-0008.i420 +336572e1dcb110b1eb87bea81e0752f4 vp90-2-02-size-16x32-16x32-0009.i420 +705f73d0a39afce59ea571e68bfe25df vp90-2-02-size-16x32-16x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x34.webm.md5 new file mode 100644 index 0000000..169e06c --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x34.webm.md5 @@ -0,0 +1,10 @@ +b8bf711d9a1ce49180ed56407c8a4b0a vp90-2-02-size-16x34-16x34-0001.i420 +0457929b06ce46aec63d66bd38586e3f vp90-2-02-size-16x34-16x34-0002.i420 +3b5f417ee5a936797a6f0d138b8ed73b vp90-2-02-size-16x34-16x34-0003.i420 +5d1a42aeecfd5c8513cb2df94c206c8b vp90-2-02-size-16x34-16x34-0004.i420 +a0ab2dddbc810a1667d779f6ed69d010 vp90-2-02-size-16x34-16x34-0005.i420 +b150cd7c4ec83e6f9d948e99d7465350 vp90-2-02-size-16x34-16x34-0006.i420 +ea39622ad21312bd8bcecdaf09aa18fb vp90-2-02-size-16x34-16x34-0007.i420 +467a42e1226a01c8ba244f312f588bab vp90-2-02-size-16x34-16x34-0008.i420 +f2311e15228ffc7fd377b89c203d0fbf vp90-2-02-size-16x34-16x34-0009.i420 +5df58b3ac0a7856796a46f27be7dcf4c vp90-2-02-size-16x34-16x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x64.webm.md5 new file mode 100644 index 0000000..5b98188 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x64.webm.md5 @@ -0,0 +1,10 @@ +925fdc485f3baa1ed145ae391519d7fd vp90-2-02-size-16x64-16x64-0001.i420 +d37af656da2d7a727c8451773495d5ed vp90-2-02-size-16x64-16x64-0002.i420 +8a0f207a99e46f3d3b2aaa3f1b061981 vp90-2-02-size-16x64-16x64-0003.i420 +a3914c7b739d3af2641fd6aae35428ef vp90-2-02-size-16x64-16x64-0004.i420 +0ba3b49970d7b029f2dfa991fdfc6e61 vp90-2-02-size-16x64-16x64-0005.i420 +55838d1d787dc5a4fa4da2994f04587f vp90-2-02-size-16x64-16x64-0006.i420 +c089f7ba2b2983df2a4dc2e07798af31 vp90-2-02-size-16x64-16x64-0007.i420 +c23dcb3b109543a61ccfa404a726caae vp90-2-02-size-16x64-16x64-0008.i420 +01aaf09960f5ca599ca32768f017d0c9 vp90-2-02-size-16x64-16x64-0009.i420 +79fe955692ecba8bbb00b20a42ca8104 vp90-2-02-size-16x64-16x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-16x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-16x66.webm.md5 new file mode 100644 index 0000000..34f48af --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-16x66.webm.md5 @@ -0,0 +1,10 @@ +c7b0d91f362dff0a581434af6e902d43 vp90-2-02-size-16x66-16x66-0001.i420 +d8b016ef59c6bc193b29d1c714f342c1 vp90-2-02-size-16x66-16x66-0002.i420 +c520bd8d4b81aafc7687befff66c7396 vp90-2-02-size-16x66-16x66-0003.i420 +92e81bbd3af675c9cdb1cb00d03dabe1 vp90-2-02-size-16x66-16x66-0004.i420 +a271db3defe5daa6d9e0a73a580f4f88 vp90-2-02-size-16x66-16x66-0005.i420 +4077e857321e241bb98dfd89c0aca46f vp90-2-02-size-16x66-16x66-0006.i420 +0466e1453a94baf876e9f64b60235300 vp90-2-02-size-16x66-16x66-0007.i420 +9d2cb9c7b180d44841e0e4d8a595d912 vp90-2-02-size-16x66-16x66-0008.i420 +500f443eeb0ecef47c34d1e91f0df6ce vp90-2-02-size-16x66-16x66-0009.i420 +83354487982915c33b1c6243d80adaeb vp90-2-02-size-16x66-16x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-178x180.webm.md5 b/testdata/libvpx/vp90-2-02-size-178x180.webm.md5 new file mode 100644 index 0000000..8af554c --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-178x180.webm.md5 @@ -0,0 +1,10 @@ +ca7515c880d0a8230432e77abf3e3d33 vp90_2_02_size_178x180.webm-178x180-0001.i420 +7612d57deeb9d947529f73dd1b64a08d vp90_2_02_size_178x180.webm-178x180-0002.i420 +a230690af19b975ffaca630e84e648fe vp90_2_02_size_178x180.webm-178x180-0003.i420 +c6f829cb3462fcc0f7259819797c3283 vp90_2_02_size_178x180.webm-178x180-0004.i420 +3d13df53df5abb8d7602ffb0a3c89bb6 vp90_2_02_size_178x180.webm-178x180-0005.i420 +08ed7474c5630c1d7de6e32906f8b62f vp90_2_02_size_178x180.webm-178x180-0006.i420 +d09e4324a86be4e4141fcd72b855744b vp90_2_02_size_178x180.webm-178x180-0007.i420 +2934746d377ee23fd3eaeea27d049210 vp90_2_02_size_178x180.webm-178x180-0008.i420 +9cbad3dfc8a5665f57f483fede1ac91c vp90_2_02_size_178x180.webm-178x180-0009.i420 +9c2dc6879c5778f293db30eac2fe7103 vp90_2_02_size_178x180.webm-178x180-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-180x178.webm.md5 b/testdata/libvpx/vp90-2-02-size-180x178.webm.md5 new file mode 100644 index 0000000..dd72479 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-180x178.webm.md5 @@ -0,0 +1,10 @@ +461aa52a5658cbb30320be36bf42867d vp90_2_02_size_180x178.webm-180x178-0001.i420 +a6c5fb033c04b5bdbe47a07a2ea8a001 vp90_2_02_size_180x178.webm-180x178-0002.i420 +de1d2789826b143aaae0b7c337332a69 vp90_2_02_size_180x178.webm-180x178-0003.i420 +aaf60e6369a72ea8fe47b3767b6b4aef vp90_2_02_size_180x178.webm-180x178-0004.i420 +40c6bfaf1f4bcd39d6c6cf588ea445cb vp90_2_02_size_180x178.webm-180x178-0005.i420 +3bfe6508595fb0c000c196cb6387531b vp90_2_02_size_180x178.webm-180x178-0006.i420 +b70dcaad6d9dd7fe378b323460c3a243 vp90_2_02_size_180x178.webm-180x178-0007.i420 +201fce98c70f2623196a44e40a4850ac vp90_2_02_size_180x178.webm-180x178-0008.i420 +aba16ce70b06355a025d003d6974790b vp90_2_02_size_180x178.webm-180x178-0009.i420 +39220f4dd594972d258788528d19460c vp90_2_02_size_180x178.webm-180x178-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-180x180.webm.md5 b/testdata/libvpx/vp90-2-02-size-180x180.webm.md5 new file mode 100644 index 0000000..f257f21 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-180x180.webm.md5 @@ -0,0 +1,10 @@ +325a336bcaf9987ab1ad3f6a7328d2be vp90_2_02_size_180x180.webm-180x180-0001.i420 +e7d73157a4861d98318240b60d157f55 vp90_2_02_size_180x180.webm-180x180-0002.i420 +1db60eb53a9756c751325942a021b36e vp90_2_02_size_180x180.webm-180x180-0003.i420 +c0adb82dc19f4cabcebd18f0d7712ee5 vp90_2_02_size_180x180.webm-180x180-0004.i420 +35b768881097c1e6b99814e4fbf905d1 vp90_2_02_size_180x180.webm-180x180-0005.i420 +c3af16f1334c6baa0a51086f57c7cfd5 vp90_2_02_size_180x180.webm-180x180-0006.i420 +d30718f4a93162e7752e5177096718ee vp90_2_02_size_180x180.webm-180x180-0007.i420 +b73f17d3affa5a9f69273579c09f4566 vp90_2_02_size_180x180.webm-180x180-0008.i420 +f596f4234d2486985a2d94ce73bd72ad vp90_2_02_size_180x180.webm-180x180-0009.i420 +aab77693ee7b744c81a0b913f5318ac2 vp90_2_02_size_180x180.webm-180x180-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x08.webm.md5 new file mode 100644 index 0000000..19f6cbe --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x08.webm.md5 @@ -0,0 +1,10 @@ +3219af4ef540636b0f67a989e9966059 vp90-2-02-size-18x08-18x8-0001.i420 +1a3655c2cfd2ee332bc89da5b3faf778 vp90-2-02-size-18x08-18x8-0002.i420 +d638d5b361a6d81440e26993ed86c97d vp90-2-02-size-18x08-18x8-0003.i420 +d9bc2e7cffd66db4ba9dcbce99448d4d vp90-2-02-size-18x08-18x8-0004.i420 +399f962e0a0573915bc4da4a9f1effcf vp90-2-02-size-18x08-18x8-0005.i420 +69d917e19b903e4f07f848e9e557bbe7 vp90-2-02-size-18x08-18x8-0006.i420 +d6311488a58acf6eb0cc45bc4fe3c2da vp90-2-02-size-18x08-18x8-0007.i420 +0ce360a84d5755307f98d65c83f190e1 vp90-2-02-size-18x08-18x8-0008.i420 +2554828e6dbf94424ccac30fb153872e vp90-2-02-size-18x08-18x8-0009.i420 +598a55f9735e85b8d45105dd6be7f97b vp90-2-02-size-18x08-18x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x10.webm.md5 new file mode 100644 index 0000000..f79825a --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x10.webm.md5 @@ -0,0 +1,10 @@ +bf574489e9360b6475aa012c747e7924 vp90-2-02-size-18x10-18x10-0001.i420 +851100301c2937312a6fd32f5aab5a09 vp90-2-02-size-18x10-18x10-0002.i420 +0f7c1209e44ea7cd4df12d82f9224684 vp90-2-02-size-18x10-18x10-0003.i420 +28d121f9c40de5280435bfdeaec0c072 vp90-2-02-size-18x10-18x10-0004.i420 +bb00898d03ce4dff5f7bee719dd3f5b5 vp90-2-02-size-18x10-18x10-0005.i420 +a098cc66bc25b81f84b0e930b0915cdb vp90-2-02-size-18x10-18x10-0006.i420 +81e25f19bfcbfce17bd7138eedae04ee vp90-2-02-size-18x10-18x10-0007.i420 +69c36c5ce555a461f16a1733450f7258 vp90-2-02-size-18x10-18x10-0008.i420 +c95236d9e7c624bb664310bd9ef47fb4 vp90-2-02-size-18x10-18x10-0009.i420 +7ab0942e686939951037314e9402d2c1 vp90-2-02-size-18x10-18x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x16.webm.md5 new file mode 100644 index 0000000..aeafea2 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x16.webm.md5 @@ -0,0 +1,10 @@ +9535aaa2ea26fbdc16e7fe9cba3fc9b4 vp90-2-02-size-18x16-18x16-0001.i420 +7f6e7ca33c0b27ff052dc2ab6721e37d vp90-2-02-size-18x16-18x16-0002.i420 +d37e3f169457a9c7f2a197353e39d3d6 vp90-2-02-size-18x16-18x16-0003.i420 +f26d7d81dd81d051680ea2485e812705 vp90-2-02-size-18x16-18x16-0004.i420 +704b01955ced6d101b9e9315d3327f28 vp90-2-02-size-18x16-18x16-0005.i420 +30d46d6a0f6be383dede451cacf465f4 vp90-2-02-size-18x16-18x16-0006.i420 +83c7ed04f0af61ec665041967cbce05d vp90-2-02-size-18x16-18x16-0007.i420 +152daf37dd37607886c50dd4c7796357 vp90-2-02-size-18x16-18x16-0008.i420 +609d807351ba74b1c432e3d0516add91 vp90-2-02-size-18x16-18x16-0009.i420 +67953f0c735984232cb6782217cdcdf6 vp90-2-02-size-18x16-18x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x18.webm.md5 new file mode 100644 index 0000000..9600c40 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x18.webm.md5 @@ -0,0 +1,10 @@ +83790b0e7004d8d89b7134ee1a88d885 vp90-2-02-size-18x18-18x18-0001.i420 +0baf0bf556ae56d2f4b04567e6ac7ed9 vp90-2-02-size-18x18-18x18-0002.i420 +c648854a4d49f7e407a2450cf4ba292a vp90-2-02-size-18x18-18x18-0003.i420 +510c3aca23339841ffc72ed5c75d184e vp90-2-02-size-18x18-18x18-0004.i420 +1c1f3116ec4d4ee1ad790652e49233ad vp90-2-02-size-18x18-18x18-0005.i420 +f94891f4e16fd32d638a2c696f5922e6 vp90-2-02-size-18x18-18x18-0006.i420 +e164814c22e38cbe45312dfd48d987fc vp90-2-02-size-18x18-18x18-0007.i420 +f582515fcc6c4308ad931d2f6cf371a0 vp90-2-02-size-18x18-18x18-0008.i420 +0a446974bd227ee34a1621a2b7852abb vp90-2-02-size-18x18-18x18-0009.i420 +beca28bdae8d1fe20036b3646f3109cd vp90-2-02-size-18x18-18x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x32.webm.md5 new file mode 100644 index 0000000..697fa7d --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x32.webm.md5 @@ -0,0 +1,10 @@ +62eabc8819ded6ddba2c3a5029497cf0 vp90-2-02-size-18x32-18x32-0001.i420 +b760182fddf8bc05f149e80bbcb2c281 vp90-2-02-size-18x32-18x32-0002.i420 +0c44be0472ebd2653ce9fb174c6180ab vp90-2-02-size-18x32-18x32-0003.i420 +bbb033c3bfeeb6f59cb43013597b9d92 vp90-2-02-size-18x32-18x32-0004.i420 +a769975cdbc6529525f7cac8a0d9299a vp90-2-02-size-18x32-18x32-0005.i420 +15b02059bbced62f19c0626efea1ecb9 vp90-2-02-size-18x32-18x32-0006.i420 +47f4b50322ed31649bdcfffb05c70fa2 vp90-2-02-size-18x32-18x32-0007.i420 +8649cdd0a958047839f5b6e7bbf6f288 vp90-2-02-size-18x32-18x32-0008.i420 +2c766e3fd3882a9a5aff52ffe9d1d341 vp90-2-02-size-18x32-18x32-0009.i420 +184a62b7332a1c24acbf03f670fb7ac1 vp90-2-02-size-18x32-18x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x34.webm.md5 new file mode 100644 index 0000000..2b9926c --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x34.webm.md5 @@ -0,0 +1,10 @@ +612cc424eaae924cb25c7732c422f752 vp90-2-02-size-18x34-18x34-0001.i420 +010e8c2a814862529fcf8d7771ba2d7f vp90-2-02-size-18x34-18x34-0002.i420 +7d791b7a5916738998f77586339d5840 vp90-2-02-size-18x34-18x34-0003.i420 +aeada5f59f3dda9ab3e898f305428cb2 vp90-2-02-size-18x34-18x34-0004.i420 +06af894d38a1f0d3665c0081f5397ddf vp90-2-02-size-18x34-18x34-0005.i420 +24bf31323c568e652550e9d35de9c96c vp90-2-02-size-18x34-18x34-0006.i420 +a9681ec47d3e6a19321b9ea47221dc3f vp90-2-02-size-18x34-18x34-0007.i420 +73ae7268df79c4012952bd3e8011e894 vp90-2-02-size-18x34-18x34-0008.i420 +67aa4145398ca17036959251cb4ce17b vp90-2-02-size-18x34-18x34-0009.i420 +de247b80114c722da849f5aa23adbb38 vp90-2-02-size-18x34-18x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x64.webm.md5 new file mode 100644 index 0000000..0fbd0c0 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x64.webm.md5 @@ -0,0 +1,10 @@ +72c74de547d9ed1b17bc962dbd5e0bb1 vp90-2-02-size-18x64-18x64-0001.i420 +462849f9e2204738e9f08b40e682a6ae vp90-2-02-size-18x64-18x64-0002.i420 +f0ee17692fd816747b11d5737b511cda vp90-2-02-size-18x64-18x64-0003.i420 +0234d23406660ede76dd22b35a708390 vp90-2-02-size-18x64-18x64-0004.i420 +6544fdb9dc225d155820d3c7dfc909eb vp90-2-02-size-18x64-18x64-0005.i420 +1c073544794389596177512fb4dcffce vp90-2-02-size-18x64-18x64-0006.i420 +864709daac7b091d33afa2210c145084 vp90-2-02-size-18x64-18x64-0007.i420 +b049c4ac941743613ede9a41b16acde5 vp90-2-02-size-18x64-18x64-0008.i420 +ad0c4adb0efec03729a79f42eec66267 vp90-2-02-size-18x64-18x64-0009.i420 +146057d941f5a47eb8b2c9eefeaf3100 vp90-2-02-size-18x64-18x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-18x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-18x66.webm.md5 new file mode 100644 index 0000000..46a7a3d --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-18x66.webm.md5 @@ -0,0 +1,10 @@ +c3fc4a1593b9cc2f3752106af8539386 vp90-2-02-size-18x66-18x66-0001.i420 +7f2ffe6bc1750f6749bb5ad12cbaf34b vp90-2-02-size-18x66-18x66-0002.i420 +2539b10a981d59ef54efd77cd7276aaa vp90-2-02-size-18x66-18x66-0003.i420 +0bff22b4dfb7485fbedd6ff5b99673d1 vp90-2-02-size-18x66-18x66-0004.i420 +6a2b38f4abee785260a61bc60f16e7fa vp90-2-02-size-18x66-18x66-0005.i420 +2fbb69b5519b51548bf1ee425ff79c55 vp90-2-02-size-18x66-18x66-0006.i420 +dbd267028be2256111b2411b91fcc117 vp90-2-02-size-18x66-18x66-0007.i420 +12b2f1003633c9e19cae3d0fda06102d vp90-2-02-size-18x66-18x66-0008.i420 +d419a756c492867523af5185fd57d989 vp90-2-02-size-18x66-18x66-0009.i420 +8a7d36760bf5db32baef349b97316b47 vp90-2-02-size-18x66-18x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x08.webm.md5 new file mode 100644 index 0000000..b744f57 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x08.webm.md5 @@ -0,0 +1,10 @@ +c7b30cde5664387b0f7a80d9b01e4fe2 vp90-2-02-size-32x08-32x8-0001.i420 +2228a2a4e54ab5145525e5803c314dcd vp90-2-02-size-32x08-32x8-0002.i420 +8c048469eba24f3163c36b7461b3b42a vp90-2-02-size-32x08-32x8-0003.i420 +f6b8e8e701dea09dcf1158e9a52921c6 vp90-2-02-size-32x08-32x8-0004.i420 +b3a5fde0daf2eef8fc08521f88f79692 vp90-2-02-size-32x08-32x8-0005.i420 +653ae11cc1380ae7f39b2e007f896d81 vp90-2-02-size-32x08-32x8-0006.i420 +6e66fe002a7dff95e13cc9d3d13d9686 vp90-2-02-size-32x08-32x8-0007.i420 +13308c917a1e22c2f702afc32b8a23c2 vp90-2-02-size-32x08-32x8-0008.i420 +4fee1e63f9452dc3f81c1d634bd7f41d vp90-2-02-size-32x08-32x8-0009.i420 +666b43ead5c7c99ae5b7637da5aa4d62 vp90-2-02-size-32x08-32x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x10.webm.md5 new file mode 100644 index 0000000..cb40846 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x10.webm.md5 @@ -0,0 +1,10 @@ +7c5b5df373ebfd31d210ff910e02213b vp90-2-02-size-32x10-32x10-0001.i420 +c5b0a5e3eceb792b15818324a43aa2a8 vp90-2-02-size-32x10-32x10-0002.i420 +1d9c0eafd4638dfe4fe308174fde2faf vp90-2-02-size-32x10-32x10-0003.i420 +47301d12055944b35008028761cf5e7b vp90-2-02-size-32x10-32x10-0004.i420 +9586ac1087423dcd3b0ff96d43ae475e vp90-2-02-size-32x10-32x10-0005.i420 +26bfe1afea96c7ef2084fffd1fa99a33 vp90-2-02-size-32x10-32x10-0006.i420 +0995c8a1935266159a7ef3f95d7f4697 vp90-2-02-size-32x10-32x10-0007.i420 +8cfcc0ea67507ab7f3551d8ac50f93a5 vp90-2-02-size-32x10-32x10-0008.i420 +658cf3cb887b055d9de7d50db4eb78a9 vp90-2-02-size-32x10-32x10-0009.i420 +856bd5189688f7ccfe9995752bc0f1f6 vp90-2-02-size-32x10-32x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x16.webm.md5 new file mode 100644 index 0000000..7609114 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x16.webm.md5 @@ -0,0 +1,10 @@ +7c2818db2632e5c5beee17e7105d9209 vp90-2-02-size-32x16-32x16-0001.i420 +cead72bd22995e98b54a91c7b4a20975 vp90-2-02-size-32x16-32x16-0002.i420 +eb6baee5d65d778052c88ba5db2f9174 vp90-2-02-size-32x16-32x16-0003.i420 +1f5f38e89e985e9e4172446de05e91fd vp90-2-02-size-32x16-32x16-0004.i420 +57b57ffcb03627942fc5868324a10feb vp90-2-02-size-32x16-32x16-0005.i420 +4b4066a452d8e9cd687cd611f5d9cb88 vp90-2-02-size-32x16-32x16-0006.i420 +113e5069b2a4d2c2e802b72649eb435d vp90-2-02-size-32x16-32x16-0007.i420 +e176bb233f76f9fd4c55d62d53487b60 vp90-2-02-size-32x16-32x16-0008.i420 +f2ff3def712a846ea7b678bd9078e32b vp90-2-02-size-32x16-32x16-0009.i420 +21007ed1c727c5ccc5955188a2cec276 vp90-2-02-size-32x16-32x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x18.webm.md5 new file mode 100644 index 0000000..4bd047f --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x18.webm.md5 @@ -0,0 +1,10 @@ +9da5409d344e7b8380688569e54803a5 vp90-2-02-size-32x18-32x18-0001.i420 +9b51e14e2e624ee2b430e9eaf1a48798 vp90-2-02-size-32x18-32x18-0002.i420 +b8811779f363b9a595e3a92737771ea9 vp90-2-02-size-32x18-32x18-0003.i420 +e5a0c335e5e713a3e77fff0b65127fb9 vp90-2-02-size-32x18-32x18-0004.i420 +1bffa3283b463a356794c8f7a73f8c54 vp90-2-02-size-32x18-32x18-0005.i420 +97c13270621a583eb9e13c05f9d792f0 vp90-2-02-size-32x18-32x18-0006.i420 +a6f81a4dde1ffc352ebe9d8ab8782f35 vp90-2-02-size-32x18-32x18-0007.i420 +91a955a86ce9378ff3442794ce0934c6 vp90-2-02-size-32x18-32x18-0008.i420 +2e4f8938e9c88b328a258a0b99366ea6 vp90-2-02-size-32x18-32x18-0009.i420 +adbbbc192cf36e1fc7c308824765d482 vp90-2-02-size-32x18-32x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x32.webm.md5 new file mode 100644 index 0000000..4e5b3c4 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x32.webm.md5 @@ -0,0 +1,10 @@ +117915db1856cee26f05a609c8c8de2e vp90-2-02-size-32x32-32x32-0001.i420 +943771a98b26b174e88ed1f4e872e504 vp90-2-02-size-32x32-32x32-0002.i420 +3e0d2585e1f1cb540998d107aca5c395 vp90-2-02-size-32x32-32x32-0003.i420 +e64a9e1e0232983a69ab48453025b23d vp90-2-02-size-32x32-32x32-0004.i420 +2c6ef6637fb7b9425f7d7ea28cd84087 vp90-2-02-size-32x32-32x32-0005.i420 +419a5a31a43955d408c13ee8a5ddce9c vp90-2-02-size-32x32-32x32-0006.i420 +2ab13e1c236553d42d59498ca350b190 vp90-2-02-size-32x32-32x32-0007.i420 +b8068beb037f3232d4da38fe33a8a885 vp90-2-02-size-32x32-32x32-0008.i420 +160df68b9e3f75e9b1f8ed7cce327bc2 vp90-2-02-size-32x32-32x32-0009.i420 +1ccafa8c7babdce0983aeb20d298b0ee vp90-2-02-size-32x32-32x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x34.webm.md5 new file mode 100644 index 0000000..28b1e11 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x34.webm.md5 @@ -0,0 +1,10 @@ +770582911fd0095ebbeae384e87665ac vp90-2-02-size-32x34-32x34-0001.i420 +f99d7e3131f04413cba2f9de6818976d vp90-2-02-size-32x34-32x34-0002.i420 +3bfbb8c9c48f24cd596973a6deb33a3f vp90-2-02-size-32x34-32x34-0003.i420 +0b8166afdd357f20c76f77d228bb7171 vp90-2-02-size-32x34-32x34-0004.i420 +3a3d7f2a03e19a82250d6ca0238f9791 vp90-2-02-size-32x34-32x34-0005.i420 +9b558f9b8744b016059f69f3fca90d2c vp90-2-02-size-32x34-32x34-0006.i420 +c857736342f1145d919cb77732120006 vp90-2-02-size-32x34-32x34-0007.i420 +11dc5dda4c883a3146db060dd50343d0 vp90-2-02-size-32x34-32x34-0008.i420 +7526a62ae87de174be86eac7bb36c7f3 vp90-2-02-size-32x34-32x34-0009.i420 +9ef38f47cfc461710ff0dd75690473c0 vp90-2-02-size-32x34-32x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x64.webm.md5 new file mode 100644 index 0000000..d00ccc6 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x64.webm.md5 @@ -0,0 +1,10 @@ +caa8471a8b381d53c3e8fc627946a871 vp90-2-02-size-32x64-32x64-0001.i420 +2cba86ea14c0f28e242625b08f5e9b88 vp90-2-02-size-32x64-32x64-0002.i420 +cea0440ff6569fc82c3030e0340fb649 vp90-2-02-size-32x64-32x64-0003.i420 +c18ef37f1356ade96a2f40af954b31c8 vp90-2-02-size-32x64-32x64-0004.i420 +21e6e549378bcff47913ef292e74dc37 vp90-2-02-size-32x64-32x64-0005.i420 +a9d3d483f74a5afe5d80725ce696fd20 vp90-2-02-size-32x64-32x64-0006.i420 +a436e2586b0963747deaf5e450e2b230 vp90-2-02-size-32x64-32x64-0007.i420 +9daaadf265df56974cb0950843d9fd8c vp90-2-02-size-32x64-32x64-0008.i420 +e0b84714bad2519e62b7d16705fb09d5 vp90-2-02-size-32x64-32x64-0009.i420 +8cdfce574edbe548da7f6cd9a7076b9e vp90-2-02-size-32x64-32x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-32x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-32x66.webm.md5 new file mode 100644 index 0000000..4a00973 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-32x66.webm.md5 @@ -0,0 +1,10 @@ +920ea4b8a00d41489d122d641d6e4fe5 vp90-2-02-size-32x66-32x66-0001.i420 +8bfc8d452a79f2978b8e973b77cbf8a8 vp90-2-02-size-32x66-32x66-0002.i420 +09f3f0d31d3377a844fa5385d9b36b9f vp90-2-02-size-32x66-32x66-0003.i420 +df43fae763da9360c8062bb92ee091a8 vp90-2-02-size-32x66-32x66-0004.i420 +445d8c675bb865d1814fcfa6b8a9afd3 vp90-2-02-size-32x66-32x66-0005.i420 +dc7d43db86aac6636724de8790eda555 vp90-2-02-size-32x66-32x66-0006.i420 +d3a9fc272424449ffc5b7e69f8f9948b vp90-2-02-size-32x66-32x66-0007.i420 +11ef33b9bccca54b3703bf24ab55e2d6 vp90-2-02-size-32x66-32x66-0008.i420 +ce31b8bf9b00b427ca956abb800d8034 vp90-2-02-size-32x66-32x66-0009.i420 +e707f824d6e95d482bf3a0b4d52ea069 vp90-2-02-size-32x66-32x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x08.webm.md5 new file mode 100644 index 0000000..2940416 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x08.webm.md5 @@ -0,0 +1,10 @@ +c14f2ba5b4582c9d3a488976814691b3 vp90-2-02-size-34x08-34x8-0001.i420 +4387a4dce19007b7efb810b5a4069749 vp90-2-02-size-34x08-34x8-0002.i420 +ecfe868d28f4861a5612edfd57447a02 vp90-2-02-size-34x08-34x8-0003.i420 +5cba54f568534d29169ac31c8fa505e0 vp90-2-02-size-34x08-34x8-0004.i420 +fe9aab7b3378b9fc3e373ee626b887db vp90-2-02-size-34x08-34x8-0005.i420 +fce72dfc7f9c0cb50ff73761b4d82c1f vp90-2-02-size-34x08-34x8-0006.i420 +d4d98f42b1377e0f0ffaa66aa81d40c3 vp90-2-02-size-34x08-34x8-0007.i420 +65c027646dc95a749ce2d7ad0a6beccc vp90-2-02-size-34x08-34x8-0008.i420 +317b283a0d907270f671272771022e69 vp90-2-02-size-34x08-34x8-0009.i420 +d3e2c008584608502f3e24c5c5f64028 vp90-2-02-size-34x08-34x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x10.webm.md5 new file mode 100644 index 0000000..9e19ab4 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x10.webm.md5 @@ -0,0 +1,10 @@ +fd7212b519783cf4831ce4bff91f2312 vp90-2-02-size-34x10-34x10-0001.i420 +9768722ee939d80a6716865fdebca33d vp90-2-02-size-34x10-34x10-0002.i420 +328ee0f774eeafde00dcc4b9a8f4e9af vp90-2-02-size-34x10-34x10-0003.i420 +f882fa6015fcb042094eadab5fa952cf vp90-2-02-size-34x10-34x10-0004.i420 +4331a3dabeae27d2bf3590eb96ce914a vp90-2-02-size-34x10-34x10-0005.i420 +0e15106bd8e90377f6ed8b464d17159c vp90-2-02-size-34x10-34x10-0006.i420 +8f062653ac2b83f7e541393e838d0e0f vp90-2-02-size-34x10-34x10-0007.i420 +eeb98c1728c1a74510f8bfaf10fc0002 vp90-2-02-size-34x10-34x10-0008.i420 +30bb058a67d6a5ee3693b21cbca5349a vp90-2-02-size-34x10-34x10-0009.i420 +7ce4b79983b3abc37b141a3bea56e0b7 vp90-2-02-size-34x10-34x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x16.webm.md5 new file mode 100644 index 0000000..1c01cd4 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x16.webm.md5 @@ -0,0 +1,10 @@ +e443c43101be00470c6a61c1a2995b5a vp90-2-02-size-34x16-34x16-0001.i420 +1e79b1b46ec704d360b5fb725913b0f1 vp90-2-02-size-34x16-34x16-0002.i420 +6d5e77cafab6bc43498980c515d299d3 vp90-2-02-size-34x16-34x16-0003.i420 +91c3bba5fd2aa29ee54c8f3783cfe5a2 vp90-2-02-size-34x16-34x16-0004.i420 +9548d07c2a6204694d34e973e8339077 vp90-2-02-size-34x16-34x16-0005.i420 +6819a34c7e3c13bee3ea2b18e12e92fd vp90-2-02-size-34x16-34x16-0006.i420 +f75920457f01f65bf30ba1ec41076d4e vp90-2-02-size-34x16-34x16-0007.i420 +3a04f6cc0c348c21464b173ac6005043 vp90-2-02-size-34x16-34x16-0008.i420 +93a3336374e8cc4dfb2c0b4716ab60ec vp90-2-02-size-34x16-34x16-0009.i420 +148af188b8a2ee93de406a01c2af180d vp90-2-02-size-34x16-34x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x18.webm.md5 new file mode 100644 index 0000000..74ee172 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x18.webm.md5 @@ -0,0 +1,10 @@ +ab7eabb355e5163e7451945018fadebd vp90-2-02-size-34x18-34x18-0001.i420 +b9a77cc0c769535808996a6de7b374ff vp90-2-02-size-34x18-34x18-0002.i420 +bd773f11d89091b3c9ebc22d8291dd49 vp90-2-02-size-34x18-34x18-0003.i420 +278c215d6c188752818f07f4d317c0e0 vp90-2-02-size-34x18-34x18-0004.i420 +b59856932c675c1ba587644c23cdb002 vp90-2-02-size-34x18-34x18-0005.i420 +2bcaef04f89326a56025269a68742043 vp90-2-02-size-34x18-34x18-0006.i420 +5abb4a1b96b4bc003cd19a146347c54e vp90-2-02-size-34x18-34x18-0007.i420 +26e36058f451ff80d498ac1c0343489f vp90-2-02-size-34x18-34x18-0008.i420 +57ac43fcc6f1a2c863188aca68d52524 vp90-2-02-size-34x18-34x18-0009.i420 +282467118b5b7a986ccd28d16dab3ea7 vp90-2-02-size-34x18-34x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x32.webm.md5 new file mode 100644 index 0000000..fb6d77d --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x32.webm.md5 @@ -0,0 +1,10 @@ +7e334867e27046fabf0f39365311c38c vp90-2-02-size-34x32-34x32-0001.i420 +d2a49216ecedea62f546e54c1552f163 vp90-2-02-size-34x32-34x32-0002.i420 +f66e10d1779533e5b6e2b98369134833 vp90-2-02-size-34x32-34x32-0003.i420 +0054b8d4393df58eee87784862a29901 vp90-2-02-size-34x32-34x32-0004.i420 +b9cdf3ebea0d1e3f1e0c42db2e11a3c2 vp90-2-02-size-34x32-34x32-0005.i420 +c08a728d955a559457c82e44c3296148 vp90-2-02-size-34x32-34x32-0006.i420 +d05f4c4a8b0e606525c3d388d26a9351 vp90-2-02-size-34x32-34x32-0007.i420 +78fc2544da88a1a21d6626b0f7bbcf8c vp90-2-02-size-34x32-34x32-0008.i420 +90832c4fed05390377551359bb9a91f7 vp90-2-02-size-34x32-34x32-0009.i420 +5290a0e77081863398f36c7ae192710b vp90-2-02-size-34x32-34x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x34.webm.md5 new file mode 100644 index 0000000..36d92f5 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x34.webm.md5 @@ -0,0 +1,10 @@ +1bb98ba89abf6b86f47a851f8126e1ff vp90-2-02-size-34x34-34x34-0001.i420 +b960cc795c179afe7eec360c57fddd7f vp90-2-02-size-34x34-34x34-0002.i420 +a93cd094a80c542ecb7b6ac7720c5eff vp90-2-02-size-34x34-34x34-0003.i420 +f1cd34e4f0bf9b1238769f028708b742 vp90-2-02-size-34x34-34x34-0004.i420 +f01437ad14450d2136a8fc971f180eb7 vp90-2-02-size-34x34-34x34-0005.i420 +8778230f1182c2227bf1e253bd85df4c vp90-2-02-size-34x34-34x34-0006.i420 +1d1d5cf6c5cc9e73a1fa5b882e441d74 vp90-2-02-size-34x34-34x34-0007.i420 +2f7a1867487c56c252e35225f71adb55 vp90-2-02-size-34x34-34x34-0008.i420 +1d1aea21f70ceed596f22ec32d8712ee vp90-2-02-size-34x34-34x34-0009.i420 +260e66df92f32bc853f4cd4ede692ea4 vp90-2-02-size-34x34-34x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x64.webm.md5 new file mode 100644 index 0000000..6a6795e --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x64.webm.md5 @@ -0,0 +1,10 @@ +3856635223f578e1e7f7e7250a53cb8d vp90-2-02-size-34x64-34x64-0001.i420 +ee8d7c3a0ea165420d7e733b9e59219a vp90-2-02-size-34x64-34x64-0002.i420 +3d33f06bac22131f04e3411fc216dc02 vp90-2-02-size-34x64-34x64-0003.i420 +7aea667775077de32250dac25fd24bb3 vp90-2-02-size-34x64-34x64-0004.i420 +43fb534551f153c5e9e60240df0bf3b4 vp90-2-02-size-34x64-34x64-0005.i420 +d42b721aa2242d4258d97f840fdcc901 vp90-2-02-size-34x64-34x64-0006.i420 +e876200d720cbe6e36e0ffb775c5ad6c vp90-2-02-size-34x64-34x64-0007.i420 +453078449d8701270564086e58a1d69e vp90-2-02-size-34x64-34x64-0008.i420 +22cb799a817d45a7591489e6faa31cb9 vp90-2-02-size-34x64-34x64-0009.i420 +628dc3f03bf5dd5cae135ad1e4b9ebf7 vp90-2-02-size-34x64-34x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-34x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-34x66.webm.md5 new file mode 100644 index 0000000..af3cde6 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-34x66.webm.md5 @@ -0,0 +1,10 @@ +bf4e568217906ee4b58dc4707bee8ef6 vp90-2-02-size-34x66-34x66-0001.i420 +f823f8c7b6e47ba43215f3becd35208e vp90-2-02-size-34x66-34x66-0002.i420 +1d986d65b502e77764428e21e77503a6 vp90-2-02-size-34x66-34x66-0003.i420 +73520382bc54d6aee165402518dd7b5d vp90-2-02-size-34x66-34x66-0004.i420 +c84e943758f2d7e37126172728838640 vp90-2-02-size-34x66-34x66-0005.i420 +1d4b298da98e4b66b31ad6874f726aa6 vp90-2-02-size-34x66-34x66-0006.i420 +e67748eeb3c818deb8b51d321cd16a9c vp90-2-02-size-34x66-34x66-0007.i420 +4d1514c63e669261beef9e35b04c241e vp90-2-02-size-34x66-34x66-0008.i420 +57705e2131e2129efbc68b74a1e0459c vp90-2-02-size-34x66-34x66-0009.i420 +681acf1b384856d6e544d8e7a79fc628 vp90-2-02-size-34x66-34x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x08.webm.md5 new file mode 100644 index 0000000..0b40ce8 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x08.webm.md5 @@ -0,0 +1,10 @@ +d801797c94039b0a166d46e151ec912c vp90-2-02-size-64x08-64x8-0001.i420 +161ec22caa3689b214d9ab993424584b vp90-2-02-size-64x08-64x8-0002.i420 +499b589ecf1873e388c256ce948eabb9 vp90-2-02-size-64x08-64x8-0003.i420 +22bc77650e3df70e3e36f2a1b8d8aa71 vp90-2-02-size-64x08-64x8-0004.i420 +750e40530257a68211596a60de18bffa vp90-2-02-size-64x08-64x8-0005.i420 +4f812a92157e7186642656b59bc28a3d vp90-2-02-size-64x08-64x8-0006.i420 +a3f141cec127a2c2e16740b8dd4ce56a vp90-2-02-size-64x08-64x8-0007.i420 +a5ba9959bf65ab6e254e5b359a3d59b5 vp90-2-02-size-64x08-64x8-0008.i420 +baa72b8a57277d9e9ad4b92aab04f5d1 vp90-2-02-size-64x08-64x8-0009.i420 +4cb9aebb6c9d5bd164461726de201549 vp90-2-02-size-64x08-64x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x10.webm.md5 new file mode 100644 index 0000000..acd1ed1 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x10.webm.md5 @@ -0,0 +1,10 @@ +97eb5fd0599d482662eb0a1def5c5ef2 vp90-2-02-size-64x10-64x10-0001.i420 +dfdc1b61b478dcca8d411021486aa2ec vp90-2-02-size-64x10-64x10-0002.i420 +2cf560f068bdcb9e345951739091808e vp90-2-02-size-64x10-64x10-0003.i420 +33cacb04c0797fc7bd774251e04b7fb9 vp90-2-02-size-64x10-64x10-0004.i420 +7fca126c0542c0dcdcf769b156bd85f5 vp90-2-02-size-64x10-64x10-0005.i420 +8a46c5a48cb5bd34be8e647c127f8d61 vp90-2-02-size-64x10-64x10-0006.i420 +1ddf07562c0b7dc68ed61b8e1a09fcf0 vp90-2-02-size-64x10-64x10-0007.i420 +d75911d5eb7fc75ffc3ee40344fc7ed2 vp90-2-02-size-64x10-64x10-0008.i420 +498329c8a01d950286af11e1fcf3ac07 vp90-2-02-size-64x10-64x10-0009.i420 +7a6ec019df5f3e419d389699094f87c3 vp90-2-02-size-64x10-64x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x16.webm.md5 new file mode 100644 index 0000000..dd67756 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x16.webm.md5 @@ -0,0 +1,10 @@ +a43068a364cc42619e62406dcf17ddfc vp90-2-02-size-64x16-64x16-0001.i420 +94691f93299bbf5b6ba3022b02b3e069 vp90-2-02-size-64x16-64x16-0002.i420 +3c8fc275490b4daf63ef6d8f9b7f81f6 vp90-2-02-size-64x16-64x16-0003.i420 +96c06031f0fcad49dfed256c5c737d07 vp90-2-02-size-64x16-64x16-0004.i420 +f722d3a51790b55d070d57d3b9a53d0d vp90-2-02-size-64x16-64x16-0005.i420 +a753b3dfe13f5778f9f054e73e512ef1 vp90-2-02-size-64x16-64x16-0006.i420 +fa12cbe6cbc38fa8a38ecbcf1af8833c vp90-2-02-size-64x16-64x16-0007.i420 +cb42303391ef6f76f77d14d2600cce12 vp90-2-02-size-64x16-64x16-0008.i420 +e0c18bb1d4dcc8168b5fdd7c7963987e vp90-2-02-size-64x16-64x16-0009.i420 +581b5291cb60e50326c0dfa6a2d09d8a vp90-2-02-size-64x16-64x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x18.webm.md5 new file mode 100644 index 0000000..4a01c17 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x18.webm.md5 @@ -0,0 +1,10 @@ +adf7e84a351847683f6a8dd177019e29 vp90-2-02-size-64x18-64x18-0001.i420 +8227cf283a27277fbab3d7826e340337 vp90-2-02-size-64x18-64x18-0002.i420 +a5551b16db948e395537310d12128e76 vp90-2-02-size-64x18-64x18-0003.i420 +4b57ed07dbc15de9ab6143656b2a7e8e vp90-2-02-size-64x18-64x18-0004.i420 +a15489495f0acc41f446e9689e4142d6 vp90-2-02-size-64x18-64x18-0005.i420 +b0a0d5d3ff756e8ae19797455432755c vp90-2-02-size-64x18-64x18-0006.i420 +094a440243d36edcdd3e9d0d070de011 vp90-2-02-size-64x18-64x18-0007.i420 +a780bd61e1abbfbb28581784531608bd vp90-2-02-size-64x18-64x18-0008.i420 +55886a8c7aad65683aa9366a38382512 vp90-2-02-size-64x18-64x18-0009.i420 +5ae5b24383f66720a62ed1001664051f vp90-2-02-size-64x18-64x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x32.webm.md5 new file mode 100644 index 0000000..15e0b11 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x32.webm.md5 @@ -0,0 +1,10 @@ +931ab6a2482c3e84bc7ef8dfbc251307 vp90-2-02-size-64x32-64x32-0001.i420 +3552a9d8470a64ed627a6dbb799b7811 vp90-2-02-size-64x32-64x32-0002.i420 +cae1863fc606a0e3df3e708b7eefdf99 vp90-2-02-size-64x32-64x32-0003.i420 +4b825a07e235c4708b12a726da8e4cdf vp90-2-02-size-64x32-64x32-0004.i420 +0dac578ef616a13be2b9db3c0d775524 vp90-2-02-size-64x32-64x32-0005.i420 +bfd47cbab8285f301777351c8bc5553c vp90-2-02-size-64x32-64x32-0006.i420 +f29f9a0cfeaaae3bdeb26933bc7c17dc vp90-2-02-size-64x32-64x32-0007.i420 +c7f3a4d24dcf72ef195a402eff77d8f6 vp90-2-02-size-64x32-64x32-0008.i420 +88ede6207441a7953cf893032c353663 vp90-2-02-size-64x32-64x32-0009.i420 +258f4e86541813e3edb1fe5332ff4ab1 vp90-2-02-size-64x32-64x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x34.webm.md5 new file mode 100644 index 0000000..2727525 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x34.webm.md5 @@ -0,0 +1,10 @@ +68d00958a78e6252dd75d632806e2022 vp90-2-02-size-64x34-64x34-0001.i420 +f7b6266e74200a669eecd241db787ee2 vp90-2-02-size-64x34-64x34-0002.i420 +c8b88d43aee037857310edeb74bc66f4 vp90-2-02-size-64x34-64x34-0003.i420 +c6d9a52baf3ca962574bff1364fcb8dc vp90-2-02-size-64x34-64x34-0004.i420 +b384fbf3ceef0affa69f5e81681edc6e vp90-2-02-size-64x34-64x34-0005.i420 +cd473f0c8d1cde98153402123a3ee7cf vp90-2-02-size-64x34-64x34-0006.i420 +c0f320a23c3e39719a3b3590fe3c2ab5 vp90-2-02-size-64x34-64x34-0007.i420 +751207d15a791728c1022f711a25cd68 vp90-2-02-size-64x34-64x34-0008.i420 +7396df89a0d88044cf7527420d193636 vp90-2-02-size-64x34-64x34-0009.i420 +b772dd247838b0c3ed12713447894323 vp90-2-02-size-64x34-64x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x64.webm.md5 new file mode 100644 index 0000000..9733f63 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x64.webm.md5 @@ -0,0 +1,10 @@ +35f17db9076fa20368fddfa01543c746 vp90-2-02-size-64x64-64x64-0001.i420 +61cd775dfc177262da9a91d3912e6718 vp90-2-02-size-64x64-64x64-0002.i420 +8b8cf175f91425d703332b22b46c1c0e vp90-2-02-size-64x64-64x64-0003.i420 +6041afbdd81e228f8f16384d3f9e988e vp90-2-02-size-64x64-64x64-0004.i420 +d30bd08897b50f518920014c7fa55df9 vp90-2-02-size-64x64-64x64-0005.i420 +fb67222a183876b502f93e48bb779b70 vp90-2-02-size-64x64-64x64-0006.i420 +60830425ca1dcf3df4ee9c6cd75f066a vp90-2-02-size-64x64-64x64-0007.i420 +3e178df858f7fcaa2552a1c5c719b5cc vp90-2-02-size-64x64-64x64-0008.i420 +66718eb0c3981beb7c1119df8a2cd27e vp90-2-02-size-64x64-64x64-0009.i420 +7c1912448c7756f7451888050760d73d vp90-2-02-size-64x64-64x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-64x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-64x66.webm.md5 new file mode 100644 index 0000000..1c4d7e9 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-64x66.webm.md5 @@ -0,0 +1,10 @@ +88587de65acfc85ff56daac8ef5d12e6 vp90-2-02-size-64x66-64x66-0001.i420 +be41f6c788b929b5b6b27c5674f40abd vp90-2-02-size-64x66-64x66-0002.i420 +04ab3f88ca062a6911405fd84c7e9de4 vp90-2-02-size-64x66-64x66-0003.i420 +231436e0a68d19d3882f285d38aca3fb vp90-2-02-size-64x66-64x66-0004.i420 +1a067e147a6740bb4ce57c4184437eea vp90-2-02-size-64x66-64x66-0005.i420 +be0c47e06c7e9439570473adf4713f5f vp90-2-02-size-64x66-64x66-0006.i420 +a213b0611247eafab0711748c25e88a0 vp90-2-02-size-64x66-64x66-0007.i420 +b1df495aa3afb74399f91c74b527b93c vp90-2-02-size-64x66-64x66-0008.i420 +46319f21069541e1ee1652621b957860 vp90-2-02-size-64x66-64x66-0009.i420 +313517a5721b2b14683e7eefc83e51b1 vp90-2-02-size-64x66-64x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x08.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x08.webm.md5 new file mode 100644 index 0000000..1879fe4 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x08.webm.md5 @@ -0,0 +1,10 @@ +3b16847e60786706fc339abc452746ff vp90-2-02-size-66x08-66x8-0001.i420 +365a5951cb127d6df183fe5d5000f493 vp90-2-02-size-66x08-66x8-0002.i420 +6d4bceb815ca7717c4a3f86a6670703a vp90-2-02-size-66x08-66x8-0003.i420 +5a0a03d4788934285448c85788ae8d71 vp90-2-02-size-66x08-66x8-0004.i420 +8712f9a82d07447e7a0d0a37ddc3858d vp90-2-02-size-66x08-66x8-0005.i420 +cff32e6c183c16962207a86d7c6cf0a0 vp90-2-02-size-66x08-66x8-0006.i420 +dc933d90f87110651d7efb39854d3d46 vp90-2-02-size-66x08-66x8-0007.i420 +d1299562a022521f0c3cb30668f83b6d vp90-2-02-size-66x08-66x8-0008.i420 +5054254ca125d7c7e6df4001397170cd vp90-2-02-size-66x08-66x8-0009.i420 +a6bd7c7c0b02afa8d25f911ec847c61a vp90-2-02-size-66x08-66x8-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x10.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x10.webm.md5 new file mode 100644 index 0000000..56a9c16 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x10.webm.md5 @@ -0,0 +1,10 @@ +7cbd8c6b2fb35c0c3063cb7a379944c9 vp90-2-02-size-66x10-66x10-0001.i420 +14062e74b98bed1ca982f408bc14326c vp90-2-02-size-66x10-66x10-0002.i420 +f6d6868d849aa74b27df1c5f40c7096e vp90-2-02-size-66x10-66x10-0003.i420 +719c8d7e3769466ee8e3dca3f4747a0e vp90-2-02-size-66x10-66x10-0004.i420 +a72e1a7a4c82ec09ea77f87b0e6f25aa vp90-2-02-size-66x10-66x10-0005.i420 +a5163d142b429afa155cc2f1401a0b8a vp90-2-02-size-66x10-66x10-0006.i420 +27762d813dd1f80d6aaed5f197124fa5 vp90-2-02-size-66x10-66x10-0007.i420 +02e94454660f3528abbde8f50e94288f vp90-2-02-size-66x10-66x10-0008.i420 +1d57dcfa57a55d96f14cfe471aac2e0b vp90-2-02-size-66x10-66x10-0009.i420 +7804477923c0cd067bd09ebca3529775 vp90-2-02-size-66x10-66x10-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x16.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x16.webm.md5 new file mode 100644 index 0000000..2aae0a2 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x16.webm.md5 @@ -0,0 +1,10 @@ +fa2f292d273c37dc2804a70d1cae1e9d vp90-2-02-size-66x16-66x16-0001.i420 +ba75d90652c021bc7ca061352e6e94ce vp90-2-02-size-66x16-66x16-0002.i420 +e65d9a205bd17d100e50c7b6a7ea772d vp90-2-02-size-66x16-66x16-0003.i420 +46f9e9ff891576b9462f21d48b7b9e2b vp90-2-02-size-66x16-66x16-0004.i420 +d23cedacf3a37cf6b2774e0b18b6b9d7 vp90-2-02-size-66x16-66x16-0005.i420 +84329f7716a6db5a7e64a68a1155bfc6 vp90-2-02-size-66x16-66x16-0006.i420 +ad62286b0e13f4e54df4445cdd4fd4e3 vp90-2-02-size-66x16-66x16-0007.i420 +4511529eb24b21eb63e280070f888642 vp90-2-02-size-66x16-66x16-0008.i420 +4e1c122df1785e0e9134c43c85082e05 vp90-2-02-size-66x16-66x16-0009.i420 +ac3a3747a00be3f9f58155648fcf9b24 vp90-2-02-size-66x16-66x16-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x18.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x18.webm.md5 new file mode 100644 index 0000000..05e3eaf --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x18.webm.md5 @@ -0,0 +1,10 @@ +fda5ad9bf70a51b3a41bdcabf2cce32a vp90-2-02-size-66x18-66x18-0001.i420 +91916fb20ad542a7a3ad276e6505f9b0 vp90-2-02-size-66x18-66x18-0002.i420 +e18e5d11aec483c76afd68f7e64415a4 vp90-2-02-size-66x18-66x18-0003.i420 +c13da01c2b6c09101bda7af93ad5fd07 vp90-2-02-size-66x18-66x18-0004.i420 +ed8d2568b2ad9c7bd980cba0d3b95cff vp90-2-02-size-66x18-66x18-0005.i420 +e6f3cf312b69d37579e77f2e52cc936b vp90-2-02-size-66x18-66x18-0006.i420 +e509f3682e9c4bcdb0889e044b1979b7 vp90-2-02-size-66x18-66x18-0007.i420 +acc3945e557cd7a9642f08a656444976 vp90-2-02-size-66x18-66x18-0008.i420 +44ddd03aa8f03ba393f12fc6a1b3fc17 vp90-2-02-size-66x18-66x18-0009.i420 +fdd3e68132c742d9f0cf0ea6fff2a074 vp90-2-02-size-66x18-66x18-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x32.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x32.webm.md5 new file mode 100644 index 0000000..996f32b --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x32.webm.md5 @@ -0,0 +1,10 @@ +013cd22aea6bfeccc8ec809abd52be5c vp90-2-02-size-66x32-66x32-0001.i420 +0980adfb0ef879b3c960797272f025ad vp90-2-02-size-66x32-66x32-0002.i420 +d1411ffa0429befb8c71d3ab45acee92 vp90-2-02-size-66x32-66x32-0003.i420 +6c6f825379eaf21709a45be77def7a63 vp90-2-02-size-66x32-66x32-0004.i420 +bab632ef00a080739a41c692f2b21c3a vp90-2-02-size-66x32-66x32-0005.i420 +fc0f6045aca252f2e904730227b8f337 vp90-2-02-size-66x32-66x32-0006.i420 +c8dbea209329463bfd9238a11b8d5b17 vp90-2-02-size-66x32-66x32-0007.i420 +457247bf4186ed8459e0a1564f0e68f2 vp90-2-02-size-66x32-66x32-0008.i420 +baa55e20bd7c73960b080d8a0c8db4d5 vp90-2-02-size-66x32-66x32-0009.i420 +dc8933e8edc98cd0cfca44ae22997c62 vp90-2-02-size-66x32-66x32-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x34.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x34.webm.md5 new file mode 100644 index 0000000..ca0e251 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x34.webm.md5 @@ -0,0 +1,10 @@ +6821eb3fcd1d10db32eff70468dcf9c1 vp90-2-02-size-66x34-66x34-0001.i420 +ed0094d347d9f250d46b4903cbc14801 vp90-2-02-size-66x34-66x34-0002.i420 +fd018555dc9a62b8074d46e7c0fd0b40 vp90-2-02-size-66x34-66x34-0003.i420 +05d5baf9f2e62bbeeb3809a099e84147 vp90-2-02-size-66x34-66x34-0004.i420 +7a150c265214269c08e05fe4f296122d vp90-2-02-size-66x34-66x34-0005.i420 +9a7ae61d4bb125ee4c4ccce9cc1c3664 vp90-2-02-size-66x34-66x34-0006.i420 +5a88fd6d96dcbc4255e98dfe19ff96b8 vp90-2-02-size-66x34-66x34-0007.i420 +4192c273a46b2b196c871ead0e61ec71 vp90-2-02-size-66x34-66x34-0008.i420 +e79ebfc47e755f5db221f392c3216278 vp90-2-02-size-66x34-66x34-0009.i420 +b995c5f483a2e553baf4f66d1a47fc57 vp90-2-02-size-66x34-66x34-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x64.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x64.webm.md5 new file mode 100644 index 0000000..9802722 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x64.webm.md5 @@ -0,0 +1,10 @@ +929086fbb3e117bd53110b64c1ee915b vp90-2-02-size-66x64-66x64-0001.i420 +9ed45f5e40dd2393434e14a0c0160c63 vp90-2-02-size-66x64-66x64-0002.i420 +5cdade692b1baf23e61896da18e3e44f vp90-2-02-size-66x64-66x64-0003.i420 +11a2ebac61a3f826ec41c8031899e55c vp90-2-02-size-66x64-66x64-0004.i420 +621a1e0142b94d14db9c2121553a11fb vp90-2-02-size-66x64-66x64-0005.i420 +029a29590f7255f1bc9ff9b7a000ca25 vp90-2-02-size-66x64-66x64-0006.i420 +5fde42becf6bf054d04e2a0fa1b2d55e vp90-2-02-size-66x64-66x64-0007.i420 +5b8ba552cef1931e1412fb4f3420748b vp90-2-02-size-66x64-66x64-0008.i420 +d41cd7d418f6ec1db802a01a90cfee1e vp90-2-02-size-66x64-66x64-0009.i420 +cea99c93a84a82edff8c6069d131453f vp90-2-02-size-66x64-66x64-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-66x66.webm.md5 b/testdata/libvpx/vp90-2-02-size-66x66.webm.md5 new file mode 100644 index 0000000..4cf3ed2 --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-66x66.webm.md5 @@ -0,0 +1,10 @@ +69f9028d52f95d2e7f986c57b19fc018 vp90-2-02-size-66x66-66x66-0001.i420 +068e611f62b3f6222f6b1699748c8fbf vp90-2-02-size-66x66-66x66-0002.i420 +3d3fec78ff2274241a7958f17a773a19 vp90-2-02-size-66x66-66x66-0003.i420 +93d71ef1a2d00c7e70e76ccc1859143d vp90-2-02-size-66x66-66x66-0004.i420 +5a35a640d52bc0930825b963b0b9e830 vp90-2-02-size-66x66-66x66-0005.i420 +782223239e6b1ca1bedbd25d9652a07c vp90-2-02-size-66x66-66x66-0006.i420 +a4b5e8a319cbc9a12d3e36127c7f0fbb vp90-2-02-size-66x66-66x66-0007.i420 +a3e2d9a78fa42b3c817aadfd31fd2d16 vp90-2-02-size-66x66-66x66-0008.i420 +e9fc6b83535735f46006f3e4b376755f vp90-2-02-size-66x66-66x66-0009.i420 +80223f600dfe86021bd0e83fecdc4b2b vp90-2-02-size-66x66-66x66-0010.i420 diff --git a/testdata/libvpx/vp90-2-02-size-lf-1920x1080.webm.md5 b/testdata/libvpx/vp90-2-02-size-lf-1920x1080.webm.md5 new file mode 100644 index 0000000..557ac7a --- /dev/null +++ b/testdata/libvpx/vp90-2-02-size-lf-1920x1080.webm.md5 @@ -0,0 +1,217 @@ +3fb5a1b268b017332fda7fa981032c2c vp90-2-02-size-lf-1920x1080-1920x1080-0001.i420 +7380f42c862bb0418274010f71f8291f vp90-2-02-size-lf-1920x1080-1920x1080-0002.i420 +1931968e92c34f693582d1ae28e7a145 vp90-2-02-size-lf-1920x1080-1920x1080-0003.i420 +40606221248726f3412d8e08e489a94f vp90-2-02-size-lf-1920x1080-1920x1080-0004.i420 +5ecd3fd1d4b607e3d84fb597a948d84b vp90-2-02-size-lf-1920x1080-1920x1080-0005.i420 +db805d6f9289f1525c4ea594bf323fdc vp90-2-02-size-lf-1920x1080-1920x1080-0006.i420 +7584c857279bfcf6e5e1e29557c2a6f0 vp90-2-02-size-lf-1920x1080-1920x1080-0007.i420 +bf436864c58c4d2db1d9b31ce06a8f70 vp90-2-02-size-lf-1920x1080-1920x1080-0008.i420 +9712ccf78bcddc0c44c221c2767e1f28 vp90-2-02-size-lf-1920x1080-1920x1080-0009.i420 +3071176342e59678d99dd8686336e476 vp90-2-02-size-lf-1920x1080-1920x1080-0010.i420 +92cfa56092e8e4d5269de441d31ec739 vp90-2-02-size-lf-1920x1080-1920x1080-0011.i420 +d0bc77ad1997bc38f312846a40d11a16 vp90-2-02-size-lf-1920x1080-1920x1080-0012.i420 +c656c39e3527eee973033b42d4b9deef vp90-2-02-size-lf-1920x1080-1920x1080-0013.i420 +725ccfe5d0736997aa78f7d948692cdb vp90-2-02-size-lf-1920x1080-1920x1080-0014.i420 +51f2245ebc2da1e3bdd0708e9d18e1eb vp90-2-02-size-lf-1920x1080-1920x1080-0015.i420 +530c48d99fad9cddad22ee67ba4fd4d4 vp90-2-02-size-lf-1920x1080-1920x1080-0016.i420 +d55a6ebe71df8d47ac0f2b2f243f740a vp90-2-02-size-lf-1920x1080-1920x1080-0017.i420 +aa84ff7d5dc665441376f8a75bd9bf05 vp90-2-02-size-lf-1920x1080-1920x1080-0018.i420 +70459811c09abf51e7e421656bff1939 vp90-2-02-size-lf-1920x1080-1920x1080-0019.i420 +bb69e3d69ef55a6d19506dd556168901 vp90-2-02-size-lf-1920x1080-1920x1080-0020.i420 +4f1daad761f0949509ffd9873ca03cd4 vp90-2-02-size-lf-1920x1080-1920x1080-0021.i420 +37a037e9de60b411701fda7706db37d6 vp90-2-02-size-lf-1920x1080-1920x1080-0022.i420 +09869838e806717791fe867b018d18ff vp90-2-02-size-lf-1920x1080-1920x1080-0023.i420 +367385d264306ddd25231bb9f8681160 vp90-2-02-size-lf-1920x1080-1920x1080-0024.i420 +42c9da4939d435fcec3def2fa2bc5e26 vp90-2-02-size-lf-1920x1080-1920x1080-0025.i420 +26da302e6e86a632dfa8d8a78e83e269 vp90-2-02-size-lf-1920x1080-1920x1080-0026.i420 +8387287bfa4e62dd575941fab6f95f96 vp90-2-02-size-lf-1920x1080-1920x1080-0027.i420 +7fcc408015aed7f70c0c2321b61d166d vp90-2-02-size-lf-1920x1080-1920x1080-0028.i420 +2394b1c14a156421cc7b30fa95c1a49b vp90-2-02-size-lf-1920x1080-1920x1080-0029.i420 +34d91c69395380155f6f1020cda78bf9 vp90-2-02-size-lf-1920x1080-1920x1080-0030.i420 +3f081ccd624b2648b7fde66e23b05e1d vp90-2-02-size-lf-1920x1080-1920x1080-0031.i420 +ca08738b7c81f2f10ea2f65bf5fd7876 vp90-2-02-size-lf-1920x1080-1920x1080-0032.i420 +f65c4dc7c172666ba3bb9bd402d5767c vp90-2-02-size-lf-1920x1080-1920x1080-0033.i420 +d7ea91467fea6c268b6cd8da9067d12b vp90-2-02-size-lf-1920x1080-1920x1080-0034.i420 +9888aa4a9b3ff09ada838b5ab0f1216c vp90-2-02-size-lf-1920x1080-1920x1080-0035.i420 +015d788822a605d03877454c8ffd065a vp90-2-02-size-lf-1920x1080-1920x1080-0036.i420 +d9d6a53eed5627764c107aafaa64d9a8 vp90-2-02-size-lf-1920x1080-1920x1080-0037.i420 +0b4a40dc0a6a1f5caf16ddd4dde26186 vp90-2-02-size-lf-1920x1080-1920x1080-0038.i420 +4a3f4c2e6d559a1a93b50e716dddf0bf vp90-2-02-size-lf-1920x1080-1920x1080-0039.i420 +d10f631f4a15b6f1060233a6519eefcc vp90-2-02-size-lf-1920x1080-1920x1080-0040.i420 +cc650873b637c244cb1415e39051d013 vp90-2-02-size-lf-1920x1080-1920x1080-0041.i420 +44a697f932e97b7f53a989e429fdca29 vp90-2-02-size-lf-1920x1080-1920x1080-0042.i420 +a09c7c567353412a36776398975fbe6a vp90-2-02-size-lf-1920x1080-1920x1080-0043.i420 +49e3469e2b27fc776bcc0e146910ce2b vp90-2-02-size-lf-1920x1080-1920x1080-0044.i420 +dd3261b098648b62fa0eab900b0056ba vp90-2-02-size-lf-1920x1080-1920x1080-0045.i420 +853f90bb3e23e837ad0cb33106c2256f vp90-2-02-size-lf-1920x1080-1920x1080-0046.i420 +0df1eadd74d643e029188f242af2f533 vp90-2-02-size-lf-1920x1080-1920x1080-0047.i420 +c1d3b56a0a622b176b81400421e87176 vp90-2-02-size-lf-1920x1080-1920x1080-0048.i420 +3c723084af1b727f78fdb9a0e5912a58 vp90-2-02-size-lf-1920x1080-1920x1080-0049.i420 +9806a519be5c399ae8c2b816772786ec vp90-2-02-size-lf-1920x1080-1920x1080-0050.i420 +f25fd27140575595c5f944446e57e502 vp90-2-02-size-lf-1920x1080-1920x1080-0051.i420 +8c8e4f402372d76e2844794d2ddada43 vp90-2-02-size-lf-1920x1080-1920x1080-0052.i420 +c2cce3cc8291978008779f567e912361 vp90-2-02-size-lf-1920x1080-1920x1080-0053.i420 +d3d2819296938ded08b07b2206387afd vp90-2-02-size-lf-1920x1080-1920x1080-0054.i420 +fce62f1e083bf305f966696617549fc8 vp90-2-02-size-lf-1920x1080-1920x1080-0055.i420 +70ccdb87e5d4458ab60fb6b7a263880f vp90-2-02-size-lf-1920x1080-1920x1080-0056.i420 +a8def4b2a416924ac1a8933901e6cdee vp90-2-02-size-lf-1920x1080-1920x1080-0057.i420 +a4f09f6e2f534716e0ab92c094cd0525 vp90-2-02-size-lf-1920x1080-1920x1080-0058.i420 +91e264c9da9dd14b631ef6483a458ead vp90-2-02-size-lf-1920x1080-1920x1080-0059.i420 +8506e8b6033f50212c7a4fb751074667 vp90-2-02-size-lf-1920x1080-1920x1080-0060.i420 +eb14b107652f8f71ff06b1f73fbc8ec7 vp90-2-02-size-lf-1920x1080-1920x1080-0061.i420 +4684a67783e8663bdf275352108f4eef vp90-2-02-size-lf-1920x1080-1920x1080-0062.i420 +9568285e9a9542f5a708a31e2e157c5b vp90-2-02-size-lf-1920x1080-1920x1080-0063.i420 +b5349702a8cb8679a362ba8bc550bf7c vp90-2-02-size-lf-1920x1080-1920x1080-0064.i420 +fb7920dc58fd81ddf221fc9031fbc19f vp90-2-02-size-lf-1920x1080-1920x1080-0065.i420 +b8f752ad92003e481c94beb3b8599214 vp90-2-02-size-lf-1920x1080-1920x1080-0066.i420 +3d93fc99118832ac7c3897f3e9b3a82e vp90-2-02-size-lf-1920x1080-1920x1080-0067.i420 +98003f945aa8ba7aae4d9f6255002f62 vp90-2-02-size-lf-1920x1080-1920x1080-0068.i420 +a18ff6d6fa7645f922de2f3ba4053f49 vp90-2-02-size-lf-1920x1080-1920x1080-0069.i420 +1232126ef24ff4787b11b32223d34018 vp90-2-02-size-lf-1920x1080-1920x1080-0070.i420 +a83f92c62e008939b3de91cdf9c1282f vp90-2-02-size-lf-1920x1080-1920x1080-0071.i420 +cd47127ea0b864e5636222b40cdb5fbe vp90-2-02-size-lf-1920x1080-1920x1080-0072.i420 +544233ce095abea8ffe427a603224ddd vp90-2-02-size-lf-1920x1080-1920x1080-0073.i420 +7192883aca7eda74dd7e61d1cc6f6e2e vp90-2-02-size-lf-1920x1080-1920x1080-0074.i420 +e8db34581dd264810ad683cd6475cf23 vp90-2-02-size-lf-1920x1080-1920x1080-0075.i420 +c215af24670915f3a123beb970ccba22 vp90-2-02-size-lf-1920x1080-1920x1080-0076.i420 +40d89931ddef819030a46d81e114f0b5 vp90-2-02-size-lf-1920x1080-1920x1080-0077.i420 +064781c2e9e9d564c9098be2aa5b6299 vp90-2-02-size-lf-1920x1080-1920x1080-0078.i420 +9ebab2d14446bdd11b62a6b308889b64 vp90-2-02-size-lf-1920x1080-1920x1080-0079.i420 +77ca0761cab449ea90bc8b1e1de5ae3a vp90-2-02-size-lf-1920x1080-1920x1080-0080.i420 +74cb71b2755157dc7c1ef211b2346270 vp90-2-02-size-lf-1920x1080-1920x1080-0081.i420 +23ce88228df42b9e69ad3f4f25dd20cf vp90-2-02-size-lf-1920x1080-1920x1080-0082.i420 +52ac5c9e14482dfde27ad838145c5986 vp90-2-02-size-lf-1920x1080-1920x1080-0083.i420 +929381d60199bb8c250324ca96323008 vp90-2-02-size-lf-1920x1080-1920x1080-0084.i420 +94f9ca3acbe3ed61bffec3f48e1dc43a vp90-2-02-size-lf-1920x1080-1920x1080-0085.i420 +955a4095051cdf3699e5385396a04d69 vp90-2-02-size-lf-1920x1080-1920x1080-0086.i420 +dd784f3a18eae98cae4f795f854d6f03 vp90-2-02-size-lf-1920x1080-1920x1080-0087.i420 +1ebeb7d3d528292c8ae1b54b30692c81 vp90-2-02-size-lf-1920x1080-1920x1080-0088.i420 +f38b83c5b2827c4efddcb6777fd6cd5d vp90-2-02-size-lf-1920x1080-1920x1080-0089.i420 +011dff2cf18e5b4bac6035edf57372d6 vp90-2-02-size-lf-1920x1080-1920x1080-0090.i420 +a1e8ae0f840b6aeddf283f44aa57262e vp90-2-02-size-lf-1920x1080-1920x1080-0091.i420 +bf8f75c177756e4e8c8ad0d494b7921c vp90-2-02-size-lf-1920x1080-1920x1080-0092.i420 +d3e9bf1a44f61e47a3d0f4ca04921a11 vp90-2-02-size-lf-1920x1080-1920x1080-0093.i420 +874f5b4db9dfdb78d9a654a9ce3da4ba vp90-2-02-size-lf-1920x1080-1920x1080-0094.i420 +a8f7ef85e67a1b3c6c730565e0e1ab3e vp90-2-02-size-lf-1920x1080-1920x1080-0095.i420 +33d6e20c9921719b4dcd9ccdcf242ebf vp90-2-02-size-lf-1920x1080-1920x1080-0096.i420 +ee13704be5bb72bc91e05dc07154c8b4 vp90-2-02-size-lf-1920x1080-1920x1080-0097.i420 +8edfa18ab4a51243581302b7b12655c5 vp90-2-02-size-lf-1920x1080-1920x1080-0098.i420 +4d71c47f48e498c525b3a2907b4dad10 vp90-2-02-size-lf-1920x1080-1920x1080-0099.i420 +6de62f06881c7db2e37391f3928f9ac1 vp90-2-02-size-lf-1920x1080-1920x1080-0100.i420 +70f76a47c7ed5568ff4d21c53c58482e vp90-2-02-size-lf-1920x1080-1920x1080-0101.i420 +e7faf1645e75a6d0927336c08a018a34 vp90-2-02-size-lf-1920x1080-1920x1080-0102.i420 +e206df8ed03f809e31f704863851ec77 vp90-2-02-size-lf-1920x1080-1920x1080-0103.i420 +03eb13cf9426514e58deeda33f4766d0 vp90-2-02-size-lf-1920x1080-1920x1080-0104.i420 +e06bc2064d306de26356f6d67c2bc21b vp90-2-02-size-lf-1920x1080-1920x1080-0105.i420 +dd8a993039b6d9c78e2f03c7efcb4984 vp90-2-02-size-lf-1920x1080-1920x1080-0106.i420 +26cb793df8bc7f1ddcd9bd897e877ef0 vp90-2-02-size-lf-1920x1080-1920x1080-0107.i420 +7e3d32618b104c9c47d4464aa2df4709 vp90-2-02-size-lf-1920x1080-1920x1080-0108.i420 +64b1e12d7b87decd877e6c23ffd275d7 vp90-2-02-size-lf-1920x1080-1920x1080-0109.i420 +323ddc3a19c198f7768dacaf6faad602 vp90-2-02-size-lf-1920x1080-1920x1080-0110.i420 +126d984b9bdaf3397ea4ebec52775e7f vp90-2-02-size-lf-1920x1080-1920x1080-0111.i420 +76a4586be73d0401c339790c1045abab vp90-2-02-size-lf-1920x1080-1920x1080-0112.i420 +68466c976fb0309ada2cc7bc514c7d78 vp90-2-02-size-lf-1920x1080-1920x1080-0113.i420 +38135b5505f21ec8d23f97cb29ef1161 vp90-2-02-size-lf-1920x1080-1920x1080-0114.i420 +d657d27a111e9d81b1fbedc7f9c035c9 vp90-2-02-size-lf-1920x1080-1920x1080-0115.i420 +f399d1dc319f560206f09ca5fb59c837 vp90-2-02-size-lf-1920x1080-1920x1080-0116.i420 +269b8a8582e28e11ca3d21dc0f4dc2a6 vp90-2-02-size-lf-1920x1080-1920x1080-0117.i420 +3550fd48042d272f051bb4a6fc76c9df vp90-2-02-size-lf-1920x1080-1920x1080-0118.i420 +5be1f4ed7eea3b62d6c55003ded2906a vp90-2-02-size-lf-1920x1080-1920x1080-0119.i420 +7c607aade4b3451f9a081367584ae5f7 vp90-2-02-size-lf-1920x1080-1920x1080-0120.i420 +a724b1ee8504955503aca7af81425008 vp90-2-02-size-lf-1920x1080-1920x1080-0121.i420 +f58ea230bd73fa111982093742f22055 vp90-2-02-size-lf-1920x1080-1920x1080-0122.i420 +8ad4a70efa7bbc936049de2cd5b973b8 vp90-2-02-size-lf-1920x1080-1920x1080-0123.i420 +4ecbe738e3d31d546332ae248e6ba075 vp90-2-02-size-lf-1920x1080-1920x1080-0124.i420 +507a6fe3e6c95dfec41950382ed49f0e vp90-2-02-size-lf-1920x1080-1920x1080-0125.i420 +833dc6d11dbfc1fa8465b292a66afa32 vp90-2-02-size-lf-1920x1080-1920x1080-0126.i420 +0ac2d4983e91ba36a69d11ae9a32f31a vp90-2-02-size-lf-1920x1080-1920x1080-0127.i420 +0e61c144b842d46b7f63f433dc7be802 vp90-2-02-size-lf-1920x1080-1920x1080-0128.i420 +e93dc18eddef0a93ba652ed898fc4898 vp90-2-02-size-lf-1920x1080-1920x1080-0129.i420 +6745736a1f8ce3dae8532a007023ac6a vp90-2-02-size-lf-1920x1080-1920x1080-0130.i420 +75f9739dc3e003fdb356221a5654c0e4 vp90-2-02-size-lf-1920x1080-1920x1080-0131.i420 +d189cf9fffb8118f31a294deab61585a vp90-2-02-size-lf-1920x1080-1920x1080-0132.i420 +2738879f462aca9015e212e644420b7b vp90-2-02-size-lf-1920x1080-1920x1080-0133.i420 +eff4b276b3c4f454b0822ae4f8d88a0b vp90-2-02-size-lf-1920x1080-1920x1080-0134.i420 +2e461ae7d93bb4cfd4e072a35b651d17 vp90-2-02-size-lf-1920x1080-1920x1080-0135.i420 +bf9a82ea0e3628e4fd1eeb03cb1f50bc vp90-2-02-size-lf-1920x1080-1920x1080-0136.i420 +c8dff3e50d37f9e1ce8b92a0762c57be vp90-2-02-size-lf-1920x1080-1920x1080-0137.i420 +51e6f9efc88a795de0a4d16a6a71d497 vp90-2-02-size-lf-1920x1080-1920x1080-0138.i420 +761b5005e7f8ab8185ccedb660ded250 vp90-2-02-size-lf-1920x1080-1920x1080-0139.i420 +f98da0c03436b1c759d368b9d42db679 vp90-2-02-size-lf-1920x1080-1920x1080-0140.i420 +dec3590e5c11737670703e73ed69783f vp90-2-02-size-lf-1920x1080-1920x1080-0141.i420 +0481f4aec0c9eafb3f9a10cf80c0b056 vp90-2-02-size-lf-1920x1080-1920x1080-0142.i420 +67478cb1e4de699d529046f983105477 vp90-2-02-size-lf-1920x1080-1920x1080-0143.i420 +80f371f7fa43cab698b832a4010e5a88 vp90-2-02-size-lf-1920x1080-1920x1080-0144.i420 +4e9095ab5204a387f63118949bb90f9e vp90-2-02-size-lf-1920x1080-1920x1080-0145.i420 +f943ce3342b90b01fabd3d5bc779bb01 vp90-2-02-size-lf-1920x1080-1920x1080-0146.i420 +1b12d49c5685111fa4faa8edc8b683ad vp90-2-02-size-lf-1920x1080-1920x1080-0147.i420 +8ee848ae53f7b86a254e49562bbfe849 vp90-2-02-size-lf-1920x1080-1920x1080-0148.i420 +2d83c434c41329ae3a8b56c10a27f2e7 vp90-2-02-size-lf-1920x1080-1920x1080-0149.i420 +af6a63fc13b919dabedd86db735990f3 vp90-2-02-size-lf-1920x1080-1920x1080-0150.i420 +a807fce07a52227202dcdcbbfb4eb1bc vp90-2-02-size-lf-1920x1080-1920x1080-0151.i420 +95aebea323577226684914c6b74830c5 vp90-2-02-size-lf-1920x1080-1920x1080-0152.i420 +65d64ebdaadb116608f06add0e8fada2 vp90-2-02-size-lf-1920x1080-1920x1080-0153.i420 +b064af776f8c562ea6b41e0c74710869 vp90-2-02-size-lf-1920x1080-1920x1080-0154.i420 +26291594af160501023eb0035443b7c3 vp90-2-02-size-lf-1920x1080-1920x1080-0155.i420 +79a414d560d3e36314c981f1e30e053b vp90-2-02-size-lf-1920x1080-1920x1080-0156.i420 +3455e01e2cd146aefbad54cb032b15f1 vp90-2-02-size-lf-1920x1080-1920x1080-0157.i420 +eaa2e271058202cbc0933dea8f46f570 vp90-2-02-size-lf-1920x1080-1920x1080-0158.i420 +42da27c94aaa56ae27fddf75bf51f47f vp90-2-02-size-lf-1920x1080-1920x1080-0159.i420 +746cca013c7b6df41e3233214ca7a5d7 vp90-2-02-size-lf-1920x1080-1920x1080-0160.i420 +ab20ad95d6b3e0d689186cde51e4a86a vp90-2-02-size-lf-1920x1080-1920x1080-0161.i420 +b8a02e44615a697da3de946e8cf4e8e4 vp90-2-02-size-lf-1920x1080-1920x1080-0162.i420 +4df5b10cb1c784362035f69bdb183be0 vp90-2-02-size-lf-1920x1080-1920x1080-0163.i420 +f2e5dd616e8125b1b46c410141180fb0 vp90-2-02-size-lf-1920x1080-1920x1080-0164.i420 +e09ab4ca180cb477a3a87bc8fd1e2ce0 vp90-2-02-size-lf-1920x1080-1920x1080-0165.i420 +5ee431b26d6c83689bf18eb8d805f31e vp90-2-02-size-lf-1920x1080-1920x1080-0166.i420 +bca8aaf030c959ac37c3e084be6cf8b3 vp90-2-02-size-lf-1920x1080-1920x1080-0167.i420 +8dd977323d8a5dba5c98c6671821e066 vp90-2-02-size-lf-1920x1080-1920x1080-0168.i420 +aed8ef2c20f9726542c78fade0fb0968 vp90-2-02-size-lf-1920x1080-1920x1080-0169.i420 +e19775ba9c5b6dbf1e84fd0531bd1f2a vp90-2-02-size-lf-1920x1080-1920x1080-0170.i420 +a69c5daf6e6e3b579a3430fc95f37dac vp90-2-02-size-lf-1920x1080-1920x1080-0171.i420 +3503bc793f86b75d9aa1c9c51b2d0f6f vp90-2-02-size-lf-1920x1080-1920x1080-0172.i420 +bdcee02e245b92acf06588370df2e5e6 vp90-2-02-size-lf-1920x1080-1920x1080-0173.i420 +8bbb9460d0f419969491669664891d88 vp90-2-02-size-lf-1920x1080-1920x1080-0174.i420 +d4b993d87c2f4042c0b647e4e50cca38 vp90-2-02-size-lf-1920x1080-1920x1080-0175.i420 +5acb9f10167b208a32babbe56fd07587 vp90-2-02-size-lf-1920x1080-1920x1080-0176.i420 +958900bb713559d272470f1e85cffcda vp90-2-02-size-lf-1920x1080-1920x1080-0177.i420 +f355f1858fd2c8a4932dfd6d6cfe7673 vp90-2-02-size-lf-1920x1080-1920x1080-0178.i420 +45caac733e395f63c82c9d8ab050c858 vp90-2-02-size-lf-1920x1080-1920x1080-0179.i420 +8b05c2c352c4adc5cabc0184a1f510f5 vp90-2-02-size-lf-1920x1080-1920x1080-0180.i420 +167c3fe4df204bab9cceb17ae655aa61 vp90-2-02-size-lf-1920x1080-1920x1080-0181.i420 +3859339e9a63d0e05797f0de535f7be8 vp90-2-02-size-lf-1920x1080-1920x1080-0182.i420 +2d5cc539454cb6aace19ab9bba60b066 vp90-2-02-size-lf-1920x1080-1920x1080-0183.i420 +f51299a0601fb1621d2de6b0e2391a9a vp90-2-02-size-lf-1920x1080-1920x1080-0184.i420 +92b0ed2528c0756b0c84721a306ba61b vp90-2-02-size-lf-1920x1080-1920x1080-0185.i420 +8f1870cce38718b02d0a4e26a5a2619e vp90-2-02-size-lf-1920x1080-1920x1080-0186.i420 +e0ed74a244b8698baaefd837ab1590ff vp90-2-02-size-lf-1920x1080-1920x1080-0187.i420 +c8b10e2ac68bd0106e34a57943f23e12 vp90-2-02-size-lf-1920x1080-1920x1080-0188.i420 +f5e505e3d681763fd447214aed863ab9 vp90-2-02-size-lf-1920x1080-1920x1080-0189.i420 +c2cc70d65ba1c13c5e07a1d28611792a vp90-2-02-size-lf-1920x1080-1920x1080-0190.i420 +e518aac5c551f7c09652c25905cce41f vp90-2-02-size-lf-1920x1080-1920x1080-0191.i420 +66379f7a3b2de153486a76b459e2ce3b vp90-2-02-size-lf-1920x1080-1920x1080-0192.i420 +552afad8181d6d138e2e62c971a10a42 vp90-2-02-size-lf-1920x1080-1920x1080-0193.i420 +ac21d5c2ef3ccaabbaa9f08fcc9d0db8 vp90-2-02-size-lf-1920x1080-1920x1080-0194.i420 +f67af966e3fa79a6fce48b7d9e1fb593 vp90-2-02-size-lf-1920x1080-1920x1080-0195.i420 +dd6331e4361f8b8bd45d571db2e0344b vp90-2-02-size-lf-1920x1080-1920x1080-0196.i420 +14a0db3c0a39b7431c337622ed4078a5 vp90-2-02-size-lf-1920x1080-1920x1080-0197.i420 +8d3394abad260b5e4e24abe4a898cb7b vp90-2-02-size-lf-1920x1080-1920x1080-0198.i420 +e085ce3274d77fa874ab70183353b4c1 vp90-2-02-size-lf-1920x1080-1920x1080-0199.i420 +de083fffb4226ec227d3aa9c873dfcf7 vp90-2-02-size-lf-1920x1080-1920x1080-0200.i420 +4628eff51846a97fb708c4d3753ffee4 vp90-2-02-size-lf-1920x1080-1920x1080-0201.i420 +b480e4409fa8ca9c2e0d4bd57b7e8cf6 vp90-2-02-size-lf-1920x1080-1920x1080-0202.i420 +ff21164cc573b6f79739165b61b68dd0 vp90-2-02-size-lf-1920x1080-1920x1080-0203.i420 +ec391026b77527ed48029adfbd1afc93 vp90-2-02-size-lf-1920x1080-1920x1080-0204.i420 +23186dd93e32603c3709aa3419963ca9 vp90-2-02-size-lf-1920x1080-1920x1080-0205.i420 +6a1968207b37594cc82736f086a0a023 vp90-2-02-size-lf-1920x1080-1920x1080-0206.i420 +57358a332af03e5d96d8c1cd5e4a497d vp90-2-02-size-lf-1920x1080-1920x1080-0207.i420 +584ac2ecc56e1a9f0f1a5356b161a7a6 vp90-2-02-size-lf-1920x1080-1920x1080-0208.i420 +f566d1e385f25ef9b74989cbe7bbca7b vp90-2-02-size-lf-1920x1080-1920x1080-0209.i420 +a4bf059ee8207d1edeebc3193e8db8e0 vp90-2-02-size-lf-1920x1080-1920x1080-0210.i420 +cc5948fa18d6e73afa253eedbfaecd41 vp90-2-02-size-lf-1920x1080-1920x1080-0211.i420 +61d44c8bfca18b6742fed974366898b8 vp90-2-02-size-lf-1920x1080-1920x1080-0212.i420 +c48d67da0d72daaf635226b9e30e05e3 vp90-2-02-size-lf-1920x1080-1920x1080-0213.i420 +b4596a68e708f304875fd2306fec56e9 vp90-2-02-size-lf-1920x1080-1920x1080-0214.i420 +b59be425ebea3d15b4be140e552ab944 vp90-2-02-size-lf-1920x1080-1920x1080-0215.i420 +1e966f137918375ae060d4c49cf38664 vp90-2-02-size-lf-1920x1080-1920x1080-0216.i420 +0ff25f8e98719fd57dc31d391bb930c4 vp90-2-02-size-lf-1920x1080-1920x1080-0217.i420 diff --git a/testdata/libvpx/vp90-2-03-deltaq.webm.md5 b/testdata/libvpx/vp90-2-03-deltaq.webm.md5 new file mode 100644 index 0000000..aca350c --- /dev/null +++ b/testdata/libvpx/vp90-2-03-deltaq.webm.md5 @@ -0,0 +1,2 @@ +2f90d606edc511c8c960530dd915cb98 vp90-2-03-deltaq-352x240-0001.i420 +7fd451a057d6341b2b0d116f59e41a13 vp90-2-03-deltaq-352x240-0002.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x196.webm.md5 new file mode 100644 index 0000000..847972f --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x196.webm.md5 @@ -0,0 +1,10 @@ +14cc1c34b8106e35238d4650a9123852 vp90-2-03-size-196x196-196x196-0001.i420 +66e0bb9136ea24e30b781a4610b428a1 vp90-2-03-size-196x196-196x196-0002.i420 +8e36679c20a3a3e974fdacf7a9343817 vp90-2-03-size-196x196-196x196-0003.i420 +2669fd03ce7ce01f4fc9db23e06fffdb vp90-2-03-size-196x196-196x196-0004.i420 +46ced29eb6edf2136c8ee19e9a87380f vp90-2-03-size-196x196-196x196-0005.i420 +4e4138b65a30bc56cd18663a1799f98f vp90-2-03-size-196x196-196x196-0006.i420 +580b0431b5f808c67e50ed34e62f39ad vp90-2-03-size-196x196-196x196-0007.i420 +1339bbe256d8499ab17d6a550f7dac70 vp90-2-03-size-196x196-196x196-0008.i420 +89b9dac29a4c4136249c40a3763dc114 vp90-2-03-size-196x196-196x196-0009.i420 +a735d341d7df9dcd0b6e51a82b813f61 vp90-2-03-size-196x196-196x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x198.webm.md5 new file mode 100644 index 0000000..33056c5 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x198.webm.md5 @@ -0,0 +1,10 @@ +d2bd2dfaf2ac22b3f2499844f228d89a vp90-2-03-size-196x198-196x198-0001.i420 +e066448baeb39da04b22d4d2ebd27b0a vp90-2-03-size-196x198-196x198-0002.i420 +aace53c0ecca2596c51dd5e70da7abc4 vp90-2-03-size-196x198-196x198-0003.i420 +077256d024ab101918d10ae61142f203 vp90-2-03-size-196x198-196x198-0004.i420 +e2bfdad36b0365d41dc6813a371111ee vp90-2-03-size-196x198-196x198-0005.i420 +17495af68b0a2c075899849382f3b046 vp90-2-03-size-196x198-196x198-0006.i420 +7853db163344798e5c37672adaac92d8 vp90-2-03-size-196x198-196x198-0007.i420 +7b2ee2e1ca709c58457c7d818e47c95c vp90-2-03-size-196x198-196x198-0008.i420 +f7eb3ce10561628f932861358a30b414 vp90-2-03-size-196x198-196x198-0009.i420 +3182374f5aa539fd0faa44ed4a7492e5 vp90-2-03-size-196x198-196x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x200.webm.md5 new file mode 100644 index 0000000..7746aba --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x200.webm.md5 @@ -0,0 +1,10 @@ +b2f2ac3e3833ae1b4dd075fe00210373 vp90-2-03-size-196x200-196x200-0001.i420 +c0cce05e56a07111fe62553fa3a87074 vp90-2-03-size-196x200-196x200-0002.i420 +626aab3de03242073e03504e166b4697 vp90-2-03-size-196x200-196x200-0003.i420 +574d2c810f0bbfac57f1f06c2b97445c vp90-2-03-size-196x200-196x200-0004.i420 +7d5bc5860bd1422d08396fe080452099 vp90-2-03-size-196x200-196x200-0005.i420 +5d47bbfb0f5cdecfe8415ca2caddc206 vp90-2-03-size-196x200-196x200-0006.i420 +fbef6a0fa51029d0475975945ccf4b36 vp90-2-03-size-196x200-196x200-0007.i420 +c9179c153bcb2a8e9d17ed04e5e2c39c vp90-2-03-size-196x200-196x200-0008.i420 +107d796592cf2140d4d492beadba2d68 vp90-2-03-size-196x200-196x200-0009.i420 +eee46f9ee67fc1121bffb63aeb7c768f vp90-2-03-size-196x200-196x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x202.webm.md5 new file mode 100644 index 0000000..351cf95 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x202.webm.md5 @@ -0,0 +1,10 @@ +7109d2ef160828ece26337f36fcfc092 vp90-2-03-size-196x202-196x202-0001.i420 +bdaa6612f81a956d9b20d55a04df8346 vp90-2-03-size-196x202-196x202-0002.i420 +15eb75495d2713a64415b990b058d5ca vp90-2-03-size-196x202-196x202-0003.i420 +b997c84553475ba84e8ba3d7ee19ae4e vp90-2-03-size-196x202-196x202-0004.i420 +63a8badd691bcf643cf676d029ce8a6c vp90-2-03-size-196x202-196x202-0005.i420 +b8ca23d9b3418c4c36040a215b2b7917 vp90-2-03-size-196x202-196x202-0006.i420 +1be0da18386c35e4a5e5d5d32d9a4468 vp90-2-03-size-196x202-196x202-0007.i420 +e75a03fa70fe7e6b3a8d8ce7dc8305f1 vp90-2-03-size-196x202-196x202-0008.i420 +cbd2b60df9209025c8e890771a05321d vp90-2-03-size-196x202-196x202-0009.i420 +c655d6fcc3333917b66358a9ac2b1357 vp90-2-03-size-196x202-196x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x208.webm.md5 new file mode 100644 index 0000000..94a9277 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x208.webm.md5 @@ -0,0 +1,10 @@ +efa2a2a76a0fe709a78e491346cfcf29 vp90-2-03-size-196x208-196x208-0001.i420 +97de85e21b408878853fa870104707d7 vp90-2-03-size-196x208-196x208-0002.i420 +419bd1157e156d3059190d6b561c57dd vp90-2-03-size-196x208-196x208-0003.i420 +fbb6e01c524fc7c8007c6cfe2c64f467 vp90-2-03-size-196x208-196x208-0004.i420 +7453994c2e9901fa23f295ec0b556f9c vp90-2-03-size-196x208-196x208-0005.i420 +ba39dc984789fa2c4b833cd88013cc97 vp90-2-03-size-196x208-196x208-0006.i420 +cea5061cac1be18d5f9a9301a5460491 vp90-2-03-size-196x208-196x208-0007.i420 +1c583018c425b1a91949e0c3eb0a4152 vp90-2-03-size-196x208-196x208-0008.i420 +b48be02280ac6f97731af69bcf18de25 vp90-2-03-size-196x208-196x208-0009.i420 +6f8ab465214d8374c9ff77b939da333e vp90-2-03-size-196x208-196x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x210.webm.md5 new file mode 100644 index 0000000..eddddaf --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x210.webm.md5 @@ -0,0 +1,10 @@ +fccc18714a9ed3840bd6e9c6ca4858e5 vp90-2-03-size-196x210-196x210-0001.i420 +a8f6eb43cf6ed670eb180c5051de06f7 vp90-2-03-size-196x210-196x210-0002.i420 +6a9baf9eae6e799deaefd6e801f7ace3 vp90-2-03-size-196x210-196x210-0003.i420 +3bb44c8a45aab088c9887c11bc6a4acf vp90-2-03-size-196x210-196x210-0004.i420 +0907a7e926be9e54bbb087251b4715d9 vp90-2-03-size-196x210-196x210-0005.i420 +10fef2876c20eb3f9570c0c23e5acc69 vp90-2-03-size-196x210-196x210-0006.i420 +ffe5d2b6d874af0f878075c97940ccfb vp90-2-03-size-196x210-196x210-0007.i420 +d10fae10144ff88075048827203f7e9c vp90-2-03-size-196x210-196x210-0008.i420 +bdf35736ac625f2178902c1f24d513c0 vp90-2-03-size-196x210-196x210-0009.i420 +30882bf2c21785be6234b637c4b16b28 vp90-2-03-size-196x210-196x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x224.webm.md5 new file mode 100644 index 0000000..18395ce --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x224.webm.md5 @@ -0,0 +1,10 @@ +13263674ea5aa619250dfd139bda872f vp90-2-03-size-196x224-196x224-0001.i420 +39f5cbd8917f2b3a1df8cf2b786266de vp90-2-03-size-196x224-196x224-0002.i420 +f9aade31f9e3065f3d5b8645ef099ac6 vp90-2-03-size-196x224-196x224-0003.i420 +124f9664380f092e692b5e881f5a8fcc vp90-2-03-size-196x224-196x224-0004.i420 +e8e040e417830f5e911537828ace21b7 vp90-2-03-size-196x224-196x224-0005.i420 +84ce09882b9c184a787e8022e6d8c8de vp90-2-03-size-196x224-196x224-0006.i420 +b1397fd91814e4fdc4f75c89161ced26 vp90-2-03-size-196x224-196x224-0007.i420 +d64f39d64d248f0223ed359e092d46cb vp90-2-03-size-196x224-196x224-0008.i420 +e04ee663dcc52eebd74255671c6f4ec9 vp90-2-03-size-196x224-196x224-0009.i420 +955303cb73bf072c693f37d9778ca2b6 vp90-2-03-size-196x224-196x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-196x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-196x226.webm.md5 new file mode 100644 index 0000000..1c250d6 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-196x226.webm.md5 @@ -0,0 +1,10 @@ +5cb240f10761f59687612ed589759800 vp90-2-03-size-196x226-196x226-0001.i420 +9d8d5b57336ddfa5c9c5100a0302197d vp90-2-03-size-196x226-196x226-0002.i420 +9db74997d23b16f527c63e88795331dc vp90-2-03-size-196x226-196x226-0003.i420 +52758cd901533e790334d464bee516da vp90-2-03-size-196x226-196x226-0004.i420 +40e671b9b85d07b13acba85eb64bbbaa vp90-2-03-size-196x226-196x226-0005.i420 +8524b2cd2c9bb3e41c6167f8269e75d2 vp90-2-03-size-196x226-196x226-0006.i420 +ff194ad6fa180fde86cc05a99c0580ec vp90-2-03-size-196x226-196x226-0007.i420 +22ab303cb37745a73c227cd7d1c70003 vp90-2-03-size-196x226-196x226-0008.i420 +01986c58e82e0b5194418f5b75a8599c vp90-2-03-size-196x226-196x226-0009.i420 +eedfc9c14cbf3fa10402dbed52103848 vp90-2-03-size-196x226-196x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x196.webm.md5 new file mode 100644 index 0000000..fc8de27 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x196.webm.md5 @@ -0,0 +1,10 @@ +c980866a6f17d4107ce128ee112d74cf vp90-2-03-size-198x196-198x196-0001.i420 +d4d5d2a10e73f1d09919355dc4d63d48 vp90-2-03-size-198x196-198x196-0002.i420 +82c76ed020acb68ff9d8bd81899aa6f8 vp90-2-03-size-198x196-198x196-0003.i420 +8330705fa354fb5838af56dcf9cc0980 vp90-2-03-size-198x196-198x196-0004.i420 +e47b63d839a592e6372d18249bf5bc0c vp90-2-03-size-198x196-198x196-0005.i420 +b6095b6f752a50e96cab52e7c3fd52f3 vp90-2-03-size-198x196-198x196-0006.i420 +fc4786f48b6ee31043d94f79c5c8a54f vp90-2-03-size-198x196-198x196-0007.i420 +7d3d06c96496bd5ab44fe5489877771d vp90-2-03-size-198x196-198x196-0008.i420 +5b96de089a9faa2dc01697fe9dd97f7f vp90-2-03-size-198x196-198x196-0009.i420 +d7361203b4c264067dcb7bf6912e8df2 vp90-2-03-size-198x196-198x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x198.webm.md5 new file mode 100644 index 0000000..7eae1b0 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x198.webm.md5 @@ -0,0 +1,10 @@ +ee0760611da9938e72f551d219671c76 vp90-2-03-size-198x198-198x198-0001.i420 +c512cb8a864c25318254438c7170f373 vp90-2-03-size-198x198-198x198-0002.i420 +aaea10aeb7dfd1f9f6dc77adccfcd56f vp90-2-03-size-198x198-198x198-0003.i420 +fb4e68ce202d9c6ecbddc6fe50b1cd7b vp90-2-03-size-198x198-198x198-0004.i420 +57a803d02f0d71ec4c3c17a112574525 vp90-2-03-size-198x198-198x198-0005.i420 +526d0beaf7ef721c3a6ae8bf3505fd78 vp90-2-03-size-198x198-198x198-0006.i420 +972ab31f81dbb79c2273bcfc98569e8b vp90-2-03-size-198x198-198x198-0007.i420 +e1f05d62691bd1a9494d57449417415c vp90-2-03-size-198x198-198x198-0008.i420 +bc39a559b25e5a1ac698e0101bd6bf29 vp90-2-03-size-198x198-198x198-0009.i420 +04caed04ac21c76af873e21899860fb2 vp90-2-03-size-198x198-198x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x200.webm.md5 new file mode 100644 index 0000000..777aeef --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x200.webm.md5 @@ -0,0 +1,10 @@ +fb0e8171b0f91d9b2ceb5430db27a67b vp90-2-03-size-198x200-198x200-0001.i420 +73f121e6aa0e6290cfd06ac9b033c772 vp90-2-03-size-198x200-198x200-0002.i420 +4113897efc44f49f5169a579bee03596 vp90-2-03-size-198x200-198x200-0003.i420 +aec1d4cf1a15e12b689980cfe136d5d6 vp90-2-03-size-198x200-198x200-0004.i420 +1322af65f647254330120e67ddae38bd vp90-2-03-size-198x200-198x200-0005.i420 +5d28c1684451812c9db41433e6286d85 vp90-2-03-size-198x200-198x200-0006.i420 +33843fc49d1d8655520c2f42332222ca vp90-2-03-size-198x200-198x200-0007.i420 +92a8125d8c75eaf6159d5f431c5c71bf vp90-2-03-size-198x200-198x200-0008.i420 +5bc96553842f65a3e37f012b72b580f5 vp90-2-03-size-198x200-198x200-0009.i420 +de5eb6299ee5034dc3b01cdc94bf810a vp90-2-03-size-198x200-198x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x202.webm.md5 new file mode 100644 index 0000000..a5eef00 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x202.webm.md5 @@ -0,0 +1,10 @@ +f5e1cf4cc56742fadddf42189a3f65e3 vp90-2-03-size-198x202-198x202-0001.i420 +f3e8ca2c8deb29a6b5bfe415b39c901e vp90-2-03-size-198x202-198x202-0002.i420 +89c513049e41e145bca46a7f7119567c vp90-2-03-size-198x202-198x202-0003.i420 +419089035739e84f1aa14ccdf34edcb1 vp90-2-03-size-198x202-198x202-0004.i420 +4962c98c23b16b9257869a8ad5138731 vp90-2-03-size-198x202-198x202-0005.i420 +fde9e858ec895c36c2d8071e69f68db6 vp90-2-03-size-198x202-198x202-0006.i420 +42e1271915f31a00be3627fa866ce3ee vp90-2-03-size-198x202-198x202-0007.i420 +c15f794933f913861a6d0041ff2fccdb vp90-2-03-size-198x202-198x202-0008.i420 +35dab245ba952dc6fddc1a9668c30b28 vp90-2-03-size-198x202-198x202-0009.i420 +30bb4ef77cdde9cf5aea0f1287183b23 vp90-2-03-size-198x202-198x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x208.webm.md5 new file mode 100644 index 0000000..eccf93d --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x208.webm.md5 @@ -0,0 +1,10 @@ +d45b561f81cbfcca8a1dddbc2bf8ca31 vp90-2-03-size-198x208-198x208-0001.i420 +3664f63b2e59e380622caadb7a05545e vp90-2-03-size-198x208-198x208-0002.i420 +0662fa199512320704efecc10af1aaa4 vp90-2-03-size-198x208-198x208-0003.i420 +d8dc00882e73be89d0585663892cbcff vp90-2-03-size-198x208-198x208-0004.i420 +ff64b8d50b7c5b484a06dab09a26147c vp90-2-03-size-198x208-198x208-0005.i420 +1771b6a55112eb7ea10885d1390339cc vp90-2-03-size-198x208-198x208-0006.i420 +0d5944e8a13e3c2faffb562bbe2671a8 vp90-2-03-size-198x208-198x208-0007.i420 +744bed3a88407b75a8ff27a1b0cec64e vp90-2-03-size-198x208-198x208-0008.i420 +3887415f2ab10d2a265c4a413e7060b9 vp90-2-03-size-198x208-198x208-0009.i420 +7dd683019b19b464bc0436f41e0b7c87 vp90-2-03-size-198x208-198x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x210.webm.md5 new file mode 100644 index 0000000..0c19c2f --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x210.webm.md5 @@ -0,0 +1,10 @@ +8525a27170982c059d5904c1af3b43fb vp90-2-03-size-198x210-198x210-0001.i420 +c4eb329733913360384d3917a58f6f36 vp90-2-03-size-198x210-198x210-0002.i420 +ec118b87c9cba0e4bd89fd43567cca4e vp90-2-03-size-198x210-198x210-0003.i420 +7e57c6caba7924823977e2c9bc11f7fa vp90-2-03-size-198x210-198x210-0004.i420 +f77ffb7228a5eda848acc40ff636ecad vp90-2-03-size-198x210-198x210-0005.i420 +c5dddafbe3badcbbcaaebe97076e0394 vp90-2-03-size-198x210-198x210-0006.i420 +34d69ae2e5b4c4fbcc51627237c9abc5 vp90-2-03-size-198x210-198x210-0007.i420 +d9c63fa8b18d6c54e5fa31db866c06cc vp90-2-03-size-198x210-198x210-0008.i420 +7ab392764a399328bf35977539e3148a vp90-2-03-size-198x210-198x210-0009.i420 +7fbb7bae3ec775298aaa49a286dfb9d1 vp90-2-03-size-198x210-198x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x224.webm.md5 new file mode 100644 index 0000000..12c6979 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x224.webm.md5 @@ -0,0 +1,10 @@ +5f69230bfd8bb485bd85552b18339fc0 vp90-2-03-size-198x224-198x224-0001.i420 +f5c365774fc1d0bffd5025ce2e931aaf vp90-2-03-size-198x224-198x224-0002.i420 +2898234103c3624e6470ae82c916e000 vp90-2-03-size-198x224-198x224-0003.i420 +d82a7fa705180b68a8ee8cb7de0cdd2d vp90-2-03-size-198x224-198x224-0004.i420 +144a162d418deae62883a2cc4c341b4c vp90-2-03-size-198x224-198x224-0005.i420 +b3419a48385e42ca15717289ff2daa1c vp90-2-03-size-198x224-198x224-0006.i420 +d6306b5737f88f989bf2e6a1084a94fe vp90-2-03-size-198x224-198x224-0007.i420 +5669761d7417b52b3cf81d44a13e3fb7 vp90-2-03-size-198x224-198x224-0008.i420 +3f730b8658d7a6657d1af38c75357512 vp90-2-03-size-198x224-198x224-0009.i420 +27df68d515148f732325bf821037d59f vp90-2-03-size-198x224-198x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-198x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-198x226.webm.md5 new file mode 100644 index 0000000..31305ef --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-198x226.webm.md5 @@ -0,0 +1,10 @@ +412c33a8fd71c99e68e6701b050b107c vp90-2-03-size-198x226-198x226-0001.i420 +8e69483ff8a094096dd550b30be20dde vp90-2-03-size-198x226-198x226-0002.i420 +b8df87ab3d2613be31a3743e34d7e794 vp90-2-03-size-198x226-198x226-0003.i420 +ec4b08a4014950f1fe04e83f8a790af0 vp90-2-03-size-198x226-198x226-0004.i420 +030da2b60627d879730108826ce6632c vp90-2-03-size-198x226-198x226-0005.i420 +03aab0c9b4d75bc0b47fa5237e9efe3d vp90-2-03-size-198x226-198x226-0006.i420 +fd01e369df258f340eb8e486c07ae136 vp90-2-03-size-198x226-198x226-0007.i420 +1c301f0e60c96008fd7b6e8de1ebaa29 vp90-2-03-size-198x226-198x226-0008.i420 +912723f43b2b36366c3e6ab122d31801 vp90-2-03-size-198x226-198x226-0009.i420 +b2774a66f7aa0fb7dd7e64b0d67818cd vp90-2-03-size-198x226-198x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x196.webm.md5 new file mode 100644 index 0000000..0b38c2b --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x196.webm.md5 @@ -0,0 +1,10 @@ +651a0627c6cdaee8b46e1f8c4121a368 vp90-2-03-size-200x196-200x196-0001.i420 +3e63075148df16f69c933cf6c63e078c vp90-2-03-size-200x196-200x196-0002.i420 +edf18e52b7d52af2bb7594ed358542d8 vp90-2-03-size-200x196-200x196-0003.i420 +30284124756d00d10f4f8428206ceab8 vp90-2-03-size-200x196-200x196-0004.i420 +6f6ecde53cd0ea5298f4529d396460c6 vp90-2-03-size-200x196-200x196-0005.i420 +0431d389278957fbef3e72f69f3ce008 vp90-2-03-size-200x196-200x196-0006.i420 +a047c60c4c60d2ea1f79c86dc98cdf8e vp90-2-03-size-200x196-200x196-0007.i420 +dceda8bf128a8cdcadfa6c5db49cde51 vp90-2-03-size-200x196-200x196-0008.i420 +d8a6283637f5abda17e0bf150eac2983 vp90-2-03-size-200x196-200x196-0009.i420 +33dca31ef26fdd0daf9971c8de685d01 vp90-2-03-size-200x196-200x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x198.webm.md5 new file mode 100644 index 0000000..055811c --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x198.webm.md5 @@ -0,0 +1,10 @@ +d4b3578d800c747bcabaa484a140ffb0 vp90-2-03-size-200x198-200x198-0001.i420 +a40f6f8c384c5dc3d5546d960bb6d9e5 vp90-2-03-size-200x198-200x198-0002.i420 +e270ae8754d9906dd88b1c7d05280801 vp90-2-03-size-200x198-200x198-0003.i420 +bde7fde5012840c5e188f3b29f4f0003 vp90-2-03-size-200x198-200x198-0004.i420 +8f8510c1130615b64fb8469af66ff678 vp90-2-03-size-200x198-200x198-0005.i420 +79b9d4e0c64f82a6e9540394222a593d vp90-2-03-size-200x198-200x198-0006.i420 +34852ac9ca5c6bfa51736296784343c7 vp90-2-03-size-200x198-200x198-0007.i420 +b055218509dbed644113642f8f0ac8a8 vp90-2-03-size-200x198-200x198-0008.i420 +1628866b436f1c4b892474025226e545 vp90-2-03-size-200x198-200x198-0009.i420 +3fdec760c04e30c90e74afb38dbf757c vp90-2-03-size-200x198-200x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x200.webm.md5 new file mode 100644 index 0000000..b6d78f8 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x200.webm.md5 @@ -0,0 +1,10 @@ +b339f4e563afadb25f43b8c05b12dc03 vp90-2-03-size-200x200-200x200-0001.i420 +3bd5280e7fb42400085b0b1dbba1905e vp90-2-03-size-200x200-200x200-0002.i420 +acf1c84cabff763fe2073d2c1f183bfc vp90-2-03-size-200x200-200x200-0003.i420 +eaa4983b6baf907efb11d137644569d2 vp90-2-03-size-200x200-200x200-0004.i420 +8a1871c8dc38a19dfd4ac571ad7f39be vp90-2-03-size-200x200-200x200-0005.i420 +0be539bd51f5f364828dd0abc70360be vp90-2-03-size-200x200-200x200-0006.i420 +df60622d2c9f294f61d738be9e3bd16c vp90-2-03-size-200x200-200x200-0007.i420 +22b3f1d51ddf92c7d2add305ba0ef405 vp90-2-03-size-200x200-200x200-0008.i420 +01ba29be721e64a5a50526de0797c7d3 vp90-2-03-size-200x200-200x200-0009.i420 +7b7aa7fa0e58202b3104671375762587 vp90-2-03-size-200x200-200x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x202.webm.md5 new file mode 100644 index 0000000..f93617e --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x202.webm.md5 @@ -0,0 +1,10 @@ +c4a13df44e66f06961dd72fc990439e9 vp90-2-03-size-200x202-200x202-0001.i420 +81c73b8d3806ad96af8f422914a253f8 vp90-2-03-size-200x202-200x202-0002.i420 +05f77526125e802be9cb306e375ded6e vp90-2-03-size-200x202-200x202-0003.i420 +ab2e224840ff89abec2c675a23a73094 vp90-2-03-size-200x202-200x202-0004.i420 +c30f58f88819eb57102678b169e15188 vp90-2-03-size-200x202-200x202-0005.i420 +33e5e2799eb4a9c548c8372fd6769db9 vp90-2-03-size-200x202-200x202-0006.i420 +fa53c1c7e60bd1d00335af542ec69ed7 vp90-2-03-size-200x202-200x202-0007.i420 +534cafe658af10a314d6d084e55b3620 vp90-2-03-size-200x202-200x202-0008.i420 +502529e4fbecc8b890abf665fa21f53c vp90-2-03-size-200x202-200x202-0009.i420 +bf1f73c6e77370bc51a770c8ae87bd12 vp90-2-03-size-200x202-200x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x208.webm.md5 new file mode 100644 index 0000000..4611a4a --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x208.webm.md5 @@ -0,0 +1,10 @@ +702748bec18c500dd41d93ae74b11d56 vp90-2-03-size-200x208-200x208-0001.i420 +4fb542190dab2fd673724d47451ff6ee vp90-2-03-size-200x208-200x208-0002.i420 +dbb4d27d52797dab67e39d32092c9d44 vp90-2-03-size-200x208-200x208-0003.i420 +e4a0ed1572207b7ba433896bba711148 vp90-2-03-size-200x208-200x208-0004.i420 +28ec32bc165f4f9d455efec8a7aa8737 vp90-2-03-size-200x208-200x208-0005.i420 +a95910575a6423abffb28ca38c384b34 vp90-2-03-size-200x208-200x208-0006.i420 +791f1c558c5467725f4614a75a8a687e vp90-2-03-size-200x208-200x208-0007.i420 +cfd3e12f84f7a811966721e890228313 vp90-2-03-size-200x208-200x208-0008.i420 +824c5fdf938551c28ac1c996645ae52f vp90-2-03-size-200x208-200x208-0009.i420 +7465917fdd0206e393968232a0ec5193 vp90-2-03-size-200x208-200x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x210.webm.md5 new file mode 100644 index 0000000..75c190c --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x210.webm.md5 @@ -0,0 +1,10 @@ +31ef44bd12ae702f306c55eba10d2ba7 vp90-2-03-size-200x210-200x210-0001.i420 +83e9d913f5aa058d79a81047ca45e4a2 vp90-2-03-size-200x210-200x210-0002.i420 +b5e21313b859f1e2c67aaac5fefc9f68 vp90-2-03-size-200x210-200x210-0003.i420 +959d63c1b219c3479af673a9a8b8d82c vp90-2-03-size-200x210-200x210-0004.i420 +ffcfaf42b69c7cd92f6e3c21987ff7df vp90-2-03-size-200x210-200x210-0005.i420 +e9667d3ee4d8179da44de4fbffcb7df2 vp90-2-03-size-200x210-200x210-0006.i420 +5e2c841bcf4ec6f3a05020d36986fe5b vp90-2-03-size-200x210-200x210-0007.i420 +19fe287c30bd4c90b00a9631409568c0 vp90-2-03-size-200x210-200x210-0008.i420 +58a8843e50b19860a0a91e1e1bb63bfd vp90-2-03-size-200x210-200x210-0009.i420 +0ebd31e18597a567f96645acbb2500cf vp90-2-03-size-200x210-200x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x224.webm.md5 new file mode 100644 index 0000000..0f64dfc --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x224.webm.md5 @@ -0,0 +1,10 @@ +315d69847bf752a84231a368278eb0b6 vp90-2-03-size-200x224-200x224-0001.i420 +d245738f8627fc345ab38a547bc7d352 vp90-2-03-size-200x224-200x224-0002.i420 +982681cdca448919c2eead94435772ad vp90-2-03-size-200x224-200x224-0003.i420 +7b67b2d96476e17cd407bbccb19fd070 vp90-2-03-size-200x224-200x224-0004.i420 +c38dde73ca097049d1fc689e18a49b5d vp90-2-03-size-200x224-200x224-0005.i420 +525f323b81d780c669a03655bb0d0b56 vp90-2-03-size-200x224-200x224-0006.i420 +5dbeb96f65e383771c1c877ec559044a vp90-2-03-size-200x224-200x224-0007.i420 +7d96e976265ef0f9faf173376caaa9e9 vp90-2-03-size-200x224-200x224-0008.i420 +6047c805a724701b80a133486aae0e65 vp90-2-03-size-200x224-200x224-0009.i420 +eb8895dd994076a52aa3a0c1758ccbb7 vp90-2-03-size-200x224-200x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-200x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-200x226.webm.md5 new file mode 100644 index 0000000..42f870c --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-200x226.webm.md5 @@ -0,0 +1,10 @@ +e45b6b9dce4a8509b7d26bc3cfdf7c86 vp90-2-03-size-200x226-200x226-0001.i420 +ddb9d5033ecfa2d6e9a5505dce374bda vp90-2-03-size-200x226-200x226-0002.i420 +52c495d3137143e0bce9382fe5506057 vp90-2-03-size-200x226-200x226-0003.i420 +d09f3d6ad084f2966196acd48246f951 vp90-2-03-size-200x226-200x226-0004.i420 +1556d006d0119a3172b98a500b27f8d0 vp90-2-03-size-200x226-200x226-0005.i420 +904f86cfbcc3fa683d3d7744a286cd88 vp90-2-03-size-200x226-200x226-0006.i420 +b35907456b8ccab0ae8efc8405b04c89 vp90-2-03-size-200x226-200x226-0007.i420 +b7f2648fe0f873f7e9ea4a6d913e45ec vp90-2-03-size-200x226-200x226-0008.i420 +2da76544bc7e295486c335e17047e12e vp90-2-03-size-200x226-200x226-0009.i420 +10fd6424caf837d37564ef15f1c6f93d vp90-2-03-size-200x226-200x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x196.webm.md5 new file mode 100644 index 0000000..1e76804 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x196.webm.md5 @@ -0,0 +1,10 @@ +1261466179df96099e598e46c50fa7c1 vp90-2-03-size-202x196-202x196-0001.i420 +cc0fe373cd0399cf0c95edf92d9ab01f vp90-2-03-size-202x196-202x196-0002.i420 +7a2dc0afd06ecfcf54321fb759f57601 vp90-2-03-size-202x196-202x196-0003.i420 +db9c138503d27f87449f870ab07cab03 vp90-2-03-size-202x196-202x196-0004.i420 +ddea2e5e2659e97132a537566d5ed989 vp90-2-03-size-202x196-202x196-0005.i420 +c31e90b5eee032526c4e0603332fd160 vp90-2-03-size-202x196-202x196-0006.i420 +7e5b40f03b905d9ee749d3097a484ea0 vp90-2-03-size-202x196-202x196-0007.i420 +93e9f7defa94ff03c041448ae1e55cea vp90-2-03-size-202x196-202x196-0008.i420 +aef8e03f0146699faa16ec28dea49dbe vp90-2-03-size-202x196-202x196-0009.i420 +a651d949b4c8f0e455c6592dc98385f7 vp90-2-03-size-202x196-202x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x198.webm.md5 new file mode 100644 index 0000000..fa76001 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x198.webm.md5 @@ -0,0 +1,10 @@ +181edc4ebeeff7f0527b93b84d5d8efb vp90-2-03-size-202x198-202x198-0001.i420 +132c71b634fb67eed51fcdef1775b6b2 vp90-2-03-size-202x198-202x198-0002.i420 +fd41144770765fc893adc5843ebe32e4 vp90-2-03-size-202x198-202x198-0003.i420 +77dcbaea101142940b6a78a271842829 vp90-2-03-size-202x198-202x198-0004.i420 +01737c38c1ac711a9744256788211177 vp90-2-03-size-202x198-202x198-0005.i420 +31cd0b5f621daac309c6f249f4c26cd8 vp90-2-03-size-202x198-202x198-0006.i420 +e06d34e570dc46904fdb9eeb55811464 vp90-2-03-size-202x198-202x198-0007.i420 +71bf55030373bde1eaeb52d1e97bfa4a vp90-2-03-size-202x198-202x198-0008.i420 +e96063ff02e8a23a666222b59391de9c vp90-2-03-size-202x198-202x198-0009.i420 +5aa0079168ab5069e8a3064f9e2a6d8b vp90-2-03-size-202x198-202x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x200.webm.md5 new file mode 100644 index 0000000..1e7817e --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x200.webm.md5 @@ -0,0 +1,10 @@ +20c41d4a1271183dbbc7a44e6b90ea80 vp90-2-03-size-202x200-202x200-0001.i420 +bd8c1fba8d8742f4d98b7d5097c8c828 vp90-2-03-size-202x200-202x200-0002.i420 +55cbe06a925009c1b1f9b609b60b4c1d vp90-2-03-size-202x200-202x200-0003.i420 +78e80c7cf1f142e2dda1bc269b5b3e00 vp90-2-03-size-202x200-202x200-0004.i420 +42ee8157a4c8af6670b81e9324b251e9 vp90-2-03-size-202x200-202x200-0005.i420 +022bdf5a2e1ea5f98503cd25b383ae53 vp90-2-03-size-202x200-202x200-0006.i420 +c2073865386a991da01966878ce1ce6d vp90-2-03-size-202x200-202x200-0007.i420 +6a5b95cd4eff0836b9180a25f663d36a vp90-2-03-size-202x200-202x200-0008.i420 +5e5498c357340d4755dc98eb0669f103 vp90-2-03-size-202x200-202x200-0009.i420 +0907d5e4020111b1ecfe707df71bcd8a vp90-2-03-size-202x200-202x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x202.webm.md5 new file mode 100644 index 0000000..f5ef776 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x202.webm.md5 @@ -0,0 +1,10 @@ +610cef52d35e9c641f2b8c10489c3d12 vp90-2-03-size-202x202-202x202-0001.i420 +1f84062e607d4798b0544739fe0da99c vp90-2-03-size-202x202-202x202-0002.i420 +ea379947b5c52ea3989dfc3f47c729d9 vp90-2-03-size-202x202-202x202-0003.i420 +1d06b72f06178cbb6bb5d188d22bff43 vp90-2-03-size-202x202-202x202-0004.i420 +25bd41bd7607f88a01aa0cdc336c9975 vp90-2-03-size-202x202-202x202-0005.i420 +86836a95a7a9fb1eefb20f7c5a15a9ab vp90-2-03-size-202x202-202x202-0006.i420 +d8eb3fecce1b646b9877cd4fcca9f9bf vp90-2-03-size-202x202-202x202-0007.i420 +a057e0b29e4ac9717452cc478c418c12 vp90-2-03-size-202x202-202x202-0008.i420 +9a3bab91b4f0fff174536b1609c9632c vp90-2-03-size-202x202-202x202-0009.i420 +d1cd93975f746b6cae490aae31f89e7e vp90-2-03-size-202x202-202x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x208.webm.md5 new file mode 100644 index 0000000..7eae1c8 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x208.webm.md5 @@ -0,0 +1,10 @@ +d2128e290be81bb0700ebe19e3faed4f vp90-2-03-size-202x208-202x208-0001.i420 +dccaecb7e4ddb7e4224221a659af2a43 vp90-2-03-size-202x208-202x208-0002.i420 +be8e0966aaf3a9fe9164f63695dc3b62 vp90-2-03-size-202x208-202x208-0003.i420 +da944fadc3a239c2254678cadb4cf7fa vp90-2-03-size-202x208-202x208-0004.i420 +3c270f3c02fcbd192b7f896f3f9ee6d9 vp90-2-03-size-202x208-202x208-0005.i420 +0b3ccda0a87c37e40104ae2f1060e8e9 vp90-2-03-size-202x208-202x208-0006.i420 +254253aba91758f302e7177e614596be vp90-2-03-size-202x208-202x208-0007.i420 +b1501a4e372a5249e74aab77e57a28f1 vp90-2-03-size-202x208-202x208-0008.i420 +c4497fea1cefed5cf2b2908620153d26 vp90-2-03-size-202x208-202x208-0009.i420 +5ba20dfa2400b15b5394f315c5c3707d vp90-2-03-size-202x208-202x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x210.webm.md5 new file mode 100644 index 0000000..3d0ee16 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x210.webm.md5 @@ -0,0 +1,10 @@ +e4663a28cabbfdd3815efda2d38debcc vp90-2-03-size-202x210-202x210-0001.i420 +3cc7dbec64e9f697f40d740a72c09fc7 vp90-2-03-size-202x210-202x210-0002.i420 +f108981e0ce9c6c501b9ac61d0f1ba44 vp90-2-03-size-202x210-202x210-0003.i420 +63191c7aceb8ac6b030cc1a4b3cda18c vp90-2-03-size-202x210-202x210-0004.i420 +b0a527ae3aafe94d13573199c6f4944f vp90-2-03-size-202x210-202x210-0005.i420 +1be14b213ebf1d653468b8c16bae03fb vp90-2-03-size-202x210-202x210-0006.i420 +44e5a8333a043cd93b9d1cc78e5f188f vp90-2-03-size-202x210-202x210-0007.i420 +bfd7619f990f20e23b47d0738a6a8449 vp90-2-03-size-202x210-202x210-0008.i420 +800405f45ca5198014ef8d8521b044fa vp90-2-03-size-202x210-202x210-0009.i420 +dca4eda872349708f54486433efc8225 vp90-2-03-size-202x210-202x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x224.webm.md5 new file mode 100644 index 0000000..50b423d --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x224.webm.md5 @@ -0,0 +1,10 @@ +1d318f05310f6d40646f23c62c7eafe4 vp90-2-03-size-202x224-202x224-0001.i420 +42870bd73e1a0c5d84b986db3d24f0f0 vp90-2-03-size-202x224-202x224-0002.i420 +afaac676150286143c6fec7992a81467 vp90-2-03-size-202x224-202x224-0003.i420 +128f84400c272628e802c2369b6bf548 vp90-2-03-size-202x224-202x224-0004.i420 +9adc24d69f12349d8b17c84f5c111767 vp90-2-03-size-202x224-202x224-0005.i420 +b33d2f7a1955248652701f2ade8ab55d vp90-2-03-size-202x224-202x224-0006.i420 +b8acc23721097fce6c8835f5fcfaa6ee vp90-2-03-size-202x224-202x224-0007.i420 +b63bf9a08e4dc5879bbd91efaec95960 vp90-2-03-size-202x224-202x224-0008.i420 +96e8fe29935266f6bd486b99f917eabc vp90-2-03-size-202x224-202x224-0009.i420 +54be14f8dde6857867cd4581f8557044 vp90-2-03-size-202x224-202x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-202x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-202x226.webm.md5 new file mode 100644 index 0000000..88d3400 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-202x226.webm.md5 @@ -0,0 +1,10 @@ +5aa0f439c58c6335cd86d4238a8c4b68 vp90-2-03-size-202x226-202x226-0001.i420 +3616cc306ec05f89d9b0db63200e4abf vp90-2-03-size-202x226-202x226-0002.i420 +424e98f8ec0ebf2a326a917ee0159bbe vp90-2-03-size-202x226-202x226-0003.i420 +ed5710e412f056fa8c1a277d86dd45d7 vp90-2-03-size-202x226-202x226-0004.i420 +760b850feab485f0bda6cde9943102bc vp90-2-03-size-202x226-202x226-0005.i420 +f4bd90ca72aa707f9b68e6192ac230fd vp90-2-03-size-202x226-202x226-0006.i420 +58e4aad0bc2a9f3fc279df10208bd6f6 vp90-2-03-size-202x226-202x226-0007.i420 +b42f84723dd167d5c544d539275ad537 vp90-2-03-size-202x226-202x226-0008.i420 +5f54feca21331646e68797380260932a vp90-2-03-size-202x226-202x226-0009.i420 +8e787dd318024aff25af8b4d85040f3c vp90-2-03-size-202x226-202x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x196.webm.md5 new file mode 100644 index 0000000..f32709e --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x196.webm.md5 @@ -0,0 +1,10 @@ +6195975181969789e101a83a555d13f7 vp90-2-03-size-208x196-208x196-0001.i420 +2aca5e3307d68a5e969564a943b8e723 vp90-2-03-size-208x196-208x196-0002.i420 +aee4b00472ee0b6b7a13e31069181db4 vp90-2-03-size-208x196-208x196-0003.i420 +7808595b650a7c14d8a4800db7c014e0 vp90-2-03-size-208x196-208x196-0004.i420 +746eb763b176286aa875ae06b81118c4 vp90-2-03-size-208x196-208x196-0005.i420 +0e8a78ec061319e27d49ca25e333e017 vp90-2-03-size-208x196-208x196-0006.i420 +ac4432db2bb0971d5f70a7dda1210c19 vp90-2-03-size-208x196-208x196-0007.i420 +78870f4bd767f8ab65d369a5b322735d vp90-2-03-size-208x196-208x196-0008.i420 +eee9ddd91209348a64259db6a4a3f80c vp90-2-03-size-208x196-208x196-0009.i420 +c48d21e36a9c0d0d1c64db3f776b3002 vp90-2-03-size-208x196-208x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x198.webm.md5 new file mode 100644 index 0000000..a57dc44 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x198.webm.md5 @@ -0,0 +1,10 @@ +1f1fa3cdf865d8c75183f4ba6203b675 vp90-2-03-size-208x198-208x198-0001.i420 +ead33ead8fea5bd5d831a79f4c75a590 vp90-2-03-size-208x198-208x198-0002.i420 +9a406b4464989fd4bb7cbcb1b18aeaa7 vp90-2-03-size-208x198-208x198-0003.i420 +fab3d228e7032f2cdc440dbfcb17c4c1 vp90-2-03-size-208x198-208x198-0004.i420 +f2f3f8b8d9ece21c359c89245157c613 vp90-2-03-size-208x198-208x198-0005.i420 +321f5a8ecb2cec1780013fe72c237bde vp90-2-03-size-208x198-208x198-0006.i420 +6f025b1f4ef61d261f05ca149a9470e6 vp90-2-03-size-208x198-208x198-0007.i420 +85abcc8d8e6b5f286ed6aa6c588cf416 vp90-2-03-size-208x198-208x198-0008.i420 +b28d710dd44389f774aa02edd6327d5c vp90-2-03-size-208x198-208x198-0009.i420 +79374bef9819eecafa7396d70c80be7f vp90-2-03-size-208x198-208x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x200.webm.md5 new file mode 100644 index 0000000..35756a2 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x200.webm.md5 @@ -0,0 +1,10 @@ +ff2dda3ddbe8b461d960baba0ad132bf vp90-2-03-size-208x200-208x200-0001.i420 +d6935ac8f2250316f498e8f01afa04fd vp90-2-03-size-208x200-208x200-0002.i420 +57173ebaef7b21698c62fa959cb40ead vp90-2-03-size-208x200-208x200-0003.i420 +f354c76d7cf45e9f3adfdde0f6b3b5c9 vp90-2-03-size-208x200-208x200-0004.i420 +fbc968ecd214b01509a76996e45dd09a vp90-2-03-size-208x200-208x200-0005.i420 +9c314b51a80f2a081adf9b9cc26f5f8a vp90-2-03-size-208x200-208x200-0006.i420 +f22883a6a5b74ffa4bb16f22d496b5a5 vp90-2-03-size-208x200-208x200-0007.i420 +eb4fa914fc5658d43e32c48a0c39bab3 vp90-2-03-size-208x200-208x200-0008.i420 +d763c0c2f44b68e1e3fe9e165334eb0b vp90-2-03-size-208x200-208x200-0009.i420 +344e1075a48cd61e79b0550809b4c91f vp90-2-03-size-208x200-208x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x202.webm.md5 new file mode 100644 index 0000000..cd27e7c --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x202.webm.md5 @@ -0,0 +1,10 @@ +e5164f87feadf4b65257f578affc3e04 vp90-2-03-size-208x202-208x202-0001.i420 +6aee5a3b6c3a096dfc1594762b2b248f vp90-2-03-size-208x202-208x202-0002.i420 +cb1c9dce6fdf7372e0eb2397251f0ade vp90-2-03-size-208x202-208x202-0003.i420 +4fe5f24c08690c966b6a14ac3422510b vp90-2-03-size-208x202-208x202-0004.i420 +b22a273814523251b365f3278d8a3a9c vp90-2-03-size-208x202-208x202-0005.i420 +190d9dff373023a25427fc859545ea24 vp90-2-03-size-208x202-208x202-0006.i420 +a6307f38718ed686cb195e3833ab27ab vp90-2-03-size-208x202-208x202-0007.i420 +79630bec5a91d69aca42a910413c2800 vp90-2-03-size-208x202-208x202-0008.i420 +2231cec9c03714b8671e5e1456b148c9 vp90-2-03-size-208x202-208x202-0009.i420 +278458f6734a24f2eb9bc877a6e9d7df vp90-2-03-size-208x202-208x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x208.webm.md5 new file mode 100644 index 0000000..921cbdd --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x208.webm.md5 @@ -0,0 +1,10 @@ +6bff7c1f4c5ef8412ebf669852c70de6 vp90-2-03-size-208x208-208x208-0001.i420 +fdfd7a2308de9509a41fed2880a8f0f5 vp90-2-03-size-208x208-208x208-0002.i420 +d8b464811e9c3b8a6db9cc277ac88c59 vp90-2-03-size-208x208-208x208-0003.i420 +b8fa29e79be3126dd74310d6dd09c747 vp90-2-03-size-208x208-208x208-0004.i420 +dad29803fed686887a0873eb78a469c6 vp90-2-03-size-208x208-208x208-0005.i420 +684de29bbf800f52aea4af9850bcc5b3 vp90-2-03-size-208x208-208x208-0006.i420 +06862dbce7571b4487766b179a596e1d vp90-2-03-size-208x208-208x208-0007.i420 +99582a966bc7070112e214ce7912e485 vp90-2-03-size-208x208-208x208-0008.i420 +a61158581a5719cb0cf13fb3301cb8c4 vp90-2-03-size-208x208-208x208-0009.i420 +9c2295332f34fee3a249262c8ba843bc vp90-2-03-size-208x208-208x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x210.webm.md5 new file mode 100644 index 0000000..ab5c7d8 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x210.webm.md5 @@ -0,0 +1,10 @@ +b15c7e98ddd137237b062cb51667522f vp90-2-03-size-208x210-208x210-0001.i420 +00c594c68b19ef39a79a38e86853dc64 vp90-2-03-size-208x210-208x210-0002.i420 +e6742abe3d2c178af4298e121391c299 vp90-2-03-size-208x210-208x210-0003.i420 +efe5387b38c32f1c25c0fc9836921074 vp90-2-03-size-208x210-208x210-0004.i420 +e0e696f4c18af09a74e052903db1468c vp90-2-03-size-208x210-208x210-0005.i420 +f1960270c6704ca47caed63161716025 vp90-2-03-size-208x210-208x210-0006.i420 +a1542d7749cfa447481acd7835db838a vp90-2-03-size-208x210-208x210-0007.i420 +a91fb10a17d1d056667860cc43c81dae vp90-2-03-size-208x210-208x210-0008.i420 +b673bfbb722522b4e7b5e9c5b85cc31f vp90-2-03-size-208x210-208x210-0009.i420 +8b4bb57d3cf609cbf9564a96a6ca6ade vp90-2-03-size-208x210-208x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x224.webm.md5 new file mode 100644 index 0000000..bcb9657 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x224.webm.md5 @@ -0,0 +1,10 @@ +479d07bb96905ad7d5f0ec3ee12b41ba vp90-2-03-size-208x224-208x224-0001.i420 +4b6555aaed8e5a45879773f1bf87962e vp90-2-03-size-208x224-208x224-0002.i420 +c5f42cb796dd7b6622957016ca6b502f vp90-2-03-size-208x224-208x224-0003.i420 +f06c954483560866fbff10bae7ba0785 vp90-2-03-size-208x224-208x224-0004.i420 +af83aff39999852310395fe241ccb49b vp90-2-03-size-208x224-208x224-0005.i420 +108377d6f30ceba6f2377330af2da38f vp90-2-03-size-208x224-208x224-0006.i420 +e81e6e0b37a7b92368ede9cab124567c vp90-2-03-size-208x224-208x224-0007.i420 +59dbe51caaed8e6e825c78c5901fb22c vp90-2-03-size-208x224-208x224-0008.i420 +24686123ea14c8d1a9b447733df0aaab vp90-2-03-size-208x224-208x224-0009.i420 +ce2035c49237c8076f8dac0d3f61848e vp90-2-03-size-208x224-208x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-208x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-208x226.webm.md5 new file mode 100644 index 0000000..e0a7e53 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-208x226.webm.md5 @@ -0,0 +1,10 @@ +33aa4af6153570518c59960a0c959053 vp90-2-03-size-208x226-208x226-0001.i420 +024fa27dee80ad199528052aaa8d42c7 vp90-2-03-size-208x226-208x226-0002.i420 +b949ef118c7e7e62a8b88e2308219ef9 vp90-2-03-size-208x226-208x226-0003.i420 +3061ee13696ced5e10a646fdd5ca6c34 vp90-2-03-size-208x226-208x226-0004.i420 +c4984bd53dcb7b9e2570f2965d077b2f vp90-2-03-size-208x226-208x226-0005.i420 +d564c35c5caadcfd9f80377fa414af72 vp90-2-03-size-208x226-208x226-0006.i420 +9b7d7b10ee2f3eb7a9ffddcebff45b97 vp90-2-03-size-208x226-208x226-0007.i420 +a0ede7085b04cbb3519d56b2e4347d14 vp90-2-03-size-208x226-208x226-0008.i420 +63d7af745f9e6a34b618db28fe878ffd vp90-2-03-size-208x226-208x226-0009.i420 +85077809087e7bdfb9215bfcd1f1bbc0 vp90-2-03-size-208x226-208x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x196.webm.md5 new file mode 100644 index 0000000..c23a9af --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x196.webm.md5 @@ -0,0 +1,10 @@ +5c69f80da667bfd20394995e93e4cd2b vp90-2-03-size-210x196-210x196-0001.i420 +13363cd8e52ca8c1053db1c84c111bc9 vp90-2-03-size-210x196-210x196-0002.i420 +108976afdf99f59276d6f89879e3bdc3 vp90-2-03-size-210x196-210x196-0003.i420 +770ce25985e6b479d52a9185876cfe83 vp90-2-03-size-210x196-210x196-0004.i420 +eba7cbb3c91989aa4c13487ed01675b5 vp90-2-03-size-210x196-210x196-0005.i420 +f391c30a47c33a250dd20cb12f0a6e01 vp90-2-03-size-210x196-210x196-0006.i420 +c38e12de302177d19dd744a3ea227e90 vp90-2-03-size-210x196-210x196-0007.i420 +8c9370439a0b7289919c6ee68e00570f vp90-2-03-size-210x196-210x196-0008.i420 +ac3748c4b99c4f1aba7430ae12c19cfd vp90-2-03-size-210x196-210x196-0009.i420 +e5228dc84f7933ccc9306907d737ad3c vp90-2-03-size-210x196-210x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x198.webm.md5 new file mode 100644 index 0000000..7776c06 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x198.webm.md5 @@ -0,0 +1,10 @@ +d83ee2413e701ae405a2b74863d4c5a9 vp90-2-03-size-210x198-210x198-0001.i420 +f2ebc0f7dc171e0e5d2911c7ee2df5e1 vp90-2-03-size-210x198-210x198-0002.i420 +e189ef4d8add227352a0d6ee62748ee7 vp90-2-03-size-210x198-210x198-0003.i420 +6dcb1dca1a0e2ba85034aba9f021427e vp90-2-03-size-210x198-210x198-0004.i420 +e98c633ba8912f6d65374055ec9af543 vp90-2-03-size-210x198-210x198-0005.i420 +82111cb7d5addce16d9bcba9e0a99503 vp90-2-03-size-210x198-210x198-0006.i420 +bbbc73002f794ab0261fe384b2524226 vp90-2-03-size-210x198-210x198-0007.i420 +0bcdc427df47123959f7de9c44fe291e vp90-2-03-size-210x198-210x198-0008.i420 +505776b3d82e38612393d60b6aa55c1d vp90-2-03-size-210x198-210x198-0009.i420 +feb93758242b847f3d53bb4c97b0ad9c vp90-2-03-size-210x198-210x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x200.webm.md5 new file mode 100644 index 0000000..20dea3f --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x200.webm.md5 @@ -0,0 +1,10 @@ +2465560246c1ee24d937cb9cbc1422f1 vp90-2-03-size-210x200-210x200-0001.i420 +8926b628dcdf2182516822c7d0d778ec vp90-2-03-size-210x200-210x200-0002.i420 +9bd14d3ebc7fe81c4223116de1b9c2ec vp90-2-03-size-210x200-210x200-0003.i420 +2d029d8461c20236066c0786950540fb vp90-2-03-size-210x200-210x200-0004.i420 +39412b6e62de43bd40c58d4e2e38daf8 vp90-2-03-size-210x200-210x200-0005.i420 +3ea211c24f606b29582147bf872994dd vp90-2-03-size-210x200-210x200-0006.i420 +261c37f88bf7f40549642578d9464aeb vp90-2-03-size-210x200-210x200-0007.i420 +98551d44de1e23165e05975babb72446 vp90-2-03-size-210x200-210x200-0008.i420 +1d85ad052dd27e7e6bfea5d2babf5176 vp90-2-03-size-210x200-210x200-0009.i420 +ad18b6a3698a3674c2488f927810eb0d vp90-2-03-size-210x200-210x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x202.webm.md5 new file mode 100644 index 0000000..8d7e06e --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x202.webm.md5 @@ -0,0 +1,10 @@ +5d01848aee2b324f2e356627f9c39532 vp90-2-03-size-210x202-210x202-0001.i420 +b671fe34bc0e5a682baff929d26ea627 vp90-2-03-size-210x202-210x202-0002.i420 +e9a40f87ca5aaa5af9772e286feb9063 vp90-2-03-size-210x202-210x202-0003.i420 +4730f60d4c856e8ad877c0d8b1729ec4 vp90-2-03-size-210x202-210x202-0004.i420 +317fc01349e0984c23d15f97a3a0f442 vp90-2-03-size-210x202-210x202-0005.i420 +aea89116ffe48340d1752d1ad5195529 vp90-2-03-size-210x202-210x202-0006.i420 +14694ba65b6308e5f5571486b62ca1cc vp90-2-03-size-210x202-210x202-0007.i420 +53c6102d877c9a30eaa20ddc45207ea0 vp90-2-03-size-210x202-210x202-0008.i420 +7d1e898b1bead878224e8ff15d624bd9 vp90-2-03-size-210x202-210x202-0009.i420 +37b684bfae5dbd33e8dbb8332b94ce8a vp90-2-03-size-210x202-210x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x208.webm.md5 new file mode 100644 index 0000000..72f9259 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x208.webm.md5 @@ -0,0 +1,10 @@ +1156d318c00d299cf5bdc7e485966dab vp90-2-03-size-210x208-210x208-0001.i420 +a8094f8f1e7e04e54251bee8c4c800ce vp90-2-03-size-210x208-210x208-0002.i420 +e2a07d99ffe1cfe6b9fce36e93677fe1 vp90-2-03-size-210x208-210x208-0003.i420 +63d179b00816dbad75b778d2c23955c6 vp90-2-03-size-210x208-210x208-0004.i420 +407de5fb2dfdd52e6173905b09ff22f2 vp90-2-03-size-210x208-210x208-0005.i420 +36900199c56310e651723de4e3ad2f2c vp90-2-03-size-210x208-210x208-0006.i420 +908db56e975b5db07af17fdc51b12be8 vp90-2-03-size-210x208-210x208-0007.i420 +400e32490b1262009a481cc331a00e44 vp90-2-03-size-210x208-210x208-0008.i420 +dc43b786cba033cc92b9921d12f7b3d7 vp90-2-03-size-210x208-210x208-0009.i420 +e8c94c5965c729f5d1ef3ba4509c97c8 vp90-2-03-size-210x208-210x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x210.webm.md5 new file mode 100644 index 0000000..6b88d01 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x210.webm.md5 @@ -0,0 +1,10 @@ +b65725c68978bdaaafdf735dfbafa9e3 vp90-2-03-size-210x210-210x210-0001.i420 +35be2f16bd5dedc9d3f7a016f0d71701 vp90-2-03-size-210x210-210x210-0002.i420 +8c2873a97b51510d7449869e24a348f5 vp90-2-03-size-210x210-210x210-0003.i420 +724a30e8ae539e797db8889dc08aec5e vp90-2-03-size-210x210-210x210-0004.i420 +e3ae1246a63ea22afd026bfb859fe165 vp90-2-03-size-210x210-210x210-0005.i420 +7e1fa363cf3f44c7a3019f29c14a6da4 vp90-2-03-size-210x210-210x210-0006.i420 +c6f26619ab5687a2a698c8766b79f2eb vp90-2-03-size-210x210-210x210-0007.i420 +be5b8c50a772afe95d72bf3cc7c4fd2f vp90-2-03-size-210x210-210x210-0008.i420 +9eab1417ac249ce31c79750143d52084 vp90-2-03-size-210x210-210x210-0009.i420 +9d2455048dbc3cdc2343a818c5a2bcb1 vp90-2-03-size-210x210-210x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x224.webm.md5 new file mode 100644 index 0000000..7bd7a82 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x224.webm.md5 @@ -0,0 +1,10 @@ +bb903b926c4b34ae336e21d65ad8fd25 vp90-2-03-size-210x224-210x224-0001.i420 +c4c0bc3b112487e994d22176817ace3c vp90-2-03-size-210x224-210x224-0002.i420 +24e699f7a92ab1b0fe12e0b747470b5b vp90-2-03-size-210x224-210x224-0003.i420 +200f403694d3acfda63f52e8373f1420 vp90-2-03-size-210x224-210x224-0004.i420 +6df417a8ec1810562301c89724b739d1 vp90-2-03-size-210x224-210x224-0005.i420 +55757b633d8fe669fc0f507dab4fa9f7 vp90-2-03-size-210x224-210x224-0006.i420 +45bc82bee02cb45422be3ac1019896d0 vp90-2-03-size-210x224-210x224-0007.i420 +4aaf5d07d2796910767d5084556c9cf9 vp90-2-03-size-210x224-210x224-0008.i420 +f100fa26da47250b98d95a18915f521d vp90-2-03-size-210x224-210x224-0009.i420 +f5a8def53b4638b6ce7c8588d595d0ad vp90-2-03-size-210x224-210x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-210x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-210x226.webm.md5 new file mode 100644 index 0000000..48fa3d4 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-210x226.webm.md5 @@ -0,0 +1,10 @@ +03707b2f5c392933f7336f380423a0a1 vp90-2-03-size-210x226-210x226-0001.i420 +b388553c79573555a3b660f5e36d4e36 vp90-2-03-size-210x226-210x226-0002.i420 +a1a7fd8ba7fb0fe7733cdf5440c7c1f3 vp90-2-03-size-210x226-210x226-0003.i420 +9daff7ef71dd54951f0b75a902065259 vp90-2-03-size-210x226-210x226-0004.i420 +60218a4b8bc0a5b0b40fa560a40fb4c0 vp90-2-03-size-210x226-210x226-0005.i420 +21229bfed833468fafc27ce93db1450c vp90-2-03-size-210x226-210x226-0006.i420 +7aa290c6e503315d7aa3517258d5f63a vp90-2-03-size-210x226-210x226-0007.i420 +63fd08ae2e859ff3d874ab2c2ce41a42 vp90-2-03-size-210x226-210x226-0008.i420 +725b371247fae28ef4b912368738df64 vp90-2-03-size-210x226-210x226-0009.i420 +7cf2d8d9e464307311b499ff0c3ea05e vp90-2-03-size-210x226-210x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x196.webm.md5 new file mode 100644 index 0000000..3edb492 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x196.webm.md5 @@ -0,0 +1,10 @@ +3ffc096f1b42b4d319d4a9efbefc7625 vp90-2-03-size-224x196-224x196-0001.i420 +78b3655d5cad30fa6b2c2d8fd29463de vp90-2-03-size-224x196-224x196-0002.i420 +ab197553d9599b2a03aff62d1d694848 vp90-2-03-size-224x196-224x196-0003.i420 +be368d1f3d3fcc710565b5433940f0df vp90-2-03-size-224x196-224x196-0004.i420 +374c5db60ea9c110b871bb45be0efff1 vp90-2-03-size-224x196-224x196-0005.i420 +ec50085400d626de5833bc0a94d9941f vp90-2-03-size-224x196-224x196-0006.i420 +d4ae69937e2a8d9bf2023d4215749635 vp90-2-03-size-224x196-224x196-0007.i420 +9b0b81eb6d62b8014e0639932fe35bc0 vp90-2-03-size-224x196-224x196-0008.i420 +cd02d0cc268e6b6df0b2dbd3f3b137e6 vp90-2-03-size-224x196-224x196-0009.i420 +5322ba1085c114f93534e1761a0d8aa1 vp90-2-03-size-224x196-224x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x198.webm.md5 new file mode 100644 index 0000000..d0b35cd --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x198.webm.md5 @@ -0,0 +1,10 @@ +cf35dffc80946e87bb9d3e18aab9d320 vp90-2-03-size-224x198-224x198-0001.i420 +a76ac92f05e9b097f8ac5882e1ffe656 vp90-2-03-size-224x198-224x198-0002.i420 +faa1e8a11c9df3e9c9a9dafbebea6d04 vp90-2-03-size-224x198-224x198-0003.i420 +905a28289c8ac793b335096ca7f84e1d vp90-2-03-size-224x198-224x198-0004.i420 +cb480fa6977baf98a74bddf213ecba82 vp90-2-03-size-224x198-224x198-0005.i420 +35224d3708e3ba1dafcc58b803d5ea77 vp90-2-03-size-224x198-224x198-0006.i420 +d166d764e87854bca47ab7a2bc8b1f9b vp90-2-03-size-224x198-224x198-0007.i420 +562f1e06ae36abba5f1fb53e3d6cd7e8 vp90-2-03-size-224x198-224x198-0008.i420 +1599cebef060f6464aeef15aacbde446 vp90-2-03-size-224x198-224x198-0009.i420 +3316ebca2864a9dc04db86069efb1dd1 vp90-2-03-size-224x198-224x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x200.webm.md5 new file mode 100644 index 0000000..bb368ce --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x200.webm.md5 @@ -0,0 +1,10 @@ +0819e6d715c9b4d94f05f63a7ca86199 vp90-2-03-size-224x200-224x200-0001.i420 +9b9a4b01ed4c8a93687e45245b3092a3 vp90-2-03-size-224x200-224x200-0002.i420 +3a076f5b8dba60552e84a391ee04d1c7 vp90-2-03-size-224x200-224x200-0003.i420 +7aafc561f5b96e9d286bd8deb5687774 vp90-2-03-size-224x200-224x200-0004.i420 +daa43a89ab6b2761eedaa183e33a3465 vp90-2-03-size-224x200-224x200-0005.i420 +c14874409872357b11b65f35a283e058 vp90-2-03-size-224x200-224x200-0006.i420 +37d2ef52a9c694b2596d58ed9ca0d90b vp90-2-03-size-224x200-224x200-0007.i420 +c97bc860c006896d80f52ccc0759f472 vp90-2-03-size-224x200-224x200-0008.i420 +5f8618114a723a017e39a1af695996f3 vp90-2-03-size-224x200-224x200-0009.i420 +ee8234fc5ccd41d05eb87e1510f9795e vp90-2-03-size-224x200-224x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x202.webm.md5 new file mode 100644 index 0000000..0c6b78c --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x202.webm.md5 @@ -0,0 +1,10 @@ +e1e3b4af5910383ff6f66b6ab1a29544 vp90-2-03-size-224x202-224x202-0001.i420 +8668ef92b72f35728ebb456665d48b95 vp90-2-03-size-224x202-224x202-0002.i420 +dffc7c28f86f07bf28451292990e9594 vp90-2-03-size-224x202-224x202-0003.i420 +aebfb446fa6d48db36dbd9b5cd147f1e vp90-2-03-size-224x202-224x202-0004.i420 +e3c6cb8c5bb3a26928493bfc297ab827 vp90-2-03-size-224x202-224x202-0005.i420 +68dabae76c1d27ab0e1079d99cb6d413 vp90-2-03-size-224x202-224x202-0006.i420 +d1f7745eef748688f3871d00a7e67ef8 vp90-2-03-size-224x202-224x202-0007.i420 +36738851cc2af83fd250dea4cd63941b vp90-2-03-size-224x202-224x202-0008.i420 +16c0315c43427e7e6719806a89551703 vp90-2-03-size-224x202-224x202-0009.i420 +c4d589c0ea4cdfc1dd6dff72084c61fd vp90-2-03-size-224x202-224x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x208.webm.md5 new file mode 100644 index 0000000..1bcdd2c --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x208.webm.md5 @@ -0,0 +1,10 @@ +85f08afadfd1204d4131b9ee9c8cc10b vp90-2-03-size-224x208-224x208-0001.i420 +f893de5432a082b3dffcf7499827f548 vp90-2-03-size-224x208-224x208-0002.i420 +cb81e0d7b657bc5a4a9cf8ad75a76a77 vp90-2-03-size-224x208-224x208-0003.i420 +8a40842123965731c15fc23fb6366d1d vp90-2-03-size-224x208-224x208-0004.i420 +09c6d92af14a3fcfb12705cd5da57f2a vp90-2-03-size-224x208-224x208-0005.i420 +6bede4dc8770df534b599021b0425309 vp90-2-03-size-224x208-224x208-0006.i420 +334b0b0448e9e4e6a0cddcd2e3a0af3f vp90-2-03-size-224x208-224x208-0007.i420 +09f491f0f3870ef96cff0384cd7183d1 vp90-2-03-size-224x208-224x208-0008.i420 +c9e5f81186ac947a77b051c8f0e76eac vp90-2-03-size-224x208-224x208-0009.i420 +917565c3327bff78b53a78ea739472ff vp90-2-03-size-224x208-224x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x210.webm.md5 new file mode 100644 index 0000000..d522202 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x210.webm.md5 @@ -0,0 +1,10 @@ +427421e5fd2087c6ff7b87a27982332f vp90-2-03-size-224x210-224x210-0001.i420 +b68311fd44e189e4174ac357d5415068 vp90-2-03-size-224x210-224x210-0002.i420 +2c822ff45be7a1ea412d21ff82c7bc1d vp90-2-03-size-224x210-224x210-0003.i420 +34659186d93516eae1dd4d9a391d1c3f vp90-2-03-size-224x210-224x210-0004.i420 +1990dd822abc3a10f511589db5aa50f4 vp90-2-03-size-224x210-224x210-0005.i420 +4a4dc076172c79d9fde3e17b47109835 vp90-2-03-size-224x210-224x210-0006.i420 +51874c79850120537fa5c405721d0107 vp90-2-03-size-224x210-224x210-0007.i420 +15d7897a128de9be90be17f1679012c9 vp90-2-03-size-224x210-224x210-0008.i420 +a8d9480accf8585e94161a5f7c371cef vp90-2-03-size-224x210-224x210-0009.i420 +8a9d3f09561b895b423ae9428f620b9b vp90-2-03-size-224x210-224x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x224.webm.md5 new file mode 100644 index 0000000..1a8a55e --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x224.webm.md5 @@ -0,0 +1,10 @@ +bedd5d2725ffff06a50e23841bc2dfb8 vp90-2-03-size-224x224-224x224-0001.i420 +8c363f68b0b30f507563516aa99e23ac vp90-2-03-size-224x224-224x224-0002.i420 +9cb7d51ca4439614dc3f5980507a4d32 vp90-2-03-size-224x224-224x224-0003.i420 +b393a18de28ab6b8d1c6afd67a7794e0 vp90-2-03-size-224x224-224x224-0004.i420 +81f69ee1e3d89cb78cac192c352f7741 vp90-2-03-size-224x224-224x224-0005.i420 +aabb51f029a9a02e71524cf3500931e9 vp90-2-03-size-224x224-224x224-0006.i420 +6581aec620c508d2b42ccceaa2c6044d vp90-2-03-size-224x224-224x224-0007.i420 +993cde759158c30dcf0f0a9fdcdfb0d8 vp90-2-03-size-224x224-224x224-0008.i420 +85985ae8d35514d601800a06c8226625 vp90-2-03-size-224x224-224x224-0009.i420 +0eba1d7c193e473586e4a5c87d0e0d21 vp90-2-03-size-224x224-224x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-224x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-224x226.webm.md5 new file mode 100644 index 0000000..b3a8eee --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-224x226.webm.md5 @@ -0,0 +1,10 @@ +dca556e648a576b3973fbe4b34d0328c vp90-2-03-size-224x226-224x226-0001.i420 +34a49e4aba4aca5c76ab0f751341c32b vp90-2-03-size-224x226-224x226-0002.i420 +4b7cc6d500b273efe7e30fc3a3946f74 vp90-2-03-size-224x226-224x226-0003.i420 +1960f0f1edf9196c96b0de742a3cd53c vp90-2-03-size-224x226-224x226-0004.i420 +3cb7d90178636911c5d53a5f8e75599c vp90-2-03-size-224x226-224x226-0005.i420 +84b56c60c2282f85102048cc2cf40b88 vp90-2-03-size-224x226-224x226-0006.i420 +3ca34d2978307ec0fca05130d81bcc26 vp90-2-03-size-224x226-224x226-0007.i420 +c15560be737e02ea9d1deeca0af9bb77 vp90-2-03-size-224x226-224x226-0008.i420 +391439789a6aa7bb02d7e699795a9559 vp90-2-03-size-224x226-224x226-0009.i420 +9f681e91cbcbe9920f21236b8ff093c7 vp90-2-03-size-224x226-224x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x196.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x196.webm.md5 new file mode 100644 index 0000000..a995846 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x196.webm.md5 @@ -0,0 +1,10 @@ +4757a31842453f806de2f2256329547e vp90-2-03-size-226x196-226x196-0001.i420 +fe5fb955a4143091c5bfae7c4a4afe0f vp90-2-03-size-226x196-226x196-0002.i420 +93766c5a03d71f99afb7705add7b63f0 vp90-2-03-size-226x196-226x196-0003.i420 +30c91162aa6fb0ed3e47325146bb6d8a vp90-2-03-size-226x196-226x196-0004.i420 +501fe67785b970b1b62c2ae0b36b19ad vp90-2-03-size-226x196-226x196-0005.i420 +836be5e778e3d20e75c4fcd71f765b3d vp90-2-03-size-226x196-226x196-0006.i420 +21a9fd5e78212fe71719e173844bc6e6 vp90-2-03-size-226x196-226x196-0007.i420 +81b3919208e345d93dde62740b47dd93 vp90-2-03-size-226x196-226x196-0008.i420 +df010555a929ba88a2f25c6267e3786e vp90-2-03-size-226x196-226x196-0009.i420 +d2cff8282e5e7a5bbd879c73df0670c3 vp90-2-03-size-226x196-226x196-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x198.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x198.webm.md5 new file mode 100644 index 0000000..3c4d3f5 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x198.webm.md5 @@ -0,0 +1,10 @@ +b97087eb8c53cf56dc44576912654fb2 vp90-2-03-size-226x198-226x198-0001.i420 +219bb68a59dc166806a5b5689a943b66 vp90-2-03-size-226x198-226x198-0002.i420 +67b2ec19dd3b74d828b51912c25249d6 vp90-2-03-size-226x198-226x198-0003.i420 +73dd9625538e10a0f94d31ac9fe3db23 vp90-2-03-size-226x198-226x198-0004.i420 +51e68f201130da18beb0cb27adcf6fa9 vp90-2-03-size-226x198-226x198-0005.i420 +455d9753b3c0ac5ad7d9da022f69acd0 vp90-2-03-size-226x198-226x198-0006.i420 +60a8905a63db4cdd2560583fb6415030 vp90-2-03-size-226x198-226x198-0007.i420 +48c156f4b2c9f936487b43713a4573fd vp90-2-03-size-226x198-226x198-0008.i420 +a5c8f4190cb34b3ecd42ca8e09bf1646 vp90-2-03-size-226x198-226x198-0009.i420 +233a5d5187137e047993532fc2e725d3 vp90-2-03-size-226x198-226x198-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x200.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x200.webm.md5 new file mode 100644 index 0000000..edab982 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x200.webm.md5 @@ -0,0 +1,10 @@ +0ae27db338f73f37eaed806b1c789593 vp90-2-03-size-226x200-226x200-0001.i420 +3f69273752f43699a3bc7b22a88cc3aa vp90-2-03-size-226x200-226x200-0002.i420 +ce0dfafb59910241d2b1a2275a2c2143 vp90-2-03-size-226x200-226x200-0003.i420 +8d20f404e25766c819ee728858bcbc76 vp90-2-03-size-226x200-226x200-0004.i420 +67bc5604c5b0f6c3484b605c1f93c83a vp90-2-03-size-226x200-226x200-0005.i420 +1c82def3a06430d205cce0db7b5714de vp90-2-03-size-226x200-226x200-0006.i420 +654d7a676e3b8b64541ed8cdefbd7286 vp90-2-03-size-226x200-226x200-0007.i420 +6c80c78c7b652c5b3b117a0960e89951 vp90-2-03-size-226x200-226x200-0008.i420 +ae73e3c69ec6747c5234d58c5e1e36eb vp90-2-03-size-226x200-226x200-0009.i420 +e40d716efd8caf2d4004d299fb914328 vp90-2-03-size-226x200-226x200-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x202.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x202.webm.md5 new file mode 100644 index 0000000..80e7ac2 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x202.webm.md5 @@ -0,0 +1,10 @@ +0cd2876640e71de3a6df7839bd6f0b51 vp90-2-03-size-226x202-226x202-0001.i420 +f887db6839c0cddd1ea9ae6bfd2cc16d vp90-2-03-size-226x202-226x202-0002.i420 +ff2a890cf4c4973bf181ba8424c2eadc vp90-2-03-size-226x202-226x202-0003.i420 +f69f2e4f3036a21deb43a0bf4b95771f vp90-2-03-size-226x202-226x202-0004.i420 +93f511739c19f1a3b356dda39d945c93 vp90-2-03-size-226x202-226x202-0005.i420 +7f79633c93765b504fef0324bd10fdba vp90-2-03-size-226x202-226x202-0006.i420 +d6c53d3937c9a40b227b4486452e0b33 vp90-2-03-size-226x202-226x202-0007.i420 +4e26625e8997ad6fe08ae68fbdfdbfd7 vp90-2-03-size-226x202-226x202-0008.i420 +3bf4c8ac0279351bf904cf57b0fc13c1 vp90-2-03-size-226x202-226x202-0009.i420 +12d64d856025185fa9e610dfa62b05af vp90-2-03-size-226x202-226x202-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x208.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x208.webm.md5 new file mode 100644 index 0000000..364227a --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x208.webm.md5 @@ -0,0 +1,10 @@ +6006cac6628cf9e7cea58aec07471b06 vp90-2-03-size-226x208-226x208-0001.i420 +f7e994921248b6933920c984880ec96c vp90-2-03-size-226x208-226x208-0002.i420 +c0aeeb9d2009538d8d5e837f45e1542d vp90-2-03-size-226x208-226x208-0003.i420 +7dacf9d00e85bd52045eb47bae5225b3 vp90-2-03-size-226x208-226x208-0004.i420 +024fd008a099ae954e38a3f0a8ebb6c9 vp90-2-03-size-226x208-226x208-0005.i420 +fb6c368a1b3578ab59aa30e0b5cc4853 vp90-2-03-size-226x208-226x208-0006.i420 +07815251f7020b627c365a7a7be694c7 vp90-2-03-size-226x208-226x208-0007.i420 +db8b8f48f3693867d2bd8208cf4f929a vp90-2-03-size-226x208-226x208-0008.i420 +88b42d943c0978d832333a8a3f7b6bbc vp90-2-03-size-226x208-226x208-0009.i420 +7aa760190f9328ba4f6fa87d1d9e8d3e vp90-2-03-size-226x208-226x208-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x210.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x210.webm.md5 new file mode 100644 index 0000000..f4afd83 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x210.webm.md5 @@ -0,0 +1,10 @@ +a6c1b7686202f5cc64335f92be595309 vp90-2-03-size-226x210-226x210-0001.i420 +3e573d4c693a39c5d6cd46b8873e99bb vp90-2-03-size-226x210-226x210-0002.i420 +d2388f6f641c8ddec98f11493f1a1390 vp90-2-03-size-226x210-226x210-0003.i420 +16473e33532ebc8de2f02077c406346b vp90-2-03-size-226x210-226x210-0004.i420 +6c75d1c01276838fce40837e373f49db vp90-2-03-size-226x210-226x210-0005.i420 +b718e7445e2b08dde78fa7f30be01346 vp90-2-03-size-226x210-226x210-0006.i420 +2f556ed5afd60b1bbae76984ce073107 vp90-2-03-size-226x210-226x210-0007.i420 +4e5d59daed044c39a14c35f18cb4fb7a vp90-2-03-size-226x210-226x210-0008.i420 +c14901a9906ffcd0eb1efc068ce32941 vp90-2-03-size-226x210-226x210-0009.i420 +3d73b7f87bcd16c1ec565b5cc8d0fe93 vp90-2-03-size-226x210-226x210-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x224.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x224.webm.md5 new file mode 100644 index 0000000..24df8e0 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x224.webm.md5 @@ -0,0 +1,10 @@ +80fb3a643384386beadc0991f171669d vp90-2-03-size-226x224-226x224-0001.i420 +65a4a51163f49a75f8eeecd94cb2ba47 vp90-2-03-size-226x224-226x224-0002.i420 +d5b2aac9889d2991b83fd4360ada0258 vp90-2-03-size-226x224-226x224-0003.i420 +7958ff5535358567ea7df351d78256a7 vp90-2-03-size-226x224-226x224-0004.i420 +7e7413b9a61967d0ade07b81944e9a15 vp90-2-03-size-226x224-226x224-0005.i420 +40a008016adbf9673adbbc4c0edb4454 vp90-2-03-size-226x224-226x224-0006.i420 +fef7b5e2809ef79917ab394a067ef4be vp90-2-03-size-226x224-226x224-0007.i420 +91ee2360faf46a25b95927c55eea603f vp90-2-03-size-226x224-226x224-0008.i420 +a47f14a80a529f79f97accbe23188046 vp90-2-03-size-226x224-226x224-0009.i420 +3613bcd41ff13006fbba3bd0087c44f4 vp90-2-03-size-226x224-226x224-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-226x226.webm.md5 b/testdata/libvpx/vp90-2-03-size-226x226.webm.md5 new file mode 100644 index 0000000..24f20a6 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-226x226.webm.md5 @@ -0,0 +1,10 @@ +f2370fc802dafdf5082beffc1907a9c6 vp90-2-03-size-226x226-226x226-0001.i420 +aad6de7b986234a1d621935b272501c9 vp90-2-03-size-226x226-226x226-0002.i420 +8a6d3784e22e3b4f735e78916fbc3821 vp90-2-03-size-226x226-226x226-0003.i420 +0c4afce19c43fdf3bb1b972810cc9126 vp90-2-03-size-226x226-226x226-0004.i420 +814a68dd76a3135221131988910f51ba vp90-2-03-size-226x226-226x226-0005.i420 +b2379c4b28dca10e67ac58631f9731c0 vp90-2-03-size-226x226-226x226-0006.i420 +b16fd651884340a428cea3fe0ac18ba6 vp90-2-03-size-226x226-226x226-0007.i420 +cb65cd4c421cfd6a19fb123ec27abbe6 vp90-2-03-size-226x226-226x226-0008.i420 +7f1d2686b9808de8ecc723b18136d57d vp90-2-03-size-226x226-226x226-0009.i420 +da7fd4bff4b6db0221c42492876c5c4d vp90-2-03-size-226x226-226x226-0010.i420 diff --git a/testdata/libvpx/vp90-2-03-size-352x288.webm.md5 b/testdata/libvpx/vp90-2-03-size-352x288.webm.md5 new file mode 100644 index 0000000..72216c5 --- /dev/null +++ b/testdata/libvpx/vp90-2-03-size-352x288.webm.md5 @@ -0,0 +1,2 @@ +20dda6231f9801c9c237c6d09d9939b6 vp90-2-03-size-352x288-352x288-0001.i420 +23c91e93807fb9a4ed5bd5bdd449d99f vp90-2-03-size-352x288-352x288-0002.i420 diff --git a/testdata/libvpx/vp90-2-05-resize.ivf.md5 b/testdata/libvpx/vp90-2-05-resize.ivf.md5 new file mode 100644 index 0000000..59eb8c2 --- /dev/null +++ b/testdata/libvpx/vp90-2-05-resize.ivf.md5 @@ -0,0 +1,10 @@ +539e9964364c1db09ad18f2e01713799 vp90-2-05-resize.ivf-352x288-0001.i420 +fb76e673ba2a5342bfed8a1523e0a425 vp90-2-05-resize.ivf-352x288-0002.i420 +b0e6881ac6c1e0d839f80f292cb1afd4 vp90-2-05-resize.ivf-352x288-0003.i420 +f0dbe138413e55c3ee9aa94717fc9f2a vp90-2-05-resize.ivf-282x173-0004.i420 +ff1ff9a16be47910e17f5d0aa857e6d1 vp90-2-05-resize.ivf-282x173-0005.i420 +79ccc2a656c80c8d4f2bc3c154ebc408 vp90-2-05-resize.ivf-282x173-0006.i420 +2c6f7b8c72a0103cd1fa37270f6d9962 vp90-2-05-resize.ivf-352x288-0007.i420 +9f837ba58bf07d1e1a8b6a30a9a588e8 vp90-2-05-resize.ivf-352x288-0008.i420 +81ecfd1810b25395af999e557ed4b938 vp90-2-05-resize.ivf-352x288-0009.i420 +cee53e71d6347333fd76d421ece1740f vp90-2-05-resize.ivf-352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-06-bilinear.webm.md5 b/testdata/libvpx/vp90-2-06-bilinear.webm.md5 new file mode 100644 index 0000000..25231b9 --- /dev/null +++ b/testdata/libvpx/vp90-2-06-bilinear.webm.md5 @@ -0,0 +1,10 @@ +818a5af531c921ae58dfedc75234f3c5 -352x288-0001.i420 +f863f8c68b5c87c721d345c5a894336d -352x288-0002.i420 +3f1213e44db416530bc0717f0a795b5d -352x288-0003.i420 +4b99c16a62c3d6687c78236fa13e1f41 -352x288-0004.i420 +80f23a3f04215dd7542128e7c53d68d0 -352x288-0005.i420 +b40b7aa34a77fe773d82d75b5bdd9c13 -352x288-0006.i420 +dd4af6263d20bbaf9afedb6695c1ba67 -352x288-0007.i420 +1f2ccf88f15c10e3c27b2368dacc3727 -352x288-0008.i420 +232b027c4e9b598f50d078bb7b7a165e -352x288-0009.i420 +2b44367332aa0fe42362d61f18e7f8dd -352x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-07-frame_parallel.webm.md5 b/testdata/libvpx/vp90-2-07-frame_parallel.webm.md5 new file mode 100644 index 0000000..7e598ae --- /dev/null +++ b/testdata/libvpx/vp90-2-07-frame_parallel.webm.md5 @@ -0,0 +1,10 @@ +4480e19849cb7b042355a42011fa2d89 vp90-2-07-frame_parallel-352x240-0001.i420 +1d48490e61c0109b301938facb648987 vp90-2-07-frame_parallel-352x240-0002.i420 +9c9140e23a56114ea3cc9bae01c6f2be vp90-2-07-frame_parallel-352x240-0003.i420 +cbdd934532bd9c9c27079d17e570e4af vp90-2-07-frame_parallel-352x240-0004.i420 +db86f11f02c0936371f59a292e32976d vp90-2-07-frame_parallel-352x240-0005.i420 +6fc5f675eb7e1ccdfa5230208dcbc608 vp90-2-07-frame_parallel-352x240-0006.i420 +39fcd15c8cf524a9acce7a66982acec5 vp90-2-07-frame_parallel-352x240-0007.i420 +8c24475c41ec9d5aaa7954f997da12c4 vp90-2-07-frame_parallel-352x240-0008.i420 +5b9747332e303f62b73d4cd2728ac93c vp90-2-07-frame_parallel-352x240-0009.i420 +706f3fc0042b9e6e8b91318ecd55fce8 vp90-2-07-frame_parallel-352x240-0010.i420 diff --git a/testdata/libvpx/vp90-2-08-tile-4x1.webm.md5 b/testdata/libvpx/vp90-2-08-tile-4x1.webm.md5 new file mode 100644 index 0000000..85d3f2a --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile-4x1.webm.md5 @@ -0,0 +1,5 @@ +82fe82552fc693418e68f7757c67bbcb vp90-2-08-tile-4x1-1920x1080-0001.i420 +28db6328c54d2dbe7e9efae5ca58cec8 vp90-2-08-tile-4x1-1920x1080-0002.i420 +72f6459dd217ddd05f42cd9e8d6f689f vp90-2-08-tile-4x1-1920x1080-0003.i420 +12eeebc1533f812d01df0e2b2b8cf0f3 vp90-2-08-tile-4x1-1920x1080-0004.i420 +7ddc1f11bb28f6ad235832e6a1bb88dd vp90-2-08-tile-4x1-1920x1080-0005.i420 diff --git a/testdata/libvpx/vp90-2-08-tile-4x4.webm.md5 b/testdata/libvpx/vp90-2-08-tile-4x4.webm.md5 new file mode 100644 index 0000000..5bb175c --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile-4x4.webm.md5 @@ -0,0 +1,5 @@ +a3b9b715a7e2aed15430faabb3c8b7b3 vp90-2-08-tile-4x4-1920x1080-0001.i420 +85fa2105aa554e680056d1a413ac9673 vp90-2-08-tile-4x4-1920x1080-0002.i420 +4abb371be22d7914bb62b30d901c30ce vp90-2-08-tile-4x4-1920x1080-0003.i420 +83c2528204ae3fd4d4cc8fc67b641d3a vp90-2-08-tile-4x4-1920x1080-0004.i420 +86fcc862b8c8d64690ba3c4a6bff9f74 vp90-2-08-tile-4x4-1920x1080-0005.i420 diff --git a/testdata/libvpx/vp90-2-08-tile_1x2.webm.md5 b/testdata/libvpx/vp90-2-08-tile_1x2.webm.md5 new file mode 100644 index 0000000..f979f7f --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile_1x2.webm.md5 @@ -0,0 +1,10 @@ +124dcaf4393bbc676cefc1dcfc1474b9 /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0001.i420 +5f3357dc102c9db11e7b68d277f31f99 /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0002.i420 +a5fb34b4a52fbc7b8290bffe988ffb01 /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0003.i420 +1405fa1086ac63d4f5e8ed1ca0ad192a /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0004.i420 +0ead62c1d7c7c44f316e601d8fea16ba /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0005.i420 +204e05b399becce6e936bb3ac739fbe3 /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0006.i420 +a27c70e46f6b2c40d6d0a13befede3ac /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0007.i420 +71434072992ec693ae809086760cad22 /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0008.i420 +790a525234048c0645cc81f6a042c9c3 /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0009.i420 +751b37a7b9401a5ca30dc2673070f881 /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0010.i420 diff --git a/testdata/libvpx/vp90-2-08-tile_1x2_frame_parallel.webm.md5 b/testdata/libvpx/vp90-2-08-tile_1x2_frame_parallel.webm.md5 new file mode 100644 index 0000000..7e6b4f2 --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile_1x2_frame_parallel.webm.md5 @@ -0,0 +1,10 @@ +124dcaf4393bbc676cefc1dcfc1474b9 /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0001.i420 +02e0c145da3e3c711f13dad6d5d9f2ec /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0002.i420 +bd276b44124d01ea89cb428a3532a87e /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0003.i420 +fc1eb96ba3b93382a8cf3dee39928d85 /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0004.i420 +0b7b92b084684377795f6fcc549f7677 /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0005.i420 +208972b2d34f0a7a6616570d8279c1f1 /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0006.i420 +33f15b325f9367cf1f58e2e25ccc7bed /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0007.i420 +d7f75036195e89dcbcaba566c1d6cad8 /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0008.i420 +bdc3a5b228f0afa3f969d5f99685a501 /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0009.i420 +d436084146d6be84df15f5fb94067d53 /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0010.i420 diff --git a/testdata/libvpx/vp90-2-08-tile_1x4.webm.md5 b/testdata/libvpx/vp90-2-08-tile_1x4.webm.md5 new file mode 100644 index 0000000..23297f5 --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile_1x4.webm.md5 @@ -0,0 +1,10 @@ +c8a7f0299fb945318bbb6fd531885339 /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0001.i420 +22dde3e7feb2177aa350db7331e8fa8f /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0002.i420 +ba644eea2bd5cded05a7b82224a02d30 /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0003.i420 +0611f83948b22eb4bd5973fa0485dcda /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0004.i420 +a8eea6193af51dbd06d953165b3de261 /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0005.i420 +1e76d8ec66941c9185e0747307a1496c /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0006.i420 +d8404c3e80c2773173e362ff622b6f3c /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0007.i420 +beed5600864a9b961c983d7a7a670bc1 /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0008.i420 +9efbe9228f6a437fe450215f711ea429 /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0009.i420 +1b65f47a5c11c5b763123d337482bd92 /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0010.i420 diff --git a/testdata/libvpx/vp90-2-08-tile_1x4_frame_parallel.webm.md5 b/testdata/libvpx/vp90-2-08-tile_1x4_frame_parallel.webm.md5 new file mode 100644 index 0000000..0541f98 --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile_1x4_frame_parallel.webm.md5 @@ -0,0 +1,10 @@ +c8a7f0299fb945318bbb6fd531885339 /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0001.i420 +88001dece48c52b0f34afc9137915c9e /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0002.i420 +71c3bc238c76f1e3a81bc70aa7dcacfc /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0003.i420 +32726efd04e67dc09c055481f0189c76 /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0004.i420 +7c8fa7372885d16b73f79cbddfd7d45c /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0005.i420 +0d9a3324f574bccd9903ee040eee1787 /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0006.i420 +630fb9507a52803b50ea959a36ff60b8 /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0007.i420 +d5d7b249db773ec3c5b49567aff761e9 /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0008.i420 +b480f582b52d291aeffb97e6d572731b /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0009.i420 +be72a4c2f29317441344cc4d73b24333 /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0010.i420 diff --git a/testdata/libvpx/vp90-2-08-tile_1x8.webm.md5 b/testdata/libvpx/vp90-2-08-tile_1x8.webm.md5 new file mode 100644 index 0000000..a13a4d7 --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile_1x8.webm.md5 @@ -0,0 +1,10 @@ +f91ceda125d592a3f9537d02df06c4f3 /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0001.i420 +a911be78a743ed0f21463bfb82efbd44 /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0002.i420 +85d7cddba48b9e26b089da7f40fd4c71 /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0003.i420 +39241fe3e171fafbc95966c03042699d /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0004.i420 +7b8500c53fce2702d204b6fc888f33fb /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0005.i420 +8197c61dcecdbd975fe54771f34c5df2 /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0006.i420 +f28ebf18412521df51b9d6a3ffd44f4b /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0007.i420 +0d576800a02952e825f1721fc13ac695 /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0008.i420 +0eb34a14d7a89ee4c951759a35673b13 /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0009.i420 +11fb21038d63e3b431f92e0a4152c2f4 /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0010.i420 diff --git a/testdata/libvpx/vp90-2-08-tile_1x8_frame_parallel.webm.md5 b/testdata/libvpx/vp90-2-08-tile_1x8_frame_parallel.webm.md5 new file mode 100644 index 0000000..f36f297 --- /dev/null +++ b/testdata/libvpx/vp90-2-08-tile_1x8_frame_parallel.webm.md5 @@ -0,0 +1,10 @@ +f91ceda125d592a3f9537d02df06c4f3 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0001.i420 +563dae097075cd4002b16ffb2be42cf2 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0002.i420 +1f035d79632516b58c56813c113e0f23 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0003.i420 +0db334dafa73ec37699a96e21bf065d0 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0004.i420 +445a1d62a17f7362c1a14179bededcab /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0005.i420 +4c80d03262518f957c54afd6e02d3610 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0006.i420 +bc6be97c7e509af0903509a260f5ccb6 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0007.i420 +27a679a8bbf2eef3eb1dc6cb221ec467 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0008.i420 +eb3b064727f265bd29407f334a51c1ab /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0009.i420 +3e0caeeef59797f9ec278e190170c285 /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0010.i420 diff --git a/testdata/libvpx/vp90-2-09-aq2.webm.md5 b/testdata/libvpx/vp90-2-09-aq2.webm.md5 new file mode 100644 index 0000000..57ce2c8 --- /dev/null +++ b/testdata/libvpx/vp90-2-09-aq2.webm.md5 @@ -0,0 +1,100 @@ +7fd2573f979a4c0fcc74c6ed37599738 vp90-2-09-aq2-352x240-0001.i420 +c2fba96de0561d78d96425813bdf0da0 vp90-2-09-aq2-352x240-0002.i420 +108b4bfeae261da9758675bce8b4645f vp90-2-09-aq2-352x240-0003.i420 +43b6e3bb1c3f6d15033f16fbd4355265 vp90-2-09-aq2-352x240-0004.i420 +e5a63b53ba5c19370c6f5fdb812014b5 vp90-2-09-aq2-352x240-0005.i420 +de4aa11cfd57d3fa11c8e29faec64bea vp90-2-09-aq2-352x240-0006.i420 +b70e555bc41eafa68db19d81780fe7b9 vp90-2-09-aq2-352x240-0007.i420 +8a49e3307faef41ecfecfdaa29f48d1f vp90-2-09-aq2-352x240-0008.i420 +ed01509dcb01ba6644137e7f0f588f13 vp90-2-09-aq2-352x240-0009.i420 +15630dcfe0ec0f27abace3e2ac80d47a vp90-2-09-aq2-352x240-0010.i420 +2f023d334f0d0d7ea7724ddd075b41a3 vp90-2-09-aq2-352x240-0011.i420 +3fd72535813e4943d1e4b19f7e554b00 vp90-2-09-aq2-352x240-0012.i420 +360db62794959e018a04c3650e832d60 vp90-2-09-aq2-352x240-0013.i420 +33638c46202958cabd78356f18101b88 vp90-2-09-aq2-352x240-0014.i420 +d8a3d7541654307f3b500cb6399fccd1 vp90-2-09-aq2-352x240-0015.i420 +cd2a41d7d0f21c02919ffb87b9510b55 vp90-2-09-aq2-352x240-0016.i420 +54b8f6b3d7e2edb67db7c3aa7f5a973b vp90-2-09-aq2-352x240-0017.i420 +ddabc76c8b2af158e5feed0f48106429 vp90-2-09-aq2-352x240-0018.i420 +b22c40581501676d588a77b502cb5e48 vp90-2-09-aq2-352x240-0019.i420 +e25c4976462fe37b0119e719e7a9a65b vp90-2-09-aq2-352x240-0020.i420 +1fcf289ba81a469926b63e9fa70fc184 vp90-2-09-aq2-352x240-0021.i420 +6a7392c22ffac7c6a4bfe7012e8dfa29 vp90-2-09-aq2-352x240-0022.i420 +9b74dc670c67073a582b3c8d390caaf5 vp90-2-09-aq2-352x240-0023.i420 +23b18dc9b7eb27b55e0068c1d75de8ad vp90-2-09-aq2-352x240-0024.i420 +0a94a263b90e08e88909deafd5c42b7c vp90-2-09-aq2-352x240-0025.i420 +9b940506b41816d2030f7a2089d83ea3 vp90-2-09-aq2-352x240-0026.i420 +da88cae2ec9324ad19365871ec893d45 vp90-2-09-aq2-352x240-0027.i420 +323cf97cddde5a9cea5f338b7ab17860 vp90-2-09-aq2-352x240-0028.i420 +455506b023df603e494bcc36ffcce179 vp90-2-09-aq2-352x240-0029.i420 +7dc8cf924ca17b6f19c7ed5e7d584835 vp90-2-09-aq2-352x240-0030.i420 +88e4c47e343182051fef005676fc3112 vp90-2-09-aq2-352x240-0031.i420 +e4891dfcc239d80f3240b85fe48f3957 vp90-2-09-aq2-352x240-0032.i420 +e559abcb6717ca8b211159010beebef8 vp90-2-09-aq2-352x240-0033.i420 +3b96d340f65e415d40d60bf6a3bedefc vp90-2-09-aq2-352x240-0034.i420 +51131241975195394fb3eaa13ca1b43f vp90-2-09-aq2-352x240-0035.i420 +ceefc4774251000943f2d58c68f2b3d3 vp90-2-09-aq2-352x240-0036.i420 +76524ef8a7f1ab5199124e8bff7bc559 vp90-2-09-aq2-352x240-0037.i420 +906cf4fc07aacb1f0a3ceaf7eeda2e74 vp90-2-09-aq2-352x240-0038.i420 +c7ad9d7bc30af316285b962b9eda4c9a vp90-2-09-aq2-352x240-0039.i420 +424a7133c0bb45a2601733a39f8d70fa vp90-2-09-aq2-352x240-0040.i420 +e76eac1e8e9529609ad1bf3e4c44e4d0 vp90-2-09-aq2-352x240-0041.i420 +e238dcef853fed9f7322cb1d73dceef5 vp90-2-09-aq2-352x240-0042.i420 +a0f2d7cd7f628fca6992ccb2ca418133 vp90-2-09-aq2-352x240-0043.i420 +4d07e59c0935554b624409bd904264ef vp90-2-09-aq2-352x240-0044.i420 +d0944fdf52b02c4ff8fd7fcb944ae00c vp90-2-09-aq2-352x240-0045.i420 +f719c346201b393262d4764bc989c4fd vp90-2-09-aq2-352x240-0046.i420 +951d18cb2791c55ebed8321dba537eb9 vp90-2-09-aq2-352x240-0047.i420 +f764f5aaac4f19b131377e16d034de9a vp90-2-09-aq2-352x240-0048.i420 +871f7a2201dd951ba541625219a8f000 vp90-2-09-aq2-352x240-0049.i420 +05e9bf3f38aacd65a796400247c8d149 vp90-2-09-aq2-352x240-0050.i420 +7bdc6fc1fe6a1e24cb952e10ed19ab68 vp90-2-09-aq2-352x240-0051.i420 +a92e8a9e7ba4d24adcf63ab897057e68 vp90-2-09-aq2-352x240-0052.i420 +7ec84b978b27052954fac85142582c2c vp90-2-09-aq2-352x240-0053.i420 +10153d3889093a27aa2aa7a4380d6372 vp90-2-09-aq2-352x240-0054.i420 +1313e1ab4c7c6c01b3b25ff7fc84da9f vp90-2-09-aq2-352x240-0055.i420 +810d9122895dcb90fae58be03af9980b vp90-2-09-aq2-352x240-0056.i420 +f77fb637d12d958099d534f4a1689eb7 vp90-2-09-aq2-352x240-0057.i420 +3570f0094d3f06efa648ff4d9db2a25d vp90-2-09-aq2-352x240-0058.i420 +8f22721b7e56e04d41d2af7cbf2ca349 vp90-2-09-aq2-352x240-0059.i420 +fee5d638fa94a6d1a2fa1dfc86a3f131 vp90-2-09-aq2-352x240-0060.i420 +c9e2f58d5f3f8c3ad527e9bd53e12372 vp90-2-09-aq2-352x240-0061.i420 +6507534d0c9fbd22c76f1f7753f000ce vp90-2-09-aq2-352x240-0062.i420 +cd944cf2a7dbd30ab4fc4b99f4041379 vp90-2-09-aq2-352x240-0063.i420 +15bbc0674190eeb1112a27746dce3726 vp90-2-09-aq2-352x240-0064.i420 +7270c42f643a9f27095dade9f1b6b62e vp90-2-09-aq2-352x240-0065.i420 +7f47919091ccd7072a2068904f582679 vp90-2-09-aq2-352x240-0066.i420 +1e3c77d769a978bf9dc9188c0f1ed105 vp90-2-09-aq2-352x240-0067.i420 +4a4613749f272b7a04e6ead37844f73c vp90-2-09-aq2-352x240-0068.i420 +8967e0f52af43110004dce3f78c8fc75 vp90-2-09-aq2-352x240-0069.i420 +e3b979ec8ed4e389abaeea149b86b407 vp90-2-09-aq2-352x240-0070.i420 +fd3c72c5249c214a85e0957279090781 vp90-2-09-aq2-352x240-0071.i420 +7fe861180df75e21f4b8937ae506d601 vp90-2-09-aq2-352x240-0072.i420 +8804a39483b5a8d7ae03003ee8b3152a vp90-2-09-aq2-352x240-0073.i420 +30a1b0bd147277f8fc50de11c2c8dc93 vp90-2-09-aq2-352x240-0074.i420 +7cb788efedd325f45bd4785f89432115 vp90-2-09-aq2-352x240-0075.i420 +a162c8ab7fa0dafdc3313a69bc7f1e38 vp90-2-09-aq2-352x240-0076.i420 +83905de481bd1cafa16cd96698337c25 vp90-2-09-aq2-352x240-0077.i420 +3d75f99043ea4bf2364844474e180079 vp90-2-09-aq2-352x240-0078.i420 +89975274a8a72af7d2cdee9fbe907852 vp90-2-09-aq2-352x240-0079.i420 +e05c9a7af0ea61d4ef4476de4d7c97cd vp90-2-09-aq2-352x240-0080.i420 +dfc99210a942a7427033cce9b596e0fa vp90-2-09-aq2-352x240-0081.i420 +544361eecb8c3b45feb1dbef5c0a39a2 vp90-2-09-aq2-352x240-0082.i420 +7aaae6bbf8af4f7f6556f2285a9d9476 vp90-2-09-aq2-352x240-0083.i420 +485716ddd13576464d1ca47b4859cc22 vp90-2-09-aq2-352x240-0084.i420 +00194b66bafdb6a252852bd087200c6b vp90-2-09-aq2-352x240-0085.i420 +d21b316ba1006c2381d78e5b7652b12a vp90-2-09-aq2-352x240-0086.i420 +56506d53dc2333ccddcedb449977ce57 vp90-2-09-aq2-352x240-0087.i420 +0c6787858208959270dde59e38c544ca vp90-2-09-aq2-352x240-0088.i420 +913b906f645964f57913db70e21aa6d8 vp90-2-09-aq2-352x240-0089.i420 +f9c5d447dd4c060d3610d22b6ff8f1d7 vp90-2-09-aq2-352x240-0090.i420 +ece0a0110c14dccde0ea4d0484b60d38 vp90-2-09-aq2-352x240-0091.i420 +fbcb7e878673c8287a1ed57a6feef818 vp90-2-09-aq2-352x240-0092.i420 +be5aed5dd5538c3ad8c9d88fb4a4207f vp90-2-09-aq2-352x240-0093.i420 +4c668204dd2c45d039bf7c5f44203803 vp90-2-09-aq2-352x240-0094.i420 +06f9b1207289ed7fbf03c4be3f0349f5 vp90-2-09-aq2-352x240-0095.i420 +26275672bc752789d0a175ca48344643 vp90-2-09-aq2-352x240-0096.i420 +1b56fde58558ec9ae00f24815c13f672 vp90-2-09-aq2-352x240-0097.i420 +ff65dec4cab5d10ea34321f34d369b5e vp90-2-09-aq2-352x240-0098.i420 +3d419dded34673cf487b39106af08da6 vp90-2-09-aq2-352x240-0099.i420 +ab8a99b2a88bab0238e5d3d3204098e0 vp90-2-09-aq2-352x240-0100.i420 diff --git a/testdata/libvpx/vp90-2-09-lf_deltas.webm.md5 b/testdata/libvpx/vp90-2-09-lf_deltas.webm.md5 new file mode 100644 index 0000000..b212aaa --- /dev/null +++ b/testdata/libvpx/vp90-2-09-lf_deltas.webm.md5 @@ -0,0 +1,30 @@ +a83c7f4602f595fd09e97f8c8a7277ec vp90-2-09-lf_deltas-352x240-0001.i420 +53e1a3fd44932883a8dd112bbb0e359f vp90-2-09-lf_deltas-352x240-0002.i420 +4bb16d168f9f0a7702c31a68bb8ff36c vp90-2-09-lf_deltas-352x240-0003.i420 +1b2df157913aba96553aaf8d51491bf3 vp90-2-09-lf_deltas-352x240-0004.i420 +9d041532e42fca7a4062cd3e9b75413b vp90-2-09-lf_deltas-352x240-0005.i420 +0dbac5ca06e13714d10e99042aefe375 vp90-2-09-lf_deltas-352x240-0006.i420 +bb83a507a65d2a640b08f42a77bb37f6 vp90-2-09-lf_deltas-352x240-0007.i420 +176f992d37c7daa36135cddb49398de3 vp90-2-09-lf_deltas-352x240-0008.i420 +c41834f72b3281cf6aaa66fd7416e6c3 vp90-2-09-lf_deltas-352x240-0009.i420 +790d4e6b1609dec782ff978e2003d318 vp90-2-09-lf_deltas-352x240-0010.i420 +449622f741f7577c1d721f2e9eb25091 vp90-2-09-lf_deltas-352x240-0011.i420 +8ef8543f7895c87ab04491b0150628e5 vp90-2-09-lf_deltas-352x240-0012.i420 +88ef626aca4b2bcb8c58a69db20a7b02 vp90-2-09-lf_deltas-352x240-0013.i420 +4b2f7adc2e1872ecdd9ffa7d1f1df4a6 vp90-2-09-lf_deltas-352x240-0014.i420 +7b162660225022ef31e39c34fee3418e vp90-2-09-lf_deltas-352x240-0015.i420 +2b439a4b846edcc69cdf6075de5ac8fb vp90-2-09-lf_deltas-352x240-0016.i420 +ba2eb1ba0ed9abf701a53a94c9c626fc vp90-2-09-lf_deltas-352x240-0017.i420 +9fbec5d5334fd5e917feee756b652d93 vp90-2-09-lf_deltas-352x240-0018.i420 +93b5eb99ea54abc5fa90c5674499e27e vp90-2-09-lf_deltas-352x240-0019.i420 +04a98408e9b0aed28932ef1dfdcfdb6c vp90-2-09-lf_deltas-352x240-0020.i420 +9856ba976bed30bc790a3f28e926b092 vp90-2-09-lf_deltas-352x240-0021.i420 +2b0f450e9724cfc57b846148ff876e51 vp90-2-09-lf_deltas-352x240-0022.i420 +163757f3529369b9789ea606387b831d vp90-2-09-lf_deltas-352x240-0023.i420 +de5ed2aff936c54f3378d0dcc2575d13 vp90-2-09-lf_deltas-352x240-0024.i420 +1f642826b8a6fb111c7c6130481dab89 vp90-2-09-lf_deltas-352x240-0025.i420 +b8e3a77c7d3c5c56f67aa7409fb5404c vp90-2-09-lf_deltas-352x240-0026.i420 +eb06cb4f471e42d7fc06929a442cca8b vp90-2-09-lf_deltas-352x240-0027.i420 +53471649a5080b306d2c04a4f7673bdf vp90-2-09-lf_deltas-352x240-0028.i420 +70996be0cc5d2bd97025015dd50caa99 vp90-2-09-lf_deltas-352x240-0029.i420 +ff3280a8562fdf6697c4a7cb9c1bf0a0 vp90-2-09-lf_deltas-352x240-0030.i420 diff --git a/testdata/libvpx/vp90-2-09-subpixel-00.ivf.md5 b/testdata/libvpx/vp90-2-09-subpixel-00.ivf.md5 new file mode 100644 index 0000000..1144632 --- /dev/null +++ b/testdata/libvpx/vp90-2-09-subpixel-00.ivf.md5 @@ -0,0 +1,20 @@ +50233551e96b74ebfdaabbc8a154303c vp90-hantro-stream-001-320x180-0001.i420 +047109ae2e488be8ee953dca4f09a0e2 vp90-hantro-stream-001-320x180-0002.i420 +5e2ba01240e39566a607f10f0d7eaed3 vp90-hantro-stream-001-320x180-0003.i420 +01f1c635ce56efcc13def2ac3bcccc3f vp90-hantro-stream-001-320x180-0004.i420 +6e800d75da797409eb2f5b458027b05d vp90-hantro-stream-001-320x180-0005.i420 +a88b9c2cfad5367d934fd067c2c6452d vp90-hantro-stream-001-320x180-0006.i420 +a898a33e443dba4c2d61c27caa0fb068 vp90-hantro-stream-001-320x180-0007.i420 +321f16df155169f1fbd117a258b065ed vp90-hantro-stream-001-320x180-0008.i420 +a71b4df17c37e423a2a6129be8058c66 vp90-hantro-stream-001-320x180-0009.i420 +b168dad8dd0be2e945ada495320e1ec3 vp90-hantro-stream-001-320x180-0010.i420 +4b4e227f6558b9a0e80bbeaebdc50b63 vp90-hantro-stream-001-320x180-0011.i420 +929ad97d05c62b56d908378beeedb68e vp90-hantro-stream-001-320x180-0012.i420 +f952dc4b2a6e6cdcb0740e67eec87c96 vp90-hantro-stream-001-320x180-0013.i420 +f42500b60e2bbfee44b7e5b4068d9061 vp90-hantro-stream-001-320x180-0014.i420 +802f7975005cc8d77a3801b72ee08ca1 vp90-hantro-stream-001-320x180-0015.i420 +e685e147c9400dd6742c749dc1e18fd6 vp90-hantro-stream-001-320x180-0016.i420 +4080f9db1e9a98478af9c0575a7f31fc vp90-hantro-stream-001-320x180-0017.i420 +70fcce378d2bade12d2dab44b3fbd4b6 vp90-hantro-stream-001-320x180-0018.i420 +81e539130d2dbb2eb69fe63eb1bb9cbb vp90-hantro-stream-001-320x180-0019.i420 +2952c0eae93f3dadd1aa84c50d3fd6d2 vp90-hantro-stream-001-320x180-0020.i420 diff --git a/testdata/libvpx/vp90-2-10-show-existing-frame.webm.md5 b/testdata/libvpx/vp90-2-10-show-existing-frame.webm.md5 new file mode 100644 index 0000000..85d421d --- /dev/null +++ b/testdata/libvpx/vp90-2-10-show-existing-frame.webm.md5 @@ -0,0 +1,13 @@ +18981342ec178e082519451062c3a67f vp90-2-10-show-existing-frame-352x288-0001.i420 +04ab9dbeac49ec31be58f6e671698e05 vp90-2-10-show-existing-frame-352x288-0002.i420 +4ed58a0ba93a5d97a232a50c5876cda2 vp90-2-10-show-existing-frame-352x288-0003.i420 +a41f00034923e56ba51a0b598acc2e3a vp90-2-10-show-existing-frame-352x288-0004.i420 +63fa55ae9535ccdf06d44cce8065dda6 vp90-2-10-show-existing-frame-352x288-0005.i420 +a41f00034923e56ba51a0b598acc2e3a vp90-2-10-show-existing-frame-352x288-0006.i420 +0e4b08e14d919edee2bbff2ecd47de57 vp90-2-10-show-existing-frame-352x288-0007.i420 +0e4b08e14d919edee2bbff2ecd47de57 vp90-2-10-show-existing-frame-352x288-0008.i420 +5d4af03fc3d410413ef2b5a6275528b7 vp90-2-10-show-existing-frame-352x288-0009.i420 +9e932915c67a789f6877e6d3f76d3649 vp90-2-10-show-existing-frame-352x288-0010.i420 +12f2e975c217e7ffcf334524e8acec35 vp90-2-10-show-existing-frame-352x288-0011.i420 +9e932915c67a789f6877e6d3f76d3649 vp90-2-10-show-existing-frame-352x288-0012.i420 +12f2e975c217e7ffcf334524e8acec35 vp90-2-10-show-existing-frame-352x288-0013.i420 diff --git a/testdata/libvpx/vp90-2-10-show-existing-frame2.webm.md5 b/testdata/libvpx/vp90-2-10-show-existing-frame2.webm.md5 new file mode 100644 index 0000000..51940b6 --- /dev/null +++ b/testdata/libvpx/vp90-2-10-show-existing-frame2.webm.md5 @@ -0,0 +1,16 @@ +382b12c33cd86b38758706b8ebca8a85 -352x288-0001.i420 +799544370b35c91711a5b49a28cf86a8 -352x288-0002.i420 +7218eb4b6d1c7aea4f96ee47ad675e8e -352x288-0003.i420 +627466200370e6ad60ea570d31be66e3 -352x288-0004.i420 +7dc65a2af108379f2b9265a9a1ea7cf8 -352x288-0005.i420 +c979e2f084760775a567f60f79f28198 -352x288-0006.i420 +fe668a6417aa0543e4ed4d1c67c5cbcb -352x288-0007.i420 +bf9901e39815fa93cce0ed5b02b2ef2d -352x288-0008.i420 +627466200370e6ad60ea570d31be66e3 -352x288-0009.i420 +7dc65a2af108379f2b9265a9a1ea7cf8 -352x288-0010.i420 +c979e2f084760775a567f60f79f28198 -352x288-0011.i420 +fe668a6417aa0543e4ed4d1c67c5cbcb -352x288-0012.i420 +bf9901e39815fa93cce0ed5b02b2ef2d -352x288-0013.i420 +627466200370e6ad60ea570d31be66e3 -352x288-0014.i420 +7dc65a2af108379f2b9265a9a1ea7cf8 -352x288-0015.i420 +c979e2f084760775a567f60f79f28198 -352x288-0016.i420 diff --git a/testdata/libvpx/vp90-2-11-size-351x287.webm.md5 b/testdata/libvpx/vp90-2-11-size-351x287.webm.md5 new file mode 100644 index 0000000..cf199ef --- /dev/null +++ b/testdata/libvpx/vp90-2-11-size-351x287.webm.md5 @@ -0,0 +1,10 @@ +f82842800bee8e31ab7c9abe960412ce vp90-2-02-size-351x287-351x287-0001.i420 +5448dc1a6662fcd6b2acf1440a76bb1d vp90-2-02-size-351x287-351x287-0002.i420 +ac2c9263c142ef66d024e6be793581ef vp90-2-02-size-351x287-351x287-0003.i420 +95c3a7d0b2efe962aabcfb873bb6cbd5 vp90-2-02-size-351x287-351x287-0004.i420 +91997eadcb32e03bb693e08b3730a689 vp90-2-02-size-351x287-351x287-0005.i420 +edc112b7a057a76e19866ed0f99f5ac2 vp90-2-02-size-351x287-351x287-0006.i420 +584e083ec1e75a3f38d088a485afd589 vp90-2-02-size-351x287-351x287-0007.i420 +250f730b029c5fc5ee08633cce9c6a19 vp90-2-02-size-351x287-351x287-0008.i420 +9fac7e9a1c0700c58b7b6663b9729f50 vp90-2-02-size-351x287-351x287-0009.i420 +868409da3b0b39f3f3297b96c6ce7689 vp90-2-02-size-351x287-351x287-0010.i420 diff --git a/testdata/libvpx/vp90-2-11-size-351x288.webm.md5 b/testdata/libvpx/vp90-2-11-size-351x288.webm.md5 new file mode 100644 index 0000000..f2db901 --- /dev/null +++ b/testdata/libvpx/vp90-2-11-size-351x288.webm.md5 @@ -0,0 +1,10 @@ +4ea0e40bfc56cecda80239edbc7939af vp90-2-02-size-351x288-351x288-0001.i420 +c3199803f9a42e7e1164c8becaa1a2da vp90-2-02-size-351x288-351x288-0002.i420 +a5702891d0ee83801672d080c4eba4f3 vp90-2-02-size-351x288-351x288-0003.i420 +f8ca4458878e722b4e56a486016ffaed vp90-2-02-size-351x288-351x288-0004.i420 +1cdfa41dfe27fe6ae0e448736ea29174 vp90-2-02-size-351x288-351x288-0005.i420 +47468a7c28900472bb64847ed5df779d vp90-2-02-size-351x288-351x288-0006.i420 +7f69d0a62099b4ea58442599eee671f8 vp90-2-02-size-351x288-351x288-0007.i420 +78ea797f879fe881d9e958f86eec5fa4 vp90-2-02-size-351x288-351x288-0008.i420 +f3dd31f8ef54a7ef34148e30e6c93345 vp90-2-02-size-351x288-351x288-0009.i420 +c53dae8abad5f441c47cb7cc64f6f6cd vp90-2-02-size-351x288-351x288-0010.i420 diff --git a/testdata/libvpx/vp90-2-11-size-352x287.webm.md5 b/testdata/libvpx/vp90-2-11-size-352x287.webm.md5 new file mode 100644 index 0000000..6b91c5b --- /dev/null +++ b/testdata/libvpx/vp90-2-11-size-352x287.webm.md5 @@ -0,0 +1,10 @@ +f93e10c9d06d66da470a575ba25d2f26 vp90-2-02-size-352x287-352x287-0001.i420 +8d2a8828410ddc10bca9732c9825efac vp90-2-02-size-352x287-352x287-0002.i420 +6c592c67923592d117dd82a9689155f3 vp90-2-02-size-352x287-352x287-0003.i420 +e481963df56d53c1bf1621100540b657 vp90-2-02-size-352x287-352x287-0004.i420 +e0896c55fa2e70898e11bd547934c785 vp90-2-02-size-352x287-352x287-0005.i420 +9891427ebdc554488eb8d55f67b304cc vp90-2-02-size-352x287-352x287-0006.i420 +3a60422c822d2b2f291042c08c322233 vp90-2-02-size-352x287-352x287-0007.i420 +0d3fae69b75d0b318ac0d06864dcfdd8 vp90-2-02-size-352x287-352x287-0008.i420 +85f8c85b6953ddde0eba488e52d94fc3 vp90-2-02-size-352x287-352x287-0009.i420 +b6c9f06443b77fadcaa64850da404dd9 vp90-2-02-size-352x287-352x287-0010.i420 diff --git a/testdata/libvpx/vp90-2-12-droppable_1.ivf.md5 b/testdata/libvpx/vp90-2-12-droppable_1.ivf.md5 new file mode 100644 index 0000000..7b1abf8 --- /dev/null +++ b/testdata/libvpx/vp90-2-12-droppable_1.ivf.md5 @@ -0,0 +1,99 @@ +1839e5db94dc99681d690d544cbe28a4 vp90-2-12-droppable_1.ivf-352x288-0001.i420 +dae2db51b91745edddb33ddbeb4e0988 vp90-2-12-droppable_1.ivf-352x288-0002.i420 +046639dbef310bf9016a54498a3ef0a3 vp90-2-12-droppable_1.ivf-352x288-0003.i420 +947044a5dbc918e8be468c2bc9eaeeaa vp90-2-12-droppable_1.ivf-352x288-0004.i420 +f96322ba3bf86065829d15c4394a1ab2 vp90-2-12-droppable_1.ivf-352x288-0005.i420 +4dfcf05608b399d56b0b29e3447ac24a vp90-2-12-droppable_1.ivf-352x288-0006.i420 +b772fd5f5e3221d9c1daf690aeca89e8 vp90-2-12-droppable_1.ivf-352x288-0007.i420 +d8838cf1a4316c6c9ba7f42f8cba205c vp90-2-12-droppable_1.ivf-352x288-0008.i420 +368f762830ed3d29d642798ff88107bd vp90-2-12-droppable_1.ivf-352x288-0009.i420 +f3e614a8f67681f814242c75e6ac66f7 vp90-2-12-droppable_1.ivf-352x288-0010.i420 +f49458a915dd853e53c15e52e280085b vp90-2-12-droppable_1.ivf-352x288-0011.i420 +65cbd3f3f8447d3caf935cddfcb6cb15 vp90-2-12-droppable_1.ivf-352x288-0012.i420 +8f4764c45093050a78b4b6055648cda0 vp90-2-12-droppable_1.ivf-352x288-0013.i420 +16d399bff977cdac0543daffba3a14bd vp90-2-12-droppable_1.ivf-352x288-0014.i420 +59f16bc632697d20514a55814cf0a9ae vp90-2-12-droppable_1.ivf-352x288-0015.i420 +058ba53139a3f48883ae4e668177d564 vp90-2-12-droppable_1.ivf-352x288-0016.i420 +85796d9edf6a5fe5d0c804e8b80f4469 vp90-2-12-droppable_1.ivf-352x288-0017.i420 +94b7bf54b3dd8d007cb932c330e4e7cf vp90-2-12-droppable_1.ivf-352x288-0018.i420 +964732ac0abf132fe8c65a845eeaea39 vp90-2-12-droppable_1.ivf-352x288-0019.i420 +dda8408b95868ea683f921e88ca0f8f4 vp90-2-12-droppable_1.ivf-352x288-0020.i420 +33b008d0b3932abd28d1c0d484a89cb0 vp90-2-12-droppable_1.ivf-352x288-0021.i420 +bbf8f8edda10ab20cde304b362f6fc7c vp90-2-12-droppable_1.ivf-352x288-0022.i420 +6a08c9c1d4444f6b706a9193823e4866 vp90-2-12-droppable_1.ivf-352x288-0023.i420 +f3cfb225730f103c76083220b55aaf7e vp90-2-12-droppable_1.ivf-352x288-0024.i420 +aa43de9fd852ffca405f9e1be0c517b9 vp90-2-12-droppable_1.ivf-352x288-0025.i420 +e5bcd2084c06d7e391af0710a3f56f86 vp90-2-12-droppable_1.ivf-352x288-0026.i420 +e16276389746853039a5c1353e3f830e vp90-2-12-droppable_1.ivf-352x288-0027.i420 +8ecf32a7649dd9df718b5a31512aa17b vp90-2-12-droppable_1.ivf-352x288-0028.i420 +db63be2b267a77061f40a48a5ad94129 vp90-2-12-droppable_1.ivf-352x288-0029.i420 +94c6a699e9b5382e1e4a30d462d1b05d vp90-2-12-droppable_1.ivf-352x288-0030.i420 +340102d21a9c8d9119aed97d7bd408ba vp90-2-12-droppable_1.ivf-352x288-0031.i420 +a369b32d71a6daf9a589614cba76d06c vp90-2-12-droppable_1.ivf-352x288-0032.i420 +7c6f24525d07f08cfaaf8b57c1b1e0c7 vp90-2-12-droppable_1.ivf-352x288-0033.i420 +f99b35baf3e4f3967ad08b5475041959 vp90-2-12-droppable_1.ivf-352x288-0034.i420 +b1dede9bbe4a9542d10e7e2dcc225208 vp90-2-12-droppable_1.ivf-352x288-0035.i420 +d627915070dd5e6e11d1dff7b1dc4243 vp90-2-12-droppable_1.ivf-352x288-0036.i420 +2f176951d8716e1ac316f30388be269d vp90-2-12-droppable_1.ivf-352x288-0037.i420 +215828b89c294b2568a575438c75d4e0 vp90-2-12-droppable_1.ivf-352x288-0038.i420 +3a29b4bf698713cbd575e6b14257fc87 vp90-2-12-droppable_1.ivf-352x288-0039.i420 +b930a1eef6838edc9abb769909b87cd9 vp90-2-12-droppable_1.ivf-352x288-0040.i420 +532c260abbd6d1181be3ff7a77f2d350 vp90-2-12-droppable_1.ivf-352x288-0041.i420 +b9ee7c0ab6c7cf8881fe5ed165454638 vp90-2-12-droppable_1.ivf-352x288-0042.i420 +d516f6949c3704ab9f154e3720f5f9ec vp90-2-12-droppable_1.ivf-352x288-0043.i420 +bf05478086e97057856c3c987b220958 vp90-2-12-droppable_1.ivf-352x288-0044.i420 +92202af7ea355a8d4678e618c0344134 vp90-2-12-droppable_1.ivf-352x288-0045.i420 +ca870c59afab60c5da07e688a89be1a9 vp90-2-12-droppable_1.ivf-352x288-0046.i420 +92429a1763b07d2a0bf843a2953fcc1c vp90-2-12-droppable_1.ivf-352x288-0047.i420 +1614a4655799cd08875b1271767ce85e vp90-2-12-droppable_1.ivf-352x288-0048.i420 +2b30362c459109cafcff5f1bb8217e34 vp90-2-12-droppable_1.ivf-352x288-0049.i420 +6568f3dd687762489b7fd2c4a59dd38c vp90-2-12-droppable_1.ivf-352x288-0050.i420 +6121d029cf4e402f9999a6719b3d6d97 vp90-2-12-droppable_1.ivf-352x288-0051.i420 +085cc85c56e35b4a19b48b502d606ffb vp90-2-12-droppable_1.ivf-352x288-0052.i420 +63a7dc5d70bd142cb167c20f645a90bb vp90-2-12-droppable_1.ivf-352x288-0053.i420 +b3ae931ee6f2724304f6a67070a386c0 vp90-2-12-droppable_1.ivf-352x288-0054.i420 +07fcd2b18c1c8a6c46151acff26ce2c0 vp90-2-12-droppable_1.ivf-352x288-0055.i420 +658758a58b92693bafeff41a2424e2a9 vp90-2-12-droppable_1.ivf-352x288-0056.i420 +3619120dfca7b24434ebe8e87936996c vp90-2-12-droppable_1.ivf-352x288-0057.i420 +17152bbf314be8c30837cbece6fb53cd vp90-2-12-droppable_1.ivf-352x288-0058.i420 +bc3352c6948fac5a681bf37abcc9b8b4 vp90-2-12-droppable_1.ivf-352x288-0059.i420 +5a4e0a19a7653a5ad120b1f46f9905b4 vp90-2-12-droppable_1.ivf-352x288-0060.i420 +2632db035652049f5340d1e59d577d42 vp90-2-12-droppable_1.ivf-352x288-0061.i420 +95a28f288602ae1f859a02055103aa39 vp90-2-12-droppable_1.ivf-352x288-0062.i420 +3d01e40359a3cfca996908d331492848 vp90-2-12-droppable_1.ivf-352x288-0063.i420 +4b6243114b09dbf590c1250419327b01 vp90-2-12-droppable_1.ivf-352x288-0064.i420 +f9aae29d9168366933f2bcc57a5afcb8 vp90-2-12-droppable_1.ivf-352x288-0065.i420 +6bca12015a807fdf48cda90cbe042ab4 vp90-2-12-droppable_1.ivf-352x288-0066.i420 +7769b6fa16f8c09973d1a2c08cf18dbb vp90-2-12-droppable_1.ivf-352x288-0067.i420 +3457395b67960b1566007e764b0c0e81 vp90-2-12-droppable_1.ivf-352x288-0068.i420 +0d0ea9bdd5c4b164bbefc31000a28e49 vp90-2-12-droppable_1.ivf-352x288-0069.i420 +9fb6b2afb53b73a658b579beb3008bcd vp90-2-12-droppable_1.ivf-352x288-0070.i420 +c9a941b87dcdd09afaab68cca0ed668a vp90-2-12-droppable_1.ivf-352x288-0071.i420 +9a2baa4c442f3ebdf251e9bbef0dbf83 vp90-2-12-droppable_1.ivf-352x288-0072.i420 +ef90237bc4ed3d795ba78c8a4ef9f1d6 vp90-2-12-droppable_1.ivf-352x288-0073.i420 +68cabdcf5d934e279f1c45207e983d43 vp90-2-12-droppable_1.ivf-352x288-0074.i420 +ac5d93877691c05bb581a10bfcd058e5 vp90-2-12-droppable_1.ivf-352x288-0075.i420 +c4e09feb0a88d765c7681c7d427eda87 vp90-2-12-droppable_1.ivf-352x288-0076.i420 +690734960471ab41d5cdf052be87bd30 vp90-2-12-droppable_1.ivf-352x288-0077.i420 +4abaaa7e31a3a6e30b242e42587363d5 vp90-2-12-droppable_1.ivf-352x288-0078.i420 +b9c46f294e7a23b608004ff8aa2b9ea3 vp90-2-12-droppable_1.ivf-352x288-0079.i420 +b6a6a0e45c30de0f03880f753b6e75de vp90-2-12-droppable_1.ivf-352x288-0080.i420 +c8725906463cb71ed8a64ba8af6a79be vp90-2-12-droppable_1.ivf-352x288-0081.i420 +d0e28c090e859834a33bc0867a0f7ed7 vp90-2-12-droppable_1.ivf-352x288-0082.i420 +1ad8bf201d9898d562631226a2ef85fa vp90-2-12-droppable_1.ivf-352x288-0083.i420 +962fe544b1a76bafe8a1b77cd64679ba vp90-2-12-droppable_1.ivf-352x288-0084.i420 +89f9a77223961cc5ad49a11913ff9774 vp90-2-12-droppable_1.ivf-352x288-0085.i420 +483782bf6d14bbb19c749d58b8535e3e vp90-2-12-droppable_1.ivf-352x288-0086.i420 +dfbe1b7ecc880ce5da758728f7375d63 vp90-2-12-droppable_1.ivf-352x288-0087.i420 +11a51b22418cc8dad57a20b37dd10630 vp90-2-12-droppable_1.ivf-352x288-0088.i420 +50b90506f9666ccb7dd94b6d59096489 vp90-2-12-droppable_1.ivf-352x288-0089.i420 +101294ecaff7edf5155ddc6cf3595021 vp90-2-12-droppable_1.ivf-352x288-0090.i420 +177e8f9d8aaf40b17d0b677133fc7955 vp90-2-12-droppable_1.ivf-352x288-0091.i420 +c029f78e758a27b8fc4214abf5ddad07 vp90-2-12-droppable_1.ivf-352x288-0092.i420 +45b6df0756e3f98218f4e9f0f33b1f13 vp90-2-12-droppable_1.ivf-352x288-0093.i420 +82d1fd8cc9fa0a072a0fc6177e7f8805 vp90-2-12-droppable_1.ivf-352x288-0094.i420 +bf6c3e8df105fdb82a614f8e8f6d68af vp90-2-12-droppable_1.ivf-352x288-0095.i420 +2e66eccd31c0e1792f3019c0a7b43af6 vp90-2-12-droppable_1.ivf-352x288-0096.i420 +d7eab4f351bd3c03e873b93afc9b7803 vp90-2-12-droppable_1.ivf-352x288-0097.i420 +f7bc200d54ec154779521311c54a22d1 vp90-2-12-droppable_1.ivf-352x288-0098.i420 +8e2624d762102b6dbe13b7cf20ee1708 vp90-2-12-droppable_1.ivf-352x288-0099.i420 diff --git a/testdata/libvpx/vp90-2-12-droppable_2.ivf.md5 b/testdata/libvpx/vp90-2-12-droppable_2.ivf.md5 new file mode 100644 index 0000000..4ee5724 --- /dev/null +++ b/testdata/libvpx/vp90-2-12-droppable_2.ivf.md5 @@ -0,0 +1,99 @@ +1839e5db94dc99681d690d544cbe28a4 vp90-2-12-droppable_2.ivf-352x288-0001.i420 +dae2db51b91745edddb33ddbeb4e0988 vp90-2-12-droppable_2.ivf-352x288-0002.i420 +046639dbef310bf9016a54498a3ef0a3 vp90-2-12-droppable_2.ivf-352x288-0003.i420 +947044a5dbc918e8be468c2bc9eaeeaa vp90-2-12-droppable_2.ivf-352x288-0004.i420 +f96322ba3bf86065829d15c4394a1ab2 vp90-2-12-droppable_2.ivf-352x288-0005.i420 +4dfcf05608b399d56b0b29e3447ac24a vp90-2-12-droppable_2.ivf-352x288-0006.i420 +b772fd5f5e3221d9c1daf690aeca89e8 vp90-2-12-droppable_2.ivf-352x288-0007.i420 +d8838cf1a4316c6c9ba7f42f8cba205c vp90-2-12-droppable_2.ivf-352x288-0008.i420 +368f762830ed3d29d642798ff88107bd vp90-2-12-droppable_2.ivf-352x288-0009.i420 +f3e614a8f67681f814242c75e6ac66f7 vp90-2-12-droppable_2.ivf-352x288-0010.i420 +f49458a915dd853e53c15e52e280085b vp90-2-12-droppable_2.ivf-352x288-0011.i420 +65cbd3f3f8447d3caf935cddfcb6cb15 vp90-2-12-droppable_2.ivf-352x288-0012.i420 +8f4764c45093050a78b4b6055648cda0 vp90-2-12-droppable_2.ivf-352x288-0013.i420 +16d399bff977cdac0543daffba3a14bd vp90-2-12-droppable_2.ivf-352x288-0014.i420 +59f16bc632697d20514a55814cf0a9ae vp90-2-12-droppable_2.ivf-352x288-0015.i420 +058ba53139a3f48883ae4e668177d564 vp90-2-12-droppable_2.ivf-352x288-0016.i420 +85796d9edf6a5fe5d0c804e8b80f4469 vp90-2-12-droppable_2.ivf-352x288-0017.i420 +94b7bf54b3dd8d007cb932c330e4e7cf vp90-2-12-droppable_2.ivf-352x288-0018.i420 +964732ac0abf132fe8c65a845eeaea39 vp90-2-12-droppable_2.ivf-352x288-0019.i420 +dda8408b95868ea683f921e88ca0f8f4 vp90-2-12-droppable_2.ivf-352x288-0020.i420 +33b008d0b3932abd28d1c0d484a89cb0 vp90-2-12-droppable_2.ivf-352x288-0021.i420 +bbf8f8edda10ab20cde304b362f6fc7c vp90-2-12-droppable_2.ivf-352x288-0022.i420 +6a08c9c1d4444f6b706a9193823e4866 vp90-2-12-droppable_2.ivf-352x288-0023.i420 +f3cfb225730f103c76083220b55aaf7e vp90-2-12-droppable_2.ivf-352x288-0024.i420 +aa43de9fd852ffca405f9e1be0c517b9 vp90-2-12-droppable_2.ivf-352x288-0025.i420 +e5bcd2084c06d7e391af0710a3f56f86 vp90-2-12-droppable_2.ivf-352x288-0026.i420 +e16276389746853039a5c1353e3f830e vp90-2-12-droppable_2.ivf-352x288-0027.i420 +8ecf32a7649dd9df718b5a31512aa17b vp90-2-12-droppable_2.ivf-352x288-0028.i420 +db63be2b267a77061f40a48a5ad94129 vp90-2-12-droppable_2.ivf-352x288-0029.i420 +94c6a699e9b5382e1e4a30d462d1b05d vp90-2-12-droppable_2.ivf-352x288-0030.i420 +340102d21a9c8d9119aed97d7bd408ba vp90-2-12-droppable_2.ivf-352x288-0031.i420 +a369b32d71a6daf9a589614cba76d06c vp90-2-12-droppable_2.ivf-352x288-0032.i420 +7c6f24525d07f08cfaaf8b57c1b1e0c7 vp90-2-12-droppable_2.ivf-352x288-0033.i420 +f99b35baf3e4f3967ad08b5475041959 vp90-2-12-droppable_2.ivf-352x288-0034.i420 +b1dede9bbe4a9542d10e7e2dcc225208 vp90-2-12-droppable_2.ivf-352x288-0035.i420 +d627915070dd5e6e11d1dff7b1dc4243 vp90-2-12-droppable_2.ivf-352x288-0036.i420 +2f176951d8716e1ac316f30388be269d vp90-2-12-droppable_2.ivf-352x288-0037.i420 +215828b89c294b2568a575438c75d4e0 vp90-2-12-droppable_2.ivf-352x288-0038.i420 +3a29b4bf698713cbd575e6b14257fc87 vp90-2-12-droppable_2.ivf-352x288-0039.i420 +b930a1eef6838edc9abb769909b87cd9 vp90-2-12-droppable_2.ivf-352x288-0040.i420 +532c260abbd6d1181be3ff7a77f2d350 vp90-2-12-droppable_2.ivf-352x288-0041.i420 +b9ee7c0ab6c7cf8881fe5ed165454638 vp90-2-12-droppable_2.ivf-352x288-0042.i420 +d516f6949c3704ab9f154e3720f5f9ec vp90-2-12-droppable_2.ivf-352x288-0043.i420 +bf05478086e97057856c3c987b220958 vp90-2-12-droppable_2.ivf-352x288-0044.i420 +92202af7ea355a8d4678e618c0344134 vp90-2-12-droppable_2.ivf-352x288-0045.i420 +ca870c59afab60c5da07e688a89be1a9 vp90-2-12-droppable_2.ivf-352x288-0046.i420 +92429a1763b07d2a0bf843a2953fcc1c vp90-2-12-droppable_2.ivf-352x288-0047.i420 +1614a4655799cd08875b1271767ce85e vp90-2-12-droppable_2.ivf-352x288-0048.i420 +2b30362c459109cafcff5f1bb8217e34 vp90-2-12-droppable_2.ivf-352x288-0049.i420 +6568f3dd687762489b7fd2c4a59dd38c vp90-2-12-droppable_2.ivf-352x288-0050.i420 +6121d029cf4e402f9999a6719b3d6d97 vp90-2-12-droppable_2.ivf-352x288-0051.i420 +085cc85c56e35b4a19b48b502d606ffb vp90-2-12-droppable_2.ivf-352x288-0052.i420 +63a7dc5d70bd142cb167c20f645a90bb vp90-2-12-droppable_2.ivf-352x288-0053.i420 +b3ae931ee6f2724304f6a67070a386c0 vp90-2-12-droppable_2.ivf-352x288-0054.i420 +07fcd2b18c1c8a6c46151acff26ce2c0 vp90-2-12-droppable_2.ivf-352x288-0055.i420 +658758a58b92693bafeff41a2424e2a9 vp90-2-12-droppable_2.ivf-352x288-0056.i420 +3619120dfca7b24434ebe8e87936996c vp90-2-12-droppable_2.ivf-352x288-0057.i420 +17152bbf314be8c30837cbece6fb53cd vp90-2-12-droppable_2.ivf-352x288-0058.i420 +bc3352c6948fac5a681bf37abcc9b8b4 vp90-2-12-droppable_2.ivf-352x288-0059.i420 +5a4e0a19a7653a5ad120b1f46f9905b4 vp90-2-12-droppable_2.ivf-352x288-0060.i420 +2632db035652049f5340d1e59d577d42 vp90-2-12-droppable_2.ivf-352x288-0061.i420 +95a28f288602ae1f859a02055103aa39 vp90-2-12-droppable_2.ivf-352x288-0062.i420 +3d01e40359a3cfca996908d331492848 vp90-2-12-droppable_2.ivf-352x288-0063.i420 +4b6243114b09dbf590c1250419327b01 vp90-2-12-droppable_2.ivf-352x288-0064.i420 +f9aae29d9168366933f2bcc57a5afcb8 vp90-2-12-droppable_2.ivf-352x288-0065.i420 +6bca12015a807fdf48cda90cbe042ab4 vp90-2-12-droppable_2.ivf-352x288-0066.i420 +7769b6fa16f8c09973d1a2c08cf18dbb vp90-2-12-droppable_2.ivf-352x288-0067.i420 +3457395b67960b1566007e764b0c0e81 vp90-2-12-droppable_2.ivf-352x288-0068.i420 +0d0ea9bdd5c4b164bbefc31000a28e49 vp90-2-12-droppable_2.ivf-352x288-0069.i420 +9fb6b2afb53b73a658b579beb3008bcd vp90-2-12-droppable_2.ivf-352x288-0070.i420 +c9a941b87dcdd09afaab68cca0ed668a vp90-2-12-droppable_2.ivf-352x288-0071.i420 +9a2baa4c442f3ebdf251e9bbef0dbf83 vp90-2-12-droppable_2.ivf-352x288-0072.i420 +ef90237bc4ed3d795ba78c8a4ef9f1d6 vp90-2-12-droppable_2.ivf-352x288-0073.i420 +68cabdcf5d934e279f1c45207e983d43 vp90-2-12-droppable_2.ivf-352x288-0074.i420 +ac5d93877691c05bb581a10bfcd058e5 vp90-2-12-droppable_2.ivf-352x288-0075.i420 +c4e09feb0a88d765c7681c7d427eda87 vp90-2-12-droppable_2.ivf-352x288-0076.i420 +690734960471ab41d5cdf052be87bd30 vp90-2-12-droppable_2.ivf-352x288-0077.i420 +4abaaa7e31a3a6e30b242e42587363d5 vp90-2-12-droppable_2.ivf-352x288-0078.i420 +b9c46f294e7a23b608004ff8aa2b9ea3 vp90-2-12-droppable_2.ivf-352x288-0079.i420 +b6a6a0e45c30de0f03880f753b6e75de vp90-2-12-droppable_2.ivf-352x288-0080.i420 +c8725906463cb71ed8a64ba8af6a79be vp90-2-12-droppable_2.ivf-352x288-0081.i420 +d0e28c090e859834a33bc0867a0f7ed7 vp90-2-12-droppable_2.ivf-352x288-0082.i420 +1ad8bf201d9898d562631226a2ef85fa vp90-2-12-droppable_2.ivf-352x288-0083.i420 +962fe544b1a76bafe8a1b77cd64679ba vp90-2-12-droppable_2.ivf-352x288-0084.i420 +89f9a77223961cc5ad49a11913ff9774 vp90-2-12-droppable_2.ivf-352x288-0085.i420 +483782bf6d14bbb19c749d58b8535e3e vp90-2-12-droppable_2.ivf-352x288-0086.i420 +dfbe1b7ecc880ce5da758728f7375d63 vp90-2-12-droppable_2.ivf-352x288-0087.i420 +11a51b22418cc8dad57a20b37dd10630 vp90-2-12-droppable_2.ivf-352x288-0088.i420 +50b90506f9666ccb7dd94b6d59096489 vp90-2-12-droppable_2.ivf-352x288-0089.i420 +101294ecaff7edf5155ddc6cf3595021 vp90-2-12-droppable_2.ivf-352x288-0090.i420 +177e8f9d8aaf40b17d0b677133fc7955 vp90-2-12-droppable_2.ivf-352x288-0091.i420 +c029f78e758a27b8fc4214abf5ddad07 vp90-2-12-droppable_2.ivf-352x288-0092.i420 +45b6df0756e3f98218f4e9f0f33b1f13 vp90-2-12-droppable_2.ivf-352x288-0093.i420 +82d1fd8cc9fa0a072a0fc6177e7f8805 vp90-2-12-droppable_2.ivf-352x288-0094.i420 +bf6c3e8df105fdb82a614f8e8f6d68af vp90-2-12-droppable_2.ivf-352x288-0095.i420 +2e66eccd31c0e1792f3019c0a7b43af6 vp90-2-12-droppable_2.ivf-352x288-0096.i420 +d7eab4f351bd3c03e873b93afc9b7803 vp90-2-12-droppable_2.ivf-352x288-0097.i420 +f7bc200d54ec154779521311c54a22d1 vp90-2-12-droppable_2.ivf-352x288-0098.i420 +8e2624d762102b6dbe13b7cf20ee1708 vp90-2-12-droppable_2.ivf-352x288-0099.i420 diff --git a/testdata/libvpx/vp90-2-12-droppable_3.ivf.md5 b/testdata/libvpx/vp90-2-12-droppable_3.ivf.md5 new file mode 100644 index 0000000..9fdb07c --- /dev/null +++ b/testdata/libvpx/vp90-2-12-droppable_3.ivf.md5 @@ -0,0 +1,31 @@ +7ab6428314a7bce2ebae83b78acf9d1c vp90-2-12-droppable_3.ivf-640x480-0001.i420 +373cfc7765ea8038e64d95ff90b6d9e8 vp90-2-12-droppable_3.ivf-640x480-0002.i420 +58d782daf8249542df4a4f0e66994b86 vp90-2-12-droppable_3.ivf-640x480-0003.i420 +38b13b37c460f67dbbda8847a37e5a58 vp90-2-12-droppable_3.ivf-640x480-0004.i420 +902d00e196093fcebad74ef608d7c3ff vp90-2-12-droppable_3.ivf-640x480-0005.i420 +f3549650a4581de21916b189576b6a52 vp90-2-12-droppable_3.ivf-640x480-0006.i420 +a44d4bf06a241f31d1755ff6a118060a vp90-2-12-droppable_3.ivf-640x480-0007.i420 +8eeef076eec9eec2861f3376ebf87d0a vp90-2-12-droppable_3.ivf-640x480-0008.i420 +9a81bf95fc7210526b79c47ff80ae968 vp90-2-12-droppable_3.ivf-640x480-0009.i420 +bf215dfd9b764292de4d064389015e55 vp90-2-12-droppable_3.ivf-640x480-0010.i420 +283b1efdedde5633606d8a5d68097768 vp90-2-12-droppable_3.ivf-640x480-0011.i420 +dbb74ee6ec5f32b9ecb58b73d465be26 vp90-2-12-droppable_3.ivf-640x480-0012.i420 +ca1e21e458f674036addf08a79f6164e vp90-2-12-droppable_3.ivf-640x480-0013.i420 +24c3b279ecb0559ac146abed5976c54a vp90-2-12-droppable_3.ivf-640x480-0014.i420 +5f6796e3fa0e85d65b46ba66932ee09c vp90-2-12-droppable_3.ivf-640x480-0015.i420 +7b22b5642e42e79fcc339ca6652f8f39 vp90-2-12-droppable_3.ivf-640x480-0016.i420 +7478595483ce62a5906f979ad296b6c5 vp90-2-12-droppable_3.ivf-640x480-0017.i420 +55d843f54af65305f7e298013e90a839 vp90-2-12-droppable_3.ivf-640x480-0018.i420 +6ab0a82b5f0736d951b58f2245adb793 vp90-2-12-droppable_3.ivf-640x480-0019.i420 +1a9f6adde0d6ecd7bc83301ffeb15e51 vp90-2-12-droppable_3.ivf-640x480-0020.i420 +07552d44c99801657a3301d50c6d3897 vp90-2-12-droppable_3.ivf-640x480-0021.i420 +e9cdeec3accd4d19aa199a64e6cd163d vp90-2-12-droppable_3.ivf-640x480-0022.i420 +5dedc5eeb214bc4356bfa53e1c00d723 vp90-2-12-droppable_3.ivf-640x480-0023.i420 +dfd4bf2f664b46c36de24edf799c5c2a vp90-2-12-droppable_3.ivf-640x480-0024.i420 +deb33fefe4f20f09b6e84a037a7c2755 vp90-2-12-droppable_3.ivf-640x480-0025.i420 +e7425d6d380be060a89a2ca85660042f vp90-2-12-droppable_3.ivf-640x480-0026.i420 +74e3b4f750566b09c2fd0baafa5d69d1 vp90-2-12-droppable_3.ivf-640x480-0027.i420 +dd9f990aa7d858290a970be4681b7a1f vp90-2-12-droppable_3.ivf-640x480-0028.i420 +f7e8c6e20722b6a69e7f6766f41f2805 vp90-2-12-droppable_3.ivf-640x480-0029.i420 +835fca0a38539ef2632f85a051544326 vp90-2-12-droppable_3.ivf-640x480-0030.i420 +9c10a225363aa167ccef6e53b19ee64f vp90-2-12-droppable_3.ivf-640x480-0031.i420 diff --git a/testdata/libvpx/vp90-2-13-largescaling.webm.md5 b/testdata/libvpx/vp90-2-13-largescaling.webm.md5 new file mode 100644 index 0000000..13f1fab --- /dev/null +++ b/testdata/libvpx/vp90-2-13-largescaling.webm.md5 @@ -0,0 +1,2 @@ +49d48ef8e60799cb4216ad06d72c8c48 vp90-2-13-largescaling.webm-19200x108-0001.i420 +f59212c869c5069f2a179e96fd924614 vp90-2-13-largescaling.webm-20400x120-0002.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm.md5 new file mode 100644 index 0000000..60d6635 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm.md5 @@ -0,0 +1,50 @@ +a8a62e90b20b9ef6488d90a5dea2da8a vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0001.i420 +b2e46d14db6191e1449e46b7188c5f2f vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0002.i420 +12c31b571e4e2d90fcd512d77965b4cb vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0003.i420 +b3119bc49d4623c8ea3becd05e07463f vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0004.i420 +1675882b0ea5bd4a5065040752d5fe3e vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0005.i420 +923daa2c6d59e03ae8cf1af2c78c5bb2 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0006.i420 +08f2140d69cc820051a85892b2ff2a01 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0007.i420 +06d914b93342b270be99db67602d7793 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0008.i420 +c28cb062ec28f1e75e0eb29bd647a5de vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0009.i420 +82af7516ed6442bc185d6596d83ad9b8 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0010.i420 +d871744118e744aca6276bebeda410fc vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0011.i420 +c5b1807e36e91956cc0229c4756ea61e vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0012.i420 +9f167be5df53f45f9cc1c6ab9bc950cf vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0013.i420 +d1c3488d466f5b30bca9d8b36130afb6 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0014.i420 +b0088f83d803caa9ec01be43dc551d47 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0015.i420 +10ac93e04d1b4e9bae012263f3d15738 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0016.i420 +fda2014ed3bd8bf097086e93605f450c vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0017.i420 +3ddc4680540a6f205183476027ad204a vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0018.i420 +efefcdbc50a9b47b12bf50ff3d010490 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0019.i420 +994f082fedeb452d5f3f98c58efaf5d0 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-848x480-0020.i420 +28be337ddfb28688c21dbca5c45d00df vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0021.i420 +f04d582c758ad4677d1589cec06e7244 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0022.i420 +ee5769250599f4f3b380bf656d3e3885 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0023.i420 +962ed36e32885dc0d1c85e2f0ca2130b vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0024.i420 +b0400906f954ad79532db3f90c33bd2f vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0025.i420 +00de40dd55f18d5273412907d544e6c8 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0026.i420 +3e42f55ed09bd4b16a7f46410132901a vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0027.i420 +8fb06005364fd08702bc438f5164a5b6 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0028.i420 +f49fd4dbdec0ae761ecd1196dab8945d vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0029.i420 +8e931c00521bd618599182bbac778756 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-1280x720-0030.i420 +f8fb6da26a0db4c0af321d7a1974a973 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0031.i420 +1f95d4b4ac690d5c8b5477a0eafadd17 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0032.i420 +a2dfbf0ea6a11e94b543c5304d2e2b7e vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0033.i420 +915fe2d26a71a49e9af727d9e30f35e0 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0034.i420 +4fc1a2d564ffe9f8510bbf33a597505f vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0035.i420 +0dc4b7ab66ac46ca7161c5aee9bda48e vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0036.i420 +e931fa1830e0240e483548c15a85c3ae vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0037.i420 +c85484efac2b3a9c25174242bc4fc58d vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0038.i420 +7db7a631f70a8255cdc3fd970b00250b vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0039.i420 +9fbfd3614c69f0be47605b21c82b29c4 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-3840x2160-0040.i420 +f284a7f4b2d088b218be5b60acde50a6 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0041.i420 +ea4ef0c2b6356f4c5edae922198de309 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0042.i420 +dd7f547f27adaa3a4a0c7ff247ca7a71 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0043.i420 +491312ef6809486b73eee86655ad0be6 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0044.i420 +713603791ceb61ad7d579e8999bd7f82 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0045.i420 +03a4e151363eb26e88eea48ce675bf1a vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0046.i420 +47d6590d7fc75cd881b9def5539b5913 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0047.i420 +949836e9c4f128909dbe9b961e338665 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0048.i420 +a2d5130d691ae9b53cafedd713e8c7dd vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0049.i420 +6f7bf634f205b191a2e9c7bb6a36c564 vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm-432x240-0050.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-2.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-2.webm.md5 new file mode 100644 index 0000000..342d217 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-2.webm.md5 @@ -0,0 +1,30 @@ +a8a62e90b20b9ef6488d90a5dea2da8a vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0001.i420 +b2e46d14db6191e1449e46b7188c5f2f vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0002.i420 +12c31b571e4e2d90fcd512d77965b4cb vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0003.i420 +b3119bc49d4623c8ea3becd05e07463f vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0004.i420 +1675882b0ea5bd4a5065040752d5fe3e vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0005.i420 +923daa2c6d59e03ae8cf1af2c78c5bb2 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0006.i420 +08f2140d69cc820051a85892b2ff2a01 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0007.i420 +06d914b93342b270be99db67602d7793 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0008.i420 +c28cb062ec28f1e75e0eb29bd647a5de vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0009.i420 +82af7516ed6442bc185d6596d83ad9b8 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0010.i420 +d871744118e744aca6276bebeda410fc vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0011.i420 +c5b1807e36e91956cc0229c4756ea61e vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0012.i420 +9f167be5df53f45f9cc1c6ab9bc950cf vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0013.i420 +d1c3488d466f5b30bca9d8b36130afb6 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0014.i420 +b0088f83d803caa9ec01be43dc551d47 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0015.i420 +10ac93e04d1b4e9bae012263f3d15738 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0016.i420 +fda2014ed3bd8bf097086e93605f450c vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0017.i420 +3ddc4680540a6f205183476027ad204a vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0018.i420 +efefcdbc50a9b47b12bf50ff3d010490 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0019.i420 +994f082fedeb452d5f3f98c58efaf5d0 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-848x480-0020.i420 +fe4e8f7e62c6706767d68b9bd6313518 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0021.i420 +52c3f80fb43f903c90087200ef8452f6 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0022.i420 +f480f19eb44c6bc260644167f5806e95 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0023.i420 +22c2d55bdee971a50d3517d95d99d0bf vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0024.i420 +3b496ba30d015b81a2b55afc7cdb2d35 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0025.i420 +0f721548463ea46ea9d4902a3e1c6800 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0026.i420 +5795396282033a1c656457fece4419d6 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0027.i420 +47bde85a833d372569fc4c89a56dfd80 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0028.i420 +32b6085b561145488cd12d42199a3b64 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0029.i420 +f31254d89f891ba7a0a98423118303a4 vp90-2-14-resize-10frames-fp-tiles-1-2.webm-432x240-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-4.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-4.webm.md5 new file mode 100644 index 0000000..ab32365 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-4.webm.md5 @@ -0,0 +1,30 @@ +a8a62e90b20b9ef6488d90a5dea2da8a vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0001.i420 +b2e46d14db6191e1449e46b7188c5f2f vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0002.i420 +12c31b571e4e2d90fcd512d77965b4cb vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0003.i420 +b3119bc49d4623c8ea3becd05e07463f vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0004.i420 +1675882b0ea5bd4a5065040752d5fe3e vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0005.i420 +923daa2c6d59e03ae8cf1af2c78c5bb2 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0006.i420 +08f2140d69cc820051a85892b2ff2a01 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0007.i420 +06d914b93342b270be99db67602d7793 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0008.i420 +c28cb062ec28f1e75e0eb29bd647a5de vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0009.i420 +82af7516ed6442bc185d6596d83ad9b8 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0010.i420 +80e00dea7ca0378d0f15d2f4247a6892 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0011.i420 +6e7063cb07c7d54e7606f9d42c1e92a2 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0012.i420 +1df3247ef43b83cef0faa678fb7e18cf vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0013.i420 +75c0166722099d5fbdc325364354217b vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0014.i420 +ef9795649c7fa09d55565a370d206987 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0015.i420 +34cdea1efe01ae1f3f04af0be13fe100 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0016.i420 +bf9565eb31e481f10937c798b9bb7357 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0017.i420 +ef5eebf1922e112e4f485a1c0046ee00 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0018.i420 +1b24095c7734a91cab568a3c45eb7b01 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0019.i420 +20a10739f628afe0321965643f0ae25a vp90-2-14-resize-10frames-fp-tiles-1-4.webm-1280x720-0020.i420 +fe4e8f7e62c6706767d68b9bd6313518 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0021.i420 +52c3f80fb43f903c90087200ef8452f6 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0022.i420 +f480f19eb44c6bc260644167f5806e95 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0023.i420 +22c2d55bdee971a50d3517d95d99d0bf vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0024.i420 +3b496ba30d015b81a2b55afc7cdb2d35 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0025.i420 +0f721548463ea46ea9d4902a3e1c6800 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0026.i420 +5795396282033a1c656457fece4419d6 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0027.i420 +47bde85a833d372569fc4c89a56dfd80 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0028.i420 +32b6085b561145488cd12d42199a3b64 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0029.i420 +f31254d89f891ba7a0a98423118303a4 vp90-2-14-resize-10frames-fp-tiles-1-4.webm-432x240-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-8.webm.md5 new file mode 100644 index 0000000..86f8539 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-1-8.webm.md5 @@ -0,0 +1,30 @@ +a8a62e90b20b9ef6488d90a5dea2da8a vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0001.i420 +b2e46d14db6191e1449e46b7188c5f2f vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0002.i420 +12c31b571e4e2d90fcd512d77965b4cb vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0003.i420 +b3119bc49d4623c8ea3becd05e07463f vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0004.i420 +1675882b0ea5bd4a5065040752d5fe3e vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0005.i420 +923daa2c6d59e03ae8cf1af2c78c5bb2 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0006.i420 +08f2140d69cc820051a85892b2ff2a01 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0007.i420 +06d914b93342b270be99db67602d7793 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0008.i420 +c28cb062ec28f1e75e0eb29bd647a5de vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0009.i420 +82af7516ed6442bc185d6596d83ad9b8 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0010.i420 +7cdbee56185f8626204dba1e33dbaa13 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0011.i420 +a3fe22f50682d5061facfacb65138c0e vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0012.i420 +dedb211a6e0ca4d08cf60761c96b054a vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0013.i420 +ffca50cddbee3c8cfc43588c45e9c966 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0014.i420 +88e7f49b4470ec4df21c9583caa15c77 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0015.i420 +77386e9425400d339cbc2f769f630c6e vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0016.i420 +e83e12b6f07469e5657ac371759f0f8a vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0017.i420 +a7f06420232e5979dd8f520537690aa3 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0018.i420 +562dac183196aa91ad850dffe01465a5 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0019.i420 +81d55c349f761128f01bf29abb7f9234 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-3840x2160-0020.i420 +fe4e8f7e62c6706767d68b9bd6313518 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0021.i420 +52c3f80fb43f903c90087200ef8452f6 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0022.i420 +f480f19eb44c6bc260644167f5806e95 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0023.i420 +22c2d55bdee971a50d3517d95d99d0bf vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0024.i420 +3b496ba30d015b81a2b55afc7cdb2d35 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0025.i420 +0f721548463ea46ea9d4902a3e1c6800 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0026.i420 +5795396282033a1c656457fece4419d6 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0027.i420 +47bde85a833d372569fc4c89a56dfd80 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0028.i420 +32b6085b561145488cd12d42199a3b64 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0029.i420 +f31254d89f891ba7a0a98423118303a4 vp90-2-14-resize-10frames-fp-tiles-1-8.webm-432x240-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-1.webm.md5 new file mode 100644 index 0000000..8493ecc --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-1.webm.md5 @@ -0,0 +1,30 @@ +d50911f8b8c9df41a5edd2c3a7453e72 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0001.i420 +2120eb834bb505be7891b7627208a086 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0002.i420 +64ba53805cb0154351f8ed9d45704592 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0003.i420 +eb9eaaaf17b6277097a0c75b5e494f87 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0004.i420 +74f0913cb52f5cb081b614370290e871 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0005.i420 +8f9ab8c07b6b65a53d1e877e54624202 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0006.i420 +97e5f7a680a8989e9b4a988f4adbc946 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0007.i420 +ef48bc43fcda8f86ef9d9d7fc74c0e5f vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0008.i420 +21ed81f1dc2f71c60b49f63b908be1f7 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0009.i420 +dece7b7fa100993d1c26f1522c707a14 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0010.i420 +c458cce689f4bf6763a7fa1089cc02ad vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0011.i420 +3d86ad2fcccb0464eb2d3565e3ca8da1 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0012.i420 +e98c319116f68c0b515079f61d57bf13 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0013.i420 +e4fcaeb3de365a6fed5e722048e6aebd vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0014.i420 +ec264fabaea1491576efafabe6eaf37b vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0015.i420 +9ae9c4167d39cbef304c7b92c8db5e44 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0016.i420 +bf4f327f376f8a469e55b09bbf760ae9 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0017.i420 +3be68fe84b3bf6298e6e411ac6ff5883 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0018.i420 +7aa5aaa52ab9d152aa40abd4004d38db vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0019.i420 +7e526e997f6e0efbbad673f032957977 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-432x240-0020.i420 +a9ff9fdb10ea1637fbecd805f78e2f39 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0021.i420 +ef39611748b50d134405c72b5f8543f8 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0022.i420 +1b84dbb919f494a3fd0d40423b4e171a vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0023.i420 +629f5ffbbb94a63ed96e63e7e69c91e0 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0024.i420 +84fa30bea8d190007e022f06db42f978 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0025.i420 +45b361ffb35de314732c13c123071452 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0026.i420 +a4c8a4ab7392238356f6277d6f7742e6 vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0027.i420 +ad74002c5481790891d92ec69caf256b vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0028.i420 +6660d12cb2abe85602e4def29196b39b vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0029.i420 +b6490817c9548400e461ab86643bfc6f vp90-2-14-resize-10frames-fp-tiles-2-1.webm-848x480-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-4.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-4.webm.md5 new file mode 100644 index 0000000..486d6fc --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-4.webm.md5 @@ -0,0 +1,30 @@ +d50911f8b8c9df41a5edd2c3a7453e72 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0001.i420 +2120eb834bb505be7891b7627208a086 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0002.i420 +64ba53805cb0154351f8ed9d45704592 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0003.i420 +eb9eaaaf17b6277097a0c75b5e494f87 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0004.i420 +74f0913cb52f5cb081b614370290e871 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0005.i420 +8f9ab8c07b6b65a53d1e877e54624202 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0006.i420 +97e5f7a680a8989e9b4a988f4adbc946 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0007.i420 +ef48bc43fcda8f86ef9d9d7fc74c0e5f vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0008.i420 +21ed81f1dc2f71c60b49f63b908be1f7 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0009.i420 +dece7b7fa100993d1c26f1522c707a14 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0010.i420 +80e00dea7ca0378d0f15d2f4247a6892 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0011.i420 +6e7063cb07c7d54e7606f9d42c1e92a2 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0012.i420 +1df3247ef43b83cef0faa678fb7e18cf vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0013.i420 +75c0166722099d5fbdc325364354217b vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0014.i420 +ef9795649c7fa09d55565a370d206987 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0015.i420 +34cdea1efe01ae1f3f04af0be13fe100 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0016.i420 +bf9565eb31e481f10937c798b9bb7357 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0017.i420 +ef5eebf1922e112e4f485a1c0046ee00 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0018.i420 +1b24095c7734a91cab568a3c45eb7b01 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0019.i420 +20a10739f628afe0321965643f0ae25a vp90-2-14-resize-10frames-fp-tiles-2-4.webm-1280x720-0020.i420 +a9ff9fdb10ea1637fbecd805f78e2f39 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0021.i420 +ef39611748b50d134405c72b5f8543f8 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0022.i420 +1b84dbb919f494a3fd0d40423b4e171a vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0023.i420 +629f5ffbbb94a63ed96e63e7e69c91e0 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0024.i420 +84fa30bea8d190007e022f06db42f978 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0025.i420 +45b361ffb35de314732c13c123071452 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0026.i420 +a4c8a4ab7392238356f6277d6f7742e6 vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0027.i420 +ad74002c5481790891d92ec69caf256b vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0028.i420 +6660d12cb2abe85602e4def29196b39b vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0029.i420 +b6490817c9548400e461ab86643bfc6f vp90-2-14-resize-10frames-fp-tiles-2-4.webm-848x480-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-8.webm.md5 new file mode 100644 index 0000000..9f8a171 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-2-8.webm.md5 @@ -0,0 +1,30 @@ +d50911f8b8c9df41a5edd2c3a7453e72 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0001.i420 +2120eb834bb505be7891b7627208a086 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0002.i420 +64ba53805cb0154351f8ed9d45704592 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0003.i420 +eb9eaaaf17b6277097a0c75b5e494f87 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0004.i420 +74f0913cb52f5cb081b614370290e871 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0005.i420 +8f9ab8c07b6b65a53d1e877e54624202 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0006.i420 +97e5f7a680a8989e9b4a988f4adbc946 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0007.i420 +ef48bc43fcda8f86ef9d9d7fc74c0e5f vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0008.i420 +21ed81f1dc2f71c60b49f63b908be1f7 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0009.i420 +dece7b7fa100993d1c26f1522c707a14 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0010.i420 +7cdbee56185f8626204dba1e33dbaa13 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0011.i420 +a3fe22f50682d5061facfacb65138c0e vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0012.i420 +dedb211a6e0ca4d08cf60761c96b054a vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0013.i420 +ffca50cddbee3c8cfc43588c45e9c966 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0014.i420 +88e7f49b4470ec4df21c9583caa15c77 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0015.i420 +77386e9425400d339cbc2f769f630c6e vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0016.i420 +e83e12b6f07469e5657ac371759f0f8a vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0017.i420 +a7f06420232e5979dd8f520537690aa3 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0018.i420 +562dac183196aa91ad850dffe01465a5 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0019.i420 +81d55c349f761128f01bf29abb7f9234 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-3840x2160-0020.i420 +a9ff9fdb10ea1637fbecd805f78e2f39 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0021.i420 +ef39611748b50d134405c72b5f8543f8 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0022.i420 +1b84dbb919f494a3fd0d40423b4e171a vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0023.i420 +629f5ffbbb94a63ed96e63e7e69c91e0 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0024.i420 +84fa30bea8d190007e022f06db42f978 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0025.i420 +45b361ffb35de314732c13c123071452 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0026.i420 +a4c8a4ab7392238356f6277d6f7742e6 vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0027.i420 +ad74002c5481790891d92ec69caf256b vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0028.i420 +6660d12cb2abe85602e4def29196b39b vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0029.i420 +b6490817c9548400e461ab86643bfc6f vp90-2-14-resize-10frames-fp-tiles-2-8.webm-848x480-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-1.webm.md5 new file mode 100644 index 0000000..8749122 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-1.webm.md5 @@ -0,0 +1,30 @@ +148122d580a594100d81254f49bd62e1 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0001.i420 +ff05dbab5df7c65df70b1aca3e987feb vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0002.i420 +89865e8a832a507568ec20c5ffd0d008 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0003.i420 +42252a4fbde2e134124b09f550a7764f vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0004.i420 +8c667206142a22fcc528afe3741b2b68 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0005.i420 +8ad292fe5b40ccc6d2d7a697ef02b8b7 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0006.i420 +45272243429f2e7e72637a3413b3533b vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0007.i420 +57adb339d328e7f5a24a9b3ae81c49c0 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0008.i420 +53ba265c9d60b43c9132c9612104bd52 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0009.i420 +69c036bc83b50bb356b4908d9459a08e vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0010.i420 +c458cce689f4bf6763a7fa1089cc02ad vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0011.i420 +3d86ad2fcccb0464eb2d3565e3ca8da1 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0012.i420 +e98c319116f68c0b515079f61d57bf13 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0013.i420 +e4fcaeb3de365a6fed5e722048e6aebd vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0014.i420 +ec264fabaea1491576efafabe6eaf37b vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0015.i420 +9ae9c4167d39cbef304c7b92c8db5e44 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0016.i420 +bf4f327f376f8a469e55b09bbf760ae9 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0017.i420 +3be68fe84b3bf6298e6e411ac6ff5883 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0018.i420 +7aa5aaa52ab9d152aa40abd4004d38db vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0019.i420 +7e526e997f6e0efbbad673f032957977 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-432x240-0020.i420 +28be337ddfb28688c21dbca5c45d00df vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0021.i420 +75fe17095189de37b5ae3534d05758cb vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0022.i420 +e0abee11620d3545142131bb80b6d87f vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0023.i420 +c41420346b4d321833f0fc98c03f7655 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0024.i420 +a031408cc5b552e9a46f9f35e4e9f0da vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0025.i420 +538fda529c0b118ec24c909a98b60fd6 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0026.i420 +2e2b5edaeeef34c3e7792135111799d6 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0027.i420 +13ea5de98dd99d64708d23893c79a5f7 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0028.i420 +7d6b709b9787e2e80275950b090b9c91 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0029.i420 +7fcaa230bbd76719dbf969ad44a7a264 vp90-2-14-resize-10frames-fp-tiles-4-1.webm-1280x720-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-2.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-2.webm.md5 new file mode 100644 index 0000000..9a4476a --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-2.webm.md5 @@ -0,0 +1,30 @@ +148122d580a594100d81254f49bd62e1 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0001.i420 +ff05dbab5df7c65df70b1aca3e987feb vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0002.i420 +89865e8a832a507568ec20c5ffd0d008 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0003.i420 +42252a4fbde2e134124b09f550a7764f vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0004.i420 +8c667206142a22fcc528afe3741b2b68 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0005.i420 +8ad292fe5b40ccc6d2d7a697ef02b8b7 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0006.i420 +45272243429f2e7e72637a3413b3533b vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0007.i420 +57adb339d328e7f5a24a9b3ae81c49c0 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0008.i420 +53ba265c9d60b43c9132c9612104bd52 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0009.i420 +69c036bc83b50bb356b4908d9459a08e vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0010.i420 +d871744118e744aca6276bebeda410fc vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0011.i420 +c5b1807e36e91956cc0229c4756ea61e vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0012.i420 +9f167be5df53f45f9cc1c6ab9bc950cf vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0013.i420 +d1c3488d466f5b30bca9d8b36130afb6 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0014.i420 +b0088f83d803caa9ec01be43dc551d47 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0015.i420 +10ac93e04d1b4e9bae012263f3d15738 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0016.i420 +fda2014ed3bd8bf097086e93605f450c vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0017.i420 +3ddc4680540a6f205183476027ad204a vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0018.i420 +efefcdbc50a9b47b12bf50ff3d010490 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0019.i420 +994f082fedeb452d5f3f98c58efaf5d0 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-848x480-0020.i420 +28be337ddfb28688c21dbca5c45d00df vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0021.i420 +75fe17095189de37b5ae3534d05758cb vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0022.i420 +e0abee11620d3545142131bb80b6d87f vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0023.i420 +c41420346b4d321833f0fc98c03f7655 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0024.i420 +a031408cc5b552e9a46f9f35e4e9f0da vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0025.i420 +538fda529c0b118ec24c909a98b60fd6 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0026.i420 +2e2b5edaeeef34c3e7792135111799d6 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0027.i420 +13ea5de98dd99d64708d23893c79a5f7 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0028.i420 +7d6b709b9787e2e80275950b090b9c91 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0029.i420 +7fcaa230bbd76719dbf969ad44a7a264 vp90-2-14-resize-10frames-fp-tiles-4-2.webm-1280x720-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-8.webm.md5 new file mode 100644 index 0000000..8c2051c --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-4-8.webm.md5 @@ -0,0 +1,30 @@ +148122d580a594100d81254f49bd62e1 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0001.i420 +ff05dbab5df7c65df70b1aca3e987feb vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0002.i420 +89865e8a832a507568ec20c5ffd0d008 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0003.i420 +42252a4fbde2e134124b09f550a7764f vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0004.i420 +8c667206142a22fcc528afe3741b2b68 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0005.i420 +8ad292fe5b40ccc6d2d7a697ef02b8b7 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0006.i420 +45272243429f2e7e72637a3413b3533b vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0007.i420 +57adb339d328e7f5a24a9b3ae81c49c0 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0008.i420 +53ba265c9d60b43c9132c9612104bd52 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0009.i420 +69c036bc83b50bb356b4908d9459a08e vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0010.i420 +7cdbee56185f8626204dba1e33dbaa13 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0011.i420 +a3fe22f50682d5061facfacb65138c0e vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0012.i420 +dedb211a6e0ca4d08cf60761c96b054a vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0013.i420 +ffca50cddbee3c8cfc43588c45e9c966 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0014.i420 +88e7f49b4470ec4df21c9583caa15c77 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0015.i420 +77386e9425400d339cbc2f769f630c6e vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0016.i420 +e83e12b6f07469e5657ac371759f0f8a vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0017.i420 +a7f06420232e5979dd8f520537690aa3 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0018.i420 +562dac183196aa91ad850dffe01465a5 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0019.i420 +81d55c349f761128f01bf29abb7f9234 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-3840x2160-0020.i420 +28be337ddfb28688c21dbca5c45d00df vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0021.i420 +75fe17095189de37b5ae3534d05758cb vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0022.i420 +e0abee11620d3545142131bb80b6d87f vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0023.i420 +c41420346b4d321833f0fc98c03f7655 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0024.i420 +a031408cc5b552e9a46f9f35e4e9f0da vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0025.i420 +538fda529c0b118ec24c909a98b60fd6 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0026.i420 +2e2b5edaeeef34c3e7792135111799d6 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0027.i420 +13ea5de98dd99d64708d23893c79a5f7 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0028.i420 +7d6b709b9787e2e80275950b090b9c91 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0029.i420 +7fcaa230bbd76719dbf969ad44a7a264 vp90-2-14-resize-10frames-fp-tiles-4-8.webm-1280x720-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-1.webm.md5 new file mode 100644 index 0000000..2790f2a --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-1.webm.md5 @@ -0,0 +1,30 @@ +fdb90e29cda4c5848d06f62975a8a5b8 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0001.i420 +822250940e32f0507e8ff76deba5f94d vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0002.i420 +8ea739401d6eac42cdd5e338c258bb93 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0003.i420 +94fc80b94acd91003528181c2288169d vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0004.i420 +d68613aeee5016c1424788a881fdf78b vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0005.i420 +993e87ce5ef5129bd92d482df07771db vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0006.i420 +6a16b332d0559e6ab8db688196b7a606 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0007.i420 +e80dd664aaf0d7aa28a5052be43bebf8 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0008.i420 +43f4289579c6431707fe24b33f9abe63 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0009.i420 +643802753c5c0138d43323905ca82c3d vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0010.i420 +c458cce689f4bf6763a7fa1089cc02ad vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0011.i420 +3d86ad2fcccb0464eb2d3565e3ca8da1 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0012.i420 +e98c319116f68c0b515079f61d57bf13 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0013.i420 +e4fcaeb3de365a6fed5e722048e6aebd vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0014.i420 +ec264fabaea1491576efafabe6eaf37b vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0015.i420 +9ae9c4167d39cbef304c7b92c8db5e44 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0016.i420 +bf4f327f376f8a469e55b09bbf760ae9 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0017.i420 +3be68fe84b3bf6298e6e411ac6ff5883 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0018.i420 +7aa5aaa52ab9d152aa40abd4004d38db vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0019.i420 +7e526e997f6e0efbbad673f032957977 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-432x240-0020.i420 +1c692d89d1bae607c770cb828331f0a9 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0021.i420 +2d057101d84e291e747edfb5708264e0 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0022.i420 +b10e1ee46457469c32ec0f55ed95396b vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0023.i420 +b8b7bbf0e04c4164482d7f4961a087d3 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0024.i420 +f1a6ea880cd0d671257b1d2f221c2d42 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0025.i420 +4484e86d8496f7d7b7879455caf3cc14 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0026.i420 +cac0285cdd452ccd468c77db5bf6634e vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0027.i420 +ba02a23c6564a9c80141755e4ea482bb vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0028.i420 +b2ba940497c7e85ea02ab009eb737b9c vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0029.i420 +1cbf969e2e0e38643d8f7e1a3f313545 vp90-2-14-resize-10frames-fp-tiles-8-1.webm-3840x2160-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-2.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-2.webm.md5 new file mode 100644 index 0000000..dd1493f --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-2.webm.md5 @@ -0,0 +1,30 @@ +fdb90e29cda4c5848d06f62975a8a5b8 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0001.i420 +822250940e32f0507e8ff76deba5f94d vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0002.i420 +8ea739401d6eac42cdd5e338c258bb93 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0003.i420 +94fc80b94acd91003528181c2288169d vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0004.i420 +d68613aeee5016c1424788a881fdf78b vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0005.i420 +993e87ce5ef5129bd92d482df07771db vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0006.i420 +6a16b332d0559e6ab8db688196b7a606 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0007.i420 +e80dd664aaf0d7aa28a5052be43bebf8 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0008.i420 +43f4289579c6431707fe24b33f9abe63 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0009.i420 +643802753c5c0138d43323905ca82c3d vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0010.i420 +d871744118e744aca6276bebeda410fc vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0011.i420 +c5b1807e36e91956cc0229c4756ea61e vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0012.i420 +9f167be5df53f45f9cc1c6ab9bc950cf vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0013.i420 +d1c3488d466f5b30bca9d8b36130afb6 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0014.i420 +b0088f83d803caa9ec01be43dc551d47 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0015.i420 +10ac93e04d1b4e9bae012263f3d15738 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0016.i420 +fda2014ed3bd8bf097086e93605f450c vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0017.i420 +3ddc4680540a6f205183476027ad204a vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0018.i420 +efefcdbc50a9b47b12bf50ff3d010490 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0019.i420 +994f082fedeb452d5f3f98c58efaf5d0 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-848x480-0020.i420 +1c692d89d1bae607c770cb828331f0a9 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0021.i420 +2d057101d84e291e747edfb5708264e0 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0022.i420 +b10e1ee46457469c32ec0f55ed95396b vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0023.i420 +b8b7bbf0e04c4164482d7f4961a087d3 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0024.i420 +f1a6ea880cd0d671257b1d2f221c2d42 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0025.i420 +4484e86d8496f7d7b7879455caf3cc14 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0026.i420 +cac0285cdd452ccd468c77db5bf6634e vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0027.i420 +ba02a23c6564a9c80141755e4ea482bb vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0028.i420 +b2ba940497c7e85ea02ab009eb737b9c vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0029.i420 +1cbf969e2e0e38643d8f7e1a3f313545 vp90-2-14-resize-10frames-fp-tiles-8-2.webm-3840x2160-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm.md5 new file mode 100644 index 0000000..a5ab117 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm.md5 @@ -0,0 +1,50 @@ +fdb90e29cda4c5848d06f62975a8a5b8 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0001.i420 +822250940e32f0507e8ff76deba5f94d vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0002.i420 +8ea739401d6eac42cdd5e338c258bb93 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0003.i420 +94fc80b94acd91003528181c2288169d vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0004.i420 +d68613aeee5016c1424788a881fdf78b vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0005.i420 +993e87ce5ef5129bd92d482df07771db vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0006.i420 +6a16b332d0559e6ab8db688196b7a606 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0007.i420 +e80dd664aaf0d7aa28a5052be43bebf8 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0008.i420 +43f4289579c6431707fe24b33f9abe63 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0009.i420 +643802753c5c0138d43323905ca82c3d vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0010.i420 +80e00dea7ca0378d0f15d2f4247a6892 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0011.i420 +6e7063cb07c7d54e7606f9d42c1e92a2 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0012.i420 +1df3247ef43b83cef0faa678fb7e18cf vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0013.i420 +75c0166722099d5fbdc325364354217b vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0014.i420 +ef9795649c7fa09d55565a370d206987 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0015.i420 +34cdea1efe01ae1f3f04af0be13fe100 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0016.i420 +bf9565eb31e481f10937c798b9bb7357 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0017.i420 +ef5eebf1922e112e4f485a1c0046ee00 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0018.i420 +1b24095c7734a91cab568a3c45eb7b01 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0019.i420 +20a10739f628afe0321965643f0ae25a vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-1280x720-0020.i420 +a9ff9fdb10ea1637fbecd805f78e2f39 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0021.i420 +fede91f7b711fbb3f3fde8b0a114a093 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0022.i420 +6b51905467601fe2e4da34bb0dd57939 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0023.i420 +27f2a4ecc1ca694c9c2b1010a6c60357 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0024.i420 +42e17f44f11b30c7f394268a3a6074a5 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0025.i420 +85087f344f300fda88dbbd1cd61cd1ff vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0026.i420 +0875e86a249ce2696cf7aa11e7b12cd3 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0027.i420 +0901dd4344b6afaa4036195aaea7f8c4 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0028.i420 +37cd9e4668dd1fbf30a4b740a9ad0532 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0029.i420 +a37daf67d972521d8dccc38f18a6b47a vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-848x480-0030.i420 +cfee4f34d4938002e0c98ff4f641618d vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0031.i420 +ea8579eb0dfa2dbee599d40cdad9c8ac vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0032.i420 +93a6ef533897091c59d4a5d5b353e68c vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0033.i420 +6681ff5e5b6342294cf3bfdbc7cadf97 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0034.i420 +6865ffc977a13e9022c214b76b9d6176 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0035.i420 +b05a250efd130d211ed005c9f52890fb vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0036.i420 +efe929c6160d930900243784cffb184f vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0037.i420 +043325e61dfb14b650df95bfba55182b vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0038.i420 +0fd7afcfb4c47791bd3f0cfa2cf4f412 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0039.i420 +4ee279de6392e4c99a0996b5ff9757a5 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-432x240-0040.i420 +acf4fc6cd3dc10078e3e574a81b8b0f8 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0041.i420 +0c8f79ea1fc94ab355a4de5288ec4c8b vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0042.i420 +15da5aeff18ee71af76003e9e853a13a vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0043.i420 +9c2beeafa63b584860087f33e314e111 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0044.i420 +d85f5a66efe101baeb017ccf9b5a726b vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0045.i420 +a8c4fb083e481aae227ce98d716c2996 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0046.i420 +eb31f078049ceddc52273014d88d1614 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0047.i420 +88d1c74ea6c4ce8a7a4d0cdade54bfe3 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0048.i420 +9abaa40a735fc5cd80a52a4ff2d9d3b6 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0049.i420 +3591541aa4dff261169df7f84fc63af3 vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm-3840x2160-0050.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-4.webm.md5 b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-4.webm.md5 new file mode 100644 index 0000000..72ef0c5 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-10frames-fp-tiles-8-4.webm.md5 @@ -0,0 +1,30 @@ +fdb90e29cda4c5848d06f62975a8a5b8 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0001.i420 +822250940e32f0507e8ff76deba5f94d vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0002.i420 +8ea739401d6eac42cdd5e338c258bb93 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0003.i420 +94fc80b94acd91003528181c2288169d vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0004.i420 +d68613aeee5016c1424788a881fdf78b vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0005.i420 +993e87ce5ef5129bd92d482df07771db vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0006.i420 +6a16b332d0559e6ab8db688196b7a606 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0007.i420 +e80dd664aaf0d7aa28a5052be43bebf8 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0008.i420 +43f4289579c6431707fe24b33f9abe63 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0009.i420 +643802753c5c0138d43323905ca82c3d vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0010.i420 +80e00dea7ca0378d0f15d2f4247a6892 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0011.i420 +6e7063cb07c7d54e7606f9d42c1e92a2 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0012.i420 +1df3247ef43b83cef0faa678fb7e18cf vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0013.i420 +75c0166722099d5fbdc325364354217b vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0014.i420 +ef9795649c7fa09d55565a370d206987 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0015.i420 +34cdea1efe01ae1f3f04af0be13fe100 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0016.i420 +bf9565eb31e481f10937c798b9bb7357 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0017.i420 +ef5eebf1922e112e4f485a1c0046ee00 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0018.i420 +1b24095c7734a91cab568a3c45eb7b01 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0019.i420 +20a10739f628afe0321965643f0ae25a vp90-2-14-resize-10frames-fp-tiles-8-4.webm-1280x720-0020.i420 +1c692d89d1bae607c770cb828331f0a9 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0021.i420 +2d057101d84e291e747edfb5708264e0 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0022.i420 +b10e1ee46457469c32ec0f55ed95396b vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0023.i420 +b8b7bbf0e04c4164482d7f4961a087d3 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0024.i420 +f1a6ea880cd0d671257b1d2f221c2d42 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0025.i420 +4484e86d8496f7d7b7879455caf3cc14 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0026.i420 +cac0285cdd452ccd468c77db5bf6634e vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0027.i420 +ba02a23c6564a9c80141755e4ea482bb vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0028.i420 +b2ba940497c7e85ea02ab009eb737b9c vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0029.i420 +1cbf969e2e0e38643d8f7e1a3f313545 vp90-2-14-resize-10frames-fp-tiles-8-4.webm-3840x2160-0030.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-16.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-16.webm.md5 new file mode 100644 index 0000000..47c3c62 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-16.webm.md5 @@ -0,0 +1,18 @@ +d385a70d8244c0f3d90f7e07eca93b0e vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0001.i420 +04a03882c690293e5598e5e7b1751e1b vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0002.i420 +6bdeca5e41c95e3835269bf74cb60219 vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0003.i420 +853893e9f1d4e996298095542ef54396 vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0004.i420 +3e45503efce23c56ea2b8229848e6abe vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0005.i420 +b571f9b90d4a19abf98db123fea52767 vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0006.i420 +d73d7e6d773b97dee9c1cc558a890b0a vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0007.i420 +4a4b4db3ac13d50f8369be2a74da62a1 vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0008.i420 +55405379ac57e8cb05e119a964704260 vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0009.i420 +42eaa2744ad438956abea47b66074b38 vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0010.i420 +064a2807a8b2752897386c4d7c336eda vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0011.i420 +b788f1c1f03ee19f57e77e27dde01b6c vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0012.i420 +800e9ea7a68195a1f830664a5c5ff060 vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0013.i420 +16435a45b102993d60c89bdc9cdec7be vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0014.i420 +e135a21f03f4f901923266ecb61c8dee vp90-2-14-resize-fp-tiles-1-16.webm-432x240-0015.i420 +4b96a38f3f82dfcbf1abe015f233d547 vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0016.i420 +56d2d33f37a43673a10ac0262a7e45fc vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0017.i420 +db5a5e14c53c46827bf71f1bc1592114 vp90-2-14-resize-fp-tiles-1-16.webm-4096x2304-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm.md5 new file mode 100644 index 0000000..017b99e --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm.md5 @@ -0,0 +1,18 @@ +d385a70d8244c0f3d90f7e07eca93b0e vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-432x240-0001.i420 +04a03882c690293e5598e5e7b1751e1b vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-432x240-0002.i420 +6bdeca5e41c95e3835269bf74cb60219 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-432x240-0003.i420 +4c3f765f0f9e75ad4a96b8eb5e919e09 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-848x480-0004.i420 +60b88cfe3a2caedb603f9dc2dbce4cb3 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-848x480-0005.i420 +409769c464eb2173e2cd51e7a12b70c4 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-848x480-0006.i420 +8549c023873966f8cf1017d1fef660f6 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-1280x720-0007.i420 +afaa88cb0150a2122103f37cd283b853 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-1280x720-0008.i420 +a960e88b51bb5d7e8025b055528fb000 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-1280x720-0009.i420 +dc97ceb6328f1f56a8d29218f7b5c032 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-3840x2160-0010.i420 +2a41699357164d2dfbcc7500a188805f vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-3840x2160-0011.i420 +bcc2aab1484b5f398ac2a66ad68afd83 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-3840x2160-0012.i420 +90120a5aa516bb281705dd76f9c59357 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-4096x2304-0013.i420 +68f8f030d04f524f9a8bd8bd921729fa vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-4096x2304-0014.i420 +cd88a6282602e99f8565e80a0324db20 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-4096x2304-0015.i420 +dac79d94960a0740f2bf2dba06ae4152 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-432x240-0016.i420 +c9650c863e061c4a5c1b3e47c5ab5067 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-432x240-0017.i420 +218f32e6f171d8698a6e4a02317d99f2 vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm-432x240-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-2.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-2.webm.md5 new file mode 100644 index 0000000..54cf2d1 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-2.webm.md5 @@ -0,0 +1,18 @@ +d385a70d8244c0f3d90f7e07eca93b0e vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0001.i420 +04a03882c690293e5598e5e7b1751e1b vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0002.i420 +6bdeca5e41c95e3835269bf74cb60219 vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0003.i420 +4c3f765f0f9e75ad4a96b8eb5e919e09 vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0004.i420 +60b88cfe3a2caedb603f9dc2dbce4cb3 vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0005.i420 +409769c464eb2173e2cd51e7a12b70c4 vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0006.i420 +d73d7e6d773b97dee9c1cc558a890b0a vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0007.i420 +4a4b4db3ac13d50f8369be2a74da62a1 vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0008.i420 +55405379ac57e8cb05e119a964704260 vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0009.i420 +7dd8c74fdc13aad70eb47af83d3af009 vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0010.i420 +11118e1e669158722b77e14c572dfd4e vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0011.i420 +bc2a4dfba0fff3981e57a70155f9652e vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0012.i420 +800e9ea7a68195a1f830664a5c5ff060 vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0013.i420 +16435a45b102993d60c89bdc9cdec7be vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0014.i420 +e135a21f03f4f901923266ecb61c8dee vp90-2-14-resize-fp-tiles-1-2.webm-432x240-0015.i420 +824565e5f3e2e6b185e08ce816e6778e vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0016.i420 +d63df904df5c2bc05d1c044de670da7d vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0017.i420 +2b12d90a95abcd02435d286a5f3eff12 vp90-2-14-resize-fp-tiles-1-2.webm-848x480-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-4.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-4.webm.md5 new file mode 100644 index 0000000..f8212df --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-4.webm.md5 @@ -0,0 +1,18 @@ +d385a70d8244c0f3d90f7e07eca93b0e vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0001.i420 +04a03882c690293e5598e5e7b1751e1b vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0002.i420 +6bdeca5e41c95e3835269bf74cb60219 vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0003.i420 +4e2e14d1fbdff4b2c5336ce82cf79dd9 vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0004.i420 +a51f6f55a855f2a65c4d0162044739ad vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0005.i420 +13e9734d20beb04d4aa1cb73535575c8 vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0006.i420 +d73d7e6d773b97dee9c1cc558a890b0a vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0007.i420 +4a4b4db3ac13d50f8369be2a74da62a1 vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0008.i420 +55405379ac57e8cb05e119a964704260 vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0009.i420 +3850a2ef0638e0f66e2c72ca5fc2bbee vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0010.i420 +49fbb5ab2fb89cc2c3afcbbb543b2ba2 vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0011.i420 +c88b3bad769c73b72a2bd192e1f11325 vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0012.i420 +800e9ea7a68195a1f830664a5c5ff060 vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0013.i420 +16435a45b102993d60c89bdc9cdec7be vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0014.i420 +e135a21f03f4f901923266ecb61c8dee vp90-2-14-resize-fp-tiles-1-4.webm-432x240-0015.i420 +892530f64abb38fe9b2a07b9ecc8ce79 vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0016.i420 +9b78d317dce71833e762d715bae9079f vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0017.i420 +dd644e83dc4892591ae460514026f278 vp90-2-14-resize-fp-tiles-1-4.webm-1280x720-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-8.webm.md5 new file mode 100644 index 0000000..87c6296 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-1-8.webm.md5 @@ -0,0 +1,18 @@ +d385a70d8244c0f3d90f7e07eca93b0e vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0001.i420 +04a03882c690293e5598e5e7b1751e1b vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0002.i420 +6bdeca5e41c95e3835269bf74cb60219 vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0003.i420 +8ae75e85a73e4a9ba7ecd3ca7f0919cf vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0004.i420 +b75eeef070a7230de3b39d6c6b0ce6ea vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0005.i420 +b01533666d412a8e24e13990e0a2b4f0 vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0006.i420 +d73d7e6d773b97dee9c1cc558a890b0a vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0007.i420 +4a4b4db3ac13d50f8369be2a74da62a1 vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0008.i420 +55405379ac57e8cb05e119a964704260 vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0009.i420 +dc97ceb6328f1f56a8d29218f7b5c032 vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0010.i420 +2a41699357164d2dfbcc7500a188805f vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0011.i420 +bcc2aab1484b5f398ac2a66ad68afd83 vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0012.i420 +800e9ea7a68195a1f830664a5c5ff060 vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0013.i420 +16435a45b102993d60c89bdc9cdec7be vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0014.i420 +e135a21f03f4f901923266ecb61c8dee vp90-2-14-resize-fp-tiles-1-8.webm-432x240-0015.i420 +d7d7eeec10d1dcc062fa1db4285f6199 vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0016.i420 +189ff9b711691d8ab54c6aa0cafb7c19 vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0017.i420 +fe7620ef0018ac7584afcb10126060f4 vp90-2-14-resize-fp-tiles-1-8.webm-3840x2160-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-1.webm.md5 new file mode 100644 index 0000000..7314945 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-1.webm.md5 @@ -0,0 +1,18 @@ +7522aa343257305b2cab0ff1ef66eea7 vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0001.i420 +7d31ab0c02881e3812ad5d8178853ede vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0002.i420 +279a71d54cfb224f2cf2d738ace6b687 vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0003.i420 +6c256d64eb42b60a492be13328ea66ae vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0004.i420 +9adcda224de3cabc141c52f9c321d550 vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0005.i420 +24cd54a8a1eed6af97b760927fbbac28 vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0006.i420 +e425560375214cd6a503a538e9ff94f0 vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0007.i420 +80a172b3ef7a9e258a4e46317ae4385c vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0008.i420 +8ee72e1d2f4aed28eed351f17ffe0122 vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0009.i420 +d6ab89405b3d6621a478ddf15784af60 vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0010.i420 +ace69ded39a0074a7de5dff2cc93f895 vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0011.i420 +96201a39b9648a4721dea0b22726031a vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0012.i420 +90120a5aa516bb281705dd76f9c59357 vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0013.i420 +68f8f030d04f524f9a8bd8bd921729fa vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0014.i420 +cd88a6282602e99f8565e80a0324db20 vp90-2-14-resize-fp-tiles-16-1.webm-4096x2304-0015.i420 +dac79d94960a0740f2bf2dba06ae4152 vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0016.i420 +c9650c863e061c4a5c1b3e47c5ab5067 vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0017.i420 +218f32e6f171d8698a6e4a02317d99f2 vp90-2-14-resize-fp-tiles-16-1.webm-432x240-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-2.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-2.webm.md5 new file mode 100644 index 0000000..bd7520a --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-2.webm.md5 @@ -0,0 +1,18 @@ +7522aa343257305b2cab0ff1ef66eea7 vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0001.i420 +7d31ab0c02881e3812ad5d8178853ede vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0002.i420 +279a71d54cfb224f2cf2d738ace6b687 vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0003.i420 +4c3f765f0f9e75ad4a96b8eb5e919e09 vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0004.i420 +60b88cfe3a2caedb603f9dc2dbce4cb3 vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0005.i420 +409769c464eb2173e2cd51e7a12b70c4 vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0006.i420 +e425560375214cd6a503a538e9ff94f0 vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0007.i420 +80a172b3ef7a9e258a4e46317ae4385c vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0008.i420 +8ee72e1d2f4aed28eed351f17ffe0122 vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0009.i420 +7dd8c74fdc13aad70eb47af83d3af009 vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0010.i420 +11118e1e669158722b77e14c572dfd4e vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0011.i420 +bc2a4dfba0fff3981e57a70155f9652e vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0012.i420 +90120a5aa516bb281705dd76f9c59357 vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0013.i420 +68f8f030d04f524f9a8bd8bd921729fa vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0014.i420 +cd88a6282602e99f8565e80a0324db20 vp90-2-14-resize-fp-tiles-16-2.webm-4096x2304-0015.i420 +824565e5f3e2e6b185e08ce816e6778e vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0016.i420 +d63df904df5c2bc05d1c044de670da7d vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0017.i420 +2b12d90a95abcd02435d286a5f3eff12 vp90-2-14-resize-fp-tiles-16-2.webm-848x480-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-4.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-4.webm.md5 new file mode 100644 index 0000000..9bd3466 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-4.webm.md5 @@ -0,0 +1,18 @@ +7522aa343257305b2cab0ff1ef66eea7 vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0001.i420 +7d31ab0c02881e3812ad5d8178853ede vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0002.i420 +279a71d54cfb224f2cf2d738ace6b687 vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0003.i420 +4e2e14d1fbdff4b2c5336ce82cf79dd9 vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0004.i420 +a51f6f55a855f2a65c4d0162044739ad vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0005.i420 +13e9734d20beb04d4aa1cb73535575c8 vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0006.i420 +e425560375214cd6a503a538e9ff94f0 vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0007.i420 +80a172b3ef7a9e258a4e46317ae4385c vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0008.i420 +8ee72e1d2f4aed28eed351f17ffe0122 vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0009.i420 +3850a2ef0638e0f66e2c72ca5fc2bbee vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0010.i420 +49fbb5ab2fb89cc2c3afcbbb543b2ba2 vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0011.i420 +c88b3bad769c73b72a2bd192e1f11325 vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0012.i420 +90120a5aa516bb281705dd76f9c59357 vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0013.i420 +68f8f030d04f524f9a8bd8bd921729fa vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0014.i420 +cd88a6282602e99f8565e80a0324db20 vp90-2-14-resize-fp-tiles-16-4.webm-4096x2304-0015.i420 +892530f64abb38fe9b2a07b9ecc8ce79 vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0016.i420 +9b78d317dce71833e762d715bae9079f vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0017.i420 +dd644e83dc4892591ae460514026f278 vp90-2-14-resize-fp-tiles-16-4.webm-1280x720-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm.md5 new file mode 100644 index 0000000..8f760b9 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm.md5 @@ -0,0 +1,18 @@ +7522aa343257305b2cab0ff1ef66eea7 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-4096x2304-0001.i420 +7d31ab0c02881e3812ad5d8178853ede vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-4096x2304-0002.i420 +279a71d54cfb224f2cf2d738ace6b687 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-4096x2304-0003.i420 +8ae75e85a73e4a9ba7ecd3ca7f0919cf vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-3840x2160-0004.i420 +b75eeef070a7230de3b39d6c6b0ce6ea vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-3840x2160-0005.i420 +b01533666d412a8e24e13990e0a2b4f0 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-3840x2160-0006.i420 +8549c023873966f8cf1017d1fef660f6 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-1280x720-0007.i420 +afaa88cb0150a2122103f37cd283b853 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-1280x720-0008.i420 +a960e88b51bb5d7e8025b055528fb000 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-1280x720-0009.i420 +7dd8c74fdc13aad70eb47af83d3af009 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-848x480-0010.i420 +11118e1e669158722b77e14c572dfd4e vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-848x480-0011.i420 +bc2a4dfba0fff3981e57a70155f9652e vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-848x480-0012.i420 +800e9ea7a68195a1f830664a5c5ff060 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-432x240-0013.i420 +16435a45b102993d60c89bdc9cdec7be vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-432x240-0014.i420 +e135a21f03f4f901923266ecb61c8dee vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-432x240-0015.i420 +4b96a38f3f82dfcbf1abe015f233d547 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-4096x2304-0016.i420 +56d2d33f37a43673a10ac0262a7e45fc vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-4096x2304-0017.i420 +db5a5e14c53c46827bf71f1bc1592114 vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm-4096x2304-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-8.webm.md5 new file mode 100644 index 0000000..87c7977 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-16-8.webm.md5 @@ -0,0 +1,18 @@ +7522aa343257305b2cab0ff1ef66eea7 vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0001.i420 +7d31ab0c02881e3812ad5d8178853ede vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0002.i420 +279a71d54cfb224f2cf2d738ace6b687 vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0003.i420 +8ae75e85a73e4a9ba7ecd3ca7f0919cf vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0004.i420 +b75eeef070a7230de3b39d6c6b0ce6ea vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0005.i420 +b01533666d412a8e24e13990e0a2b4f0 vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0006.i420 +e425560375214cd6a503a538e9ff94f0 vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0007.i420 +80a172b3ef7a9e258a4e46317ae4385c vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0008.i420 +8ee72e1d2f4aed28eed351f17ffe0122 vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0009.i420 +dc97ceb6328f1f56a8d29218f7b5c032 vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0010.i420 +2a41699357164d2dfbcc7500a188805f vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0011.i420 +bcc2aab1484b5f398ac2a66ad68afd83 vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0012.i420 +90120a5aa516bb281705dd76f9c59357 vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0013.i420 +68f8f030d04f524f9a8bd8bd921729fa vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0014.i420 +cd88a6282602e99f8565e80a0324db20 vp90-2-14-resize-fp-tiles-16-8.webm-4096x2304-0015.i420 +d7d7eeec10d1dcc062fa1db4285f6199 vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0016.i420 +189ff9b711691d8ab54c6aa0cafb7c19 vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0017.i420 +fe7620ef0018ac7584afcb10126060f4 vp90-2-14-resize-fp-tiles-16-8.webm-3840x2160-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-1.webm.md5 new file mode 100644 index 0000000..0c2a17e --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-1.webm.md5 @@ -0,0 +1,18 @@ +50ffbb759948956a258f63b99afe2e5c vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0001.i420 +103322392c94eeee7f01ece0b09a350d vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0002.i420 +ff11e7cb0f4308018b9eedf0a2a819f5 vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0003.i420 +6c256d64eb42b60a492be13328ea66ae vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0004.i420 +9adcda224de3cabc141c52f9c321d550 vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0005.i420 +24cd54a8a1eed6af97b760927fbbac28 vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0006.i420 +77650f5b2ea5beb79b0a341f83e0b9ae vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0007.i420 +f150f13b531151078caac943cbb0b466 vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0008.i420 +b65831f9b33c94fa81adaed34e610ce3 vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0009.i420 +d6ab89405b3d6621a478ddf15784af60 vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0010.i420 +ace69ded39a0074a7de5dff2cc93f895 vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0011.i420 +96201a39b9648a4721dea0b22726031a vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0012.i420 +be5a23e1723d8c7fd7fb0ce0bf44fbae vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0013.i420 +ba44b341402c77f727d8544419699924 vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0014.i420 +8aacc8c0a38a0e61a88ed7b1f022faba vp90-2-14-resize-fp-tiles-2-1.webm-848x480-0015.i420 +dac79d94960a0740f2bf2dba06ae4152 vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0016.i420 +c9650c863e061c4a5c1b3e47c5ab5067 vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0017.i420 +218f32e6f171d8698a6e4a02317d99f2 vp90-2-14-resize-fp-tiles-2-1.webm-432x240-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-16.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-16.webm.md5 new file mode 100644 index 0000000..5fb8786 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-16.webm.md5 @@ -0,0 +1,18 @@ +50ffbb759948956a258f63b99afe2e5c vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0001.i420 +103322392c94eeee7f01ece0b09a350d vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0002.i420 +ff11e7cb0f4308018b9eedf0a2a819f5 vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0003.i420 +853893e9f1d4e996298095542ef54396 vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0004.i420 +3e45503efce23c56ea2b8229848e6abe vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0005.i420 +b571f9b90d4a19abf98db123fea52767 vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0006.i420 +77650f5b2ea5beb79b0a341f83e0b9ae vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0007.i420 +f150f13b531151078caac943cbb0b466 vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0008.i420 +b65831f9b33c94fa81adaed34e610ce3 vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0009.i420 +42eaa2744ad438956abea47b66074b38 vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0010.i420 +064a2807a8b2752897386c4d7c336eda vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0011.i420 +b788f1c1f03ee19f57e77e27dde01b6c vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0012.i420 +be5a23e1723d8c7fd7fb0ce0bf44fbae vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0013.i420 +ba44b341402c77f727d8544419699924 vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0014.i420 +8aacc8c0a38a0e61a88ed7b1f022faba vp90-2-14-resize-fp-tiles-2-16.webm-848x480-0015.i420 +4b96a38f3f82dfcbf1abe015f233d547 vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0016.i420 +56d2d33f37a43673a10ac0262a7e45fc vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0017.i420 +db5a5e14c53c46827bf71f1bc1592114 vp90-2-14-resize-fp-tiles-2-16.webm-4096x2304-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-4.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-4.webm.md5 new file mode 100644 index 0000000..328d84b --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-4.webm.md5 @@ -0,0 +1,18 @@ +50ffbb759948956a258f63b99afe2e5c vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0001.i420 +103322392c94eeee7f01ece0b09a350d vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0002.i420 +ff11e7cb0f4308018b9eedf0a2a819f5 vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0003.i420 +4e2e14d1fbdff4b2c5336ce82cf79dd9 vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0004.i420 +a51f6f55a855f2a65c4d0162044739ad vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0005.i420 +13e9734d20beb04d4aa1cb73535575c8 vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0006.i420 +77650f5b2ea5beb79b0a341f83e0b9ae vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0007.i420 +f150f13b531151078caac943cbb0b466 vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0008.i420 +b65831f9b33c94fa81adaed34e610ce3 vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0009.i420 +3850a2ef0638e0f66e2c72ca5fc2bbee vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0010.i420 +49fbb5ab2fb89cc2c3afcbbb543b2ba2 vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0011.i420 +c88b3bad769c73b72a2bd192e1f11325 vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0012.i420 +be5a23e1723d8c7fd7fb0ce0bf44fbae vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0013.i420 +ba44b341402c77f727d8544419699924 vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0014.i420 +8aacc8c0a38a0e61a88ed7b1f022faba vp90-2-14-resize-fp-tiles-2-4.webm-848x480-0015.i420 +892530f64abb38fe9b2a07b9ecc8ce79 vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0016.i420 +9b78d317dce71833e762d715bae9079f vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0017.i420 +dd644e83dc4892591ae460514026f278 vp90-2-14-resize-fp-tiles-2-4.webm-1280x720-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-8.webm.md5 new file mode 100644 index 0000000..0e6ff96 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-2-8.webm.md5 @@ -0,0 +1,18 @@ +50ffbb759948956a258f63b99afe2e5c vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0001.i420 +103322392c94eeee7f01ece0b09a350d vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0002.i420 +ff11e7cb0f4308018b9eedf0a2a819f5 vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0003.i420 +8ae75e85a73e4a9ba7ecd3ca7f0919cf vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0004.i420 +b75eeef070a7230de3b39d6c6b0ce6ea vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0005.i420 +b01533666d412a8e24e13990e0a2b4f0 vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0006.i420 +77650f5b2ea5beb79b0a341f83e0b9ae vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0007.i420 +f150f13b531151078caac943cbb0b466 vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0008.i420 +b65831f9b33c94fa81adaed34e610ce3 vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0009.i420 +dc97ceb6328f1f56a8d29218f7b5c032 vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0010.i420 +2a41699357164d2dfbcc7500a188805f vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0011.i420 +bcc2aab1484b5f398ac2a66ad68afd83 vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0012.i420 +be5a23e1723d8c7fd7fb0ce0bf44fbae vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0013.i420 +ba44b341402c77f727d8544419699924 vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0014.i420 +8aacc8c0a38a0e61a88ed7b1f022faba vp90-2-14-resize-fp-tiles-2-8.webm-848x480-0015.i420 +d7d7eeec10d1dcc062fa1db4285f6199 vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0016.i420 +189ff9b711691d8ab54c6aa0cafb7c19 vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0017.i420 +fe7620ef0018ac7584afcb10126060f4 vp90-2-14-resize-fp-tiles-2-8.webm-3840x2160-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-1.webm.md5 new file mode 100644 index 0000000..5bcbf4e --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-1.webm.md5 @@ -0,0 +1,18 @@ +78d793acb081affe1907832c08d47a2c vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0001.i420 +53d27864bfaa5620926c2fcb82c67973 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0002.i420 +e32affcddd045564b9408f8cdca4cf47 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0003.i420 +6c256d64eb42b60a492be13328ea66ae vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0004.i420 +9adcda224de3cabc141c52f9c321d550 vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0005.i420 +24cd54a8a1eed6af97b760927fbbac28 vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0006.i420 +8549c023873966f8cf1017d1fef660f6 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0007.i420 +afaa88cb0150a2122103f37cd283b853 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0008.i420 +a960e88b51bb5d7e8025b055528fb000 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0009.i420 +d6ab89405b3d6621a478ddf15784af60 vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0010.i420 +ace69ded39a0074a7de5dff2cc93f895 vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0011.i420 +96201a39b9648a4721dea0b22726031a vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0012.i420 +324a0b8dad8a74094dcf55f4a1c7c883 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0013.i420 +f5c307ce869f064ab2d3f13b35acb9b8 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0014.i420 +c74df2856ac4659ccda8a463ffe8fc41 vp90-2-14-resize-fp-tiles-4-1.webm-1280x720-0015.i420 +dac79d94960a0740f2bf2dba06ae4152 vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0016.i420 +c9650c863e061c4a5c1b3e47c5ab5067 vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0017.i420 +218f32e6f171d8698a6e4a02317d99f2 vp90-2-14-resize-fp-tiles-4-1.webm-432x240-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-16.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-16.webm.md5 new file mode 100644 index 0000000..a4fffa5 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-16.webm.md5 @@ -0,0 +1,18 @@ +78d793acb081affe1907832c08d47a2c vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0001.i420 +53d27864bfaa5620926c2fcb82c67973 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0002.i420 +e32affcddd045564b9408f8cdca4cf47 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0003.i420 +853893e9f1d4e996298095542ef54396 vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0004.i420 +3e45503efce23c56ea2b8229848e6abe vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0005.i420 +b571f9b90d4a19abf98db123fea52767 vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0006.i420 +8549c023873966f8cf1017d1fef660f6 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0007.i420 +afaa88cb0150a2122103f37cd283b853 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0008.i420 +a960e88b51bb5d7e8025b055528fb000 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0009.i420 +42eaa2744ad438956abea47b66074b38 vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0010.i420 +064a2807a8b2752897386c4d7c336eda vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0011.i420 +b788f1c1f03ee19f57e77e27dde01b6c vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0012.i420 +324a0b8dad8a74094dcf55f4a1c7c883 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0013.i420 +f5c307ce869f064ab2d3f13b35acb9b8 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0014.i420 +c74df2856ac4659ccda8a463ffe8fc41 vp90-2-14-resize-fp-tiles-4-16.webm-1280x720-0015.i420 +4b96a38f3f82dfcbf1abe015f233d547 vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0016.i420 +56d2d33f37a43673a10ac0262a7e45fc vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0017.i420 +db5a5e14c53c46827bf71f1bc1592114 vp90-2-14-resize-fp-tiles-4-16.webm-4096x2304-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-2.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-2.webm.md5 new file mode 100644 index 0000000..20205a5 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-2.webm.md5 @@ -0,0 +1,18 @@ +78d793acb081affe1907832c08d47a2c vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0001.i420 +53d27864bfaa5620926c2fcb82c67973 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0002.i420 +e32affcddd045564b9408f8cdca4cf47 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0003.i420 +4c3f765f0f9e75ad4a96b8eb5e919e09 vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0004.i420 +60b88cfe3a2caedb603f9dc2dbce4cb3 vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0005.i420 +409769c464eb2173e2cd51e7a12b70c4 vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0006.i420 +8549c023873966f8cf1017d1fef660f6 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0007.i420 +afaa88cb0150a2122103f37cd283b853 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0008.i420 +a960e88b51bb5d7e8025b055528fb000 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0009.i420 +7dd8c74fdc13aad70eb47af83d3af009 vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0010.i420 +11118e1e669158722b77e14c572dfd4e vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0011.i420 +bc2a4dfba0fff3981e57a70155f9652e vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0012.i420 +324a0b8dad8a74094dcf55f4a1c7c883 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0013.i420 +f5c307ce869f064ab2d3f13b35acb9b8 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0014.i420 +c74df2856ac4659ccda8a463ffe8fc41 vp90-2-14-resize-fp-tiles-4-2.webm-1280x720-0015.i420 +824565e5f3e2e6b185e08ce816e6778e vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0016.i420 +d63df904df5c2bc05d1c044de670da7d vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0017.i420 +2b12d90a95abcd02435d286a5f3eff12 vp90-2-14-resize-fp-tiles-4-2.webm-848x480-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-8.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-8.webm.md5 new file mode 100644 index 0000000..0708f96 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-4-8.webm.md5 @@ -0,0 +1,18 @@ +78d793acb081affe1907832c08d47a2c vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0001.i420 +53d27864bfaa5620926c2fcb82c67973 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0002.i420 +e32affcddd045564b9408f8cdca4cf47 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0003.i420 +8ae75e85a73e4a9ba7ecd3ca7f0919cf vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0004.i420 +b75eeef070a7230de3b39d6c6b0ce6ea vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0005.i420 +b01533666d412a8e24e13990e0a2b4f0 vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0006.i420 +8549c023873966f8cf1017d1fef660f6 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0007.i420 +afaa88cb0150a2122103f37cd283b853 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0008.i420 +a960e88b51bb5d7e8025b055528fb000 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0009.i420 +dc97ceb6328f1f56a8d29218f7b5c032 vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0010.i420 +2a41699357164d2dfbcc7500a188805f vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0011.i420 +bcc2aab1484b5f398ac2a66ad68afd83 vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0012.i420 +324a0b8dad8a74094dcf55f4a1c7c883 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0013.i420 +f5c307ce869f064ab2d3f13b35acb9b8 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0014.i420 +c74df2856ac4659ccda8a463ffe8fc41 vp90-2-14-resize-fp-tiles-4-8.webm-1280x720-0015.i420 +d7d7eeec10d1dcc062fa1db4285f6199 vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0016.i420 +189ff9b711691d8ab54c6aa0cafb7c19 vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0017.i420 +fe7620ef0018ac7584afcb10126060f4 vp90-2-14-resize-fp-tiles-4-8.webm-3840x2160-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-1.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-1.webm.md5 new file mode 100644 index 0000000..0181f58 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-1.webm.md5 @@ -0,0 +1,18 @@ +2a137f70b7f610f91f592c6c023b8e78 vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0001.i420 +e4d8bb301558170f2ef17cca4e39972f vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0002.i420 +1e9af1587cde4f00f892ba433cdad896 vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0003.i420 +6c256d64eb42b60a492be13328ea66ae vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0004.i420 +9adcda224de3cabc141c52f9c321d550 vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0005.i420 +24cd54a8a1eed6af97b760927fbbac28 vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0006.i420 +c0e6f4285a89dece0689a9ad57c2dec1 vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0007.i420 +c177a93afb0662212bfbb0a311778d48 vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0008.i420 +eaf2249e33e2c36850b148218d4999ed vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0009.i420 +d6ab89405b3d6621a478ddf15784af60 vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0010.i420 +ace69ded39a0074a7de5dff2cc93f895 vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0011.i420 +96201a39b9648a4721dea0b22726031a vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0012.i420 +f40fe8a61dea8fe9b826f94905b42980 vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0013.i420 +47009f1b1816dcfa038778df8183ea98 vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0014.i420 +687a20dca6cd33460f87cbdca38e904f vp90-2-14-resize-fp-tiles-8-1.webm-3840x2160-0015.i420 +dac79d94960a0740f2bf2dba06ae4152 vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0016.i420 +c9650c863e061c4a5c1b3e47c5ab5067 vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0017.i420 +218f32e6f171d8698a6e4a02317d99f2 vp90-2-14-resize-fp-tiles-8-1.webm-432x240-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-16.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-16.webm.md5 new file mode 100644 index 0000000..8720f01 --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-16.webm.md5 @@ -0,0 +1,18 @@ +2a137f70b7f610f91f592c6c023b8e78 vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0001.i420 +e4d8bb301558170f2ef17cca4e39972f vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0002.i420 +1e9af1587cde4f00f892ba433cdad896 vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0003.i420 +853893e9f1d4e996298095542ef54396 vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0004.i420 +3e45503efce23c56ea2b8229848e6abe vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0005.i420 +b571f9b90d4a19abf98db123fea52767 vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0006.i420 +c0e6f4285a89dece0689a9ad57c2dec1 vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0007.i420 +c177a93afb0662212bfbb0a311778d48 vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0008.i420 +eaf2249e33e2c36850b148218d4999ed vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0009.i420 +42eaa2744ad438956abea47b66074b38 vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0010.i420 +064a2807a8b2752897386c4d7c336eda vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0011.i420 +b788f1c1f03ee19f57e77e27dde01b6c vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0012.i420 +f40fe8a61dea8fe9b826f94905b42980 vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0013.i420 +47009f1b1816dcfa038778df8183ea98 vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0014.i420 +687a20dca6cd33460f87cbdca38e904f vp90-2-14-resize-fp-tiles-8-16.webm-3840x2160-0015.i420 +4b96a38f3f82dfcbf1abe015f233d547 vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0016.i420 +56d2d33f37a43673a10ac0262a7e45fc vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0017.i420 +db5a5e14c53c46827bf71f1bc1592114 vp90-2-14-resize-fp-tiles-8-16.webm-4096x2304-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-2.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-2.webm.md5 new file mode 100644 index 0000000..8914dfb --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-2.webm.md5 @@ -0,0 +1,18 @@ +2a137f70b7f610f91f592c6c023b8e78 vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0001.i420 +e4d8bb301558170f2ef17cca4e39972f vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0002.i420 +1e9af1587cde4f00f892ba433cdad896 vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0003.i420 +4c3f765f0f9e75ad4a96b8eb5e919e09 vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0004.i420 +60b88cfe3a2caedb603f9dc2dbce4cb3 vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0005.i420 +409769c464eb2173e2cd51e7a12b70c4 vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0006.i420 +c0e6f4285a89dece0689a9ad57c2dec1 vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0007.i420 +c177a93afb0662212bfbb0a311778d48 vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0008.i420 +eaf2249e33e2c36850b148218d4999ed vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0009.i420 +7dd8c74fdc13aad70eb47af83d3af009 vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0010.i420 +11118e1e669158722b77e14c572dfd4e vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0011.i420 +bc2a4dfba0fff3981e57a70155f9652e vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0012.i420 +f40fe8a61dea8fe9b826f94905b42980 vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0013.i420 +47009f1b1816dcfa038778df8183ea98 vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0014.i420 +687a20dca6cd33460f87cbdca38e904f vp90-2-14-resize-fp-tiles-8-2.webm-3840x2160-0015.i420 +824565e5f3e2e6b185e08ce816e6778e vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0016.i420 +d63df904df5c2bc05d1c044de670da7d vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0017.i420 +2b12d90a95abcd02435d286a5f3eff12 vp90-2-14-resize-fp-tiles-8-2.webm-848x480-0018.i420 diff --git a/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-4.webm.md5 b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-4.webm.md5 new file mode 100644 index 0000000..58c0a3e --- /dev/null +++ b/testdata/libvpx/vp90-2-14-resize-fp-tiles-8-4.webm.md5 @@ -0,0 +1,18 @@ +2a137f70b7f610f91f592c6c023b8e78 vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0001.i420 +e4d8bb301558170f2ef17cca4e39972f vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0002.i420 +1e9af1587cde4f00f892ba433cdad896 vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0003.i420 +4e2e14d1fbdff4b2c5336ce82cf79dd9 vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0004.i420 +a51f6f55a855f2a65c4d0162044739ad vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0005.i420 +13e9734d20beb04d4aa1cb73535575c8 vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0006.i420 +c0e6f4285a89dece0689a9ad57c2dec1 vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0007.i420 +c177a93afb0662212bfbb0a311778d48 vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0008.i420 +eaf2249e33e2c36850b148218d4999ed vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0009.i420 +3850a2ef0638e0f66e2c72ca5fc2bbee vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0010.i420 +49fbb5ab2fb89cc2c3afcbbb543b2ba2 vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0011.i420 +c88b3bad769c73b72a2bd192e1f11325 vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0012.i420 +f40fe8a61dea8fe9b826f94905b42980 vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0013.i420 +47009f1b1816dcfa038778df8183ea98 vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0014.i420 +687a20dca6cd33460f87cbdca38e904f vp90-2-14-resize-fp-tiles-8-4.webm-3840x2160-0015.i420 +892530f64abb38fe9b2a07b9ecc8ce79 vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0016.i420 +9b78d317dce71833e762d715bae9079f vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0017.i420 +dd644e83dc4892591ae460514026f278 vp90-2-14-resize-fp-tiles-8-4.webm-1280x720-0018.i420 diff --git a/testdata/libvpx/vp90-2-15-segkey.webm.md5 b/testdata/libvpx/vp90-2-15-segkey.webm.md5 new file mode 100644 index 0000000..809e25e --- /dev/null +++ b/testdata/libvpx/vp90-2-15-segkey.webm.md5 @@ -0,0 +1 @@ +d3805a0d832b9bdd69ad99d68490be7b vp90-2-15-segkey.webm-1280x720-0001.i420 diff --git a/testdata/libvpx/vp90-2-15-segkey_adpq.webm.md5 b/testdata/libvpx/vp90-2-15-segkey_adpq.webm.md5 new file mode 100644 index 0000000..e3ee4d7 --- /dev/null +++ b/testdata/libvpx/vp90-2-15-segkey_adpq.webm.md5 @@ -0,0 +1,150 @@ +d4f0e4b606ddb40b482aecb24cf3bc63 vp90-2-15-segkey_adpq.webm-1280x720-0001.i420 +692ec092bc5928fa6430d056e883759a vp90-2-15-segkey_adpq.webm-1280x720-0002.i420 +dad790df33430899fed98886a24b37e5 vp90-2-15-segkey_adpq.webm-1280x720-0003.i420 +7e66e793ac9462a40dd5b963fb62e667 vp90-2-15-segkey_adpq.webm-1280x720-0004.i420 +0d795c6e20f42f09aca0ddb9dffaa6e8 vp90-2-15-segkey_adpq.webm-1280x720-0005.i420 +0ef3739c4ab2c51f0ab8e290eadad77e vp90-2-15-segkey_adpq.webm-1280x720-0006.i420 +04a15f765960263c1b4a5a8822e17322 vp90-2-15-segkey_adpq.webm-1280x720-0007.i420 +116d518830c958bf46759fd79bc74198 vp90-2-15-segkey_adpq.webm-1280x720-0008.i420 +58ea67addab05825cc2e5f2ab99fca4b vp90-2-15-segkey_adpq.webm-1280x720-0009.i420 +590f6e5deea6dde21dc1098fa2017c2f vp90-2-15-segkey_adpq.webm-1280x720-0010.i420 +895479957b0882ccce4159782dee8deb vp90-2-15-segkey_adpq.webm-1280x720-0011.i420 +cc8e05afdfb6f9c7042fd6f9e9d49140 vp90-2-15-segkey_adpq.webm-1280x720-0012.i420 +3e47c556a63af90f1ca4609f97f25d2c vp90-2-15-segkey_adpq.webm-1280x720-0013.i420 +e5ca5dce8cbd39412db2fe219d6d2594 vp90-2-15-segkey_adpq.webm-1280x720-0014.i420 +c62b456e12230660d26eb7226f257d0c vp90-2-15-segkey_adpq.webm-1280x720-0015.i420 +e184c961b373de465d3242f32f7cf3ed vp90-2-15-segkey_adpq.webm-1280x720-0016.i420 +7466b91858f740fc28965a63effe05d6 vp90-2-15-segkey_adpq.webm-1280x720-0017.i420 +c8f06a3b1e471c4e7a9efd71a30dfe3b vp90-2-15-segkey_adpq.webm-1280x720-0018.i420 +d4fb95148963b2eaff0211ddc5117c13 vp90-2-15-segkey_adpq.webm-1280x720-0019.i420 +c646526b40277289520d47ed8ca3b644 vp90-2-15-segkey_adpq.webm-1280x720-0020.i420 +e441ae686fa444e4e3584543611043ba vp90-2-15-segkey_adpq.webm-1280x720-0021.i420 +68d707ef6909bfbc02dcbd9e392a04f6 vp90-2-15-segkey_adpq.webm-1280x720-0022.i420 +1ff285d17a26622b61bd2651754602b1 vp90-2-15-segkey_adpq.webm-1280x720-0023.i420 +c272192987e44e54e5335e6416bd15a5 vp90-2-15-segkey_adpq.webm-1280x720-0024.i420 +8f6f02572181eb4855dcd4c957e57d2e vp90-2-15-segkey_adpq.webm-1280x720-0025.i420 +baf03eb567fd092eeb6f08ff5e098350 vp90-2-15-segkey_adpq.webm-1280x720-0026.i420 +479c78bd3da0892b8d4e32c99ec4739f vp90-2-15-segkey_adpq.webm-1280x720-0027.i420 +d39a52f6e30ef10462bdef1006809e88 vp90-2-15-segkey_adpq.webm-1280x720-0028.i420 +d58395369806221efe9ba88513319d8a vp90-2-15-segkey_adpq.webm-1280x720-0029.i420 +459e77e83c510ee1d79bf069752d44e5 vp90-2-15-segkey_adpq.webm-1280x720-0030.i420 +438027c8eacb9c795f8267a151ef5a4e vp90-2-15-segkey_adpq.webm-1280x720-0031.i420 +ea6b73fb0d4b23ebbdaeb0267135d083 vp90-2-15-segkey_adpq.webm-1280x720-0032.i420 +48160c624d4d5050a4c8abcbe0edf4b2 vp90-2-15-segkey_adpq.webm-1280x720-0033.i420 +6fc6d5b4751cf137fc0204c0026f2503 vp90-2-15-segkey_adpq.webm-1280x720-0034.i420 +5ea20f6483fc5cde854313ed8288c7ca vp90-2-15-segkey_adpq.webm-1280x720-0035.i420 +dafa41fa3468f684ca5538593cd1a0de vp90-2-15-segkey_adpq.webm-1280x720-0036.i420 +b73d3336c83a27874e24b691c34c3421 vp90-2-15-segkey_adpq.webm-1280x720-0037.i420 +d0b0488a5871a49442746ac8ea1343bc vp90-2-15-segkey_adpq.webm-1280x720-0038.i420 +df6fe9cb354624b69908730f24f51b88 vp90-2-15-segkey_adpq.webm-1280x720-0039.i420 +a388b159a024ace9437976206e62473c vp90-2-15-segkey_adpq.webm-1280x720-0040.i420 +9007423410201a70b6997477ed9040f6 vp90-2-15-segkey_adpq.webm-1280x720-0041.i420 +7f7425cc018ad391e06b867f51d69513 vp90-2-15-segkey_adpq.webm-1280x720-0042.i420 +2ef51a3a15c627f803eee7f351cdfa4e vp90-2-15-segkey_adpq.webm-1280x720-0043.i420 +260cded2461ab87181d650c58a8a0656 vp90-2-15-segkey_adpq.webm-1280x720-0044.i420 +fdd7a93b5f25ec2b74d93736fa7bb475 vp90-2-15-segkey_adpq.webm-1280x720-0045.i420 +810bb95ef0221b50ef12c7d0a4740fec vp90-2-15-segkey_adpq.webm-1280x720-0046.i420 +f7eb4d63c16aebfeba4804c4e9c2c134 vp90-2-15-segkey_adpq.webm-1280x720-0047.i420 +a1ae94b85bced552e2c4f15ab5c5096d vp90-2-15-segkey_adpq.webm-1280x720-0048.i420 +4b7b9e460b4a4ceab5deb5c6876cea05 vp90-2-15-segkey_adpq.webm-1280x720-0049.i420 +514472399dc39fcc4e833e166b81ea8e vp90-2-15-segkey_adpq.webm-1280x720-0050.i420 +dca73ca76936d0a7eeb71c20955ea3a3 vp90-2-15-segkey_adpq.webm-1280x720-0051.i420 +927b185567b515a6bd102e1199ee1836 vp90-2-15-segkey_adpq.webm-1280x720-0052.i420 +63e1fffd59b77c53811d75a116fbac60 vp90-2-15-segkey_adpq.webm-1280x720-0053.i420 +5ca302497e81d564cfd455e2b606b262 vp90-2-15-segkey_adpq.webm-1280x720-0054.i420 +6e317d469ee664bc511a8286650f0b79 vp90-2-15-segkey_adpq.webm-1280x720-0055.i420 +d93e1909f3bdda983e0b3c73a8c51754 vp90-2-15-segkey_adpq.webm-1280x720-0056.i420 +836072cb1c4dc3dc32c935ba4ac3f716 vp90-2-15-segkey_adpq.webm-1280x720-0057.i420 +014e61666ba819260a25f09ae97768a8 vp90-2-15-segkey_adpq.webm-1280x720-0058.i420 +997fa6283e48ff017ce04041b9022fb9 vp90-2-15-segkey_adpq.webm-1280x720-0059.i420 +b2c35749c6b848601193c2eff7f0bdf1 vp90-2-15-segkey_adpq.webm-1280x720-0060.i420 +813e9f562ef53589afbfe7d73002c136 vp90-2-15-segkey_adpq.webm-1280x720-0061.i420 +be876a05cfc72fe6138e1c24b6e94c3f vp90-2-15-segkey_adpq.webm-1280x720-0062.i420 +2a33b99f67fe5579ddbd62bac085ae8a vp90-2-15-segkey_adpq.webm-1280x720-0063.i420 +8d374a1886861cfd9ca6f16a0aff1b6c vp90-2-15-segkey_adpq.webm-1280x720-0064.i420 +eff4e17b08c67a1663c8f1cc614bd94a vp90-2-15-segkey_adpq.webm-1280x720-0065.i420 +39e4d97460cf02ecfbc666e0413d7db1 vp90-2-15-segkey_adpq.webm-1280x720-0066.i420 +732f41606146dfb0c6a8cf130df969a8 vp90-2-15-segkey_adpq.webm-1280x720-0067.i420 +9b724b808bc26f21aaa32653185b2cf3 vp90-2-15-segkey_adpq.webm-1280x720-0068.i420 +e18598cb7ac70cdb5dea29b35ae5accb vp90-2-15-segkey_adpq.webm-1280x720-0069.i420 +afbcad9f7bad0b58a5bccdb8977a60fb vp90-2-15-segkey_adpq.webm-1280x720-0070.i420 +6ec24c40cd8a0cf2e15339ce4f60c232 vp90-2-15-segkey_adpq.webm-1280x720-0071.i420 +76616dbe8207235f6890360566f9e8df vp90-2-15-segkey_adpq.webm-1280x720-0072.i420 +49a5c751ed430e9bc41c3a3334295025 vp90-2-15-segkey_adpq.webm-1280x720-0073.i420 +f657e47dbbcc2a04e9e7b71ecd8451ff vp90-2-15-segkey_adpq.webm-1280x720-0074.i420 +8e85f3d26b26f26ccd804061d2f37bbb vp90-2-15-segkey_adpq.webm-1280x720-0075.i420 +5a9dd5c0390491cd21163da01dc21f4d vp90-2-15-segkey_adpq.webm-1280x720-0076.i420 +3cf88ad2d2d7ecf1223afa5d1b849317 vp90-2-15-segkey_adpq.webm-1280x720-0077.i420 +27385b23461b5f1c137c2f29354595ed vp90-2-15-segkey_adpq.webm-1280x720-0078.i420 +e6eacbe2890389c586f2936a75ab3509 vp90-2-15-segkey_adpq.webm-1280x720-0079.i420 +19a48ffafdcdb6fb1d6b9808daed2f86 vp90-2-15-segkey_adpq.webm-1280x720-0080.i420 +f8c9419d4944fb214e06a2c30a560d93 vp90-2-15-segkey_adpq.webm-1280x720-0081.i420 +3f3d3dd54e5aa6bd59af1be86ec9be3d vp90-2-15-segkey_adpq.webm-1280x720-0082.i420 +28be5316ed79dc47b6a142cef0c16ab7 vp90-2-15-segkey_adpq.webm-1280x720-0083.i420 +6fbed684bfe8dfd354210293d7eb4d0b vp90-2-15-segkey_adpq.webm-1280x720-0084.i420 +e60cd76f68c95f8b484d0b6424eea4cc vp90-2-15-segkey_adpq.webm-1280x720-0085.i420 +e05a0cf382f49039faddaffeff2cec16 vp90-2-15-segkey_adpq.webm-1280x720-0086.i420 +42ea736ebbfe50f1ebd460d71781e5d6 vp90-2-15-segkey_adpq.webm-1280x720-0087.i420 +80f78066700b6752bbc1a41390ddb482 vp90-2-15-segkey_adpq.webm-1280x720-0088.i420 +14671354929fcf10677b2ed2db3c8cb4 vp90-2-15-segkey_adpq.webm-1280x720-0089.i420 +96a7d68407f1a2c96bd3cafe0c696bf5 vp90-2-15-segkey_adpq.webm-1280x720-0090.i420 +2f2adb990cfa42229db987a668b19d38 vp90-2-15-segkey_adpq.webm-1280x720-0091.i420 +a8233951004e1bb0d0937435a517fad2 vp90-2-15-segkey_adpq.webm-1280x720-0092.i420 +6163e872c38adfde7b0c8891cbb2c969 vp90-2-15-segkey_adpq.webm-1280x720-0093.i420 +990165e0905fb80ccc29d2de062d4f9b vp90-2-15-segkey_adpq.webm-1280x720-0094.i420 +e6f3224c4c60098ee93fca870f8636b2 vp90-2-15-segkey_adpq.webm-1280x720-0095.i420 +8c561667345f932618f8b3aaa43ffde0 vp90-2-15-segkey_adpq.webm-1280x720-0096.i420 +1acb3999bacd483d1153beb43ee09772 vp90-2-15-segkey_adpq.webm-1280x720-0097.i420 +2a075c7bc49190df83b8285ee6e124d3 vp90-2-15-segkey_adpq.webm-1280x720-0098.i420 +890a134a3c77d9b64d83fe6d2def02de vp90-2-15-segkey_adpq.webm-1280x720-0099.i420 +d0b41422b89f03ffcbde7c85889ad2c2 vp90-2-15-segkey_adpq.webm-1280x720-0100.i420 +fdc4f855d70ef16ec9baeb05c3a73f44 vp90-2-15-segkey_adpq.webm-1280x720-0101.i420 +ed9f847a3b4280cfe306018825c76508 vp90-2-15-segkey_adpq.webm-1280x720-0102.i420 +5deb2536bba158c722bc0d909f45e611 vp90-2-15-segkey_adpq.webm-1280x720-0103.i420 +fc7880ca8680e03fb1978adce8066027 vp90-2-15-segkey_adpq.webm-1280x720-0104.i420 +6e1c351c6b102e9185f688a02190b87f vp90-2-15-segkey_adpq.webm-1280x720-0105.i420 +1f6169bf490ed1b4c391383f770fec02 vp90-2-15-segkey_adpq.webm-1280x720-0106.i420 +80ac3b673b1504fb1e88d883a91a539c vp90-2-15-segkey_adpq.webm-1280x720-0107.i420 +d2e7654f961ff3767c1e9e8558c2f20d vp90-2-15-segkey_adpq.webm-1280x720-0108.i420 +365368d813eb10c5adc53e47afeb414d vp90-2-15-segkey_adpq.webm-1280x720-0109.i420 +5f74f55478377dd31da91cf195332480 vp90-2-15-segkey_adpq.webm-1280x720-0110.i420 +827b7b3853ea3b1855583b59ed7b09c2 vp90-2-15-segkey_adpq.webm-1280x720-0111.i420 +2017c1a57a271308172bd84d3887d063 vp90-2-15-segkey_adpq.webm-1280x720-0112.i420 +d65b95c71db9972dc051bec7df19f85f vp90-2-15-segkey_adpq.webm-1280x720-0113.i420 +7243da9072729ffa75209a6699e77ac3 vp90-2-15-segkey_adpq.webm-1280x720-0114.i420 +112da8d27907ab6a66b030e9c8864e46 vp90-2-15-segkey_adpq.webm-1280x720-0115.i420 +e2837b6409de4bc6e71ff9eca8eab391 vp90-2-15-segkey_adpq.webm-1280x720-0116.i420 +567eba2ddb91a02665ac96fa10703f00 vp90-2-15-segkey_adpq.webm-1280x720-0117.i420 +474a99d56fce0e7e96ac3585b905956f vp90-2-15-segkey_adpq.webm-1280x720-0118.i420 +3087edb09f1ef2e63130b7c03e696028 vp90-2-15-segkey_adpq.webm-1280x720-0119.i420 +574f7328da31760ecf237617aebd7784 vp90-2-15-segkey_adpq.webm-1280x720-0120.i420 +c3a7669bb496bec766a74a800275ff6c vp90-2-15-segkey_adpq.webm-1280x720-0121.i420 +c0d87245a92e7140e6b729c26fe97a95 vp90-2-15-segkey_adpq.webm-1280x720-0122.i420 +467e33e84435fe64cb14653600ec5163 vp90-2-15-segkey_adpq.webm-1280x720-0123.i420 +1c7a5b2472c00e9dc63f679b51ead6a9 vp90-2-15-segkey_adpq.webm-1280x720-0124.i420 +8fb7197463cdae6c45437a73dcb4a3d8 vp90-2-15-segkey_adpq.webm-1280x720-0125.i420 +f352fee36f51536175b05b5ff5a3187a vp90-2-15-segkey_adpq.webm-1280x720-0126.i420 +ac1ed4392a38268a2495508245032d74 vp90-2-15-segkey_adpq.webm-1280x720-0127.i420 +b8179a306c4fbc6f207d15acaae92dfb vp90-2-15-segkey_adpq.webm-1280x720-0128.i420 +7f263b0fd68652d83b75d24cc11c89e8 vp90-2-15-segkey_adpq.webm-1280x720-0129.i420 +39e33d02a01247cefe19d8bf9fbdecae vp90-2-15-segkey_adpq.webm-1280x720-0130.i420 +49a4e89c9fcc66f7e6e679aee4af0852 vp90-2-15-segkey_adpq.webm-1280x720-0131.i420 +0af52a32e6d74694a0a1f12aa78293fe vp90-2-15-segkey_adpq.webm-1280x720-0132.i420 +fedde75a5c093ea12f0ed328da7350c9 vp90-2-15-segkey_adpq.webm-1280x720-0133.i420 +2ab788cf689fdbe8fbc74dde165605ad vp90-2-15-segkey_adpq.webm-1280x720-0134.i420 +682c2316cbd2e8a5e54edd1e9309a6c7 vp90-2-15-segkey_adpq.webm-1280x720-0135.i420 +f155e8fa47625f18dffea813a7070c71 vp90-2-15-segkey_adpq.webm-1280x720-0136.i420 +2611eb2b2da8f6995ac2159012ec540a vp90-2-15-segkey_adpq.webm-1280x720-0137.i420 +a1130a4ddf7dbd592e23001c4b98b3fc vp90-2-15-segkey_adpq.webm-1280x720-0138.i420 +84eef6f47bff223c6a0916c0688d2f7c vp90-2-15-segkey_adpq.webm-1280x720-0139.i420 +ccfab0b84c7fc59d850ac5cb8d36da41 vp90-2-15-segkey_adpq.webm-1280x720-0140.i420 +6866845dfb320ecd9c22444ca7e52c8b vp90-2-15-segkey_adpq.webm-1280x720-0141.i420 +3068ceb83ee4d047df3880c64754efd7 vp90-2-15-segkey_adpq.webm-1280x720-0142.i420 +7f9a74e20cfe10972961e7f21529f7f4 vp90-2-15-segkey_adpq.webm-1280x720-0143.i420 +29156833963ec7f218d38fca7df132bf vp90-2-15-segkey_adpq.webm-1280x720-0144.i420 +f8feb4c2ae1ce371fc8b4a83d7dc34e0 vp90-2-15-segkey_adpq.webm-1280x720-0145.i420 +0e5fe8965da239c17b02f0c902feeaec vp90-2-15-segkey_adpq.webm-1280x720-0146.i420 +e8d37eb1b8c2576658ebc58a7cc6c0d4 vp90-2-15-segkey_adpq.webm-1280x720-0147.i420 +0a89fd2784112bbd54eb559a8272ab1e vp90-2-15-segkey_adpq.webm-1280x720-0148.i420 +342bc99cdd618272d12d045698b9cb20 vp90-2-15-segkey_adpq.webm-1280x720-0149.i420 +a489a32bb43559b8a1989b13660e3cf6 vp90-2-15-segkey_adpq.webm-1280x720-0150.i420 diff --git a/testdata/libvpx/vp90-2-16-intra-only.webm.md5 b/testdata/libvpx/vp90-2-16-intra-only.webm.md5 new file mode 100644 index 0000000..112a52a --- /dev/null +++ b/testdata/libvpx/vp90-2-16-intra-only.webm.md5 @@ -0,0 +1,7 @@ +d57529601178948afa4818c3c8938884 vp90-2-16-intra-only-352x288-0001.i420 +d47e00250c45733d64af067a417bcd06 vp90-2-16-intra-only-352x288-0002.i420 +984e41cd8350808ac6129746b2377818 vp90-2-16-intra-only-352x288-0003.i420 +a5fa62996b4bb52e72e335722cf55bef vp90-2-16-intra-only-352x288-0004.i420 +b71ca5ad650170ac921a71a6440fb508 vp90-2-16-intra-only-352x288-0005.i420 +76ba63001170b8992fc72be5c4ace731 vp90-2-16-intra-only-352x288-0006.i420 +c4e7f96a8fd58d901b1d881926ddae09 vp90-2-16-intra-only-352x288-0007.i420 diff --git a/testdata/libvpx/vp90-2-17-show-existing-frame.webm.md5 b/testdata/libvpx/vp90-2-17-show-existing-frame.webm.md5 new file mode 100644 index 0000000..50394da --- /dev/null +++ b/testdata/libvpx/vp90-2-17-show-existing-frame.webm.md5 @@ -0,0 +1,30 @@ +b71ca5ad650170ac921a71a6440fb508 vp90-2-17-show-existing-frame.webm-352x288-0001.i420 +edc30ba14b73198ca827c1b216957dec vp90-2-17-show-existing-frame.webm-352x288-0002.i420 +1902c5b3a82f6bdeb80a5b053909df04 vp90-2-17-show-existing-frame.webm-352x288-0003.i420 +9a96e33ed546d7961c6e5bc48244a5c7 vp90-2-17-show-existing-frame.webm-352x288-0004.i420 +b02a48630b0f3c08c61dd2518b55ea39 vp90-2-17-show-existing-frame.webm-352x288-0005.i420 +8ac9cec1101a46bf4ba20191b7ba3f07 vp90-2-17-show-existing-frame.webm-352x288-0006.i420 +88ea8c3cb9eca47152b5d22435a06675 vp90-2-17-show-existing-frame.webm-352x288-0007.i420 +bff3406209ec0d592a891dff2b58d6cd vp90-2-17-show-existing-frame.webm-352x288-0008.i420 +b71ca5ad650170ac921a71a6440fb508 vp90-2-17-show-existing-frame.webm-352x288-0009.i420 +edc30ba14b73198ca827c1b216957dec vp90-2-17-show-existing-frame.webm-352x288-0010.i420 +1902c5b3a82f6bdeb80a5b053909df04 vp90-2-17-show-existing-frame.webm-352x288-0011.i420 +9a96e33ed546d7961c6e5bc48244a5c7 vp90-2-17-show-existing-frame.webm-352x288-0012.i420 +b02a48630b0f3c08c61dd2518b55ea39 vp90-2-17-show-existing-frame.webm-352x288-0013.i420 +8ac9cec1101a46bf4ba20191b7ba3f07 vp90-2-17-show-existing-frame.webm-352x288-0014.i420 +88ea8c3cb9eca47152b5d22435a06675 vp90-2-17-show-existing-frame.webm-352x288-0015.i420 +bff3406209ec0d592a891dff2b58d6cd vp90-2-17-show-existing-frame.webm-352x288-0016.i420 +b71ca5ad650170ac921a71a6440fb508 vp90-2-17-show-existing-frame.webm-352x288-0017.i420 +edc30ba14b73198ca827c1b216957dec vp90-2-17-show-existing-frame.webm-352x288-0018.i420 +1902c5b3a82f6bdeb80a5b053909df04 vp90-2-17-show-existing-frame.webm-352x288-0019.i420 +9a96e33ed546d7961c6e5bc48244a5c7 vp90-2-17-show-existing-frame.webm-352x288-0020.i420 +b02a48630b0f3c08c61dd2518b55ea39 vp90-2-17-show-existing-frame.webm-352x288-0021.i420 +8ac9cec1101a46bf4ba20191b7ba3f07 vp90-2-17-show-existing-frame.webm-352x288-0022.i420 +88ea8c3cb9eca47152b5d22435a06675 vp90-2-17-show-existing-frame.webm-352x288-0023.i420 +bff3406209ec0d592a891dff2b58d6cd vp90-2-17-show-existing-frame.webm-352x288-0024.i420 +a36428fd889ddf9983638c581c1d9146 vp90-2-17-show-existing-frame.webm-352x288-0025.i420 +689bd5fba1b7dff9abb1332e56f224fa vp90-2-17-show-existing-frame.webm-352x288-0026.i420 +e883aa425fa13c6d4eda2707d114d61d vp90-2-17-show-existing-frame.webm-352x288-0027.i420 +94d0bce08beb8a19c4ae12194a646935 vp90-2-17-show-existing-frame.webm-352x288-0028.i420 +cd317e97f5fd4be166308911c874f4e1 vp90-2-17-show-existing-frame.webm-352x288-0029.i420 +2fa245acd72d377cbb79c08faa02b330 vp90-2-17-show-existing-frame.webm-352x288-0030.i420 diff --git a/testdata/libvpx/vp90-2-18-resize.ivf.md5 b/testdata/libvpx/vp90-2-18-resize.ivf.md5 new file mode 100644 index 0000000..ede2061 --- /dev/null +++ b/testdata/libvpx/vp90-2-18-resize.ivf.md5 @@ -0,0 +1,100 @@ +a49e03a55c3e332d43c5f1895a537a11 vp90-2-06-resize.ivf-310x230-0001.i420 +7ae0caf3f1f50074aa4e8a3a9e34f43e vp90-2-06-resize.ivf-310x230-0002.i420 +af9b26d50d047c70023fb19c695fb040 vp90-2-06-resize.ivf-310x230-0003.i420 +19a078fb090766647acafc48e9ce5a8a vp90-2-06-resize.ivf-248x138-0004.i420 +67c9cfa6c77794ace04b780f105f094d vp90-2-06-resize.ivf-248x138-0005.i420 +34cf5183d1e95dc48cae7b805cf70a91 vp90-2-06-resize.ivf-248x138-0006.i420 +164f72e4b602b0ac188d0eb0ab1744b7 vp90-2-06-resize.ivf-310x230-0007.i420 +d6cc2489cb3a7cd6c8d098a780927f35 vp90-2-06-resize.ivf-310x230-0008.i420 +8cf5289f7fd5fbcac823c17f62fbd10b vp90-2-06-resize.ivf-310x230-0009.i420 +8c48b724ea5af4aae80e8a7be97d2edb vp90-2-06-resize.ivf-155x115-0010.i420 +384cbd1894fb1bf31756b79a56beaf6a vp90-2-06-resize.ivf-155x115-0011.i420 +8bd173b98530b307265c4f18fb0eb140 vp90-2-06-resize.ivf-155x115-0012.i420 +10496711a5535d8def648d3c833dc159 vp90-2-06-resize.ivf-155x115-0013.i420 +47dbe9ca958d8be19625934751d86d68 vp90-2-06-resize.ivf-155x115-0014.i420 +cce2889825a09ed4cddb71a4536d18ac vp90-2-06-resize.ivf-155x115-0015.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0016.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0017.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0018.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0019.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0020.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0021.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0022.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0023.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0024.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0025.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0026.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0027.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0028.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0029.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0030.i420 +dc327b82c46b429a4f1f5ab23e9db944 vp90-2-06-resize.ivf-155x115-0031.i420 +4ad3d940316f321792879f882d4e7950 vp90-2-06-resize.ivf-155x115-0032.i420 +fb8f952db157a8e0caa0141c8aa83e8b vp90-2-06-resize.ivf-155x115-0033.i420 +97919d5c2c53d0db019deb8b79ae873e vp90-2-06-resize.ivf-155x115-0034.i420 +477dd5ca868f6950804e619d06b41e85 vp90-2-06-resize.ivf-155x115-0035.i420 +dabf490c262e2477d6c50e476b5c98fe vp90-2-06-resize.ivf-155x115-0036.i420 +327f11f2800a34a03feece37752b4a12 vp90-2-06-resize.ivf-155x115-0037.i420 +efe1c7b208a33139d7b9364bd7de7619 vp90-2-06-resize.ivf-155x115-0038.i420 +b5430760c00ef2c8685871416b4af297 vp90-2-06-resize.ivf-155x115-0039.i420 +15713e82a412fd98cdeeee10e4d52441 vp90-2-06-resize.ivf-155x115-0040.i420 +3039d91c48187aa8424cd634b5cdbb7e vp90-2-06-resize.ivf-155x115-0041.i420 +42a28bb97ab36dd24467814ac5a506dc vp90-2-06-resize.ivf-155x115-0042.i420 +24624574feb37f32b1cc4d8258e8677b vp90-2-06-resize.ivf-155x115-0043.i420 +2580cf1a0389aa4832b51ce9812457f2 vp90-2-06-resize.ivf-155x115-0044.i420 +7ec7511a5be36033e3bf694fe9802aaa vp90-2-06-resize.ivf-155x115-0045.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0046.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0047.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0048.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0049.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0050.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0051.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0052.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0053.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0054.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0055.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0056.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0057.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0058.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0059.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0060.i420 +931ea248ad0123d9d14ece05db24d5bc vp90-2-06-resize.ivf-155x115-0061.i420 +21a24132abac7a71fb08bc096db350ae vp90-2-06-resize.ivf-155x115-0062.i420 +6a3518e4b85683fe3a8ed1fcc164c6c7 vp90-2-06-resize.ivf-155x115-0063.i420 +a48393ef7940b47a48d14bc2d872cfd0 vp90-2-06-resize.ivf-155x115-0064.i420 +7c9273fe9509d012080590486487237f vp90-2-06-resize.ivf-155x115-0065.i420 +55555aec6f8934c7777a251253bfdab0 vp90-2-06-resize.ivf-155x115-0066.i420 +d6f8427d142568a0b0fbb6b385419fd5 vp90-2-06-resize.ivf-155x115-0067.i420 +5d1a8102658fc40f217481c1fecdc39b vp90-2-06-resize.ivf-155x115-0068.i420 +456835497950fed8d599423376ccbc0c vp90-2-06-resize.ivf-155x115-0069.i420 +97297f52535460848c4a0512eaf380f9 vp90-2-06-resize.ivf-155x115-0070.i420 +4a48290df6e8c4f949a4ab10c141518d vp90-2-06-resize.ivf-155x115-0071.i420 +ad5d472ef2d4891b3999900f09da1d4b vp90-2-06-resize.ivf-155x115-0072.i420 +2c56d62987e6f0c50049cd627e4f05d0 vp90-2-06-resize.ivf-155x115-0073.i420 +5ad4f28816812de060ad671030112f98 vp90-2-06-resize.ivf-155x115-0074.i420 +2558a04c2f8ab9e3cc7e387cb704db1e vp90-2-06-resize.ivf-155x115-0075.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0076.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0077.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0078.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0079.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0080.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0081.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0082.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0083.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0084.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0085.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0086.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0087.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0088.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0089.i420 +6966aa213cc5321a2a68697edcc1962d vp90-2-06-resize.ivf-155x115-0090.i420 +762c27507fb173db3ba28714ec2241f8 vp90-2-06-resize.ivf-155x115-0091.i420 +6e505052a32ffe5f48fbad24258f7036 vp90-2-06-resize.ivf-155x115-0092.i420 +a9af41b5d83e58956f477a05f6dfe767 vp90-2-06-resize.ivf-155x115-0093.i420 +7a0a839d4afdbf956bc8b92e15f9f548 vp90-2-06-resize.ivf-155x115-0094.i420 +3bc0615845b22af1d9b7f51b57fe22b3 vp90-2-06-resize.ivf-155x115-0095.i420 +2df11907e04a749f49ba753f42a1e9cd vp90-2-06-resize.ivf-155x115-0096.i420 +2e8f8ff8c48ddbe1036cad3bf4adc9c9 vp90-2-06-resize.ivf-155x115-0097.i420 +5483d04361b52c1012fa8060f6bb4c7b vp90-2-06-resize.ivf-155x115-0098.i420 +f67d1ca015ce30e6f8db7efbd3ece7bd vp90-2-06-resize.ivf-155x115-0099.i420 +c800f7382e976e924937363cc8641a2c vp90-2-06-resize.ivf-155x115-0100.i420 diff --git a/testdata/libvpx/vp90-2-19-skip-01.webm.md5 b/testdata/libvpx/vp90-2-19-skip-01.webm.md5 new file mode 100644 index 0000000..98fdce2 --- /dev/null +++ b/testdata/libvpx/vp90-2-19-skip-01.webm.md5 @@ -0,0 +1,60 @@ +6e350ec33af4ce08c18e884d7fd795aa 01.yuv +abfb6e52a5a9d896b65e2c54e1f35f20 02.yuv +e40e57536810c196f277f2d86fd7ef4d 03.yuv +0b25dbe7b8218fcc67e700d332ef7ad7 04.yuv +20f7737828b9a686a02a1b01cebb637f 05.yuv +06d41fe61fbd8d96750882baac56954f 06.yuv +9e6661eb3424978e105dfa393407c293 07.yuv +2d9dd8d9625dc67cb342b9db51a9bf85 08.yuv +d8d8671e8e921484acd0fd67c7046382 09.yuv +f6513fee6d2de65d51239a689f45f1d6 10.yuv +5a8c26cbe9cefc79481a1e24c36d1b07 11.yuv +918c1080ca4f2d61049caaa963d58069 12.yuv +9d028868e407a2a596ede1c7ec71997c 13.yuv +0bf06f2b16acc2c9691953d0ba134e7b 14.yuv +f340480004fd45b579bfa04487c94136 15.yuv +a6ab04e5c72ab3612842e891644ef2f2 16.yuv +cf5da560e869a73ac6dc37ff1812b14e 17.yuv +4b9e24121a05b7f95e4c2ed5dc25aac9 18.yuv +5e7c43edbf51d19cae31e348920e5848 19.yuv +96e421b17ce7fea2428ea1fe8f7b500a 20.yuv +0e2b1ef0e3d1cf4a2af7dd7cbb160f04 21.yuv +bdcc399223320df2fab20bf365e4f3df 22.yuv +26cf7f3d9c3e36c6d2f8af6e1c9f9b15 23.yuv +d2ef6d0dfd7eca3d77b60f9c82191bf3 24.yuv +76c07306ce9a627f37a6a5c8d66820a2 25.yuv +7ee2428a7fbc3c88418167a8e52d438d 26.yuv +68b267345e01d2fc72576f984f757a3c 27.yuv +541bfb03ae1db20d693a0a92550e8df6 28.yuv +e87cf619aefdb81e26a8ec70d6a12c2c 29.yuv +621f1ed3976088b247d79504bdf03ca3 30.yuv +2c6023819babc72f8ad936ec0f0ca85e 31.yuv +9f5eae1311cfdd2c02ee63a978b8d6d2 32.yuv +902112ada88fbd3fe006b713cf08f5aa 33.yuv +ab5b451f7174520c57b096268272759c 34.yuv +b686cba2b4c454de4e8e16f088db8354 35.yuv +a68e934aa397819bb80bf4bd29134103 36.yuv +6982347a3aa730c2f8a15c94bfb42b3d 37.yuv +57c3f83402184dd80beb9f78f0c5cfc8 38.yuv +adf66470bfdb88a860a17b74d0f5e99b 39.yuv +e98d09d8d34d3c8d1cb6619794b1ed5b 40.yuv +f839dce9aabf7db8b007d83766e05fa7 41.yuv +3bad23fa7f6052582e319b9774e26030 42.yuv +4220ba420816a3bc7030e1582942e74d 43.yuv +f404671eaf5310565d0831684ff0f3ba 44.yuv +8ba48a53a0178bcd596b880c8a96a61f 45.yuv +7a8fbb7356e494a6cefe52c2b07e6dce 46.yuv +fb7974be2a11fcfc71cc450727bf71ad 47.yuv +5c9be4d4acac0b375be851cd3774a918 48.yuv +83c84c97c9c5efd6dd56668cdbf18428 49.yuv +626c9ab1e52f7d9c711e142b46e82a42 50.yuv +8012dbe193dfa5d787445eaeecd9091b 51.yuv +bc36350c60b92f77473158a9249d5383 52.yuv +4e81e00620020b4c55f273796f023145 53.yuv +f6161f425f0476821f8caa46360d87af 54.yuv +509f724002e54baac7dd37b514c345da 55.yuv +4ab2368ffa3854f433fd568883db0e55 56.yuv +9934a8d1ae0bdd65aab070efa91ac778 57.yuv +2f2c1b110107c1141053513f2596a599 58.yuv +9da6ca6ef375a095f0c86cb8cb41db74 59.yuv +125c735dc1fb523c8088e0815cd4cde1 60.yuv diff --git a/testdata/libvpx/vp90-2-19-skip-02.webm.md5 b/testdata/libvpx/vp90-2-19-skip-02.webm.md5 new file mode 100644 index 0000000..80b3d65 --- /dev/null +++ b/testdata/libvpx/vp90-2-19-skip-02.webm.md5 @@ -0,0 +1,12 @@ +1ee94a4b059cd7380dabf71553aedf32 vp90-2-19-skip-02.webm-208x144-0001.i420 +d86167bfd6bca76c476c79361894a3f0 vp90-2-19-skip-02.webm-208x144-0002.i420 +421c9cd3b3474af8893fa44832b6fca7 vp90-2-19-skip-02.webm-208x144-0003.i420 +db0585dc48220105b8a3326222a66292 vp90-2-19-skip-02.webm-208x144-0004.i420 +15e5a53f39d7e350d356b0c4b2be4c82 vp90-2-19-skip-02.webm-208x144-0005.i420 +4d35f23245c90b5c0f013b4b2a085b2a vp90-2-19-skip-02.webm-208x144-0006.i420 +1e46a9945accfec93e345f50ebb520a0 vp90-2-19-skip-02.webm-208x144-0007.i420 +ea53419be2de85e9505aaed3a03a10e0 vp90-2-19-skip-02.webm-208x144-0008.i420 +14c17560d0690e929a40b6f2e46a458a vp90-2-19-skip-02.webm-208x144-0009.i420 +7c5eb58b81b57530391717a076114728 vp90-2-19-skip-02.webm-208x144-0010.i420 +57d4952e50ba519388ce7efca7ee505b vp90-2-19-skip-02.webm-208x144-0011.i420 +7bb3d99c86e135354ad437e5d80bf089 vp90-2-19-skip-02.webm-208x144-0012.i420 diff --git a/testdata/libvpx/vp90-2-19-skip.webm.md5 b/testdata/libvpx/vp90-2-19-skip.webm.md5 new file mode 100644 index 0000000..472b59a --- /dev/null +++ b/testdata/libvpx/vp90-2-19-skip.webm.md5 @@ -0,0 +1,60 @@ +6e350ec33af4ce08c18e884d7fd795aa 01.yuv +3f77603d7a5727db4017202310da1724 02.yuv +983aae5424ab39af07adcf78d43a23ba 03.yuv +a0cdeaa0eb6eda3750d268434391a7ab 04.yuv +64325c99444e566989c6eeaa8ffeee32 05.yuv +8320f52b7fcd0565465941c50a01b801 06.yuv +d6bb76bf65b70b86bda891fe807fcd26 07.yuv +c44b46422d2be0b831d27fab61a0d374 08.yuv +414ce4220e0aef53cb5966990ae00bb6 09.yuv +2bf82867941dc68b0d60cede97f2d4d7 10.yuv +593c676743ffaf1a5be85d74529dbb3f 11.yuv +ccac5f0992545c35d227a021cb91b6f6 12.yuv +bbb637aaed37f7cc6068802531152b77 13.yuv +41e2d71a3ff3ed9d225348eb6be72853 14.yuv +7ed3f76508059c281f75e2043d7d6677 15.yuv +ed330eefed85685bed2bc1c5dc409d24 16.yuv +61c4c435237e06623b6994f43b469833 17.yuv +1e27f96fe683a654b228360f7a1beee1 18.yuv +090e025ec148ec53f802cdb8ed0bfd77 19.yuv +20d0caa6d4ab9db05869fd0532a2265f 20.yuv +e11d108db8822b07a6fe8216b34fa259 21.yuv +bdb3421bffee6eeafa00255ffcdcf1fe 22.yuv +cb090c2f2d28679d1e2eb2c04150d751 23.yuv +7f8eec67552bbac654f9a374d7a985ca 24.yuv +5c039c621c9c20947f75b98b7e579ce8 25.yuv +464be7de183b98138d8e9fb61ef613ec 26.yuv +b887a102c6399d33307ac434d0ab3fd4 27.yuv +e8fa163067c77e27b9089b4a48b444c0 28.yuv +d92e13465475df261f9469171ac962cc 29.yuv +8e6a8ba99387bc4cf7aee0aab6d132f4 30.yuv +4625d7b6b23ddc840941a4f4d7739daa 31.yuv +3b8533887142da49fdb24569dd34c2ac 32.yuv +9ff94cefac26936cbf284e7482b2433d 33.yuv +68b2fec46494c24501e48927fe9636e5 34.yuv +7d76bfa0ebb09f27482288a0d61cd0e8 35.yuv +27b630a10fc1790884e16bbb0fef37ee 36.yuv +322de7f87166725fdd48373b28156593 37.yuv +d73c7bd37eccd47df4a5b27cecbb8cea 38.yuv +c3679a0317d1efc2b76e3dd97baa4070 39.yuv +e3f9523bd41a280b922cdcf188911de2 40.yuv +b57f28d944f4f39ab9c97a5ae8e3beda 41.yuv +520a2b794f4384cf4c38f8d4c5b9c7bb 42.yuv +bc215f65a73183da31b4bd896db178b4 43.yuv +ab3c86d15728db474a45c544c2103745 44.yuv +1287678d28e400a47a4f21b8854339d7 45.yuv +be3f1eb3f48706e4e37aff83f0434fab 46.yuv +dbc71f50dd620e058da88c414041ca57 47.yuv +3d68bf9ae1e6065bf70eee87fbb9a2ce 48.yuv +c901fac66677a4be1b624d6995af1ea3 49.yuv +0756c5dd31c691df91a535910d8756e0 50.yuv +b9c30e56f000a71148ababdf7c7bbae3 51.yuv +2dc2917b1c0e498dd8e83abcdc48e3ca 52.yuv +057ce1fe6eb8800ec8ec47720e70ed74 53.yuv +1c25a6c9e182fa7fbef473ad9be476ea 54.yuv +3ae770d42403b5069d0fa97e11cec3b0 55.yuv +e5c19d46df1c711a650229867073246c 56.yuv +cfc5f6cbb0a319d8bfb3feffddbb8f48 57.yuv +86e42a5e03bc537505589f7fa39bff2b 58.yuv +cdf32bda09d594763068d6fa0ff67b98 59.yuv +0d6be7f95a7e3941950f14e20be11020 60.yuv diff --git a/testdata/libvpx/vp90-2-20-big_superframe-01.webm.md5 b/testdata/libvpx/vp90-2-20-big_superframe-01.webm.md5 new file mode 100644 index 0000000..4fe4dcc --- /dev/null +++ b/testdata/libvpx/vp90-2-20-big_superframe-01.webm.md5 @@ -0,0 +1,13 @@ +b5d461894f957709576d15f6dce3d69e vp90-2-20-big_superframe-01.webm-352x288-0001.i420 +b14448e30621b5d2d0a18c2e12ef0d95 vp90-2-20-big_superframe-01.webm-352x288-0002.i420 +4584cf6ffe6ca91fa3926cb88b6dab2d vp90-2-20-big_superframe-01.webm-352x288-0003.i420 +ff83dd3c0dfdd8740523f560a9d7abfe vp90-2-20-big_superframe-01.webm-352x288-0004.i420 +a2a1dc9b91b0e4fd6ecc8fa53a156ed9 vp90-2-20-big_superframe-01.webm-352x288-0005.i420 +13f953ae1cfa25c5996d77fc88070452 vp90-2-20-big_superframe-01.webm-352x288-0006.i420 +81dd4bdf32f7998fdc221a4612e022ce vp90-2-20-big_superframe-01.webm-352x288-0007.i420 +518bbee70ad6488ea3d69e0e34a133a4 vp90-2-20-big_superframe-01.webm-352x288-0008.i420 +acae8f0ab72c6daa3a280fa41fbbb22e vp90-2-20-big_superframe-01.webm-352x288-0009.i420 +fbfb93207c09242ee49637e740f3f870 vp90-2-20-big_superframe-01.webm-352x288-0010.i420 +20b072932f592e67d92cb67b224620b1 vp90-2-20-big_superframe-01.webm-352x288-0011.i420 +ddab6752606406c5b25d4e3b3208e381 vp90-2-20-big_superframe-01.webm-352x288-0012.i420 +6525d6826964e8b54fa982a300088ce3 vp90-2-20-big_superframe-01.webm-352x288-0013.i420 diff --git a/testdata/libvpx/vp90-2-20-big_superframe-02.webm.md5 b/testdata/libvpx/vp90-2-20-big_superframe-02.webm.md5 new file mode 100644 index 0000000..8ca8576 --- /dev/null +++ b/testdata/libvpx/vp90-2-20-big_superframe-02.webm.md5 @@ -0,0 +1,18 @@ +b5d461894f957709576d15f6dce3d69e vp90-2-20-big_superframe-02.webm-352x288-0001.i420 +54e45dfe575d9843c198270f62154c09 vp90-2-20-big_superframe-02.webm-352x288-0002.i420 +87749847c291a46c0ae0ca5d5002cb5f vp90-2-20-big_superframe-02.webm-352x288-0003.i420 +04d7f341b081b35fd14ddfd777607fb1 vp90-2-20-big_superframe-02.webm-352x288-0004.i420 +81c73e1129b94936d53d33f8c66588e9 vp90-2-20-big_superframe-02.webm-352x288-0005.i420 +678b99102426df6a69184acc142c0c6a vp90-2-20-big_superframe-02.webm-352x288-0006.i420 +a91f8d509a3e853e71b78b7ebe162428 vp90-2-20-big_superframe-02.webm-352x288-0007.i420 +9981ac3b4b78627c4474222823a9b288 vp90-2-20-big_superframe-02.webm-352x288-0008.i420 +400adf7ab42c47954db9086b5fcb2ef8 vp90-2-20-big_superframe-02.webm-352x288-0009.i420 +fc917ebef7115a04f0bf4e06e1e1a2a9 vp90-2-20-big_superframe-02.webm-352x288-0010.i420 +72271e7946c9dd99a947df787caaadfe vp90-2-20-big_superframe-02.webm-352x288-0011.i420 +acb81daaaa35d651a87a9f8e87f813b3 vp90-2-20-big_superframe-02.webm-352x288-0012.i420 +e6ffc22ab1a918e3f1af384f0dd22ff9 vp90-2-20-big_superframe-02.webm-352x288-0013.i420 +3ecbc78c737312948d8c172d1c2d2383 vp90-2-20-big_superframe-02.webm-352x288-0014.i420 +320edb7fddfe8c98e616702d11f8f456 vp90-2-20-big_superframe-02.webm-352x288-0015.i420 +cf8363cebf34bdefd2c8e2178de5ef23 vp90-2-20-big_superframe-02.webm-352x288-0016.i420 +d15c8f1bc21ad09ad881a59b5f2b8167 vp90-2-20-big_superframe-02.webm-352x288-0017.i420 +c5c9f8b1826fac50655ed1454ae78279 vp90-2-20-big_superframe-02.webm-352x288-0018.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1280x720_5_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_5_1-2.webm.md5 new file mode 100644 index 0000000..0a0bb53 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_5_1-2.webm.md5 @@ -0,0 +1,30 @@ +7e0f316ed40bd18c3d5f3ad8b5b4f6f7 vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0001.i420 +7ca195fe6c0475d032b2364a16eb7660 vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0002.i420 +2a48c9acf5624bbaf077eb67e873eeb1 vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0003.i420 +1c572487ed416a960bfc297fc72d7575 vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0004.i420 +2b5a15324d833a567f28b882a4ff4a32 vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0005.i420 +63030e136c86a0d18aab363961e916fa vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0006.i420 +2db2eab81fb67da0aafc69fc966f6fb0 vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0007.i420 +2e2a33127c2a3b950f0d22625f6f011a vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0008.i420 +85ca2de7dc5a15ff9aa2cab0bdfab3ea vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0009.i420 +9188b65af629b529630c9d47b23dfef3 vp90-2-21-resize_inter_1280x720_5_1-2.webm-1280x720-0010.i420 +4e6b24f3be3beac0470e7a7ba7d608d4 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0011.i420 +3060089626eac4944bdcc003723636c3 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0012.i420 +e0a5f4eeffe85a5f65e682397f99d434 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0013.i420 +1a2f926baeda65d532179566f0170223 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0014.i420 +1485e057ded217bf7f56d59e51f3a552 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0015.i420 +a2268eef9a77dc0680d0d37c1138fbc7 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0016.i420 +982f8f0e8982b6b6be55636b736f368c vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0017.i420 +b9bb2be029a50d739a038bbcfb1dd614 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0018.i420 +271e55336a09ccd678594548ce37f522 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0019.i420 +bb137f36952ac7b70bfb818c68971eba vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0020.i420 +4865155973807b8a92c8933473d994e0 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0021.i420 +e09b432ca54e3ba7cf428788c59e449b vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0022.i420 +fffed7ec6d402881a877042c7e86e391 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0023.i420 +6c24fd04427e77c8c2b5b6ecfc6041b7 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0024.i420 +65c35aef40f2c3a5c5305d864beef5a7 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0025.i420 +4dcb72ed61ebfbed866c66f897ffbe4f vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0026.i420 +d83b40f8afe2ade6b7003b803373f235 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0027.i420 +38b6a6e9566baedca8b4cc1ab8752656 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0028.i420 +da8d288cef0b994a9fc4fbd44b4a963e vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0029.i420 +377457040bcba24f5675cac12973c818 vp90-2-21-resize_inter_1280x720_5_1-2.webm-640x360-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1280x720_5_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_5_3-4.webm.md5 new file mode 100644 index 0000000..7e78468 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_5_3-4.webm.md5 @@ -0,0 +1,30 @@ +7e0f316ed40bd18c3d5f3ad8b5b4f6f7 vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0001.i420 +7ca195fe6c0475d032b2364a16eb7660 vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0002.i420 +2a48c9acf5624bbaf077eb67e873eeb1 vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0003.i420 +1c572487ed416a960bfc297fc72d7575 vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0004.i420 +2b5a15324d833a567f28b882a4ff4a32 vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0005.i420 +63030e136c86a0d18aab363961e916fa vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0006.i420 +2db2eab81fb67da0aafc69fc966f6fb0 vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0007.i420 +2e2a33127c2a3b950f0d22625f6f011a vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0008.i420 +85ca2de7dc5a15ff9aa2cab0bdfab3ea vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0009.i420 +9188b65af629b529630c9d47b23dfef3 vp90-2-21-resize_inter_1280x720_5_3-4.webm-1280x720-0010.i420 +7995cce4983b113a100dddec9db1d359 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0011.i420 +1dc32c7f00ea0f560a8bbbbe9a92f2fb vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0012.i420 +ff10227ba06dc58832d831b4a98c2c6e vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0013.i420 +2c02ea4770cdb3992e1d7145c79646fb vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0014.i420 +31c71fe6b84862a58372a2958e416ef6 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0015.i420 +e02871d359b303af121aab75a4c60a57 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0016.i420 +a58fe76613f3ae697a83fd47d7744283 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0017.i420 +51eb152056866ea37afc019240570747 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0018.i420 +f6810fda2876b3f836a2a37d365f2b0f vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0019.i420 +90ea91f972f12fcbcac4130c5c52f646 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0020.i420 +29222d50bfb628bd89c76425b2843d6e vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0021.i420 +2514f8793cb8d79176773e32ffd63aa3 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0022.i420 +d864a9017883dd3f1f5e960ea3031da2 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0023.i420 +a3e73634323661d697614eaffdd8d74f vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0024.i420 +c5fd45c867427334a782e788d7f9c44f vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0025.i420 +476589910c0cf0162d91fd2decd3bfba vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0026.i420 +46eadb17b4e0a9b8f6a2f4d17eca92c5 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0027.i420 +25bc6dcb798b3efd3fb25a5ea82dcab2 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0028.i420 +cc40120125ec34f0b36e497bc2d89de3 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0029.i420 +b2d44abc665cc7e87509f3b7064e6e94 vp90-2-21-resize_inter_1280x720_5_3-4.webm-960x540-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1280x720_7_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_7_1-2.webm.md5 new file mode 100644 index 0000000..6ffb95e --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_7_1-2.webm.md5 @@ -0,0 +1,30 @@ +7e0f316ed40bd18c3d5f3ad8b5b4f6f7 vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0001.i420 +8c646cd4d8ff769dde3f2a8045de520b vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0002.i420 +b4a1cf91fcfca995026dc45f2798d861 vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0003.i420 +d18524ed59f4f936ecbabc411f33c861 vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0004.i420 +98aaa03d1e01b0e5bcb351549bf20785 vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0005.i420 +72ac53103604f0fcc2681859ce3c6f6f vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0006.i420 +2b824b34b348923d4b1666e9b9cdd116 vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0007.i420 +85973fadaf538b205a68becc575c5828 vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0008.i420 +989fe23f46de08e16131f5a9708d6db8 vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0009.i420 +5225b0a4154aa2239cb9808aca77a5ac vp90-2-21-resize_inter_1280x720_7_1-2.webm-1280x720-0010.i420 +afcdaa57f384245ba2dbba32cfa84f82 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0011.i420 +7217d3fc08eb71a42bc6a89e3bb013a8 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0012.i420 +c3d38fc9a75174ac9574313516369a6d vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0013.i420 +bd5114e5bb035d7e8321442ebff565bb vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0014.i420 +d858f7e3da9fc0a902800850a23e7720 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0015.i420 +4b9a30fa7650b61a8ec5fa4189c24cd6 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0016.i420 +45e5938e3927847b1543d1e5e2a26177 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0017.i420 +7a5195e824468ed1727b941a01ce7020 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0018.i420 +66ee95f7977139134811525827f8b889 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0019.i420 +c9da026e1c1751973a1a88299a39fd58 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0020.i420 +c9b737c9494a84ff5e15d1f7e7073431 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0021.i420 +10be91db9f287cf34a172790b0bde5fe vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0022.i420 +adbc3359c04ddadfdd15d3fe39826462 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0023.i420 +9576e4d7f7c6bbd13256b9dfff117677 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0024.i420 +c19405e1f518dedccbcc3ce21334cc2c vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0025.i420 +adbe490baea06fdf4e6d962f8c080222 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0026.i420 +74bccad5faf5e7e758e541ecf382b8cb vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0027.i420 +030aad9ae3b7e33e1c178eb3292901f6 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0028.i420 +3b0f014f05f750f48fc0f6d80ced2727 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0029.i420 +782630aaa20c7f38452446745d7f8a66 vp90-2-21-resize_inter_1280x720_7_1-2.webm-640x360-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1280x720_7_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_7_3-4.webm.md5 new file mode 100644 index 0000000..1c1af5f --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1280x720_7_3-4.webm.md5 @@ -0,0 +1,30 @@ +7e0f316ed40bd18c3d5f3ad8b5b4f6f7 vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0001.i420 +8c646cd4d8ff769dde3f2a8045de520b vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0002.i420 +b4a1cf91fcfca995026dc45f2798d861 vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0003.i420 +d18524ed59f4f936ecbabc411f33c861 vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0004.i420 +98aaa03d1e01b0e5bcb351549bf20785 vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0005.i420 +72ac53103604f0fcc2681859ce3c6f6f vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0006.i420 +2b824b34b348923d4b1666e9b9cdd116 vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0007.i420 +85973fadaf538b205a68becc575c5828 vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0008.i420 +989fe23f46de08e16131f5a9708d6db8 vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0009.i420 +5225b0a4154aa2239cb9808aca77a5ac vp90-2-21-resize_inter_1280x720_7_3-4.webm-1280x720-0010.i420 +6fbad64411d848d2fb556d19f1c7f08e vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0011.i420 +d07f3acc994e86f853770dc32ba7673d vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0012.i420 +f893ae0c55efcc9efc65d4931c017e5f vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0013.i420 +6a80cdbddb3c6b9d0fa4c39cf17b1fa8 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0014.i420 +e0183d67c5c6cb259d2b1ba92bcd99d9 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0015.i420 +8ed8375e6f58fae8500c42502bd1e4ef vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0016.i420 +29f69ed91323a994544217523f14e2b2 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0017.i420 +1e39a46c8f6cd52eedc7413c096a8a0d vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0018.i420 +99a9177e2073994f162d4ee71879a05a vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0019.i420 +ee19b31f9432d4d193366416e891d867 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0020.i420 +3929f05734463ffd73176708528db8b1 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0021.i420 +d640e1528f80783923392610d4e1387b vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0022.i420 +53d709b700a6fbf94ea921d14a2b0a9d vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0023.i420 +e32eb541642b8a31a9da900e5d5926a3 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0024.i420 +434a987348472999f0a3917cfa2c9cd5 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0025.i420 +613d5fd6ced8ed035478dfefd163d3c3 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0026.i420 +d7757185c6905cc5bb78ea16186c5f88 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0027.i420 +867a4fd837321e91933175ae06f90d9f vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0028.i420 +d268778f4eb6abafe484f9255b88d1eb vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0029.i420 +9ab84de5699a1978dc42e60428c877a2 vp90-2-21-resize_inter_1280x720_7_3-4.webm-960x540-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_5_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_5_1-2.webm.md5 new file mode 100644 index 0000000..8a4f3e3 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_5_1-2.webm.md5 @@ -0,0 +1,30 @@ +9d87aa186547312bb3841e6ece2a38ce vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0001.i420 +f667a56cffa05f90ee4600385190f2ff vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0002.i420 +bce7f5ac00b9299ff3c9384e21c9ea03 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0003.i420 +e99594da97e66a035c8cc262f9845757 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0004.i420 +e7a274a22e2b167bca00920438e87c4b vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0005.i420 +9da294447149404a8b0d99d051dec9dc vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0006.i420 +64a5b94dc9bf7e7ad7e29301ddd9c402 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0007.i420 +2c68651da3ae3af809d928b02263a56a vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0008.i420 +80435ca596f62ca491622465be9e66b9 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0009.i420 +9bd062ca422c08f87482ae6939715a7b vp90-2-21-resize_inter_1920x1080_5_1-2.webm-1920x1080-0010.i420 +a6356d98486690fd38ba410a0ee57f5a vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0011.i420 +a312fced434974436691d0fd34995d97 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0012.i420 +2d7c431a167497604a6513d812bec90c vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0013.i420 +e33e9f636d3bb95d6683a0eff70ddc0d vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0014.i420 +f751ef4f44639ba93fd12e544b738f26 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0015.i420 +9a1ae2c2b061336d8b142a589ce2c5a2 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0016.i420 +14c289fd84d933e51faf12583c1fbda8 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0017.i420 +0aca4496c762dad4d8c47d4e03523425 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0018.i420 +6191b0e1ae4172ace2218564b0d9470f vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0019.i420 +f5a318c8860c64f6afca93400f44838b vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0020.i420 +c1cc69a0d52326088675791fc9d14874 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0021.i420 +3b2644c9045423b5b1afc972116608b5 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0022.i420 +2a5a3146e2e78e28d37123ce4f66ddb1 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0023.i420 +1fc628b5e1ac1fbd72b284d3e3eea68a vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0024.i420 +904147d8611f39b2504077df84461c1b vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0025.i420 +caff5529722ebf933ab61a536edbb30b vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0026.i420 +3fd2b2128ed8bf5398d213bc92f622e3 vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0027.i420 +384caebe302fbef5453c6ad27f545eec vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0028.i420 +c6387aed70c7b10685a58c18359b591c vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0029.i420 +1c5183423551d30b9324665348d442ba vp90-2-21-resize_inter_1920x1080_5_1-2.webm-960x540-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_5_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_5_3-4.webm.md5 new file mode 100644 index 0000000..1778b24 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_5_3-4.webm.md5 @@ -0,0 +1,30 @@ +9d87aa186547312bb3841e6ece2a38ce vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0001.i420 +f667a56cffa05f90ee4600385190f2ff vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0002.i420 +bce7f5ac00b9299ff3c9384e21c9ea03 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0003.i420 +e99594da97e66a035c8cc262f9845757 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0004.i420 +e7a274a22e2b167bca00920438e87c4b vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0005.i420 +9da294447149404a8b0d99d051dec9dc vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0006.i420 +64a5b94dc9bf7e7ad7e29301ddd9c402 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0007.i420 +2c68651da3ae3af809d928b02263a56a vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0008.i420 +80435ca596f62ca491622465be9e66b9 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0009.i420 +9bd062ca422c08f87482ae6939715a7b vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1920x1080-0010.i420 +9e0bb65a6cdf4b81666962c61577779d vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0011.i420 +9df0ef610610b8e70fd5bd813166ff0f vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0012.i420 +c7c3d3f4ae063ba62ae4c051d1ba4245 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0013.i420 +87b998ccd3d9505c7ba1dfdf3e4b96c3 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0014.i420 +43aac819bbebe4aeb7685fbb33c0792e vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0015.i420 +de335a92f3e2e9cd872a46b0464c45fe vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0016.i420 +b88d9e401883919f4d823eb64397a0e1 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0017.i420 +f7baed06844c54fc41cb4b036db1a1d5 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0018.i420 +738e732b9a01a964580eb9a72debfbf9 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0019.i420 +6df1e30960c5bb38f67fdb7efa0d2546 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0020.i420 +093ce155664f1202764bbb6bf6536596 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0021.i420 +628093bf8520ad0078421a34560453ce vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0022.i420 +873403daccad9ed068a778fbf648de97 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0023.i420 +29f582573fb4a0ba90de99adf74b9b2d vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0024.i420 +3c37049e1e1c14309daf9785f05f10f2 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0025.i420 +34b1bef5dd2a73bada9efc9b2f4c3b0d vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0026.i420 +df4f6788e4031b609b6b2d6391fadf1c vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0027.i420 +3c3aaafa262bd9bf3db92f43c1300eef vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0028.i420 +acc96fc0b0697ecc8f292656c511d0f1 vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0029.i420 +b81fb6c9b4e3a3e44f5206e4de146a9f vp90-2-21-resize_inter_1920x1080_5_3-4.webm-1440x810-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_7_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_7_1-2.webm.md5 new file mode 100644 index 0000000..8ddfd23 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_7_1-2.webm.md5 @@ -0,0 +1,30 @@ +9d87aa186547312bb3841e6ece2a38ce vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0001.i420 +5290ca6654a27c847765816baa571d01 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0002.i420 +6a70d914ee947cc0c9a25889e7085c5a vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0003.i420 +f275ed0f56f6cbcb90bb3bb431d6eac1 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0004.i420 +03fb48602ab1384861df220061b33087 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0005.i420 +dcc05823585c341923913544745e5586 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0006.i420 +c5c436c95899bc31533a73fa5c8b69f0 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0007.i420 +3d3e0620486d9b6ba5a01d83ce780ca2 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0008.i420 +49f3808c374e7d25ffb3ddeae3962864 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0009.i420 +a1ce6b1c0c99ae0bf3b6df5b358b39cc vp90-2-21-resize_inter_1920x1080_7_1-2.webm-1920x1080-0010.i420 +ce99c9f8ecdbe57a5f0e46aee9302f14 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0011.i420 +87f276bc6a8cd7ac888d319e5fbee9d5 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0012.i420 +85483639ea6778d65c0e1cac282c0682 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0013.i420 +789f01eb802d17e1e3d4c197fa94f518 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0014.i420 +2e0ae1f7fe42510338262a1661e7f5a8 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0015.i420 +5c15cbbd55f4ef755437e83406c4ade4 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0016.i420 +3431efb3bb7f65d64ee0273d55ea6d55 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0017.i420 +d59c6581859a5fe19fb675ee1c223c85 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0018.i420 +614973d2f12fa034f8261899826c8e64 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0019.i420 +d1f033036257a20766611f3e391078f2 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0020.i420 +3b9f0df0417503525a2873e38ad60f89 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0021.i420 +7f727e36db1c59c7832589ae2c16e7bc vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0022.i420 +60a78085b194085b66dcdd2deca8b89f vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0023.i420 +3d92aa2960493be95954614a1282c0e2 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0024.i420 +89060b6fba87e7e4b7faf3b83f0fd450 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0025.i420 +871987a5663593025d45e37302a967fd vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0026.i420 +eaa7a334024585f8377d7c54e4cf0c71 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0027.i420 +2d7bd6a136847da1ca6b3cfb1401211b vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0028.i420 +e82ef6327e066f44a8d0e7af4127f522 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0029.i420 +70f1ae6641e6ada9a7663816025811a2 vp90-2-21-resize_inter_1920x1080_7_1-2.webm-960x540-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_7_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_7_3-4.webm.md5 new file mode 100644 index 0000000..7eac5ab --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_1920x1080_7_3-4.webm.md5 @@ -0,0 +1,30 @@ +9d87aa186547312bb3841e6ece2a38ce vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0001.i420 +5290ca6654a27c847765816baa571d01 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0002.i420 +6a70d914ee947cc0c9a25889e7085c5a vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0003.i420 +f275ed0f56f6cbcb90bb3bb431d6eac1 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0004.i420 +03fb48602ab1384861df220061b33087 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0005.i420 +dcc05823585c341923913544745e5586 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0006.i420 +c5c436c95899bc31533a73fa5c8b69f0 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0007.i420 +3d3e0620486d9b6ba5a01d83ce780ca2 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0008.i420 +49f3808c374e7d25ffb3ddeae3962864 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0009.i420 +a1ce6b1c0c99ae0bf3b6df5b358b39cc vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1920x1080-0010.i420 +102db2866deb949c7695a6c96fea5f85 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0011.i420 +5e7d6798761434174c3596dfd2d6ee91 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0012.i420 +70bfe013ba70b8a16fc9ab3870b955ce vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0013.i420 +cc8cd6a16854d1a834e8598b9c4fa886 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0014.i420 +160e6acd7edc3d4cb7d9e5aec1bab966 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0015.i420 +74198d9598b82b43b587377fe69c72e8 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0016.i420 +7f102a7bca5475eef40094d9ba7a1d12 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0017.i420 +1abba0e72f27700c9fb7e5881bf8338c vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0018.i420 +c443ae33f1f2fa794d845441534910f4 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0019.i420 +bf8bcb1b87b8650ffe69dc069bfa3671 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0020.i420 +65b24b37f96c3669a8ee798f2666dc52 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0021.i420 +5aedd2d52489fdea7365dd74de27bb6f vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0022.i420 +403835243cff516b8642718fecffb23c vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0023.i420 +66960b305f156d2b4e521cf8c48a7f9b vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0024.i420 +5bda807b02838d0ffa0b11b6d33506e1 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0025.i420 +440b2878b88c31d8f16b3998bc466cae vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0026.i420 +41dabd7f6ac2611c92fea68e3f12d7b4 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0027.i420 +8afbb3460f7fdb3237a77778e011b3d3 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0028.i420 +f4325f63241e93a3b5073e054343e2ed vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0029.i420 +70c6648ce2b186c778d6334d61522bd4 vp90-2-21-resize_inter_1920x1080_7_3-4.webm-1440x810-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x180_5_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x180_5_1-2.webm.md5 new file mode 100644 index 0000000..2df1dcf --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x180_5_1-2.webm.md5 @@ -0,0 +1,30 @@ +408da78612025669e23206dd797920ae vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0001.i420 +698f9b1eae39f7a51f1e4d2c64fd5c1b vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0002.i420 +917f466e5c75835c6830815096476d2e vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0003.i420 +526116df391644cbe3d579f5ebbc446c vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0004.i420 +2e4a12dc39a829163977358b93171306 vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0005.i420 +a0ad0724cb71c16bca90f8d10bd4e506 vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0006.i420 +955f7ae54d2b66f92d86255985ba657a vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0007.i420 +09cddacead7dcd7e1e5aebd538b55668 vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0008.i420 +fcb13771b1d012fc4f5e0ee7aa02db64 vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0009.i420 +9bf28e41bd4e80425b5402c7954ff0e3 vp90-2-21-resize_inter_320x180_5_1-2.webm-320x180-0010.i420 +944f98bfeb39a6b8f34ac82ba990f641 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0011.i420 +59e005c59fa365cde3de1825671592f9 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0012.i420 +7c2ec6c947f253cab5e99add15bfd126 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0013.i420 +1b7172953d267af72c0852085a7441cb vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0014.i420 +083221cb6c884841f6eec7c9a93351d2 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0015.i420 +e366c5c84f8ca55cbc672a5ca00571e8 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0016.i420 +9d7aaae51bc11ac1a505623304609e4f vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0017.i420 +e355b1d7618d3706b104ea915a004550 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0018.i420 +2b6050b98f60e3b7cfe8c933c89c7c8a vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0019.i420 +904c6b421a765ffdff1bdde520b0986d vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0020.i420 +8c2c7e1291d430a8f9037204e2e788d4 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0021.i420 +7c1cdd83377bf62653427f4ec145f156 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0022.i420 +2a494b440fbe35604429b92997b9af3f vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0023.i420 +cac7a2eb6b38880a638f350578d43854 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0024.i420 +e0fc12c61bca62a10a270750edb0e45a vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0025.i420 +eb057f75c5831ca017c0609c94fba3d8 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0026.i420 +1d2987121809c3f3512cb6f5c6563cb4 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0027.i420 +a5c6b8dd06a8d93f5d7c239551ea60c3 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0028.i420 +5e97fdbcde5ef6cf235ae37e86019111 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0029.i420 +240a8d2ef086a48f3b0ccd5ff92e1419 vp90-2-21-resize_inter_320x180_5_1-2.webm-160x90-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x180_5_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x180_5_3-4.webm.md5 new file mode 100644 index 0000000..6a4376b --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x180_5_3-4.webm.md5 @@ -0,0 +1,30 @@ +408da78612025669e23206dd797920ae vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0001.i420 +698f9b1eae39f7a51f1e4d2c64fd5c1b vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0002.i420 +917f466e5c75835c6830815096476d2e vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0003.i420 +526116df391644cbe3d579f5ebbc446c vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0004.i420 +2e4a12dc39a829163977358b93171306 vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0005.i420 +a0ad0724cb71c16bca90f8d10bd4e506 vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0006.i420 +955f7ae54d2b66f92d86255985ba657a vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0007.i420 +09cddacead7dcd7e1e5aebd538b55668 vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0008.i420 +fcb13771b1d012fc4f5e0ee7aa02db64 vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0009.i420 +9bf28e41bd4e80425b5402c7954ff0e3 vp90-2-21-resize_inter_320x180_5_3-4.webm-320x180-0010.i420 +e091bb91b0a9b87511fa38b959d3fa78 vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0011.i420 +0f8061979b30f3aa210bce7fa6cd4b2a vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0012.i420 +862c6162dacedfaef176b0856a0e991f vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0013.i420 +53d37e86c338cecb168dc8a97801f52e vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0014.i420 +c99d46dd3f3a1973fedeedc1e32a425b vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0015.i420 +56dc9cc3ec0979d1dec2e10a7de6d3f4 vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0016.i420 +1eefd34206e0b5b1053dc25ad455b2af vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0017.i420 +47d08079b05a788786afb9f9a1a3be60 vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0018.i420 +3519e1b8babd5fdd33d707cbbb84aa8b vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0019.i420 +dbbd03e6b45a1f1390b52abd55bbed9a vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0020.i420 +cad4d420811390d8daf207f0a3e8b473 vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0021.i420 +1d4550f3103f829524fbd3db38eddad8 vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0022.i420 +352153234564bd719f1c5bf6d637e99c vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0023.i420 +07c0320a9f4a28afcb3655510da960ba vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0024.i420 +24f9207d38a899c03ef7585fc0bee481 vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0025.i420 +07fc1db07fe68d8abda68a3844921c2e vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0026.i420 +4e8e97ecd2dfe920214299eae06bad24 vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0027.i420 +6b2f6c085aef4f5c1fff380bfe0e6e5f vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0028.i420 +03243e6d6b200854a710ab4e80e8330f vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0029.i420 +3f23603892656cd05fef0c3a7374dd7e vp90-2-21-resize_inter_320x180_5_3-4.webm-240x135-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x180_7_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x180_7_1-2.webm.md5 new file mode 100644 index 0000000..11fee31 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x180_7_1-2.webm.md5 @@ -0,0 +1,30 @@ +408da78612025669e23206dd797920ae vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0001.i420 +d9108296cdcfd7a18138fae46840d051 vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0002.i420 +e0dc160bca41f40c1cbe7e1d3daa8244 vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0003.i420 +786a335472dd01db3dec3436dba169a2 vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0004.i420 +38d62578fdb3caa2c808d7b5bd5d64fc vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0005.i420 +f29a1e2aa950025e526e3e2d72efb829 vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0006.i420 +17945f22096196d078077061584c1d47 vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0007.i420 +92c809257e8f7e73c9df354b1dd7dcf6 vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0008.i420 +38075769a923beb6bb8de5ba95e31db0 vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0009.i420 +ae3a6e2a4f2a8a51854f4a0650e513fe vp90-2-21-resize_inter_320x180_7_1-2.webm-320x180-0010.i420 +fade4a3c7499b1dc5e5cca546e62c17a vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0011.i420 +72887f2a2946a380de8d028035ff7d37 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0012.i420 +ed73db8ca58cc595f4b1166f272b9489 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0013.i420 +203ee446f0bd534d7713e11dcf89776f vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0014.i420 +22bca97beadf9100ca6e164db0f01d31 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0015.i420 +91edee6ab92cfc92a7493d390823c002 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0016.i420 +7b8aff7afe8b99183775e3dd495faabb vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0017.i420 +c822f64bf886c04afdec4bc1e2a2c7e9 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0018.i420 +0db42b8dc8d3777ea17e9edc1498145e vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0019.i420 +9f1fff7b4840ba6cd209e6b11909b980 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0020.i420 +b0a227f7b77762d9a8964aaf78aac2bc vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0021.i420 +703edbe79624a3d206a5fa6eb1425025 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0022.i420 +ef7819ba7eadfa06968ef7f1197eee7c vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0023.i420 +4053252916b148ef8f8be153f3514865 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0024.i420 +5ce1f1849fc629d402dc90c5a5aea662 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0025.i420 +f3aab54cbd2adbd342413c8472f3588b vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0026.i420 +140fc4e182a6501902a0c28effd628cd vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0027.i420 +45230628c01fa3162766435c18abbecf vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0028.i420 +73533643a57696040e26f99f48e3e54e vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0029.i420 +ee86fb68cc3601804d116599cc2b4d83 vp90-2-21-resize_inter_320x180_7_1-2.webm-160x90-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x180_7_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x180_7_3-4.webm.md5 new file mode 100644 index 0000000..76ca689 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x180_7_3-4.webm.md5 @@ -0,0 +1,30 @@ +408da78612025669e23206dd797920ae vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0001.i420 +d9108296cdcfd7a18138fae46840d051 vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0002.i420 +e0dc160bca41f40c1cbe7e1d3daa8244 vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0003.i420 +786a335472dd01db3dec3436dba169a2 vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0004.i420 +38d62578fdb3caa2c808d7b5bd5d64fc vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0005.i420 +f29a1e2aa950025e526e3e2d72efb829 vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0006.i420 +17945f22096196d078077061584c1d47 vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0007.i420 +92c809257e8f7e73c9df354b1dd7dcf6 vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0008.i420 +38075769a923beb6bb8de5ba95e31db0 vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0009.i420 +ae3a6e2a4f2a8a51854f4a0650e513fe vp90-2-21-resize_inter_320x180_7_3-4.webm-320x180-0010.i420 +4d543ecd7cf4f40bfc16811164500191 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0011.i420 +c7c190acb81914616ac21314a98f536f vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0012.i420 +c929b0579bd5b3e1a42461ae12f96f95 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0013.i420 +9db1eee2755cc2304b9a3e7973ac8bd6 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0014.i420 +fd85a4050dc2c4cde352dfb0647e531a vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0015.i420 +0a1f967dd80efc9dc501b732e7b63ec8 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0016.i420 +5c723f6a0e0fca8ba59b89dbb4c38c09 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0017.i420 +0804f7169d00d080b4dbddad058fe2eb vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0018.i420 +e1b27be491c1b0d5ca9e056b197dca59 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0019.i420 +e941f26d84dbfb72f8386b5f04f8c8b5 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0020.i420 +8970ebfea523670e938f53c85e4e89ad vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0021.i420 +3bf6d97d737964a9a9de1c7ed2373fa0 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0022.i420 +168b58228235c94c9f9212e17d1449dc vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0023.i420 +c218c47e605aa7c62718110da9992fc6 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0024.i420 +b044dd73330e64c4a3efcfe4a6d28264 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0025.i420 +99ad31c44491e4a6e75b239743538197 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0026.i420 +3cec85f7d0f5e581ed4855e5bd101c12 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0027.i420 +6b9456f7e3006244088d2c8a5e7543cc vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0028.i420 +14bcfe350aade6c2393bd7f1e82c3b1d vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0029.i420 +dd013e51b1bd429cbc66b2645bad92b3 vp90-2-21-resize_inter_320x180_7_3-4.webm-240x135-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x240_5_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x240_5_1-2.webm.md5 new file mode 100644 index 0000000..a3a35d3 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x240_5_1-2.webm.md5 @@ -0,0 +1,30 @@ +a26007e01e19f2148d22fcb166031d2f vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0001.i420 +e61f0562da47a096f4d8c687e1a543cc vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0002.i420 +80ce4f65c4b758ef8a130cc97f7d7f63 vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0003.i420 +93d3e9381c966e5b142aa705a6271e6d vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0004.i420 +845debccba4276a81292a4a2d98b6bda vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0005.i420 +59325db2ea7572bb08c1d78ebca19c68 vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0006.i420 +ea55c58c6141f1113d330b23e95aedcc vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0007.i420 +afe76027debf7efaa7e108ee594ea3fc vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0008.i420 +23d9260b52783c783db22db66a9e8ad4 vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0009.i420 +02ca04f9f1b00c3a418e3932fe8979da vp90-2-21-resize_inter_320x240_5_1-2.webm-320x240-0010.i420 +403b2674bfdf392623e31a81835a9158 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0011.i420 +eae2366c65753876aef700b36fe94ce2 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0012.i420 +5e05bdd088c991cd85bee4d21ee3f753 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0013.i420 +9a3b28d5bdfd0449a89c0e39a2d402b8 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0014.i420 +1859455a18c7e7f4ec06a3467fbeb8d1 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0015.i420 +294ceb30807ce92ee7a0d48f4799670d vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0016.i420 +c1235798a7d6777833ecacbffe9f4ebd vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0017.i420 +50e9ece493a7453e978778ab111339b7 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0018.i420 +f6f6c4c7dd83d1994cbd08abef4cd87a vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0019.i420 +8d5197e001e57e366e8cf8f260307efb vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0020.i420 +0ebd093047c869cfe1f9fa2b4ad743ca vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0021.i420 +5d8bab803ff00ac7473fcaeea4c404da vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0022.i420 +d4a92667f679796fd43cbab172f4fe45 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0023.i420 +3077d119fa23ce5273868eb67006fc0c vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0024.i420 +40a51ec82460f2e0f335810f8b78a8f8 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0025.i420 +a46f4047ad8e412c594eb280ea0db50a vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0026.i420 +fdf679253dd1d3320962d45c813c010c vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0027.i420 +001f76af2a5b7f06b951fd0b11e99b30 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0028.i420 +5f09d9a110634fd4fe490e6316a5ff07 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0029.i420 +b87699ba28df7b4e61dbd02b05b307a9 vp90-2-21-resize_inter_320x240_5_1-2.webm-160x120-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x240_5_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x240_5_3-4.webm.md5 new file mode 100644 index 0000000..ca93d27 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x240_5_3-4.webm.md5 @@ -0,0 +1,30 @@ +a26007e01e19f2148d22fcb166031d2f vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0001.i420 +e61f0562da47a096f4d8c687e1a543cc vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0002.i420 +80ce4f65c4b758ef8a130cc97f7d7f63 vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0003.i420 +93d3e9381c966e5b142aa705a6271e6d vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0004.i420 +845debccba4276a81292a4a2d98b6bda vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0005.i420 +59325db2ea7572bb08c1d78ebca19c68 vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0006.i420 +ea55c58c6141f1113d330b23e95aedcc vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0007.i420 +afe76027debf7efaa7e108ee594ea3fc vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0008.i420 +23d9260b52783c783db22db66a9e8ad4 vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0009.i420 +02ca04f9f1b00c3a418e3932fe8979da vp90-2-21-resize_inter_320x240_5_3-4.webm-320x240-0010.i420 +8f273075623d2d4e3f749265bc3dfbc8 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0011.i420 +e512513ae8fc8c8f831f1485db93e875 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0012.i420 +69e7baedb5efc2fdc499a4fc53db61cf vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0013.i420 +6be1a37546d1a6520d6007a267c15990 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0014.i420 +b32607fa113e3727b89ed9b0852bfad1 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0015.i420 +3d1479e15da1a910b4e70718308029a6 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0016.i420 +aeb0f3da6c758cfecd79b20daa29dcab vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0017.i420 +616bc9c613276a0604de6ed4d0b5c38e vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0018.i420 +360a7b6a5679fc1cb6fd732fdebf2403 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0019.i420 +63ba5890c14305dfc4ddd979617ca439 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0020.i420 +85f5b8f22df9b60615fc6561998ded2b vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0021.i420 +151460d92e54b815f553a076dc9c1af8 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0022.i420 +06d95c7f5f928ee1916fbf29b67bd8c4 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0023.i420 +a598b7e79ea5b4dae4e414384971e836 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0024.i420 +34cf640ba4b0178203e56e9dc09a4eeb vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0025.i420 +2f7f6f6252f74be69af8cff826bcf0cb vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0026.i420 +d03a343aec3b92e6c5710d096c90f525 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0027.i420 +2c57a852fb5624971a7eb942d7399208 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0028.i420 +4281e8e78e852b4f531a4ffc5067476a vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0029.i420 +2a3bf5a90b742960a1a018308f268027 vp90-2-21-resize_inter_320x240_5_3-4.webm-240x180-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x240_7_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x240_7_1-2.webm.md5 new file mode 100644 index 0000000..47cabda --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x240_7_1-2.webm.md5 @@ -0,0 +1,30 @@ +a26007e01e19f2148d22fcb166031d2f vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0001.i420 +fafd12eb37cfdccb41ed1b0f4b543b90 vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0002.i420 +aa96d33ba4190763588816f4591b6278 vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0003.i420 +b332eaf86c8ed98de7dc431f62dd71ce vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0004.i420 +9256972b5451b23b914e69f8eae0e219 vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0005.i420 +d6a33e47ddc0ac5524878e206b4b37a7 vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0006.i420 +d4abc8fdf190b79e71c0f8acfe19d512 vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0007.i420 +22fc7dfd3616913eafb9d439e3795986 vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0008.i420 +fcbd8d3b030b9ac8294344cef840ffaa vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0009.i420 +5fa89b8f261c600ce37a1a334fcd3fb4 vp90-2-21-resize_inter_320x240_7_1-2.webm-320x240-0010.i420 +89aa91885e1ed9a3ea2b6b8f623cc765 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0011.i420 +2b6d849c69a5a0032b11f90be66669cb vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0012.i420 +691ad2ac0644985e1b0ea8625e2f48be vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0013.i420 +d3242bf49f69d68e25c5bfad30c0a201 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0014.i420 +7988a3146228eaf39c7da8a044c245e9 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0015.i420 +585f848879b6f1598d744c3c99435d3d vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0016.i420 +f1ea4cd97bd0b0b138dae396af6dcca6 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0017.i420 +791dc424b01ba2b07270628b5401a5c3 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0018.i420 +1cc5890cd8e6788b2d203725a0691399 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0019.i420 +a2ec0142f0036abf3dcc6c035453cf1b vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0020.i420 +7b6f4b3d3d93cc17abac530360aefd9f vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0021.i420 +5ee87122de3dede9cef84df6724dd867 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0022.i420 +e7600c91c911cbc5d5e47cd53ca86f2a vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0023.i420 +f5574feec1b89435bf1679715752deb5 vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0024.i420 +6b0d92c64efce0e6d44f45d5d36655eb vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0025.i420 +c72f78fd25277297bef8a5091637418a vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0026.i420 +7839e950d13cb07f5815f0509ae42f5c vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0027.i420 +308d2bd64f4f8a3a814992de62427f3d vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0028.i420 +998e14fac266cc9038382bb367f8d8cc vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0029.i420 +7cf9b10f63351923b2382f4f06efbebf vp90-2-21-resize_inter_320x240_7_1-2.webm-160x120-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_320x240_7_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_320x240_7_3-4.webm.md5 new file mode 100644 index 0000000..7963c70 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_320x240_7_3-4.webm.md5 @@ -0,0 +1,30 @@ +a26007e01e19f2148d22fcb166031d2f vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0001.i420 +fafd12eb37cfdccb41ed1b0f4b543b90 vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0002.i420 +aa96d33ba4190763588816f4591b6278 vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0003.i420 +b332eaf86c8ed98de7dc431f62dd71ce vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0004.i420 +9256972b5451b23b914e69f8eae0e219 vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0005.i420 +d6a33e47ddc0ac5524878e206b4b37a7 vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0006.i420 +d4abc8fdf190b79e71c0f8acfe19d512 vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0007.i420 +22fc7dfd3616913eafb9d439e3795986 vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0008.i420 +fcbd8d3b030b9ac8294344cef840ffaa vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0009.i420 +5fa89b8f261c600ce37a1a334fcd3fb4 vp90-2-21-resize_inter_320x240_7_3-4.webm-320x240-0010.i420 +74778fe0e50d4ba92fe914c29fb7a10a vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0011.i420 +62b6e0133b66a7c9b72e28ad4bd755c5 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0012.i420 +b4b9e134e382b0388c8c878aab1b560a vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0013.i420 +ebd38a64e22bf2a484f39e85660575e1 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0014.i420 +64a0ed3f1acceb279c536930947890b8 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0015.i420 +7b6e93a7bd790de718b97b8fb9b9c9a8 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0016.i420 +d7ec32b622a9dad42e85befa858c393c vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0017.i420 +77d3b507d80782e9c86eb968d69f6eab vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0018.i420 +9b2d7eebd50ce9f1d34b079438b385ce vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0019.i420 +cc4af7b8ee7e2a28f8755c8be426d1ad vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0020.i420 +c29ad38a774b9dcb4e0774dc959946b6 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0021.i420 +91a29f19e266bc7a53fb910eff11c2fa vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0022.i420 +27e6d21e74e3c1ac74df7e19496baee6 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0023.i420 +d8bc4792531c3e07ec83fb5a0b990bbc vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0024.i420 +a573211a1aed48979cca34d03190df56 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0025.i420 +ba4ea7ce53e39fdfe5cd66cc72d19c32 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0026.i420 +da8c17f04e00adeba8bd54e0f5da74a8 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0027.i420 +dfc56149affbb1a2e1b792d428fbb322 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0028.i420 +3217470bb9b1ec65cc73b16f165963f1 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0029.i420 +b3f72c2efb994302ea5b9da6f9e3ad66 vp90-2-21-resize_inter_320x240_7_3-4.webm-240x180-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x360_5_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x360_5_1-2.webm.md5 new file mode 100644 index 0000000..5bf24db --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x360_5_1-2.webm.md5 @@ -0,0 +1,30 @@ +ea0a50029d27840ca8ad855d6efb91b9 vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0001.i420 +0a8e1dc2d6cfd286892e7bb20d4838ca vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0002.i420 +87f44cd7a65a408168a0d758d9dd29fa vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0003.i420 +82ff81df665edc57f0d9bbd96ae7531a vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0004.i420 +2db852aa653788596a64174a91b871bb vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0005.i420 +2331b7239135cfbb952bf9bf62025490 vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0006.i420 +bf61c6eeb48577de7dd2b8be235e93b6 vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0007.i420 +9f1e51f98bc884465ea88232e10588d4 vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0008.i420 +b2ff028ecc40df6cb5cae7368010f793 vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0009.i420 +85477891cbc71d716568125c12519149 vp90-2-21-resize_inter_640x360_5_1-2.webm-640x360-0010.i420 +3a45202cf746e046437e23762e57a867 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0011.i420 +bf152635165b7bba7aecefea93f57b6d vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0012.i420 +2baa919408b4bec5a956eb1a353b6488 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0013.i420 +52be4271cbf6f777993f7a57f5af844b vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0014.i420 +da9b9dc06767603d5c9f5ea01c7bc689 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0015.i420 +0491e391c010dc7059937199cf4693cb vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0016.i420 +126c0d71c7a1bf01fb3ca97be1e3725f vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0017.i420 +f8468d6334cd831e0e04e0b8f4d0d20a vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0018.i420 +8083d8a4cdc97a149785dc046d0d1e43 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0019.i420 +51c3c20bd0146eb858db961ea2949392 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0020.i420 +0d49e02617fb37a79a22f639f4089b18 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0021.i420 +0c75dfc9c34d05c798078478be1e6197 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0022.i420 +a106c6fbb95388af2e9f8eda4b1f9bee vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0023.i420 +c9287e4ce55ef606b713392b5747ff5b vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0024.i420 +09dd1df7b91c87706a13030898fbd8cc vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0025.i420 +b8471b1ccbcc7478e47017f626897a5e vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0026.i420 +6b685c99e16b3dea57bc4e3a57f4d755 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0027.i420 +7fca23867d847b8ac693899cfbcf6d78 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0028.i420 +7b4a4bb97510f851a9b750bccce01b31 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0029.i420 +ae65d9d58cd17148acf16c59da1f8e73 vp90-2-21-resize_inter_640x360_5_1-2.webm-320x180-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x360_5_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x360_5_3-4.webm.md5 new file mode 100644 index 0000000..afbfc41 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x360_5_3-4.webm.md5 @@ -0,0 +1,30 @@ +ea0a50029d27840ca8ad855d6efb91b9 vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0001.i420 +0a8e1dc2d6cfd286892e7bb20d4838ca vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0002.i420 +87f44cd7a65a408168a0d758d9dd29fa vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0003.i420 +82ff81df665edc57f0d9bbd96ae7531a vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0004.i420 +2db852aa653788596a64174a91b871bb vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0005.i420 +2331b7239135cfbb952bf9bf62025490 vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0006.i420 +bf61c6eeb48577de7dd2b8be235e93b6 vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0007.i420 +9f1e51f98bc884465ea88232e10588d4 vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0008.i420 +b2ff028ecc40df6cb5cae7368010f793 vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0009.i420 +85477891cbc71d716568125c12519149 vp90-2-21-resize_inter_640x360_5_3-4.webm-640x360-0010.i420 +e784922b2380bae4e4bb6279fa650da4 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0011.i420 +4aeb66c5ebe82bba65c7f932835101b8 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0012.i420 +3b9c733775d8eeff18563132f81898ab vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0013.i420 +9b8881b772a7280e6e4f19644b2ece85 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0014.i420 +a7d9e95237c279e93c8737ff534f4292 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0015.i420 +0074788f36efe0ec25dfaad58ab5ec2f vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0016.i420 +459f8da42561461c9fb197da8b55f411 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0017.i420 +6b093aa7cf126db7f90916a7068c219e vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0018.i420 +47134f66fe272158f1bb86ddf283dedb vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0019.i420 +e55433df5b5824b86b34e0b409ad53f3 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0020.i420 +8395fd42240c8071e429e349d290eaa3 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0021.i420 +b9bb54096f983c52fdce3290b9e496c6 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0022.i420 +40f9c8d2ad4c23f74305059dc648171a vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0023.i420 +0cf1d200bd7af5e7f4d68cf89519e558 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0024.i420 +d3a9a4b0c5eee10ac9fd2eae2321401f vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0025.i420 +8effd2197a218c89678cc61731ad27e6 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0026.i420 +be19009e0e3fbb8e2f321cfada8d6785 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0027.i420 +a07d7cb4b2dec271ce24e5b9358bcd38 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0028.i420 +c93cb2c4a4a944868fdafae832f60434 vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0029.i420 +45f547483c2d87720768d860e6b87edc vp90-2-21-resize_inter_640x360_5_3-4.webm-480x270-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x360_7_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x360_7_1-2.webm.md5 new file mode 100644 index 0000000..4ffd1cb --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x360_7_1-2.webm.md5 @@ -0,0 +1,30 @@ +ea0a50029d27840ca8ad855d6efb91b9 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0001.i420 +5829bb3d2eca7b013cdae86af649049c vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0002.i420 +18f280aba5530790932bd3f693a15c07 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0003.i420 +07c45424eec5f9de6698a91b73b84093 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0004.i420 +cb9500d8143666b7ccb7d81a00430238 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0005.i420 +cc5ef2505843b6efb0e422b07e6bcf46 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0006.i420 +8c702c0c596a743687492dc0d31b74b1 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0007.i420 +a608cfa6730ad0419a783b471b03748b vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0008.i420 +e477a01b0f44d01aeeba371a4796dbc6 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0009.i420 +e3036a69f94b1c60d819fc421f9e4df7 vp90-2-21-resize_inter_640x360_7_1-2.webm-640x360-0010.i420 +aa9ec1e8a8c50edb38ac481743e50f7e vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0011.i420 +ceff77320473ed7456d3b84fc042a8d7 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0012.i420 +6b75c9422e027ebc6113da170ca1244e vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0013.i420 +8ad71988ca1bf65074f32dd6e6c3c5f3 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0014.i420 +5ece116501a38b30cf104ad0b318c81f vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0015.i420 +c9c9fd61451227d89cc90d0d3b2ffe0a vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0016.i420 +25d44a3a312e7c41a6049ea79904cd97 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0017.i420 +3493faff3def2ab64194d269526c0576 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0018.i420 +734fd1553b604ea9f4fb9caff7ee7b4a vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0019.i420 +f84f497b928ca8665a05c4f8bc2c27bd vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0020.i420 +89ed5cc48e4de7d1f9dabde1b20938f8 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0021.i420 +b724233d1443313bf14a6dc44cbb6204 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0022.i420 +609a76b3d870065dc35ee9d0cd271fa7 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0023.i420 +2b40cb4fba4b28813d734e692c0b5936 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0024.i420 +64370f94aeda1814939ba4c800a9509a vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0025.i420 +7b486bbca097186f51965bd9cd0c5243 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0026.i420 +d9ff86df24493c56182564df35fa05e1 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0027.i420 +267855f5b55b2e81b845100c1a71de1d vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0028.i420 +6c9b987018d0ddc393e9cac23ad83f07 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0029.i420 +214ca166064b1f505f09466bd33b6db8 vp90-2-21-resize_inter_640x360_7_1-2.webm-320x180-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x360_7_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x360_7_3-4.webm.md5 new file mode 100644 index 0000000..1af8099 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x360_7_3-4.webm.md5 @@ -0,0 +1,30 @@ +ea0a50029d27840ca8ad855d6efb91b9 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0001.i420 +5829bb3d2eca7b013cdae86af649049c vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0002.i420 +18f280aba5530790932bd3f693a15c07 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0003.i420 +07c45424eec5f9de6698a91b73b84093 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0004.i420 +cb9500d8143666b7ccb7d81a00430238 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0005.i420 +cc5ef2505843b6efb0e422b07e6bcf46 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0006.i420 +8c702c0c596a743687492dc0d31b74b1 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0007.i420 +a608cfa6730ad0419a783b471b03748b vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0008.i420 +e477a01b0f44d01aeeba371a4796dbc6 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0009.i420 +e3036a69f94b1c60d819fc421f9e4df7 vp90-2-21-resize_inter_640x360_7_3-4.webm-640x360-0010.i420 +7ef8fcdc3bd62a3b77f99378cd9ce1a1 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0011.i420 +656cc68092579f02402b38a050c590f7 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0012.i420 +d50a50bfc0afc92e683e9d9b0da24cff vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0013.i420 +1e6cd619864956f47ab081a1ea87e935 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0014.i420 +d956f5e8f5fa16062adbc186d3196498 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0015.i420 +11d2c02895934302ebd97b5d18876dd1 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0016.i420 +cbe9e9d57b6dade714de2ba978438c4a vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0017.i420 +4fadc0fe785a345ac2a37e257f8c208e vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0018.i420 +8a01943b1cc9074d343d55ce076cb6c7 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0019.i420 +6d448ab0248fc9eb50500d4429c47d7d vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0020.i420 +f508e0cfcc8ea34b99fc3e2602c81659 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0021.i420 +796935abd6fd72b77c6d7e5ede34af1b vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0022.i420 +f1989f92a6298d1ec552f112877b5909 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0023.i420 +934513b603997cf751ecbc3676fcd6d4 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0024.i420 +ff501651bff88b86c796d2d851506df7 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0025.i420 +d36d74314705f03f6a7eff04cba3253e vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0026.i420 +9617f5744a7dc447b7898b50f99200fa vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0027.i420 +b66f58b4af1745d37e741481e3c67a0c vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0028.i420 +7a9568c78b276bc1b64bd71071932a8a vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0029.i420 +f61f53f9a4415e541500a37023d017f8 vp90-2-21-resize_inter_640x360_7_3-4.webm-480x270-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x480_5_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x480_5_1-2.webm.md5 new file mode 100644 index 0000000..1b84136 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x480_5_1-2.webm.md5 @@ -0,0 +1,30 @@ +7109f3605fbb141997d6d79fbbd292c7 vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0001.i420 +bc4a8e393f125ec353fddbdc8d8a66ab vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0002.i420 +3a1cdb55cbdc4a5d1610d92ac80a7081 vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0003.i420 +3e438b170d93ad640e3c59646943fc7f vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0004.i420 +5946a4b5d4e14a5c3e908c7664f1ebc1 vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0005.i420 +a466d7cb3e4bd999a4bc8311cf8e4f81 vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0006.i420 +a09a9eb287196373d68fe1265d8dc27c vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0007.i420 +ab6ca8364923f658185d5823a14a105c vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0008.i420 +10625eec045228019d74f2df1b107675 vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0009.i420 +0b328a63046bcdec341f6ea8e7980c84 vp90-2-21-resize_inter_640x480_5_1-2.webm-640x480-0010.i420 +b9d5aaf88b04c8f7c56ab3869a6efa71 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0011.i420 +1bb54755ecf64929ea2ad6b7370fc665 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0012.i420 +4d8557229a4046aaa00f3e73cd44f580 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0013.i420 +5fe660f00fd72973155e9381994b82cf vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0014.i420 +3c75fbf907a7a3165ba71a5cfc6b8052 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0015.i420 +bf6548af193bc9f3ac8b4f51f1b02143 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0016.i420 +86833800e75fdc2a856bf39fb4f9b4b5 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0017.i420 +fda494de7b7a28f1093be1e497d47ef1 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0018.i420 +8cd6c7fb1ff27cfc321a1a96e6cf86d6 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0019.i420 +a58116c9c89efb4e4719637bb025358b vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0020.i420 +3938abc2be28ef0608e8ddc94bc86a9f vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0021.i420 +0e85999e990a208e391964325ee2b131 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0022.i420 +81223814e135dec485bf97f3a9447013 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0023.i420 +9cc93d04ebe14eb9f77f9ca8e5922586 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0024.i420 +4edc970574bb831df343dfc7b53e26ab vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0025.i420 +eace0f26c78b4e33c3fea40d2569bc51 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0026.i420 +c43ff9908531ef79d44a8349a7909893 vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0027.i420 +fb5b5327ac2462c3df514b5fcfc22d9e vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0028.i420 +3b4008109ec325cff65364150359818f vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0029.i420 +1688f6abdc248e4814e50004439b4c3f vp90-2-21-resize_inter_640x480_5_1-2.webm-320x240-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x480_5_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x480_5_3-4.webm.md5 new file mode 100644 index 0000000..6397459 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x480_5_3-4.webm.md5 @@ -0,0 +1,30 @@ +7109f3605fbb141997d6d79fbbd292c7 vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0001.i420 +bc4a8e393f125ec353fddbdc8d8a66ab vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0002.i420 +3a1cdb55cbdc4a5d1610d92ac80a7081 vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0003.i420 +3e438b170d93ad640e3c59646943fc7f vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0004.i420 +5946a4b5d4e14a5c3e908c7664f1ebc1 vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0005.i420 +a466d7cb3e4bd999a4bc8311cf8e4f81 vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0006.i420 +a09a9eb287196373d68fe1265d8dc27c vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0007.i420 +ab6ca8364923f658185d5823a14a105c vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0008.i420 +10625eec045228019d74f2df1b107675 vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0009.i420 +0b328a63046bcdec341f6ea8e7980c84 vp90-2-21-resize_inter_640x480_5_3-4.webm-640x480-0010.i420 +88523993ee2201280c79d1e7b606bc23 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0011.i420 +381f9da7c96f2892175c114d69b4daa6 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0012.i420 +4ed39272f8e015b425b7c1acfe57d4d8 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0013.i420 +0b9ff056ca44f0bc5fdb0b8347c3a94e vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0014.i420 +97454b6af43654930a71400a948daea8 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0015.i420 +f181d4d64d3740d9d599fd43204a2fcc vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0016.i420 +52ff59b4831877b799cf6f4d48872864 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0017.i420 +4680724bfe5b708f6f5d4bf1642ecbf1 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0018.i420 +2c10dc72e8fb8854c518bb8124f8363a vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0019.i420 +91ddd48c8e5490dfcc6dc781431a585c vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0020.i420 +e6c31d00110374f8f64814a7bd18261b vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0021.i420 +f7b29bc673d764ee691ad9e43a67d741 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0022.i420 +f689652bd223c58d3e7be0426e8b200b vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0023.i420 +2f5d92831cf6c0367a45e9f755c38bdb vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0024.i420 +e3dbbe62a495a48cf25216d5b078e05b vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0025.i420 +240f36c214df6dc3b47e5463fc9512cd vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0026.i420 +e25524bd29f563ad31c504145b773d69 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0027.i420 +095c3c01c9c5553edde74afd7ca9ddfa vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0028.i420 +2dc90e4408b36ac47e5448d436d809e0 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0029.i420 +c700b032329885bef7347027ab8870f7 vp90-2-21-resize_inter_640x480_5_3-4.webm-480x360-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x480_7_1-2.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x480_7_1-2.webm.md5 new file mode 100644 index 0000000..29267fe --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x480_7_1-2.webm.md5 @@ -0,0 +1,30 @@ +7109f3605fbb141997d6d79fbbd292c7 vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0001.i420 +464f2139bae85688198684607241264b vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0002.i420 +4a56b21033af483be809eae54ec242df vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0003.i420 +97c6b6a0a5f655b5ae42406802af2f8c vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0004.i420 +377bdf496092fb7c49576bc17650376c vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0005.i420 +f3a650bcd4269a02f087229c491e97e6 vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0006.i420 +35e492623322e3a705c62f64610aa939 vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0007.i420 +e682f90ddaf048c9fd83ca5dab8c928f vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0008.i420 +cab9b891b3b928fd68489b5602d3b1d3 vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0009.i420 +7078e18c2b078be46be4ac2f115f0ca1 vp90-2-21-resize_inter_640x480_7_1-2.webm-640x480-0010.i420 +ec282439d81a1008451cafb3f30a7c0d vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0011.i420 +e5713409b9bfab97feade9db425b7c36 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0012.i420 +02aa1c55ec4999239d67ae0ec43e56c9 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0013.i420 +cd39bc30496b428d7882f442737a779d vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0014.i420 +466c3b80275ddeaca08ab2ba9ecc3468 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0015.i420 +c2cce024597fe90abb5bb5374e41b785 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0016.i420 +6d036c028227c3abba1ebd48edad9fd5 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0017.i420 +4e2bc160d5fd344123ca207ba21fc0d0 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0018.i420 +5ff2e9222d3b538022fa2c9715085dd8 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0019.i420 +8a56063d2806107c662712b6fc798753 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0020.i420 +0ffe9eb8095d27fb4391b799f265bdd5 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0021.i420 +f0aa2ac52d0e2daadae938f96c5ce3d5 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0022.i420 +940f8532ffd3c3021c9cd95ef3b7a7da vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0023.i420 +d718424e4ea9b8a1d854eb26cc07b6cf vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0024.i420 +fa3649dd6458213934ae66213a69d601 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0025.i420 +7ddd29d570ba745fa5c3aadbaf71fb95 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0026.i420 +2b523529f5abbff1b9e34b31dceaf7c4 vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0027.i420 +103ed0b4fcde6491f98ec8747b57191e vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0028.i420 +8a1e9aaf6e577dc15f16f707a1ef777a vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0029.i420 +a296451fa1fc6c2ec283b76493e3175c vp90-2-21-resize_inter_640x480_7_1-2.webm-320x240-0030.i420 diff --git a/testdata/libvpx/vp90-2-21-resize_inter_640x480_7_3-4.webm.md5 b/testdata/libvpx/vp90-2-21-resize_inter_640x480_7_3-4.webm.md5 new file mode 100644 index 0000000..12b7897 --- /dev/null +++ b/testdata/libvpx/vp90-2-21-resize_inter_640x480_7_3-4.webm.md5 @@ -0,0 +1,30 @@ +7109f3605fbb141997d6d79fbbd292c7 vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0001.i420 +464f2139bae85688198684607241264b vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0002.i420 +4a56b21033af483be809eae54ec242df vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0003.i420 +97c6b6a0a5f655b5ae42406802af2f8c vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0004.i420 +377bdf496092fb7c49576bc17650376c vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0005.i420 +f3a650bcd4269a02f087229c491e97e6 vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0006.i420 +35e492623322e3a705c62f64610aa939 vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0007.i420 +e682f90ddaf048c9fd83ca5dab8c928f vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0008.i420 +cab9b891b3b928fd68489b5602d3b1d3 vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0009.i420 +7078e18c2b078be46be4ac2f115f0ca1 vp90-2-21-resize_inter_640x480_7_3-4.webm-640x480-0010.i420 +6989cba3f097688e2eb1a0f042d98b4c vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0011.i420 +03adea5c7c98215f83e793b2bdb91e81 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0012.i420 +d343ebbb52fefc6f9f3634a19a43cbc0 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0013.i420 +ea65032e6869ec304a040a0b05c3e8d0 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0014.i420 +e4dca1f9a7dfa82d1499244b761dc17d vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0015.i420 +2acf642cbaaa8a3cb95d1efec1093687 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0016.i420 +e78c525cf85c71fa3f163e05d7225f84 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0017.i420 +b9881bb6707c51bbfce19eb9ca370e16 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0018.i420 +14be36cb693abea74434985479f1830e vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0019.i420 +8ca9e6e3535368fd2fdaea926e3943ac vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0020.i420 +50e34f14124cbbbc48ce1bde0b0aebb9 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0021.i420 +81cba1c9e0f07fac22c3ad545b344e83 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0022.i420 +e22a51c506fe95d158fd04bb92a124fc vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0023.i420 +708b8a8cd2fd43b879561dea6ed5849f vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0024.i420 +e390d139cd2fb953bb771bb2f0024255 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0025.i420 +07036509ce7a02d969508c471588c5c4 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0026.i420 +b86bcb1ef7a948549995926729668c78 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0027.i420 +b241d0ebefccea1d17100d596a4c29a6 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0028.i420 +2311f2e982179037836113189632ada8 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0029.i420 +2220cec481ba81c8b6fde1da94aa46c8 vp90-2-21-resize_inter_640x480_7_3-4.webm-480x360-0030.i420 diff --git a/testdata/libvpx/vp90-2-22-svc_1280x720_1.webm.md5 b/testdata/libvpx/vp90-2-22-svc_1280x720_1.webm.md5 new file mode 100644 index 0000000..9915292 --- /dev/null +++ b/testdata/libvpx/vp90-2-22-svc_1280x720_1.webm.md5 @@ -0,0 +1,400 @@ +4c307af45bb8a5aefb8cca2641c9128f vp90-2-22-svc_1280x720_1.webm-1280x720-0001.i420 +8e373b92a12a505c2621ce323f41ad43 vp90-2-22-svc_1280x720_1.webm-1280x720-0002.i420 +54adf6d4707e9a1eb761c0fe2c631316 vp90-2-22-svc_1280x720_1.webm-1280x720-0003.i420 +b9402d695a11b175cb06a4405d7c0bc1 vp90-2-22-svc_1280x720_1.webm-1280x720-0004.i420 +ef28c80472bf0ac41da24a926d0d7906 vp90-2-22-svc_1280x720_1.webm-1280x720-0005.i420 +ffb2d69beaa0cdb81a8f614bf7e5c82a vp90-2-22-svc_1280x720_1.webm-1280x720-0006.i420 +dfc43af1792c5a0442b37754a85fb623 vp90-2-22-svc_1280x720_1.webm-1280x720-0007.i420 +3ed7fc511566d222f9b6ff259b193372 vp90-2-22-svc_1280x720_1.webm-1280x720-0008.i420 +7c14dfb85421cbb721747cbcd92cc612 vp90-2-22-svc_1280x720_1.webm-1280x720-0009.i420 +41bfaf416e5ed47069eda94354fed92b vp90-2-22-svc_1280x720_1.webm-1280x720-0010.i420 +16efab76de0ddf7505ce2aea5789bde1 vp90-2-22-svc_1280x720_1.webm-1280x720-0011.i420 +1b8869251bf3b7f5bdeca2094e3e51ee vp90-2-22-svc_1280x720_1.webm-1280x720-0012.i420 +1429ef4a198f3d5341015bee538c0f67 vp90-2-22-svc_1280x720_1.webm-1280x720-0013.i420 +af16fd9f5ae6a02b47eb543fc9b770da vp90-2-22-svc_1280x720_1.webm-1280x720-0014.i420 +32809f683727c8d386bc2ed0d0d5d92f vp90-2-22-svc_1280x720_1.webm-1280x720-0015.i420 +ff6ec9ec5beef8fa18de9ba66bb5dcda vp90-2-22-svc_1280x720_1.webm-1280x720-0016.i420 +60fb05c0512faaa4855a41335bc1232e vp90-2-22-svc_1280x720_1.webm-1280x720-0017.i420 +662410b18db7bf527a15f45c3387864f vp90-2-22-svc_1280x720_1.webm-1280x720-0018.i420 +ecdc5491e0adb9b19f8b87ed6e7ec1ba vp90-2-22-svc_1280x720_1.webm-1280x720-0019.i420 +7c606892eb31692c14e54bb511c8eefb vp90-2-22-svc_1280x720_1.webm-1280x720-0020.i420 +2ea44a28e94b494be166a9dec761b2a5 vp90-2-22-svc_1280x720_1.webm-1280x720-0021.i420 +cf0d86ed0056c866b3552decb849f7e0 vp90-2-22-svc_1280x720_1.webm-1280x720-0022.i420 +65cad60720bba021c26ee2492f1c49d6 vp90-2-22-svc_1280x720_1.webm-1280x720-0023.i420 +b37071e4dfa41dabb62b58a1efbabda8 vp90-2-22-svc_1280x720_1.webm-1280x720-0024.i420 +f935938d418be36a0f6f9ba24f393ffd vp90-2-22-svc_1280x720_1.webm-1280x720-0025.i420 +39d4cb3a17977423e76ab51e92f6dac4 vp90-2-22-svc_1280x720_1.webm-1280x720-0026.i420 +b853bb59f13fd4091162dae7532258a2 vp90-2-22-svc_1280x720_1.webm-1280x720-0027.i420 +598c0c86a6208aea8e4da8ad1e72c1e4 vp90-2-22-svc_1280x720_1.webm-1280x720-0028.i420 +ad191f3c20384f12501397ba03cb4f66 vp90-2-22-svc_1280x720_1.webm-1280x720-0029.i420 +64ea18c4557735e4b22dee052f8fe27f vp90-2-22-svc_1280x720_1.webm-1280x720-0030.i420 +88ee3a193af54f3e9a82c28b4459f777 vp90-2-22-svc_1280x720_1.webm-1280x720-0031.i420 +0e5ab2f70fc7fc35dfd7a75505b9db97 vp90-2-22-svc_1280x720_1.webm-1280x720-0032.i420 +0aa5c32795d8bf4096a8ccd54f325196 vp90-2-22-svc_1280x720_1.webm-1280x720-0033.i420 +8c43a9fc09849c897230097ba42084cb vp90-2-22-svc_1280x720_1.webm-1280x720-0034.i420 +2d20489be172b7344abf5f8ed7918d3c vp90-2-22-svc_1280x720_1.webm-1280x720-0035.i420 +2af7c6cdcee21c4d2d49883fcdb703c6 vp90-2-22-svc_1280x720_1.webm-1280x720-0036.i420 +6e8aeef6ddd2200a30369f121820d79e vp90-2-22-svc_1280x720_1.webm-1280x720-0037.i420 +14acba535dcf1d13340dd79da60178cf vp90-2-22-svc_1280x720_1.webm-1280x720-0038.i420 +05e44f9cad6d10e2a245ac4f03305199 vp90-2-22-svc_1280x720_1.webm-1280x720-0039.i420 +3e816d13d404ca3bc99806ecb6d2bb17 vp90-2-22-svc_1280x720_1.webm-1280x720-0040.i420 +7bfa438bf51b44464bf6c47e1f200dab vp90-2-22-svc_1280x720_1.webm-1280x720-0041.i420 +9ad5a1d33782ad0963ad3179fb9b1359 vp90-2-22-svc_1280x720_1.webm-1280x720-0042.i420 +7439da0ad7f86ab9484d2a55de4cfdb5 vp90-2-22-svc_1280x720_1.webm-1280x720-0043.i420 +05c45e6f375aa77260d656cab25b4be1 vp90-2-22-svc_1280x720_1.webm-1280x720-0044.i420 +f7081ed282d0c316e6d3c028a1f8c64d vp90-2-22-svc_1280x720_1.webm-1280x720-0045.i420 +52f59ab141a41749b8b48e7385e72da9 vp90-2-22-svc_1280x720_1.webm-1280x720-0046.i420 +829c75d2ab11ab9f5abad3a228440506 vp90-2-22-svc_1280x720_1.webm-1280x720-0047.i420 +9d4d8f4aafc5c8e269298c0202e6ce71 vp90-2-22-svc_1280x720_1.webm-1280x720-0048.i420 +6fed3bf364af5ab2628eac9b78223799 vp90-2-22-svc_1280x720_1.webm-1280x720-0049.i420 +81329cd15fa50696c96f1d57f4b5785a vp90-2-22-svc_1280x720_1.webm-1280x720-0050.i420 +acd5aca57bc0935f9151d9c6b3f4c8af vp90-2-22-svc_1280x720_1.webm-1280x720-0051.i420 +c20260832540eec42bd136df1f77c0f6 vp90-2-22-svc_1280x720_1.webm-1280x720-0052.i420 +e0fa2f7919a418e7200aec3ad604a16a vp90-2-22-svc_1280x720_1.webm-1280x720-0053.i420 +e21e4b494e483b6096ce654fe0fb7f12 vp90-2-22-svc_1280x720_1.webm-1280x720-0054.i420 +61667178ab2e103f7cf5d734a0d8aa82 vp90-2-22-svc_1280x720_1.webm-1280x720-0055.i420 +40335b72c684fc8765194cad6b9e12a4 vp90-2-22-svc_1280x720_1.webm-1280x720-0056.i420 +0fde72f4cd55128c3846f52a51982860 vp90-2-22-svc_1280x720_1.webm-1280x720-0057.i420 +fb89836e2bac13015bea22662caa6ad6 vp90-2-22-svc_1280x720_1.webm-1280x720-0058.i420 +20773ad86ef6e10fa65142dd471adfe7 vp90-2-22-svc_1280x720_1.webm-1280x720-0059.i420 +4390563c656cef5230761314f92a017a vp90-2-22-svc_1280x720_1.webm-1280x720-0060.i420 +6ad5a232f1a24872e53c7f4df5b144f8 vp90-2-22-svc_1280x720_1.webm-1280x720-0061.i420 +13c30baecf87b8e6a34ec5581619d076 vp90-2-22-svc_1280x720_1.webm-1280x720-0062.i420 +1320aa0d423a77d6041bbe2f7e19e291 vp90-2-22-svc_1280x720_1.webm-1280x720-0063.i420 +ed30fcd7533a51e733c36e49dadd3435 vp90-2-22-svc_1280x720_1.webm-1280x720-0064.i420 +15b018689e5a2118663fb63ab41d1ccb vp90-2-22-svc_1280x720_1.webm-1280x720-0065.i420 +a1925ee56daf4328e0c758a27cdd2644 vp90-2-22-svc_1280x720_1.webm-1280x720-0066.i420 +19f912f827ca0edbcba7628c20bf8b54 vp90-2-22-svc_1280x720_1.webm-1280x720-0067.i420 +554d23e9813e2adb686de8e45aa61b79 vp90-2-22-svc_1280x720_1.webm-1280x720-0068.i420 +bb61bc524eb9291263e8291d769c014c vp90-2-22-svc_1280x720_1.webm-1280x720-0069.i420 +9429ed5b037a23924eada21136ba534b vp90-2-22-svc_1280x720_1.webm-1280x720-0070.i420 +33d888bac163a1fcd4a91f9070fb1b36 vp90-2-22-svc_1280x720_1.webm-1280x720-0071.i420 +444fbf09166110ff156017a906b12b73 vp90-2-22-svc_1280x720_1.webm-1280x720-0072.i420 +ba2bd8a32cb64946ef1361b290e60826 vp90-2-22-svc_1280x720_1.webm-1280x720-0073.i420 +9c5300146ed02f9e7c444c326bab73da vp90-2-22-svc_1280x720_1.webm-1280x720-0074.i420 +425dfab7773dbe2dff1723db9b711cd5 vp90-2-22-svc_1280x720_1.webm-1280x720-0075.i420 +7bb16e15eb7828199a3b09ec1316c302 vp90-2-22-svc_1280x720_1.webm-1280x720-0076.i420 +01e7ec357f621e4bf064d1aa129132d9 vp90-2-22-svc_1280x720_1.webm-1280x720-0077.i420 +e7bff1ce6e2085d04838d4e0fde9a131 vp90-2-22-svc_1280x720_1.webm-1280x720-0078.i420 +32372baa416524ee59b5176bc785ad5a vp90-2-22-svc_1280x720_1.webm-1280x720-0079.i420 +9181e1057cd8ac84c15f8c0f319a8062 vp90-2-22-svc_1280x720_1.webm-1280x720-0080.i420 +cd3831f0d2b1020f727e156da5bf6051 vp90-2-22-svc_1280x720_1.webm-1280x720-0081.i420 +bf634076fa36d2a2d9eafa9aa2f7b605 vp90-2-22-svc_1280x720_1.webm-1280x720-0082.i420 +4c847871703a4a83dd72fca2567fbd14 vp90-2-22-svc_1280x720_1.webm-1280x720-0083.i420 +c7cdbe392451d62da1144c3eb3329360 vp90-2-22-svc_1280x720_1.webm-1280x720-0084.i420 +d75e8cadff78bcdee4d4ca9ae8bde45e vp90-2-22-svc_1280x720_1.webm-1280x720-0085.i420 +8c8cc2fcd3541a0ec44eb8fd9568c58b vp90-2-22-svc_1280x720_1.webm-1280x720-0086.i420 +b603c60b07eccfbd793cc1f8b241795c vp90-2-22-svc_1280x720_1.webm-1280x720-0087.i420 +2862b3a6b49d5e6230e199c47d482ccc vp90-2-22-svc_1280x720_1.webm-1280x720-0088.i420 +989499f2e47dabe73007c96685a0b14d vp90-2-22-svc_1280x720_1.webm-1280x720-0089.i420 +caccab81257dfe47c32ecdfe0c2868f6 vp90-2-22-svc_1280x720_1.webm-1280x720-0090.i420 +0d5a20a1a57dbf05cda453d75e35ebdd vp90-2-22-svc_1280x720_1.webm-1280x720-0091.i420 +7d5a29566f6f192aae43425c97fa4560 vp90-2-22-svc_1280x720_1.webm-1280x720-0092.i420 +9650d1cdd2026aebac238ab5f6d63530 vp90-2-22-svc_1280x720_1.webm-1280x720-0093.i420 +0721eb1040c978c994ba1d72fb0d54b7 vp90-2-22-svc_1280x720_1.webm-1280x720-0094.i420 +e312ebb9cc1e3c8cf331bfd52e2883ad vp90-2-22-svc_1280x720_1.webm-1280x720-0095.i420 +af5cbb5afbeeda167d6d662d8d2873e2 vp90-2-22-svc_1280x720_1.webm-1280x720-0096.i420 +e7019662aab6c72a9ada6eb4c3261b8a vp90-2-22-svc_1280x720_1.webm-1280x720-0097.i420 +613c52de9c0588c0e207a07d7e9e8927 vp90-2-22-svc_1280x720_1.webm-1280x720-0098.i420 +baeb0509a520b2bb11241e6113ea30e9 vp90-2-22-svc_1280x720_1.webm-1280x720-0099.i420 +21d6dfca6c1a0bc1109fdd6d2b12af0c vp90-2-22-svc_1280x720_1.webm-1280x720-0100.i420 +c3bca26331a78d8e7ad23b44a5346fa7 vp90-2-22-svc_1280x720_1.webm-1280x720-0101.i420 +9a68c058c2dc9ae55a8fd2d076f4de20 vp90-2-22-svc_1280x720_1.webm-1280x720-0102.i420 +6c27e6f0a6e0d3b0a694046d05f32bae vp90-2-22-svc_1280x720_1.webm-1280x720-0103.i420 +218ad4d94d1e13982f26298dff6d33c3 vp90-2-22-svc_1280x720_1.webm-1280x720-0104.i420 +69c63890c73f014c3afc47ff4d4bad35 vp90-2-22-svc_1280x720_1.webm-1280x720-0105.i420 +d1b2562c9d1fe136c39676de9a6da63a vp90-2-22-svc_1280x720_1.webm-1280x720-0106.i420 +379b7f81727f164edec474a99159eaf9 vp90-2-22-svc_1280x720_1.webm-1280x720-0107.i420 +fc95ce696f10ea5007461d53239343b2 vp90-2-22-svc_1280x720_1.webm-1280x720-0108.i420 +3990a1418e18d06c0e588436160f56ce vp90-2-22-svc_1280x720_1.webm-1280x720-0109.i420 +38b34c59ee0928b678512dd2d44405fc vp90-2-22-svc_1280x720_1.webm-1280x720-0110.i420 +ef5d45e7fe8dfbcc29c22a18a9ded865 vp90-2-22-svc_1280x720_1.webm-1280x720-0111.i420 +683d5755968b7d754e152fd1d51d8750 vp90-2-22-svc_1280x720_1.webm-1280x720-0112.i420 +4add096c2c5e07ea22f6f1bdf9f4b024 vp90-2-22-svc_1280x720_1.webm-1280x720-0113.i420 +16a7a4b2ae5c215cb80708ae67d4b2e9 vp90-2-22-svc_1280x720_1.webm-1280x720-0114.i420 +f9c81461eab22a7d4e390267b546d871 vp90-2-22-svc_1280x720_1.webm-1280x720-0115.i420 +e44a1642250d5a76b8836979c1972f2f vp90-2-22-svc_1280x720_1.webm-1280x720-0116.i420 +3d43ed49e1fcb367d0e24295560dcd2e vp90-2-22-svc_1280x720_1.webm-1280x720-0117.i420 +15329f5e2c4ffe33c5ba0b9368389c33 vp90-2-22-svc_1280x720_1.webm-1280x720-0118.i420 +033e53860810cc779575143526756d3e vp90-2-22-svc_1280x720_1.webm-1280x720-0119.i420 +702e1322f1b9f6bb2d9461eb2b53b11b vp90-2-22-svc_1280x720_1.webm-1280x720-0120.i420 +ca76cb61c0957a9aac48c2a7fe2cb985 vp90-2-22-svc_1280x720_1.webm-1280x720-0121.i420 +b974483351ee4dfb843575bddccea815 vp90-2-22-svc_1280x720_1.webm-1280x720-0122.i420 +64c59d55e1d425d07d2b604f0c1013c2 vp90-2-22-svc_1280x720_1.webm-1280x720-0123.i420 +36c3d6d1d0b43df11641639596007aaa vp90-2-22-svc_1280x720_1.webm-1280x720-0124.i420 +a1063af51e171ddb3a130cf5774420fd vp90-2-22-svc_1280x720_1.webm-1280x720-0125.i420 +729cd88657be19367baef5c1501aa08e vp90-2-22-svc_1280x720_1.webm-1280x720-0126.i420 +f05409108bdd9a03e3242bdb01b3ada3 vp90-2-22-svc_1280x720_1.webm-1280x720-0127.i420 +a3e4994d15530a826b637f07ff9079c9 vp90-2-22-svc_1280x720_1.webm-1280x720-0128.i420 +9a71ab35e364e0122dfee1fa946d1a51 vp90-2-22-svc_1280x720_1.webm-1280x720-0129.i420 +2f7fd354deedc62b7ff8c3f224b7f68f vp90-2-22-svc_1280x720_1.webm-1280x720-0130.i420 +80c0ef342712191f8664f1f3ae4d998f vp90-2-22-svc_1280x720_1.webm-1280x720-0131.i420 +5b0395640fc146d558a983b95e41eebc vp90-2-22-svc_1280x720_1.webm-1280x720-0132.i420 +3e3f7ab76e868b3dcd58bf0fcdbbb5c2 vp90-2-22-svc_1280x720_1.webm-1280x720-0133.i420 +ff7362cfc80d31de3723d3df8159ac7e vp90-2-22-svc_1280x720_1.webm-1280x720-0134.i420 +57cc2cac3aac1399da5d73c83f5ab2a9 vp90-2-22-svc_1280x720_1.webm-1280x720-0135.i420 +ff26b8665bf7cc84a65944f4c4ed82eb vp90-2-22-svc_1280x720_1.webm-1280x720-0136.i420 +9958068f53f9e0606076f0ca21fb6e01 vp90-2-22-svc_1280x720_1.webm-1280x720-0137.i420 +e3ac0e75dcda980031cc713e5a320ad9 vp90-2-22-svc_1280x720_1.webm-1280x720-0138.i420 +a7d7767a1f86f3d60195254d0fa6508f vp90-2-22-svc_1280x720_1.webm-1280x720-0139.i420 +f537a05318a15502766c05d940f53194 vp90-2-22-svc_1280x720_1.webm-1280x720-0140.i420 +33b73accfc3203e6eaaf49769b1a405e vp90-2-22-svc_1280x720_1.webm-1280x720-0141.i420 +03c6ec8fefbec29977ac1b2c40593d40 vp90-2-22-svc_1280x720_1.webm-1280x720-0142.i420 +8c0e876fe86aed40dde34c1fc0a3f3a7 vp90-2-22-svc_1280x720_1.webm-1280x720-0143.i420 +6071d55cce55f381f2ad86bfcb752fdb vp90-2-22-svc_1280x720_1.webm-1280x720-0144.i420 +f3370705d7851eca535d7979488d5d00 vp90-2-22-svc_1280x720_1.webm-1280x720-0145.i420 +947a1f06c537b042f70c69cc395624ec vp90-2-22-svc_1280x720_1.webm-1280x720-0146.i420 +62e5c9e37221fdfa6bf5adf2bf8dad68 vp90-2-22-svc_1280x720_1.webm-1280x720-0147.i420 +6cb6cd753b78b05fc76f06059ffcbb15 vp90-2-22-svc_1280x720_1.webm-1280x720-0148.i420 +868e9dd20364726a94b82922ab0d9b19 vp90-2-22-svc_1280x720_1.webm-1280x720-0149.i420 +555cdb3ca4636b639c7da4c8d1301c36 vp90-2-22-svc_1280x720_1.webm-1280x720-0150.i420 +948259cd85ab690a1dd659c0e6a4e0ff vp90-2-22-svc_1280x720_1.webm-1280x720-0151.i420 +7e4ff2e235a497e0715aa0105c215f41 vp90-2-22-svc_1280x720_1.webm-1280x720-0152.i420 +9122d8f704711ffae399e0faa8409c48 vp90-2-22-svc_1280x720_1.webm-1280x720-0153.i420 +eb3cb94a5aaf67689ffed86f98927aed vp90-2-22-svc_1280x720_1.webm-1280x720-0154.i420 +746f66fbafbcaa0f2bed8998459e7469 vp90-2-22-svc_1280x720_1.webm-1280x720-0155.i420 +0bc707a2eeb9541fc7ff2705420da4d6 vp90-2-22-svc_1280x720_1.webm-1280x720-0156.i420 +035efe48b40145945860eab73f5c0eb5 vp90-2-22-svc_1280x720_1.webm-1280x720-0157.i420 +f65406d9a079d585872cda2bd7ea0597 vp90-2-22-svc_1280x720_1.webm-1280x720-0158.i420 +1253a1a90b298d343c56a143285b6428 vp90-2-22-svc_1280x720_1.webm-1280x720-0159.i420 +a220c4cb346e9fef22809ccc3fd54e87 vp90-2-22-svc_1280x720_1.webm-1280x720-0160.i420 +24a6e2cfe0ab32473e661671189d41af vp90-2-22-svc_1280x720_1.webm-1280x720-0161.i420 +f71e1923d0a7211955f9dbe48043b08a vp90-2-22-svc_1280x720_1.webm-1280x720-0162.i420 +6a26453770f2bd3e00a7093f85e086b1 vp90-2-22-svc_1280x720_1.webm-1280x720-0163.i420 +2c136a56ce0da6a50cb1716a18c402c3 vp90-2-22-svc_1280x720_1.webm-1280x720-0164.i420 +9d5c8b5e983e4c8d8744f1e452ac90b9 vp90-2-22-svc_1280x720_1.webm-1280x720-0165.i420 +fba3806feef612f36085185d259b90e6 vp90-2-22-svc_1280x720_1.webm-1280x720-0166.i420 +9e3e613a288bb798f36b88cdb273d970 vp90-2-22-svc_1280x720_1.webm-1280x720-0167.i420 +cdfaadac276bdc06c9d9b1b4141672df vp90-2-22-svc_1280x720_1.webm-1280x720-0168.i420 +cf187d34f7e3480ed333ee805871bf5a vp90-2-22-svc_1280x720_1.webm-1280x720-0169.i420 +850d678bc08882dadfddf701b6d940db vp90-2-22-svc_1280x720_1.webm-1280x720-0170.i420 +b26cfa9dbace82920abec6645741f3d0 vp90-2-22-svc_1280x720_1.webm-1280x720-0171.i420 +b848772d9797eca2359d22567e381ac1 vp90-2-22-svc_1280x720_1.webm-1280x720-0172.i420 +2bf0eba2be547144fa6cb3357bb7239e vp90-2-22-svc_1280x720_1.webm-1280x720-0173.i420 +d0575184470c4fe8b10470547450d283 vp90-2-22-svc_1280x720_1.webm-1280x720-0174.i420 +de47ca12fe66aa798d540bceb6900544 vp90-2-22-svc_1280x720_1.webm-1280x720-0175.i420 +0c3d60d0fec2366fbe8b7057a13a32b7 vp90-2-22-svc_1280x720_1.webm-1280x720-0176.i420 +ff1506a5e12acdbcc4c83e62c8964357 vp90-2-22-svc_1280x720_1.webm-1280x720-0177.i420 +b1a8b47418a72ac89a78fcf4c4e2dcb5 vp90-2-22-svc_1280x720_1.webm-1280x720-0178.i420 +52247bf106bedfd0ade8e4a3a2651ac3 vp90-2-22-svc_1280x720_1.webm-1280x720-0179.i420 +0bb18501864fa620c84e9567eba58cb8 vp90-2-22-svc_1280x720_1.webm-1280x720-0180.i420 +52cf51c10d9c691b2b04378564927ab9 vp90-2-22-svc_1280x720_1.webm-1280x720-0181.i420 +651d78e5a043005380f61311e4730c80 vp90-2-22-svc_1280x720_1.webm-1280x720-0182.i420 +873e07ee94118db97fbb89d29edb5e4c vp90-2-22-svc_1280x720_1.webm-1280x720-0183.i420 +d2646f56b658609227d38fd011f0e6af vp90-2-22-svc_1280x720_1.webm-1280x720-0184.i420 +f2e91f403f33cd26163762195eef906e vp90-2-22-svc_1280x720_1.webm-1280x720-0185.i420 +e8fa396a3272cb3142c1937d530893fa vp90-2-22-svc_1280x720_1.webm-1280x720-0186.i420 +8e50324775b5ff09247ac519b4e1a28d vp90-2-22-svc_1280x720_1.webm-1280x720-0187.i420 +fcc2a905954ea24534bdb1edd84dd3bc vp90-2-22-svc_1280x720_1.webm-1280x720-0188.i420 +0a6083b3ec90ff8308ee5d8aa6b1732e vp90-2-22-svc_1280x720_1.webm-1280x720-0189.i420 +d24e965dd7d5f987f6ef8bf917573620 vp90-2-22-svc_1280x720_1.webm-1280x720-0190.i420 +a8d74c7a8de91c13426ea84adac4b761 vp90-2-22-svc_1280x720_1.webm-1280x720-0191.i420 +5edba26620fbba78ee0b0d89ea0071a0 vp90-2-22-svc_1280x720_1.webm-1280x720-0192.i420 +0226e1f3a95db383aa9393f57bd122b3 vp90-2-22-svc_1280x720_1.webm-1280x720-0193.i420 +e62683f3fcdd44c74f005edbbc81f177 vp90-2-22-svc_1280x720_1.webm-1280x720-0194.i420 +3a471f7f57094540ddafba57ee4d4383 vp90-2-22-svc_1280x720_1.webm-1280x720-0195.i420 +64e92c3390f3c9955a22c357ae3a7e65 vp90-2-22-svc_1280x720_1.webm-1280x720-0196.i420 +4c306d02cb0d079c51f1b0589b724a06 vp90-2-22-svc_1280x720_1.webm-1280x720-0197.i420 +f54a98177bae3a5cfb7b90e6a782cfc8 vp90-2-22-svc_1280x720_1.webm-1280x720-0198.i420 +78e8f0aa6b624d48feb71c0456a1e05e vp90-2-22-svc_1280x720_1.webm-1280x720-0199.i420 +aa9b3440c5e49c1ee4e2a00be7818cdd vp90-2-22-svc_1280x720_1.webm-1280x720-0200.i420 +036bc32e0714746632c4cd45cd1f97b3 vp90-2-22-svc_1280x720_1.webm-1280x720-0201.i420 +574de8f1f215ea600ad6760f72aadfe2 vp90-2-22-svc_1280x720_1.webm-1280x720-0202.i420 +23f35f189e9fb138c9f613fd70d21dab vp90-2-22-svc_1280x720_1.webm-1280x720-0203.i420 +ced65412d1c389dd1dfd274c06985ddb vp90-2-22-svc_1280x720_1.webm-1280x720-0204.i420 +8b09aca4457b2aa1b589c0a78265047b vp90-2-22-svc_1280x720_1.webm-1280x720-0205.i420 +b1293fe43d5eb7e63f991822eec17e25 vp90-2-22-svc_1280x720_1.webm-1280x720-0206.i420 +944197b3e89fb3adea0c570ef3e95dbd vp90-2-22-svc_1280x720_1.webm-1280x720-0207.i420 +f1e3b2089a0011343626a494c7f265a0 vp90-2-22-svc_1280x720_1.webm-1280x720-0208.i420 +73d0b249cab685355cca66bd71e01340 vp90-2-22-svc_1280x720_1.webm-1280x720-0209.i420 +ec86a56943d08050808596f46d5a9cc3 vp90-2-22-svc_1280x720_1.webm-1280x720-0210.i420 +00fe1182f91fec93f80308e244c48c23 vp90-2-22-svc_1280x720_1.webm-1280x720-0211.i420 +6c4f87a78b50f6fe1068806d62b22ae1 vp90-2-22-svc_1280x720_1.webm-1280x720-0212.i420 +781d41c3baf808b63f9b6ccfc14bc6a8 vp90-2-22-svc_1280x720_1.webm-1280x720-0213.i420 +c6039efe98a835c74e2382a84e061f49 vp90-2-22-svc_1280x720_1.webm-1280x720-0214.i420 +62f51d959bf8d06356fdb3b08bf90d2b vp90-2-22-svc_1280x720_1.webm-1280x720-0215.i420 +148cc206b17392bafcec3dc5af5c2cbb vp90-2-22-svc_1280x720_1.webm-1280x720-0216.i420 +7a5616151dd0a426a0456f303454e2f6 vp90-2-22-svc_1280x720_1.webm-1280x720-0217.i420 +a44474f3a2557a8dec829f3d4933f772 vp90-2-22-svc_1280x720_1.webm-1280x720-0218.i420 +e6339a0f3dd2d87d943d4c890921fd1d vp90-2-22-svc_1280x720_1.webm-1280x720-0219.i420 +b8d44eb80c3065358c7a4aa29ede3088 vp90-2-22-svc_1280x720_1.webm-1280x720-0220.i420 +1c53c58ac052e3b280de2c4d8c41c190 vp90-2-22-svc_1280x720_1.webm-1280x720-0221.i420 +346c4d2d1e4a93fa1d35dbf3731794a6 vp90-2-22-svc_1280x720_1.webm-1280x720-0222.i420 +55770efffd5455ab604948dbde6784a5 vp90-2-22-svc_1280x720_1.webm-1280x720-0223.i420 +e24158c0e06d6b9f9dc40efd336ed7f6 vp90-2-22-svc_1280x720_1.webm-1280x720-0224.i420 +3a352c252ced4a8fe66bab375142934d vp90-2-22-svc_1280x720_1.webm-1280x720-0225.i420 +3135ba4f47c0b78c23d5dd3bbe62ade0 vp90-2-22-svc_1280x720_1.webm-1280x720-0226.i420 +5beef953efab97c6011c22445c594239 vp90-2-22-svc_1280x720_1.webm-1280x720-0227.i420 +86d9a64d2e531a65797c8433099e2f73 vp90-2-22-svc_1280x720_1.webm-1280x720-0228.i420 +e166c0ffb28cae29018bba2ad7c69f06 vp90-2-22-svc_1280x720_1.webm-1280x720-0229.i420 +b66cb3c07dd28ecdc80713b4dce1ba3d vp90-2-22-svc_1280x720_1.webm-1280x720-0230.i420 +29b5c2960c93388c95f612bc39a74b5c vp90-2-22-svc_1280x720_1.webm-1280x720-0231.i420 +a53d83bc8a68919efc7ed9d30c2f3106 vp90-2-22-svc_1280x720_1.webm-1280x720-0232.i420 +fd7278737ebba46b33a26167848ee735 vp90-2-22-svc_1280x720_1.webm-1280x720-0233.i420 +735d54a1903a51cf5dcbe38be08b134c vp90-2-22-svc_1280x720_1.webm-1280x720-0234.i420 +462607226273dbcf2e6a2d1a9a467dd8 vp90-2-22-svc_1280x720_1.webm-1280x720-0235.i420 +931366e2a57dbe76a840f64092b66f18 vp90-2-22-svc_1280x720_1.webm-1280x720-0236.i420 +0a2f2131c75bd403248285dcc0b02def vp90-2-22-svc_1280x720_1.webm-1280x720-0237.i420 +cc9858c4be0c2409a2c711ae585e1a08 vp90-2-22-svc_1280x720_1.webm-1280x720-0238.i420 +31d574f08d53a68e9df411c734bd3a1b vp90-2-22-svc_1280x720_1.webm-1280x720-0239.i420 +4da72d80658c300548f0912c8661dfdb vp90-2-22-svc_1280x720_1.webm-1280x720-0240.i420 +bebf8f23eb3b42fd83dbed744c92cae6 vp90-2-22-svc_1280x720_1.webm-1280x720-0241.i420 +b5608adca47ee603569b819d07f1780c vp90-2-22-svc_1280x720_1.webm-1280x720-0242.i420 +f684298bd48bb922bc98be29ebae2801 vp90-2-22-svc_1280x720_1.webm-1280x720-0243.i420 +994e76f3f06e926c2b0403d3d5cda148 vp90-2-22-svc_1280x720_1.webm-1280x720-0244.i420 +9d901989dd76d4eb3238282f0f728e36 vp90-2-22-svc_1280x720_1.webm-1280x720-0245.i420 +767c6b9a1d67243793d2a978000449ab vp90-2-22-svc_1280x720_1.webm-1280x720-0246.i420 +c863c0f9b237973eab90b94383fabda0 vp90-2-22-svc_1280x720_1.webm-1280x720-0247.i420 +5972752264c121416efb165a085f7892 vp90-2-22-svc_1280x720_1.webm-1280x720-0248.i420 +415e2295f2c252cc8f376bee8f32ed9a vp90-2-22-svc_1280x720_1.webm-1280x720-0249.i420 +1bc19de3faa894a5c8af161c754f4bdf vp90-2-22-svc_1280x720_1.webm-1280x720-0250.i420 +b106332c1f2fcdd233ee802b56b6b77a vp90-2-22-svc_1280x720_1.webm-1280x720-0251.i420 +0180194341ae1eb41c2bd4e1b5ff28fd vp90-2-22-svc_1280x720_1.webm-1280x720-0252.i420 +2eb187c374ff9a7bc3f5ae0765d7ec58 vp90-2-22-svc_1280x720_1.webm-1280x720-0253.i420 +15ad372dd505e3f924132964ee915c66 vp90-2-22-svc_1280x720_1.webm-1280x720-0254.i420 +68b0b2b5847197baa0ba99f9472c56d8 vp90-2-22-svc_1280x720_1.webm-1280x720-0255.i420 +e9c53cbac03962a67de3ed8b8b693c2f vp90-2-22-svc_1280x720_1.webm-1280x720-0256.i420 +fb5b33fc00b72d801de6817fb221a87c vp90-2-22-svc_1280x720_1.webm-1280x720-0257.i420 +6352854564f9b3ad68439dccd84069bc vp90-2-22-svc_1280x720_1.webm-1280x720-0258.i420 +de8de5689b28091dd7ad4d934aec0642 vp90-2-22-svc_1280x720_1.webm-1280x720-0259.i420 +951c7fd6d7840e9fd0de47478dfb6e70 vp90-2-22-svc_1280x720_1.webm-1280x720-0260.i420 +ad86f28b48efe8c5a397ab66a9ed412d vp90-2-22-svc_1280x720_1.webm-1280x720-0261.i420 +d88386c198662462c331fb7cf8c7d303 vp90-2-22-svc_1280x720_1.webm-1280x720-0262.i420 +66e3d458e0e2edac7f38369f4010cc43 vp90-2-22-svc_1280x720_1.webm-1280x720-0263.i420 +bf44c8ead4db92fdc52fb77aec437a34 vp90-2-22-svc_1280x720_1.webm-1280x720-0264.i420 +f92758d31140a3ed6c664065c63c085e vp90-2-22-svc_1280x720_1.webm-1280x720-0265.i420 +27ad64d07cfe45ea6749131ecab5e781 vp90-2-22-svc_1280x720_1.webm-1280x720-0266.i420 +7f4f5632b610db0a5a9eefedf7ac2e35 vp90-2-22-svc_1280x720_1.webm-1280x720-0267.i420 +1129ad0166566c6831b588cc8f40e873 vp90-2-22-svc_1280x720_1.webm-1280x720-0268.i420 +9142613477ef97678dd6741d37a67d94 vp90-2-22-svc_1280x720_1.webm-1280x720-0269.i420 +9e81eedf0e9aea0dc35031ef184654e6 vp90-2-22-svc_1280x720_1.webm-1280x720-0270.i420 +8d4385077d216b18dcf63e07993ea4b4 vp90-2-22-svc_1280x720_1.webm-1280x720-0271.i420 +1de39f9a8f6f0bf728946d85e58dfd0a vp90-2-22-svc_1280x720_1.webm-1280x720-0272.i420 +f61b0c335f2e11576a098e17a6879051 vp90-2-22-svc_1280x720_1.webm-1280x720-0273.i420 +c9332bd79f6fffb235f49dca8791a305 vp90-2-22-svc_1280x720_1.webm-1280x720-0274.i420 +11895212e515734eb6214316a0fd5bad vp90-2-22-svc_1280x720_1.webm-1280x720-0275.i420 +952934f9eab2ca0aeefa99f074a0ea25 vp90-2-22-svc_1280x720_1.webm-1280x720-0276.i420 +c9a34d7c92fe67c964e777aa9c020fc7 vp90-2-22-svc_1280x720_1.webm-1280x720-0277.i420 +ae8c5a769a44d379c9bad1e7374861fb vp90-2-22-svc_1280x720_1.webm-1280x720-0278.i420 +33d73c8a053ae30a9598f2b6493eb920 vp90-2-22-svc_1280x720_1.webm-1280x720-0279.i420 +8e5a874e192a8a782ffe8c72cafa41ba vp90-2-22-svc_1280x720_1.webm-1280x720-0280.i420 +b4f931cbb1320945b5302bcf4c855b82 vp90-2-22-svc_1280x720_1.webm-1280x720-0281.i420 +2331af44d91cfa3d330a53134f9dbf07 vp90-2-22-svc_1280x720_1.webm-1280x720-0282.i420 +9b59a84fbbebff1b03fcbfb65fbe9084 vp90-2-22-svc_1280x720_1.webm-1280x720-0283.i420 +5885ce3052ee370f42dc8cd7600bc0d1 vp90-2-22-svc_1280x720_1.webm-1280x720-0284.i420 +f37d28feed35d818c693be009a870f8a vp90-2-22-svc_1280x720_1.webm-1280x720-0285.i420 +a9b6f071587f7c66b199a002fe974117 vp90-2-22-svc_1280x720_1.webm-1280x720-0286.i420 +71f92a22e2e4be45a0d4ca160dfdc218 vp90-2-22-svc_1280x720_1.webm-1280x720-0287.i420 +69f3a0b694a4a7028512b3bce46d7cdb vp90-2-22-svc_1280x720_1.webm-1280x720-0288.i420 +2c99d03f43382b4a468faf6f108a4932 vp90-2-22-svc_1280x720_1.webm-1280x720-0289.i420 +61f5a45ec0b075bbfa5fa3fca8bcf8a4 vp90-2-22-svc_1280x720_1.webm-1280x720-0290.i420 +388f2c0af0d9b2feda303b459f40788a vp90-2-22-svc_1280x720_1.webm-1280x720-0291.i420 +2884834914824aa2af6be442c1341227 vp90-2-22-svc_1280x720_1.webm-1280x720-0292.i420 +a530856a30112779e5d386a652323e46 vp90-2-22-svc_1280x720_1.webm-1280x720-0293.i420 +9e4ea98ceca4df25b347ee26298ba136 vp90-2-22-svc_1280x720_1.webm-1280x720-0294.i420 +cc88880a0d5707d713391b4c507dcc38 vp90-2-22-svc_1280x720_1.webm-1280x720-0295.i420 +f07a039da3d4c6962abddf48d48340d0 vp90-2-22-svc_1280x720_1.webm-1280x720-0296.i420 +6f127a282866678f2856c300a0cfb928 vp90-2-22-svc_1280x720_1.webm-1280x720-0297.i420 +dd16f5d4446934e6f30cfe7c17df2a8e vp90-2-22-svc_1280x720_1.webm-1280x720-0298.i420 +78ff1440fbc4eef77d917151b96b42e4 vp90-2-22-svc_1280x720_1.webm-1280x720-0299.i420 +e6e9d02acf8b22ad1f33f0f91947d0c7 vp90-2-22-svc_1280x720_1.webm-1280x720-0300.i420 +237cad94b36d4d6006379a777f4942d0 vp90-2-22-svc_1280x720_1.webm-1280x720-0301.i420 +0e2ed2e8b63b53f0123562ff0c14abbe vp90-2-22-svc_1280x720_1.webm-1280x720-0302.i420 +bc994bf3b0370a188dc644568be844e0 vp90-2-22-svc_1280x720_1.webm-1280x720-0303.i420 +7d9bd4847a74a2634235659396993132 vp90-2-22-svc_1280x720_1.webm-1280x720-0304.i420 +327b873c2374ab9791cb9b23ce3d0c5e vp90-2-22-svc_1280x720_1.webm-1280x720-0305.i420 +bf98d64d9ab07175b831661e8c1c4367 vp90-2-22-svc_1280x720_1.webm-1280x720-0306.i420 +2cf455ba95f00349469a4464325f3727 vp90-2-22-svc_1280x720_1.webm-1280x720-0307.i420 +d3a9820bf92b9bf5b769b46f0a4166b2 vp90-2-22-svc_1280x720_1.webm-1280x720-0308.i420 +618356617d1da11c0622d4964bc17951 vp90-2-22-svc_1280x720_1.webm-1280x720-0309.i420 +00712124a595b98fbd26759ecb6690d4 vp90-2-22-svc_1280x720_1.webm-1280x720-0310.i420 +a3da7ac86aeee1ef03ad9c1755fb4004 vp90-2-22-svc_1280x720_1.webm-1280x720-0311.i420 +6fed3eab75b4a05eff08a14e5495fbaf vp90-2-22-svc_1280x720_1.webm-1280x720-0312.i420 +4c5ecda6c24e0a2a27d58f73ac831791 vp90-2-22-svc_1280x720_1.webm-1280x720-0313.i420 +569378a465293b956fc675b18e0d4f5d vp90-2-22-svc_1280x720_1.webm-1280x720-0314.i420 +857ef5aacceba0efad59cbf37a1d1fca vp90-2-22-svc_1280x720_1.webm-1280x720-0315.i420 +7c1fcb9a32435fc3801eb93b8debd435 vp90-2-22-svc_1280x720_1.webm-1280x720-0316.i420 +2fa5e4fefdf598f679c76ffd1fca68c1 vp90-2-22-svc_1280x720_1.webm-1280x720-0317.i420 +99cface32f78a6d40c7c6ea98c66c922 vp90-2-22-svc_1280x720_1.webm-1280x720-0318.i420 +ca346230dcfd005dfe04d10f7e9c53ba vp90-2-22-svc_1280x720_1.webm-1280x720-0319.i420 +8c6be49ac99ac6c2c43e9a363cd456de vp90-2-22-svc_1280x720_1.webm-1280x720-0320.i420 +d9b7b0628e7cd9abca722df1d4d9cb10 vp90-2-22-svc_1280x720_1.webm-1280x720-0321.i420 +8aaab56aa26dee5808ff6b8b27863a77 vp90-2-22-svc_1280x720_1.webm-1280x720-0322.i420 +8421085268c326fee9157aa5bd37b09f vp90-2-22-svc_1280x720_1.webm-1280x720-0323.i420 +9aec98cb6873f2a5691e8b7095e16a9a vp90-2-22-svc_1280x720_1.webm-1280x720-0324.i420 +176de5fe8fa98d4c08e7c2284c201b9f vp90-2-22-svc_1280x720_1.webm-1280x720-0325.i420 +8fe0adc5e040ee544eedbbacd0fa2a7b vp90-2-22-svc_1280x720_1.webm-1280x720-0326.i420 +689159e056513513759ed16360d2d274 vp90-2-22-svc_1280x720_1.webm-1280x720-0327.i420 +eb6f8835c966aa188bfcba53933fb8a0 vp90-2-22-svc_1280x720_1.webm-1280x720-0328.i420 +32ba3974d4434eace67dce53545b1bc0 vp90-2-22-svc_1280x720_1.webm-1280x720-0329.i420 +53c3ea4cb5605f69b648262159c85cb0 vp90-2-22-svc_1280x720_1.webm-1280x720-0330.i420 +5fd0b8029092401bd1d84e0298a3e849 vp90-2-22-svc_1280x720_1.webm-1280x720-0331.i420 +cd39b38b479b96233d31ffb662b95eeb vp90-2-22-svc_1280x720_1.webm-1280x720-0332.i420 +3d32a603b3977d5a7c19c17648eac718 vp90-2-22-svc_1280x720_1.webm-1280x720-0333.i420 +098a30e2cc0c02d415bcf86774a03083 vp90-2-22-svc_1280x720_1.webm-1280x720-0334.i420 +5d95f4d9cc35f3deb9fc3f8a67df76de vp90-2-22-svc_1280x720_1.webm-1280x720-0335.i420 +86cc4add4d0cbd5562f9bf0b23714e99 vp90-2-22-svc_1280x720_1.webm-1280x720-0336.i420 +9e1fd696ac5b8937ff951514437b0b8f vp90-2-22-svc_1280x720_1.webm-1280x720-0337.i420 +23b5d237ab012d571cc6909ccb82f202 vp90-2-22-svc_1280x720_1.webm-1280x720-0338.i420 +572d63e15fc23224953d157bf43a4c6b vp90-2-22-svc_1280x720_1.webm-1280x720-0339.i420 +d2add91896ecd9744352f15b02d0296b vp90-2-22-svc_1280x720_1.webm-1280x720-0340.i420 +ee51460f9883b5cd84f0f1965513e783 vp90-2-22-svc_1280x720_1.webm-1280x720-0341.i420 +af1ee71a0fd8c38e37dd47ebb0459066 vp90-2-22-svc_1280x720_1.webm-1280x720-0342.i420 +1fdcdfe06b3d10e009f952b62c9436f3 vp90-2-22-svc_1280x720_1.webm-1280x720-0343.i420 +603eda3bc16ce4384d69847ec694f678 vp90-2-22-svc_1280x720_1.webm-1280x720-0344.i420 +568569d80f7deb80ed4e534ad6ef8aac vp90-2-22-svc_1280x720_1.webm-1280x720-0345.i420 +6e2dc3bd8f60aa5d26c9d7150caa0a78 vp90-2-22-svc_1280x720_1.webm-1280x720-0346.i420 +39e104a19ba035043dfd5b795b6e1aad vp90-2-22-svc_1280x720_1.webm-1280x720-0347.i420 +6a11a2db38160fde99a1b2aa8e87d641 vp90-2-22-svc_1280x720_1.webm-1280x720-0348.i420 +75e38a4b2563ec337611efd0be0b18ba vp90-2-22-svc_1280x720_1.webm-1280x720-0349.i420 +cd90cb699098a6372f5067e4310c3bdd vp90-2-22-svc_1280x720_1.webm-1280x720-0350.i420 +f948f2bd913717b62d0a2db4463e6610 vp90-2-22-svc_1280x720_1.webm-1280x720-0351.i420 +540ca6540a30de443cfe84c5ed299667 vp90-2-22-svc_1280x720_1.webm-1280x720-0352.i420 +7617998f9c57dba5d434dac48f31c399 vp90-2-22-svc_1280x720_1.webm-1280x720-0353.i420 +be180a1839655ef555e73b2c324fd11b vp90-2-22-svc_1280x720_1.webm-1280x720-0354.i420 +80fec30cb17e284183b335c74a54270b vp90-2-22-svc_1280x720_1.webm-1280x720-0355.i420 +23c5c75dada7dcb99d58f7180a8fc76d vp90-2-22-svc_1280x720_1.webm-1280x720-0356.i420 +84837817f35a59bdc992e94912c63653 vp90-2-22-svc_1280x720_1.webm-1280x720-0357.i420 +4ad148c8aefb46994b62bc7980640563 vp90-2-22-svc_1280x720_1.webm-1280x720-0358.i420 +e2cbdff4ad8c5907a44bca6158df41bb vp90-2-22-svc_1280x720_1.webm-1280x720-0359.i420 +44aeab1eef1263b668587cd9bdf58853 vp90-2-22-svc_1280x720_1.webm-1280x720-0360.i420 +a0c12e52f813a184e32636fe53fd9f61 vp90-2-22-svc_1280x720_1.webm-1280x720-0361.i420 +005c4c89f4645338fa6911f89af46d53 vp90-2-22-svc_1280x720_1.webm-1280x720-0362.i420 +be31f6beb0106018975d487498db8720 vp90-2-22-svc_1280x720_1.webm-1280x720-0363.i420 +6971fcc90f252592462466f316f7b998 vp90-2-22-svc_1280x720_1.webm-1280x720-0364.i420 +12811bd010dec7e9d4ca59795f843f44 vp90-2-22-svc_1280x720_1.webm-1280x720-0365.i420 +32110c8decad12c7a21cb1afec88335c vp90-2-22-svc_1280x720_1.webm-1280x720-0366.i420 +ff798bdae3ef6160e1b9c45b1c18bb41 vp90-2-22-svc_1280x720_1.webm-1280x720-0367.i420 +119addc8975d36812ea86eda7c6889e0 vp90-2-22-svc_1280x720_1.webm-1280x720-0368.i420 +db22f407e5c66aacd6df8b5ec7b1d620 vp90-2-22-svc_1280x720_1.webm-1280x720-0369.i420 +27ba9216e3f04f02827ef19018f4e18d vp90-2-22-svc_1280x720_1.webm-1280x720-0370.i420 +6c9272e95db59a4dd2e94d0fbb70fb3e vp90-2-22-svc_1280x720_1.webm-1280x720-0371.i420 +0346acd877af2d8bba285c3fb519fd08 vp90-2-22-svc_1280x720_1.webm-1280x720-0372.i420 +ca79fa02c03541331c113cbd6ce558af vp90-2-22-svc_1280x720_1.webm-1280x720-0373.i420 +effc28f199d3b5054f22f316e90d34d0 vp90-2-22-svc_1280x720_1.webm-1280x720-0374.i420 +1f1eb2d13dc2967295bda3c51aafa829 vp90-2-22-svc_1280x720_1.webm-1280x720-0375.i420 +1c0d1c9684d86b1072e64c5a69dc27be vp90-2-22-svc_1280x720_1.webm-1280x720-0376.i420 +7e8f349ca3e9e850cf2c14d9f563b075 vp90-2-22-svc_1280x720_1.webm-1280x720-0377.i420 +8b3fdc9370bb32415f2a70f94b242cf7 vp90-2-22-svc_1280x720_1.webm-1280x720-0378.i420 +ec47207fa855caee122bc2f1b7669447 vp90-2-22-svc_1280x720_1.webm-1280x720-0379.i420 +09965143b16f92b0bd29534f5e45dddf vp90-2-22-svc_1280x720_1.webm-1280x720-0380.i420 +184947fd60a83c1d1566af5c17a68b73 vp90-2-22-svc_1280x720_1.webm-1280x720-0381.i420 +fa80ea349c7a245f2872efc88c70c7e6 vp90-2-22-svc_1280x720_1.webm-1280x720-0382.i420 +d422151cf376b96faef68d661137dfe6 vp90-2-22-svc_1280x720_1.webm-1280x720-0383.i420 +b245d6e5f94eca21e43adf42fd04a784 vp90-2-22-svc_1280x720_1.webm-1280x720-0384.i420 +41375a7a8c37c086e74c09a71a01ac4f vp90-2-22-svc_1280x720_1.webm-1280x720-0385.i420 +7b3a73c10b0b3acbcba0bd1b9b43bb0a vp90-2-22-svc_1280x720_1.webm-1280x720-0386.i420 +d1e6d0ba891d8f1a99aa27b70eb31a54 vp90-2-22-svc_1280x720_1.webm-1280x720-0387.i420 +70a037d48d0e7ad6e5fc2d24004a67b5 vp90-2-22-svc_1280x720_1.webm-1280x720-0388.i420 +00472ce282d99e24be942247909fadbe vp90-2-22-svc_1280x720_1.webm-1280x720-0389.i420 +f11001c0a5cd52a1a312b51d98e00c90 vp90-2-22-svc_1280x720_1.webm-1280x720-0390.i420 +92405802dcb19cfeea988e218e00cbae vp90-2-22-svc_1280x720_1.webm-1280x720-0391.i420 +8d34f077f946572514a7c6d3f009ace0 vp90-2-22-svc_1280x720_1.webm-1280x720-0392.i420 +8c4786da7db2dfa8bbec4a1de1e68f57 vp90-2-22-svc_1280x720_1.webm-1280x720-0393.i420 +90e1b74ebb099fc68e5782519e654ee0 vp90-2-22-svc_1280x720_1.webm-1280x720-0394.i420 +80c3b72e48e571704834fc6d305eec1b vp90-2-22-svc_1280x720_1.webm-1280x720-0395.i420 +bda771507fc21a82e5bc5ec982d5a38d vp90-2-22-svc_1280x720_1.webm-1280x720-0396.i420 +6586cbd3b72d1b71813e8fadaeea4f2f vp90-2-22-svc_1280x720_1.webm-1280x720-0397.i420 +f7906489d9ad484533ab3fc62daf80e3 vp90-2-22-svc_1280x720_1.webm-1280x720-0398.i420 +b3eeca5b1852b68d10eed537303774d2 vp90-2-22-svc_1280x720_1.webm-1280x720-0399.i420 +597dd77234d72827e4a29dbc62a31423 vp90-2-22-svc_1280x720_1.webm-1280x720-0400.i420 diff --git a/testdata/libvpx/vp90-2-22-svc_1280x720_3.ivf.md5 b/testdata/libvpx/vp90-2-22-svc_1280x720_3.ivf.md5 new file mode 100644 index 0000000..900faaa --- /dev/null +++ b/testdata/libvpx/vp90-2-22-svc_1280x720_3.ivf.md5 @@ -0,0 +1,20 @@ +369f3d6ce1ba7ad7bd5716d0aef8daf4 vp90-2-22-svc_1280x720_3.ivf-1280x720-0001.i420 +0ad5c83e585de549cfc9ded9fa4c5492 vp90-2-22-svc_1280x720_3.ivf-1280x720-0002.i420 +a2219e6319c1a349823ac3db9622c0f5 vp90-2-22-svc_1280x720_3.ivf-1280x720-0003.i420 +d4a14bbfa9578135b1009093b8d125b6 vp90-2-22-svc_1280x720_3.ivf-1280x720-0004.i420 +6df51e3ddd37327515b2b89bc52eebc8 vp90-2-22-svc_1280x720_3.ivf-1280x720-0005.i420 +1f50b4aae62052626ecd809ba74be743 vp90-2-22-svc_1280x720_3.ivf-1280x720-0006.i420 +7457c267eeeded57f6d08b2673cdca9e vp90-2-22-svc_1280x720_3.ivf-1280x720-0007.i420 +c0ba7c866797cda601a4a7ab7e86a68f vp90-2-22-svc_1280x720_3.ivf-1280x720-0008.i420 +ef7b294358c7cd85a9c1fb38686b5600 vp90-2-22-svc_1280x720_3.ivf-1280x720-0009.i420 +ef973b7ca33b85eda6dce6d89a103fde vp90-2-22-svc_1280x720_3.ivf-1280x720-0010.i420 +11a8e5fbb31f42d9b6e4d5302709e907 vp90-2-22-svc_1280x720_3.ivf-1280x720-0011.i420 +c386ad4d05574cc6da59fa8c7971900d vp90-2-22-svc_1280x720_3.ivf-1280x720-0012.i420 +653e7d0431a14d6c29d64430b30591f4 vp90-2-22-svc_1280x720_3.ivf-1280x720-0013.i420 +02f6165a9f1a67606069acb95bf9f525 vp90-2-22-svc_1280x720_3.ivf-1280x720-0014.i420 +885f65f3429939dbd7e5cfda9be2d068 vp90-2-22-svc_1280x720_3.ivf-1280x720-0015.i420 +f4eeab0becc7bf6b527686004547064e vp90-2-22-svc_1280x720_3.ivf-1280x720-0016.i420 +7e9919a78dd20bbbb85a12d8535411ed vp90-2-22-svc_1280x720_3.ivf-1280x720-0017.i420 +c752c0b777b91bf82331f7ab2c616a5e vp90-2-22-svc_1280x720_3.ivf-1280x720-0018.i420 +c4f6a681e24b0a4848e2398b66a8fdab vp90-2-22-svc_1280x720_3.ivf-1280x720-0019.i420 +a765ba4e273d559c8421589d89a070f5 vp90-2-22-svc_1280x720_3.ivf-1280x720-0020.i420 diff --git a/testdata/libvpx/vp91-2-04-yuv422.webm.md5 b/testdata/libvpx/vp91-2-04-yuv422.webm.md5 new file mode 100644 index 0000000..dc35a37 --- /dev/null +++ b/testdata/libvpx/vp91-2-04-yuv422.webm.md5 @@ -0,0 +1,10 @@ +b81b8a8444ac6ce4a4807c37e0a44c8b vp91-2-04-yuv422.webm-160x90-0001.i422 +344458b82d35ea9944dc841643fc25c2 vp91-2-04-yuv422.webm-160x90-0002.i422 +376a4bb3944f052191963740b980eb26 vp91-2-04-yuv422.webm-160x90-0003.i422 +2fecb02c842bd7d588415904f2d3a82d vp91-2-04-yuv422.webm-160x90-0004.i422 +0fda2f1dabba5c179599190f179b9782 vp91-2-04-yuv422.webm-160x90-0005.i422 +a88ac885ee59e3a3a01fa483cdd40274 vp91-2-04-yuv422.webm-160x90-0006.i422 +e76b488ffa70a05457fc046e7b999c56 vp91-2-04-yuv422.webm-160x90-0007.i422 +74ae5e52162f5bbc95258d44a2dd647c vp91-2-04-yuv422.webm-160x90-0008.i422 +0c017e2b12e5192c8d598941d9c93306 vp91-2-04-yuv422.webm-160x90-0009.i422 +ca3941ee43b7033cb48f8498af127d53 vp91-2-04-yuv422.webm-160x90-0010.i422 diff --git a/testdata/libvpx/vp91-2-04-yuv440.webm.md5 b/testdata/libvpx/vp91-2-04-yuv440.webm.md5 new file mode 100644 index 0000000..afb5dcb --- /dev/null +++ b/testdata/libvpx/vp91-2-04-yuv440.webm.md5 @@ -0,0 +1,10 @@ +61157ad4fb02a254de8f34ae7b8915dc vp91-2-04-yuv440.webm-160x90-0001.i440 +9431337382bf90d40aa417e297ac05da vp91-2-04-yuv440.webm-160x90-0002.i440 +56b739049cc9e97a1d82018bba3db0ee vp91-2-04-yuv440.webm-160x90-0003.i440 +75138a9b6bb905b2f79a1ebb959ddfea vp91-2-04-yuv440.webm-160x90-0004.i440 +141b2fc9625fad86577838d84a276ef8 vp91-2-04-yuv440.webm-160x90-0005.i440 +b364668c44a237d4e532e086a55401a9 vp91-2-04-yuv440.webm-160x90-0006.i440 +a4ca6014d5194e4c921a4cb4289eb315 vp91-2-04-yuv440.webm-160x90-0007.i440 +cfcacb3d5086d3861f4712a3c87a6b6c vp91-2-04-yuv440.webm-160x90-0008.i440 +228d3fd3d849d021f3690cc538edb0a3 vp91-2-04-yuv440.webm-160x90-0009.i440 +97ecf281eb1130723d70e3c8803fa814 vp91-2-04-yuv440.webm-160x90-0010.i440 diff --git a/testdata/libvpx/vp91-2-04-yuv444.webm.md5 b/testdata/libvpx/vp91-2-04-yuv444.webm.md5 new file mode 100644 index 0000000..ce061c5 --- /dev/null +++ b/testdata/libvpx/vp91-2-04-yuv444.webm.md5 @@ -0,0 +1,10 @@ +859df7b3661783e337a16ee79f3c20bc vp91-2-04-yuv444.webm-352x288-0001.i444 +3b3ccf344cd5a478c4c1fa422497183d vp91-2-04-yuv444.webm-352x288-0002.i444 +3be1f565823cb88013a14a93a3cf9480 vp91-2-04-yuv444.webm-352x288-0003.i444 +6e188a963deaf46c2d6e741b03c4240c vp91-2-04-yuv444.webm-352x288-0004.i444 +82ead184ae478ac821b1b4b72f28c9cd vp91-2-04-yuv444.webm-352x288-0005.i444 +59bb43badc76b39a228b1ad96b6339ca vp91-2-04-yuv444.webm-352x288-0006.i444 +2eaee790fc188e2251b92dd4ea90c42a vp91-2-04-yuv444.webm-352x288-0007.i444 +2a95f8727589e710dc1b95400916b72e vp91-2-04-yuv444.webm-352x288-0008.i444 +b7032f73544a7108fcdcaca2832ecc32 vp91-2-04-yuv444.webm-352x288-0009.i444 +b7778c35b30bcc400b25ed0e5b7913e1 vp91-2-04-yuv444.webm-352x288-0010.i444 diff --git a/testdata/libvpx/vp92-2-20-10bit-yuv420.webm.md5 b/testdata/libvpx/vp92-2-20-10bit-yuv420.webm.md5 new file mode 100644 index 0000000..6b37ea6 --- /dev/null +++ b/testdata/libvpx/vp92-2-20-10bit-yuv420.webm.md5 @@ -0,0 +1,10 @@ +c3964ed9065de7f839b8d878444c6140 vp92-2-20-10bit-yuv420.webm-160x90-0001.i420 +87595f7f53d6e84af9708dba72422cc4 vp92-2-20-10bit-yuv420.webm-160x90-0002.i420 +5cadbce099363a71040919e6f1cec496 vp92-2-20-10bit-yuv420.webm-160x90-0003.i420 +0e3cab2b26b936de245a94b4128a368f vp92-2-20-10bit-yuv420.webm-160x90-0004.i420 +07bde452ca50655717a85cd9fdb3f7ce vp92-2-20-10bit-yuv420.webm-160x90-0005.i420 +00bee090fe849fee5fd4eb169c62c897 vp92-2-20-10bit-yuv420.webm-160x90-0006.i420 +4564a423df89d7e9dea1226873ce9a51 vp92-2-20-10bit-yuv420.webm-160x90-0007.i420 +7580af6956360112191380a677f5e625 vp92-2-20-10bit-yuv420.webm-160x90-0008.i420 +c9d05c5aadf8a372acfc2c93094d003e vp92-2-20-10bit-yuv420.webm-160x90-0009.i420 +6c08ea732cda06cf9a12f2e1a089d401 vp92-2-20-10bit-yuv420.webm-160x90-0010.i420 diff --git a/testdata/libvpx/vp92-2-20-12bit-yuv420.webm.md5 b/testdata/libvpx/vp92-2-20-12bit-yuv420.webm.md5 new file mode 100644 index 0000000..bd45cab --- /dev/null +++ b/testdata/libvpx/vp92-2-20-12bit-yuv420.webm.md5 @@ -0,0 +1,10 @@ +8403bd5a381737e1c2d737047f6a5a0b vp92-2-20-12bit-yuv420.webm-160x90-0001.i420 +3c0bf7eecc3131e3598f6810d6b70539 vp92-2-20-12bit-yuv420.webm-160x90-0002.i420 +ff020bf894bb88d74426f02a75081695 vp92-2-20-12bit-yuv420.webm-160x90-0003.i420 +097d81cb29f1caaf4446f3a3de4842d9 vp92-2-20-12bit-yuv420.webm-160x90-0004.i420 +e923a7e7e0349846ba27bd2e6ebdf4df vp92-2-20-12bit-yuv420.webm-160x90-0005.i420 +28c6016e6687c7eecbe4057a4dbfe372 vp92-2-20-12bit-yuv420.webm-160x90-0006.i420 +15ae05537ea7152b535d112871b5ef84 vp92-2-20-12bit-yuv420.webm-160x90-0007.i420 +cb50d043a10a0e9b52eed0e8b3aabc7b vp92-2-20-12bit-yuv420.webm-160x90-0008.i420 +f97dfbce56e36a42538ef000ce0e937e vp92-2-20-12bit-yuv420.webm-160x90-0009.i420 +aae42063df910ed31c09eba5f73a195c vp92-2-20-12bit-yuv420.webm-160x90-0010.i420 diff --git a/testdata/libvpx/vp93-2-20-10bit-yuv422.webm.md5 b/testdata/libvpx/vp93-2-20-10bit-yuv422.webm.md5 new file mode 100644 index 0000000..f3dadf7 --- /dev/null +++ b/testdata/libvpx/vp93-2-20-10bit-yuv422.webm.md5 @@ -0,0 +1,10 @@ +18fed3eff623f0308561e5db0bc28691 vp93-2-20-10bit-yuv422.webm-160x90-0001.i422 +3f22b2269cd53738e955c4b27ff6abce vp93-2-20-10bit-yuv422.webm-160x90-0002.i422 +d1a44bae5cf45c68c5ca86f9e1ffd6a0 vp93-2-20-10bit-yuv422.webm-160x90-0003.i422 +6592a5b6f1a8a18930bf27195a836efc vp93-2-20-10bit-yuv422.webm-160x90-0004.i422 +f1dc8ba72916630aa8ff07f214bd1baf vp93-2-20-10bit-yuv422.webm-160x90-0005.i422 +195db6438c313e870ecfe9db3e3cbe83 vp93-2-20-10bit-yuv422.webm-160x90-0006.i422 +ad1cca6689026c31c2350594b669b7e7 vp93-2-20-10bit-yuv422.webm-160x90-0007.i422 +6cb437a604a714ea746b429cdd68c47f vp93-2-20-10bit-yuv422.webm-160x90-0008.i422 +cda524f9de8774cc161224c3b81033f5 vp93-2-20-10bit-yuv422.webm-160x90-0009.i422 +a2ae05ae998b4158a32b96e01ed02241 vp93-2-20-10bit-yuv422.webm-160x90-0010.i422 diff --git a/testdata/libvpx/vp93-2-20-10bit-yuv440.webm.md5 b/testdata/libvpx/vp93-2-20-10bit-yuv440.webm.md5 new file mode 100644 index 0000000..9474b84 --- /dev/null +++ b/testdata/libvpx/vp93-2-20-10bit-yuv440.webm.md5 @@ -0,0 +1,20 @@ +504a347654ef41e568c484ab017f5387 vp93-2-20-10bit-yuv440.webm-160x90-0001.i440 +6110f151a39144da5616227d44b81c21 vp93-2-20-10bit-yuv440.webm-160x90-0002.i440 +a856b5e0675c59fb9329d087580c6c5b vp93-2-20-10bit-yuv440.webm-160x90-0003.i440 +d951b271bf38e7c9b9d215f7a87a079c vp93-2-20-10bit-yuv440.webm-160x90-0004.i440 +a9e6feb4142a111c74d46cdbac08f2e6 vp93-2-20-10bit-yuv440.webm-160x90-0005.i440 +4802b599651e7aa35cd52d0dfbfaa4d3 vp93-2-20-10bit-yuv440.webm-160x90-0006.i440 +1244f3b9da3341057566915e708c7afb vp93-2-20-10bit-yuv440.webm-160x90-0007.i440 +212a02d7ee8d56b6f2a4fd7ee6eb3c93 vp93-2-20-10bit-yuv440.webm-160x90-0008.i440 +1872091be977628ff5435f9186f64a29 vp93-2-20-10bit-yuv440.webm-160x90-0009.i440 +d5255599c33859ee96474a20929dc4bb vp93-2-20-10bit-yuv440.webm-160x90-0010.i440 +16d0056501cd1bfc630f6f99672504a0 vp93-2-20-10bit-yuv440.webm-160x90-0011.i440 +7dcca62c4dc5d508f38376533648bce6 vp93-2-20-10bit-yuv440.webm-160x90-0012.i440 +1e1617813af32cbf7be3df11d275339e vp93-2-20-10bit-yuv440.webm-160x90-0013.i440 +88b036fde717f72485b24e346f55f9dc vp93-2-20-10bit-yuv440.webm-160x90-0014.i440 +e689287b89b116ec71670ee479e15717 vp93-2-20-10bit-yuv440.webm-160x90-0015.i440 +211aa3727dcde2d9dfe15d6cebda69e4 vp93-2-20-10bit-yuv440.webm-160x90-0016.i440 +3037677f680cbdcac242da94717da3ff vp93-2-20-10bit-yuv440.webm-160x90-0017.i440 +0138ea9fd279a939df385ea0c97700ca vp93-2-20-10bit-yuv440.webm-160x90-0018.i440 +9da47cb99085c352f9e9a07639a9b3cb vp93-2-20-10bit-yuv440.webm-160x90-0019.i440 +d369f4c840ccb61ce3aaffc77b5f230e vp93-2-20-10bit-yuv440.webm-160x90-0020.i440 diff --git a/testdata/libvpx/vp93-2-20-10bit-yuv444.webm.md5 b/testdata/libvpx/vp93-2-20-10bit-yuv444.webm.md5 new file mode 100644 index 0000000..a82b9c0 --- /dev/null +++ b/testdata/libvpx/vp93-2-20-10bit-yuv444.webm.md5 @@ -0,0 +1,10 @@ +06a4c4550dc31f75f842a4e65fc32398 vp93-2-20-10bit-yuv444.webm-160x90-0001.i444 +f7feda15d5c2babc1f6438c72d4900e4 vp93-2-20-10bit-yuv444.webm-160x90-0002.i444 +5aa9924c0a17c2209b72ba7ec9af6fdd vp93-2-20-10bit-yuv444.webm-160x90-0003.i444 +01597451aab5498ba89a7f632cd7d0cf vp93-2-20-10bit-yuv444.webm-160x90-0004.i444 +9a42ae17c2744c305895acd911066575 vp93-2-20-10bit-yuv444.webm-160x90-0005.i444 +17c1d9cda113a3ce2fc7387e2adaa89b vp93-2-20-10bit-yuv444.webm-160x90-0006.i444 +6c6e303d282d8e043329eb6b29600cb4 vp93-2-20-10bit-yuv444.webm-160x90-0007.i444 +97b7d47711222a91dd7ac121df01f922 vp93-2-20-10bit-yuv444.webm-160x90-0008.i444 +69f305bc0a4a92422b5ebe05a3ac8b38 vp93-2-20-10bit-yuv444.webm-160x90-0009.i444 +a559c738c428c2f895e94a31957eec6b vp93-2-20-10bit-yuv444.webm-160x90-0010.i444 diff --git a/testdata/libvpx/vp93-2-20-12bit-yuv422.webm.md5 b/testdata/libvpx/vp93-2-20-12bit-yuv422.webm.md5 new file mode 100644 index 0000000..db46767 --- /dev/null +++ b/testdata/libvpx/vp93-2-20-12bit-yuv422.webm.md5 @@ -0,0 +1,10 @@ +442a6d932a163907303f1e08056b33b3 vp93-2-20-12bit-yuv422.webm-160x90-0001.i422 +80b21954eb522f0140e2226a03062839 vp93-2-20-12bit-yuv422.webm-160x90-0002.i422 +991251ca3f55879e3ed90d5816bf5056 vp93-2-20-12bit-yuv422.webm-160x90-0003.i422 +33f1a1aa1a48fda4ef7dccf302c4e7bf vp93-2-20-12bit-yuv422.webm-160x90-0004.i422 +e9faf81b0664be622040910f29e3d522 vp93-2-20-12bit-yuv422.webm-160x90-0005.i422 +fa9aba755df9f52aa551d942bba5e26f vp93-2-20-12bit-yuv422.webm-160x90-0006.i422 +ef58938b38ced2fecb8afdb9a6d8024b vp93-2-20-12bit-yuv422.webm-160x90-0007.i422 +ce43338326c024eb187abaeaa64a44b1 vp93-2-20-12bit-yuv422.webm-160x90-0008.i422 +d487dab8c8b9f690f13569f3d1875a6d vp93-2-20-12bit-yuv422.webm-160x90-0009.i422 +b4ab8672067ffce5df2daa9a2c2496d2 vp93-2-20-12bit-yuv422.webm-160x90-0010.i422 diff --git a/testdata/libvpx/vp93-2-20-12bit-yuv440.webm.md5 b/testdata/libvpx/vp93-2-20-12bit-yuv440.webm.md5 new file mode 100644 index 0000000..ab8e7b0 --- /dev/null +++ b/testdata/libvpx/vp93-2-20-12bit-yuv440.webm.md5 @@ -0,0 +1,20 @@ +9c03fb4aa813522d9a44b3b309b85d19 vp93-2-20-12bit-yuv440.webm-160x90-0001.i440 +73081beafa17bc23a170172e311c0f54 vp93-2-20-12bit-yuv440.webm-160x90-0002.i440 +36a1eb7aec96b81d54119e26a5056f48 vp93-2-20-12bit-yuv440.webm-160x90-0003.i440 +228ca739c96ceb5c63f593790e487a49 vp93-2-20-12bit-yuv440.webm-160x90-0004.i440 +289e08c01574d23562ce8162b0ec553b vp93-2-20-12bit-yuv440.webm-160x90-0005.i440 +76ca62fa4b80bef534e3cb4e37d9f178 vp93-2-20-12bit-yuv440.webm-160x90-0006.i440 +0d9d5c09c4a453b8b7e04d2904924e15 vp93-2-20-12bit-yuv440.webm-160x90-0007.i440 +b659b38305c3afbbc84f5aab4c373592 vp93-2-20-12bit-yuv440.webm-160x90-0008.i440 +3f5c87c678c2dc6ffc45ec875920e620 vp93-2-20-12bit-yuv440.webm-160x90-0009.i440 +d758cb908aee57e05af8dd7132ce0973 vp93-2-20-12bit-yuv440.webm-160x90-0010.i440 +5539bdf8f2cfc09580bd9371c3655989 vp93-2-20-12bit-yuv440.webm-160x90-0011.i440 +0446cf34d7f1a081e7eef6050cbcb7d8 vp93-2-20-12bit-yuv440.webm-160x90-0012.i440 +2a29f74bd76f8c2187a0f61ff6935744 vp93-2-20-12bit-yuv440.webm-160x90-0013.i440 +fb4b0e71884069537e3e3e62fbe83877 vp93-2-20-12bit-yuv440.webm-160x90-0014.i440 +57e19855e60825333fbbd9fdbad54ca0 vp93-2-20-12bit-yuv440.webm-160x90-0015.i440 +2f111ed5be32c4cbff83efd5530893db vp93-2-20-12bit-yuv440.webm-160x90-0016.i440 +87afd9a47e6ee7a71cee99157dd89815 vp93-2-20-12bit-yuv440.webm-160x90-0017.i440 +72992f2a91f9d91dca5c638d6a2f748c vp93-2-20-12bit-yuv440.webm-160x90-0018.i440 +ad92cad72adfe2ad43c3be5e3b74439f vp93-2-20-12bit-yuv440.webm-160x90-0019.i440 +d70f736810724ab968307daf4da1120c vp93-2-20-12bit-yuv440.webm-160x90-0020.i440 diff --git a/testdata/libvpx/vp93-2-20-12bit-yuv444.webm.md5 b/testdata/libvpx/vp93-2-20-12bit-yuv444.webm.md5 new file mode 100644 index 0000000..3465f49 --- /dev/null +++ b/testdata/libvpx/vp93-2-20-12bit-yuv444.webm.md5 @@ -0,0 +1,10 @@ +d9500a2c9e0b6b44935de019c3583194 vp93-2-20-12bit-yuv444.webm-160x90-0001.i444 +58edf3e69b332a2b62ca78a8dc99ea68 vp93-2-20-12bit-yuv444.webm-160x90-0002.i444 +ca8894e8496bf0eec64655972323feb2 vp93-2-20-12bit-yuv444.webm-160x90-0003.i444 +3473bbb77d10631525a6e7240f6f0c68 vp93-2-20-12bit-yuv444.webm-160x90-0004.i444 +1bc71b016a90d6a79882bd6b8af0cb23 vp93-2-20-12bit-yuv444.webm-160x90-0005.i444 +ebfbb540587c20586d9ff33adee41f24 vp93-2-20-12bit-yuv444.webm-160x90-0006.i444 +e8bd27ebb53f979232abbb9d18b15085 vp93-2-20-12bit-yuv444.webm-160x90-0007.i444 +820f65d50b3c48ec600924c0bba90c40 vp93-2-20-12bit-yuv444.webm-160x90-0008.i444 +d8d8588550bc9820eb3289c5684dd7a9 vp93-2-20-12bit-yuv444.webm-160x90-0009.i444 +d8bd25842191e47ac1b342655e7015e6 vp93-2-20-12bit-yuv444.webm-160x90-0010.i444 diff --git a/third_party/goav1/LICENSE b/third_party/goav1/LICENSE new file mode 100644 index 0000000..854871d --- /dev/null +++ b/third_party/goav1/LICENSE @@ -0,0 +1,42 @@ +Copyright (c) 2025-2026, goav1 authors. All rights reserved. + +Portions of this software are derived from libaom, the AV1 reference +implementation released by the Alliance for Open Media: + + Copyright (c) 2016, Alliance for Open Media. All rights reserved. + +The derived portions are used and redistributed under the terms of the +BSD 2-Clause license shown below, which matches the upstream libaom +LICENSE preserved at third_party/upstream/libaom/LICENSE. The patent +grant that accompanies libaom is reproduced verbatim in the companion +PATENTS file at the root of this repository, as required by section +1.2.1 of the Alliance for Open Media Patent License 1.0. + +See NOTICE for the full list of third-party attributions covering +libaom, dav1d, and libwebrtc references used while porting this +project. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/goav1/NOTICE b/third_party/goav1/NOTICE new file mode 100644 index 0000000..c18728b --- /dev/null +++ b/third_party/goav1/NOTICE @@ -0,0 +1,118 @@ +goav1 +===== + +Pure-Go AV1 implementation focused on realtime/WebRTC decoding. + +This project ports behavior from a set of pinned upstream sources. +See third_party/upstream.lock for the exact pinned git object of +every upstream consulted while writing this code. Local working +clones of each upstream live under third_party/upstream// and +are ignored by git but produced on demand by `make sync-upstreams`. + +The list below covers the third-party projects whose code, behavior, +or specifications this repository derives from. Each upstream is +distributed under its own license; the local checkout preserves the +upstream LICENSE / COPYING / PATENTS files verbatim. + +------------------------------------------------------------------------------- +1. libaom (AV1 reference encoder/decoder) +------------------------------------------------------------------------------- + +Upstream: https://aomedia.googlesource.com/aom +Pinned tag: v3.14.0 +Pinned at: third_party/upstream/libaom/ (sync via `make sync-upstreams`) +License: BSD 2-Clause + Alliance for Open Media Patent License 1.0 +Files: third_party/upstream/libaom/LICENSE + third_party/upstream/libaom/PATENTS + +Copyright notice (verbatim from libaom LICENSE): + + Copyright (c) 2016, Alliance for Open Media. All rights reserved. + +A copy of the libaom BSD 2-Clause license is reproduced as the goav1 +root LICENSE file. The Alliance for Open Media Patent License 1.0 is +reproduced verbatim as the goav1 root PATENTS file, satisfying the +"reproduce this License with any Implementation" condition in section +1.2.1 of that grant. + +Files in this repository whose logic is derived from libaom should +cite their upstream source path with a comment of the form + + // Ported from libaom: av1/.c + +near the top of the file or function. Direct numerical tables (CDF +defaults, dequantization scales, transform scan orders, qmatrix +levels, etc.) are reproduced as published in libaom. + +------------------------------------------------------------------------------- +2. dav1d (VideoLAN AV1 decoder) +------------------------------------------------------------------------------- + +Upstream: https://code.videolan.org/videolan/dav1d.git +Pinned tag: 1.5.3 +Pinned at: third_party/upstream/dav1d/ (sync via `make sync-upstreams`) +License: BSD 2-Clause +File: third_party/upstream/dav1d/COPYING + +Copyright notice (verbatim from dav1d COPYING): + + Copyright (c) 2018-2025, VideoLAN and dav1d authors + All rights reserved. + +dav1d is consulted as a reference for decoder architecture, OBU +parsing layout, tile/decode pipeline shape, and DSP organization. +No source code is copied verbatim from dav1d into this repository, +but several internal Go packages are structurally inspired by its +layout and that influence is acknowledged here. + +------------------------------------------------------------------------------- +3. libwebrtc (Chromium WebRTC AV1 RTP behavior) +------------------------------------------------------------------------------- + +Upstream: https://webrtc.googlesource.com/src +Pinned ref: refs/branch-heads/7778_178 (Chrome Stable Mac 148.0.7778.179) +Pinned at: third_party/upstream/webrtc/ (sync via `make sync-upstreams`) +License: BSD 3-Clause + Additional IP Rights Grant (see upstream + https://webrtc.googlesource.com/src/+/refs/heads/main/LICENSE + and PATENTS in the upstream project root). + +libwebrtc is consulted as a reference for AV1 RTP payload and +depayload behavior (modules/rtp_rtcp/source/rtp_packetizer_av1.cc and +its companions). No source code is copied verbatim from libwebrtc +into this repository; the influence on the RTP packetization and +assembly code is acknowledged here. + +------------------------------------------------------------------------------- +4. AV1 specifications +------------------------------------------------------------------------------- + +AV1 Bitstream & Decoding Process Specification + https://aomediacodec.github.io/av1-spec/av1-spec.pdf + +RTP Payload Format For AV1 (v1.0.0) + https://aomediacodec.github.io/av1-rtp-spec/v1.0.0.html + +Both specifications are published by the Alliance for Open Media and +are reproduced in derived form (parsing logic, syntax structures) +under the AOM specification licensing terms covered by the patent +grant reproduced in the root PATENTS file. + +------------------------------------------------------------------------------- +5. Test vectors +------------------------------------------------------------------------------- + +A curated slice of the libaom AV1 conformance test vectors is +committed under internal/av1/testdata/libaom/. The remote manifest +and the full corpus referenced by `make testvectors-full` live at + + https://storage.googleapis.com/aom-test-data + +and are distributed by the Alliance for Open Media under the same +terms as libaom itself. + +------------------------------------------------------------------------------- + +For the full text of every license referenced above, see the +corresponding file in third_party/upstream// after running +`make sync-upstreams`. Questions about attribution gaps or license +compliance should be filed as issues against this repository. diff --git a/third_party/govpx/LICENSE b/third_party/govpx/LICENSE new file mode 100644 index 0000000..366a2cb --- /dev/null +++ b/third_party/govpx/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2026, The govpx authors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the project nor the names of its contributors may be used + to endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT INCLUDING +NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/govpx/NOTICE b/third_party/govpx/NOTICE new file mode 100644 index 0000000..b156369 --- /dev/null +++ b/third_party/govpx/NOTICE @@ -0,0 +1,12 @@ +govpx + +This project is a pure-Go VP8 codec implementation scaffold inspired by libvpx. + +Ported VP8 algorithms, when added, must cite the corresponding libvpx v1.16.0 +source files in comments and preserve applicable copyright, license, and patent +notices. + +Go-native SIMD primitives in internal/pixel/goav1_* are extracted from +goav1, copyright (c) 2025-2026 goav1 authors, under BSD-2-Clause. +See internal/pixel/UPSTREAM.md and third_party/goav1/ for provenance, +license, notices and the accompanying patent grant. diff --git a/third_party/libvpx/LICENSE b/third_party/libvpx/LICENSE new file mode 100644 index 0000000..8234185 --- /dev/null +++ b/third_party/libvpx/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2010, The WebM Project authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Google, nor the WebM Project, nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT INCLUDING +NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/libvpx/PATENTS b/third_party/libvpx/PATENTS new file mode 100644 index 0000000..747d963 --- /dev/null +++ b/third_party/libvpx/PATENTS @@ -0,0 +1,9 @@ +Additional IP Rights Grant (Patents) + +The upstream libvpx project includes an additional patent grant for WebM codec +implementations. The frozen baseline for this repository is libvpx v1.16.0: + +https://chromium.googlesource.com/webm/libvpx/+/refs/tags/v1.16.0/PATENTS + +When source code is ported from libvpx, keep this file with distributions of +govpx and review the upstream grant text for exact legal terms. diff --git a/tools/portgovpx/go.mod b/tools/portgovpx/go.mod new file mode 100644 index 0000000..9e75c22 --- /dev/null +++ b/tools/portgovpx/go.mod @@ -0,0 +1,15 @@ +module github.com/go-avkit/vpx/tools/portgovpx + +go 1.27.1 + +require ( + github.com/spf13/cobra v1.10.2 + golang.org/x/tools v0.53.0 +) + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.9 // indirect + golang.org/x/mod v0.43.0 // indirect + golang.org/x/sync v0.25.0 // indirect +) diff --git a/tools/portgovpx/go.sum b/tools/portgovpx/go.sum new file mode 100644 index 0000000..64c1cc7 --- /dev/null +++ b/tools/portgovpx/go.sum @@ -0,0 +1,18 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg= +golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/tools v0.53.0 h1:T3bIVp3zjHG9/aEiFk6BXxFh5/Vcbk7JA5hRq1cG8IU= +golang.org/x/tools v0.53.0/go.mod h1:vg+Vrb7y5mTTtxZLTdbTK8G745wcaLcsCtgCWgQONCI= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tools/portgovpx/guards_test.go b/tools/portgovpx/guards_test.go new file mode 100644 index 0000000..16afbee --- /dev/null +++ b/tools/portgovpx/guards_test.go @@ -0,0 +1,257 @@ +package main + +import ( + "errors" + "fmt" + "io" + "io/fs" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "golang.org/x/tools/go/packages" +) + +// noPanic turns a panic into a test failure, so that a guard whose removal +// crashes the program is held by an assertion, not by luck. +func noPanic(t *testing.T, f func()) { + t.Helper() + defer func() { + if r := recover(); r != nil { + t.Fatalf("panicked: %v", r) + } + }() + f() +} + +// closureT and runT are Closure and run with a panic turned into a failure. +func closureT(t *testing.T, dir string, roots []string, cfgs []Config) (*Result, error) { + t.Helper() + defer func() { + if r := recover(); r != nil { + t.Fatalf("Closure panicked: %v", r) + } + }() + return Closure(dir, roots, cfgs) +} + +func runT(t *testing.T, args []string, out, errw io.Writer) int { + t.Helper() + defer func() { + if r := recover(); r != nil { + t.Fatalf("run panicked: %v", r) + } + }() + return run(args, out, errw) +} + +var errSentinel = errors.New("sentinel") + +func TestClosureReturnsHostErrors(t *testing.T) { + root := fixture(t) + cfg := []Config{{"linux", "amd64", ""}} + roots := []string{"example.com/m/dec.D"} + + oldAbs, oldDir, oldLoad := absPath, readDir, loadPackages + defer func() { absPath, readDir, loadPackages = oldAbs, oldDir, oldLoad }() + + absPath = func(string) (string, error) { return "", errSentinel } + if _, err := closureT(t, root, roots, cfg); !errors.Is(err, errSentinel) { + t.Errorf("Abs failure: got %v", err) + } + absPath = oldAbs + + readDir = func(string) ([]os.DirEntry, error) { return nil, errSentinel } + if _, err := closureT(t, root, roots, cfg); !errors.Is(err, errSentinel) { + t.Errorf("ReadDir failure: got %v", err) + } + readDir = oldDir + + loadPackages = func(*packages.Config, ...string) ([]*packages.Package, error) { return nil, errSentinel } + if _, err := closureT(t, root, roots, cfg); !errors.Is(err, errSentinel) { + t.Errorf("Load failure: got %v", err) + } +} + +func TestClosureRootErrorsNameTheirCause(t *testing.T) { + root := fixture(t) + cfg := []Config{{"linux", "amd64", ""}} + for root_, want := range map[string]string{ + "nodot": "bad root", + "example.com/m/none.X": "not loaded", + "example.com/m/dec.Absent": "not found", + } { + noPanic(t, func() { + _, err := closureT(t, root, []string{root_}, cfg) + if err == nil || !strings.Contains(err.Error(), want) { + t.Errorf("root %q: got %v, want an error containing %q", root_, err, want) + } + }) + } +} + +func TestClosureLeavesOtherModulesOut(t *testing.T) { + root := fixture(t) + noPanic(t, func() { + res, err := closureT(t, root, []string{"example.com/m/dec.Encode"}, []Config{{"linux", "amd64", ""}}) + if err != nil { + t.Fatal(err) + } + // Encode uses fmt.Sprint: the standard library is not part of the closure. + for _, f := range res.Names() { + if !strings.HasPrefix(f, "dec/") && !strings.HasPrefix(f, "encoder/") { + t.Errorf("file %q is outside the module's own packages", f) + } + } + }) +} + +func TestRelSlash(t *testing.T) { + if got := relSlash(filepath.FromSlash("/a/b"), filepath.FromSlash("/a/b/c/d.go")); got != "c/d.go" { + t.Errorf("got %q", got) + } + // An absolute dir and a relative file have no relative path: the file comes back. + if got := relSlash(filepath.FromSlash("/a/b"), "c/d.go"); got != "c/d.go" { + t.Errorf("got %q", got) + } +} + +func TestEmitKeepsAWhollyKeptFileByteForByte(t *testing.T) { + src := "package p\n\nfunc F( ) { }\n" // not gofmt'd: only a verbatim copy preserves it + sel := &Selection{Units: map[int]bool{strings.Index(src, "func"): true}} + out, err := Emit([]byte(src), "p.go", sel) + if err != nil || string(out) != src { + t.Fatalf("got %q, %v", out, err) + } +} + +func TestEmitPrintsADocCommentOnce(t *testing.T) { + root := fixture(t) + res, err := closureT(t, root, []string{"example.com/m/dec.D"}, []Config{{"linux", "amd64", ""}}) + if err != nil { + t.Fatal(err) + } + src, err := os.ReadFile(filepath.Join(root, "dec", "dec.go")) + if err != nil { + t.Fatal(err) + } + out, err := Emit(src, "dec/dec.go", res.Files["dec/dec.go"]) + if err != nil { + t.Fatal(err) + } + for _, c := range []string{"// D is the decoder.", "// Run decodes."} { + if n := strings.Count(string(out), c); n != 1 { + t.Errorf("%q printed %d times:\n%s", c, n, out) + } + } +} + +// A function that calls itself must not be pushed again and again: the +// closure has to end. The watchdog turns a spin into a failure. +func TestClosureEndsOnRecursionAndSkipsBlankVars(t *testing.T) { + root := t.TempDir() + write(t, root, "go.mod", "module example.com/r\n\ngo 1.27\n") + write(t, root, "r/r.go", `package r + +func F(n int) int { + if n == 0 { + return 0 + } + return F(n - 1) +} + +var _ = F + +func Unused() {} +`) + noPanic(t, func() { + res, err := closureT(t, root, []string{"example.com/r/r.F"}, []Config{{"linux", "amd64", ""}}) + if err != nil { + t.Fatal(err) + } + if n := len(res.Files["r/r.go"].Units); n != 1 { + t.Errorf("kept %d declarations, want only F", n) + } + }) +} + +// TestMain is the watchdog of the suite: a closure that does not end (a +// declaration pushed again and again) would otherwise spin until go test's +// own ten minutes. The suite takes seconds. +func TestMain(m *testing.M) { + w := time.AfterFunc(3*time.Minute, func() { + fmt.Println("--- FAIL: watchdog: the suite ran past 3 minutes, a closure does not end") + os.Exit(1) + }) + code := m.Run() + w.Stop() + os.Exit(code) +} + +func TestWriteErrors(t *testing.T) { + root := fixture(t) + res, err := closureT(t, root, []string{"example.com/m/dec.D"}, []Config{{"linux", "amd64", ""}}) + if err != nil { + t.Fatal(err) + } + const hdr = "// h {path}\n" + + t.Run("missing source", func(t *testing.T) { + err := Write(t.TempDir(), t.TempDir(), res, "a/", "b/", hdr) + if !errors.Is(err, fs.ErrNotExist) { + t.Errorf("got %v", err) + } + }) + t.Run("source that does not parse", func(t *testing.T) { + src := t.TempDir() + for _, f := range res.Names() { + write(t, src, f, "not go") + } + err := Write(src, t.TempDir(), res, "a/", "b/", hdr) + if err == nil || !strings.Contains(err.Error(), "dec/dec.go") { + t.Errorf("got %v", err) + } + }) + t.Run("patch that does not apply", func(t *testing.T) { + old := Patches + defer func() { Patches = old }() + Patches = map[string][]Patch{"dec/dec.go": {{"text that is not there", "x"}}} + err := Write(root, t.TempDir(), res, "a/", "b/", hdr) + if err == nil || !strings.Contains(err.Error(), "occurs 0 times") { + t.Errorf("got %v", err) + } + }) + t.Run("destination is a file", func(t *testing.T) { + dst := filepath.Join(t.TempDir(), "f") + write(t, filepath.Dir(dst), "f", "x") + err := Write(root, dst, res, "a/", "b/", hdr) + if err == nil || !strings.Contains(err.Error(), "mkdir") { + t.Errorf("got %v", err) + } + }) + t.Run("target is a directory", func(t *testing.T) { + dst := t.TempDir() + if err := os.MkdirAll(filepath.Join(dst, "dec", "dec.go"), 0o755); err != nil { + t.Fatal(err) + } + err := Write(root, dst, res, "a/", "b/", hdr) + if err == nil || strings.Contains(err.Error(), "mkdir") { + t.Errorf("got %v", err) + } + }) +} + +func TestCLIReportsABadRoot(t *testing.T) { + root := fixture(t) + var out, errb strings.Builder + noPanic(t, func() { + if code := runT(t, []string{"--src", root, "--root", "bad"}, &out, &errb); code != 1 { + t.Errorf("exit %d", code) + } + }) + if !strings.Contains(errb.String(), `bad root "bad"`) { + t.Errorf("stderr %q", errb.String()) + } +} diff --git a/tools/portgovpx/header.txt b/tools/portgovpx/header.txt new file mode 100644 index 0000000..8d9d7c9 --- /dev/null +++ b/tools/portgovpx/header.txt @@ -0,0 +1,9 @@ +// Code generated by tools/portgovpx from github.com/thesyncim/govpx v0.5.3; DO NOT EDIT. +// +// Copyright (c) 2026, The govpx authors. All rights reserved. +// Use of this source code is governed by a BSD-3-Clause licence, in +// third_party/govpx/LICENSE. +// +// Derived from github.com/thesyncim/govpx v0.5.3, {path}. +// Where govpx cites a libvpx source file, that file is libvpx's, under the +// licence and patent grant in third_party/libvpx/. diff --git a/tools/portgovpx/main.go b/tools/portgovpx/main.go new file mode 100644 index 0000000..d973993 --- /dev/null +++ b/tools/portgovpx/main.go @@ -0,0 +1,519 @@ +// Command portgovpx computes which top-level declarations of a Go module a set +// of root declarations needs, and writes them into another module with the +// import path and the licence header rewritten. +// +// It was written to port the decoder subset of github.com/thesyncim/govpx +// v0.5.3 (BSD-3-Clause) into go-avkit/vpx, whose decoders share files and +// packages with the encoder. The closure is taken per declaration, under +// several GOOS/GOARCH/GOEXPERIMENT configurations, and the union is kept. A +// file whose every declaration is needed is copied byte for byte (plus the +// header); any other file is rewritten with only the needed declarations and +// the imports they use. +// +// portgovpx --src ~/go/pkg/mod/github.com/thesyncim/govpx@v0.5.3 \ +// --root github.com/thesyncim/govpx/internal/vp8/codec.VP8Decoder \ +// --dst ./out --header header.txt +package main + +import ( + "bytes" + "fmt" + "go/ast" + "go/format" + "go/parser" + "go/printer" + "go/token" + "go/types" + "io" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/spf13/cobra" + "golang.org/x/tools/go/packages" +) + +var osExit = os.Exit + +// The three calls below fail only on a broken host (no working directory, a +// directory removed under us, no go command), which a test cannot arrange +// portably; tests replace them to prove the error is returned. +var ( + absPath = filepath.Abs + readDir = os.ReadDir + loadPackages = packages.Load +) + +// relSlash returns file relative to dir, slash-separated. Both are absolute +// in every use, so Rel cannot fail; if it ever did, the file is returned as is. +func relSlash(dir, file string) string { + r, err := filepath.Rel(dir, file) + if err != nil { + return filepath.ToSlash(file) + } + return filepath.ToSlash(r) +} + +// Config is one build configuration the closure is taken under. +type Config struct { + GOOS, GOARCH, GOEXPERIMENT string +} + +func (c Config) String() string { + return c.GOOS + "/" + c.GOARCH + "+" + c.GOEXPERIMENT +} + +// DefaultConfigs covers every architecture file set of govpx. +func DefaultConfigs() []Config { + return []Config{ + {"linux", "amd64", ""}, {"linux", "amd64", "simd"}, + {"linux", "arm64", ""}, {"linux", "arm64", "simd"}, + {"darwin", "arm64", ""}, {"windows", "amd64", ""}, + {"linux", "386", ""}, {"linux", "arm", ""}, + {"linux", "riscv64", ""}, {"linux", "s390x", ""}, + {"linux", "ppc64le", ""}, {"linux", "loong64", ""}, + {"js", "wasm", ""}, + } +} + +// Selection is what the closure keeps of one file: the byte offsets of the +// kept declarations (the start of the declaration, or of the spec inside a +// var/type group), and the import paths those declarations use. +type Selection struct { + Units map[int]bool + Imports map[string]bool +} + +// Result is the closure: kept units per file (slash path relative to the +// source directory), and the non-Go files found beside kept files. +type Result struct { + Files map[string]*Selection + Others []string +} + +// Names returns the kept files, sorted. +func (r *Result) Names() []string { + var n []string + for f := range r.Files { + n = append(n, f) + } + sort.Strings(n) + return n +} + +// Closure takes the closure of roots ("importpath.Name") under every +// configuration and unions the kept declarations. +func Closure(dir string, roots []string, configs []Config) (*Result, error) { + dir, err := absPath(dir) + if err != nil { + return nil, err + } + res := &Result{Files: map[string]*Selection{}} + for _, c := range configs { + if err := closureOne(dir, roots, c, res); err != nil { + return nil, fmt.Errorf("%s: %w", c, err) + } + } + dirs := map[string]bool{} + for f := range res.Files { + dirs[filepath.ToSlash(filepath.Dir(f))] = true + } + for d := range dirs { + ents, err := readDir(filepath.Join(dir, filepath.FromSlash(d))) + if err != nil { + return nil, err + } + for _, e := range ents { + if !e.IsDir() && !strings.HasSuffix(e.Name(), ".go") { + res.Others = append(res.Others, d+"/"+e.Name()) + } + } + } + sort.Strings(res.Others) + return res, nil +} + +// unit is one top-level declaration (or one spec of a var/type group; a const +// group is one unit, because an omitted initialiser repeats the previous one). +type unit struct { + file string + off int + pos, end token.Pos + node ast.Node + pkg *packages.Package + blank bool // var _ ...: dropped + isInit bool +} + +func closureOne(dir string, roots []string, c Config, res *Result) error { + cfg := &packages.Config{ + Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | + packages.NeedSyntax | packages.NeedTypes | packages.NeedTypesInfo | + packages.NeedImports | packages.NeedDeps, + Dir: dir, + Env: append(os.Environ(), "GOOS="+c.GOOS, "GOARCH="+c.GOARCH, + "GOEXPERIMENT="+c.GOEXPERIMENT, "CGO_ENABLED=0", "GOFLAGS=-mod=mod"), + } + pkgs, err := loadPackages(cfg, "./...") + if err != nil { + return err + } + inModule := map[string]*packages.Package{} + for _, p := range pkgs { + if len(p.Errors) > 0 { + return fmt.Errorf("package %s: %v", p.PkgPath, p.Errors[0]) + } + inModule[p.PkgPath] = p + } + rel := func(p *packages.Package, pos token.Pos) string { + return relSlash(dir, p.Fset.Position(pos).Filename) + } + // Units, indexed by file for position lookup. + unitsOf := map[string][]*unit{} + var inits []*unit + for _, p := range pkgs { + for i, f := range p.Syntax { + fn := relSlash(dir, p.CompiledGoFiles[i]) + add := func(n ast.Node) *unit { + u := &unit{file: fn, off: p.Fset.Position(n.Pos()).Offset, pos: n.Pos(), end: n.End(), node: n, pkg: p} + unitsOf[fn] = append(unitsOf[fn], u) + return u + } + for _, d := range f.Decls { + switch d := d.(type) { + case *ast.FuncDecl: + u := add(d) + if d.Recv == nil && d.Name.Name == "init" { + u.isInit = true + inits = append(inits, u) + } + case *ast.GenDecl: + switch { + case d.Tok == token.IMPORT: + case d.Tok == token.CONST: + add(d) + default: + for _, s := range d.Specs { + u := add(s) + if vs, ok := s.(*ast.ValueSpec); ok && len(vs.Names) == 1 && vs.Names[0].Name == "_" { + u.blank = true + } + } + } + } + } + } + } + find := func(p *packages.Package, pos token.Pos) *unit { + for _, u := range unitsOf[rel(p, pos)] { + // the doc comment precedes pos of the node; objects live inside it + if u.pos <= pos && pos < u.end { + return u + } + } + return nil + } + reached := map[*unit]bool{} + var work []*unit + push := func(u *unit) { + if u == nil || u.blank || reached[u] { + return + } + reached[u] = true + work = append(work, u) + } + addObj := func(o types.Object) { + if o == nil || o.Pkg() == nil || inModule[o.Pkg().Path()] == nil { + return + } + if f, ok := o.(*types.Func); ok { + o = f.Origin() + } + if v, ok := o.(*types.Var); ok { + o = v.Origin() + } + p := inModule[o.Pkg().Path()] + push(find(p, o.Pos())) + if tn, ok := o.(*types.TypeName); ok { + if n, ok := tn.Type().(*types.Named); ok { + for i := 0; i < n.NumMethods(); i++ { + push(find(p, n.Method(i).Pos())) + } + } + } + } + for _, r := range roots { + i := strings.LastIndex(r, ".") + if i < 0 { + return fmt.Errorf("bad root %q", r) + } + p := inModule[r[:i]] + if p == nil { + return fmt.Errorf("root package %q not loaded", r[:i]) + } + o := p.Types.Scope().Lookup(r[i+1:]) + if o == nil { + return fmt.Errorf("root %q not found", r) + } + addObj(o) + } + reachedPkg := map[string]bool{} + doneInit := map[*unit]bool{} + for { + for len(work) > 0 { + u := work[len(work)-1] + work = work[:len(work)-1] + reachedPkg[u.pkg.PkgPath] = true + ast.Inspect(u.node, func(n ast.Node) bool { + if id, ok := n.(*ast.Ident); ok { + if o := u.pkg.TypesInfo.Uses[id]; o != nil { + addObj(o) + } + } + return true + }) + } + grew := false + for _, u := range inits { + if reachedPkg[u.pkg.PkgPath] && !doneInit[u] { + doneInit[u] = true + push(u) + grew = true + } + } + if !grew { + break + } + } + // Record: kept units and the imports they use. + for u := range reached { + sel := res.Files[u.file] + if sel == nil { + sel = &Selection{Units: map[int]bool{}, Imports: map[string]bool{}} + res.Files[u.file] = sel + } + sel.Units[u.off] = true + ast.Inspect(u.node, func(n ast.Node) bool { + if id, ok := n.(*ast.Ident); ok { + if pn, ok := u.pkg.TypesInfo.Uses[id].(*types.PkgName); ok { + sel.Imports[pn.Imported().Path()] = true + } + } + return true + }) + } + return nil +} + +// Emit returns the text of file src as kept by sel. A file whose every +// declaration is kept is returned unchanged. +func Emit(src []byte, name string, sel *Selection) ([]byte, error) { + fset := token.NewFileSet() + f, err := parser.ParseFile(fset, name, src, parser.ParseComments|parser.SkipObjectResolution) + if err != nil { + return nil, err + } + off := func(p token.Pos) int { return fset.Position(p).Offset } + all := true + var decls []ast.Decl + keepRange := [][2]token.Pos{} + for _, d := range f.Decls { + switch d := d.(type) { + case *ast.FuncDecl: + if sel.Units[off(d.Pos())] { + decls = append(decls, d) + keepRange = append(keepRange, [2]token.Pos{d.Pos(), d.End()}) + } else { + all = false + } + case *ast.GenDecl: + if d.Tok == token.IMPORT { + continue + } + if d.Tok == token.CONST { + if sel.Units[off(d.Pos())] { + decls = append(decls, d) + keepRange = append(keepRange, [2]token.Pos{d.Pos(), d.End()}) + } else { + all = false + } + continue + } + var specs []ast.Spec + for _, s := range d.Specs { + if sel.Units[off(s.Pos())] { + specs = append(specs, s) + } else { + all = false + } + } + if len(specs) > 0 { + nd := *d + nd.Specs = specs + decls = append(decls, &nd) + keepRange = append(keepRange, [2]token.Pos{d.Pos(), d.End()}) + } + } + } + if all { + return src, nil + } + // Imports: keep those used (or blank/dot). + var imports []ast.Spec + for _, s := range f.Imports { + p := strings.Trim(s.Path.Value, "\"`") // the parser has already validated the literal + if sel.Imports[p] || (s.Name != nil && (s.Name.Name == "_" || s.Name.Name == ".")) { + imports = append(imports, s) + } + } + nf := *f + nf.Decls = nil + if len(imports) > 0 { + nf.Decls = append(nf.Decls, &ast.GenDecl{Tok: token.IMPORT, Lparen: 1, Specs: imports}) + } + nf.Decls = append(nf.Decls, decls...) + nf.Imports = nil + for _, s := range imports { + nf.Imports = append(nf.Imports, s.(*ast.ImportSpec)) + } + nf.Comments = nil + for _, cg := range f.Comments { + keep := cg.End() <= f.Package + for _, r := range keepRange { + if cg.Pos() >= r[0] && cg.End() <= r[1] { + keep = true + } + } + for _, s := range imports { + if cg.Pos() >= s.Pos() && cg.End() <= s.End()+1 { + keep = true + } + } + if keep { + nf.Comments = append(nf.Comments, cg) + } + } + var buf bytes.Buffer + // A bytes.Buffer cannot fail to write, and a tree the printer cannot print + // yields text that format.Source refuses. + _ = (&printer.Config{Mode: printer.UseSpaces | printer.TabIndent, Tabwidth: 8}).Fprint(&buf, fset, &nf) + return format.Source(buf.Bytes()) +} + +// Rewrite returns src with the import path prefix replaced and the +// derivation header put first. +func Rewrite(src []byte, rel, from, to, header string) []byte { + s := strings.ReplaceAll(string(src), from, to) + h := strings.ReplaceAll(header, "{path}", rel) + return []byte(h + "\n" + s) +} + +// A Patch is a deliberate change to a govpx file, made by the generator so that the output is +// still wholly generated. Old must occur in the emitted file exactly once. +type Patch struct{ Old, New string } + +// Patches lists the changes from govpx v0.5.3, by source path. +var Patches = map[string][]Patch{ + // govpx shifts an int by 32, which does not compile where int is 32 bits wide. + "internal/vpx/buffers/aligned.go": { + {"\tv--\n\tv |= v >> 1\n\tv |= v >> 2\n\tv |= v >> 4\n\tv |= v >> 8\n\tv |= v >> 16\n\tv |= v >> 32\n\treturn v + 1\n", + "\t// Changed from govpx v0.5.3, whose `v >> 32` does not compile where int is 32 bits.\n\treturn 1 << bits.Len(uint(v-1))\n"}, + {"import (\n\t\"reflect\"", "import (\n\t\"math/bits\"\n\t\"reflect\""}, + }, +} + +// ApplyPatches applies the patches of the source file rel to out. +func ApplyPatches(out []byte, rel string, patches map[string][]Patch) ([]byte, error) { + s := string(out) + for _, p := range patches[rel] { + if n := strings.Count(s, p.Old); n != 1 { + return nil, fmt.Errorf("%s: a patch's old text occurs %d times, want 1", rel, n) + } + s = strings.Replace(s, p.Old, p.New, 1) + } + return []byte(s), nil +} + +// Write emits every kept file from src into dst. +func Write(src, dst string, res *Result, from, to, header string) error { + for _, f := range res.Names() { + b, err := os.ReadFile(filepath.Join(src, filepath.FromSlash(f))) + if err != nil { + return err + } + out, err := Emit(b, f, res.Files[f]) + if err != nil { + return fmt.Errorf("%s: %w", f, err) + } + out, err = ApplyPatches(out, f, Patches) + if err != nil { + return err + } + target := filepath.Join(dst, filepath.FromSlash(f)) + if err := os.MkdirAll(filepath.Dir(target), 0o755); err != nil { + return err + } + if err := os.WriteFile(target, Rewrite(out, f, from, to, header), 0o644); err != nil { + return err + } + } + return nil +} + +// RootCmd builds the command. +func RootCmd() *cobra.Command { + var src, dst, from, to, headerFile string + var roots []string + cmd := &cobra.Command{ + Use: "portgovpx --src DIR --root pkg.Name... [--dst DIR --header FILE]", + Short: "per-declaration closure of root declarations, and a licence-preserving copy", + SilenceUsage: true, + SilenceErrors: true, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + res, err := Closure(src, roots, DefaultConfigs()) + if err != nil { + return err + } + out := cmd.OutOrStdout() + if dst == "" { + for _, f := range res.Names() { + fmt.Fprintln(out, f) + } + for _, o := range res.Others { + fmt.Fprintln(cmd.ErrOrStderr(), "non-Go file beside a kept file:", o) + } + return nil + } + hb, err := os.ReadFile(headerFile) + if err != nil { + return err + } + return Write(src, dst, res, from, to, strings.TrimRight(string(hb), "\n")+"\n") + }, + } + f := cmd.Flags() + f.StringVar(&src, "src", "", "source module directory") + f.StringVar(&dst, "dst", "", "destination directory; empty lists the kept files") + f.StringSliceVar(&roots, "root", nil, "root declaration importpath.Name (repeatable)") + f.StringVar(&from, "from", "github.com/thesyncim/govpx/", "import path prefix to replace") + f.StringVar(&to, "to", "github.com/go-avkit/vpx/", "replacement") + f.StringVar(&headerFile, "header", "", "derivation header file; {path} is the source path") + _ = cmd.MarkFlagRequired("src") + return cmd +} + +func run(args []string, out, errw io.Writer) int { + cmd := RootCmd() + cmd.SetArgs(args) + cmd.SetOut(out) + cmd.SetErr(errw) + if err := cmd.Execute(); err != nil { + fmt.Fprintln(errw, "portgovpx:", err) + return 1 + } + return 0 +} + +func main() { osExit(run(os.Args[1:], os.Stdout, os.Stderr)) } diff --git a/tools/portgovpx/main_test.go b/tools/portgovpx/main_test.go new file mode 100644 index 0000000..aa58df8 --- /dev/null +++ b/tools/portgovpx/main_test.go @@ -0,0 +1,210 @@ +package main + +import ( + "bytes" + "go/parser" + "go/token" + "os" + "path/filepath" + "reflect" + "strings" + "testing" +) + +func write(t *testing.T, root, rel, body string) { + t.Helper() + p := filepath.Join(root, filepath.FromSlash(rel)) + if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(p, []byte(body), 0o644); err != nil { + t.Fatal(err) + } +} + +func fixture(t *testing.T) string { + root := t.TempDir() + write(t, root, "go.mod", "module example.com/m\n\ngo 1.27\n") + write(t, root, "dec/dec.go", `package dec + +import ( + "fmt" + + "example.com/m/encoder" + "example.com/m/util" +) + +// D is the decoder. +type D struct{} + +// Run decodes. +func (D) Run() int { return util.Helper() } + +// Encode belongs to the encoder and must be pruned with its imports. +func Encode() string { return fmt.Sprint(encoder.E()) } + +type unusedType struct{ x int } + +const ( + A = iota + B +) + +var _ = Encode + +var ( + kept = 1 + dropped = 2 +) +`) + write(t, root, "dec/more.go", `package dec + +func (D) Close() { _, _ = kept, A } +`) + write(t, root, "util/util.go", `package util + +func Helper() int { return 1 } +`) + write(t, root, "util/init_amd64.go", `package util + +var fast bool + +func init() { fast = true } +`) + write(t, root, "util/data.bin", "x") + write(t, root, "encoder/e.go", `package encoder + +func E() int { return 2 } +`) + return root +} + +func TestClosureAndEmit(t *testing.T) { + root := fixture(t) + cfgs := []Config{{"linux", "amd64", ""}, {"linux", "arm64", ""}} + res, err := closureT(t, root, []string{"example.com/m/dec.D"}, cfgs) + if err != nil { + t.Fatal(err) + } + want := []string{"dec/dec.go", "dec/more.go", "util/init_amd64.go", "util/util.go"} + if !reflect.DeepEqual(res.Names(), want) { + t.Fatalf("files = %v, want %v", res.Names(), want) + } + if !reflect.DeepEqual(res.Others, []string{"util/data.bin"}) { + t.Fatalf("others = %v", res.Others) + } + src, err := os.ReadFile(filepath.Join(root, "dec", "dec.go")) + if err != nil { + t.Fatal(err) + } + out, err := Emit(src, "dec/dec.go", res.Files["dec/dec.go"]) + if err != nil { + t.Fatal(err) + } + s := string(out) + for _, bad := range []string{"Encode", "encoder", "fmt", "unusedType", "dropped", "_ = Encode"} { + if strings.Contains(s, bad) { + t.Errorf("pruned file still has %q:\n%s", bad, s) + } + } + for _, good := range []string{"// D is the decoder.", "// Run decodes.", "util.Helper", "kept", "A = iota", "B\n"} { + if !strings.Contains(s, good) { + t.Errorf("pruned file lost %q:\n%s", good, s) + } + } + if _, err := parser.ParseFile(token.NewFileSet(), "x.go", out, 0); err != nil { + t.Fatalf("pruned file does not parse: %v\n%s", err, s) + } + whole, err := os.ReadFile(filepath.Join(root, "util", "util.go")) + if err != nil { + t.Fatal(err) + } + same, err := Emit(whole, "util/util.go", res.Files["util/util.go"]) + if err != nil || !bytes.Equal(same, whole) { + t.Fatalf("a wholly kept file must be returned unchanged: %v", err) + } + if _, err := Emit([]byte("not go"), "x.go", &Selection{}); err == nil { + t.Error("a file that does not parse must fail") + } +} + +func TestClosureErrors(t *testing.T) { + root := fixture(t) + cfg := []Config{{"linux", "amd64", ""}} + for _, r := range []string{"nodot", "example.com/m/none.X", "example.com/m/dec.Missing"} { + if _, err := closureT(t, root, []string{r}, cfg); err == nil { + t.Errorf("root %q: want error", r) + } + } + write(t, root, "dec/bad.go", "package dec\n\nvar _ = undefined\n") + if _, err := closureT(t, root, []string{"example.com/m/dec.D"}, cfg); err == nil { + t.Error("type error must fail the closure") + } +} + +func TestRewrite(t *testing.T) { + got := string(Rewrite([]byte("//go:build amd64\n\npackage a\n\nimport _ \"github.com/thesyncim/govpx/internal/x\"\n"), + "a/a.go", "github.com/thesyncim/govpx/", "github.com/go-avkit/vpx/", "// derived from {path}\n")) + if !strings.HasPrefix(got, "// derived from a/a.go\n\n//go:build amd64") || !strings.Contains(got, "github.com/go-avkit/vpx/internal/x") { + t.Fatalf("got %q", got) + } +} + +func TestCLI(t *testing.T) { + root := fixture(t) + var out, errb bytes.Buffer + if code := runT(t, []string{"--src", root, "--root", "example.com/m/dec.D"}, &out, &errb); code != 0 { + t.Fatalf("exit %d: %s", code, errb.String()) + } + if !strings.Contains(out.String(), "dec/dec.go") || !strings.Contains(errb.String(), "data.bin") { + t.Fatalf("out %q err %q", out.String(), errb.String()) + } + out.Reset() + errb.Reset() + if code := runT(t, []string{"--src", root, "--root", "bad"}, &out, &errb); code != 1 { + t.Fatalf("exit %d", code) + } + hdrDir := t.TempDir() + write(t, hdrDir, "h.txt", "// h {path}\n") + dst := t.TempDir() + args := []string{"--src", root, "--root", "example.com/m/dec.D", "--dst", dst, "--header", filepath.Join(hdrDir, "h.txt")} + if code := run(args, &out, &errb); code != 0 { + t.Fatalf("exit %d %s", code, errb.String()) + } + b, err := os.ReadFile(filepath.Join(dst, "dec", "dec.go")) + if err != nil || !strings.HasPrefix(string(b), "// h dec/dec.go\n\npackage dec") { + t.Fatalf("%v %q", err, b) + } + args[len(args)-1] = "/nonexistent" + if code := run(args, &out, &errb); code != 1 { + t.Fatalf("exit %d", code) + } + // a write into a path that is a file fails + blocker := filepath.Join(t.TempDir(), "f") + write(t, filepath.Dir(blocker), "f", "x") + args[len(args)-1] = filepath.Join(hdrDir, "h.txt") + args[len(args)-3] = blocker + if code := run(args, &out, &errb); code != 1 { + t.Fatalf("exit %d", code) + } +} + +func TestMainExits(t *testing.T) { + old := osExit + defer func() { osExit = old }() + got := -1 + osExit = func(c int) { got = c } + oldArgs := os.Args + defer func() { os.Args = oldArgs }() + os.Args = []string{"portgovpx"} + main() + if got != 1 { + t.Fatalf("exit %d, want 1 (--src is required)", got) + } +} + +func TestConfigString(t *testing.T) { + if s := (Config{"linux", "amd64", "simd"}).String(); s != "linux/amd64+simd" { + t.Fatal(s) + } +} diff --git a/tools/portgovpx/patches_test.go b/tools/portgovpx/patches_test.go new file mode 100644 index 0000000..2c831be --- /dev/null +++ b/tools/portgovpx/patches_test.go @@ -0,0 +1,35 @@ +package main + +import ( + "strings" + "testing" +) + +func TestApplyPatches(t *testing.T) { + ps := map[string][]Patch{"a.go": {{"x := 1", "x := 2"}}} + out, err := ApplyPatches([]byte("package a\nx := 1\n"), "a.go", ps) + if err != nil || string(out) != "package a\nx := 2\n" { + t.Fatalf("got %q, %v", out, err) + } + // A file with no patch is returned as it is. + out, err = ApplyPatches([]byte("same"), "b.go", ps) + if err != nil || string(out) != "same" { + t.Fatalf("got %q, %v", out, err) + } + // An old text that is absent, or that occurs twice, is an error, never a silent no-op. + for _, src := range []string{"nothing", "x := 1 x := 1"} { + if _, err := ApplyPatches([]byte(src), "a.go", ps); err == nil || !strings.Contains(err.Error(), "a.go") { + t.Fatalf("%q: err = %v, want a refusal naming the file", src, err) + } + } +} + +func TestPatchesHaveOldText(t *testing.T) { + for rel, list := range Patches { + for i, p := range list { + if p.Old == "" || p.Old == p.New { + t.Errorf("%s patch %d changes nothing", rel, i) + } + } + } +} diff --git a/tools/vpxfetch/go.mod b/tools/vpxfetch/go.mod new file mode 100644 index 0000000..cd025f6 --- /dev/null +++ b/tools/vpxfetch/go.mod @@ -0,0 +1,10 @@ +module github.com/go-avkit/vpx/tools/vpxfetch + +go 1.27.1 + +require github.com/spf13/cobra v1.10.2 + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.9 // indirect +) diff --git a/tools/vpxfetch/go.sum b/tools/vpxfetch/go.sum new file mode 100644 index 0000000..a6ee3e0 --- /dev/null +++ b/tools/vpxfetch/go.sum @@ -0,0 +1,10 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tools/vpxfetch/main.go b/tools/vpxfetch/main.go new file mode 100644 index 0000000..c7c799a --- /dev/null +++ b/tools/vpxfetch/main.go @@ -0,0 +1,139 @@ +// Copyright (c) 2026, go-avkit +// SPDX-License-Identifier: BSD-3-Clause + +// Command vpxfetch downloads libvpx's decoder test vectors and their per-frame md5 files: +// +// vpxfetch --cc test_vectors.cc --dir ~/Documents/VCS/GIT/localhost/libvpx-test-vectors +// +// The names are read from libvpx's test/test_vectors.cc (the vp80, vp90, vp91, vp92 and vp93 files +// it lists); each NAME and NAME.md5 is fetched from the webmproject test-data bucket unless it is +// already in --dir. A file that does not download is reported and fails the run, never skipped. +package main + +import ( + "errors" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "regexp" + "slices" + "strings" + + "github.com/spf13/cobra" +) + +// DefaultBase is where libvpx's test data lives (libvpx test/test_vectors.cc names the files). +const DefaultBase = "https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx/" + +var osExit = os.Exit + +var nameRE = regexp.MustCompile(`"(vp(?:80|90|91|92|93)-[A-Za-z0-9_.-]+\.(?:ivf|webm))"`) + +// Names lists the vector file names a test_vectors.cc source holds, sorted, once each. +func Names(src string) []string { + var out []string + for _, m := range nameRE.FindAllStringSubmatch(src, -1) { + out = append(out, m[1]) + } + slices.Sort(out) + return slices.Compact(out) +} + +// fetch downloads base+name into dir/name unless it is there; the file is written whole or not at all. +func fetch(client *http.Client, base, dir, name string) error { + dst := filepath.Join(dir, name) + if st, err := os.Stat(dst); err == nil && st.Size() > 0 { + return nil + } + resp, err := client.Get(base + name) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("%s: HTTP %d", name, resp.StatusCode) + } + tmp, err := os.CreateTemp(dir, name+".part*") + if err != nil { + return err + } + _, err = io.Copy(tmp, resp.Body) + if cerr := tmp.Close(); err == nil { + err = cerr + } + if err != nil { + os.Remove(tmp.Name()) + return fmt.Errorf("%s: %w", name, err) + } + return os.Rename(tmp.Name(), dst) +} + +// RootCmd is the command line. +func RootCmd() *cobra.Command { + var cc, dir, base, manifests string + cmd := &cobra.Command{ + Use: "vpxfetch --cc test_vectors.cc --dir DIR", + Short: "download libvpx's decoder test vectors and their md5 files", + SilenceUsage: true, + SilenceErrors: true, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + if (cc == "") == (manifests == "") || dir == "" { + return errors.New("--dir and exactly one of --cc and --manifests are required") + } + var names []string + if cc != "" { + src, err := os.ReadFile(cc) + if err != nil { + return err + } + names = Names(string(src)) + } else { + ms, err := filepath.Glob(filepath.Join(manifests, "*.md5")) + if err != nil { + return err + } + for _, m := range ms { + names = append(names, strings.TrimSuffix(filepath.Base(m), ".md5")) + } + slices.Sort(names) + } + if len(names) == 0 { + return fmt.Errorf("%s lists no vp80/vp90/vp91/vp92/vp93 vectors", cc+manifests) + } + if err := os.MkdirAll(dir, 0o755); err != nil { + return err + } + if !strings.HasSuffix(base, "/") { + base += "/" + } + var failed []string + for _, n := range names { + for _, f := range []string{n, n + ".md5"} { + if err := fetch(http.DefaultClient, base, dir, f); err != nil { + failed = append(failed, err.Error()) + } + } + } + fmt.Fprintf(cmd.OutOrStdout(), "%d vectors in %s, %d failures\n", len(names), dir, len(failed)) + if len(failed) > 0 { + return errors.New(strings.Join(failed, "; ")) + } + return nil + }, + } + cmd.Flags().StringVar(&cc, "cc", "", "libvpx test/test_vectors.cc") + cmd.Flags().StringVar(&manifests, "manifests", "", "directory of committed NAME.md5 files, whose names are fetched") + cmd.Flags().StringVar(&dir, "dir", "", "directory to download into") + cmd.Flags().StringVar(&base, "base", DefaultBase, "URL the files are under") + return cmd +} + +func main() { + if err := RootCmd().Execute(); err != nil { + fmt.Fprintln(os.Stderr, "vpxfetch:", err) + osExit(1) + } +} diff --git a/tools/vpxfetch/main_test.go b/tools/vpxfetch/main_test.go new file mode 100644 index 0000000..28a8531 --- /dev/null +++ b/tools/vpxfetch/main_test.go @@ -0,0 +1,210 @@ +// Copyright (c) 2026, go-avkit +// SPDX-License-Identifier: BSD-3-Clause + +package main + +import ( + "bytes" + "errors" + "io/fs" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "slices" + "strings" + "testing" +) + +const sampleCC = `const char *const kVP8TestVectors[] = { + "vp80-00-comprehensive-001.ivf", "vp80-00-comprehensive-002.ivf", +}; + "vp90-2-00-quantizer-00.webm", "vp90-2-00-quantizer-00.webm", + "vp91-2-04-yuv444.webm", "notvpx-1.webm", "vp90-2-x.mkv", +` + +func TestNames(t *testing.T) { + got := Names(sampleCC) + want := []string{"vp80-00-comprehensive-001.ivf", "vp80-00-comprehensive-002.ivf", "vp90-2-00-quantizer-00.webm", "vp91-2-04-yuv444.webm"} + if !slices.Equal(got, want) { + t.Fatalf("Names = %v, want %v", got, want) + } +} + +func run(t *testing.T, args ...string) (string, error) { + t.Helper() + var out bytes.Buffer + cmd := RootCmd() + cmd.SetArgs(args) + cmd.SetOut(&out) + cmd.SetErr(&out) + err := cmd.Execute() + return out.String(), err +} + +func TestFetch(t *testing.T) { + hits := map[string]int{} + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + hits[r.URL.Path]++ + if strings.Contains(r.URL.Path, "yuv444") && strings.HasSuffix(r.URL.Path, ".md5") { + http.NotFound(w, r) + return + } + w.Write([]byte("body of " + r.URL.Path)) + })) + defer srv.Close() + dir := t.TempDir() + cc := filepath.Join(dir, "test_vectors.cc") + if err := os.WriteFile(cc, []byte(sampleCC), 0o644); err != nil { + t.Fatal(err) + } + dst := filepath.Join(dir, "out") + out, err := run(t, "--cc", cc, "--dir", dst, "--base", srv.URL) + if err == nil || !strings.Contains(err.Error(), "vp91-2-04-yuv444.webm.md5: HTTP 404") { + t.Fatalf("a missing md5 gave %v, want its HTTP 404", err) + } + if !strings.Contains(out, "4 vectors") || !strings.Contains(out, "1 failures") { + t.Errorf("summary %q", out) + } + got, err := os.ReadFile(filepath.Join(dst, "vp80-00-comprehensive-001.ivf.md5")) + if err != nil || string(got) != "body of /vp80-00-comprehensive-001.ivf.md5" { + t.Errorf("md5 file: %q, %v", got, err) + } + if left, _ := filepath.Glob(filepath.Join(dst, "*.part*")); len(left) != 0 { + t.Errorf("partial files left: %v", left) + } + // A second run downloads only what is missing. + before := hits["/vp80-00-comprehensive-001.ivf"] + run(t, "--cc", cc, "--dir", dst, "--base", srv.URL+"/") + if hits["/vp80-00-comprehensive-001.ivf"] != before { + t.Errorf("a file already in --dir was downloaded again") + } +} + +func TestFetchFromManifests(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("body of " + r.URL.Path)) + })) + defer srv.Close() + man := t.TempDir() + for _, n := range []string{"vp90-2-b.webm.md5", "vp80-00-a.ivf.md5", "readme.txt"} { + os.WriteFile(filepath.Join(man, n), []byte("x"), 0o644) + } + dst := filepath.Join(t.TempDir(), "out") + out, err := run(t, "--manifests", man, "--dir", dst, "--base", srv.URL) + if err != nil || !strings.Contains(out, "2 vectors") { + t.Fatalf("%q, %v", out, err) + } + if _, err := os.Stat(filepath.Join(dst, "vp80-00-a.ivf")); err != nil { + t.Error(err) + } + if _, err := run(t, "--manifests", t.TempDir(), "--dir", dst); err == nil || !strings.Contains(err.Error(), "lists no") { + t.Errorf("empty manifests: %v", err) + } + if _, err := run(t, "--manifests", man, "--cc", "x", "--dir", dst); err == nil { + t.Error("both --cc and --manifests: want an error") + } +} + +func TestFetchRefusals(t *testing.T) { + if _, err := run(t); err == nil { + t.Error("no flags: want an error") + } + if _, err := run(t, "--cc", filepath.Join(t.TempDir(), "absent.cc"), "--dir", t.TempDir()); err == nil { + t.Error("absent --cc: want an error") + } + empty := filepath.Join(t.TempDir(), "e.cc") + os.WriteFile(empty, []byte("nothing"), 0o644) + if _, err := run(t, "--cc", empty, "--dir", t.TempDir()); err == nil || !strings.Contains(err.Error(), "lists no") { + t.Errorf("empty list: %v", err) + } +} + +func TestFetchRefusalsAreNamed(t *testing.T) { + cc := filepath.Join(t.TempDir(), "v.cc") + os.WriteFile(cc, []byte(sampleCC), 0o644) + for _, args := range [][]string{{"--cc", cc}, {"--dir", t.TempDir()}} { + if _, err := run(t, args...); err == nil || !strings.Contains(err.Error(), "are required") { + t.Errorf("%v: %v, want the missing flag named", args, err) + } + } + // ⛔ Judged by the *fs.PathError's fields, not its text: the text is the + // operating system's ("no such file or directory" on Unix, "The system + // cannot find the file specified." on Windows), and matching the Unix + // wording turned windows-latest red on decode#121. + absent := filepath.Join(t.TempDir(), "absent.cc") + _, err := run(t, "--cc", absent, "--dir", t.TempDir()) + var pe *fs.PathError + if !errors.As(err, &pe) || pe.Op != "open" || pe.Path != absent || !errors.Is(err, fs.ErrNotExist) { + t.Errorf("absent --cc: %v, want the read error naming %s", err, absent) + } + file := filepath.Join(t.TempDir(), "afile") + os.WriteFile(file, nil, 0o644) + _, err = run(t, "--cc", cc, "--dir", filepath.Join(file, "sub"), "--base", "http://127.0.0.1:1/") + // MkdirAll names the ancestor that is in the way, on every system. + if !errors.As(err, &pe) || pe.Op != "mkdir" || pe.Path != file { + t.Errorf("--dir under a file: %v, want the mkdir error naming %s", err, file) + } +} + +func TestFetchMalformedManifestsPattern(t *testing.T) { + // A directory name that is a malformed glob pattern is refused, not read as no manifests. + _, err := run(t, "--manifests", "[", "--dir", t.TempDir()) + if !errors.Is(err, filepath.ErrBadPattern) { + t.Errorf("--manifests [: %v, want filepath.ErrBadPattern", err) + } +} + +// fetchT is fetch with a panic turned into a failure: an ignored error would +// otherwise surface as a nil dereference, which is luck and not an assertion. +func fetchT(t *testing.T, client *http.Client, base, dir, name string) error { + t.Helper() + defer func() { + if r := recover(); r != nil { + t.Fatalf("fetch panicked: %v", r) + } + }() + return fetch(client, base, dir, name) +} + +func TestFetchFailures(t *testing.T) { + // A server that promises more than it sends. + short := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Length", "100") + w.Write([]byte("only a few bytes")) + })) + defer short.Close() + dir := t.TempDir() + if err := fetch(http.DefaultClient, short.URL+"/", dir, "a.ivf"); err == nil || !strings.Contains(err.Error(), "a.ivf") { + t.Errorf("a truncated body gave %v, want an error naming the file", err) + } + if left, _ := filepath.Glob(filepath.Join(dir, "a.ivf*")); len(left) != 0 { + t.Errorf("a truncated download left %v", left) + } + // A directory that is not there: the temporary file cannot be created. + missing := filepath.Join(t.TempDir(), "missing") + if err := fetchT(t, http.DefaultClient, short.URL+"/", missing, "a.ivf"); err == nil { + t.Error("an absent directory: want an error") + } + // A server that is gone. + gone := httptest.NewServer(http.NotFoundHandler()) + url := gone.URL + "/" + gone.Close() + if err := fetchT(t, http.DefaultClient, url, t.TempDir(), "a.ivf"); err == nil || strings.Contains(err.Error(), "HTTP") { + t.Errorf("an unreachable server gave %v, want a connection error", err) + } +} + +func TestMainExits(t *testing.T) { + old := osExit + defer func() { osExit = old }() + code := -1 + osExit = func(c int) { code = c } + oldArgs := os.Args + defer func() { os.Args = oldArgs }() + os.Args = []string{"vpxfetch"} + main() + if code != 1 { + t.Errorf("exit code %d, want 1", code) + } +} diff --git a/vectors_test.go b/vectors_test.go new file mode 100644 index 0000000..0ec8ad8 --- /dev/null +++ b/vectors_test.go @@ -0,0 +1,345 @@ +// Copyright (c) 2026, go-avkit +// SPDX-License-Identifier: BSD-3-Clause + +package vpx_test + +import ( + "crypto/md5" + "encoding/binary" + "encoding/hex" + "errors" + "fmt" + "hash" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/go-avkit/vpx" + "github.com/go-avkit/vpx/vp8" + "github.com/go-avkit/vpx/vp9" +) + +// manifests is the directory of libvpx's per-frame md5 files, one NAME.md5 for each decoder test +// vector NAME that libvpx's test/test_vectors.cc lists (vp80, vp90, vp91, vp92 and vp93), copied +// unchanged from https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx/. +const manifests = "testdata/libvpx" + +// vectorCount is how many vectors the manifests hold. +const vectorCount = 376 + +// reference reads the md5 of every output picture of vector name. A libvpx md5 file has one line per +// picture, "MD5 NAME-WxH-NNNN.i420". +func reference(t testing.TB, name string) []string { + t.Helper() + b, err := os.ReadFile(filepath.Join(manifests, name+".md5")) + if err != nil { + t.Fatal(err) + } + var out []string + for _, l := range strings.Split(string(b), "\n") { + if f := strings.Fields(l); len(f) > 0 { + out = append(out, f[0]) + } + } + return out +} + +func names(t testing.TB) []string { + t.Helper() + m, err := filepath.Glob(filepath.Join(manifests, "*.md5")) + if err != nil || len(m) == 0 { + t.Fatalf("manifests: %d, %v", len(m), err) + } + var out []string + for _, p := range m { + out = append(out, strings.TrimSuffix(filepath.Base(p), ".md5")) + } + return out +} + +// pictureMD5 is the hash libvpx's test/md5_helper.h computes: the three planes, each cropped to the +// display size with chroma rounded up, 16-bit little endian above 8 bits. +func pictureMD5(img vpx.Image) string { + h := md5.New() + cw, ch := img.Subsampling.ChromaDimensions(img.Width, img.Height) + if img.BitDepth > 8 { + plane16(h, img.Y16, img.YStride, img.Width, img.Height) + plane16(h, img.U16, img.UStride, cw, ch) + plane16(h, img.V16, img.VStride, cw, ch) + } else { + plane8(h, img.Y, img.YStride, img.Width, img.Height) + plane8(h, img.U, img.UStride, cw, ch) + plane8(h, img.V, img.VStride, cw, ch) + } + return hex.EncodeToString(h.Sum(nil)) +} + +func plane8(h hash.Hash, p []byte, stride, w, rows int) { + for y := range rows { + h.Write(p[y*stride : y*stride+w]) + } +} + +func plane16(h hash.Hash, p []uint16, stride, w, rows int) { + row := make([]byte, 2*w) + for y := range rows { + for x, v := range p[y*stride : y*stride+w] { + binary.LittleEndian.PutUint16(row[2*x:], v) + } + h.Write(row) + } +} + +// ivfSamples cuts an IVF file (a 32-byte header whose bytes 6-7 give its length, then frames of a +// 4-byte size, an 8-byte pts and the data) into its frames. +func ivfSamples(b []byte) ([][]byte, error) { + if len(b) < 32 || string(b[:4]) != "DKIF" { + return nil, errors.New("not an IVF file") + } + pos := int(binary.LittleEndian.Uint16(b[6:8])) + if pos < 32 || pos > len(b) { + return nil, errors.New("bad IVF header length") + } + var out [][]byte + for pos < len(b) { + if len(b)-pos < 12 { + return nil, errors.New("truncated IVF frame header") + } + n := int(binary.LittleEndian.Uint32(b[pos:])) + pos += 12 + if n < 0 || n > len(b)-pos { + return nil, errors.New("truncated IVF frame") + } + out = append(out, b[pos:pos+n]) + pos += n + } + return out, nil +} + +// webmBlocks lists the frames of the blocks of a WebM file with one track, in file order: the EBML +// elements (ID, size) are walked flat, entering Segment, Cluster and BlockGroup (whatever their +// size, which may be unknown) and skipping the rest, and each SimpleBlock or Block gives one frame +// after its track number, 16-bit timecode and flags byte. Lacing is refused. +func webmBlocks(b []byte) ([][]byte, error) { + const ( + segment, cluster, blockGroup = 0x18538067, 0x1F43B675, 0xA0 + simpleBlock, block = 0xA3, 0xA1 + ) + var out [][]byte + pos := 0 + vint := func(keepMarker bool) (v uint64, unknown bool, err error) { + if pos >= len(b) || b[pos] == 0 { + return 0, false, errors.New("bad EBML variable-length integer") + } + n := 1 + for b[pos]&(0x80>>(n-1)) == 0 { + n++ + } + if pos+n > len(b) { + return 0, false, errors.New("truncated EBML variable-length integer") + } + v = uint64(b[pos]) + if !keepMarker { + v &= 0xff >> n + } + allOnes := b[pos]&(0xff>>n) == 0xff>>n + for _, c := range b[pos+1 : pos+n] { + v = v<<8 | uint64(c) + allOnes = allOnes && c == 0xff + } + pos += n + return v, allOnes, nil + } + for pos < len(b) { + id, _, err := vint(true) + if err != nil { + return nil, err + } + size, unknown, err := vint(false) + if err != nil { + return nil, err + } + switch id { + case segment, cluster, blockGroup: + continue // enter it + } + if unknown || size > uint64(len(b)-pos) { + return nil, fmt.Errorf("element %#x has size %d past the end of the file", id, size) + } + body := b[pos : pos+int(size)] + pos += int(size) + if id != simpleBlock && id != block { + continue + } + if len(body) < 4 { + return nil, errors.New("short block") + } + track := 1 + for body[0]&(0x80>>(track-1)) == 0 && track < 8 { + track++ + } + if len(body) < track+3 || body[track+2]&0x06 != 0 { + return nil, errors.New("laced or short block") + } + out = append(out, body[track+3:]) + } + return out, nil +} + +func samples(path string) ([][]byte, error) { + b, err := os.ReadFile(path) + if err != nil { + return nil, err + } + if strings.HasSuffix(path, ".ivf") { + return ivfSamples(b) + } + return webmBlocks(b) +} + +// decoder is what vp8.Decoder and vp9.Decoder share. +type decoder interface { + DecodeWithPTS([]byte, uint64) error + NextFrame() (vpx.Image, bool) + Close() error +} + +func newDecoder(name string, threads int) (decoder, error) { + if strings.HasPrefix(name, "vp80") { + return vp8.New(vp8.Options{Threads: threads}) + } + return vp9.New(vp9.Options{Threads: threads, RowMT: threads >= 2}) +} + +// decodeSums decodes every sample and returns the pictures' md5s; it stops at the first error. +func decodeSums(name string, in [][]byte, threads int) (sums []string, err error) { + d, err := newDecoder(name, threads) + if err != nil { + return nil, err + } + defer d.Close() + for i, s := range in { + if err := d.DecodeWithPTS(s, uint64(i)); err != nil { + return sums, fmt.Errorf("sample %d: %w", i, err) + } + if img, ok := d.NextFrame(); ok { + sums = append(sums, pictureMD5(img)) + } + } + return sums, nil +} + +// TestLibvpxVectors decodes libvpx's decoder test vectors and compares every picture's md5 with the +// one libvpx states. The streams are not in this repository: set LIBVPX_VECTORS_DIR to a directory +// holding them, as `go run ./tools/vpxfetch --manifests testdata/libvpx --dir DIR` downloads them. +// Every vector must match picture for picture, 4:4:0 ones included; there is no list of known failures. +func TestLibvpxVectors(t *testing.T) { vectorsAt(t, 0) } + +// TestLibvpxVectorsThreaded is the same oracle with 4 threads: threads must not change a picture. +func TestLibvpxVectorsThreaded(t *testing.T) { vectorsAt(t, 4) } + +func vectorsAt(t *testing.T, threads int) { + dir := os.Getenv("LIBVPX_VECTORS_DIR") + if dir == "" { + t.Skip("LIBVPX_VECTORS_DIR is not set: the libvpx test vectors were NOT run") + } + for _, name := range names(t) { + t.Run(name, func(t *testing.T) { + t.Parallel() + path := filepath.Join(dir, name) + if _, err := os.Stat(path); err != nil { + // With the directory named, a vector that is missing is a hole in the guard, not a skip. + t.Fatalf("%s is not in %s: this vector was NOT run (tools/vpxfetch downloads them)", name, dir) + } + in, err := samples(path) + if err != nil { + t.Fatal(err) + } + got, err := decodeSums(name, in, threads) + want := reference(t, name) + if err != nil { + t.Errorf("%v, after %d of %d pictures", err, len(got), len(want)) + } + for i := range want { + if i >= len(got) { + t.Errorf("%d pictures, libvpx has %d", len(got), len(want)) + break + } + if got[i] != want[i] { + t.Errorf("first differing picture %d of %d: md5 %s, libvpx %s", i, len(want), got[i], want[i]) + break + } + } + if len(got) > len(want) { + t.Errorf("%d pictures, libvpx has %d", len(got), len(want)) + } + }) + } +} + +func TestManifestsAreCommitted(t *testing.T) { + ns := names(t) + if len(ns) != vectorCount { + t.Errorf("%d manifests, want %d", len(ns), vectorCount) + } + for _, n := range ns { + if !strings.HasPrefix(n, "vp80-") && !strings.HasPrefix(n, "vp90-") && !strings.HasPrefix(n, "vp91-") && + !strings.HasPrefix(n, "vp92-") && !strings.HasPrefix(n, "vp93-") { + t.Errorf("%s is not a vp80, vp90, vp91, vp92 or vp93 vector", n) + } + if len(reference(t, n)) == 0 { + t.Errorf("%s: empty manifest", n) + } + } +} + +func TestIVFSamples(t *testing.T) { + hdr := make([]byte, 32) + copy(hdr, "DKIF") + binary.LittleEndian.PutUint16(hdr[6:], 32) + frame := func(data string) []byte { + h := make([]byte, 12) + binary.LittleEndian.PutUint32(h, uint32(len(data))) + return append(h, data...) + } + good := append(append(append([]byte{}, hdr...), frame("ab")...), frame("")...) + got, err := ivfSamples(good) + if err != nil || len(got) != 2 || string(got[0]) != "ab" || len(got[1]) != 0 { + t.Fatalf("ivfSamples = %q, %v", got, err) + } + for name, b := range map[string][]byte{ + "short": hdr[:10], + "magic": append([]byte("XXXX"), hdr[4:]...), + "header too long": func() []byte { h := append([]byte{}, hdr...); binary.LittleEndian.PutUint16(h[6:], 99); return h }(), + "header too short": func() []byte { h := append([]byte{}, hdr...); binary.LittleEndian.PutUint16(h[6:], 8); return h }(), + "frame header cut": append(append([]byte{}, hdr...), 1, 2, 3), + "frame data cut": good[:len(good)-13], + "frame size absurd": append(append([]byte{}, hdr...), 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0), + } { + if _, err := ivfSamples(b); err == nil { + t.Errorf("%s: want an error", name) + } + } +} + +func TestWebmBlocksRefusals(t *testing.T) { + for name, b := range map[string][]byte{ + "zero byte": {0x00}, + "truncated integer": {0x18, 0x53}, + "size past the end": {0xA3, 0x85, 1, 2}, + "unknown size": {0xA3, 0xFF}, + "short block": {0xA3, 0x82, 0x81, 0}, + "laced block": {0xA3, 0x86, 0x81, 0, 0, 0x02, 1, 2}, + "truncated size": {0xA3, 0x40}, + "block shorter track": {0xA3, 0x84, 0x01, 0, 0, 0}, + } { + if _, err := webmBlocks(b); err == nil { + t.Errorf("%s: want an error", name) + } + } + got, err := webmBlocks([]byte{0xA3, 0x85, 0x81, 0, 0, 0, 7, 0xEC, 0x81, 0}) + if err != nil || len(got) != 1 || len(got[0]) != 1 || got[0][0] != 7 { + t.Errorf("a block and a skipped element: %v, %v", got, err) + } +} diff --git a/vp8/vp8.go b/vp8/vp8.go new file mode 100644 index 0000000..750983e --- /dev/null +++ b/vp8/vp8.go @@ -0,0 +1,41 @@ +// Package vp8 is a VP8 decoder. +package vp8 + +import ( + "github.com/go-avkit/vpx" + "github.com/go-avkit/vpx/internal/vp8/codec" +) + +// Options configures a Decoder. +type Options struct { + // MaxWidth and MaxHeight refuse key frames larger than this; zero is no cap. + MaxWidth, MaxHeight int + // Threads of 2 or more enables the two-stage row pipeline. + Threads int +} + +// Decoder decodes VP8 packets. It is not safe for concurrent use. +type Decoder struct{ d *codec.VP8Decoder } + +// New returns a decoder. +func New(o Options) (*Decoder, error) { + d, err := codec.NewVP8Decoder(codec.DecoderOptions{MaxWidth: o.MaxWidth, MaxHeight: o.MaxHeight, Threads: o.Threads}) + if err != nil { + return nil, err + } + return &Decoder{d}, nil +} + +// DecodeWithPTS decodes one packet. +func (d *Decoder) DecodeWithPTS(packet []byte, pts uint64) error { + return d.d.DecodeWithPTS(packet, pts) +} + +// NextFrame returns the frame the last packet produced, valid until the next decode. +func (d *Decoder) NextFrame() (vpx.Image, bool) { return d.d.NextFrame() } + +// LastFrameCorrupted reports whether the last frame was damaged. +func (d *Decoder) LastFrameCorrupted() (corrupted, ok bool) { return d.d.LastFrameCorrupted() } + +// Close releases the decoder. +func (d *Decoder) Close() error { return d.d.Close() } diff --git a/vp9/vp9.go b/vp9/vp9.go new file mode 100644 index 0000000..72e97f5 --- /dev/null +++ b/vp9/vp9.go @@ -0,0 +1,45 @@ +// Package vp9 is a VP9 decoder (profiles 0 and 1). +package vp9 + +import ( + "github.com/go-avkit/vpx" + "github.com/go-avkit/vpx/internal/vp9/codec" +) + +// Options configures a Decoder. +type Options struct { + // MaxWidth and MaxHeight refuse frames larger than this; zero is no cap. + MaxWidth, MaxHeight int + // Threads of 2 or more enables the tile and loop-filter worker pools. + Threads int + // RowMT enables row multithreading when Threads is 2 or more. + RowMT bool +} + +// Decoder decodes VP9 packets. It is not safe for concurrent use. +type Decoder struct{ d *codec.VP9Decoder } + +// New returns a decoder. +func New(o Options) (*Decoder, error) { + d, err := codec.NewVP9Decoder(codec.VP9DecoderOptions{ + MaxWidth: o.MaxWidth, MaxHeight: o.MaxHeight, Threads: o.Threads, DecoderRowMT: o.RowMT, + }) + if err != nil { + return nil, err + } + return &Decoder{d}, nil +} + +// DecodeWithPTS decodes one packet (or superframe). +func (d *Decoder) DecodeWithPTS(packet []byte, pts uint64) error { + return d.d.DecodeWithPTS(packet, pts) +} + +// NextFrame returns the frame the last packet produced, valid until the next decode. +func (d *Decoder) NextFrame() (vpx.Image, bool) { return d.d.NextFrame() } + +// LastFrameCorrupted reports whether the last frame was damaged. +func (d *Decoder) LastFrameCorrupted() (corrupted, ok bool) { return d.d.LastFrameCorrupted() } + +// Close releases the decoder. +func (d *Decoder) Close() error { return d.d.Close() } diff --git a/vpx.go b/vpx.go new file mode 100644 index 0000000..9c33d7b --- /dev/null +++ b/vpx.go @@ -0,0 +1,38 @@ +// Package vpx holds the types shared by the VP8 and VP9 decoders of this +// module: the decoded image and the error sentinels. The decoders are in +// packages vp8 and vp9. +// +// At M0 the decoded picture is [Image], a view of the decoder's frame +// buffer, valid until the next decode call. The design's Picture type +// replaces it in a later milestone. +package vpx + +import ( + "github.com/go-avkit/vpx/internal/vpx/codecapi" + vpxerrors "github.com/go-avkit/vpx/internal/vpx/errors" +) + +// Image is a decoded frame. Its planes alias the decoder's buffers. +type Image = codecapi.Image + +// ChromaSubsampling names the chroma layout of an Image. +type ChromaSubsampling = codecapi.ChromaSubsampling + +// The chroma layouts the decoders produce. +const ( + Subsampling420 = codecapi.Subsampling420 + Subsampling422 = codecapi.Subsampling422 + Subsampling440 = codecapi.Subsampling440 + Subsampling444 = codecapi.Subsampling444 +) + +// The error sentinels. Wrap-aware: test with errors.Is. +var ( + ErrInvalidData = vpxerrors.ErrInvalidData + ErrInvalidVP9Data = vpxerrors.ErrInvalidVP9Data + ErrNeedKeyFrame = vpxerrors.ErrNeedKeyFrame + ErrFrameRejected = vpxerrors.ErrFrameRejected + ErrInvalidConfig = vpxerrors.ErrInvalidConfig + ErrClosed = vpxerrors.ErrClosed + ErrVP9NotImplemented = vpxerrors.ErrVP9NotImplemented +)