Esempio n. 1
0
File: main.c Progetto: nihma/hoge_c
int main(int argc, char** argv)
{
  printf("Hello World!\n");

  sample_exception();
  sample_var();

  return (EXIT_SUCCESS);
}
Esempio n. 2
0
void DenoisingTask::prefilter_shadowing()
{
	device_ptr null_ptr = (device_ptr) 0;

	device_sub_ptr unfiltered_a   (buffer.mem, 0,                    buffer.pass_stride);
	device_sub_ptr unfiltered_b   (buffer.mem, 1*buffer.pass_stride, buffer.pass_stride);
	device_sub_ptr sample_var     (buffer.mem, 2*buffer.pass_stride, buffer.pass_stride);
	device_sub_ptr sample_var_var (buffer.mem, 3*buffer.pass_stride, buffer.pass_stride);
	device_sub_ptr buffer_var     (buffer.mem, 5*buffer.pass_stride, buffer.pass_stride);
	device_sub_ptr filtered_var   (buffer.mem, 6*buffer.pass_stride, buffer.pass_stride);

	/* Get the A/B unfiltered passes, the combined sample variance, the estimated variance of the sample variance and the buffer variance. */
	functions.divide_shadow(*unfiltered_a, *unfiltered_b, *sample_var, *sample_var_var, *buffer_var);

	/* Smooth the (generally pretty noisy) buffer variance using the spatial information from the sample variance. */
	nlm_state.set_parameters(6, 3, 4.0f, 1.0f);
	functions.non_local_means(*buffer_var, *sample_var, *sample_var_var, *filtered_var);

	/* Reuse memory, the previous data isn't needed anymore. */
	device_ptr filtered_a = *buffer_var,
	           filtered_b = *sample_var;
	/* Use the smoothed variance to filter the two shadow half images using each other for weight calculation. */
	nlm_state.set_parameters(5, 3, 1.0f, 0.25f);
	functions.non_local_means(*unfiltered_a, *unfiltered_b, *filtered_var, filtered_a);
	functions.non_local_means(*unfiltered_b, *unfiltered_a, *filtered_var, filtered_b);

	device_ptr residual_var = *sample_var_var;
	/* Estimate the residual variance between the two filtered halves. */
	functions.combine_halves(filtered_a, filtered_b, null_ptr, residual_var, 2, rect);

	device_ptr final_a = *unfiltered_a,
	           final_b = *unfiltered_b;
	/* Use the residual variance for a second filter pass. */
	nlm_state.set_parameters(4, 2, 1.0f, 0.5f);
	functions.non_local_means(filtered_a, filtered_b, residual_var, final_a);
	functions.non_local_means(filtered_b, filtered_a, residual_var, final_b);

	/* Combine the two double-filtered halves to a final shadow feature. */
	device_sub_ptr shadow_pass(buffer.mem, 4*buffer.pass_stride, buffer.pass_stride);
	functions.combine_halves(final_a, final_b, *shadow_pass, null_ptr, 0, rect);
}