int BrightnessMain::process_buffer(VFrame *frame, int64_t start_position, double frame_rate) { load_configuration(); read_frame(frame, 0, start_position, frame_rate, get_use_opengl()); // Use hardware if(get_use_opengl()) { run_opengl(); return 0; } if(!engine) engine = new BrightnessEngine(this, PluginClient::smp + 1); this->input = frame; this->output = frame; if(!EQUIV(config.brightness, 0) || !EQUIV(config.contrast, 0)) { engine->process_packages(); } return 0; }
int FloatAuto::identical(FloatAuto *src) { return EQUIV(value, src->value) && EQUIV(control_in_value, src->control_in_value) && EQUIV(control_out_value, src->control_out_value) && mode == src->mode; }
int HueEffect::process_buffer(VFrame *frame, int64_t start_position, double frame_rate) { load_configuration(); read_frame(frame, 0, start_position, frame_rate, get_use_opengl()); this->input = frame; this->output = frame; if(EQUIV(config.hue, 0) && EQUIV(config.saturation, 0) && EQUIV(config.value, 0)) { return 0; } else { if(get_use_opengl()) { run_opengl(); return 0; } if(!engine) engine = new HueEngine(this, PluginClient::smp + 1); engine->process_packages(); } return 0; }
int FloatAuto::identical(FloatAuto *src) { return EQUIV(value, src->value) && EQUIV(control_in_value, src->control_in_value) && EQUIV(control_out_value, src->control_out_value); // ctrl positions ignored, as they may depend on neighbours // tangent_mode is ignored, no recalculations }
int VocoderConfig::equivalent(VocoderConfig &that) { if(!EQUIV(wetness, that.wetness) || !EQUIV(level, that.level) || carrier_track != that.carrier_track || bands != that.bands) return 0; return 1; }
int SynthOscillatorConfig::equivalent(SynthOscillatorConfig &that) { if(EQUIV(level, that.level) && EQUIV(phase, that.phase) && EQUIV(freq_factor, that.freq_factor)) return 1; else return 0; }
int ChromaKeyConfig::equivalent(ChromaKeyConfig &src) { return (EQUIV(red, src.red) && EQUIV(green, src.green) && EQUIV(blue, src.blue) && EQUIV(threshold, src.threshold) && EQUIV(slope, src.slope) && use_value == src.use_value); }
int LensConfig::equivalent(LensConfig &that) { for(int i = 0; i < FOV_CHANNELS; i++) if(!EQUIV(fov[i], that.fov[i])) return 0; return EQUIV(aspect, that.aspect) && EQUIV(radius, that.radius) && EQUIV(center_x, that.center_x) && EQUIV(center_y, that.center_y) && mode == that.mode && draw_guides == that.draw_guides; }
int Color3WayConfig::equivalent(Color3WayConfig &that) { for(int i = 0; i < SECTIONS; i++) { if(!EQUIV(hue_x[i], that.hue_x[i]) || !EQUIV(hue_y[i], that.hue_y[i]) || !EQUIV(value[i], that.value[i]) || !EQUIV(saturation[i], that.saturation[i])) return 0; } return 1; }
int ParametricBand::equivalent(ParametricBand &that) { if(freq == that.freq && EQUIV(quality, that.quality) && EQUIV(magnitude, that.magnitude) && mode == that.mode) { return 1; } else return 0; }
int TimeFrontConfig::equivalent(TimeFrontConfig &that) { return (EQUIV(angle, that.angle) && EQUIV(in_radius, that.in_radius) && EQUIV(out_radius, that.out_radius) && frame_range == that.frame_range && track_usage == that.track_usage && shape == that.shape && rate == that.rate && EQUIV(center_x, that.center_x) && EQUIV(center_y, that.center_y) && invert == that.invert && show_grayscale == that.show_grayscale); }
int SharpenConfig::equivalent(SharpenConfig &that) { return horizontal == that.horizontal && interlace == that.interlace && EQUIV(sharpness, that.sharpness) && luminance == that.luminance; }
int ChromaKey::process_buffer(VFrame *frame, int64_t start_position, double frame_rate) { SET_TRACE load_configuration(); this->input = frame; this->output = frame; read_frame(frame, 0, start_position, frame_rate, get_use_opengl()); if(EQUIV(config.threshold, 0)) { return 1; } else { if(get_use_opengl()) return run_opengl(); if(!engine) engine = new ChromaKeyServer(this); engine->process_packages(); } SET_TRACE return 1; }
ClausePos_p FindSignedTopSimplifyingUnit(ClauseSet_p units, Term_p t1, Term_p t2, bool sign) { Subst_p subst = SubstAlloc(); ClausePos_p res = NULL; ClausePos_p pos; assert(TermStandardWeight(t1) == TermWeight(t1,DEFAULT_VWEIGHT,DEFAULT_FWEIGHT)); assert(TermStandardWeight(t2) == TermWeight(t2,DEFAULT_VWEIGHT,DEFAULT_FWEIGHT)); assert(units && units->demod_index); PDTreeSearchInit(units->demod_index, t1, PDTREE_IGNORE_NF_DATE, false); while((pos = PDTreeFindNextDemodulator(units->demod_index, subst))) { if(EQUIV(EqnIsPositive(pos->literal), sign) && SubstComputeMatch(ClausePosGetOtherSide(pos), t2, subst, TBTermEqual)) { res = pos; assert(res->clause->set == units); break; } } PDTreeSearchExit(units->demod_index); SubstDelete(subst); return res; }
int Piano::process_realtime(int64_t size, double *input_ptr, double *output_ptr) { need_reconfigure |= load_configuration(); if(need_reconfigure) reconfigure(); double wetness = DB::fromdb(config.wetness); if(EQUIV(config.wetness, INFINITYGAIN)) wetness = 0; for(int j = 0; j < size; j++) output_ptr[j] = input_ptr[j] * wetness; int64_t fragment_len; for(int64_t i = 0; i < size; i += fragment_len) { fragment_len = size; if(i + fragment_len > size) fragment_len = size - i; //printf("Piano::process_realtime 1 %d %d %d\n", i, fragment_len, size); fragment_len = overlay_synth(i, fragment_len, input_ptr, output_ptr); //printf("Piano::process_realtime 2\n"); } return 0; }
int PluginAClientConfig::equivalent(PluginAClientConfig &that) { if(that.total_ports != total_ports) return 0; for(int i = 0; i < total_ports; i++) if(!EQUIV(port_data[i], that.port_data[i])) return 0; return 1; }
int RecordLabels::toggle_label(double position) { RecordLabel *current; // find label the position is after for(current = first; current && current->position < position; current = NEXT) { ; } if(current) { //printf("position %ld current->position %ld current->original %d\n", position, current->position, current->original); if(EQUIV(current->position, position)) { // remove it remove(current); } else { // insert before it insert_before(current); current->position = position; } } else { // insert after last //printf("position %ld\n", position); append(new RecordLabel(position)); } return 0; }
void MWindow::fit_selection() { if(EQUIV(edl->local_session->get_selectionstart(1), edl->local_session->get_selectionend(1))) { double total_samples = edl->tracks->total_length() * edl->session->sample_rate; TimelinePane *pane = gui->get_focused_pane(); for(edl->local_session->zoom_sample = 1; pane->canvas->get_w() * edl->local_session->zoom_sample < total_samples; edl->local_session->zoom_sample *= 2) ; } else { double total_samples = (edl->local_session->get_selectionend(1) - edl->local_session->get_selectionstart(1)) * edl->session->sample_rate; TimelinePane *pane = gui->get_focused_pane(); for(edl->local_session->zoom_sample = 1; pane->canvas->get_w() * edl->local_session->zoom_sample < total_samples; edl->local_session->zoom_sample *= 2) ; } edl->local_session->zoom_sample = MIN(0x100000, edl->local_session->zoom_sample); zoom_sample(edl->local_session->zoom_sample); }
double TimeBar::get_edl_length() { edl_length = 0; if(get_edl()) { //printf("TimeBar::get_edl_length 1 %f\n", get_edl()->tracks->total_playable_length()); edl_length = get_edl()->tracks->total_playable_length(); } //printf("TimeBar::get_edl_length 2\n"); if(!EQUIV(edl_length, 0)) { //printf("TimeBar::get_edl_length 3\n"); time_per_pixel = edl_length / get_w(); //printf("TimeBar::get_edl_length 4\n"); } else { time_per_pixel = 0; } //printf("TimeBar::get_edl_length 5\n"); return edl_length; }
void compare( const serial_t &a, const serial_t &b ) { EQUIV(a,b); EQUIV(b,a); CMP(a,==,b); CMP(a,!=,b); if(a.is_remote() ) return; if(b.is_remote() ) return; CMP(a,<=,b); CMP(a,>=,b); CMP(a,>,b); CMP(a,<,b); }
int ParametricConfig::equivalent(ParametricConfig &that) { for(int i = 0; i < BANDS; i++) if(!band[i].equivalent(that.band[i])) return 0; if(!EQUIV(wetness, that.wetness) || window_size != that.window_size) return 0; return 1; }
int DenoiseVideoConfig::equivalent(DenoiseVideoConfig &that) { return frames == that.frames && EQUIV(threshold, that.threshold) && do_r == that.do_r && do_g == that.do_g && do_b == that.do_b && do_a == that.do_a; }
void Synth::new_freq(double freq) { // Check for dupes for(int i = 0; i < MAX_FREQS; i++) { if(EQUIV(config.base_freq[i], freq)) return; } for(int i = 0; i < MAX_FREQS; i++) { if(EQUIV(config.base_freq[i], 0)) { config.base_freq[i] = freq; //printf("Synth::new_freq %d\n", __LINE__); break; } } }
int InterpolateVideoConfig::equivalent(InterpolateVideoConfig *config) { return EQUIV(this->input_rate, config->input_rate) && (this->use_keyframes == config->use_keyframes) && this->optic_flow == config->optic_flow && this->draw_vectors == config->draw_vectors && this->search_radius == config->search_radius && this->macroblock_size == config->macroblock_size; }
int GradientConfig::equivalent(GradientConfig &that) { return (EQUIV(angle, that.angle) && EQUIV(in_radius, that.in_radius) && EQUIV(out_radius, that.out_radius) && in_r == that.in_r && in_g == that.in_g && in_b == that.in_b && in_a == that.in_a && out_r == that.out_r && out_g == that.out_g && out_b == that.out_b && out_a == that.out_a && shape == that.shape && rate == that.rate && EQUIV(center_x, that.center_x) && EQUIV(center_y, that.center_y)); }
int TranslateConfig::equivalent(TranslateConfig &that) { return EQUIV(in_x, that.in_x) && EQUIV(in_y, that.in_y) && EQUIV(in_w, that.in_w) && EQUIV(in_h, that.in_h) && EQUIV(out_x, that.out_x) && EQUIV(out_y, that.out_y) && EQUIV(out_w, that.out_w) && EQUIV(out_h, that.out_h); }
int SvgConfig::equivalent(SvgConfig &that) { return EQUIV(in_x, that.in_x) && EQUIV(in_y, that.in_y) && EQUIV(in_w, that.in_w) && EQUIV(in_h, that.in_h) && EQUIV(out_x, that.out_x) && EQUIV(out_y, that.out_y) && EQUIV(out_w, that.out_w) && EQUIV(out_h, that.out_h) && !strcmp(svg_file, that.svg_file); }
int TransitionLengthText::handle_event() { double result = atof(get_text()); if(!EQUIV(result, gui->thread->length)) { gui->thread->length = result; } return 1; }
bool ClauseSimplifyWithUnitSet(Clause_p clause, ClauseSet_p unit_set, UnitSimplifyType how) { Eqn_p *handle; ClausePos_p res; assert(clause); assert(unit_set && unit_set->demod_index); assert(how); handle = &(clause->literals); while(*handle) { if(how == TopLevelUnitSimplify) { res = FindTopSimplifyingUnit(unit_set, (*handle)->lterm, (*handle)->rterm); } else { res = FindSimplifyingUnit(unit_set, (*handle)->lterm, (*handle)->rterm, false); } if(res) { assert(ClauseIsUnit(res->clause)); if(EQUIV(EqnIsPositive(*handle), EqnIsPositive(res->literal))) { DocClauseQuote(GlobalOut, OutputLevel, 6, clause, "subsumed by unprocessed unit", res->clause); if(!ClauseIsUnit(clause)&& ClauseStandardWeight(clause)==ClauseStandardWeight(res->clause)) { ClauseSetProp(res->clause, CPIsProtected); } ClauseSetProp(res->clause, ClauseQueryProp(clause, CPIsSOS)); return false; } ClauseDelProp(clause, CPLimitedRW); ClauseRemoveLiteralRef(clause, handle); DocClauseModification(GlobalOut, OutputLevel, clause, inf_simplify_reflect, res->clause, NULL, "cut with unprocessed unit"); } else { handle = &((*handle)->next); } } return true; }
double ParametricEQ::gauss(double sigma, double center, double x) { if(EQUIV(sigma, 0)) sigma = 0.01; double result = 1.0 / sqrt(2 * M_PI * sigma * sigma) * exp(-(x - center) * (x - center) / (2 * sigma * sigma)); return result; }