MCPcopy Create free account
hub / github.com/NatronGitHub/openfx-misc / setValues

Method setValues

PIK/PIK.cpp:529–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527 }
528
529 void setValues(ScreenTypeEnum screenType, // Screen Type: The type of background screen used for the key.
530 const OfxRGBColourD& color,
531 double redWeight, // Red Weight: Determines how the red channel and complement channel (blue for a green screen, green for a blue screen) are weighted in the keying calculation.
532 double blueGreenWeight, // Blue/Green Weight: Determines how the red channel and complement channel (blue for a green screen, green for a blue screen) are weighted in the keying calculation.
533 const OfxRGBColourD& alphaBias,
534 const OfxRGBColourD& despillBias,
535 bool lmEnable, // Luminane Match Enable: Luminance Match Enable: Adds a luminance factor to the color difference algorithm.
536 double level, // Screen Range: Helps retain blacks and shadows.
537 double luma, // Luminance Level: Makes the matte more additive.
538 bool llEnable, // Luminance Level Enable: Disable the luminance level when us bg influence.
539 bool autolevels, // Autolevels: Removes hard edges from the matte.
540 bool yellow, // Yellow: Override autolevel with yellow component.
541 bool cyan, // Cyan: Override autolevel with cyan component.
542 bool magenta, // Magenta: Override autolevel with magenta component.
543 bool ss, // Screen Subtraction: Have the keyer subtract the foreground or just premult.
544 bool clampAlpha, // Clamp: Clamp matte to 0-1.
545 bool rgbal, // Legalize rgba relationship.
546 double screenClipMin,
547 double screenClipMax,
548 ReplaceEnum screenReplace,
549 const OfxRGBColourD& screenReplaceColor,
550 SourceAlphaEnum sourceAlpha,
551 ReplaceEnum insideReplace,
552 const OfxRGBColourD& insideReplaceColor,
553 bool noKey, // No Key: Apply background luminance and chroma to Fg rgba input - no key is pulled.
554 bool ubl, // Use Bg Lum: Have the output rgb be biased by the bg luminance.
555 bool ubc, // Use Bg Chroma: Have the output rgb be biased by the bg chroma.
556 ColorspaceEnum colorspace,
557 OutputModeEnum outputMode)
558 {
559 // all colors are normalized with unit luminance
560 _alphaBias[0] = (float)(std::max)(0.0001, alphaBias.r);
561 _alphaBias[1] = (float)(std::max)(0.0001, alphaBias.g);
562 _alphaBias[2] = (float)(std::max)(0.0001, alphaBias.b);
563 float l = luminance(_colorspace, _alphaBias);
564 _alphaBias[0] /= l;
565 _alphaBias[1] /= l;
566 _alphaBias[2] /= l;
567 _despillBias[0] = (float)(std::max)(0.0001, despillBias.r);
568 _despillBias[1] = (float)(std::max)(0.0001, despillBias.g);
569 _despillBias[2] = (float)(std::max)(0.0001, despillBias.b);
570 _despillBias[0] /= l;
571 _despillBias[1] /= l;
572 _despillBias[2] /= l;
573 if (screenType == eScreenTypePick) {
574 _screenType = (color.g / _alphaBias[1] > color.b / _alphaBias[2]) ? eScreenTypeGreen : eScreenTypeBlue;
575 _color[0] = (float)(color.r / _alphaBias[0]);
576 _color[1] = (float)(color.g / _alphaBias[1]);
577 _color[2] = (float)(color.b / _alphaBias[2]);
578 _useColor = true;
579 } else {
580 _screenType = screenType;
581 _useColor = false;
582 }
583 _redWeight = redWeight;
584 _blueGreenWeight = blueGreenWeight;
585 _lmEnable = lmEnable;
586 _level = level;

Callers 1

setupAndProcessMethod · 0.45

Calls 1

luminanceFunction · 0.70

Tested by

no test coverage detected