mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-30 15:48:13 +00:00
updated value unpacking
This commit is contained in:
parent
9a27960bf7
commit
020fb2dc80
@ -23,7 +23,7 @@ Last Modified: April 10, 2022
|
||||
"""
|
||||
|
||||
import math
|
||||
import queue
|
||||
import time
|
||||
|
||||
from PIL import Image
|
||||
from realcugan_ncnn_vulkan_python import Realcugan
|
||||
@ -162,21 +162,29 @@ class UpscalerProcessor(Processor, Upscaler):
|
||||
task = self.tasks_queue.get()
|
||||
while task is not None:
|
||||
|
||||
try:
|
||||
|
||||
if self.pause_flag.value is True:
|
||||
time.sleep(0.1)
|
||||
continue
|
||||
|
||||
# unpack the task's values
|
||||
(
|
||||
frame_index,
|
||||
previous_frame,
|
||||
current_frame,
|
||||
processing_settings,
|
||||
(output_width, output_height, algorithm, noise, threshold),
|
||||
) = task
|
||||
|
||||
# calculate the %diff between the current frame and the previous frame
|
||||
difference_ratio = 0
|
||||
if previous_frame is not None:
|
||||
difference_ratio = self.get_image_diff(previous_frame, current_frame)
|
||||
difference_ratio = self.get_image_diff(
|
||||
previous_frame, current_frame
|
||||
)
|
||||
|
||||
# if the difference is lower than threshold, skip this frame
|
||||
if difference_ratio < processing_settings["difference_threshold"]:
|
||||
if difference_ratio < threshold:
|
||||
|
||||
# make the current image the same as the previous result
|
||||
self.processed_frames[frame_index] = True
|
||||
@ -185,8 +193,10 @@ class UpscalerProcessor(Processor, Upscaler):
|
||||
# process this frame
|
||||
else:
|
||||
self.processed_frames[frame_index] = self.upscale_image(
|
||||
**processing_settings
|
||||
current_frame, output_width, output_height, algorithm, noise
|
||||
)
|
||||
|
||||
self.tasks_queue.task_done()
|
||||
task = self.tasks_queue.get()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user