Fix dec artifacts w/cropped+smoothed prog DC scans

This commit modifies decompress_smooth_data(), adding missing MCU column
offsets to the prev_block_row and next_block_row indices that are used
for block rows other than the first and last.  Effectively, this
eliminates unexpected visual artifacts when using jpeg_crop_scanline()
along with interblock smoothing while decompressing the DC scan of a
progressive JPEG image.

Based on:
0227d4fb48

Fixes #456
Closes #457
This commit is contained in:
DRC
2020-10-01 19:18:44 -05:00
parent 8e895c79e1
commit 2ec4a5ebe3
2 changed files with 9 additions and 3 deletions

View File

@@ -23,6 +23,10 @@ skipping past the end of an image.
3. The ARM 64-bit (ARMv8) NEON SIMD extensions can now be built using MinGW 3. The ARM 64-bit (ARMv8) NEON SIMD extensions can now be built using MinGW
toolchains targetting ARM64 (AArch64) Windows binaries. toolchains targetting ARM64 (AArch64) Windows binaries.
4. Fixed unexpected visual artifacts that occurred when using
`jpeg_crop_scanline()` and interblock smoothing while decompressing only the
DC scan of a progressive JPEG image.
2.0.5 2.0.5
===== =====

View File

@@ -6,7 +6,7 @@
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2010, 2015-2016, D. R. Commander. * Copyright (C) 2010, 2015-2016, D. R. Commander.
* Copyright (C) 2015, Google, Inc. * Copyright (C) 2015, 2020, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -495,11 +495,13 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
if (first_row && block_row == 0) if (first_row && block_row == 0)
prev_block_row = buffer_ptr; prev_block_row = buffer_ptr;
else else
prev_block_row = buffer[block_row - 1]; prev_block_row = buffer[block_row - 1] +
cinfo->master->first_MCU_col[ci];
if (last_row && block_row == block_rows - 1) if (last_row && block_row == block_rows - 1)
next_block_row = buffer_ptr; next_block_row = buffer_ptr;
else else
next_block_row = buffer[block_row + 1]; next_block_row = buffer[block_row + 1] +
cinfo->master->first_MCU_col[ci];
/* We fetch the surrounding DC values using a sliding-register approach. /* We fetch the surrounding DC values using a sliding-register approach.
* Initialize all nine here so as to do the right thing on narrow pics. * Initialize all nine here so as to do the right thing on narrow pics.
*/ */