w3c / png

Maintenance of the PNG specification
https://w3c.github.io/png/
Other
44 stars 11 forks source link

Description of IDAT, filter type, scanline data unclear #10

Closed svgeesus closed 2 years ago

svgeesus commented 3 years ago

Raised by: Björn Höhrmann Originally raised: 04 Mar 2011

Regarding http://www.w3.org/TR/2003/REC-PNG-20031110, in the process of implementing an IDAT recompressor I've implemented parts of the PNG specification. In this I found three things hard to understand. The first thing is how IDAT chunks encode filter type and the scanline data. This is mentioned in passing somewhere, but it is not as clear as, say, some indented

  +-------------+------------------------------------+
  | Filter type | Filtered data for this scanline... |
  +-------------+------------------------------------+
svgeesus commented 2 years ago

To be honest, this seems entirely clear in the spec at present. In particular, the ascii-art diagram in the original report looks just like

Figure 4.9 — Serializing and filtering a scanline

in 4.5.4 Filtering

which has the filter type at the start followed by the filtered data for that scanline.

Crissov commented 2 years ago

JFTR CC @hoehrmann

ProgramMax commented 2 years ago

In addition to Figure 4.9, there is the text "...the byte sequence in a scanline to an equal length sequence of bytes preceded by a filter type byte...".

So I think that part of Björn Höhrmann's comment is covered. I'll close this. Note that the original comment had 3 parts and only the first part is mentioned here. The other parts are covered in #11 and #12.