diff --git a/contrib/packjpg/precomp_jpg.h b/contrib/packjpg/precomp_jpg.h index 5288f0a..c105b78 100644 --- a/contrib/packjpg/precomp_jpg.h +++ b/contrib/packjpg/precomp_jpg.h @@ -1,5 +1,3 @@ -#define JPG_MAX_MEMORY_SIZE 64 * 1024 * 1024 - // Motion JPEG DHT header // JPEG DHT Segment for YCrCb omitted from MJPEG data diff --git a/precomp.cpp b/precomp.cpp index af9d3e5..1636ad2 100644 --- a/precomp.cpp +++ b/precomp.cpp @@ -101,6 +101,8 @@ using namespace std; #define IN_BUF_SIZE 65536 //input buffer #define PENALTY_BYTES_TOLERANCE 160 +#define MAX_IO_BUFFER_SIZE 64 * 1024 * 1024 + unsigned char copybuf[COPY_BUF_SIZE]; unsigned char in_buf[IN_BUF_SIZE]; @@ -5255,7 +5257,7 @@ while (fin_pos < fin_length) { unsigned char* jpg_mem_in = NULL; unsigned char* jpg_mem_out = NULL; unsigned int jpg_mem_out_size = -1; - bool in_memory = (recompressed_data_length <= JPG_MAX_MEMORY_SIZE); + bool in_memory = (recompressed_data_length <= MAX_IO_BUFFER_SIZE); bool recompress_success = false; if (in_memory) { @@ -7684,7 +7686,7 @@ void try_decompression_jpg (long long jpg_length, bool progressive_jpg) { unsigned char* jpg_mem_in = NULL; unsigned char* jpg_mem_out = NULL; unsigned int jpg_mem_out_size = -1; - bool in_memory = ((jpg_length + MJPGDHT_LEN) <= JPG_MAX_MEMORY_SIZE); + bool in_memory = ((jpg_length + MJPGDHT_LEN) <= MAX_IO_BUFFER_SIZE); if (in_memory) { // small stream => do everything in memory jpg_mem_in = new unsigned char[jpg_length + MJPGDHT_LEN];