upscaler 4.1.0: removed Anime4KCPP workaround to enable support for GIF and progress bar

This commit is contained in:
k4yt3x 2020-05-16 07:12:25 -04:00
parent 192c6ef38b
commit 5af49012c8

View File

@ -4,7 +4,7 @@
Name: Video2X Upscaler
Author: K4YT3X
Date Created: December 10, 2018
Last Modified: May 15, 2020
Last Modified: May 16, 2020
Description: This file contains the Upscaler class. Each
instance of the Upscaler class is an upscaler on an image or
@ -49,7 +49,7 @@ language.install()
_ = language.gettext
# version information
UPSCALER_VERSION = '4.0.0'
UPSCALER_VERSION = '4.1.0'
# these names are consistent for
# - driver selection in command line
@ -243,14 +243,6 @@ class Upscaler:
self.driver_settings['scale_width'] = None
self.driver_settings['scale_height'] = None
# temporary file type check for Anime4KCPP
# it doesn't support GIF processing yet
if self.driver == 'anime4kcpp':
for task in self.processing_queue.queue:
if task[0].suffix.lower() == '.gif':
Avalon.error(_('Anime4KCPP doesn\'t yet support GIF processing'))
raise AttributeError('Anime4KCPP doesn\'t yet support GIF file processing')
def _upscale_frames(self):
""" Upscale video frames with waifu2x-caffe
@ -480,19 +472,6 @@ class Upscaler:
# if input file is a image/gif file or a video
elif input_file_mime_type == 'image/gif' or input_file_type == 'video':
# drivers that have native support for video processing
if input_file_type == 'video' and self.driver == 'anime4kcpp':
Avalon.info(_('Starting to upscale video with Anime4KCPP'))
# enable video processing mode for Anime4KCPP
self.driver_settings['videoMode'] = True
self.process_pool.append(self.driver_object.upscale(self.current_input_file, output_path))
self._wait()
Avalon.info(_('Upscaling completed'))
self.processing_queue.task_done()
self.total_processed += 1
continue
else:
self.create_temp_directories()
# get video information JSON using FFprobe
@ -535,7 +514,6 @@ class Upscaler:
Avalon.error(_('Unsupported pixel format: {}').format(self.ffmpeg_object.pixel_format))
raise UnsupportedPixelError(f'unsupported pixel format {self.ffmpeg_object.pixel_format}')
# width/height will be coded width/height x upscale factor
# original_width = video_info['streams'][video_stream_index]['width']
# original_height = video_info['streams'][video_stream_index]['height']
@ -572,7 +550,7 @@ class Upscaler:
# frames to video
Avalon.info(_('Converting extracted frames into video'))
self.process_pool.append(self.ffmpeg_object.assemble_video(framerate, self.upscaled_frames))
# f'{scale_width}x{scale_height}',
# f'{scale_width}x{scale_height}'
self._wait()
Avalon.info(_('Conversion completed'))