@@ -4857,7 +4857,7 @@ while (fin_pos < fin_length) {
48574857 unsigned char * jpg_mem_in = NULL ;
48584858 unsigned char * jpg_mem_out = NULL ;
48594859 unsigned int jpg_mem_out_size = -1 ;
4860- bool in_memory = (recompressed_data_length <= MAX_IO_BUFFER_SIZE );
4860+ bool in_memory = (recompressed_data_length <= JPG_MAX_MEMORY_SIZE );
48614861 bool recompress_success = false ;
48624862
48634863 if (in_memory) {
@@ -6587,7 +6587,7 @@ void try_decompression_jpg (long long jpg_length, bool progressive_jpg) {
65876587 unsigned char * jpg_mem_in = NULL ;
65886588 unsigned char * jpg_mem_out = NULL ;
65896589 unsigned int jpg_mem_out_size = -1 ;
6590- bool in_memory = ((jpg_length + MJPGDHT_LEN) <= MAX_IO_BUFFER_SIZE );
6590+ bool in_memory = ((jpg_length + MJPGDHT_LEN) <= JPG_MAX_MEMORY_SIZE );
65916591
65926592 if (in_memory) { // small stream => do everything in memory
65936593 jpg_mem_in = new unsigned char [jpg_length + MJPGDHT_LEN];
@@ -6677,7 +6677,10 @@ void try_decompression_jpg (long long jpg_length, bool progressive_jpg) {
66776677 brotli_used = false ;
66786678 }
66796679 } else { // large stream => use temporary files
6680- // try to decompress at current position
6680+ if (DEBUG_MODE) {
6681+ printf (" JPG too large for brunsli, using packJPG fallback...\n " );
6682+ }
6683+ // try to decompress at current position
66816684 fjpg = tryOpen (tempfile0," wb" );
66826685 seek_64 (fin, input_file_pos);
66836686 fast_copy (fin, fjpg, jpg_length);
0 commit comments