Skip to content

eedi2

EEDI2 dataclass

EEDI2(
    mthresh: int = 10,
    lthresh: int = 20,
    vthresh: int = 20,
    estr: int = 2,
    dstr: int = 4,
    maxd: int = 24,
    pp: int = 1,
    *,
    field: int = 0,
    drop_fields: bool = True,
    transpose_first: bool = False,
    shifter: KernelT | None = None,
    scaler: ScalerT | None = None,
    cuda: bool = False
)

Bases: _FullInterpolate, _Antialiaser

cuda class-attribute instance-attribute

cuda: bool = field(default=False, kw_only=True)

drop_fields class-attribute instance-attribute

drop_fields: bool = field(default=True, kw_only=True)

dstr class-attribute instance-attribute

dstr: int = 4

estr class-attribute instance-attribute

estr: int = 2

field class-attribute instance-attribute

field: int = field(default=0, kw_only=True)

lthresh class-attribute instance-attribute

lthresh: int = 20

maxd class-attribute instance-attribute

maxd: int = 24

mthresh class-attribute instance-attribute

mthresh: int = 10

pp class-attribute instance-attribute

pp: int = 1

scaler class-attribute instance-attribute

scaler: ScalerT | None = field(default=None, kw_only=True)

shifter class-attribute instance-attribute

shifter: KernelT | None = field(default=None, kw_only=True)

transpose_first class-attribute instance-attribute

transpose_first: bool = field(default=False, kw_only=True)

vthresh class-attribute instance-attribute

vthresh: int = 20

copy

copy(**kwargs: Any) -> T
Source code
71
72
73
@inject_self
def copy(self: T, **kwargs: Any) -> T:
    return replace(self, **kwargs)

full_interpolate

full_interpolate(
    clip: VideoNode, double_y: bool, double_x: bool, **kwargs: Any
) -> VideoNode
Source code
60
61
def full_interpolate(self, clip: vs.VideoNode, double_y: bool, double_x: bool, **kwargs: Any) -> vs.VideoNode:
    return core.eedi2cuda.Enlarge2(clip, **kwargs)  # type: ignore

get_aa_args

get_aa_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
31
32
33
34
35
def get_aa_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return dict(
        mthresh=self.mthresh, lthresh=self.lthresh, vthresh=self.vthresh,
        estr=self.estr, dstr=self.dstr, maxd=self.maxd, pp=self.pp
    )

interpolate

interpolate(clip: VideoNode, double_y: bool, **kwargs: Any) -> VideoNode
Source code
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def interpolate(self, clip: vs.VideoNode, double_y: bool, **kwargs: Any) -> vs.VideoNode:
    inter: vs.VideoNode

    if self.cuda:
        inter = core.eedi2cuda.EEDI2(clip, self.field, **kwargs)  # type: ignore
    else:
        inter = core.eedi2.EEDI2(clip, self.field, **kwargs)  # type: ignore

    if not double_y:
        if self.drop_fields:
            inter = inter.std.SeparateFields(not self.field)[::2]

            inter = self._shifter.shift(inter, (0.5 - 0.75 * self.field, 0))
        else:
            shift = (self._shift * int(not self.field), 0)

            if self._scaler:
                inter = self._scaler.scale(inter, clip.width, clip.height, shift)
            else:
                inter = self._shifter.scale(inter, clip.width, clip.height, shift)

    return self._post_interpolate(clip, inter, double_y, **kwargs)

is_full_interpolate_enabled

is_full_interpolate_enabled(x: bool, y: bool) -> bool
Source code
28
29
def is_full_interpolate_enabled(self, x: bool, y: bool) -> bool:
    return self.cuda and x and y

preprocess_clip

preprocess_clip(clip: VideoNode) -> VideoNode
Source code
53
54
def preprocess_clip(self, clip: vs.VideoNode) -> vs.VideoNode:
    return clip

shift_interpolate

shift_interpolate(
    clip: VideoNode, inter: VideoNode, double_y: bool, **kwargs: Any
) -> VideoNode
Source code
59
60
61
62
63
64
65
66
67
68
69
def shift_interpolate(
    self, clip: vs.VideoNode, inter: vs.VideoNode, double_y: bool, **kwargs: Any
) -> vs.VideoNode:
    if not double_y and not self.drop_fields:
        shift = (self._shift * int(not self.field), 0)

        inter = (self._scaler if self._scaler else self._shifter).scale(inter, clip.width, clip.height, shift)

        return self._post_interpolate(clip, inter, double_y, **kwargs)

    return inter

