mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Ensure only one StaySequential operation per pipeline
This should reduce memory consumption for more complex pipelines that combine multiple operations without sequential access support e.g. flip and Gaussian blur.
This commit is contained in:
parent
397ee492d9
commit
3e8a0fc522
@ -1082,8 +1082,10 @@ namespace sharp {
|
||||
Ensure decoding remains sequential.
|
||||
*/
|
||||
VImage StaySequential(VImage image, VipsAccess access, bool condition) {
|
||||
if (access == VIPS_ACCESS_SEQUENTIAL && condition) {
|
||||
return image.copy_memory();
|
||||
static const char* meta = "sharp-copy-memory";
|
||||
if (access == VIPS_ACCESS_SEQUENTIAL && condition && image.get_typeof(meta) != G_TYPE_INT) {
|
||||
image = image.copy_memory();
|
||||
image.set(meta, 1);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user