Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 3rd August 2014, 16:38   #1  |  Link
HolyWu
Registered User
 
Join Date: Aug 2006
Location: Taiwan
Posts: 392
Deblock

https://github.com/HomeOfVapourSynth...Synth-Deblock/

Ported from the usual AviSynth plugin http://www.avisynth.nl/users/fizick/...s/deblock.html. Nothing new or interesting really. Just picked a plugin which is simple enough for me to practice porting plugin.

Last edited by HolyWu; 13th June 2017 at 18:02.
HolyWu is offline  
Old 3rd August 2014, 17:11   #2  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Yay! Another step towards independence from AviSynth plugins. Thank you.
__________________
...desu!
Mystery Keeper is offline  
Old 3rd August 2014, 17:41   #3  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
It's the code review patrol!

This is the only definitively wrong part:
Code:
if (!isConstantFormat(d.vi) || d.vi->format->colorFamily == cmCompat || d.vi->format->sampleType != stInteger || d.vi->format->bytesPerSample > 2) {
       vsapi->setError(out, "Deblock: only constant format 8-16 bits integer input supported");
        vsapi->freeNode(d.node);
        return;
}
You probably want this instead:
Code:
  if (!isConstantFormat(d.vi) || d.vi->format->sampleType != stInteger || (d.vi->format->bitsPerSample != 8 && d.vi->format->bitsPerSample != 16)) {
        vsapi->setError(out, "Deblock: only constant format 8 or 16 bits integer input supported");
        vsapi->freeNode(d.node);
        return;
    }
The motivation:
1. Normal filters will never get cmCompat formats as input so no need to check for it
2. You actual processing code actually only works for 8 and 16 bit. For 9-15 bits you don't clamp the output range properly so the output will technically be invalid. You could of course fix the clamping too for the 9-16 bit case which is probably more elegant.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline  
Old 4th August 2014, 15:40   #4  |  Link
HolyWu
Registered User
 
Join Date: Aug 2006
Location: Taiwan
Posts: 392
Thanks for the hints, Myrsloik.

It should have been fixed now. Link is updated in first post.
HolyWu is offline  
Old 7th August 2014, 22:09   #5  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
Hi

for build on linux/gcc is with '-std=gnu++11' or what?

greetings

Last edited by sl1pkn07; 7th August 2014 at 23:44.
sl1pkn07 is offline  
Old 7th August 2014, 23:32   #6  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
This works for me:
Code:
gcc -shared -fPIC -march=native -O3 -std=c++11 -o libdeblock.so Deblock.cpp $(pkg-config --cflags vapoursynth)
Are_ is offline  
Old 7th August 2014, 23:44   #7  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
thanks Are_
sl1pkn07 is offline  
Old 9th June 2015, 18:30   #8  |  Link
HolyWu
Registered User
 
Join Date: Aug 2006
Location: Taiwan
Posts: 392
Update r4.
  • Support 32-bit float input.
HolyWu is offline  
Old 1st November 2016, 08:14   #9  |  Link
HolyWu
Registered User
 
Join Date: Aug 2006
Location: Taiwan
Posts: 392
Update r5.
  • Remove the mod 8 requirement.
HolyWu is offline  
Old 2nd November 2016, 05:42   #10  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Thanks, works fine.
__________________
Hybrid here in the forum, homepage
Selur is offline  
Old 12th June 2017, 13:04   #11  |  Link
TalasNetrag
Registered User
 
Join Date: Feb 2015
Posts: 38
It seems like the VS DeBlock does something diffrent than the AV-version. With quant=25 the AV-version seems to do a better job at deblocking.
http://screenshotcomparison.com/comparison/212508

Edit: AS=Vapoursynth, AV=Avisynth (Some weird typo I did there..)

Last edited by TalasNetrag; 13th June 2017 at 20:53.
TalasNetrag is offline  
Old 13th June 2017, 17:50   #12  |  Link
HolyWu
Registered User
 
