Skip to content

Commit

Permalink
Merge pull request halide#688 from halide/includes
Browse files Browse the repository at this point in the history
<Halide.h> -> "Halide.h"
  • Loading branch information
abadams committed Feb 24, 2015
2 parents 391e783 + 38765b0 commit 1bbf6d7
Show file tree
Hide file tree
Showing 286 changed files with 331 additions and 331 deletions.
2 changes: 1 addition & 1 deletion apps/HelloAndroid/jni/halide.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"

using namespace Halide;

Expand Down
4 changes: 2 additions & 2 deletions apps/HelloAndroid/jni/native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <stdlib.h>

#include "halide_generated.h"
#include <HalideRuntime.h>
#include <HalideRuntimeOpenCL.h>
#include "HalideRuntime.h"
#include "HalideRuntimeOpenCL.h"

#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,"halide_native",__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"halide_native",__VA_ARGS__)
Expand Down
2 changes: 1 addition & 1 deletion apps/HelloAndroidGL/jni/halide_gl_filter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"

using namespace Halide;

Expand Down
28 changes: 14 additions & 14 deletions apps/HelloiOS/HelloiOS/reaction_diffusion_2.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
using namespace Halide;

Var x("x"), y("y"), c("c");
Expand All @@ -12,7 +12,7 @@ int main(int argc, char **argv) {

// The initial state is a quantity of three chemicals present
// at each pixel near the boundaries

Expr dx = (x - cx), dy = (y - cy);
Expr r = dx * dx + dy * dy;
Expr mask = r < 200 * 200;
Expand All @@ -26,7 +26,7 @@ int main(int argc, char **argv) {
Param<int> mouse_x, mouse_y;
Param<float> cx, cy;
Param<int> frame;

Func clamped;
clamped(x, y, c) = state(clamp(x, 0, state.width()-1), clamp(y, 0, state.height()-1), c);

Expand All @@ -42,37 +42,37 @@ int main(int argc, char **argv) {
clamped(x, y+1, c) +
clamped(x, y+3, c));
blur(x, y, c) = (blur_x(x, y, c) + blur_y(x, y, c))/10;

Expr R = blur(x, y, 0);
Expr G = blur(x, y, 1);
Expr B = blur(x, y, 2);

// Push the colors outwards with a sigmoid
Expr s = 0.5f;
R *= (1 - s) + s * R * (3 - 2 * R);
G *= (1 - s) + s * G * (3 - 2 * G);
B *= (1 - s) + s * B * (3 - 2 * B);

// Reaction
Expr dR = B * (1 - R - G);
Expr dG = (1 - B) * (R - G);
Expr dB = 1 - B + 2 * G * R - R - G;

Expr bump = (frame % 1024) / 1024.0f;
bump *= 1 - bump;
Expr alpha = lerp(0.3f, 0.7f, bump);
dR = select(dR > 0, dR*alpha, dR);

Expr t = 0.1f;

R += t * dR;
G += t * dG;
B += t * dB;

R = clamp(R, 0.0f, 1.0f);
G = clamp(G, 0.0f, 1.0f);
B = clamp(B, 0.0f, 1.0f);


Func new_state;
new_state(x, y, c) = select(c == 0, R, select(c == 1, G, B));
Expand Down Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv) {

new_state.vectorize(x, 4);
blur.vectorize(x, 4);

std::vector<Argument> args(6);
args[0] = state;
args[1] = mouse_x;
Expand All @@ -123,13 +123,13 @@ int main(int argc, char **argv) {

Func contour;
contour(x, y, c) = pow(state(x, y, c) * (1 - state(x, y, c)) * 4, 8);

Expr c0 = contour(x, y, 0), c1 = contour(x, y, 1), c2 = contour(x, y, 2);

Expr R = min(c0, max(c1, c2));
Expr G = (c0 + c1 + c2)/3;
Expr B = max(c0, max(c1, c2));

Expr alpha = 255 << 24;
Expr red = cast<int32_t>(R * 255) * (1 << 0);
Expr green = cast<int32_t>(G * 255) * (1 << 8);
Expand Down
12 changes: 6 additions & 6 deletions apps/blur/halide_blur.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#include <Halide.h>
#include "Halide.h"
using namespace Halide;

int main(int argc, char **argv) {

ImageParam input(UInt(16), 2);
Func blur_x("blur_x"), blur_y("blur_y");
Var x("x"), y("y"), xi("xi"), yi("yi");

// The algorithm
blur_x(x, y) = (input(x, y) + input(x+1, y) + input(x+2, y))/3;
blur_y(x, y) = (blur_x(x, y) + blur_x(x, y+1) + blur_x(x, y+2))/3;

// How to schedule it
blur_y.split(y, y, yi, 8).parallel(y).vectorize(x, 8);
blur_x.store_at(blur_y, y).compute_at(blur_y, yi).vectorize(x, 8);
blur_y.compile_to_file("halide_blur", input);
blur_x.store_at(blur_y, y).compute_at(blur_y, yi).vectorize(x, 8);

blur_y.compile_to_file("halide_blur", input);

return 0;
}
2 changes: 1 addition & 1 deletion apps/c_backend/pipeline.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"

using namespace Halide;

Expand Down
28 changes: 14 additions & 14 deletions apps/camera_pipe/camera_pipe.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdint.h>

using namespace Halide;
Expand All @@ -13,7 +13,7 @@ Func hot_pixel_suppression(Func input) {
max(input(x, y-2), input(x, y+2)));
Expr b = min(min(input(x-2, y), input(x+2, y)),
min(input(x, y-2), input(x, y+2)));

Func denoised;
denoised(x, y) = clamp(input(x, y), b, a);

Expand All @@ -36,9 +36,9 @@ Func deinterleave(Func raw) {
// Deinterleave the color channels
Func deinterleaved;

deinterleaved(x, y, c) = select(c == 0, raw(2*x, 2*y),
deinterleaved(x, y, c) = select(c == 0, raw(2*x, 2*y),
select(c == 1, raw(2*x+1, 2*y),
select(c == 2, raw(2*x, 2*y+1),
select(c == 2, raw(2*x, 2*y+1),
raw(2*x+1, 2*y+1))));
return deinterleaved;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ Func demosaic(Func deinterleaved) {
Expr bn_r = correction + (b_b(x+1, y) + b_b(x, y-1))/2;
Expr bnd_r = absd(b_b(x+1, y), b_b(x, y-1));

b_r(x, y) = select(bpd_r < bnd_r, bp_r, bn_r);
b_r(x, y) = select(bpd_r < bnd_r, bp_r, bn_r);

// Interleave the resulting channels
Func r = interleave_y(interleave_x(r_gr, r_r),
Expand All @@ -137,11 +137,11 @@ Func demosaic(Func deinterleaved) {


Func output;
output(x, y, c) = select(c == 0, r(x, y),
output(x, y, c) = select(c == 0, r(x, y),
select(c == 1, g(x, y), b(x, y)));


/* THE SCHEDULE */
/* THE SCHEDULE */
if (schedule == 0) {
// optimized for ARM
// Compute these in chunks over tiles, vectorized by 8
Expand Down Expand Up @@ -226,7 +226,7 @@ Func apply_curve(Func input, Type result_type, Param<float> gamma, Param<float>
Expr xf = clamp(cast<float>(x)/1024.0f, 0.0f, 1.0f);
Expr g = pow(xf, 1.0f/gamma);
Expr b = 2.0f - pow(2.0f, contrast/100.0f);
Expr a = 2.0f - 2.0f*b;
Expr a = 2.0f - 2.0f*b;
Expr z = select(g > 0.5f,
1.0f - (a*(1.0f-g)*(1.0f-g) + b*(1.0f-g)),
a*g*g + b*g);
Expand All @@ -242,7 +242,7 @@ Func apply_curve(Func input, Type result_type, Param<float> gamma, Param<float>
}

Func process(Func raw, Type result_type,
ImageParam matrix_3200, ImageParam matrix_7000, Param<float> color_temp,
ImageParam matrix_3200, ImageParam matrix_7000, Param<float> color_temp,
Param<float> gamma, Param<float> contrast) {

Var xi, yi;
Expand Down Expand Up @@ -296,16 +296,16 @@ int main(int argc, char **argv) {
// to make a 2560x1920 output image, just like the FCam pipe, so
// shift by 16, 12
Func shifted;
shifted(x, y) = input(x+16, y+12);
shifted(x, y) = input(x+16, y+12);

// Parameterized output type, because LLVM PTX (GPU) backend does not
// currently allow 8-bit computations
int bit_width = atoi(argv[1]);
Type result_type = UInt(bit_width);
// Pick a schedule

// Pick a schedule
schedule = atoi(argv[2]);

// Build the pipeline
Func processed = process(shifted, result_type, matrix_3200, matrix_7000, color_temp, gamma, contrast);

Expand Down
2 changes: 1 addition & 1 deletion apps/glsl/halide_blur.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"

using namespace Halide;

Expand Down
2 changes: 1 addition & 1 deletion apps/glsl/halide_ycc.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"

using namespace Halide;

Expand Down
2 changes: 1 addition & 1 deletion apps/local_laplacian/local_laplacian_gen.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
using namespace Halide;

Var x, y;
Expand Down
2 changes: 1 addition & 1 deletion apps/modules/generate_pipeline.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>
#include "my_library/my_library.h"

Expand Down
2 changes: 1 addition & 1 deletion apps/modules/my_library/flip.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion apps/modules/my_library/my_library.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file should be auto-generated in the future
#include <Halide.h>
#include "Halide.h"

namespace my_library {

Expand Down
2 changes: 1 addition & 1 deletion apps/modules/my_library/vignette.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion apps/nacl_demos/game_of_life.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"

using namespace Halide;

Expand Down
2 changes: 1 addition & 1 deletion apps/nacl_demos/julia.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
using namespace Halide;

Var x("x"), y("y"), c("c");
Expand Down
2 changes: 1 addition & 1 deletion apps/nacl_demos/nacl_demos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <string.h>
#include <sstream>

#include <HalideRuntime.h>
#include "HalideRuntime.h"

#include "game_of_life_init.h"
#include "game_of_life_update.h"
Expand Down
2 changes: 1 addition & 1 deletion apps/nacl_demos/reaction_diffusion.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
using namespace Halide;

Var x("x"), y("y"), c("c");
Expand Down
2 changes: 1 addition & 1 deletion apps/nacl_demos/reaction_diffusion_2.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
using namespace Halide;

Var x("x"), y("y"), c("c");
Expand Down
4 changes: 2 additions & 2 deletions apps/support/static_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <stdlib.h>
#include <cassert>

#include <HalideRuntime.h>
#include "HalideRuntime.h"

#ifndef BUFFER_T_DEFINED
#define BUFFER_T_DEFINED
Expand Down Expand Up @@ -135,7 +135,7 @@ class Image {

void copy_to_device(const struct halide_device_interface *device_interface) {
if (contents->buf.host_dirty) {
// If host
// If host
halide_copy_to_device(NULL, &contents->buf, device_interface);
contents->buf.host_dirty = false;
}
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/argmax.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/assertion_failure_in_parallel_for.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/autotune_bug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// This tests a segfault generated by an autotuned schedule.

#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/autotune_bug_2.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/autotune_bug_3.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/autotune_bug_4.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/autotune_bug_5.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/bad_elem_size.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <string.h>
#include <stdio.h>

Expand Down
2 changes: 1 addition & 1 deletion test/correctness/bit_counting.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include <Halide.h>
#include "Halide.h"
#include <stdio.h>
#include <stdint.h>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion test/correctness/bitwise_ops.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Halide.h>
#include "Halide.h"
#include <stdio.h>

using namespace Halide;
Expand Down
Loading

0 comments on commit 1bbf6d7

Please sign in to comment.