Skip to content

Commit eadd243

Browse files
committed
Fix interblock smoothing with narrow prog. JPEGs
Due to an oversight, the assignment of DC05, DC10, DC15, DC20, and DC25 (the right edge coefficients in the 5x5 interblock smoothing window) in decompress_smooth_data() was incorrect for images exactly two MCU blocks wide. For such images, DC04, DC09, DC14, DC19, and DC24 were assigned values based on the last MCU column, but DC05, DC10, DC15, DC20, and DC25 were assigned values based on the first MCU column (because block_num + 1 was never less than last_block_column.) This commit modifies jdcoefct.c so that, for images at least two MCU blocks wide, DC05, DC10, DC15, DC20, and DC25 are assigned the same values as DC04, DC09, DC14, DC19, and DC24 (respectively.) DC05, DC10, DC15, DC20, and DC25 are then immediately overwritten for images more than two MCU blocks wide. Since this issue was minor and not likely obvious to an end user, the fix is undocumented. Fixes #700
1 parent 21f5688 commit eadd243

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

jdcoefct.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,11 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
583583
/* Update DC values */
584584
if (block_num == cinfo->master->first_MCU_col[ci] &&
585585
block_num < last_block_column) {
586-
DC04 = (int)prev_prev_block_row[1][0];
587-
DC09 = (int)prev_block_row[1][0];
588-
DC14 = (int)buffer_ptr[1][0];
589-
DC19 = (int)next_block_row[1][0];
590-
DC24 = (int)next_next_block_row[1][0];
586+
DC04 = DC05 = (int)prev_prev_block_row[1][0];
587+
DC09 = DC10 = (int)prev_block_row[1][0];
588+
DC14 = DC15 = (int)buffer_ptr[1][0];
589+
DC19 = DC20 = (int)next_block_row[1][0];
590+
DC24 = DC25 = (int)next_next_block_row[1][0];
591591
}
592592
if (block_num + 1 < last_block_column) {
593593
DC05 = (int)prev_prev_block_row[2][0];

0 commit comments

Comments
 (0)