vodesfunc.analysis.descale
MetricMode
Bases: CustomStrEnum
Error metric for comparing source and reconstructed luma.
Source code in
vodesfunc/analysis/descale.py
get_descale_ranges
get_descale_ranges(candidates: Sequence[RescaleTarget], *, avg_error_thr: float, ind_error_thr: float, scene_starts: Iterable[int] | None = None, metric_mode: MetricMode | str = MetricMode.SOBEL_NORMALIZED, mask: MaskLike | None = None, borders_aware: BorderCrop | None = None, pixel_error_thr: float = 0.01, filename: str | PathLike[str] | None = None, progress: bool = True) -> list[list[tuple[int, int]]]
Find the scenes that best match each descale candidate.
Build all candidates from the same clip using RescaleBuilder (with descale() / descale_raw()) or vsscale.Rescale.
The unique candidate with the lowest mean error wins if both its mean and peak frame error meet their limits.
Example usage:
targets = [
RescaleBuilder(src).descale_raw(Bicubic(0, 1), 960, 540, src_width=960, src_left=-0.0625, src_top=-0.0625, src_height=540),
RescaleBuilder(src).descale(Lanczos(3), 960, 540),
]
results = get_descale_ranges(targets, avg_error_thr=0.04, ind_error_thr=0.06)
To get the final output from a list of targets, see vodesfunc.apply_ranges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidates
|
Sequence[RescaleTarget]
|
Configured |
required |
avg_error_thr
|
float
|
Maximum mean scene error in the selected metric's units. |
required |
ind_error_thr
|
float
|
Maximum individual frame error in the selected metric's units. |
required |
scene_starts
|
Iterable[int] | None
|
Zero-based scene starts. None detects cuts with SCXvid and an empty iterable uses one scene. |
None
|
metric_mode
|
MetricMode | str
|
Error metric used to compare the source and reconstructed luma. Defaults to MetricMode.SOBEL_NORMALIZED, the original descale_analysis score. |
SOBEL_NORMALIZED
|
mask
|
MaskLike | None
|
Optional per-pixel scoring mask applied to the selected metric. Pass vsmasktools.Sobel to weight edges. |
None
|
borders_aware
|
BorderCrop | None
|
Border crop used for scoring, or True to use each kernel's radius. Defaults to 10 pixels for SOBEL_NORMALIZED and 8 for other metrics. |
None
|
pixel_error_thr
|
float
|
Pixel differences at or below this value are ignored for SOBEL_NORMALIZED. |
0.01
|
filename
|
str | PathLike[str] | None
|
Save or reuse a TOML file of ranges. Relative names use the working directory. Delete the file to rerun analysis after changing the source, targets, or settings. |
None
|
progress
|
bool
|
Display a progress bar during analysis. |
True
|
Returns:
| Type | Description |
|---|---|
list[list[tuple[int, int]]]
|
One list of frame ranges per candidate for |