Skip to content

Histogram - reduction using Expr instead of Var #6332

Answered by abadams
timeinpixels asked this question in Q&A
Discussion options

You must be logged in to vote

y doesn't exist on the left-hand-side of your update definition for waveform, so I'm not sure which pixel you're trying to load. Perhaps you mean the following: ?

    Halide::Func waveform, result;

    Halide::Var x, y, c;
    Halide::RDom r(0, input.width(), 0, input.height());

    waveform(x, y, c) = 0;
    waveform(r.x, input(r.x, r.y, 0), c) = Halide::cast<int>(input(r.x, r.y, c));

    result(x, y, c) = Halide::cast<uint8_t>(waveform(x, y, c));

    Halide::Buffer<uint8_t> output =
        result.realize({input.width(), input.height(), input.channels()});

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by timeinpixels
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants