void VM::Execute() { assert(!state_->calls_.empty()); while (!state_->calls_.empty()) ExecuteFrame(); }
result MultiFrame::Execute() { result status = FILTER_OK; // Query the Frame object handling the target frame to get the plane for the other Frames to use int target_frame_id = (target_frame_number_ + temporal_radius_) % frames_.size(); int target_frame_plane; cl_event copying_target; frames_[target_frame_id].Plane(&target_frame_plane, ©ing_target); filter_.SetNumberedArg(FILTER_ARG_TARGET_PLANE, sizeof(cl_mem), g_devices[device_id_].buffers_.ptr(target_frame_plane)); const int rounded_width = region_width_ * ((width_ + region_width_ - 1) / region_width_); const int rounded_height = region_height_ * ((height_ + region_height_ - 1) / region_height_); for (int region_x = 0; region_x < rounded_width; region_x += region_width_) for (int region_y = 0; region_y < rounded_height; region_y += region_height_) { const cl_int2 top_left = {region_x, region_y}; alpha_so_far_ = 0; filter_.SetNumberedArg(FILTER_ARG_TOP_LEFT, sizeof(cl_int2), &top_left); cl_event *filter_events = new cl_event[frames_.size()]; for (int i = 0; i < 2 * temporal_radius_ + 1; ++i) { bool sample_equals_target = i == target_frame_id; if (!sample_equals_target) { // exclude the target frame so that it is processed last - TODO unnecessary status = ExecuteFrame(i, sample_equals_target, copying_target, filter_events); if (status != FILTER_OK) return status; } } status = ExecuteFrame(target_frame_id, true, copying_target, filter_events); if (status != FILTER_OK) return status; sort_.SetNumberedArg(0, sizeof(cl_mem), g_devices[device_id_].buffers_.ptr(target_frame_plane)); sort_.SetNumberedArg(2, sizeof(cl_int2), &top_left); status = sort_.Execute(cq_, NULL); if (status != FILTER_OK) return status; } return status; }
void VM::Execute() { assert(!state_->calls_.empty()); while (!state_->calls_.empty()) { // If current stack frame is a frame of a c function, // do not continue execute instructions, just return if (state_->calls_.back().func_->type_ == ValueT_CFunction) return ; ExecuteFrame(); } }