• 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
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...