File: inverse_haar_x_generator.cpp

package info (click to toggle)
halide 21.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 55,752 kB
  • sloc: cpp: 289,334; ansic: 22,751; python: 7,486; makefile: 4,299; sh: 2,508; java: 1,549; javascript: 282; pascal: 207; xml: 127; asm: 9
file content (26 lines) | stat: -rw-r--r-- 628 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "Halide.h"

#include "daubechies_constants.h"

namespace {

Halide::Var x("x"), y("y"), c("c");

class inverse_haar_x : public Halide::Generator<inverse_haar_x> {
public:
    Input<Buffer<float, 3>> in_{"in"};
    Output<Buffer<float, 2>> out_{"out"};

    void generate() {
        Func in = Halide::BoundaryConditions::repeat_edge(in_);

        out_(x, y) = select(x % 2 == 0,
                            in(x / 2, y, 0) + in(x / 2, y, 1),
                            in(x / 2, y, 0) - in(x / 2, y, 1));
        out_.unroll(x, 2);
    }
};

}  // namespace

HALIDE_REGISTER_GENERATOR(inverse_haar_x, inverse_haar_x)