Eedi2 dataclass

Eedi2(
    mthresh: int = 10,
    lthresh: int = 20,
    vthresh: int = 20,
    estr: int = 2,
    dstr: int = 4,
    maxd: int = 24,
    pp: int = 1,
    *,
    field: int = 0,
    drop_fields: bool = True,
    transpose_first: bool = False,
    shifter: KernelT | None = None,
    scaler: ScalerT | None = None,
    cuda: bool = False
)

Bases: EEDI2, Antialiaser

cuda class-attribute instance-attribute

cuda: bool = field(default=False, kw_only=True)

drop_fields class-attribute instance-attribute

drop_fields: bool = field(default=True, kw_only=True)

dstr class-attribute instance-attribute

dstr: int = 4

estr class-attribute instance-attribute

estr: int = 2

field class-attribute instance-attribute

field: int = field(default=0, kw_only=True)

lthresh class-attribute instance-attribute

lthresh: int = 20

maxd class-attribute instance-attribute

maxd: int = 24

merge_func class-attribute instance-attribute

merge_func: Callable[[VideoNode, VideoNode], VideoNode] = Merge

mthresh class-attribute instance-attribute

mthresh: int = 10

pp class-attribute instance-attribute

pp: int = 1

scaler class-attribute instance-attribute

scaler: ScalerT | None = field(default=None, kw_only=True)

shifter class-attribute instance-attribute

shifter: KernelT | None = field(default=None, kw_only=True)

transpose_first class-attribute instance-attribute

transpose_first: bool = field(default=False, kw_only=True)

vthresh class-attribute instance-attribute

vthresh: int = 20

aa

aa(clip: VideoNode, dir: AADirection = BOTH, /, **kwargs: Any) -> VideoNode
aa(
    clip: VideoNode, y: bool = True, x: bool = True, /, **kwargs: Any
) -> VideoNode
aa(
    clip: VideoNode,
    y_or_dir: bool | AADirection = True,
    x: bool = True,
    /,
    **kwargs: Any,
) -> VideoNode

Single rate aa with this antialiaser

Source code
275
276
277
278
279
280
281
282
283
284
285
286
287
288
@inject_self.init_kwargs.clean
def aa(
    self, clip: vs.VideoNode, y_or_dir: bool | AADirection = True, x: bool = True, /, **kwargs: Any
) -> vs.VideoNode:
    """Single rate aa with this antialiaser"""

    if isinstance(y_or_dir, AADirection):
        y, x = y_or_dir.to_yx()
    else:
        y = y_or_dir

    clip = self.preprocess_clip(clip)

    return SingleRater._aa(self, clip, y, x, **kwargs)

copy

copy(**kwargs: Any) -> T
Source code
71
72
73
@inject_self
def copy(self: T, **kwargs: Any) -> T:
    return replace(self, **kwargs)

draa

draa(clip: VideoNode, dir: AADirection = BOTH, /, **kwargs: Any) -> VideoNode
draa(
    clip: VideoNode, y: bool = True, x: bool = True, /, **kwargs: Any
) -> VideoNode
draa(
    clip: VideoNode,
    y_or_dir: bool | AADirection = True,
    x: bool = True,
    /,
    **kwargs: Any,
) -> VideoNode

Double rate aa with this antialiaser

Source code
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
@inject_self.init_kwargs.clean
def draa(
    self, clip: vs.VideoNode, y_or_dir: bool | AADirection = True, x: bool = True, /, **kwargs: Any
) -> vs.VideoNode:
    """Double rate aa with this antialiaser"""

    if isinstance(y_or_dir, AADirection):
        y, x = y_or_dir.to_yx()
    else:
        y = y_or_dir

    clip = self.preprocess_clip(clip)

    kwargs.pop('field', None)

    return DoubleRater._aa(self, clip, y, x, **kwargs)

full_interpolate

full_interpolate(
    clip: VideoNode, double_y: bool, double_x: bool, **kwargs: Any
) -> VideoNode
Source code
60
61
def full_interpolate(self, clip: vs.VideoNode, double_y: bool, double_x: bool, **kwargs: Any) -> vs.VideoNode:
    return core.eedi2cuda.Enlarge2(clip, **kwargs)  # type: ignore

