Skip to content

Commit

Permalink
Fixed handling of empty JPEG-LS scans.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Richter committed Jun 8, 2022
1 parent 51c3241 commit 4746b57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Standard JPEG compression, with 444 (aka "no") subsampling:

$ jpeg -q <quality> infile.ppm outfile.jpg

Standard JPEG compression, with 422 subsampling:
Standard JPEG compression, with 420 subsampling:

$ jpeg -q <quality> -s 1x1,2x2,2x2 infile.ppm outfile.jpg

Expand Down
7 changes: 5 additions & 2 deletions codestream/sampleinterleavedlsscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
** A JPEG LS scan interleaving samples of several components,
** sample by sample.
**
** $Id: sampleinterleavedlsscan.cpp,v 1.15 2014/11/14 15:41:32 thor Exp $
** $Id: sampleinterleavedlsscan.cpp,v 1.16 2022/06/08 10:54:55 thor Exp $
**
*/

Expand Down Expand Up @@ -112,9 +112,12 @@ bool SampleInterleavedLSScan::ParseMCU(void)
if (lines > 8) {
lines = 8;
}

if (lines == 0)
return false;

if (m_pFrame->HeightOf() > 0)
m_ulRemaining[0] -= lines;
assert(lines > 0);
assert(m_ucCount < 4);

//
Expand Down
7 changes: 4 additions & 3 deletions codestream/singlecomponentlsscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/*
** A JPEG LS scan covering only a single component.
**
** $Id: singlecomponentlsscan.cpp,v 1.18 2014/11/14 15:41:32 thor Exp $
** $Id: singlecomponentlsscan.cpp,v 1.19 2022/06/08 10:54:55 thor Exp $
**
*/

Expand Down Expand Up @@ -96,8 +96,9 @@ bool SingleComponentLSScan::ParseMCU(void)
}
if (m_pFrame->HeightOf() > 0)
m_ulRemaining[0] -= lines;

assert(lines > 0);

if (lines == 0)
return false;

// Loop over lines and columns
do {
Expand Down

0 comments on commit 4746b57

Please sign in to comment.