mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-22 20:40:49 +08:00
fix(api-nodes): Topaz 4k video upscaling (#11438)
Some checks are pending
Python Linting / Run Ruff (push) Waiting to run
Python Linting / Run Pylint (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Waiting to run
Execution Tests / test (macos-latest) (push) Waiting to run
Execution Tests / test (ubuntu-latest) (push) Waiting to run
Execution Tests / test (windows-latest) (push) Waiting to run
Test server launches without errors / test (push) Waiting to run
Unit Tests / test (macos-latest) (push) Waiting to run
Unit Tests / test (ubuntu-latest) (push) Waiting to run
Unit Tests / test (windows-2022) (push) Waiting to run
Some checks are pending
Python Linting / Run Ruff (push) Waiting to run
Python Linting / Run Pylint (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Waiting to run
Execution Tests / test (macos-latest) (push) Waiting to run
Execution Tests / test (ubuntu-latest) (push) Waiting to run
Execution Tests / test (windows-latest) (push) Waiting to run
Test server launches without errors / test (push) Waiting to run
Unit Tests / test (macos-latest) (push) Waiting to run
Unit Tests / test (ubuntu-latest) (push) Waiting to run
Unit Tests / test (windows-2022) (push) Waiting to run
This commit is contained in:
parent
0899012ad6
commit
bbb11e2608
@ -23,10 +23,6 @@ UPSCALER_MODELS_MAP = {
|
|||||||
"Starlight (Astra) Fast": "slf-1",
|
"Starlight (Astra) Fast": "slf-1",
|
||||||
"Starlight (Astra) Creative": "slc-1",
|
"Starlight (Astra) Creative": "slc-1",
|
||||||
}
|
}
|
||||||
UPSCALER_VALUES_MAP = {
|
|
||||||
"FullHD (1080p)": 1920,
|
|
||||||
"4K (2160p)": 3840,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class TopazImageEnhance(IO.ComfyNode):
|
class TopazImageEnhance(IO.ComfyNode):
|
||||||
@ -214,7 +210,7 @@ class TopazVideoEnhance(IO.ComfyNode):
|
|||||||
IO.Video.Input("video"),
|
IO.Video.Input("video"),
|
||||||
IO.Boolean.Input("upscaler_enabled", default=True),
|
IO.Boolean.Input("upscaler_enabled", default=True),
|
||||||
IO.Combo.Input("upscaler_model", options=list(UPSCALER_MODELS_MAP.keys())),
|
IO.Combo.Input("upscaler_model", options=list(UPSCALER_MODELS_MAP.keys())),
|
||||||
IO.Combo.Input("upscaler_resolution", options=list(UPSCALER_VALUES_MAP.keys())),
|
IO.Combo.Input("upscaler_resolution", options=["FullHD (1080p)", "4K (2160p)"]),
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
"upscaler_creativity",
|
"upscaler_creativity",
|
||||||
options=["low", "middle", "high"],
|
options=["low", "middle", "high"],
|
||||||
@ -306,8 +302,33 @@ class TopazVideoEnhance(IO.ComfyNode):
|
|||||||
target_frame_rate = src_frame_rate
|
target_frame_rate = src_frame_rate
|
||||||
filters = []
|
filters = []
|
||||||
if upscaler_enabled:
|
if upscaler_enabled:
|
||||||
target_width = UPSCALER_VALUES_MAP[upscaler_resolution]
|
if "1080p" in upscaler_resolution:
|
||||||
target_height = UPSCALER_VALUES_MAP[upscaler_resolution]
|
target_pixel_p = 1080
|
||||||
|
max_long_side = 1920
|
||||||
|
else:
|
||||||
|
target_pixel_p = 2160
|
||||||
|
max_long_side = 3840
|
||||||
|
ar = src_width / src_height
|
||||||
|
if src_width >= src_height:
|
||||||
|
# Landscape or Square; Attempt to set height to target (e.g., 2160), calculate width
|
||||||
|
target_height = target_pixel_p
|
||||||
|
target_width = int(target_height * ar)
|
||||||
|
# Check if width exceeds standard bounds (for ultra-wide e.g., 21:9 ARs)
|
||||||
|
if target_width > max_long_side:
|
||||||
|
target_width = max_long_side
|
||||||
|
target_height = int(target_width / ar)
|
||||||
|
else:
|
||||||
|
# Portrait; Attempt to set width to target (e.g., 2160), calculate height
|
||||||
|
target_width = target_pixel_p
|
||||||
|
target_height = int(target_width / ar)
|
||||||
|
# Check if height exceeds standard bounds
|
||||||
|
if target_height > max_long_side:
|
||||||
|
target_height = max_long_side
|
||||||
|
target_width = int(target_height * ar)
|
||||||
|
if target_width % 2 != 0:
|
||||||
|
target_width += 1
|
||||||
|
if target_height % 2 != 0:
|
||||||
|
target_height += 1
|
||||||
filters.append(
|
filters.append(
|
||||||
topaz_api.VideoEnhancementFilter(
|
topaz_api.VideoEnhancementFilter(
|
||||||
model=UPSCALER_MODELS_MAP[upscaler_model],
|
model=UPSCALER_MODELS_MAP[upscaler_model],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user