get_aa_args

get_aa_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
31
32
33
34
35
def get_aa_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return dict(
        mthresh=self.mthresh, lthresh=self.lthresh, vthresh=self.vthresh,
        estr=self.estr, dstr=self.dstr, maxd=self.maxd, pp=self.pp
    )

get_sr_args

get_sr_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
177
178
def get_sr_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return {}

get_ss_args

get_ss_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
85
86
def get_ss_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return {}

interpolate

interpolate(clip: VideoNode, double_y: bool, **kwargs: Any) -> VideoNode
Source code
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def interpolate(self, clip: vs.VideoNode, double_y: bool, **kwargs: Any) -> vs.VideoNode:
    inter: vs.VideoNode

    if self.cuda:
        inter = core.eedi2cuda.EEDI2(clip, self.field, **kwargs)  # type: ignore
    else:
        inter = core.eedi2.EEDI2(clip, self.field, **kwargs)  # type: ignore

    if not double_y:
        if self.drop_fields:
            inter = inter.std.SeparateFields(not self.field)[::2]

            inter = self._shifter.shift(inter, (0.5 - 0.75 * self.field, 0))
        else:
            shift = (self._shift * int(not self.field), 0)

            if self._scaler:
                inter = self._scaler.scale(inter, clip.width, clip.height, shift)
            else:
                inter = self._shifter.scale(inter, clip.width, clip.height, shift)

    return self._post_interpolate(clip, inter, double_y, **kwargs)

is_full_interpolate_enabled

is_full_interpolate_enabled(x: bool, y: bool) -> bool
Source code
28
29
def is_full_interpolate_enabled(self, x: bool, y: bool) -> bool:
    return self.cuda and x and y

preprocess_clip

preprocess_clip(clip: VideoNode) -> VideoNode
Source code
53
54
def preprocess_clip(self, clip: vs.VideoNode) -> vs.VideoNode:
    return clip

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[float, float] = (0, 0),
    **kwargs: Any
) -> VideoNode

Scale with this antialiaser

