mirror of
https://github.com/schnaader/precomp-cpp
synced 2026-08-23 00:23:04 -04:00
Increase JPG/MP3 in-memory threshold
- maximum size 512 MB instead of 64 MB - verbose output if JPGs are too large for in-memory (and packJPG is used as fallback)
This commit is contained in:
parent
905e32a127
commit
7fc569949e
3 changed files with 9 additions and 4 deletions
|
|
@ -1,6 +1,8 @@
|
|||
// Motion JPEG DHT header
|
||||
// JPEG DHT Segment for YCrCb omitted from MJPEG data
|
||||
|
||||
#define JPG_MAX_MEMORY_SIZE 512 * 1024 * 1024
|
||||
|
||||
#define MJPGDHT_LEN 420
|
||||
unsigned char MJPGDHT[MJPGDHT_LEN] = {
|
||||
0xFF,0xC4,0x01,0xA2,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "pmp3tbl.h"
|
||||
#undef PRECOMP_MP3
|
||||
|
||||
#define MP3_MAX_MEMORY_SIZE 64 * 1024 * 1024
|
||||
#define MP3_MAX_MEMORY_SIZE 512 * 1024 * 1024
|
||||
|
||||
// function to convert MP3 to PMP and vice versa, file to file
|
||||
bool pmplib_convert_file2file( char* in, char* out, char* msg );
|
||||
|
|
|
|||
|
|
@ -4857,7 +4857,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 <= MAX_IO_BUFFER_SIZE);
|
||||
bool in_memory = (recompressed_data_length <= JPG_MAX_MEMORY_SIZE);
|
||||
bool recompress_success = false;
|
||||
|
||||
if (in_memory) {
|
||||
|
|
@ -6587,7 +6587,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) <= MAX_IO_BUFFER_SIZE);
|
||||
bool in_memory = ((jpg_length + MJPGDHT_LEN) <= JPG_MAX_MEMORY_SIZE);
|
||||
|
||||
if (in_memory) { // small stream => do everything in memory
|
||||
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) {
|
|||
brotli_used = false;
|
||||
}
|
||||
} else { // large stream => use temporary files
|
||||
// try to decompress at current position
|
||||
if (DEBUG_MODE) {
|
||||
printf("JPG too large for brunsli, using packJPG fallback...\n");
|
||||
}
|
||||
// try to decompress at current position
|
||||
fjpg = tryOpen(tempfile0,"wb");
|
||||
seek_64(fin, input_file_pos);
|
||||
fast_copy(fin, fjpg, jpg_length);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue