preparations for new threading mode for SS

This commit is contained in:
janis
2023-05-16 08:47:29 +02:00
parent b752e65878
commit 01105d33e6
4 changed files with 20 additions and 9 deletions

View File

@@ -22,6 +22,7 @@ if __name__ == '__main__':
ap.add_argument( '-F', '--filetype', help='Change the file type of the temporary image files. Supports png, jpg. Video quality: png > jpg. Png is default, if not specified.' )
ap.add_argument( '-S', '--sharpening', help='Sharpening factor (between 0 and 1 whereas 0 means no sharpening, 1 the most sharpening. Recommendation: Do not exceed 0.25, as it often looks bad)' )
ap.add_argument( '-N', '--noscaling', help='Do not upscale video, instead only sharpen. Sharpening argument required!', action='store_true' )
ap.add_argument( '-t', '--threading', help='Use special threading mode with SS scaler (spawns 16 threads upscaling at one time)', action='store_true' )
ap.add_argument( '-T', '--threads', help='Thread count to use. Cannot exceed CPU thread count. Scaling non-linear (using 2 threads is not exactly 2x the speed of 1 thread). Scales well with FSR, barely with Real-ESRGAN, as it uses mostly the GPU to upscale' )
ap.add_argument( '-E', '--engine', help='Upscaling engine. Can be fsr or SS (for Real-ESRGAN). FSR tends to be lower quality, but faster, Real-ESRGAN is meant for anime. Defaults to fsr' )
ap.add_argument( '-M', '--model', help='Only available if using Real-ESRGAN. Change the ML-Model used to upsample video, can be: realesr-animevideov3 | realesrgan-x4plus-anime , defaults to realesr-animevideov3' )
@@ -32,6 +33,7 @@ if __name__ == '__main__':
go = True;
go2 = True;
go3 = True;
specialMode = False;
engine = 'fsr';
model = 'realesr-animevideov3';
availableModels = [ 'realesr-animevideov3', 'realesrgan-x4plus-anime' ];
@@ -79,25 +81,27 @@ if __name__ == '__main__':
if ( args.filetype in allowedFiletypes ):
filetype = args.filetype
else:
g3o = False
go3 = False
print( 'Invalid filetype for temp images specified. Please ensure to only use png or jpg!' );
else:
filetype = 'png'
specialMode = args.threading;
if ( go and go2 and go3 ):
if ( args.scalefactor ):
if ( int( args.scalefactor ) ):
if ( args.threads != None ):
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, args.scalefactor, args.outputfile, args.sharpening, args.noscaling, filetype, engine, model, threads=int( args.threads ) );
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, args.scalefactor, args.outputfile, args.sharpening, args.noscaling, filetype, engine, model, specialMode, threads=int( args.threads ) );
else:
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, args.scalefactor, args.outputfile, args.sharpening, args.noscaling, filetype, engine, model );
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, args.scalefactor, args.outputfile, args.sharpening, args.noscaling, filetype, engine, model, specialMode );
else:
raise NameError( 'Argument Scale does require to be an integer!' )
else:
if ( args.threads != None ):
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, '2', args.outputfile, args.sharpening, args.noscaling, filetype, engine, model, threads=int( args.threads ) );
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, '2', args.outputfile, args.sharpening, args.noscaling, filetype, engine, model, specialMode, threads=int( args.threads ) );
else:
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, '2', args.outputfile, args.sharpening, args.noscaling, filetype, engine, model )
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, '2', args.outputfile, args.sharpening, args.noscaling, filetype, engine, model, specialMode )
print( '\n\n---------------------------------------------------------------------------------\n\nDONE \n\n\n\nImageVideoUpscalerFrontend V1.1.0\n\nCopyright 2023 FSRImageVideoUpscalerFrontend contributors\nThis application comes with absolutely no warranty to the extent permitted by applicable law\n\n\n\nYour video was saved to ' + args.outputfile + '\n\n\n' )