hrydgard/ppsspp — pull request #1612 by PeterTh (2013-05-01 00:37:21+00:00)
Title: Texture scaling parallelization

This is not so much an immediate pull request, rather a request for comments.

I did 2 things:
- moved the texture scaling stuff to a separate file (it has nothing to do semantically with caching really, and that file is already big enough)
- parallelized the texture scaling using a pool of worker threads (adjustable in number)

It's pretty successful, on my quad-core system I go from **~160 MPixel/s sequentially to ~480 MPixel/s with 4 worker threads**, using 5xBRZ.

Now, there are a few open issues:
- Does it really make sense to have the texture scaler maintain its own private pool of worker threads? For example, the same threads and the same ParallelLoop() method I use could also be used in quite a few places in the texture cache. Should there be a global (singleton?) worker pool with a ParallelLoop() method?
- How should the number of worker threads be determined? By the number of CPU threads? Or by a configuration setting? Make the former a default for the latter?
- I moved SimpleBuf to MemoryUtil.h -- that makes sense to me, and I needed it in 2 separate files.

Oh, and I developed a hybrid scaling method that seems to almost completely fix the posterization of texture gradients issue with xBRZ, without reducing sharpness where desired... but I've only tested it in Matlab so far, and only on a couple of textures.