-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add utility function header Add location to extract internal helper functions to reduce code duplication Signed-off-by: Kimball Thurston <kdt3rd@gmail.com> * Fix issues with odd y_sampling numbers Use new compute_sampled_lines when the y_sampling is odd (sampling % 2 == 1), where the number of lines per chunk will oscillate. Signed-off-by: Kimball Thurston <kdt3rd@gmail.com> * Fix integer overflow computing deep chunk index Signed-off-by: Kimball Thurston <kdt3rd@gmail.com> * Fix decompression scratch buffer size Use a minimum size to handle that b44 is always 4x4 blocks Signed-off-by: Kimball Thurston <kdt3rd@gmail.com> * Use appropriate buffer size when decompressing use the scratch buffer size instead of decompressed buffer size, allow some extra padding in scratch buffer when appropriate Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
- Loading branch information
Showing
5 changed files
with
116 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
** SPDX-License-Identifier: BSD-3-Clause | ||
** Copyright Contributors to the OpenEXR Project. | ||
*/ | ||
|
||
#include <stdint.h> | ||
|
||
static inline int | ||
compute_sampled_lines (int height, int y_sampling, int start_y) | ||
{ | ||
int nlines; | ||
|
||
if (y_sampling <= 1) return height; | ||
|
||
if (height == 1) | ||
nlines = (start_y % y_sampling) == 0 ? 1 : 0; | ||
else | ||
{ | ||
int start, end; | ||
|
||
/* computed the number of times y % ysampling == 0, by | ||
* computing interval based on first and last time that occurs | ||
* on the given range | ||
*/ | ||
start = start_y % y_sampling; | ||
if (start != 0) | ||
start = start_y + (y_sampling - start); | ||
else | ||
start = start_y; | ||
end = start_y + height - 1; | ||
end -= (end % y_sampling); | ||
|
||
if (start > end) | ||
nlines = 0; | ||
else | ||
nlines = (end - start) / y_sampling + 1; | ||
} | ||
|
||
return nlines; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters