Asd-g / AviSynth-FCBI

FCBI filter for Avisynth.
GNU General Public License v3.0
4 stars 0 forks source link

Output is shifted,... #2

Closed Selur closed 2 years ago

Selur commented 2 years ago

Using:

# Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/LineFilter/FCBI/FCBI.dll")

# source: 'C:\Users\Selur\Desktop\sample25seconds.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 29.97, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading C:\Users\Selur\Desktop\sample25seconds.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/sample25seconds.mkv", format="YUV420P8", cache=0, prefer_hw=0)

# Setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=1)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=1)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 29.970
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# adjusting frame with SelectEvery
clip = core.std.SelectEvery(clip=clip, cycle=5, offsets=[0, 1, 2, 3])
clip = core.std.AssumeFPS(clip=clip,fpsnum=24000, fpsden=1001)# new fps: 23.976
# cropping the video to 1430x1080
clip = core.std.CropRel(clip=clip, left=246, right=244, top=0, bottom=0)

org = clip
w = clip.width
h = clip.height
clip = core.fcbi.FCBI(clip=clip)
clip = core.resize.Bicubic(clip=clip, width=w, height=h) # undo resize

clip = core.std.Interleave([org.text.Text('Original'), clip.text.Text('Filtered')])

# Output
clip.set_output()

this image shifts to the left.

Using:

w = clip.width
h = clip.height
for i in range(5):
  clip = core.fcbi.FCBI(clip=clip)
  clip = core.resize.Bicubic(clip=clip, width=w, height=h) # undo resize

this shifting becomes more noticeable. -> Did I miss something? Is this a know effect? A bug?

Asd-g commented 2 years ago

It's a known effect. nnedi3_rpow2 does have the same behavior.

Example how could be fixed:

clip = core.fcbi.FCBI(clip=clip)
clip = core.resize.Bicubic(clip=clip, width=clip.w, height=clip.h, src_top=-0.5, src_left=-0.5) # correct center shift
clip = core.resize.Bicubic(clip=clip, width=w, height=h) # undo resize
Selur commented 2 years ago

Thanks for clearing that up. 👍