loaders: JPG: Fix bussy loop on corrupted file.
[gfxprim.git] / libs / filters / GP_Multiply.gen.c.t
blob63f0442ce23e62a3453e115573aa019838ff0a1b
1 @ include source.t
2 /*
3  * Multiply filter -- Multiplies two images.
4  *
5  * Copyright (C) 2012-2014 Cyril Hrubis <metan@ucw.cz>
6  */
8 #include "core/GP_Clamp.h"
10 @ include arithmetic_filter.t
12 @ def filter_op(chan_name, chan_size):
13 {{ chan_name }} = ({{ chan_name }}_A * {{ chan_name }}_B + {{ (2 ** chan_size - 1) // 2}})/ ({{ 2 ** chan_size - 1}});
14 GP_CLAMP_GENERIC({{ chan_name }}, 0, {{ 2 ** chan_size - 1 }});
15 @ end
17 {@ filter_arithmetic('Multiply', filter_op) @}