-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathInpaintDelogo.avsi
3718 lines (3072 loc) · 219 KB
/
InpaintDelogo.avsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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
205
206
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
384
385
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
478
479
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
589
590
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
652
653
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
725
726
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
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
##================================================================================================##
# #
# ____ _ __ ____ __ #
# / _/___ ____ ____ _(_)___ / /_/ __ \___ / /___ ____ ____ #
# / // __ \/ __ \/ __ `/ / __ \/ __/ / / / _ \/ / __ \/ __ `/ __ \ #
# _/ // / / / /_/ / /_/ / / / / / /_/ /_/ / __/ / /_/ / /_/ / /_/ / #
# /___/_/ /_/ .___/\__,_/_/_/ /_/\__/_____/\___/_/\____/\__, /\____/ #
# /_/ /____/ #
# #
##================================================================================================##
# InpaintDelogo is an advanced logo and watermark removal function using inpainting and deblending
# with an adjustable fine process to hide artifacts and get best delogo results.
# Can remove opaque, transparent, semi-transparent and some dynamic logos from video.
# Can be used to remove hardcoded subtitles or extract them to images for OCR.
# Inpainting refers to the application of sophisticated algorithms to reconstruct of lost
# or deteriorated parts of images or videos.
##================================================================================================##
# Version: 3.7 #
##================================================================================================##
# Author : VoodooFX
# Doom9 link : https://forum.doom9.org/showthread.php?p=1883832
# GitHub link : https://github.com/Purfview/InpaintDelogo
# Version 3.7 : 2023/08/11. Fixed: Broken "YColorSolidIns" arg [code typo].
# Fixed: Bug with "isHD" variable.
# Added 'Mask' path check before running 'Automask'.
# New params: "UVAlphaFromY", "SubPrefix", "SubPostfix".
# Removed "colors_rgb.avsi" dependancy.
# Changed "mShow" to red instead of black.
# Version 3.6 : 2023/01/12. New conditional: Auto max "Interp" for frames where logo is in ~solid background.
# "Optimize" is split to "Optimize1" & "Optimize2".
# Burnin version number into ebmp ["v-", positive analyze only].
# Version 3.5 : 2022/12/27. Fixed: Dynamic mask inpainting was broken since v3.4.
# Version 3.4 : 2022/11/24. New feature: "Greyscale" parameter, affects positive "Analyze", "Deblend", "Inpaint"...
# Up to ~60% speed-up when enabled.
# Prevents chroma changes on the greyscale videos by deblend [side effect of "3.1" fix].
# FFT3DFilter replaced by Neo_FFT3D, up to ~20% speed-up.
# Version 3.3 : 2022/11/13. Corrected a code 'typo' in SubsMask2Img(), introduced in v2.10.
# Version 3.2 : 2022/10/22. New feature: Conditional optimizations with "Optimize", enabled by default.
# Up to ~1000% speed-up for slow "Inpaint" & "Interp" presets.
# Additional auto "Interp" disabling.
# New feature: Negative "dPP"/"oPP", adds denoise, enabled by default [20%-50% slow down].
# Very slow inpainting preset: Turbo=-2.
# Quick masks dump with clean "outs": DumpMasks=2.
# Various other tweaks.
# FFT3DFilter plugin is required.
# Version 3.1 : 2022/10/11. Fixed: "Deblend" with positive "Analyze" was unreliable on the colored logos.
# Version 3.00 : 2022/10/07. Fixed: A frame selection scan result wasn't saved properly when "Automask=1" and "Inpaint" mode,
# now the deblending masks generation is up to twice faster in this scenario.
# New feature: Easy use of the ebmp masks on other videos, you can input them directly with "Mask" parameter.
# Ebmp format is changed, the masks from older versions are not compatible.
# New feature: Twice faster subtitles extraction with auto intermediate file.
# It's activated by negative "Extract" values.
# Requirements: LSMASH, TWriteAVI, x264vfw.
# New params: "ReExtract", "FourCC".
# New feature: Adjustable subs detection window, useful if video has non-middle subs alignment.
# New params: "DetWinPercW", "DetWinPercH", "DetWinHoPos".
# With "Show=12" you can see the subs detection window and correlation coefficient [CorrTh/Corr].
# New: "Turbo=-1", it activates an inpainting preset more suitable for UHD - HD resolutions.
# New: "IntSpd=4", similar as above.
# Basemask change: Background should be less than full white, logo - full white.
# Swapped "Turbo" 1 & 3.
# Removed "rSize" parameter.
# Reworked "Show=2", alternative to "Show=1" for positive Analyze.
# New feature: Various parameters to manipulate the deblending masks from positive analyze [for the experts only]:
# "YAlphaTweak", "UAlphaTweak", "VAlphaTweak",
# "YAlphaSolidIns", "UAlphaSolidIns", "VAlphaSolidIns",
# "YAlphaSolidOuts", "UAlphaSolidOuts", "VAlphaSolidOuts",
# "YColorSolid", "UColorSolid", "VColorSolid",
# "YColorSolidOuts", "UColorSolidOuts", "VColorSolidOuts",
# "YColorSolidIns", "UColorSolidIns", "VColorSolidIns",
# "YOffsetIns", "YOffsetOuts", "UVOffsetIns", "UVOffsetOuts", "ShiftMasksVe", "ShiftMasksHo",
# "YAlphaExternal", "WholeDeblend", "TriggerDynamic", "DumpMasks".
# Various other tweaks.
# Avisynth+ v3.7.2 or later is required.
#
#---------------------------------------------------------------------------------------------------
#
# Version 2.17 : 2022/06/13. Option for ranged luma mask with DynMask6.
# Version 2.16 : 2022/06/12. Higher quality and faster "DynColor" mask when used with "DynLocUp".
# Faster "DynColor" alternative if parameter is string, and it supports multiple colors.
# TColorMask plugin is required.
# Version 2.15 : 2022/05/29. Spaces are allowed in "Loc".
# Version 2.14 : 2022/05/22. SubsMask2Img: New option to extract raw non-binarized images.
# Enabled by "Extract=2" in InpaintDelogo() or "Raw" in SubsMask2Img().
# New: "Raw", "RawAvr".
# Version 2.13 : 2022/05/21. SubsMask2Img: Added average luma check to catch non-sub images.
# New: "SubMinLuma", "SubSusLuma".
# Renamed: "SubSuspect" to "SubSusDur".
# Version 2.12 : 2022/05/14. Added generation of the dynamic mask by gradient magnitude map (aka "DynMask=7"/"DynTEdge").
# New: "DynTEdge", "DynTEdgeThY", "DynTEdgeInf", "DynTuneInf", Show=10, Show=11.
# vsTEdgeMask plugin is required.
# Version 2.11 : 2022/05/13. Rewrite: "DynColor" ~30%-300% faster. New: "DynMask=6/"DynTune". Removed: "Show=10".
# Version 2.10 : 2022/05/02. Added auto generation of the dynamic mask by color (aka "DynMask=5"/"DynColor").
# New: "DynColor", "DynColorTol", "DynColorInf", "Show=10".
# This dynamic mask by color can pre-patch video for other "DynMask" methods.
# Version 2.09 : 2022/04/08. Positive "DynMaskUp" is supported with "DynMask=3".
# Improved "KillNoise".
# Version 2.08 : 2022/04/07. Improved negative "KillBlobs".
# Version 2.07 : 2022/04/06. Changed defaults of the sub-parameters for "DynMask=3" (no need to set the bunch of parameters anymore).
# Version 2.06 : 2022/04/06. Fixed: "Show=3" was broken since v1.36.
# Version 2.05 : 2022/04/04. Masktools2 v2.2.30 or later is required.
# Tweaked: "DynMask=4" and positive "DynMaskUp", should be a bit faster and no more glitches on SD sources.
# New: "DynLocUp" [Experimental WIP parameter for tests].
# Version 2.04 : 2022/02/11. Improved deblend quality with positive "Analyze" when frames quantity to analyze is low.
# Tweaked: A/C masks filename from negative "Analyze" ('Deep' goes to the end of the filename).
# Tweaked: "iTune", "EdgeWide".
# Version 2.03 : 2021/12/13. Tweaked "DynTune".
# Version 2.02 : 2021/12/10. Fixed: "Analyze=1" bug.
# +11% deblend speed-up.
# Tweaked "aMix". "Analyze=2" is default. Adaptive "AnalyzeTh" default [16 or 30].
# Don't search frames for analyse if 'txt' file is present and ReAnalyze=0.
# Version 2.01 : 2021/12/05. "Analyze" 3 option.
# Version 2.00 : 2021/12/04. AviSynth+ v3.7.1 or later & FrameSel plugin is required.
# New: Old Deblend delogo is superceded by the new superior one.
# New: Smart frames selection for analyze using "AnalyzeTh" & "NoBorderAt" parameters.
# New: "Automask" adapted to the new stuff and it doesn't reanalyze when "aMix" is adjusted.
# New: "Show" 7/8/9.
# Note: Old Deblend is saved as negative "Analyze",
# -3/-4 should be same as old, -1/-2 were augmented by the smart frames selection.
#
#---------------------------------------------------------------------------------------------------
#
# Version 1.48 : 2021/11/12. Fixed: "Show=5" was broken since v1.36.
# Version 1.47 : 2021/11/11. Fixed: "Double Gscript".
# Version 1.46 : 2021/11/11. Support for AviSynth v2.6 [with the StainlessS's help].
# Version 1.45 : 2021/11/07. Fixed: Automask wasn't working if coords were "0,0,0,0".
# Version 1.44 : 2021/11/05. Refactored multipass deblending code.
# Version 1.43 : 2021/11/03. Fixed: One pass Deblend didn't see A/C masks from multi pass. Changed: "Deep".
# Version 1.42 : 2021/11/03. Fixed: A/C masks file name if coord is "-0".
# Version 1.41 : 2021/11/03. Fixed: "Show=1" was broken with "Deblend" since v1.18.
# Version 1.40 : 2021/10/28. Some speed optimizations. AvsInpaint v1.3 is required.
# Version 1.39 : 2021/10/23. Various improvements.
# Version 1.38 : 2021/10/22. Fixed: Bug with "SubSuspect" parameter.
# Version 1.37 : 2021/10/07. New: "DynMaskUp" parameter.
# Version 1.36 : 2021/10/04. Added auto generation of the dynamic mask for subtitles with halo (aka "DynMask=4").
# Updated: "KillNoise", and some other tweaks.
# Version 1.35 : 2021/09/23. Fixed: Bug with "TuneH1".
# Version 1.34 : 2021/09/21. New: "Extract" parameter to extract subtitles to images for OCR.
# New: 'SubsMask2Img()' func (mod of StainlessS's 'DetSub_Extract()').
# Note: This version needs AviSynth+.
# Version 1.33 : 2021/08/31. New: "DynMask3H", "ModeSH", "TuneH1", TuneH2", "TuneH3", "KillNoiseH, "rePassH".
# Updated: "Show", "DynTune".
# Version 1.32 : 2021/08/25. Fixed illogical Y8/YV12 conversions in the dynamic mask routines. ~20% faster.
# External dynamic mask expected to be Y8.
# Version 1.31 : 2021/08/22. New: "KillBlobs", "preBlobs", "RePass". Updated: "DynInflate", "KillNoise".
# Version 1.30 : 2021/08/13. Fixed TV levels in "Show" 5 mask.
# Version 1.29 : 2021/08/13. "mShow" 9.
# Version 1.28 : 2021/08/13. Changed "Dyn3Seq" & "ClpBlend" range limit. "Interp" 4.
# Version 1.27 : 2021/08/13. "Show" 5 outputs full size Dynamic PP mask.
# Version 1.26 : 2021/08/13. "DynInflate" up to 4px.
# Version 1.25 : 2021/08/13. Fixed/expanded "DynTune".
# Version 1.24 : 2020/11/28. Various tweaks. "Show" 3 & 4. Updated the manual with the new stuff.
# Version 1.23 : [non public] Added auto generation of a dynamic mask with ClipBlend (aka "DynMask=3").
# New parameters: "Dyn3Seq", "ClpBlend", "DynPostTune", "Dyn3buffer".
# Version 1.22 : [non public] Optimized speed for a dynamic mask, MaskTools2 required.
# Version 1.21 : [non public] Added support for the mask clips and a dynamic mask.
# Added basic auto generation of a dynamic mask (aka "DynMask=2").
# New parameters: "DynMask", "DynInflate", "DynTune", "KillNoise", "maskPatch".
# Version 1.20 : [non public] "Turbo" presets moved from soft to hard. iTune & Edge masks to "Show".
# Version 1.19 : [non public] New "IntSpd" parameter for "Interp" & the slow modes for "EdgePP".
# Version 1.18 : [non public] New "EdgePP", "EdgePos" & "EdgeWide" parameters. EdgeMask to "mShow".
# Version 1.17 : [non public] New "iTinflate" & "oTinflate" parameters. Interp/iTune mask to "mShow".
# Version 1.16 : [non public] New "diPP" & "diPPm" parameters.
# Version 1.15 : [non public] New mode for "InterpM", (-1) takes mask from new "iTune" parameter.
# Version 1.14 : [non public] "Fr1"/"Fr2" are renamed to "FrB"/"FrW". "GrainPP" is off by default.
# Version 1.13 : 2019/12/08. Allow -ve LogoX,LogoY, and +ve LogoW,LogoH in Loc string (by StainlessS).
# Version 1.12 : 2019/09/06. Various tweaks. New parameters. "Inflate" and "Deep" changed.
# Version 1.11 : 2019/08/31. First public release.
##================================================================================================##
# Requirements : #
##================================================================================================##
# Core requirements:
# AviSynth+ v3.7.2 or later ( https://github.com/AviSynth/AviSynthPlus ).
# AvsInpaint v1.3 or later ( https://github.com/pinterf/AvsInpaint ).
# Other requirements:
# MaskTools2 ( https://github.com/pinterf/masktools ).
# RgTools ( https://github.com/pinterf/RgTools ).
# GRunT ( https://github.com/pinterf/GRunT ).
# RequestLinear ( https://github.com/pinterf/TIVTC ).
# ClipBlend ( http://avisynth.nl/index.php/ClipBlend ).
# RT_Stats ( http://avisynth.nl/index.php/RT_Stats ).
# FrameSel ( http://avisynth.nl/index.php/FrameSel ).
# GrainFactory3 ( http://avisynth.nl/index.php/GrainFactory3 ).
# vsTEdgeMask ( https://github.com/Asd-g/AviSynth-vsTEdgeMask ).
# TColorMask ( https://github.com/Asd-g/AviSynth-tcolormask ).
# Neo_FFT3D ( http://avisynth.nl/index.php/Neo_FFT3D ).
# Requirements for fast subtitles extraction:
# LSMASH ( http://avisynth.nl/index.php/LSMASHSource ).
# TWriteAVI ( https://github.com/Asd-g/AviSynth-TWriteAVI ).
# x264vfw ( https://sourceforge.net/projects/mpxplay/files/x264vfw ).
##================================================================================================##
# InpaintLoc() manual: #
##================================================================================================##
# This function will help you to determine "Loc" values.
# Note: Don't forget to remove InpaintLoc() from a script after you determined "Loc" values.
# string "Loc" : Select a part of picture around the logo, it's similar as Crop().
#
# Use ("Left,Top,-Right,-Bottom") or ("Left,Top, Width, Height") coordinates.
#
# Use even(mod2) numbers.
# Include 10(no less!) - ~20 pixel borders around logo! No less than 18 is recommended for HD-UHD.
# Black or other borders shouldn't be present in the "Loc" area.
# The selected area will be highlighted.
##================================================================================================##
# InpaintDelogo() manual: #
##================================================================================================##
#=========================#
# Short basic guide: #
#=========================#
# ( Things you need before starting delogo )
#
# 0) Read help/manual(in the script) about parameters mentioned below.
# 1) Run this function to get "Loc" values: InpaintLoc(Loc="100,100,-100,-100"). Adjust "Loc" crop parameters around logo (aka "Left,Top,-Right,-Bottom"). Use even(mod2) numbers.
# 2) Prepare the "mask" manually, or start InpaintDelogo with "Automask=1" and "Analyze=2", automask result can be adjusted with"aMix".
# Basic example for non-transparent logo:
/*
InpaintDelogo( mask="D:\mask.bmp", Automask=0, aMix=0, Loc="100,100,-100,-100", Mode="Inpaint")
*/
#=================#
# Parameters: #
#=================#
# String "Loc" : Select a part of picture around the logo, it's similar as Crop().
# Use ("Left,Top,-Right,-Bottom") or ("Left,Top, Width, Height") coordinates.
#
# Use even(mod2) numbers.
# Include 10(no less!) - ~20 pixel borders around logo! No less than 18 is recommended for HD-UHD.
# Black or other borders shouldn't be present in the "Loc" area.
# val "mask" : File based bmp mask:
# Full path to a basemask of logo, an image where Logo is full white and background is less than full white.
# Example: mask="C:\mymask.bmp".
# Resolution of the image must be same as video clip's frame.
# Don't include surrounding bleed of the logo, just exact logo.
# Actually script is not strict about a format of the picture, it will
# convert whatever you give to a Black/White mask.
# You can use "Automask" option to auto-generate the base mask.
#
# File based ebmp masks:
# Full path to ebmp file. [pre v3 ebmp's are incompatible]
# You can use ebmp deblending masks from other videos.
# Adjust logo position with "Loc"s Left & Top coord, other coords are ignored. ["ShiftMasksVe", "ShiftMasksHo" can be used to move 1px.]
# Ignored parameters: "Automask", "ReAnalyze", "Analyze", "Deep".
# Filename of ebmp file doesn't matter.
#
# Clip based mask:
# "mask" accepts clip input, resolution must be same as "Loc" area.
# Dynamic mask expected to be full range Y8 or will be converted.
# Static mask must be one frame clip otherwise it will be treated as a dynamic mask.
# Int "Greyscale" : Up to ~60% speed-up with "Greyscale=1", affects positive "Analyze", "Deblend", "Inpaint", ect..
# Prevents chroma changes on the greyscale videos by deblend [side effect of "3.1" fix].
# Note: Changing this param doesn't trigger ReAnalyze [not all combinations needs to be re-analyzed].
#
# 0 - Off (default).
# 1 - Use on the greyscale videos.
# 2 - This should be used on the colored videos where a transparent logo is only in luma [no idea if such videos exists...].
# Int "Automask" : It's like a different function when On, just generates the base mask
# of the logo, then you need to turn it off.
# "Analyze" and its sub-parameters, "aMix", "mask", "Loc", "ReAnalyze", "AnalyzeTh" & "NoBorderAt" parameters will be used.
# "Loc" would be best 10(no less) pixels from the logo edges.
# Needs "mask" defined with path to imaginary bmp picture, that's where
# the base mask will be generated.
# Best should be "Analyze" method "2".
#
# 0 - Off (default).
# 1 - On. Generates the base mask. Script doesn't do anything else when "On"!
# Int "aMix" : Parameter is only for "Automask=1" (from -50 to 6; default: 0).
# Lower values = "thinner" mask, higher = "thicker" mask.
# Adjust it to generate precise mask of the logo, sometimes it's not possible
# then create a mask manually with Photoshop ect..
# No need to include the surrounding bleed of the logo.
# Int "Inflate" : Inflates the base mask.
#
# 0 - Disabled.
# 1 - Inflate by 1 pixel (default).
# 2 - Inflate by 2 pixels.
# String "Mode" : Delogo mode (default: Inpaint; default if mask=...ebmp: Deblend).
# Inpaint - Use if logo is opaque/hardly transparent.
# Deblend - Use if logo is transparent.
# Both - Use if logo is both: a logo has transparent and opaque/hardly transparent parts.
# Int "Analyze" : Analyze methods for deblend/transparent logo ("Deblend" & "Both" modes). (from -4 to 3)
# It creates Color & Alpha masks for deblending, ebmp filename will be unique with every "Analyze" setting in the filenames.
# Do "Analyze" and delogo only on frames with logo present! No animations too.
# Not MT compatible, don't use Prefetch() when doing analysis.
# Note: Clip is parsed ~few times when doing analysis, so keep that in mind if there is heavy filtering like QTGMC
# in a script before InpaintDelogo, then faster is to make an intermediate lossless encode before doing analysis and delogo.
# When "Automask=1" it creates the base mask, nothing else!!!
# (Adaptive default: 0 - forced for "Inpaint" mode; 2 - for other modes)
#
# 0 - "Disabled". Not selectable.
#
# 1 - Smart auto selection of good frames to analyze.
# Scans whole clip and checks only pixels at the edges of the base mask (~2|3 pxs offset).
# Should be more precise than 2, but it can't be used for "Automask=1".
#
# 2 - Smart auto selection of good frames to analyze.
# Scans whole clip and checks only at the edges of the "Loc" (4 pxs offset).
# "NoBorderAt" parameter must be set accordingly.
#
# 3 - Analyzes all frames, doesn't run the selection of frames.
#
#
# # Old deprecated inferior deblend:
# # Still here for some exotic use cases, for example to deblend the image file or very short video...
#
# -1 - Mirrors frame selection of method 1, but it's not the same.
#
# -2 - Mirrors frame selection of method 2, but it's not the same.
#
# -3 - Manual analysis.
# You need one frame where logo area is in a solid black/dark background and another one in a solid white/bright background.
# These two frames must be set with "FrB" & "FrW" parameters and optional "FrS".
#
# -4 - Manual analysis.
# OK (in most cases) for the basemask generation with "Automask".
# For delogo it's not good, use only if there is no white/bright frame in video and methods "-1/-2" are worse.
# Use only on white logos, will not deblend colored parts of the logo.
# Setup is similar as method "-3", just without "FrW" (it will be ignored).
# Int "AnalyzeTh" : MinMax threshold. (from 1 to 255; Adaptive default: if clip is > ~30 mins then to 16 or 30)
# Parameter only for "Analyze" 1/2/-1/-2.
# Used to auto select the solid looking frames suitable for analysis.
# 1 - very solid, 255 - usually almost all frames will be selected for analysis.
# Probably no need to touch it in the most cases.
# Analysis needs higher amount of various frames to create the better Color/Alpha masks, but non solid frames can introduce artifacts into masks.
# Txt file with found frames will be created (same filename as the Color/Alpha masks ebmp file).
# If there are less that ~1000 frames found then try to set to 30 or higher.
# "Show" 7/8/9 can be used to check stuff.
# String "NoBorderAt" : Parameter only for "Analyze" 2/-2.
# Must be set accordingly if there is no border between logo and "Loc" border, or there is less than 10 pixels.
# Accepts: "top", "bottom", "left", "right" or "none" (default: "none")
# Int "ReAnalyze" : Repeats analysis on every script load. (default: 0)
#
# 0 - Off. logo analysis is not computed if Color/Alpha masks and the selected frames txt files are present.
# 1 - On. Logo analysis is always computed even when Color/Alpha masks and the selected frames txt files are present.
# Parameters only for old (deprecated) Analyze methods:
#=============================================================================================================
# Int "Deep" : Multi pass deblending and analyze is activated with this option.
# Reduce discoloration artifacts, less logo remnants.
# Less transparent logo - bigger effect, sometimes no effect at all.
#
# 1 - Disabled (1-pass).
# 2 - 2-pass.
# 3 - 3-pass (default).
# 4 - 4-pass.
# 5 - 5-pass.
# Int "FrB" : Frame number of the black/dark frame for manual "Analyze" (default: 0).
# Int "FrW" : Frame number of the white/bright frame for manual "Analyze" (default: 0).
# Int "FrS" : Extended sequences of the frames for manual "Analyze" (default: 0).
# ( 0 - disabled; 1 - 5 frames; 2 - 10 frames; 3 - 30 frames.)
# Sequences starts from "FrB" and "FrW" frames.
# More frames = better analysis = better delogo.
# Be sure that the logo in the sequences still will be in the same/static solid
# dark/bright background.
# End of deprecated parameters
#=============================================================================================================
# Int "Interp" : Interpolation amount to reduce remnants/artifacts of the logo after deblend.
# Higher - more information is merged from the inpainted clip to the deblended clip.
# Basically, a compromise between deblend artifacts and inpaint artifacts.
# Interp artifacts are most visible when logo is crossing high contrast areas.
# (0 - Disabled. Max - 4). (default: 2).
# Int "IntSpd" : Speed of "Interp". Higher values can reduce "Interp" artifacts.
#
# 1 - Fastest (default).
# 2 - Fast.
# 3 - Slow.
# 4 - Slower. Useful for UHD - HD resolutions.
# Int "InterpM" : Manipulation of the "Interp" mask.
# (1,2) - Amount of pixels around the inflated base mask affected by "Interp",
# helps to hide bleed of the logo, if there is any, higher can decrease quality a bit
# of "Interp" for the shapy logos. Basically prevents bleed going into interpolation.
# For "Deblend"/"Both" modes.
#
# (-1) - Interpolates only less trasparent parts of the logo. For "Deblend" mode.
#
# -1 - Enables a mask controlled by "iTune" parameter.
# 0 - Disabled (default).
# 1 - Adds 1 pixels to interp mask.
# 2 - Adds 2 pixels to interp mask.
# Int "iTune" : Creates a mask for "Interp"/"InterpM". (from -10 to 10; default: 0).
# Creates mask for less transparent part of the logo.
# Useful if logo has different levels of transparency, and you don't need to
# interpolate very transparent parts as there will be almost no artifacts after deblend,
# instead you can "take" good pixels from a deblended very transparent area to do better
# interpolation on a less transparent area.
# 0 - doesn't mean that it's disabled, it is just a datum-point.
# Higher values -> mask expands into more-transparent areas of the logo.
# Int "iTinflate" : Inflates the iTune mask.
#
# 0 - Disabled (default).
# 1 - Inflate by 1 pixel.
# 2 - Inflate by 2 pixels.
# 3 - Inflate by 3 pixels.
# Int "oTune" : Creation of the mask for "Both" mode. (from -10 to 10; default: 0).
# Creates mask for opaque/hardly transparent part of the logo.
# 0 - doesn't mean that it's disabled, it is just a datum-point.
# Higher values -> mask expands into more-transparent areas of the logo.
# Int "oTinflate" : Inflates the oTune mask.
#
# 0 - Disabled (default).
# 1 - Inflate by 1 pixel.
# 2 - Inflate by 2 pixels.
# 3 - Inflate by 3 pixels.
# Int "Optimize1" : Enables conditional inpainting optimizations (from 0 to 1; default: 1).
# Not made to work with the dynamic masks (likely there wouldn't be a lot of benefit).
# 1 - Optimizations for the slow "Turbo" & "IntSpd" presets [up to ~1000% speed-up].
# Enables auto switching to the faster presets on the frames where logo is in ~solid background.
# Int "Optimize2" : Enables conditional optimizations for "Interp" (from 0 to 3; default: 3).
# 1 - Turns off "Interp" for frames where logo is in the background with higher contrast.
# 2 - Switch to max "Interp" for frames where logo is in ~solid background.
# 3 - Both 1 & 2 are enabled.
#===================#
# Dynamic mask: #
#===================#
# Int "DynMask" : Delogo with a dynamic mask, currently not for "Deblend".
# All other "Inpaint" only parameters should work with it too.
# All masks are only for "Inpaint". Except DynMask2 works in "Both" too [but only "DynTune" mask].
# For subtitles extraction use "Show=4" view.
# (Adaptive default: 0 or 1, depends from "mask".)
#
# 0 - Off - No dynamic mask. Auto-adaptive.
#
# 1 - External dynamic mask, defined by "mask". Auto-adaptive.
#
# 2 - Generation of the dynamic combo mask.
# Mix of essential DynMask6/"DynTune" mask + optional DynMask5/"DynColor and DynMask7/"DynTEdge" masks (logic 'and').
#
# 3 - Generation of the dynamic temporaly averaged combo mask [DynMask2 + temporal average].
# Useful when Logo jumps location and stays there for some time (set by "Dyn3Seq").
# Averaging is controled by "ClpBlend".
# This mask generation must be done in a single thread [no Prefetch]!
# Source filter must be frame accurate [like LWLibAvVideoSource]!
#
# For fine tuning use "Show=3" mode as in it only steps mentioned below are processed:
# Internal succession: Clip > "Loc" > "DynTune"+"DynColor"+"DynTEdge" > "ClpBlend" > "DynPostTune" >...
# Start looking at the ~last frame with logo in a location before adjusting things in "Show=3",
# because at other places a logo mask should/may disappear (down the chain those are merged in).
# Read about "Dyn3buffer" and parameters mentioned above!
#
# 4 - Generation of the dynamic mask for subtitles with halo.
#
# 5 - Generation of the dynamic mask by color (only "DynColor").
#
# 6 - Generation of the dynamic mask by brightness (only "DynTune").
#
# 7 - Generation of the dynamic mask by gradient magnitude map (only "DynTEdge").
# Int "DynInflate" : Inflates the dynamic mask by x pixels. Last in the filters chain (before "maskPatch" and "oPP"). (from 0 to 10; default: 0)
# If few masks are mixed into combo then better use separate inflation parameters [like "DynTuneInf", etc.].
# DynMask=5.
#=============================================================================================================
# NOTES: : When "DynMask=5": "DynInflate" is auto hardset to 0.
# Val "DynColor" : Auto generation of the dynamic mask by color. (from $000000 to $FFFFFF; default: 0).
# Color of logo/subtitle in RGB [hex value].
# If value is string then faster alternative is used, TColorMask instead of ColorKeyMask, and it supports multiple colors. ["$000000 $FFFFFF"]
# Use preview in AvsPmod to get RGB color value, use ConvertToRGB24(matrix="Rec601 or 709"). ['CopyPixelinfo' macro can be used for a fast copy.]
# 0 - Disabled (default).
# Int "DynColorTol" : Parameter for "DynColor". Color tolerance. (from 1 to 140; default: 10).
# Int "DynColorInf" : Inflates "DynColor" mask. (from 0 to 4; default: 1).
#=============================================================================================================
# DynMask=6.
#=============================================================================================================
# NOTES: : When "DynMask=6": "DynInflate" is auto hardset to 0.
# Val "DynTune" : A dynamic mask for "DynMask=2/3/4/6". Binarization threshold [luma/brighness level]. (from 1 to 254; default: 200).
# Lower values -> mask expands more into the darker areas of video.
# Set highest where logo/subtitle is still visible.
# Luma range mask can be made with string: "180 - 200".
# Int "DynTuneInf" : Inflates "DynTune" mask. (from -1 to 4; default: 0).
#=============================================================================================================
# DynMask=7.
#=============================================================================================================
# NOTES: : When "DynMask=7": "DynInflate" is auto hardset to 0.
# Int "DynTEdge" : Auto generation of the dynamic mask by gradient magnitude map. (from 0 to 1; default: 0).
# 0 - Disabled (default).
# Int "DynTEdgeThY" : Parameter for "DynTEdge". Magnitude threshold. (from 2 to 100; default: 20).
# Adjust it where background brightness is similar to logo/subtitle text brightness.
# Aim is to get good edges then inflate till logo/subtitle is covered. Lower - more wrong edges.
# Int "DynTEdgeInf" : Inflates "DynTEdge" mask. (from 0 to 8; default: 2).
#=============================================================================================================
# String "maskPatch": Full path to a patch image, a B/W picture in size of a "loc" area.
# Patches a dynamic mask with a custom static mask. Applies after "DynInflate".
# Int "KillNoise" : Undot, and eliminate up to 2px thick artifacts from the dynamic mask (from -5 to 5; default: 0).
# Negative pre-adds expand>inpand to reduce sponginess of a mask.
# It's after "KillBlobs" in the chain.
#
# 0 - Disabled (default).
# 1 - Undot (RemoveGrain(2). Affects white and black spaces).
# 2 - Two pass Undot.
# 3 - Hysteresis (inpand>hysteresis to eliminate up to 2x2 white stray pixels).
# 4 - Undot + Hysteresis.
# 5 - Two pass Undot + Hysteresis.
# Int "KillBlobs" : Removes thicker than logo/subs artifacts (from -8 to 8; default: 0).
# Minus sign is to indicate a method.
# Two methods: Negative -> mt_inpand>mt_hysteresis,
# Positive -> mt_inpand>mt_expand.
# Negative method removes blobs completely, but if artifact is touching logo/sub then it will be removed too.
# Positive method is safer, but leaves edges of the artifacts.
# Inner workings: Thicker logo/subs needs higher setting to make logo disappear, what is left is treated as artifact.
# Don't use Negative method if there is no thick halo.
# Int "preBlobs" : Reduce sponginess of the mask for "KillBlobs". (from -2 to 2; default: 0).
# Doesn't do anything if KillBlobs=0.
# Minus sign is to indicate a method.
# Two methods: Negative -> mt_expand> mt_inpand> KillBlobs,
# Positive -> mt_expand> KillBlobs> mt_inpand (bit more effective).
# 'Stronger' and 'more effective' is less safe for Negative "KillBlobs".
# Don't use if there is no thick halo.
#
# 0 - Disabled (default).
# -1 - 'both' mode.
# -2 - 'square' mode (bit stronger).
# 1 - 'both' mode.
# 2 - 'square' mode (bit stronger).
# Int "Extract" : See SubsMask2Img() manual somewhere below!
# Int "ReExtract" : See SubsMask2Img() manual somewhere below!
# String "FourCC" : See SubsMask2Img() manual somewhere below!
# Int "DetWinPercW" : See SubsMask2Img() manual somewhere below!
# Int "DetWinPercH" : See SubsMask2Img() manual somewhere below!
# Float "DetWinHoPos" : See SubsMask2Img() manual somewhere below!
# DynMask=3: #
#================#
# Int "Dyn3Seq" : Parameter for "DynMask=3".
# Sets how many frames the logo is in a location (from 8 to 9999, default: 12).
# For subtitles set duration of the shortest subtitle or shorter subs will disappear from the mask.
# Int "ClpBlend" : Parameter for "DynMask=3".
# Sets how many frames will be blended to help to eliminate non-logo areas.
# More frames blended - more chance for non-logo areas to disappear from the mask.
# Disabling it disables "DynPostTune" automatically. Must be less than "Dyn3Seq"-1.
# Adaptive default: ["Dyn3Seq"-2] if Dyn3Seq is < 54, else: 52.
# 0 = Disabled (for fine tuning with "Show=3").
# Note: No need to touch for subtitles.
# Int "DynPostTune" : Parameter for "DynMask=3".
# Post-blend binarization threshold. (from 0 to 5; default: 0 or 1)
# Higher values -> mask expands more into the brighter areas of video. (1=254, increments by -1)
# Safest setting is "1", higher will extend logo mask for few frames back and forth,
# and possibly some non-logo areas can appear in a mask, but logo mask will get in a lilbit better shape.
# If "ClpBlend" is disabled then this will be disabled automatically too.
# 0 - Disabled, for fine tuning.
# Note: No need to touch for subtitles.
# Int "Dyn3buffer" : Parameter for "DynMask=3".
# Ignore this if "ClpBlend" is less than "53". ( https://forum.doom9.org/showthread.php?p=1928621 )
# Buffer for internal TrimergageFX(). Disable it for the script previewing or preview will be very slow.
# Enable it for encoding or AvS will work very slow, and it must go together
# with RequestLinear(rlim=ClpBlend+1,clim=ClpBlend+1) placed after the source filter.
#
# 0 - Buffer disabled (default).
# 1 - Buffer enabled.
# Note: No need to touch for subtitles.
# Int "RePass" : Parameter for "DynMask=3".
# Re-pass temporal+KillNoise routines to reduce artifacts. (from 0 to 2; default: 0).
# Useful if "KillBlobs" or "KillNoise" are on.
#
# 0 - Disabled (default).
# 1 - Re-pass once.
# 2 - Re-pass twice (bit less artifacts).
# DynMask3H>0: #
#================#
# Int "DynMask3H" : Parameter for "DynMask=3". [Maybe better look at "DynMask=4" method]
# If subs has dark full halo then it can be used to remove artifacts. Binarization threshold (from 0 to 200; default: 0 - Disabled).
# This mask is used to refine a final "DynMask=3" mask using hysteresis.
# Is using "Dyn3Seq"/"ClpBlend" settings (don't change).
# As longs as there is a single pixel in a contiguous letter part - mask is good (letters can be partly missing).
# Artifacts outside subs area doesn't matter much, usually they won't coincide with "DynMask=3" artifacts.
# "RePass" wasn't found useful in the final result (on the short sample). After hysteresis there is non-optional repass.
#
# Use "Show=6" to finetune it, parameters are chained in sequence as they are in this help (except "ModeSH").
# At this step when "ModeSH=1 & TuneH1=0" - mask is shown pre-construct inverted, actual spatial mask is constructed when "TuneH1" is set.
# Set lowest where the subtitle halo masking is visible and clear.
# 0 - Disabled (default).
# Int "ModeSH" : Parameter for "DynMask3H".
# Temporal or spatial halo mask method selector (from 0 to 1; default: 1).
# 0 - Temporal halo mask. Cons: Slower, doesn't remove some temporal artifacts. Pros: Unknown.
# 1 - Spatial halo mask. Pros: Faster, removes temporal artifacts. Cons: Unknown.
# Int "TuneH1" : Parameter for "DynMask3H".
# Removes thicker than logo/subs artifacts (from 0 to 7; default: 0 - Disabled).
# Thicker logo/subs needs higher setting to make subs disappear, what is left is treated as artifact.
# Same as positive "KillBlobs" method.
# Increase till text is visible, small part of letter missing is ok.
# Int "TuneH2" : Parameter for "DynMask3H".
# Pre-diff expands (visibly after diff looks like inpands). (from 0 to 4; default: 0 - Disabled).
# Increase to reduce halo remnants from the mask, up to where it doesn't affect letters.
# Int "TuneH3" : Parameter for "DynMask3H".
# Post-diff inpands. (from 0 to 3; default: 0 - Disabled).
# Increase up to where letters doesn't disappear completely.
# Int "KillNoiseH" : Parameter for "DynMask3H".
# Undot, and eliminate up to 1x2px artifacts from the "DynMask3H" mask.
# Wasn't found useful in the final result (on the short sample).
#
# 0 - Disabled (default).
# 1 - Undot (RemoveGrain(2). Affects white and black spaces).
# 2 - Two pass Undot.
# Int "rePassH" : Parameter for "DynMask3H".
# Re-pass/pass temporal+KillNoiseH routines to reduce artifacts in "DynMask3H" mask. (0 - Disabled, 1 - Enabled; default: 0).
# Wasn't found useful in the final result (on the short sample).
# DynMask=4: #
#================#
# NOTES: : For subtitles with a dark halo. A mask made from "Dyntune" & "DynMask4H" parameters.
# Int "DynMask4H" : Parameter for "DynMask=4".
# Binarization threshold for the subtitles halo (from 1 to 200; default: 60).
# Set lowest where the subtitle halo masking is visible and clear. If too low then some letters can disappear.
# Use "Show=6" to finetune it.
# Int "DynMaskUp" : Parameter for "DynMask=4".
# Only to get a neat upsized subtitles mask on Show=4 output. (from -4 to 4; default: 0).
# Resolution is multiplied by parameter (-1/0/1 = Disabled).
# Positive: First set everything without this parameter as all filtering is done on a not-upsized mask, which is used to do hysteresis into the upsized mask.
# Negative: Does filtering on the upsized mask (experimental, WIP).
# Int "DynLocUp" : Experimental WIP parameter for tests, alternative to negative "DynMaskUp". Tested only with "DynMask=4", may work with other methods, may break things.
# Vs negative "DynMaskUp": ~50%-30% faster. Doesn't destroy slim characters [like hieroglyphs], but doesn't remove some noise.
# Only to get a neat upsized subtitles mask on Show=4 output. (from 1 to 4; default: 1).
# Resolution is multiplied by parameter.
#==================#
# Post-process: #
#==================#
# Int "dPP" : Blur amount applied to delogoed area to hide artifacts (from -8 to 8; default: -3).
# Blur strength. Negative adds denoise on top of blur.
# Int "dPPm" : Adds smooth borders to the deblend mask, used for "dPP" post-process,
# it will blend in a deblended area into the surrounding.(default: 3/adaptive).
#
# 0 - Disabled. Not selectable. Adaptive.
# 1 - 3 smooth pixels added.
# 2 - 5 smooth pixels added.
# 3 - 7 smooth pixels added.
# Int "diPP" : Blur amount applied to Interp/iTune area to hide artifacts (from -8 to 8; default: -5).
# Auto disabled if Interp = 0 or InterpM != -1.
# Blur strength. Negative adds denoise on top of blur.
# Int "diPPm" : Adds smooth borders to the iTune mask, used for "diPP" (default: 3).
#
# 0 - Disabled.
# 1 - 3 smooth pixels added.
# 2 - 5 smooth pixels added.
# 3 - 7 smooth pixels added.
# Int "oPP" : Blur amount applied to inpainted(opaque) area to calm it down (from -8 to 8; default: -5).
# Blur strength. Negative adds denoise on top of blur.
# Int "oPPm" : Adds smooth borders to the opaque mask, used for "oPP" post-process,
# it will blend in an inpainted area into the surrounding.(default: 3).
# Auto-disabled if "oPP=0".
#
# 0 - Disabled.
# 1 - 3 smooth pixels added.
# 2 - 5 smooth pixels added.
# 3 - 7 smooth pixels added.
# Int "GrainPP" : Adds grain, it will blend in an delogoed area into the noisy surrounding.
# Requires GrainFactory3. Use only if there is grain or similar noise in video.
# (0 - Disabled. 3 - Max noise). (default: 0)
# Int "EdgePP" : Creates the edgemask. Inpaints edges of the base or iTune mask.
# Useful on the bigger & hardly transparent logos if deblend left strong
# artifacts on the edges of the logo.
# It ignores "Inflate"/"iTinflate".
#
# 0 - Disabled (default).
# 1 - Enabled. Fast.
# 2 - Enabled. Slow. Slight increase of quality .
# 3 - Enabled. Very slow. Definitely will decrease speed.
# Int "EdgePos" : Position of the edgemask. (default: 0).
#
# -1 - 1px inwards from the initial position.
# 0 - The initial position.
# 1 - 1px outwards from the initial position.
# Int "EdgeWide" : Wideness of the edgemask (default: 1).
#
# 0 - 2px wide mask.
# 1 - 4px wide mask.
# 2 - 6px wide mask.
# 3 - 8px wide mask.
#=========================#
# Pre-process helpers: #
#=========================#
# int "Show" : Show some masks and steps of the delogo process.
#
# 0 - Disabled (default).
# 1 - Various masks and some delogo steps.
# 2 - a) For positive analyze: Shows exact deblend masks [just ignore chroma], shows more delogo steps than "Show=1" (can show "mShow").
# b) If not positive analyze:
# b1) Stacked Delogoed + PostProcessed steps (can show "mShow").
# b2) If a dynamic mask:
# Delogoed + Dynamic mask
# PostProcessed + Dynamic PP mask
# 3 - Only for "DynMask=3". For fine tuning. Pre TrimergageFX().
# 4 - Outputs the DynamicMask (Loc area). Can be used to extract subtitles.
# 5 - Outputs full sized Dynamic PP mask in Y8.
# 6 - Outputs the "DynMask3H" & "DynMask4H" mask. For fine tuning.
#
# # Analyze. Dev stuff:
# 7 - Shows the constructed clip used to select frames for Analyze (whole clip with MinMax stats). 4x upsize.
# 8 - Same as 7, except that it shows the selected frames by AnalyzeTh. 4x upsize.
# 9 - Shows original selected frames with the real frame number from source clip.
#
# # For DynMask=2/5/6/7:
# 10 - Stacked: Original | Overlayed black | Mask
# 11 - Overlayed black
#
# 12 - Debug initial subs scan. Shows subs detection window and correlation coefficient [CorrTh/Corr], Corr is calculated from whole frames. Only for DynMask > 0.
# Int "mShow" : Shows you selected mask. Overlays "red hole" over clip.
# Shows in "Show = 2" too.
# Dynamic mask (in "Inpaint" mode) should work with 2 and 9.
#
# 0 - Disabled (default).
#
# These, overlay on top of the processed clip:
# 1 - Opaque mask (actual mask for a inpainting job).
# 2 - Opaque PP mask (post-process mask for inpainted area).
# 3 - Base mask.
# 7 - Interp/iTune mask(not for "Inpaint" mode).
# 8 - Edge mask (not for "Inpaint" mode).
#
# These, overlay on top of the original clip:
# 4 - Base mask.
# 5 - Deblend PP mask (post-process mask for deblend area).
# 6 - oTune Mask (not for "Inpaint" mode).
# 9 - Opaque PP mask (post-process mask for inpaint area).
#============================#
# Parameters for Inpaint: #
#============================#
# Int "Turbo" : Inpainting presets. Only for "Inpaint" and "Both" modes (from -2 to 3; default: 0).
# Positive values are for very fast, less "alive", blurry, low quality inpainting.
# Positive values will not try to connect isophotes/inpaint shapes of the surrounding.
# Hard inpainting presets if not "0".
# Positive values activates the hard presets for "oPP".
#
# -2 - Very slow. High quality inpainting. More suitable for UHD - HD resolutions.
# -1 - Slower. High quality inpainting. More suitable for UHD - HD resolutions.
# 0 - Slow. High quality inpainting defaults.
# 1 - Fast. Low quality inpainting.
# 2 - Faster. Low quality inpainting.
# 3 - Fastest. Low quality inpainting. Less suitable for higher than SD resolutions.
# Int "KillShape" : Reduces sponginess of the base/dynamic mask when preserves dimensions of the shape.
# Experimental parameter meant for positive "Turbo", to make inpainted area less "alive".
# Will kill any hole up to 6 pixels in diameter.
# Works only in "Inpaint" mode. (Default: 0)
# 0 - Off.
# 1 - On.
# Int "prePP" : Pre blurs Loc area for inpainting algo. (Default: 0)
# Experimental parameter meant for positive "Turbo" when in "Inpaint" mode.
# 0 - Off.
# 1 - On.
#============================================#
# Parameters of the Inpainting algorithm: #
#============================================#
# Note : Default settings combo below is generally balanced, it's not recommended
# to change any of them if video is not static.
# It's in general a very hard task to find the good parameters combo (combo
# involves some settings above too. So there is endless combinations...).
# Making one scene to look better, will make another one worse.
# What is very good for one frame - very bad temporally on the whole clip.
# These parameters can be adjusted only when Turbo=0.
# Float "Radius" : Radius around a damaged pixel from where values are taken when the pixel
# is inpainted. Bigger values prevent isophotes being inpainted in the wrong
# direction, but also create more blur and increase CPU usage. (default: 8.0)
# Float "PreBlur" : Standard deviation of the blur which is applied to the image before
# the structure tensor is computed. Higher values help connecting isophotes
# which have been cut by the inpainting region, but also increase CPU usage.
# PreBlur=0.0 disables pre-blurring. (default: 6.5)
# Float "PostBlur" : Standard deviation of the blur which is applied to the structure tensors
# before they are used to determine the inpainting direction. Higher values
# help gather more directional information when there are only few valid
# pixels available, but increases CPU usage. (default: 4.0)
# Float "Sharpness" : Describes how faithful the algorithm follows directional information
# contained in the structure tensor. Higher values can prevent blurring
# caused by high Radius values.
# (Default: 45.0)
#===========================================#
# Parameters for the ebmp masks editing: #
#===========================================#
# Notes : For the expert users only [Skip this section if you don't fully understand how deblending/AVSInpaint works].
# Only for the positive Analyze deblending masks. Use "Show=2" to see what you are doing.
# All YUV [YV12] channels are deblended separetely, so there are 3 alpha masks, 3 logo images and 1 basemask stored in ebmp.
# All masks are in Y8 ["Color" refers to "Colored logo image" from AVSInpaint's docs].
# Val YAlphaExternal : Custom Y Alpha clip.
# Int UVAlphaFromY : Make U & V alphas from Y alpha.
# Int "YAlphaTweak", "UAlphaTweak", "VAlphaTweak" : Tweaks an alpha mask (from -10 to 10; default: 0 [Off]).
# Int "YAlphaSolidOuts", "UAlphaSolidOuts", "VAlphaSolidOuts" : Paints an alpha mask outside logo (from -1 to 255; default: -1 [Off]).
# Int "YAlphaSolidIns", "UAlphaSolidIns", "VAlphaSolidIns" : Paints an alpha mask inside logo (from -1 to 255; default: -1 [Off]).
# Int "YColorSolid", "UColorSolid", "VColorSolid" : Paints whole logo image (from -1 to 255; default: -1 [Off]).
# Int "YColorSolidOuts", "UColorSolidOuts", "VColorSolidOuts" : Paints a logo image outside logo (from -1 to 255; default: -1 [Off]).
# Int "YColorSolidIns", "UColorSolidIns", "VColorSolidIns" : Paints a logo image inside logo (from -1 to 255; default: -1 [Off]).
# Int "YOffsetIns" : Offset for Y "...SolidIns" parameters (from -4 to 0; default: -1).
# Int "YOffsetOuts" : Offset for Y "...SolidOuts" parameters (from 0 to 4; default: 1).
# Int "UVOffsetIns" : Offset for UV "...SolidIns" parameters (from -4 to 0; default: -2).
# Int "UVOffsetOuts" : Offset for UV "...SolidOuts" parameters (from 0 to 4; default: 2).
# Int "ShiftMasksVe" : Shifts masks by one pixel vertically, positive value moves logo up (from -1 to 1; default: 0 [Off]) [chroma shifts by sub-pixel].
# Int "ShiftMasksHo" : Shifts masks by one pixel horizontally, positive value moves logo left (from -1 to 1; default: 0 [Off]) [chroma shifts by sub-pixel].
# Int "WholeDeblend" : If enabled then deblend affects whole frame, it won't be isolated to logo (from 0 to 1; default: 0 [Off]).
# Int "TriggerDynamic" : Triggers dynamic deblending code in AVSInpaint on a static mask (from 0 to 1; default: 0 [Off]).
# Int "DumpMasks" : Meant to dump tweaked masks to ebmp file, "2" dumps with hard presets for ..SolidOuts. (from 0 to 2; default: 0 [Off]).
##================================================================================================##
# SubsMask2Img() manual: #
##================================================================================================##
# NOTES : Use "Show=4" and "DynMask" in InpaintDelogo() to get a mask of subtitles.
# Mask clip is expected to be full range Y8 or it will be converted [but there is no conversion to full range].
# Int "Extract" : This is only InpaintDelogo() parameter!!!
# Works only with "DynMask" through "Show=4".
# It will pass SubsMask2Img() parameters from InpaintDelogo() to SubsMask2Img() to extract subtitle images from a dynamic mask.
#
# Positive: Twice slower than negative mode. Extracts without using the intermediate file.
#
# Negative: Fast extraction. Extracts using the intermediate file.
# File is named "_InpaintDelogo_Intermediate_DynMask.avi", it will be overwritten on every run except when "ReExtract=1".
# Setup guide [do it once then you don't need to use "FourCC"]:
# Install TWriteAVI plugin and x264vfw codec, then you need to configure x264vfw:
# On your first extraction set "FourCC" to "" then you will see pop-up with menu:
# Select "Compressor: x264vfw" -> Press "Configure":
# In x264vfw configuration select:
# "Rate control: Lossless"
# "Debug: Log level: None"