Join Date: Aug 2006
Location: Taiwan
Posts: 392
Update r6.
  • Remove clamping for float sample type.
  • Fix bug introduced in r4. It caused the deblocking strength weaker than expected.


Quote:
Originally Posted by TalasNetrag View Post
It seems like the VS DeBlock does something diffrent than the AV-version. With quant=25 the AV-version seems to do a better job at deblocking.
http://screenshotcomparison.com/comparison/212508
Thanks for reporting.
HolyWu is offline  
Old 13th June 2017, 20:58   #13  |  Link
TalasNetrag
Registered User
 
Join Date: Feb 2015
Posts: 38
Quote:
Originally Posted by HolyWu View Post
Update r6.
  • Remove clamping for float sample type.
  • Fix bug introduced in r4. It caused the deblocking strength weaker than expected.
Thank you! Now the output is identical.
TalasNetrag is offline  
Old 2nd August 2017, 20:36   #14  |  Link
groucho86
Registered User
 
Join Date: Apr 2016
Posts: 85
Does someone have the proper syntax to compile this plugin as a dylib for Mac?
groucho86 is offline  
Old 3rd August 2017, 13:11   #15  |  Link
HolyWu
Registered User
 
Join Date: Aug 2006
Location: Taiwan
Posts: 392
Quote:
Originally Posted by groucho86 View Post
Does someone have the proper syntax to compile this plugin as a dylib for Mac?
Is the usual ./autogen.sh && ./configure && make doesn't produce dylib for Mac?
HolyWu is offline  
Old 3rd August 2017, 16:51   #16  |  Link
l33tmeatwad
Registered User
 
l33tmeatwad's Avatar
 
Join Date: Jun 2007
Posts: 414
Quote:
Originally Posted by groucho86 View Post
Does someone have the proper syntax to compile this plugin as a dylib for Mac?
The method HolyWu mentioned should work, are you getting an error compiling or when running configure? Did you install VapourSynth via brew or did you compile it yourself?
l33tmeatwad is offline  
Old 3rd August 2017, 17:29   #17  |  Link
groucho86
Registered User
 
Join Date: Apr 2016
Posts: 85
Mostly compiled from scratch, though I might have attempted a brew install at some point.

HolyWu, running that command, I get the following:
Code:
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: running: glibtoolize --copy --force
glibtoolize: putting auxiliary files in '.'.
glibtoolize: copying file './ltmain.sh'
glibtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
glibtoolize: and rerunning glibtoolize and aclocal.
glibtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:8: installing './compile'
configure.ac:8: installing './config.guess'
configure.ac:8: installing './config.sub'
configure.ac:5: installing './install-sh'
configure.ac:5: installing './missing'
Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-apple-darwin15.6.0
checking host system type... x86_64-apple-darwin15.6.0
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/local/bin/ggrep
checking for egrep... /usr/local/bin/ggrep -E
checking for fgrep... /usr/local/bin/ggrep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin15.6.0 file names to x86_64-apple-darwin15.6.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin15.6.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin15.6.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin15.6.0 dyld
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for vapoursynth... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
  CXX      Deblock/Deblock.lo
  CXXLD    libdeblock.la
The weird thing is I don't say any mention of "dylib" in the Makefile that gets generated.
groucho86 is offline  
Old 3rd August 2017, 18:29   #18  |  Link
l33tmeatwad
Registered User
 
l33tmeatwad's Avatar
 
Join Date: Jun 2007
Posts: 414
if you browse into the .libs folder you should see the dylib file.
l33tmeatwad is offline  
Old 3rd August 2017, 18:46   #19  |  Link
groucho86
Registered User
 
Join Date: Apr 2016
Posts: 85
...You are absolutely correct. Sorry for wild goose chase.

Specifically:
"make" compiles it into a hidden folder:
/VapourSynth-Deblock-master/.libs/libdeblock.dylib

"make install" copies libdeblock.dylib to:
/usr/local/lib/
groucho86 is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.