multi-threaded sequencer buffer calculation for masks.

This commit is contained in:
Campbell Barton 2012-07-31 16:37:47 +00:00
parent 4c02549d5d
commit 4473b846fb

@ -1291,27 +1291,28 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
* \brief Rasterize a buffer from a single mask
*
* We could get some speedup by inlining #BKE_maskrasterize_handle_sample
* and calcilating each layer then blending buffers, but this function is only
* and calculating each layer then blending buffers, but this function is only
* used by the sequencer - so better have the caller thread.
*
* If we wanted to this function could be threaded with OpenMP easily.
* Since #BKE_maskrasterize_handle_sample is used threaded elsewhere,
* we can simply use openmp here for some speedup.
*/
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
const unsigned int width, const unsigned int height,
float *buffer)
{
unsigned int x;
unsigned int y;
float *fp = buffer;
float xy[2];
#pragma omp parallel for private(y)
for (y = 0; y < height; y++) {
unsigned int i = y * width;
unsigned int x;
float xy[2];
xy[1] = (float)y / (float)height;
for (x = 0; x < width; x++) {
for (x = 0; x < width; x++, i++) {
xy[0] = (float)x / (float)width;
*fp++ = BKE_maskrasterize_handle_sample(mr_handle, xy);
buffer[i] = BKE_maskrasterize_handle_sample(mr_handle, xy);
}
}
}