• Nigel Tao's avatar
    image/jpeg: fix progressive decoding when the DC components are split · ea34ca76
    Nigel Tao authored
    over multiple scans. Previously, the Go code assumed that DC was
    synonymous with interleaved and AC with non-interleaved.
    
    Fixes #6767.
    
    The test files were generated with libjpeg's cjpeg program, version 9a,
    with the following patch, since cjpeg is hard-coded to output
    interleaved DC.
    
    $ diff -u jpeg-9a*/jcparam.c
    --- jpeg-9a-clean/jcparam.c	2013-07-01 21:13:28.000000000 +1000
    +++ jpeg-9a/jcparam.c	2014-02-27 11:40:41.236889852 +1100
    @@ -572,7 +572,7 @@
     {
       int ci;
    
    -  if (ncomps <= MAX_COMPS_IN_SCAN) {
    +  if (0) {
             /* Single interleaved DC scan */
             scanptr->comps_in_scan = ncomps;
             for (ci = 0; ci < ncomps; ci++)
    @@ -610,7 +610,7 @@
               (cinfo->jpeg_color_space == JCS_YCbCr ||
                    cinfo->jpeg_color_space == JCS_BG_YCC)) {
             /* Custom script for YCC color images. */
    -    nscans = 10;
    +    nscans = 14;
       } else {
             /* All-purpose script for other color spaces. */
             if (ncomps > MAX_COMPS_IN_SCAN)
    
    LGTM=r
    R=r
    CC=golang-codereviews
    https://golang.org/cl/69000046
    ea34ca76
Name
Last commit
Last update
..
video-001.5bpp.gif Loading commit data...
video-001.gif Loading commit data...
video-001.interlaced.gif Loading commit data...
video-001.jpeg Loading commit data...
video-001.png Loading commit data...
video-001.progressive.jpeg Loading commit data...
video-001.q50.420.jpeg Loading commit data...
video-001.q50.420.progressive.jpeg Loading commit data...
video-001.q50.422.jpeg Loading commit data...
video-001.q50.422.progressive.jpeg Loading commit data...
video-001.q50.440.jpeg Loading commit data...
video-001.q50.440.progressive.jpeg Loading commit data...
video-001.q50.444.jpeg Loading commit data...
video-001.q50.444.progressive.jpeg Loading commit data...
video-001.separate.dc.progression.jpeg Loading commit data...
video-001.separate.dc.progression.progressive.jpeg Loading commit data...
video-005.gray.gif Loading commit data...
video-005.gray.jpeg Loading commit data...
video-005.gray.png Loading commit data...
video-005.gray.q50.2x2.jpeg Loading commit data...
video-005.gray.q50.2x2.progressive.jpeg Loading commit data...
video-005.gray.q50.jpeg Loading commit data...
video-005.gray.q50.progressive.jpeg Loading commit data...