vsview-nativeres 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/PKG-INFO +2 -2
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/pyproject.toml +1 -1
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/src/vsview_nativeres/main.py +36 -9
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/src/vsview_nativeres/settings.py +1 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/.gitignore +0 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/LICENSE +0 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/README.md +0 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/src/vsview_nativeres/__init__.py +0 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/src/vsview_nativeres/components.py +0 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/src/vsview_nativeres/plotting.py +0 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/src/vsview_nativeres/py.typed +0 -0
- {vsview_nativeres-0.2.0 → vsview_nativeres-0.3.0}/src/vsview_nativeres/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vsview-nativeres
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A vsview plugin for analyzing and determining the native resolution of video content
|
|
5
5
|
Project-URL: Documentation, https://github.com/Jaded-Encoding-Thaumaturgy/nativeres/blob/master/src/plugin/README.md
|
|
6
6
|
Project-URL: Source Code, https://github.com/Jaded-Encoding-Thaumaturgy/nativeres/tree/master/src/plugin
|
|
@@ -39,7 +39,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
39
39
|
Classifier: Typing :: Typed
|
|
40
40
|
Requires-Python: >=3.12
|
|
41
41
|
Requires-Dist: nativeres
|
|
42
|
-
Requires-Dist: vsview>=0.
|
|
42
|
+
Requires-Dist: vsview>=0.6.2
|
|
43
43
|
Description-Content-Type: text/markdown
|
|
44
44
|
|
|
45
45
|
# vsview-nativeres
|
|
@@ -5,12 +5,13 @@ import json
|
|
|
5
5
|
from concurrent.futures import Future
|
|
6
6
|
from itertools import zip_longest
|
|
7
7
|
from logging import getLogger
|
|
8
|
+
from math import ceil
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
from typing import TYPE_CHECKING, cast
|
|
10
11
|
|
|
11
12
|
import numpy as np
|
|
12
13
|
import vapoursynth as vs
|
|
13
|
-
from jetpytools import fallback
|
|
14
|
+
from jetpytools import fallback, mod2
|
|
14
15
|
from PySide6.QtCore import QSignalBlocker, QTimer, Signal
|
|
15
16
|
from PySide6.QtGui import QPalette, QShowEvent, Qt
|
|
16
17
|
from PySide6.QtWidgets import (
|
|
@@ -95,18 +96,32 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
95
96
|
self.dimension.current_layout.setContentsMargins(0, 0, 0, 0)
|
|
96
97
|
self.dimension.current_layout.setSpacing(0)
|
|
97
98
|
self.dimension.setToolTip("Choose whether to scan candidate source widths or source heights.")
|
|
98
|
-
self.dimension.segmentChanged.connect(self.
|
|
99
|
+
self.dimension.segmentChanged.connect(self.on_dimension_segment_changed)
|
|
99
100
|
self._last_dimension: int | None = None
|
|
100
|
-
|
|
101
101
|
dimension_layout = self.make_vgroup("Dimension", self.dimension, parent=self.controls_section)
|
|
102
102
|
|
|
103
|
+
self.base_parity = SegmentedControl(["Odd", "Even"], self.controls_section)
|
|
104
|
+
self.base_parity.current_layout.setContentsMargins(0, 0, 0, 0)
|
|
105
|
+
self.base_parity.current_layout.setSpacing(0)
|
|
106
|
+
self.base_parity.setToolTip(
|
|
107
|
+
"Switches base dimension parity for fractional descales,\n"
|
|
108
|
+
"introducing a 0.5-pixel subpixel shift to the source offset."
|
|
109
|
+
)
|
|
110
|
+
self.base_parity.segmentChanged.connect(self.on_base_parity_segment_changed)
|
|
111
|
+
self._last_base_parity: int | None = None
|
|
112
|
+
base_parity_layout = self.make_vgroup("Base Parity", self.base_parity, parent=self.controls_section)
|
|
113
|
+
|
|
103
114
|
self.reset_values_btn = QPushButton("Reset Controls", self.controls_section)
|
|
104
115
|
self.reset_values_btn.setToolTip("Restore the default range, step, kernel, and metric for the current clip.")
|
|
105
116
|
self.reset_values_btn.clicked.connect(self._set_default_values)
|
|
106
117
|
|
|
107
|
-
|
|
118
|
+
dimension_base_parity = QVBoxLayout()
|
|
119
|
+
dimension_base_parity.addLayout(dimension_layout)
|
|
120
|
+
dimension_base_parity.addLayout(base_parity_layout)
|
|
121
|
+
dimension_base_parity.addStretch()
|
|
122
|
+
dimension_base_parity.addWidget(self.reset_values_btn)
|
|
108
123
|
|
|
109
|
-
controls.addLayout(
|
|
124
|
+
controls.addLayout(dimension_base_parity, 1)
|
|
110
125
|
|
|
111
126
|
self.range_min_spin = QSpinBox(self.controls_section, suffix=" px", minimum=0, maximum=99999, singleStep=1)
|
|
112
127
|
self.range_max_spin = QSpinBox(self.controls_section, suffix=" px", minimum=0, maximum=99999, singleStep=1)
|
|
@@ -219,7 +234,9 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
219
234
|
|
|
220
235
|
def _set_default_values(self) -> None:
|
|
221
236
|
self.dimension.index = 1
|
|
237
|
+
self.base_parity.index = 1
|
|
222
238
|
self._last_dimension = 1
|
|
239
|
+
self._last_base_parity = 1
|
|
223
240
|
with (
|
|
224
241
|
QSignalBlocker(self.range_min_spin),
|
|
225
242
|
QSignalBlocker(self.range_max_spin),
|
|
@@ -227,8 +244,8 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
227
244
|
QSignalBlocker(self.kernels_cb),
|
|
228
245
|
QSignalBlocker(self.metrics_cb),
|
|
229
246
|
):
|
|
230
|
-
self.range_min_spin.setValue(int(self.api.current_voutput.vs_output.clip.height *
|
|
231
|
-
self.range_max_spin.setValue(int(self.api.current_voutput.vs_output.clip.height *
|
|
247
|
+
self.range_min_spin.setValue(int(self.api.current_voutput.vs_output.clip.height * LOW_RATE))
|
|
248
|
+
self.range_max_spin.setValue(int(self.api.current_voutput.vs_output.clip.height * HIGH_RATE))
|
|
232
249
|
self.step_spin.setValue(fallback(self.settings.local_.getnative.last_step, 1.0))
|
|
233
250
|
for k in self.settings.global_.kernels:
|
|
234
251
|
self.kernels_cb.addItem(k.pretty_string, k)
|
|
@@ -249,6 +266,9 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
249
266
|
if (d := self.settings.local_.getnative.last_dimension) is not None:
|
|
250
267
|
self.dimension.index = d
|
|
251
268
|
|
|
269
|
+
if (d := self.settings.local_.getnative.last_base_parity) is not None:
|
|
270
|
+
self.base_parity.index = d
|
|
271
|
+
|
|
252
272
|
if (range_min := self.settings.local_.getnative.last_min_range) is not None:
|
|
253
273
|
self.range_min_spin.setValue(range_min)
|
|
254
274
|
|
|
@@ -268,6 +288,7 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
268
288
|
|
|
269
289
|
def snapshot_ui_values(self) -> None:
|
|
270
290
|
self.settings.local_.getnative.last_dimension = self.dimension.index
|
|
291
|
+
self.settings.local_.getnative.last_base_parity = self.base_parity.index
|
|
271
292
|
self.settings.local_.getnative.last_max_range = self.range_max_spin.value()
|
|
272
293
|
self.settings.local_.getnative.last_min_range = self.range_min_spin.value()
|
|
273
294
|
self.settings.local_.getnative.last_step = self.step_spin.value()
|
|
@@ -314,7 +335,7 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
314
335
|
def on_range_max_changed(self, value: int) -> None:
|
|
315
336
|
self.range_min_spin.setMaximum(min(value - 1, self._get_max_dim() - 1))
|
|
316
337
|
|
|
317
|
-
def
|
|
338
|
+
def on_dimension_segment_changed(self, index: int) -> None:
|
|
318
339
|
if self._last_dimension == index:
|
|
319
340
|
return
|
|
320
341
|
|
|
@@ -336,6 +357,9 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
336
357
|
self.range_min_spin.setValue(func(v_min, clip, 1))
|
|
337
358
|
self.range_max_spin.setValue(func(v_max, clip, 1))
|
|
338
359
|
|
|
360
|
+
def on_base_parity_segment_changed(self, index: int) -> None:
|
|
361
|
+
self._last_base_parity = index
|
|
362
|
+
|
|
339
363
|
def on_calculate_clicked(self) -> None:
|
|
340
364
|
self.calculate_btn.setDisabled(True)
|
|
341
365
|
|
|
@@ -353,6 +377,9 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
353
377
|
dims = np.linspace(start, start + step_f * (num - 1), num).tolist()
|
|
354
378
|
x_label_fmt = f"%.{str(step_f)[::-1].find('.') + 1}f"
|
|
355
379
|
|
|
380
|
+
if self.base_parity.index == 0:
|
|
381
|
+
dims = [(d, mod2(ceil(d)) + 1) for d in dims]
|
|
382
|
+
|
|
356
383
|
if len(dims) > 2000:
|
|
357
384
|
res = QMessageBox.warning(
|
|
358
385
|
self,
|
|
@@ -368,7 +395,7 @@ class GetNativeTab(TabContainer, IconReloadMixin):
|
|
|
368
395
|
self.calculate_btn.setEnabled(True)
|
|
369
396
|
return
|
|
370
397
|
|
|
371
|
-
match
|
|
398
|
+
match self.dimension.index:
|
|
372
399
|
case 1:
|
|
373
400
|
dimensions = zip_longest([clip.width], dims, fillvalue=clip.width)
|
|
374
401
|
dim_mode = "Height"
|
|
@@ -141,6 +141,7 @@ class GetNativeLocalSettings(BaseModel):
|
|
|
141
141
|
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
142
142
|
|
|
143
143
|
last_dimension: int | None = None
|
|
144
|
+
last_base_parity: int | None = None
|
|
144
145
|
last_min_range: int | None = None
|
|
145
146
|
last_max_range: int | None = None
|
|
146
147
|
last_step: float | None = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|