video: yield points in H.264 picture setup and VP8 rows, rgba / scale conversion; disposable packets and skipDisposable

- H264: picture and grid allocations split between yield calls (a 1080p picture's tables are 1.6 M slots)
- Vp8: Decode.decodeFrame hook three times per macroblock row and once per loop filter row; Options.yield
- Yuv.toRgba / Yuv.scale: optional hook every 16 rows; imageToRgba / imageScale take an out Image and the hook
- Video.open passes opts.yield to the conversions, the VP8 and MPEG-1/2 decoders
- codecs/video/Video/Disposable: H.264 nal_ref_idc 0 (avcC length-prefixed / Annex B), VP8 frames refreshing no
  reference; containers/Demux sets packet.disposable for h264 / vp8 tracks; Video.isDisposable(track, packet)
- skipDisposable: H.264 keeps skipped pictures in output order (pts pool / POC bookkeeping), VP8 applies the header
  state then skips; receive() returns false for a skipped picture, VideoFrame.index counts it
- Types: Packet.disposable, VideoCodecDecoder.receive may return false
- tools/fixtures/videoctl.py: VP8 two temporal layers (IVF + WebM)
This commit is contained in:
4DBug committed 2026-11-02 21:35:33 -06:00
1 parent dde6be117c
commit 15e0dfcc86
12 files changed
+469 -74

No files matched your search

+3 -1
View File
@@ -184,6 +184,7 @@ export type Packet = {
duration: number?, -- ticks
keyframe: boolean,
data: buffer, -- the packet's bytes (its own buffer)
disposable: boolean?, -- true: no later frame predicts from this one (H.264 nal_ref_idc 0, VP8 no reference refresh)
}
export type Demuxer = {
kind: "demuxer",
@@ -227,7 +228,8 @@ export type VideoDecoder = {
-- a codec's decoder instance (codecs/video/Video registry entries create them): packets in, pictures out
export type VideoCodecDecoder = {
decode: (self: any, packet: Packet) -> Err?, -- feed one packet (decode order)
receive: (self: any) -> (Image?, number?, boolean?), -- the next picture, the pts (ticks) it carries, keyframe | nil
-- the next picture, the pts (ticks) it carries, keyframe | nil; false for a picture skipped (opts.skipDisposable)
receive: (self: any) -> (Image? | false, number?, boolean?),
flush: (self: any) -> (), -- end of stream: pictures held for reordering become available to receive()
reset: (self: any) -> (), -- after a seek: drop references / held pictures
}