]> Cypherpunks repositories - gostls13.git/commitdiff
image/jpeg: for progressive JPEGs, the first SOS segment doesn't
authorNigel Tao <nigeltao@golang.org>
Tue, 5 Mar 2013 23:08:46 +0000 (10:08 +1100)
committerNigel Tao <nigeltao@golang.org>
Tue, 5 Mar 2013 23:08:46 +0000 (10:08 +1100)
necessarily contain all components.

Fixes #4975.

R=r, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7469043

src/pkg/image/jpeg/scan.go

index e3ae8ae441c6e9d3de7bba45173d6821b2a84a73..a69ed17489c6c8bce0d74b2390edbf97cb9a0ff4 100644 (file)
@@ -109,9 +109,11 @@ func (d *decoder) processSOS(n int) error {
        myy := (d.height + 8*v0 - 1) / (8 * v0)
        if d.img1 == nil && d.img3 == nil {
                d.makeImg(h0, v0, mxx, myy)
-               if d.progressive {
-                       for i := 0; i < nComp; i++ {
-                               compIndex := scan[i].compIndex
+       }
+       if d.progressive {
+               for i := 0; i < nComp; i++ {
+                       compIndex := scan[i].compIndex
+                       if d.progCoeffs[compIndex] == nil {
                                d.progCoeffs[compIndex] = make([]block, mxx*myy*d.comp[compIndex].h*d.comp[compIndex].v)
                        }
                }