Performance optimization for SLA rasterization step

Do not use a gamma function (a pow call for every pixel) if exponent is near 1.0
This commit is contained in:
tamasmeszaros 2022-01-07 10:06:52 +01:00
parent 86657523e3
commit ac6611e374

View File

@ -77,6 +77,8 @@ std::unique_ptr<RasterBase> create_raster_grayscale_aa(
if (gamma > 0)
rst = std::make_unique<RasterGrayscaleAAGammaPower>(res, pxdim, tr, gamma);
else if (std::abs(gamma - 1.) < 1e-6)
rst = std::make_unique<RasterGrayscaleAA>(res, pxdim, tr, agg::gamma_none());
else
rst = std::make_unique<RasterGrayscaleAA>(res, pxdim, tr, agg::gamma_threshold(.5));