comp-imaging / ProxImaL

A domain-specific language for image optimization.
MIT License
112 stars 29 forks source link

ProxFn least_squares Halide compilation error #41

Closed timmeinhardt closed 3 years ago

timmeinhardt commented 7 years ago

Solving a problem with the least_squares prox function in Halide implementation modus throws the following errors during compilation:

`../ProxImaL/build/lib/proximal/halide/src/fft2_r2c.cpp:52:71: error: use of undeclared identifier 'WTARGET'

    paddedInput = repeat_image( constant_exterior(input, 0.f), 0, WTARGET, 0, HTARGET);
                                                                  ^

../ProxImaL/build/lib/proximal/halide/src/fft2_r2c.cpp:52:83: error: use of undeclared identifier 'HTARGET'

    paddedInput = repeat_image( constant_exterior(input, 0.f), 0, WTARGET, 0, HTARGET);
                                                                              ^

../ProxImaL/build/lib/proximal/halide/src/fft2_r2c.cpp:56:43: error: use of undeclared identifier 'WTARGET'

    Func fftIn = fft2_r2c(input_func, WTARGET, HTARGET);
                                      ^

../ProxImaL/build/lib/proximal/halide/src/fft2_r2c.cpp:56:52: error: use of undeclared identifier 'HTARGET'

    Func fftIn = fft2_r2c(input_func, WTARGET, HTARGET);`

I resolved the error by adding the necessary flags to the compilation in sum_squares.py:

hflags = ['-DWTARGET={0} -DHTARGET={1}'.format(self.freq_shape[1], self.freq_shape[0])]

and

Halide('fft2_r2c.cpp', compile_flags=hflags).

If this is a new and unknown error and my solution is correct I am happy to send a PR.