bool enable_timing = true;
bool detailed_timing = false;
+bool enable_warmup = false;
+bool in_warmup = false;
bool enable_variational_refinement = true; // Just for debugging.
bool enable_interpolation = false;
GLuint motion_fs_obj;
GLuint motion_search_program;
- GLuint uniform_inv_image_size, uniform_inv_prev_level_size;
+ GLuint uniform_inv_image_size, uniform_inv_prev_level_size, uniform_out_flow_size;
GLuint uniform_image1_tex, uniform_grad0_tex, uniform_flow_tex;
};
uniform_inv_image_size = glGetUniformLocation(motion_search_program, "inv_image_size");
uniform_inv_prev_level_size = glGetUniformLocation(motion_search_program, "inv_prev_level_size");
+ uniform_out_flow_size = glGetUniformLocation(motion_search_program, "out_flow_size");
uniform_image1_tex = glGetUniformLocation(motion_search_program, "image1_tex");
uniform_grad0_tex = glGetUniformLocation(motion_search_program, "grad0_tex");
uniform_flow_tex = glGetUniformLocation(motion_search_program, "flow_tex");
glProgramUniform2f(motion_search_program, uniform_inv_image_size, 1.0f / level_width, 1.0f / level_height);
glProgramUniform2f(motion_search_program, uniform_inv_prev_level_size, 1.0f / prev_level_width, 1.0f / prev_level_height);
+ glProgramUniform2f(motion_search_program, uniform_out_flow_size, width_patches, height_patches);
glViewport(0, 0, width_patches, height_patches);
fbos.render_to(flow_out_tex);
}
total_timer.end();
- timers.print();
+ if (!in_warmup) {
+ timers.print();
+ }
// Scale up the flow to the final size (if needed).
if (finest_level == 0 || resize_strategy == DO_NOT_RESIZE_FLOW) {
}
pool.release_texture(flow_tex);
total_timer.end();
- timers.print();
+ if (!in_warmup) {
+ timers.print();
+ }
return output_tex;
}
glGenerateTextureMipmap(tex1_gray);
DISComputeFlow compute_flow(width1, height1);
+
+ if (enable_warmup) {
+ in_warmup = true;
+ for (int i = 0; i < 10; ++i) {
+ GLuint final_tex = compute_flow.exec(tex0_gray, tex1_gray, DISComputeFlow::RESIZE_FLOW_TO_FULL_SIZE);
+ compute_flow.release_texture(final_tex);
+ }
+ in_warmup = false;
+ }
+
GLuint final_tex = compute_flow.exec(tex0_gray, tex1_gray, DISComputeFlow::RESIZE_FLOW_TO_FULL_SIZE);
schedule_read<FlowType>(final_tex, width1, height1, filename0, filename1, flow_filename, "flow.ppm");
gray.exec(tex1, tex1_gray, width1, height1);
glGenerateTextureMipmap(tex1_gray);
+ if (enable_warmup) {
+ in_warmup = true;
+ for (int i = 0; i < 10; ++i) {
+ GLuint forward_flow_tex = compute_flow.exec(tex0_gray, tex1_gray, DISComputeFlow::DO_NOT_RESIZE_FLOW);
+ GLuint backward_flow_tex = compute_flow.exec(tex1_gray, tex0_gray, DISComputeFlow::DO_NOT_RESIZE_FLOW);
+ GLuint interpolated_tex = interpolate.exec(tex0, tex1, forward_flow_tex, backward_flow_tex, width1, height1, 0.5f);
+ compute_flow.release_texture(forward_flow_tex);
+ compute_flow.release_texture(backward_flow_tex);
+ interpolate.release_texture(interpolated_tex);
+ }
+ in_warmup = false;
+ }
+
GLuint forward_flow_tex = compute_flow.exec(tex0_gray, tex1_gray, DISComputeFlow::DO_NOT_RESIZE_FLOW);
GLuint backward_flow_tex = compute_flow.exec(tex1_gray, tex0_gray, DISComputeFlow::DO_NOT_RESIZE_FLOW);
{ "disable-timing", no_argument, 0, 1000 },
{ "detailed-timing", no_argument, 0, 1003 },
{ "ignore-variational-refinement", no_argument, 0, 1001 }, // Still calculates it, just doesn't apply it.
- { "interpolate", no_argument, 0, 1002 }
+ { "interpolate", no_argument, 0, 1002 },
+ { "warmup", no_argument, 0, 1004 }
};
for ( ;; ) {
case 1003:
detailed_timing = true;
break;
+ case 1004:
+ enable_warmup = true;
+ break;
default:
fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
exit(1);