+ int frames = config.frames;
+ MWindow *mwindow = server->mwindow;
+ if( frames > 1 && (!mwindow || // dont scan during SELECT_REGION
+ mwindow->session->current_operation != SELECT_REGION ||
+ mwindow->edl->local_session->get_selectionstart() ==
+ mwindow->edl->local_session->get_selectionend() ) ) {
+ if( !stripe_engine )
+ stripe_engine = new HistStripeEngine(this, cpus, cpus);
+ int fw = frame->get_w(), fh =frame->get_h();
+ new_temp(fw, fh, BC_RGB_FLOAT);
+ MWindow *mwindow = server->mwindow;
+ if( (mwindow && mwindow->session->current_operation == SELECT_REGION) ||
+ ( last_frames == frames && last_position-1 == start_position &&
+ fframe && fframe->get_w() == fw && fframe->get_h() == fh ) ) {
+ read_frame(temp, 0, start_position, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_FFRM);
+ frame->transfer_from(temp);
+ }
+ else if( last_frames != frames || last_position != start_position ||
+ !fframe || fframe->get_w() != fw || fframe->get_h() != fh ) {
+ last_frames = frames;
+ last_position = start_position;
+ VFrame::get_temp(fframe, fw, fh, BC_RGB_FLOAT);
+ read_frame(fframe, 0, start_position+1, frame_rate, use_opengl);
+ BC_ProgressBox *progress = 0;
+ const char *progress_title = _("Histogram: scanning\n");
+ Timer timer;
+ for( int i=2; i<frames; ++i ) {
+ read_frame(temp, 0, start_position+i, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_TEMP);
+ if( !progress && gui_open() && frames > 2*frame_rate ) {
+ progress = new BC_ProgressBox(-1, -1, progress_title, frames);
+ progress->start();
+ }
+ if( progress && timer.get_difference() > 100 ) {
+ timer.update();
+ progress->update(i, 1);
+ char string[BCTEXTLEN];
+ sprintf(string, "%sframe: %d", progress_title, i);
+ progress->update_title(string, 1);
+ if( progress->is_cancelled() ) break;
+ }
+ if( progress && !gui_open() ) {
+ progress->stop_progress();
+ delete progress; progress = 0;
+ }
+ }
+ read_frame(temp, 0, start_position, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_FFRMS);
+ frame->transfer_from(temp);
+ if( progress ) {
+ progress->stop_progress();
+ delete progress;
+ }
+ ++last_position;
+ }
+ else {
+ read_frame(temp, 0, start_position+frames-1, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_TEMPS);
+ frame->transfer_from(fframe);
+ read_frame(temp, 0, start_position, frame_rate, use_opengl);
+ stripe_engine->process_packages(SUB_TEMPS);
+ ++last_position;
+ }
+ }
+ else
+ read_frame(frame, 0, start_position, frame_rate, use_opengl);
+