Take APNG frame deltas against the canvas after disposal #10616
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 244 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.329
Real PR Conversation Timeline
1 comments
"Review active on #10616"
general
weight: 0.35
radarhere
#10336 compares each APNG frame with the previous frame directly, so the disposal of the previous frame is no longer applied before the delta is taken. A frame that follows
OP_PREVIOUSorOP_BACKGROUNDis then saved as a delta against a canvas the viewer no longer has, and the area that the disposal reverted or cleared is left wrong. This is not in 13.0.0.disposal=[0, 1, 0]is wrong too: the pixel is(0, 0, 0, 0). Frame 2 is wrong in Pillow's reader and in ffmpeg; before #10336 both decoded it correctly.The change keeps #10336's merge rule (a frame equal to the previous frame is merged into it) and takes the bounding box of each delta against the canvas left after the previous frame's disposal. For that it tracks the canvas:
OP_BACKGROUNDclears the frame's region, andOP_PREVIOUSkeeps the canvas from before the previous frame, which is not the previous frame when that frame was itself disposed of. Files saved withoutdisposalare byte-identical to main.Tests:
test_apng_save_delta_after_disposal(RGB, RGBA and L, withOP_PREVIOUSandOP_BACKGROUNDin a list) andtest_apng_save_delta_after_disposal_previous_chain(RGB, RGBA and L, scalarOP_PREVIOUSon four frames). On mainTests/test_file_apng.pyhas 9 failed, 56 passed (the 9 are these tests); with the change it is 65 passed.Tests/test_file_gif.py,Tests/test_file_png.pyandTests/test_imagesequence.pypass as well (268 passed, 1 skipped withTests/test_file_apng.py).The implementation and tests were written with AI assistance.