Modules

pl_mpeg

moduleSource
macOSLinuxWindowswasm

#import "pl_mpeg";

Procedures#

Buffer#

IDCT#

(block: *s32)

Two separable integer passes adapted from the licensed public C pl_mpeg implementation. Coefficients use the decoder's premultiplied scale.

Video#

(video: *Video) -> bool

Transactional variable-length parsing: incomplete custom matrices retain the header cursor for a later callback/append, without exposing partial metadata.

Motion#

(video: *Video, r_size: s32, motion: s32) -> s32

Motion reconstruction and integer half-pixel filtering adapted from public C pl_mpeg (MIT); source attribution is in third_party/pl_mpeg/README.md.

(dest: *u8, dest_width: s32, source_width: s32, block_size: s32, code: Code)
(video: *Video, motion_h: s32, motion_v: s32, d: *Frame)

The parameter is named d; it denotes the reference frame here.

Reconstruction#

(video: *Video, block: s32)

Entropy decoding, dequantization and frame ordering adapted from licensed public C pl_mpeg. Reviewed Jai records remain the actual live decoder state.

Synthesis#

(s: [32][3] s32, ss: s32, d: *float, dp: s32)

Direct MPEG synthesis matrix. Kept separate from entropy/sample decoding so a future verified factorization can replace it without changing the public API.

Audio#

Program#

(self: *Plm, time: float64, seek_exact: bool) -> *Frame

Linear seeks retain real decoded frames and work without a side index. The precise/nonprecise frame selection and audio alignment require contract review.

(self: *Plm, time: float64, seek_exact: bool) -> bool

Types#

Vlcstruct
:: struct
:: struct

Canonical shapes retain ABI field order.

Samplesstruct
:: struct

Canonical shapes retain ABI field order.

Plmstruct
:: struct

Canonical high-level playback record. Private demux state is defined below.

Constants#

:: float.[0.000, 23.976, 24.000, 25.000, 29.970, 30.000, 50.000, 59.940, 60.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
:: u8.[0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22 ...
:: u8.[8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, 19, 22, 26, 27, 29, 34, 34, 38, 22, 22, 26, 27, 29, 34, 37, 40, 22, 26, 27, 29, 32, 35, 40, 4 ...
:: u8.[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, ...
:: u8.[32, 44, 42, 38, 32, 25, 17, 9, 44, 62, 58, 52, 44, 35, 24, 12, 42, 58, 55, 49, 42, 33, 23, 12, 38, 52, 49, 44, 38, 30, 20, 10, 32, 44, 42, 38, 32, 25, 17, 9 ...
:: Vlc.[.{ 1 << 1, 0 }, .{ 2 << 1, 0 }, .{ 0, 1 }, .{ 0, 2 }, .{ 3 << 1, 0 }, .{ 4 << 1, 0 }, .{ 0, 0 }, .{ 0, 3 }, .{ 0, 4 }, .{ 5 << 1, 0 }, .{ 0, 5 }, .{ 6 << 1 ...
:: Vlc.[.{ 1 << 1, 0 }, .{ 2 << 1, 0 }, .{ 0, 0 }, .{ 0, 1 }, .{ 0, 2 }, .{ 3 << 1, 0 }, .{ 0, 3 }, .{ 4 << 1, 0 }, .{ 0, 4 }, .{ 5 << 1, 0 }, .{ 0, 5 }, .{ 6 << 1 ...
:: Vlc_Uint.[ .{ 1 << 1, 0 }, .{ 0, 0x0001 }, .{ 2 << 1, 0 }, .{ 3 << 1, 0 }, .{ 4 << 1, 0 }, .{ 5 << 1, 0 }, .{ 6 << 1, 0 }, .{ 0, 0x0101 }, .{ 7 << 1, 0 }, .{ 8 ...
:: Vlc.[.{ 1 << 1, 0 }, .{ 0, 0 }, .{ 2 << 1, 0 }, .{ 3 << 1, 0 }, .{ 4 << 1, 0 }, .{ 5 << 1, 0 }, .{ 0, 1 }, .{ 0, -1 }, .{ 6 << 1, 0 }, .{ 7 << 1, 0 }, .{ 0, 2 } ...
:: Vlc.[.{ 1 << 1, 0 }, .{ 2 << 1, 0 }, .{ 3 << 1, 0 }, .{ 4 << 1, 0 }, .{ 5 << 1, 0 }, .{ 6 << 1, 0 }, .{ 7 << 1, 0 }, .{ 8 << 1, 0 }, .{ 9 << 1, 0 }, .{ 10 << 1, ...
:: Vlc.[.{ 1 << 1, 0 }, .{ 0, 1 }, .{ 2 << 1, 0 }, .{ 3 << 1, 0 }, .{ 4 << 1, 0 }, .{ 5 << 1, 0 }, .{ 0, 3 }, .{ 0, 2 }, .{ 6 << 1, 0 }, .{ 7 << 1, 0 }, .{ 0, 5 }, ...
:: Vlc.[.{ 1 << 1, 0 }, .{ 0, 0x0a }, .{ 2 << 1, 0 }, .{ 0, 0x02 }, .{ 3 << 1, 0 }, .{ 0, 0x08 }, .{ 4 << 1, 0 }, .{ 5 << 1, 0 }, .{ 6 << 1, 0 }, .{ 0, 0x12 }, .{ ...
:: Vlc.[.{ 1 << 1, 0 }, .{ 2 << 1, 0 }, .{ 3 << 1, 0 }, .{ 4 << 1, 0 }, .{ 0, 0x0c }, .{ 0, 0x0e }, .{ 5 << 1, 0 }, .{ 6 << 1, 0 }, .{ 0, 0x04 }, .{ 0, 0x06 }, .{ ...
:: u16.[44100, 48000, 32000, 0, 22050, 24000, 16000, 0]
:: s16.[32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160]
:: [16] u8).[.[0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0], .[0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0]]
:: [3] u8).[.[QUANT_TAB_C, QUANT_TAB_C, QUANT_TAB_D], .[QUANT_TAB_A, QUANT_TAB_A, QUANT_TAB_A], .[QUANT_TAB_B, QUANT_TAB_A, QUANT_TAB_B]]
:: [32] u8).[.[0x44, 0x44, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ...
:: [16] u8).[.[0, 1, 2, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], .[0, 1, 2, 3, 4, 5, 6, 17, 0, 0, 0, 0, 0, 0, 0, 0], .[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ...
:: Quantizer_Spec.[.{ 3, 1, 5 }, .{ 5, 1, 7 }, .{ 7, 0, 3 }, .{ 9, 1, 10 }, .{ 15, 0, 4 }, .{ 31, 0, 5 }, .{ 63, 0, 6 }, .{ 127, 0, 7 }, .{ 255, 0, 8 }, .{ 511, 0, ...
:: float.[ 0.0, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -1.0, -1.0, -1.0, -1.0, -1.5, -1.5, -2.0, -2.0, -2.5, -2.5, -3.0, -3.5, -3.5, -4.0, -4.5, -5.0, -5.5, -6.5, -7. ...