Source code
255
256
257
258
259
260
261
262
@inject_self
def scale(  # type: ignore[override]
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[float, float] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    """Scale with this antialiaser"""
    width, height = Scaler._wh_norm(clip, width, height)
    return SuperSampler.scale(self, clip, width, height, shift, **kwargs)

shift_interpolate

shift_interpolate(
    clip: VideoNode, inter: VideoNode, double_y: bool, **kwargs: Any
) -> VideoNode
Source code
59
60
61
62
63
64
65
66
67
68
69
def shift_interpolate(
    self, clip: vs.VideoNode, inter: vs.VideoNode, double_y: bool, **kwargs: Any
) -> vs.VideoNode:
    if not double_y and not self.drop_fields:
        shift = (self._shift * int(not self.field), 0)

        inter = (self._scaler if self._scaler else self._shifter).scale(inter, clip.width, clip.height, shift)

        return self._post_interpolate(clip, inter, double_y, **kwargs)

    return inter

Eedi2DR dataclass

Eedi2DR(
    mthresh: int = 10,
    lthresh: int = 20,
    vthresh: int = 20,
    estr: int = 2,
    dstr: int = 4,
    maxd: int = 24,
    pp: int = 1,
    *,
    field: int = 0,
    drop_fields: bool = True,
    transpose_first: bool = False,
    shifter: KernelT | None = None,
    scaler: ScalerT | None = None,
    cuda: bool = False
)

Bases: EEDI2, DoubleRater

cuda class-attribute instance-attribute

cuda: bool = field(default=False, kw_only=True)

drop_fields class-attribute instance-attribute

drop_fields: bool = field(default=True, kw_only=True)

dstr class-attribute instance-attribute

dstr: int = 4

estr class-attribute instance-attribute

estr: int = 2

field class-attribute instance-attribute

field: int = field(default=0, kw_only=True)

lthresh class-attribute instance-attribute

lthresh: int = 20

maxd class-attribute instance-attribute

maxd: int = 24

merge_func class-attribute instance-attribute

merge_func: Callable[[VideoNode, VideoNode], VideoNode] = Merge

mthresh class-attribute instance-attribute

mthresh: int = 10

pp class-attribute instance-attribute

pp: int = 1

scaler class-attribute instance-attribute

scaler: ScalerT | None = field(default=None, kw_only=True)

shifter class-attribute instance-attribute

shifter: KernelT | None = field(default=None, kw_only=True)

transpose_first class-attribute instance-attribute

transpose_first: bool = field(default=False, kw_only=True)

vthresh class-attribute instance-attribute

vthresh: int = 20

aa

aa(clip: VideoNode, dir: AADirection = BOTH, /, **kwargs: Any) -> VideoNode
aa(
    clip: VideoNode, y: bool = True, x: bool = True, /, **kwargs: Any
) -> VideoNode
aa(
    clip: VideoNode,
    y_or_dir: bool | AADirection = True,
    x: bool = True,
    /,
    **kwargs: Any,
) -> VideoNode
Source code
190
191
192
193
194
195
196
197
198
199
200
201
@inject_self.init_kwargs.clean
def aa(
    self, clip: vs.VideoNode, y_or_dir: bool | AADirection = True, x: bool = True, /, **kwargs: Any
) -> vs.VideoNode:
    if isinstance(y_or_dir, AADirection):
        y, x = y_or_dir.to_yx()
    else:
        y = y_or_dir

    clip = self.preprocess_clip(clip)

    return self._aa(clip, y, x, **kwargs)

copy

copy(**kwargs: Any) -> T
Source code
71
72
73
@inject_self
def copy(self: T, **kwargs: Any) -> T:
    return replace(self, **kwargs)

full_interpolate

full_interpolate(
    clip: VideoNode, double_y: bool, double_x: bool, **kwargs: Any
) -> VideoNode
Source code
60
61
def full_interpolate(self, clip: vs.VideoNode, double_y: bool, double_x: bool, **kwargs: Any) -> vs.VideoNode:
    return core.eedi2cuda.Enlarge2(clip, **kwargs)  # type: ignore

get_aa_args

get_aa_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
31
32
33
34
35
def get_aa_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return dict(
        mthresh=self.mthresh, lthresh=self.lthresh, vthresh=self.vthresh,
        estr=self.estr, dstr=self.dstr, maxd=self.maxd, pp=self.pp
    )

get_sr_args

get_sr_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
177
178
def get_sr_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return {}

interpolate

interpolate(clip: VideoNode, double_y: bool, **kwargs: Any) -> VideoNode
Source code
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def interpolate(self, clip: vs.VideoNode, double_y: bool, **kwargs: Any) -> vs.VideoNode:
    inter: vs.VideoNode

    if self.cuda:
        inter = core.eedi2cuda.EEDI2(clip, self.field, **kwargs)  # type: ignore
    else:
        inter = core.eedi2.EEDI2(clip, self.field, **kwargs)  # type: ignore

    if not double_y:
        if self.drop_fields:
            inter = inter.std.SeparateFields(not self.field)[::2]

            inter = self._shifter.shift(inter, (0.5 - 0.75 * self.field, 0))
        else:
            shift = (self._shift * int(not self.field), 0)

            if self._scaler:
                inter = self._scaler.scale(inter, clip.width, clip.height, shift)
            else:
                inter = self._shifter.scale(inter, clip.width, clip.height, shift)

    return self._post_interpolate(clip, inter, double_y, **kwargs)

is_full_interpolate_enabled

is_full_interpolate_enabled(x: bool, y: bool) -> bool
Source code
28
29
def is_full_interpolate_enabled(self, x: bool, y: bool) -> bool:
    return self.cuda and x and y

preprocess_clip

preprocess_clip(clip: VideoNode) -> VideoNode
Source code
53
54
def preprocess_clip(self, clip: vs.VideoNode) -> vs.VideoNode:
    return clip

shift_interpolate

shift_interpolate(
    clip: VideoNode, inter: VideoNode, double_y: bool, **kwargs: Any
) -> VideoNode
Source code
59
60
61
62
63
64
65
66
67
68
69
def shift_interpolate(
    self, clip: vs.VideoNode, inter: vs.VideoNode, double_y: bool, **kwargs: Any
) -> vs.VideoNode:
    if not double_y and not self.drop_fields:
        shift = (self._shift * int(not self.field), 0)

        inter = (self._scaler if self._scaler else self._shifter).scale(inter, clip.width, clip.height, shift)

        return self._post_interpolate(clip, inter, double_y, **kwargs)

    return inter

Eedi2SR dataclass

Eedi2SR(
    mthresh: int = 10,
    lthresh: int = 20,
    vthresh: int = 20,
    estr: int = 2,
    dstr: int = 4,
    maxd: int = 24,
    pp: int = 1,
    *,
    field: int = 0,
    drop_fields: bool = True,
    transpose_first: bool = False,
    shifter: KernelT | None = None,
    scaler: ScalerT | None = None,
    cuda: bool = False
)

Bases: EEDI2, SingleRater

cuda class-attribute instance-attribute

cuda: bool = field(default=False, kw_only=True)

drop_fields class-attribute instance-attribute

drop_fields: bool = field(default=True, kw_only=True)

dstr class-attribute instance-attribute

dstr: int = 4

estr class-attribute instance-attribute

estr: int = 2

field class-attribute instance-attribute

field: int = field(default=0, kw_only=True)

lthresh class-attribute instance-attribute

lthresh: int = 20

maxd class-attribute instance-attribute

maxd: int = 24

mthresh class-attribute instance-attribute

mthresh: int = 10

pp class-attribute instance-attribute

pp: int = 1

scaler class-attribute instance-attribute

scaler: ScalerT | None = field(default=None, kw_only=True)

shifter class-attribute instance-attribute

shifter: KernelT | None = field(default=None, kw_only=True)

transpose_first class-attribute instance-attribute

transpose_first: bool = field(default=False, kw_only=True)

vthresh class-attribute instance-attribute

vthresh: int = 20

aa

aa(clip: VideoNode, dir: AADirection = BOTH, /, **kwargs: Any) -> VideoNode
aa(
    clip: VideoNode, y: bool = True, x: bool = True, /, **kwargs: Any
) -> VideoNode
aa(
    clip: VideoNode,
    y_or_dir: bool | AADirection = True,
    x: bool = True,
    /,
    **kwargs: Any,
) -> VideoNode
Source code
190
191
192
193
194
195
196
197
198
199
200
201
@inject_self.init_kwargs.clean
def aa(
    self, clip: vs.VideoNode, y_or_dir: bool | AADirection = True, x: bool = True, /, **kwargs: Any
) -> vs.VideoNode:
    if isinstance(y_or_dir, AADirection):
        y, x = y_or_dir.to_yx()
    else:
        y = y_or_dir

    clip = self.preprocess_clip(clip)

    return self._aa(clip, y, x, **kwargs)

copy

copy(**kwargs: Any) -> T
Source code
71
72
73
@inject_self
def copy(self: T, **kwargs: Any) -> T:
    return replace(self, **kwargs)

full_interpolate

full_interpolate(
    clip: VideoNode, double_y: bool, double_x: bool, **kwargs: Any
) -> VideoNode
Source code
60
61
def full_interpolate(self, clip: vs.VideoNode, double_y: bool, double_x: bool, **kwargs: Any) -> vs.VideoNode:
    return core.eedi2cuda.Enlarge2(clip, **kwargs)  # type: ignore

get_aa_args

get_aa_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
31
32
33
34
35
def get_aa_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return dict(
        mthresh=self.mthresh, lthresh=self.lthresh, vthresh=self.vthresh,
        estr=self.estr, dstr=self.dstr, maxd=self.maxd, pp=self.pp
    )

get_sr_args

get_sr_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
177
178
def get_sr_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return {}

interpolate

interpolate(clip: VideoNode, double_y: bool, **kwargs: Any) -> VideoNode
Source code
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def interpolate(self, clip: vs.VideoNode, double_y: bool, **kwargs: Any) -> vs.VideoNode:
    inter: vs.VideoNode

    if self.cuda:
        inter = core.eedi2cuda.EEDI2(clip, self.field, **kwargs)  # type: ignore
    else:
        inter = core.eedi2.EEDI2(clip, self.field, **kwargs)  # type: ignore

    if not double_y:
        if self.drop_fields:
            inter = inter.std.SeparateFields(not self.field)[::2]

            inter = self._shifter.shift(inter, (0.5 - 0.75 * self.field, 0))
        else:
            shift = (self._shift * int(not self.field), 0)

            if self._scaler:
                inter = self._scaler.scale(inter, clip.width, clip.height, shift)
            else:
                inter = self._shifter.scale(inter, clip.width, clip.height, shift)

    return self._post_interpolate(clip, inter, double_y, **kwargs)

is_full_interpolate_enabled

is_full_interpolate_enabled(x: bool, y: bool) -> bool
Source code
28
29
def is_full_interpolate_enabled(self, x: bool, y: bool) -> bool:
    return self.cuda and x and y

preprocess_clip

preprocess_clip(clip: VideoNode) -> VideoNode
Source code
53
54
def preprocess_clip(self, clip: vs.VideoNode) -> vs.VideoNode:
    return clip

shift_interpolate

shift_interpolate(
    clip: VideoNode, inter: VideoNode, double_y: bool, **kwargs: Any
) -> VideoNode
Source code
59
60
61
62
63
64
65
66
67
68
69
def shift_interpolate(
    self, clip: vs.VideoNode, inter: vs.VideoNode, double_y: bool, **kwargs: Any
) -> vs.VideoNode:
    if not double_y and not self.drop_fields:
        shift = (self._shift * int(not self.field), 0)

        inter = (self._scaler if self._scaler else self._shifter).scale(inter, clip.width, clip.height, shift)

        return self._post_interpolate(clip, inter, double_y, **kwargs)

    return inter

Eedi2SS dataclass

Eedi2SS(
    mthresh: int = 10,
    lthresh: int = 20,
    vthresh: int = 20,
    estr: int = 2,
    dstr: int = 4,
    maxd: int = 24,
    pp: int = 1,
    *,
    field: int = 0,
    drop_fields: bool = True,
    transpose_first: bool = False,
    shifter: KernelT | None = None,
    scaler: ScalerT | None = None,
    cuda: bool = False
)

Bases: EEDI2, SuperSampler

cuda class-attribute instance-attribute

cuda: bool = field(default=False, kw_only=True)

drop_fields class-attribute instance-attribute

drop_fields: bool = field(default=True, kw_only=True)

dstr class-attribute instance-attribute

dstr: int = 4

estr class-attribute instance-attribute

estr: int = 2

field class-attribute instance-attribute

field: int = field(default=0, kw_only=True)

lthresh class-attribute instance-attribute

lthresh: int = 20

maxd class-attribute instance-attribute

maxd: int = 24

mthresh class-attribute instance-attribute

mthresh: int = 10

pp class-attribute instance-attribute

pp: int = 1

scaler class-attribute instance-attribute

scaler: ScalerT | None = field(default=None, kw_only=True)

shifter class-attribute instance-attribute

shifter: KernelT | None = field(default=None, kw_only=True)

transpose_first class-attribute instance-attribute

transpose_first: bool = field(default=False, kw_only=True)

vthresh class-attribute instance-attribute

vthresh: int = 20

copy

copy(**kwargs: Any) -> T
Source code
71
72
73
@inject_self
def copy(self: T, **kwargs: Any) -> T:
    return replace(self, **kwargs)

full_interpolate

full_interpolate(
    clip: VideoNode, double_y: bool, double_x: bool, **kwargs: Any
) -> VideoNode
Source code
60
61
def full_interpolate(self, clip: vs.VideoNode, double_y: bool, double_x: bool, **kwargs: Any) -> vs.VideoNode:
    return core.eedi2cuda.Enlarge2(clip, **kwargs)  # type: ignore

get_aa_args

get_aa_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
31
32
33
34
35
def get_aa_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return dict(
        mthresh=self.mthresh, lthresh=self.lthresh, vthresh=self.vthresh,
        estr=self.estr, dstr=self.dstr, maxd=self.maxd, pp=self.pp
    )

get_ss_args

get_ss_args(clip: VideoNode, **kwargs: Any) -> dict[str, Any]
Source code
85
86
def get_ss_args(self, clip: vs.VideoNode, **kwargs: Any) -> dict[str, Any]:
    return {}

interpolate

interpolate(clip: VideoNode, double_y: bool, **kwargs: Any) -> VideoNode
Source code
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def interpolate(self, clip: vs.VideoNode, double_y: bool, **kwargs: Any) -> vs.VideoNode:
    inter: vs.VideoNode

    if self.cuda:
        inter = core.eedi2cuda.EEDI2(clip, self.field, **kwargs)  # type: ignore
    else:
        inter = core.eedi2.EEDI2(clip, self.field, **kwargs)  # type: ignore

    if not double_y:
        if self.drop_fields:
            inter = inter.std.SeparateFields(not self.field)[::2]

            inter = self._shifter.shift(inter, (0.5 - 0.75 * self.field, 0))
        else:
            shift = (self._shift * int(not self.field), 0)

            if self._scaler:
                inter = self._scaler.scale(inter, clip.width, clip.height, shift)
            else:
                inter = self._shifter.scale(inter, clip.width, clip.height, shift)

    return self._post_interpolate(clip, inter, double_y, **kwargs)

is_full_interpolate_enabled

is_full_interpolate_enabled(x: bool, y: bool) -> bool
Source code
28
29
def is_full_interpolate_enabled(self, x: bool, y: bool) -> bool:
    return self.cuda and x and y

preprocess_clip

preprocess_clip(clip: VideoNode) -> VideoNode
Source code
53
54
def preprocess_clip(self, clip: vs.VideoNode) -> vs.VideoNode:
    return clip

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[float, float] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
 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
@inject_self
def scale(  # type: ignore[override]
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[float, float] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    if FieldBased.from_video(clip).is_inter:
        raise UnsupportedFieldBasedError('Only progressive video is supported!', self.scale)

    clip = self.preprocess_clip(clip)
    width, height = Scaler._wh_norm(clip, width, height)

    assert clip.format and clip.width and clip.height

    if (clip.width, clip.height) == (width, height):
        return clip

    kwargs = self.get_aa_args(clip, **kwargs) | self.get_ss_args(clip, **kwargs) | kwargs

    divw, divh = (ceil(size) for size in (width / clip.width, height / clip.height))

    mult_x, mult_y = (int(log2(divs)) for divs in (divw, divh))

    cdivw, cdivh = 1 << clip.format.subsampling_w, 1 << clip.format.subsampling_h

    upscaled = clip

    def _transpose(before: bool, is_width: int, y: int, x: int) -> None:
        nonlocal upscaled

        before = self.transpose_first if before else not self.transpose_first

        if ((before or not y) if is_width else (before and x)):
            upscaled = upscaled.std.Transpose()

    for (y, x) in zip_longest([True] * mult_y, [True] * mult_x, fillvalue=False):
        if isinstance(self, _FullInterpolate) and self.is_full_interpolate_enabled(x, y):
            upscaled = self.full_interpolate(upscaled, y, x, **kwargs)
        else:
            for isx, val in enumerate([y, x]):
                if val:
                    _transpose(True, isx, y, x)

                    upscaled = self.interpolate(upscaled, True, **kwargs)

                    _transpose(False, isx, y, x)

        topshift = leftshift = cleftshift = ctopshift = 0.0

        if y and self._shift:
            topshift = ctopshift = self._shift

            if cdivw == 2 and cdivh == 2:
                ctopshift -= 0.125
            elif cdivw == 1 and cdivh == 2:
                ctopshift += 0.125

        cresshift = 0.0

        if x and self._shift:
            leftshift = cleftshift = self._shift

            if cdivw in {4, 2} and cdivh in {4, 2, 1}:
                cleftshift = self._shift + 0.5

                if cdivw == 4 and cdivh == 1:
                    cresshift = 0.125 * 1
                elif cdivw == 2 and cdivh == 2:
                    cresshift = 0.125 * 2
                elif cdivw == 2 and cdivh == 1:
                    cresshift = 0.125 * 3

                cleftshift -= cresshift

        if isinstance(self._shifter, NoShift):
            if upscaled.format.subsampling_h or upscaled.format.subsampling_w:
                upscaled = Catrom.shift(upscaled, 0, [0, cleftshift + cresshift])  # type: ignore
        else:
            upscaled = self._shifter.shift(
                upscaled, [topshift, ctopshift], [leftshift, cleftshift]
            )

    if self._scaler:
        return self._scaler.scale(upscaled, width, height, shift)

    return self._shifter.scale(upscaled, width, height, shift)

shift_interpolate

shift_interpolate(
    clip: VideoNode, inter: VideoNode, double_y: bool, **kwargs: Any
) -> VideoNode
Source code
59
60
61
62
63
64
65
66
67
68
69
def shift_interpolate(
    self, clip: vs.VideoNode, inter: vs.VideoNode, double_y: bool, **kwargs: Any
) -> vs.VideoNode:
    if not double_y and not self.drop_fields:
        shift = (self._shift * int(not self.field), 0)

        inter = (self._scaler if self._scaler else self._shifter).scale(inter, clip.width, clip.height, shift)

        return self._post_interpolate(clip, inter, double_y, **kwargs)

    return inter