Skip to content

Commit 47fd929

Browse files
committed
PSourcer: Skip every 2nd cycle flag after getting list
This fixes the problem where the list may have only 2 items (so not <= 1) e.g. [8, 44]. It enters the else branch and skips every 2nd item. The list is now [8] which is not enough data for the following calls, which is what the <= 1 tried to protect against.
1 parent cddcab2 commit 47fd929

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pvsfunc/psourcer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def __init__(self, file_path, d2v_vst_vfr_mode: (Union[int, bool], Optional[List
145145
# this math seems pretty far fetched, if we can somehow obtain the Pulldown x:x:...
146146
# string that mediainfo can get, then calculating it can be much easier and more efficient.
147147
pulldown_cycle = [n for n, f in enumerate(flags) if f["rff"]]
148+
pulldown_cycle = pulldown_cycle[::2] # skip every 2nd item: once per field
148149
if len(pulldown_cycle) <= 1:
149150
# no pulldown, or one strangler rff flag in the flags, only one rff index is useless
150151
pulldown_cycle = 0 # so just use 0 and assume its a mistake/mastering error
@@ -156,7 +157,6 @@ def __init__(self, file_path, d2v_vst_vfr_mode: (Union[int, bool], Optional[List
156157
# todo; that can be avoided by doing this check sectioned to each interlaced section and ignore the
157158
# last subtraction. This would allow for Variable Pull Down computation, but from there a common
158159
# check would still be necessary unless all of them from all sections match (which is likely).
159-
pulldown_cycle = pulldown_cycle[::2] # skip every 2nd item: once per field
160160
pulldown_cycle = list(zip(pulldown_cycle[::2], pulldown_cycle[1::2]))
161161
pulldown_cycle = [right - left for left, right in pulldown_cycle]
162162
pulldown_cycle = max(set(pulldown_cycle), key=pulldown_cycle.count) + 1 # +1 to one-index it

0 commit comments

Comments
 (0)