CUDASynth
Posted: Wed Mar 13, 2024 12:23 pm
Thanks for the suggestion. I'll see what I can do. Probably for a separate filter, though, rather than being part of tweak.
I have wanted a good autolevels/autoadjust for such a long time that I'd forgotten about itthechaoscoder wrote: ↑Wed Mar 13, 2024 7:13 amSounds great. Will it support features like auto gain, auto balance? This filter here http://avisynth.nl/index.php/AutoAdjust is one of the better ones, but it's also a bit broken (no source code)
auto_balance [default: false] => Enable automatic color balance
DGSharpen is still integrated, so don't worry. Say we have a frame in buffer gpu0. If we sharpen the frame saving each pixel in gpu0, that is in-place. If we save to a new buffer gpu1 (and then deliver gpu1), that is not in-place. Typically, you can do in-place if a pixel is not depending on surrounding pixels. But sharpen depends on surrounding pixels. In practice the result was still mostly OK when done in-place due to CUDA parallelism, but for full correctness it needed to be made not in-place.
I think color balance means white balance in this case.
Basically if you only apply "auto correction" on a per frame basis it could lead to some sort of flickering. One frame gets a bit too dark, the next a bit too bright etc. Averaging X frames leads to more consistent results across a scene => no "flickering".(parameter description from wiki)
temporal_radius [default: 20]
-----------------------------
Radius for temporal stabilization in each direction [useful range: 10~30]
0 = no temporal averaging
xx = number of frames used in averaging
Code: Select all
@ECHO ON
@setlocal ENABLEDELAYEDEXPANSION
@setlocal enableextensions
Set "root=G:\HDTV\DGtest"
Set "root_test2=!root!\TEST2"
Set "vapoursynth_root=!root_test2!\Vapoursynth-x64"
Set "root_dg=!vapoursynth_root!\DGIndex"
Set "dgi_file=!root_test2!\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.DGI"
Set "mpg_input=!root_test2!\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.qsf.mpg"
Set "mp4_output=!root_test2!\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.result.mp4"
DIR "!mpg_input!"
DEL /F "!dgi_file!"
"!root_dg!\DGIndexNV.exe" -version
"!root_dg!\DGIndexNV.exe" -i "!mpg_input!" -e -h -o "!dgi_file!"
REM ONLY FOR INTERLACED MATERIAL SINCE IT DEINTERLACES
DIR "!vapoursynth_root!\DGIndex\DGDecodeNV.dll"
REM @ECHO OFF
set "_VPY_file=!root_test2!\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.vpy"
DEL /F "!_VPY_file!"
ECHO import vapoursynth as vs # this allows use of constants eg vs.YUV420P8 >> "!_VPY_file!" 2>&1
ECHO from vapoursynth import core # actual vapoursynth core >> "!_VPY_file!" 2>&1
ECHO core.std.LoadPlugin^(r'!root_dg!\DGDecodeNV.dll'^) # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765 >> "!_VPY_file!" 2>&1
ECHO core.avs.LoadPlugin^(r'!root_dg!\DGDecodeNV.dll'^) # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765 >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO before_video = core.dgdecodenv.DGSource^( r'!dgi_file!', deinterlace=1, use_top_field=True, use_pf=False ^) >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO after_video = core.dgdecodenv.DGSource^( r'!dgi_file!', deinterlace=1, use_top_field=True, use_pf=False, dn_enable=1, dn_quality="good", dn_strength=0.06, dn_cstrength=0.06, dn_tthresh=75.0, dn_show=0, sh_enable=1, sh_strength=0.3 ^) >> "!_VPY_file!" 2>&1
ECHO #after_video = core.dgdecodenv.DGSource^( r'!dgi_file!', deinterlace=1, use_top_field=True, use_pf=False, dn_enable=1, dn_quality="best", dn_strength=0.06, dn_cstrength=0.06, dn_tthresh=75.0, dn_show=0, sh_enable=1, sh_strength=0.3 ^) >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO # INTERLEAVED >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO #interleaved_video = core.std.Interleave^( [before_video, after_video] ^) >> "!_VPY_file!" 2>&1
ECHO #interleaved_video = core.std.AssumeFPS^( interleaved_video, fpsnum=25, fpsden=1 ^) >> "!_VPY_file!" 2>&1
ECHO #interleaved_video.set_output^(^) >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO # STACKED >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO stacked_video = core.std.StackHorizontal^( [before_video, after_video] ^) >> "!_VPY_file!" 2>&1
ECHO stacked_video.set_output^(^) >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO # AFTER CLIP ONLY >> "!_VPY_file!" 2>&1
ECHO # >> "!_VPY_file!" 2>&1
ECHO #after_video = core.std.AssumeFPS^( after_video, fpsnum=25, fpsden=1 ^) >> "!_VPY_file!" 2>&1
ECHO #after_video.set_output^(^) >> "!_VPY_file!" 2>&1
@ECHO ON
TYPE "!_VPY_file!"
"!vapoursynth_root!\VSPipe.exe" --version
REM this vspipe yields fps
"!vapoursynth_root!\VSPipe.exe" --filter-time --container y4m "!_VPY_file!" --
REM this yields a .mp4 video
DEL /F "!mp4_output!"
"!vapoursynth_root!\VSPipe.exe" --container y4m --filter-time "!_VPY_file!" - | "!vapoursynth_root!\ffmpeg_OpenCL.exe" -hide_banner -v verbose -nostats -f yuv4mpegpipe -i pipe: -probesize 200M -analyzeduration 200M -fps_mode passthrough -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -strict experimental -c:v h264_nvenc -pix_fmt nv12 -preset p7 -multipass fullres -forced-idr 1 -g 25 -coder:v cabac -spatial-aq 1 -temporal-aq 1 -dpb_size 0 -bf:v 3 -b_ref_mode:v 0 -rc:v vbr -cq:v 0 -b:v 6000000 -minrate:v 500000 -maxrate:v 12000000 -bufsize 12000000 -profile:v high -level 5.2 -movflags +faststart+write_colr -y "!mp4_output!"
pause
goto :eof
Code: Select all
import vapoursynth as vs
from vapoursynth import core
core.std.LoadPlugin(r'D:\Don\Programming\C++\DGDecNV\DGDecodeNV\x64\Release\DGDecodeNV.dll')
before_video = core.dgdecodenv.DGSource(r'00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.dgi', deinterlace=1, use_top_field=True, use_pf=False)
after_video = core.dgdecodenv.DGSource(r'00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.dgi', deinterlace=1, use_top_field=True, use_pf=False, dn_enable=1, dn_quality="good", dn_strength=0.06, dn_cstrength=0.06, dn_tthresh=75.0, dn_show=0, sh_enable=1, sh_strength=0.3)
stacked_video = core.std.StackHorizontal([before_video, after_video])
stacked_video.set_output()
Code: Select all
"G:\HDTV\DGtest\Vapoursynth-x64\VSPipe.exe" --filter-time --container y4m "G:\HDTV\DGtest\TEST2\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.vpy" --
with variations of this:
import vapoursynth as vs # this allows use of constants eg vs.YUV420P8
from vapoursynth import core # actual vapoursynth core
core.std.LoadPlugin(r'G:\HDTV\DGtest\Vapoursynth-x64\DGIndex\DGDecodeNV.dll') # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765
core.avs.LoadPlugin(r'G:\HDTV\DGtest\Vapoursynth-x64\DGIndex\DGDecodeNV.dll') # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765
#
before_video = core.dgdecodenv.DGSource( r'G:\HDTV\DGtest\TEST2\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.DGI', deinterlace=1, use_top_field=True, use_pf=False )
#
after_video = core.dgdecodenv.DGSource( r'G:\HDTV\DGtest\TEST2\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.DGI', deinterlace=1, use_top_field=True, use_pf=False, dn_enable=1, dn_quality="good", dn_strength=0.06, dn_cstrength=0.06, dn_tthresh=75.0, dn_show=0, sh_enable=1, sh_strength=0.3 )
#after_video = core.dgdecodenv.DGSource( r'G:\HDTV\DGtest\TEST2\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.DGI', deinterlace=1, use_top_field=True, use_pf=False, dn_enable=1, dn_quality="best", dn_strength=0.06, dn_cstrength=0.06, dn_tthresh=75.0, dn_show=0, sh_enable=1, sh_strength=0.3 )
#
# INTERLEAVED
#
#interleaved_video = core.std.Interleave( [before_video, after_video] )
#interleaved_video = core.std.AssumeFPS( interleaved_video, fpsnum=25, fpsden=1 )
#interleaved_video.set_output()
#
# STACKED
#
#stacked_video = core.std.StackHorizontal( [before_video, after_video] )
#stacked_video.set_output()
#
# AFTER CLIP ONLY
#
after_video = core.std.AssumeFPS( after_video, fpsnum=25, fpsden=1 )
after_video.set_output()
Well, sheep are mentioned in the link. As are squirrels... cough
Bullwinkle will not be happy.hydra3333 wrote: ↑Sat Mar 16, 2024 1:14 amWell, sheep are mentioned in the link. As are squirrels... cough
https://www.newsweek.com/21-animals-tha ... ht-1571299
Code: Select all
import vapoursynth as vs
from vapoursynth import core
core.std.LoadPlugin(r'D:\Don\Programming\C++\DGDecNV\DGDecodeNV\x64\Release\DGDecodeNV.dll')
before_video = core.dgdecodenv.DGSource(r'00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.dgi', deinterlace=1, use_top_field=True, use_pf=False)
after_video = core.dgdecodenv.DGSource(r'00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.dgi', deinterlace=1, use_top_field=True, use_pf=False, dn_enable=1, dn_quality="good", dn_strength=0.06, dn_cstrength=0.06, dn_tthresh=75.0, dn_show=0, sh_enable=1, sh_strength=0.3)
after_video = core.std.AssumeFPS(after_video, fpsnum=5000, fpsden=1)
after_video = core.std.Loop(after_video, 20)
after_video.set_output()
Code: Select all
import vapoursynth as vs
from vapoursynth import core
core.std.LoadPlugin(r'D:\Don\Programming\C++\DGDecNV\DGDecodeNV\x64\Release\DGDecodeNV.dll')
before_video = core.dgdecodenv.DGSource(r'00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.dgi', deinterlace=1, use_top_field=True, use_pf=False)
after_video = core.dgdecodenv.DGSource(r'00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT.dgi', deinterlace=1, use_top_field=True, use_pf=False, dn_enable=1, dn_quality="good", dn_strength=0.06, dn_cstrength=0.06, dn_tthresh=75.0, dn_show=0, sh_enable=1, sh_strength=0.3)
interleaved_video = core.std.Interleave([before_video, after_video])
interleaved_video = core.std.AssumeFPS(interleaved_video, fpsnum=5000, fpsden=1)
interleaved_video = core.std.Loop(interleaved_video, 20)
interleaved_video.set_output()
Code: Select all
powershell.exe -executionpolicy bypass -Command "Measure-Command {G:\HDTV\DGtest\TEST3-DG\Vapoursynth-x64\VSPipe.exe --filter-time --container y4m G:\HDTV\DGtest\TEST3-DG\00_PostcardsFromMannum_sample-unprocessed_interlaced_CUT_normal.vpy -- | Out-Default}"