mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Add missing magic number for JPEG XL (#2924)
* Add missing magic number for JPEG XL * do not force JXL container
This commit is contained in:
parent
9a30c6d48f
commit
d45f534d68
@ -57,11 +57,12 @@ namespace dlib
|
|||||||
return DNG;
|
return DNG;
|
||||||
else if (buffer[0]=='G' && buffer[1]=='I' && buffer[2] == 'F')
|
else if (buffer[0]=='G' && buffer[1]=='I' && buffer[2] == 'F')
|
||||||
return GIF;
|
return GIF;
|
||||||
|
else if ((buffer[0] == '\xff' && buffer[1] == '\x0a') ||
|
||||||
|
memcmp(buffer, jxlHeader, 12) == 0) // we can't use strlen because the header starts with \x00.
|
||||||
|
return JXL;
|
||||||
else if (buffer[0]=='R' && buffer[1]=='I' && buffer[2] == 'F' && buffer[3] == 'F' &&
|
else if (buffer[0]=='R' && buffer[1]=='I' && buffer[2] == 'F' && buffer[3] == 'F' &&
|
||||||
buffer[8]=='W' && buffer[9]=='E' && buffer[10] == 'B' && buffer[11] == 'P')
|
buffer[8]=='W' && buffer[9]=='E' && buffer[10] == 'B' && buffer[11] == 'P')
|
||||||
return WEBP;
|
return WEBP;
|
||||||
else if (memcmp(buffer, jxlHeader, 12) == 0) // we can't use strlen because the header starts with \x00.
|
|
||||||
return JXL;
|
|
||||||
|
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,6 @@ namespace dlib {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto enc = JxlEncoderMake(nullptr);
|
auto enc = JxlEncoderMake(nullptr);
|
||||||
if (JXL_ENC_SUCCESS != JxlEncoderUseContainer(enc.get(), JXL_TRUE))
|
|
||||||
{
|
|
||||||
throw image_save_error("jxl_saver: JxlEncoderUseContainer failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
auto runner = JxlResizableParallelRunnerMake(nullptr);
|
auto runner = JxlResizableParallelRunnerMake(nullptr);
|
||||||
JxlResizableParallelRunnerSetThreads(runner.get(), JxlResizableParallelRunnerSuggestThreads(width, height));
|
JxlResizableParallelRunnerSetThreads(runner.get(), JxlResizableParallelRunnerSuggestThreads(width, height));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user