diff options
Diffstat (limited to 'libglitter_compose_double.c')
-rw-r--r-- | libglitter_compose_double.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libglitter_compose_double.c b/libglitter_compose_double.c index d0fdc3e..5a8d361 100644 --- a/libglitter_compose_double.c +++ b/libglitter_compose_double.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libglitter.h" +#include "common.h" static void @@ -60,12 +60,12 @@ hstrips(double **outputs_, const double *restrict input, size_t output_rowsize, static void -generic(double **outputs, const double *restrict input, +generic(double **outputs, size_t noutputs, const double *restrict input, size_t output_rowsize, size_t output_cellsize, size_t input_rowsize, size_t width, size_t height, size_t widthmul, size_t heightmul, - const uint8_t *restrict cellmap, const double *restrict ncellweights) + const uint8_t *restrict cellmap, const double *restrict cellweights) { - size_t y, x, iy, ix, output_y, output_i, input_blanking; + size_t y, x, iy, ix, i, output_y, output_i, input_blanking; uint8_t channel; double value; @@ -75,12 +75,14 @@ generic(double **outputs, const double *restrict input, for (y = 0, output_y = 0; y < height; y++, output_y += output_rowsize) { for (x = 0, output_i = output_y; x < width; x++, output_i += output_cellsize) { + for (i = 0; i < noutputs; i++) + outputs[i][output_i] = 0; for (iy = 0; iy < heightmul; iy++) { for (ix = 0; ix < widthmul; ix++) { channel = cellmap[iy * widthmul + ix]; value = input[iy * input_rowsize + ix]; - value *= ncellweights[channel]; + value *= cellweights[channel]; outputs[channel][output_i] += value; } @@ -93,18 +95,16 @@ generic(double **outputs, const double *restrict input, void -libglitter_compose_double(double **outputs, size_t noutputs, const double *restrict input, - size_t output_rowsize, size_t output_cellsize, size_t input_rowsize, - size_t width, size_t height, size_t widthmul, size_t heightmul, - const uint8_t *restrict cellmap, const double *restrict ncellweights) +libglitter_compose_double(double **outputs, const double *restrict input, size_t output_rowsize, size_t output_cellsize, + size_t width, size_t height, const LIBGLITTER_RENDER_CONTEXT *render_ctx) { - if (noutputs == 3 && widthmul == 3 && heightmul == 1) { - vstrips(outputs, input, output_rowsize, output_cellsize, input_rowsize, width, height, cellmap); - } else if (noutputs == 3 && widthmul == 1 && heightmul == 3) { - hstrips(outputs, input, output_rowsize, output_cellsize, input_rowsize, width, height, cellmap); + if (render_ctx->render_method == RENDER_METHOD_VSTRIPS) { + vstrips(outputs, input, output_rowsize, output_cellsize, render_ctx->rowsize, width, height, render_ctx->cellmap); + } else if (render_ctx->render_method == RENDER_METHOD_HSTRIPS) { + hstrips(outputs, input, output_rowsize, output_cellsize, render_ctx->rowsize, width, height, render_ctx->cellmap); } else { - generic(outputs, input, output_rowsize, output_cellsize, input_rowsize, - width, height, widthmul, heightmul, cellmap, ncellweights); + generic(outputs, render_ctx->noutputs, input, output_rowsize, output_cellsize, render_ctx->rowsize, width, height, + render_ctx->widthmul, render_ctx->heightmul, render_ctx->cellmap, render_ctx->cellweights_double); } } |