ffmpeg-v4l2-request-fourier: preserve sl->mb for inspection callback (0017) #107
Reference in New Issue
Block a user
Delete Branch "claude-noether/marfrit-packages:noether/h264-mb-coeffs-side-buffer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Companion to 0016 (PR #106). Foundation for daedalus-decoder PR-A3 — extracting real H.264 coefficients into daedalus-decoder for full-pipeline IDCT validation.
Problem
Patch 0016's per-MB inspection callback fires at the end of
ff_h264_hl_decode_mb. By that time the IDCT-add path has already zeroedsl->mb(FFmpeg convention —ff_h264_idct_add_neonand friends destroy the input block buffer as they go). Consumers reading coefficients in the callback get zeros.What 0017 adds
H264Context:int16_t mb_inspect_coeffs[16 * 48]— side buffer matching the 8-bit half ofsl->mb's declared size.ff_h264_hl_decode_mb, a singlememcpysnapshotssl->mbinto the side buffer — BEFORE the varianthl_decode_mb_*runs and zeros the original.Memcpy gated on
h->mb_inspect_cb != NULL. Zero cost when no inspection consumer is registered — the existing decode path adds one branch per MB.The existing 0016 callback now reads:
h->mb_inspect_coeffs= pre-IDCT coefficients (this patch)h->cur_pic.f->data= post-pixel-work pre-deblock reconstructionand the consumer can derive
P = pixels − IDCT(C)for daedalus-decoder's frame-major dispatch.Limitations
sl->mb(int16_t[16 * 48 * 2]declared); preserving the high-depth case would need a wider side buffer.avctx->thread_count = 1). Multi-slice / multi-threaded streams would race on the single side buffer — explicit limitation of the inspection mechanism. Future extension would put per-slice buffers inH264SliceContext.These match the daedalus-decoder consumer's existing scope.
Verified
Patches 0016 + 0017 apply cleanly and build in sequence against the Kwiboo
v4l2-request-n8.1fork at the pinned commitb57fbbe5.ff_h264_set_mb_inspect_cbsymbol still exported.Wiring
Refs reauktion/daedalus-decoder!14 (PR-A2 callback wiring complete; PR-A3 will consume the side buffer).