Skip to content

Commit

Permalink
SSE2: Fix prog Huff enc err if Sl%32==0 && Al!=0
Browse files Browse the repository at this point in the history
(regression introduced by 16bd984)

This implements the same fix for
jsimd_encode_mcu_AC_refine_prepare_sse2() that
a81a8c1 implemented for
jsimd_encode_mcu_AC_first_prepare_sse2().

Based on:
MegaByte@1a59587
MegaByte@eb176a9

Fixes #509
Closes #510
  • Loading branch information
dcommander committed Mar 26, 2021
1 parent 2c01200 commit e795afc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -724,7 +724,7 @@ if(WITH_12BIT)
set(MD5_JPEG_440_ISLOW e25c1912e38367be505a89c410c1c2d2)
set(MD5_PPM_440_ISLOW e7d2e26288870cfcb30f3114ad01e380)
set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0)
set(MD5_JPEG_420_IFAST_Q100_PROG 008ab68d6ddbba04a8f01deee4e0f9f8)
set(MD5_JPEG_420_IFAST_Q100_PROG 9447cef4803d9b0f74bcf333cc710a29)
set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e)
set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566)
set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9)
Expand Down Expand Up @@ -777,7 +777,7 @@ else()
set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d)
set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065)
set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1)
set(MD5_JPEG_420_IFAST_Q100_PROG e59bb462016a8d9a748c330a3474bb55)
set(MD5_JPEG_420_IFAST_Q100_PROG 0ba15f9dab81a703505f835f9dbbac6d)
set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294)
set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1)
set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d)
Expand Down
7 changes: 7 additions & 0 deletions ChangeLog.md
Expand Up @@ -19,6 +19,13 @@ Visual Studio.
attempting to compress a specially-crafted malformed GIF image with a specified
image width of 0 using cjpeg.

5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to
generate a progressive JPEG image on an SSE2-capable CPU using a scan script
containing one or more scans with lengths divisible by 32 and non-zero
successive approximation low bit positions would, under certain circumstances,
result in an error ("Missing Huffman code table entry") and an invalid JPEG
image.


2.0.90 (2.1 beta1)
==================
Expand Down
2 changes: 2 additions & 0 deletions simd/i386/jcphuff-sse2.asm
Expand Up @@ -523,6 +523,8 @@ EXTN(jsimd_encode_mcu_AC_refine_prepare_sse2):
add KK, 2
dec K
jnz .BLOOPR16
test LEN, 15
je .PADDINGR
.ELOOPR16:
mov LENEND, LEN

Expand Down
2 changes: 2 additions & 0 deletions simd/x86_64/jcphuff-sse2.asm
Expand Up @@ -504,6 +504,8 @@ EXTN(jsimd_encode_mcu_AC_refine_prepare_sse2):
add KK, 16
dec K
jnz .BLOOPR16
test LEN, 15
je .PADDINGR
.ELOOPR16:
test LEN, 8
jz .TRYR7
Expand Down
7 changes: 5 additions & 2 deletions testimages/test.scan
@@ -1,5 +1,8 @@
0 1 2: 0 0 0 0;
0: 1 16 0 0;
0: 17 63 0 0;
0: 1 9 0 0;
0: 10 41 0 2;
0: 10 41 2 1;
0: 10 41 1 0;
0: 42 63 0 0;
1: 1 63 0 0;
2: 1 63 0 0;

0 comments on commit e795afc

Please sign in to comment.