Repository navigation
Commit ce24d1a
An AVIF or a JPEG XL cut short loses the share of its picture asked for (#242)
* An AVIF or a JPEG XL cut short loses the share of its picture asked for
An AVIF or a JPEG XL a damage cuts splits its padding around the picture, so
the cut keeps the share of the picture it keeps of the whole file. Before,
all of the padding stood in free boxes behind the picture, and a cut of any
share took only padding and left the picture whole.
An AVIF puts free boxes between the coder's meta box and its media data. The
item locations give the picture's place in bytes from the start of the file,
so every one moves by as much, and an offset of four bytes that the move
takes past 4 GiB is widened to eight - only then, so a smaller file keeps the
coder's meta box but for the numbers. A JPEG XL puts skip boxes between its
file type box and its codestream, which knows nothing of where it sits:
ffmpeg takes a JPEG XL with a free box near its start for a movie and
refuses it, and a skip box, the same to the format, for nothing.
The front is rounded to whole boxes by format.SplitFront, which PNG's front
padding became with the size of its piece as a parameter. Files nothing cuts
keep their bytes, and PNG's do cut or not.
The structural checker allows padding right in front of the picture as well
as behind it, and requires every item location of an AVIF to land inside its
media data. Both formats leave the share ratchet. A new guard writes
consecutive sizes and cuts a byte apart where the front starts, where it
rounds to a box and where the padding behind runs out, decodes one file of
each layout, and plans an AVIF of 5 GiB whose item location needs eight
bytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A JPEG XL opens in ffmpeg: padding in skip boxes in front of the picture
Breaking: no JPEG XL is byte for byte what 0.5.0 wrote.
A JPEG XL carried its padding in a free box behind its codestream. ffmpeg
7.1.5 with libjxl never finishes a JPEG XL with any box behind its
codestream - free, skip or private, eight bytes or a thousand - so it read no
file this tool wrote. ffmpeg 9.0.1 tells a JPEG XL by its first two
kilobytes and takes one with a free box there for a movie, so it refused
every one below about 3.8 KB.
All of the padding now stands in skip boxes between the file type box and
the codestream box, and nothing follows the codestream. A skip box is the
other name ISO 14496-12 section 8.1.2 gives a box of free space, and ffmpeg
does not take it for a movie. Pillow, ImageMagick, the Windows Imaging
Component, Chrome, djxl and both ffmpeg read the same pixels from 2 KB to
10 MB. A file a damage cuts keeps the rest of its padding behind the
codestream, past the cut, so no file on disk has a box behind it.
Sizes are unchanged and the box costs the same eight bytes. The two
sentences about the smallest JPEG XL say a box of free space. The
structural checker refuses a free box in a JPEG XL. The four golden JPEG XL
values are remeasured, and a new guard requires the codestream to be the
last box of a file nothing cuts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* One name for the box that pads an AVIF, a JPEG XL or an MP4
The changelog entry on cutting an AVIF or a JPEG XL said that files nothing
cuts are unchanged, which the breaking entry on JPEG XL contradicts. It now
says so of AVIF only.
The sentences on why an AVIF, a JPEG XL or an MP4 cannot be smaller named
the box that pads the file in three ways: a free box, a box of free space,
and in Polish also by the box's type. Free space is what the tool calls room
on a disk. All five sentences now say a padding box, as the PNG sentence
says the padding chunk, in English and in Polish. The screen of a refused
size is redrawn, still three lines.
The guard that sweeps a cut AVIF or JPEG XL wraps the decoder's error, and
fails on an end region, which neither format writes and which its count of
what stands in front of the padding would miss.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 7c64b28 commit ce24d1a
20 files changed
Lines changed: 1048 additions & 124 deletions
File tree
- internal
- format
- avif
- isobmff
- jxl
- mp4
- png
- guard
- mutation
- testdata
- screens
- gui/text/locale/said
- oracle
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
| |||
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
119 | 134 | | |
120 | 135 | | |
121 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
| |||
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
190 | | - | |
| 194 | + | |
191 | 195 | | |
192 | 196 | | |
193 | 197 | | |
| |||
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
247 | | - | |
| 251 | + | |
248 | 252 | | |
249 | 253 | | |
250 | 254 | | |
| |||
254 | 258 | | |
255 | 259 | | |
256 | 260 | | |
257 | | - | |
| 261 | + | |
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
| |||
491 | 495 | | |
492 | 496 | | |
493 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
494 | 504 | | |
495 | 505 | | |
496 | 506 | | |
| |||
0 commit comments