JKP123

The Sacrifice 1986-JKP

May 11th, 2021 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. import vapoursynth as vs
  2. import havsfunc as hvf
  3. import fvsfunc as fvf
  4. import fag3kdb #Modified it a bit to use newer neo_f3kdb instead of old f3kdb
  5. import vsutil
  6. import kagefunc as kgf
  7. core = vs.get_core()
  8.  
  9.  
  10. path=r'D:\Sync\The.Sacrifice.aka.Offret.1986.1080p.JPN.Bluray.Remux.AVC.LPCM.2.0-NTL.mkv'
  11. path1=r'D:\Sync\Offret AKA The Sacrifice 1986 1080p 4K Remastered Blu-ray Remux AVC FLAC 2.0-KINOLORBER2018.mkv'
  12. src=core.lsmas.LWLibavSource(path)
  13. src1=core.lsmas.LWLibavSource(path1)
  14. src=core.std.CropRel(src, left=64,top=0,right=64,bottom=0)
  15. src1=core.std.CropRel(src1, left=64,top=0,right=64,bottom=0)
  16. src=core.std.Trim(src,8138,src.num_frames-1)
  17. src1=core.std.Trim(src1,0,5091)
  18. src=core.fb.FillBorders(src,2,0,1,0,'fillmargins')
  19. src1=core.fb.FillBorders(src1,2,1,1,1,'fillmargins')
  20. video=core.std.Splice([src1,src])
  21. video=core.std.Trim(video,0,210854)
  22. video1=video
  23. v1=video
  24. v2=core.std.ShufflePlanes(video, planes=0, colorfamily=vs.GRAY)
  25. v1=vsutil.depth(v1,16)
  26. v2=vsutil.depth(v2,16)
  27. thresh=(32 * (1 << v2.format.bits_per_sample) - 1) / 255 #this could be written more efficiently
  28. thresh=32*(1<<(v1.format.bits_per_sample/2)+1). What this does it scales 8 bit clip threshold for 16 bit clip.Here 32 is the 8 bit threshold and we are scaling it to 16bit.
  29. #Laplacian mask which proves more useful for regions in scenes which does not show very high change in gradient especially helpful in debanding skies since it's a partial double derivative instead of finding the slope as in edge masks it computes rate of change of slope.
  30. mask1=core.std.Convolution(v2,[1,1,1,1,-8,1,1,1,1]).std.Binarize(thresh).std.Maximum().std.Inflate().std.Maximum().std.Inflate()
  31. mask2=kgf.retinex_edgemask(v2).std.Maximum().std.Inflate().std.Maximum().std.Inflate()
  32. deband=fag3kdb.Fag3kdb(v1,radiusy=12, radiusc=8, thry=60, thrc=40, grainy=15,grainc=10,keep_tv_range=True)#Deblocking and hard debanding
  33. deband1 = core.neo_f3kdb.Deband(v1, y=45, cb=45, cr=45, range=18, grainy=0,grainc=0, output_depth=16, keep_tv_range=True) #soft deband
  34. deband2= core.neo_f3kdb.Deband(v1, y=48, cb=48, cr=48, range=16, grainy=10,grainc=0, output_depth=16, keep_tv_range=True)#Medium deband
  35. deband1=core.std.MaskedMerge(deband1,v1, mask1)
  36. deband2=core.std.MaskedMerge(deband2,v1, mask2)
  37. deband=vsutil.depth(deband,8,dither_type='error_diffusion')
  38. deband1=vsutil.depth(deband1,8,dither_type='error_diffusion')
  39. deband2=vsutil.depth(deband2,8,dither_type='error_diffusion')
  40. video=fvf.rfs(video,deband1,"[5192 19734][63221 72018][115077 115470][115942 117312][130454 130816][172147 175669][181894 204701][210449 210854]")
  41. video=fvf.rfs(video,deband2,"[72426 115076][115797 115940][117336 128812]")
  42. video=fvf.rfs(video,deband,"[44338 44366][45546 46391][131540 164243]")
  43.  
  44.  
  45. video.set_output()
  46.  
Add Comment
Please, Sign In to add comment