Example #1
0
// Fill the given array with weights for the range [0.0, 1.0]. The array is
// interpreted as rectangular array of count * filter->size items.
void mp_compute_lut(struct filter_kernel *filter, int count, float *out_array)
{
    for (int n = 0; n < count; n++) {
        mp_compute_weights(filter, n / (double)(count - 1),
                           out_array + filter->size * n);
    }
}
Example #2
0
// Fill the given array with weights for the range [0.0, 1.0]. The array is
// interpreted as rectangular array of count * filter->size items.
void mp_compute_lut(struct filter_kernel *filter, int count, float *out_array)
{
    struct filter_window *window = &filter->w;
    if (filter->polar) {
        // Compute a 1D array indexed by radius
        for (int x = 0; x < count; x++) {
            double r = x * filter->f.radius / (count - 1);
            out_array[x] = sample_filter(filter, window, r);
        }
    } else {
        // Compute a 2D array indexed by subpixel position
        for (int n = 0; n < count; n++) {
            mp_compute_weights(filter, window,  n / (double)(count - 1),
                               out_array + filter->size * n);
        }
    }
}