alpha ¶
Functions:
-
dehalo_alpha
–Reduce halo artifacts by nuking everything around edges (and also the edges actually).
-
dehalo_merge
–Merge dehaloed clip onto the source clip.
-
dehalo_sigma
– -
dehalomicron
– -
fine_dehalo
–Halo removal script that uses
dehalo_alpha
with a few masks and optional contra-sharpening -
fine_dehalo2
–Halo removal function for 2nd order halos.
FloatIterArr module-attribute
¶
FineDehalo ¶
FineDehalo(fine_dehalo: Callable[P, R])
Bases: Generic[P, R]
Class decorator that wraps the fine_dehalo function and extends its functionality.
It is not meant to be used directly.
Classes:
-
Masks
–
Methods:
Source code
129 130 |
|
Masks ¶
Bases: CustomIntEnum
Attributes:
-
EDGES
– -
IGNORE_DETAILS
– -
LARGE_EDGES
– -
MAIN
– -
SHARP_EDGES
– -
SHRINK
– -
SHRINK_EDGES_EXCL
–
__call__ ¶
__call__(*args: args, **kwargs: kwargs) -> R
Source code
132 133 |
|
mask ¶
mask(
clip: VideoNode,
dehaloed: VideoNode | None = None,
rx: int = 1,
ry: int | None = None,
thmi: int = 50,
thma: int = 100,
thlimi: int = 50,
thlima: int = 100,
exclude: bool = True,
edgeproc: float = 0.0,
edgemask: EdgeDetect = Robinson3(),
pre_ss: int = 1,
pre_supersampler: ScalerT = Bilinear,
show_mask: int | Masks = 1,
planes: PlanesT = 0,
first_plane: bool = False,
func: FuncExceptT | None = None,
) -> VideoNode
The fine_dehalo mask.
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
dehaloed
¶VideoNode | None
, default:None
) –Optional dehaloed clip to mask. If this is specified, instead of returning the mask, the function will return the maskedmerged clip to this.
-
rx
¶int
, default:1
) –Horizontal radius for halo removal.
-
ry
¶int | None
, default:None
) –Vertical radius for halo removal.
-
thmi
¶int
, default:50
) –Minimum threshold for sharp edges; keep only the sharpest edges (line edges).
-
thma
¶int
, default:100
) –Maximum threshold for sharp edges; keep only the sharpest edges (line edges).
-
thlimi
¶int
, default:50
) –Minimum limiting threshold; include more edges than previously ignored details.
-
thlima
¶int
, default:100
) –Maximum limiting threshold; include more edges than previously ignored details.
-
exclude
¶bool
, default:True
) –If True, add an addionnal step to exclude edges close to each other
-
edgeproc
¶float
, default:0.0
) –If > 0, it will add the edgemask to the processing, defaults to 0.0
-
edgemask
¶EdgeDetect
, default:Robinson3()
) –Internal mask used for detecting the edges, defaults to Robinson3()
-
pre_ss
¶int
, default:1
) –Supersampling rate used before anything else. This value will be be rounded.
-
pre_supersampler
¶ScalerT
, default:Bilinear
) –Supersampler used for
pre_ss
. -
show_mask
¶int | Masks
, default:1
) –Whether to show the computed halo mask. 1-7 values to select intermediate masks.
-
planes
¶PlanesT
, default:0
) –Planes to process.
-
first_plane
¶bool
, default:False
) –Whether to mask chroma planes with luma mask.
-
func
¶FuncExceptT | None
, default:None
) –Function from where this function was called.
Returns:
-
VideoNode
–Mask or masked clip.
Source code
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
dehalo_alpha ¶
dehalo_alpha(
clip: VideoNode,
rx: FloatIterArr = 2.0,
ry: FloatIterArr | None = None,
darkstr: FloatIterArr = 0.0,
brightstr: FloatIterArr = 1.0,
lowsens: FloatIterArr = 50.0,
highsens: FloatIterArr = 50.0,
sigma_mask: float | bool = False,
ss: FloatIterArr = 1.5,
planes: PlanesT = 0,
show_mask: bool = False,
mask_radius: RadiusT = 1,
downscaler: ScalerT = Mitchell,
upscaler: ScalerT = BSpline,
supersampler: ScalerT = Lanczos(3),
supersampler_ref: ScalerT = Mitchell,
pre_ss: float = 1.0,
pre_supersampler: ScalerT = Nnedi3(0, field=0, shifter=NoShift),
pre_downscaler: ScalerT = Point,
mask_coords: Sequence[int] | None = None,
func: FuncExceptT | None = None,
) -> VideoNode
Reduce halo artifacts by nuking everything around edges (and also the edges actually).
rx
, ry
, darkstr
, brightstr
, lowsens
, highsens
, ss
are all configurable per plane and iteration. tuple
means iteration, list
plane.
rx=(2.0, [2.0, 2.4], [2.2, 2.0, 2.1])
means three iterations. * 1st => 2.0 for all planes * 2nd => 2.0 for luma, 2.4 for chroma * 3rd => 2.2 for luma, 2.0 for u, 2.1 for v
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
rx
¶FloatIterArr
, default:2.0
) –Horizontal radius for halo removal.
-
ry
¶FloatIterArr | None
, default:None
) –Vertical radius for halo removal.
-
darkstr
¶FloatIterArr
, default:0.0
) –Strength factor for dark halos.
-
brightstr
¶FloatIterArr
, default:1.0
) –Strength factor for bright halos.
-
lowsens
¶FloatIterArr
, default:50.0
) –Sensitivity setting for defining how weak the dehalo has to be to get fully accepted.
-
highsens
¶FloatIterArr
, default:50.0
) –Sensitivity setting for define how strong the dehalo has to be to get fully discarded.
-
sigma_mask
¶float | bool
, default:False
) –Blurring strength for the mask.
-
ss
¶FloatIterArr
, default:1.5
) –Supersampling factor, to avoid creation of aliasing.
-
planes
¶PlanesT
, default:0
) –Planes to process.
-
show_mask
¶bool
, default:False
) –Whether to show the computed halo mask.
-
mask_radius
¶RadiusT
, default:1
) –Mask expanding radius with
gradient
. -
downscaler
¶ScalerT
, default:Mitchell
) –Scaler used to downscale the clip.
-
upscaler
¶ScalerT
, default:BSpline
) –Scaler used to upscale the downscaled clip.
-
supersampler
¶ScalerT
, default:Lanczos(3)
) –Scaler used to supersampler the rescaled clip to
ss
factor. -
supersampler_ref
¶ScalerT
, default:Mitchell
) –Reference scaler used to clamp the supersampled clip. Has to be blurrier.
-
pre_ss
¶float
, default:1.0
) –Supersampling rate used before anything else.
-
pre_supersampler
¶ScalerT
, default:Nnedi3(0, field=0, shifter=NoShift)
) –Supersampler used for
pre_ss
. -
pre_downscaler
¶ScalerT
, default:Point
) –Downscaler used for undoing the upscaling done by
pre_supersampler
. -
func
¶FuncExceptT | None
, default:None
) –Function from where this function was called.
Returns:
-
VideoNode
–Dehaloed clip.
Source code
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
|
dehalo_merge ¶
dehalo_merge(
clip: VideoNode,
dehalo: VideoNode,
darkstr: list[float] | float = 0.0,
brightstr: list[float] | float = 1.0,
lowsens: list[float] | float = 50.0,
highsens: list[float] | float = 50.0,
sigma_mask: float | bool = False,
ss: list[float] | float = 1.5,
planes: PlanesT = 0,
show_mask: bool = False,
mask_radius: RadiusT = 1,
supersampler: ScalerT = Lanczos(3),
supersampler_ref: ScalerT = Mitchell,
pre_ss: float = 1.0,
pre_supersampler: ScalerT = Nnedi3(0, field=0, shifter=NoShift),
pre_downscaler: ScalerT = Point,
mask_coords: Sequence[int] | None = None,
func: FuncExceptT | None = None,
) -> VideoNode
Merge dehaloed clip onto the source clip.
darkstr
, brightstr
, lowsens
, highsens
, ss
are all configurable per plane.
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
dehalo
¶VideoNode
) –Dehaloed clip.
-
darkstr
¶list[float] | float
, default:0.0
) –Strength factor for dark halos.
-
brightstr
¶list[float] | float
, default:1.0
) –Strength factor for bright halos.
-
lowsens
¶list[float] | float
, default:50.0
) –Sensitivity setting for defining how weak the dehalo has to be to get fully accepted.
-
highsens
¶list[float] | float
, default:50.0
) –Sensitivity setting for define how strong the dehalo has to be to get fully discarded.
-
sigma_mask
¶float | bool
, default:False
) –Blurring strength for the mask.
-
ss
¶list[float] | float
, default:1.5
) –Supersampling factor, to avoid creation of aliasing.
-
planes
¶PlanesT
, default:0
) –Planes to process.
-
show_mask
¶bool
, default:False
) –Whether to show the computed halo mask.
-
mask_radius
¶RadiusT
, default:1
) –Mask expanding radius with
gradient
. -
supersampler
¶ScalerT
, default:Lanczos(3)
) –Scaler used to supersampler the rescaled clip to
ss
factor. -
supersampler_ref
¶ScalerT
, default:Mitchell
) –Reference scaler used to clamp the supersampled clip. Has to be blurrier.
-
pre_ss
¶float
, default:1.0
) –Supersampling rate used before anything else.
-
pre_supersampler
¶ScalerT
, default:Nnedi3(0, field=0, shifter=NoShift)
) –Supersampler used for
pre_ss
. -
pre_downscaler
¶ScalerT
, default:Point
) –Downscaler used for undoing the upscaling done by
pre_supersampler
. -
func
¶FuncExceptT | None
, default:None
) –Function from where this function was called.
Returns:
-
VideoNode
–Merged clip.
Source code
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
|
dehalo_sigma ¶
dehalo_sigma(
clip: VideoNode,
brightstr: FloatIterArr = 1.0,
darkstr: FloatIterArr = 0.0,
lowsens: FloatIterArr = 50.0,
highsens: FloatIterArr = 50.0,
ss: FloatIterArr = 1.5,
blur_func: Prefilter = GAUSS,
planes: PlanesT = 0,
supersampler: ScalerT = Lanczos(3),
supersampler_ref: ScalerT = Mitchell,
pre_ss: float = 1.0,
pre_supersampler: ScalerT = Nnedi3(0, field=0, shifter=NoShift),
pre_downscaler: ScalerT = Point,
mask_radius: RadiusT = 1,
sigma_mask: float | bool = False,
mask_coords: Sequence[int] | None = None,
show_mask: bool = False,
func: FuncExceptT | None = None,
**kwargs: Any
) -> VideoNode
Source code
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
|
dehalomicron ¶
dehalomicron(
clip: VideoNode,
brz: float = 0.075,
sigma: float = 1.55,
sigma0: float = 1.15,
ss: float = 1.65,
pre_ss: bool = True,
dampen: (
float | list[float] | tuple[float | list[float], bool | None]
) = 0.65,
sigma_ref: float = 4.3333,
planes: PlanesT = 0,
fdehalo_kwargs: KwargsT | None = None,
**kwargs: Any
) -> VideoNode
Source code
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
|
fine_dehalo ¶
fine_dehalo(
clip: VideoNode,
rx: FloatIterArr = 2.0,
ry: FloatIterArr | None = None,
darkstr: FloatIterArr = 0.0,
brightstr: FloatIterArr = 1.0,
lowsens: FloatIterArr = 50.0,
highsens: FloatIterArr = 50.0,
thmi: int = 80,
thma: int = 128,
thlimi: int = 50,
thlima: int = 100,
sigma_mask: float | bool = False,
ss: FloatIterArr = 1.5,
contra: int | float | bool = 0.0,
exclude: bool = True,
edgeproc: float = 0.0,
edgemask: EdgeDetect = Robinson3(),
planes: PlanesT = 0,
show_mask: int | Masks | bool = False,
mask_radius: RadiusT = 1,
downscaler: ScalerT = Mitchell,
upscaler: ScalerT = BSpline,
supersampler: ScalerT = Lanczos(3),
supersampler_ref: ScalerT = Mitchell,
pre_ss: float = 1.0,
pre_supersampler: ScalerT = Nnedi3(0, field=0, shifter=NoShift),
pre_downscaler: ScalerT = Point,
mask_coords: Sequence[int] | None = None,
func: FuncExceptT | None = None,
) -> VideoNode
Halo removal script that uses dehalo_alpha
with a few masks and optional contra-sharpening to try removing halos without nuking important details like line edges.
For rx
, ry
, only the first value will be used for calculating the mask.
rx
, ry
, darkstr
, brightstr
, lowsens
, highsens
, ss
are all configurable per plane and iteration. tuple
means iteration, list
plane.
rx=(2.0, [2.0, 2.4], [2.2, 2.0, 2.1])
means three iterations. * 1st => 2.0 for all planes * 2nd => 2.0 for luma, 2.4 for chroma * 3rd => 2.2 for luma, 2.0 for u, 2.1 for v
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
rx
¶FloatIterArr
, default:2.0
) –Horizontal radius for halo removal.
-
ry
¶FloatIterArr | None
, default:None
) –Vertical radius for halo removal.
-
darkstr
¶FloatIterArr
, default:0.0
) –Strength factor for dark halos.
-
brightstr
¶FloatIterArr
, default:1.0
) –Strength factor for bright halos.
-
lowsens
¶FloatIterArr
, default:50.0
) –Sensitivity setting for how weak the dehalo has to be to get fully accepted.
-
highsens
¶FloatIterArr
, default:50.0
) –Sensitivity setting for how strong the dehalo has to be to get fully discarded.
-
thmi
¶int
, default:80
) –Minimum threshold for sharp edges; keep only the sharpest edges (line edges).
-
thma
¶int
, default:128
) –Maximum threshold for sharp edges; keep only the sharpest edges (line edges).
-
thlimi
¶int
, default:50
) –Minimum limiting threshold; include more edges than previously ignored details.
-
thlima
¶int
, default:100
) –Maximum limiting threshold; include more edges than previously ignored details.
-
sigma_mask
¶float | bool
, default:False
) –Blurring strength for the mask.
-
ss
¶FloatIterArr
, default:1.5
) –Supersampling factor, to avoid creation of aliasing.
-
contra
¶int | float | bool
, default:0.0
) –Contrasharpening. If True or int, will use :py:func:
contrasharpening
otherwise uses :py:func:contrasharpening_fine_dehalo
with specified level. -
exclude
¶bool
, default:True
) –If True, add an addionnal step to exclude edges close to each other
-
edgeproc
¶float
, default:0.0
) –If > 0, it will add the edgemask to the processing, defaults to 0.0
-
edgemask
¶EdgeDetect
, default:Robinson3()
) –Internal mask used for detecting the edges, defaults to Robinson3()
-
planes
¶PlanesT
, default:0
) –Planes to process.
-
show_mask
¶int | Masks | bool
, default:False
) –Whether to show the computed halo mask. 1-7 values to select intermediate masks.
-
mask_radius
¶RadiusT
, default:1
) –Mask expanding radius with
gradient
. -
downscaler
¶ScalerT
, default:Mitchell
) –Scaler used to downscale the clip.
-
upscaler
¶ScalerT
, default:BSpline
) –Scaler used to upscale the downscaled clip.
-
supersampler
¶ScalerT
, default:Lanczos(3)
) –Scaler used to supersampler the rescaled clip to
ss
factor. -
supersampler_ref
¶ScalerT
, default:Mitchell
) –Reference scaler used to clamp the supersampled clip. Has to be blurrier.
-
pre_ss
¶float
, default:1.0
) –Supersampling rate used before anything else.
-
pre_supersampler
¶ScalerT
, default:Nnedi3(0, field=0, shifter=NoShift)
) –Supersampler used for
pre_ss
. -
pre_downscaler
¶ScalerT
, default:Point
) –Downscaler used for undoing the upscaling done by
pre_supersampler
. -
func
¶FuncExceptT | None
, default:None
) –Function from where this function was called.
Returns:
-
VideoNode
–Dehaloed clip.
Source code
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
|
fine_dehalo2 ¶
fine_dehalo2(
clip: VideoNode,
mode: OneDimConvModeT = HV,
radius: int = 2,
mask_radius: int = 2,
brightstr: float = 1.0,
darkstr: float = 1.0,
dark: bool | None = True,
show_mask: bool = False,
) -> VideoNode
Halo removal function for 2nd order halos.
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
mode
¶OneDimConvModeT
, default:HV
) –Horizontal/Vertical or both ways.
-
radius
¶int
, default:2
) –Radius for the fixing convolution.
-
mask_radius
¶int
, default:2
) –Radius for mask growing.
-
brightstr
¶float
, default:1.0
) –Strength factor for bright halos.
-
darkstr
¶float
, default:1.0
) –Strength factor for dark halos.
-
dark
¶bool | None
, default:True
) –Whether to filter for dark or bright haloing. None for disable merging with source clip.
-
show_mask
¶bool
, default:False
) –Whether to return the computed mask.
Returns:
-
VideoNode
–Dehaloed clip.
Source code
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
|