bool example_test() {
  void *uc = NULL;

  int errors = 0;
  for (int channels = 1; channels <= 4; channels++) {
    errors += run_test(uc, channels, kCPU, kChunky);
    errors += run_test(uc, channels, kCPU, kPlanar);
    errors += run_test(uc, channels, kGLSL, kChunky);
    // GLSL+Planar is a silly combination; the conversion overhead is high.
    // But let's run it anyway, since it should work.
    errors += run_test(uc, channels, kGLSL, kPlanar);
  }

  // -------- Other stuff

  halide_print(uc, "Here is a random image.\n");

  Image<uint8_t> randomness(300, 400, 3);
  (void) halide_randomize_buffer_host<uint8_t>(uc, 0, 0, 255, randomness);
  halide_buffer_display(randomness);


  halide_print(uc, "Here is a smooth image.\n");

  Image<uint8_t> smoothness(300, 400, 3);
  (void) halide_smooth_buffer_host<uint8_t>(uc, 0, smoothness);
  halide_buffer_display(smoothness);

  return errors > 0;
}
Esempio n. 2
0
int main(void)
{
    LogCallback equals1 = equals_func1;
    LogCallback1 opposite1 = opposite_func1;
    //LogCallback equals1 = equals_func2;
    //LogCallback1 opposite1 = opposite_func2;
    int sum = 0;
    randomness(equals1, opposite1, &sum);
    printf("sum = %i", sum);
    getchar();
    return 0;
}