Answer the question
In order to leave comments, you need to log in
Why is Photoshop so fast?
The bottom line:
1. open any image
2. throw 10 adjustment layers on top with various effects
3. to the top of the heap 5 more layers with different blending modes, but so that the very first layer at least somehow shines through them
4. change, for example, brightness /contrast of the very first layer.
And now the question is: how does Photoshop apply the effects from all those 15 layers on top to the original image so quickly? We change it, the effects are recalculated in real time for the entire image (even if only for the viewport). GPU acceleration? No, because Lightroom works in a similar way with GPU acceleration turned off.
Interested in the answer from an algorithmic point of view
Answer the question
In order to leave comments, you need to log in
There is nothing super fast in Photoshop. It is simply not written in JS, but in C / C ++, and, I'm sure, with assembler inserts where necessary. Although, without them, I think he would have coped well.
Yes, by the way, about the GPU. In modern CPUs, there are also quite a lot of vector instructions, there are all sorts of SSEs. If they are skillfully applied, then no GPU will be needed to process simple images. I'm sure Photoshop also uses these command sets.
Add to this the best developers in the industry - they not only know image processing algorithms well, they invent them themselves. Who else, if not them?
Findings:
a) you are probably used to the brakes of modern software written in high-level languages by crooked guys. Not all software is like that. As the previous respondents noted, Photoshop worked on 32 meters of the opera, now it is still a monster;
b) processing algorithms can be implemented in very different ways. If you understand the potential of modern chips, you will no longer be surprised at the speed of image processing.
One of the reasons Photoshop is so fast is the use of real numbers with fixed precision. Moreover, very, very low accuracy. Many algorithms use 16 bit numbers for calculations. Plus blocking memory.
The secret is simple: the effects are first applied to the preview, then in the background they are calculated for the entire picture in full size. And it is not difficult to quickly calculate the effects of blending and correction with modern powers in HLS mode or in another more suitable for the desired effect. But what can I say, when the browser can do it all very quickly. The main effects are already implemented in CSS3 - gradients, filters, transparency, crop, blur - everything works quickly.
Calculated for rendering - only the top layer, everything else - is calculated in memory and the result of each step and the order of the layers is stored as a transformation matrix relative to the previous step.
As soon as you rearrange layers:
1. the transformation matrix of what is under what you just rearranged is taken from the cache
2. the matrices are summed from this layer and up
3. the resulting transformation matrix is prepared
4. rendering is performed from the top layer and down ( removing the layers of the resulting matrix) as long as there is "uncovered" space in the
viewport. Since only what you see is rendered, this is done very quickly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question