Skip to content

Commit 09d5eda

Browse files
committed
Support _Combed=True by VIVTC VFM in PD2V deinterlace
If _Combed=True, it assumes the frame is TFF and proceeds to deinterlace. Without this change all the deinterlace function would do to the frame would be slap `Progressive <!>` on it (if verbose) and return the frame untouched (still combed).
1 parent 110b4a3 commit 09d5eda

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

pvsfunc/pd2v.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,23 @@ def deinterlace(self, kernel: functools.partial, verbose=False):
101101
)
102102

103103
def _d(n: int, f: vs.VideoFrame, c: vs.VideoNode, tff: vs.VideoNode, bff: vs.VideoNode, ff: int):
104-
# frame marked as progressive in flags by D2V, skip deinterlacing
104+
# frame marked as progressive, skip deinterlacing
105105
if f.props["PVSFlagProgressiveFrame"] or f.props.get("_Combed") == 0:
106106
rc = core.std.Interleave([c] * ff) if ff > 1 else c # duplicate if not a single-rate fps output
107107
if rc.format and tff.format and rc.format.id != tff.format.id:
108108
rc = core.resize.Point(rc, format=tff.format.id)
109109
return core.text.Text(rc, "Progressive", alignment=3) if verbose else rc
110110
# interlaced frame, deinterlace (if _FieldBased is > 0)
111-
rc = {0: c, 1: bff, 2: tff}[f.props["_FieldBased"]] # type: ignore
112-
field_order = {0: "Progressive <!>", 1: "BFF", 2: "TFF"}[f.props["_FieldBased"]] # type: ignore
113-
return core.text.Text(rc, "Deinterlaced (%s)" % field_order, alignment=3) if verbose else rc
111+
order = f.props["_FieldBased"]
112+
if f.props["_Combed"] != 0:
113+
order = 2 # TODO: Don't assume TFF
114+
rc = {0: c, 1: bff, 2: tff}[order] # type: ignore
115+
field_order = {0: "Progressive <!>", 1: "BFF", 2: "TFF"}[order] # type: ignore
116+
return core.text.Text(
117+
rc,
118+
"Deinterlaced (%s)" % field_order,
119+
alignment=3
120+
) if verbose else rc
114121

115122
self.clip = core.std.FrameEval(
116123
deinterlaced_tff,

0 commit comments

Comments
 (0)