Repository navigation
Expand file tree
/
Copy pathimage-input-contract.json
More file actions
77 lines (77 loc) · 8.77 KB
/
Copy pathimage-input-contract.json
File metadata and controls
77 lines (77 loc) · 8.77 KB
1
2
3
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
"component": "Encoded image input and decoded source state",
"targetSha256": "c491656b962debc215a8b6e757a9b2949ffe50a36b5f2db692706bcd4ebface1",
"status": "Well-defined BMP/PNG native behavior retains strict captured comparisons. Interlaced 16-bit RGB/RGBA PNGs use standards-correct deterministic pixels instead of the original reader's undefined retained-scratch output. Runtime verification of this change is pending.",
"reference": {
"encodedEntry": "0x473e00",
"blobConstructor": "0x4aee70",
"blobReader": "0x4ae6d0 -> 0x507060",
"sourceSetter": "0x473bb0",
"pixelExport": "0x473450",
"workingPreparation": "0x4738b0",
"rea": "723 through 743; ReadPNGImage 0x5feae0, ReadOnePNGImage 0x5fd120, scratch allocator 0x50e270, interlace row reader 0x69aed0"
},
"capture": {
"nativeOperation": 92,
"input": "Exact encoded file bytes plus explicit preprocessing mode/amount and anti-alias control. Decode the blob through the original library, then invoke the same original source setter and working preparation used by the application. Do not populate native decoded pixels from an independent decoder.",
"output": "Original decoded matte flag, physical storage class/colorspace/cached type, dimensions and BGRA; post-setter cached matte/dimensions/BGRA; working dimensions/BGRA; post-filter retained source matte/dimensions/BGRA and application PRNG. Do not call GetImageType merely to observe metadata: its allocation changes later legacy PNG scratch contents.",
"verification": "Fresh complete native response repeats must agree byte for byte. Generated fixtures retain exact encoded bytes and writer inputs separately. Original installation files and instructions remain unchanged. Native intermediates are expectations only for future independent decoding.",
"authoritativeOperation": 93,
"wholeLoaderProof": "../evidence/image-loader-whole-repeat-audit.json",
"derivativeProof": "../evidence/image-loader-derivative-capture-audit.json"
},
"decoder": {
"api": "Named development exports decodeImage(encoded) and resolveImageFilename(filename) are available from the package root through src/settings.mjs and are shared by CLI, GUI and document controllers. Format-specific modules remain internal.",
"input": "Uint8Array containing exact encoded image bytes. Return owned width/height/BGRA, intrinsic hasAlpha boolean (native decoded matte), and detected format. Do not mutate input or invoke original binaries or child processes.",
"png": "PNG color types 0/2/3/4/6 at legal depths, five row filters, Adam7 passes, palette/transparency keys and concatenated IDAT. Interlaced 16-bit RGB/RGBA inputs decode each pass into its final pixel positions exactly once, take each channel's high byte, preserve RGBA alpha and use opaque alpha for RGB except exact full-16-bit tRNS sample matches. No Q8 transparency comparison or legacy opacity postscan applies to this class. Noninterlaced 16-bit RGB/RGBA retains native Q8 in-place row reduction and legacy transparency/opacity behavior; other PNG classes retain their well-defined native behavior.",
"bmp": "Independent first-raster BMP import for packed1/4/8-bit palettes,16/24/32-bit pixels, core and extended headers, reduced palettes, native bitfield/Q8/opacity behavior, RLE4/RLE8 and BM/CI/BA wrappers. All359 BMP cases and six complete conversions match. See bmp-input-contract.json for exact scope and remaining work.",
"sourceInvariant": "All 337 original source setters rebuild a matte-one source cache, including 138 decoded matte-zero inputs. Preparation requires intrinsic hasAlpha metadata. For matte-zero input, native GetImageType selects opaque palette type 4 only for nongray images with at most 256 colors; source setter promotes that type to truecolor matte type 7 and fills alpha. Other types retain decoder alpha. Setter 0x4aeaf0 selects RGB colorspace, not alpha. Fresh analysis derives resize matte=1; no user matte control or compatibility alias.",
"sources": [
"https://www.w3.org/TR/png/",
"https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapinfoheader",
"https://svn.dslinux.org/svn/tags/imagemagick/imagemagick-6.4.2/coders/png.c"
],
"authority": "Format specifications define structural parsing. Original executable byte observations govern well-defined legacy pixel behavior. The approved product decision uses deterministic standards-correct decoding for interlaced 16-bit RGB/RGBA rather than emulating undefined scratch memory.",
"proof": "../evidence/image-input-native-reference.json",
"freshQuirkProof": "../evidence/image-input-fresh-quirk-verification.json",
"fixture": "../test/fixtures/image-input-reference.ndjson.gz",
"cases": 337,
"allStageComparison": "../evidence/image-input-all-stage-comparison.json",
"historyAudit": "../evidence/image-input-history-audit.json",
"publicExportStatus": "Root development exports already exist. package.json remains private=true and unpublished; final Rust/npm binding and stable API verification remain required.",
"jpeg": "Native integer transform, chroma sampling, grayscale/RGB/YCbCr/CMYK/YCCK conversion and baseline/progressive restart handling. Normalize JPEG ink colors to the common RGB raster contract before source preparation. See jpeg-input-contract.json for exact scope, source licenses and remaining format/error work.",
"gif": "First-descriptor palette/LZW decoding, four-pass native interlace, intrinsic matte versus opacity-byte sentinel, and unchanged common source preparation. See gif-input-contract.json.",
"tiff": "Classic TIFF first-IFD import with recovered strip/plane/tile, compression, Q8/alpha and delegate quirks. See tiff-input-contract.json for exact capture scope, retained failures, CCITT table attribution and remaining work.",
"expandedBmpContract": "bmp-input-contract.json"
},
"scope": "Recover encoded input and source preparation for every original format. BMP/PNG, eight-bit Huffman JPEG, GIF and classic TIFF have independent implementations with bounded native conformance. Other original formats, remaining BMP array/metadata/error behavior, JPEG coding modes, malformed/error behavior, metadata/color management and file/dialog workflows remain required work.",
"fullApplicationParity": false,
"published": false,
"nondeterministicReference": {
"nativeEntry": "0x473e00",
"originalInstructionsPatched": false,
"targets": 7,
"contexts": 21,
"processRuns": 42,
"contextsWithRepeatPixelDifferences": 13,
"cause": "REA confirms 0x5fd120 allocates retained interlace row storage through 0x50e270, which directly calls malloc without initialization. Reader 0x69aed0 returns without writing the caller row on skipped Adam7 rows and merges only selected pass pixels otherwise. The image reader imports and reduces every row after every pass, including unchanged rows. Previously unwritten scratch bytes can enter pixels and vary with allocation history/process state. Exact source/working/prepared byte differences between repeated untouched whole-loader calls corroborate this.",
"decision": "Approved: define standards-correct deterministic pixels for the structural class interlaced 16-bit RGB/RGBA PNGs, including exact sample-domain transparency before Q8 reduction. Historical captures and finite stable-byte masks remain evidence, not correctness oracles for that class. Compare every affected archived input against its recorded writer samples and every source/working pixel against the common preparation contract. Independently authored inputs cover all filters, odd/narrow dimensions, channel order, alpha, transparency and Adam7 merging. No fixture-ID exceptions, captured heap bytes, NaNs, ignored cases or blanket snapshot updates. Exact comparison remains strict outside this class.",
"correctnessFixture": "../test/fixtures/png-adam7-correctness.json",
"stablePropertyReplacement": "The seven adam7_*_stable tests asserted repeatable artifacts of the corrupt algorithm. Replace those masked native consensus assertions with complete-buffer sample-oracle decode and preparation assertions for all 16 structurally affected historical cases, including the nine cases whose captured bytes happened to agree."
},
"verification": {
"fullSuite": {
"tests": 222,
"pass": 221,
"fail": 1,
"cancelled": 0,
"skipped": 0,
"todo": 0,
"durationMs": 634291.1176,
"report": "../evidence/image-input-full-test-run.txt"
},
"historicalFailure": "Before the approved contract change, test/image-input.test.mjs and image::native_pixels/native_preparation failed at adam7-9x7-10; seven historical Adam7 outputs differed. These logs remain historical evidence, not current validation.",
"published": false,
"exported": true
}
}