Giter Site home page Giter Site logo

tivtc's Introduction

TIVTC and TDeInt

Current versions:

  • TIVTC: v1.0.28 (20231210)
  • TDeint: v1.9 (20201210)

This is a modernization effort on tritical's TIVTC (v1.0.5) and TDeInt (v1.1.1) plugin for Avisynth by pinterf.

All credit goes to tritical, thanks for his work.

Since December 27th 2020 project can be built under Linux and macOS (x86/x64 only) as well. For build instructions see end of this readme.

Links

Build Instructions

Note: ENABLE_INTEL_SIMD does nothing, this plugin cannot be built on non-x86 architectures

Windows Visual Studio MSVC

  • build from IDE

Windows GCC

(mingw installed by msys2) Note: project root is TIVTC/src

From the 'build' folder under project root:

del ..\CMakeCache.txt
cmake .. -G "MinGW Makefiles" -DENABLE_INTEL_SIMD:bool=on
@rem test: cmake .. -G "MinGW Makefiles" -DENABLE_INTEL_SIMD:bool=off
cmake --build . --config Release  

Linux build instructions

  • Clone repo

    git clone https://github.com/pinterf/TIVTC
    cd TIVTC/src
    cmake -B build -S .
    cmake --build build
    

    Useful hints:

    build after clean:

    cmake --build build --clean-first
    

    delete CMake cache

    rm build/CMakeCache.txt
    
  • Find binaries at

    build/TIVTC/libtivtc.so
    build/TDeint/libtdeint.so
    
  • Install binaries

    cd build
    sudo make install
    

tivtc's People

Contributors

akarinvs avatar flossy83 avatar msg7086 avatar pinterf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tivtc's Issues

RequestLinear internal error

In order to fix my issue described in https://forum.doom9.org/showthread.php?p=1926067#post1926067, I've used RequestLinear(clim=x), where x has normally been 25-100. I sometimes get an error stating
Avisynth error at frame 0:
RequestLinear: internal error (frame not cached)!

This issue occurs a bit randomly, trying to launch an encode of the same script sometimes causes it and sometimes doesn't. I've never seen it elsewhere than at frame 0.

tdeint+qtgmc颜色有问题

脚本如下:
ConvertBits(16)
tdeint(mode=0,order=0,edeint=QTGMC().SelectEven())
ConvertBits(8)

8bit正常,16bit处理会花屏。

Add #include <memory> to src/info.cpp (unique_ptr, current_font, GetBitmapFont errors)

On Arch with latest everything (compiler, kernels, etc), tivtc fails to compile due to unique_ptr not being a member of "std". The solution is to add #include to the top of src/info.cpp.

This allows compilation, but then at runtime this is thrown
/usr/include/c++/11.2.0/bits/unique_ptr.h:659: typename std::add_lvalue_reference<_Tp>::type std::unique_ptr<_Tp [], _Dp>::operator const [with _Tp = MTGuardChildFilter; _Dp = std::default_delete<MTGuardChildFilter []>; typename std::add_lvalue_reference<_Tp>::type = MTGuardChildFilter&; std::size_t = long unsigned int]: Assertion 'get() != pointer()' failed.

TDecimate - want to be able to see on the screen when specify a large cycle

In TDecimate, if specify very large numbers for cycleR and cycle (ex. cycleR=7779,cycle=38895), cannot see the result on the screen.
(To begin with, setting display=true in this case will force AvsPmod to close.)

Is it possible to split the result display on the screen only, while leaving the cycleR and cycle specifications as they are?
For example, even if cycleR=7779,cycle=38895 is specified, if the screen display can show 250 frames at a time, etc., can check and make progress.

No documentation for 'l' and 'h' match codes

Output match files from TFM can include match codes of 'l' (lower-case L) and 'h' in addition to the documented 'p', 'c', 'n', 'b', and 'u' codes. The source 'common/internal.h' notes:

l = (deinterlaced c bottom field)

h = (deinterlaced c top field)

At least a mention in the documentation seems essential and some further explanation would be welcome.

TDecimate(hybrid=3) blending with wrong frame

Just bumping this pull request in case it wasn't notified.

Explanation: hybrid=3 uses CalcBlendRatios2 to set which frames get blended and by how much (frame1, frame2, amount1, amount2). Frame1 & frame2 are calculated based on the values inside lutf which is created using the 3 for loops in CalcBlendRatios2. Since the blend is spilling over into the next frame I tried offsetting the cycleS[tart] and cycleE[nd] by 1 unit to the right by swapping the >= for a > and the < for a <=. According to the test pattern and real world content this works and correct frames are now blended (see doom9 post for test pattern & code example).

TIVTC v1.0.15 AnimeIVTC error

AnimeIVTC is not working now after most recent TIVTC update:

Im getting errors "TFMPP: clip2 colorspace must be the same as input clip!"

image

TIVTC v1.0.14 (20190207) and TDeint v1.3 (20200508) works fine.

TDecimate wipes ALL frame properties when outputting hybrid (blended) frames

I can imagine a reason for it working this way - hybrid frames are blended and so their properties would be blended too, which is kind of an invalid concept.

But I am writing my own custom frame properties into my clip before it arrives at TDecimate. I need to pass these properties further downstream but can't cause TDecimate deletes them.

It may be possible to do a bodge workaround of sidechaining a separate clip and merging its properties back in with the output of TDecimate.

Compilation errors

I'm trying to make a small tweak/fix to TDecimate's hybrid=3 mode (details here) and have managed to set up the whole MSys2/Mingw64 environment just now for the first time.

The first of the two build commands seems ok:

# cmake .. -G "MinGW Makefiles" -DENABLE_INTEL_SIMD:bool=on
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detected target processor as: AMD64
../common/TCommonASM.cpp;../common/TCommonASM.h;../common/fixedfonts.cpp;../common/fixedfonts.h;../common/info.cpp;../common/info.h;../common/internal.cpp;../common/internal.h;../include/avisynth.h;../include/avs/alignment.h;../include/avs/capi.h;../include/avs/config.h;../include/avs/cpuid.h;../include/avs/filesystem.h;../include/avs/minmax.h;../include/avs/posix.h;../include/avs/types.h;../include/avs/win.h;Cache.cpp;Cache.h;Cycle.cpp;Cycle.h;FieldDiff.cpp;FieldDiff.h;Font.h;FrameDiff.cpp;FrameDiff.h;IsCombedTIVTC.cpp;MergeHints.cpp;MergeHints.h;PlanarFrame.cpp;PlanarFrame.h;PluginInit.cpp;RequestLinear.cpp;RequestLinear.h;TDecimate.cpp;TDecimate.h;TDecimateASM.cpp;TDecimateASM.h;TDecimateBlur.cpp;TDecimateMode2.cpp;TDecimateMode7.cpp;TDecimateOut.cpp;TFM.cpp;TFM.h;TFMASM.cpp;TFMD2V.cpp;TFMPP.cpp;TFMPP.h;TFMPlanar.cpp;TFMYUY2.cpp;TFMasm.h;calcCRC.cpp;calcCRC.h;profUtil.cpp;profUtil.h;resource.h
../common/TCommonASM.cpp;../common/TCommonASM.h;../common/fixedfonts.cpp;../common/fixedfonts.h;../common/info.cpp;../common/info.h;../common/internal.cpp;../common/internal.h;../include/avisynth.h;../include/avs/alignment.h;../include/avs/capi.h;../include/avs/config.h;../include/avs/cpuid.h;../include/avs/filesystem.h;../include/avs/minmax.h;../include/avs/posix.h;../include/avs/types.h;../include/avs/win.h;TDBuf.cpp;TDBuf.h;TDeintASM.cpp;TDeintASM.h;TDeinterlace.cpp;TDeinterlace.h;TDeinterlacePlanar.cpp;TDeinterlaceYUY2.cpp;THelper.cpp;THelper.h;TSwitch.cpp;TSwitch.h;resource.h
-- Configuring done
-- Generating done
-- Build files have been written to: C:/TIVTC-master/src/TIVTC

But the second command fails:

# cmake --build . --config Release
[  2%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/__/common/TCommonASM.cpp.obj
[  5%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/__/common/fixedfonts.cpp.obj
[  7%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/__/common/info.cpp.obj
In file included from C:\TIVTC-master\src\common\info.cpp:27:
C:/TIVTC-master/src/include/avs/win.h:44: warning: "STRICT" redefined
   44 | #define STRICT
      |
In file included from C:/msys64/mingw64/include/windef.h:9,
                 from C:/msys64/mingw64/include/windows.h:69,
                 from C:\TIVTC-master\src\common\internal.h:12,
                 from C:\TIVTC-master\src\common\info.h:30,
                 from C:\TIVTC-master\src\common\info.cpp:23:
C:/msys64/mingw64/include/minwindef.h:11: note: this is the location of the previous definition
   11 | #define STRICT 1
      |
C:\TIVTC-master\src\common\info.h:74:6: error: 'unique_ptr' in namespace 'std' does not name a template type
   74 | std::unique_ptr<BitmapFont> GetBitmapFont(int size, const char* name, bool bold, bool debugSave);
      |      ^~~~~~~~~~
C:\TIVTC-master\src\common\info.h:35:1: note: 'std::unique_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
   34 | #include <vector>
  +++ |+#include <memory>
   35 |
C:\TIVTC-master\src\common\info.cpp:46:13: error: 'unique_ptr' in namespace 'std' does not name a template type
   46 | static std::unique_ptr<wchar_t[]> AnsiToWideCharACP(const char* s_ansi)
      |             ^~~~~~~~~~
C:\TIVTC-master\src\common\info.cpp:44:1: note: 'std::unique_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
   43 | #include "fixedfonts.h"
  +++ |+#include <memory>
   44 |
C:\TIVTC-master\src\common\info.cpp:55:13: error: 'unique_ptr' in namespace 'std' does not name a template type
   55 | static std::unique_ptr<wchar_t[]> Utf8ToWideChar(const char* s_ansi)
      |             ^~~~~~~~~~
C:\TIVTC-master\src\common\info.cpp:55:8: note: 'std::unique_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
   55 | static std::unique_ptr<wchar_t[]> Utf8ToWideChar(const char* s_ansi)
      |        ^~~
C:\TIVTC-master\src\common\info.cpp: In function 'std::wstring charToWstring(const char*, bool)':
C:\TIVTC-master\src\common\info.cpp:110:20: error: 'AnsiToWideCharACP' was not declared in this scope
  110 |     auto wsource = AnsiToWideCharACP(text);
      |                    ^~~~~~~~~~~~~~~~~
C:\TIVTC-master\src\common\info.cpp: At global scope:
C:\TIVTC-master\src\common\info.cpp:906:6: error: 'unique_ptr' in namespace 'std' does not name a template type
  906 | std::unique_ptr<BitmapFont> GetBitmapFont(int size, const char *name, bool bold, bool debugSave) {
      |      ^~~~~~~~~~
C:\TIVTC-master\src\common\info.cpp:906:1: note: 'std::unique_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
  906 | std::unique_ptr<BitmapFont> GetBitmapFont(int size, const char *name, bool bold, bool debugSave) {
      | ^~~
C:\TIVTC-master\src\common\info.cpp: In function 'void DrawStringPlanar(VideoInfo&, PVideoFrame&, int, int, const char*)':
C:\TIVTC-master\src\common\info.cpp:1142:8: error: 'unique_ptr' is not a member of 'std'
 1142 |   std::unique_ptr<BitmapFont> current_font = GetBitmapFont(20, "info_h", false, false); // 10x20
      |        ^~~~~~~~~~
C:\TIVTC-master\src\common\info.cpp:1142:8: note: 'std::unique_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
C:\TIVTC-master\src\common\info.cpp:1142:29: error: expected primary-expression before '>' token
 1142 |   std::unique_ptr<BitmapFont> current_font = GetBitmapFont(20, "info_h", false, false); // 10x20
      |                             ^
C:\TIVTC-master\src\common\info.cpp:1142:31: error: 'current_font' was not declared in this scope
 1142 |   std::unique_ptr<BitmapFont> current_font = GetBitmapFont(20, "info_h", false, false); // 10x20
      |                               ^~~~~~~~~~~~
C:\TIVTC-master\src\common\info.cpp:1142:46: error: 'GetBitmapFont' was not declared in this scope; did you mean 'BitmapFont'?
 1142 |   std::unique_ptr<BitmapFont> current_font = GetBitmapFont(20, "info_h", false, false); // 10x20
      |                                              ^~~~~~~~~~~~~
      |                                              BitmapFont
mingw32-make[2]: *** [TIVTC\CMakeFiles\TIVTC.dir\build.make:106: TIVTC/CMakeFiles/TIVTC.dir/__/common/info.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:142: TIVTC/CMakeFiles/TIVTC.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2

The only thing that stands out to me is the last 3 lines "mingw32-make" - shouldn't that be mingw64?

Here are my installed MinGW packages btw:

mingw-w64-ucrt-x86_64-binutils 2.39-2
mingw-w64-ucrt-x86_64-crt-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-ucrt-x86_64-gcc 12.2.0-4
mingw-w64-ucrt-x86_64-gcc-libs 12.2.0-4
mingw-w64-ucrt-x86_64-gcc-objc 12.2.0-4
mingw-w64-ucrt-x86_64-gmp 6.2.1-3
mingw-w64-ucrt-x86_64-headers-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-ucrt-x86_64-isl 0.25-1
mingw-w64-ucrt-x86_64-libgccjit 12.2.0-4
mingw-w64-ucrt-x86_64-libiconv 1.17-1
mingw-w64-ucrt-x86_64-libwinpthread-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-ucrt-x86_64-mpc 1.2.1-1
mingw-w64-ucrt-x86_64-mpfr 4.1.0.p13-1
mingw-w64-ucrt-x86_64-windows-default-manifest 6.4-4
mingw-w64-ucrt-x86_64-winpthreads-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-ucrt-x86_64-zlib 1.2.13-1
mingw-w64-ucrt-x86_64-zstd 1.5.2-2
mingw-w64-x86_64-binutils 2.39-2
mingw-w64-x86_64-brotli 1.0.9-5
mingw-w64-x86_64-bzip2 1.0.8-2
mingw-w64-x86_64-c-ares 1.18.1-1
mingw-w64-x86_64-ca-certificates 20211016-3
mingw-w64-x86_64-cmake 3.24.2-4
mingw-w64-x86_64-crt-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-x86_64-curl 7.86.0-2
mingw-w64-x86_64-expat 2.4.9-1
mingw-w64-x86_64-gcc 12.2.0-4
mingw-w64-x86_64-gcc-libs 12.2.0-4
mingw-w64-x86_64-gcc-objc 12.2.0-4
mingw-w64-x86_64-gettext 0.21-3
mingw-w64-x86_64-gmp 6.2.1-3
mingw-w64-x86_64-headers-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-x86_64-isl 0.25-1
mingw-w64-x86_64-jansson 2.14-2
mingw-w64-x86_64-jemalloc 5.3.0-1
mingw-w64-x86_64-jsoncpp 1.9.5-1
mingw-w64-x86_64-libarchive 3.6.1-2
mingw-w64-x86_64-libb2 0.98.1-2
mingw-w64-x86_64-libffi 3.4.3-1
mingw-w64-x86_64-libgccjit 12.2.0-4
mingw-w64-x86_64-libiconv 1.17-1
mingw-w64-x86_64-libidn2 2.3.3-1
mingw-w64-x86_64-libpsl 0.21.1-4
mingw-w64-x86_64-libssh2 1.10.0-1
mingw-w64-x86_64-libsystre 1.0.1-4
mingw-w64-x86_64-libtasn1 4.19.0-1
mingw-w64-x86_64-libtre-git r128.6fb7206-2
mingw-w64-x86_64-libunistring 1.0-1
mingw-w64-x86_64-libuv 1.44.2-1
mingw-w64-x86_64-libwinpthread-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-x86_64-libxml2 2.10.3-1
mingw-w64-x86_64-lz4 1.9.4-1
mingw-w64-x86_64-make 4.3-1
mingw-w64-x86_64-mpc 1.2.1-1
mingw-w64-x86_64-mpfr 4.1.0.p13-1
mingw-w64-x86_64-nghttp2 1.50.0-1
mingw-w64-x86_64-ninja 1.11.1-2
mingw-w64-x86_64-openssl 1.1.1.q-1
mingw-w64-x86_64-p11-kit 0.24.1-3
mingw-w64-x86_64-pkgconf 1~1.8.0-2
mingw-w64-x86_64-rhash 1.4.3-1
mingw-w64-x86_64-windows-default-manifest 6.4-4
mingw-w64-x86_64-winpthreads-git 10.0.0.r113.g57fd0b77a-1
mingw-w64-x86_64-xz 5.2.7-1
mingw-w64-x86_64-zlib 1.2.13-1
mingw-w64-x86_64-zstd 1.5.2-2

Any help appreciated

Some bugs, probably

I noticed a few more things.

It should be vi2 instead of vi in these two places, because clip2 is allowed to have different resolution and colorspace/bit depth:

blendFrames(frame1, frame2, dst, a1, vi, env);

PVideoFrame dst = env->NewVideoFrame(vi);
setBlack(dst, vi);
if (retFrames <= -305)
{
if (retFrames <= -306 && se)
env->ThrowError("TDecimate: mode 3 finished (early termination)!");
sprintf(buf, "Mode 3: Last Actual Frame = %d", lastFrame);
Draw(dst, 2, 1, buf, vi);

(vi comes from child, vi2 comes from clip2.)


GetRowSize returns the width in bytes, but dispatch_blend expects the width in pixels:

width = src1->GetRowSize(plane);


blurFrame expects cpuFlags, not opt:

TIVTC/src/TIVTC/TDecimate.cpp

Lines 1105 to 1107 in a3d1354

blurFrame(prevt, prev, 2, chroma, env, vit, opt);
blurFrame(nextt, next, 2, chroma, env, vit, opt);

Ideas to improvement TFM matching

for cases like this https://forum.doom9.org/showthread.php?t=182154 the sample is down so here I upload it https://www.mediafire.com/file/tob9n5emimto8o6/Moire_Test.m2v/file

also this sample https://www.solidfiles.com/v/pdVvVnXpxV2ej that work better in IT https://forum.doom9.org/showpost.php?p=1925578&postcount=265

maybe can be improved by adding denoise parameter like

of another post-processed/prefilterd pclip parameter to feed clean clip that not affects output but the field matching

[ Linux ] malloc(): invalid size (unsorted)

I'm trying to get QTGMC deinterlacing working on linux which requires a bit of work.

I've installed the arch linux package avisynth-plugin-tivtc-git and if I run the following script:

LWLibavVideoSource("test.mkv")
TDeint()

and then try to run it through ffplay:

ffplay -i test.avs
ffplay version n4.4 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-openssl --enable-shared --enable-version3 --enable-libfdk_aac --enable-nonfree
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
malloc(): invalid size (unsorted)  0KB vq=    0KB sq=    0B f=0/0   
Aborted (core dumped)

Without TDeint() it works fine, so it seems to be a TDeint issue, I'm not sure where to start on debugging it as it's my first time using AviSynth.

feature request: "animation mode" to detect and avoid blocky frames from mismatching

I'm processing a lot of telecined animation from DVD and find that any IVTC process, including TFM with access to the D2V file, sometimes produces blocky looking frames where it has combined top and bottom fields that consist of identical pixels, producing an output that's the same as if it had thrown away one field entirely, and scaled the remaining field to fill the image. the result is a blocky image that looks like the vertical resolution is halved. here's a screenshot showing the sort of thing I mean - lines 0 and 1 of the image are the same, lines 2 and 3 are the same, etc

The Simpsons 1x02 - Bart the Genius pass 1 - 17829

and here's a better version of this frame produced by using an override file to choose a different match (I'm using mode 2 because on this dvd, every good match is always either c p or u)

The Simpsons 1x02 - Bart the Genius pass 1 - 17829 v2

the frequency of these bad frames varies depending on the show and the episode, but it happens to some extent with pretty much every episode of any DVD of telecined animation I have (I've got several well-known shows and they all exhibit this to some extent), at the moment I'm finding hundreds of bad frames in each episode around 40,000 frames long, but in some really bad cases there can be sections with a bad frame on every cycle of 5 frames. not only do these bad frames look awful and distracting when they appear, but they also mess up the decimation as they are almost always a blocky version of a neighbouring frame, so while they should be a candidate for decimation they instead look like unique frames. in the example above, the next frame is identical to the good frame I've shown, so that should be two identical frames that are candidates for decimation, but instead we have two unique frames

I've tried using overrides to fix this problem, and this is very successful - I can override almost every bad frame this way (on the two episodes I've done, I've removed hundreds and hundreds of bad frames leaving only 3-5 max), showing that good matches do exist but TFM is not choosing them. I've tried a myriad of modes and settings in TFM and while the results do vary, nothing stops these frames from being outputted in significant numbers. I think the problem is fundamentally that they are not combed frames, so there's nothing to identify them as a bad match, however to the eye they look terrible, and are very difficult to deal with using filters across the entire clip, without using extreme processing that does more harm than good to the rest of the clip. it's also difficult to identify and treat them separately in AVS, I've had some success with this but it feels like taking a hammer to fix hundreds of bad frames, when the better option is to output better frames in the first place. unfortunately using manual overrides to the extent required is an enormous process, it's taking around 10 hours to manually scan through and override all the bad frames in a single 23 minute episode, and I've got hundreds of episodes in each of multiple shows, which is why I'm here making this suggestion!

so - what would be really useful is if there was an "animation mode" for the field matching, where it would try to identify these frames and treat them the same way it does combed frames - rejecting them as matches, and passing through any leftover blocky frames that couldn't be avoided for post-processing (ideally I'd like to offer a clip3 for fixing blocky frames the same way I already use clip2 for combed frames, I have found that 2-3 stacked calls to QTGMC deals with the blockiness pretty effectively, but I obviously don't want to destroy the entire clip this way). I'm pretty sure these frames should be easy to detect - an algorithm similar to the one that detects combing by looking for significant pixel differences across several neighouring lines of pixels, could instead look for pixel differences that are aligned to odd/even pairs of lines only

I've never seen this issue with telecined live action stuff, it's only ever with animated material, which is why I suggested making it an optional "animation mode" but maybe it would work fine leaving this in place for all material, either way I think it would be a really useful feature for TIVTC resulting in better output for some difficult material

edeint bug with HBD

with

ColorBars(width=720, height=480, pixel_type="yv12")
ConvertBits(16)
tdeint(edeint=nnedi3)
ConvertBits(8)

at least with x64 I got this
image

Frame properties

Hi. After TDeint and tfm/tdecimate the frame property "_FieldBased" isn't changed (2/1->0).

TIVTC 1.0.16 error

At 1.0.16, I get a new error.

エラー

This error was caused by using the following function.


function Film24P(clip clip){
sclip=clip.nnedi3(field=1)
Interp=clip.AssumeTFF().eedi3(field=1,sclip=sclip)
m1=clip.TMM2(mtype=2,ttype=5)
Deinted=clip.TDeint(order=1,field=1,edeint=Interp,emask=m1,slow=2)
clip=clip.TFM(mode=6,order=1,PP=7,slow=2,mChroma=true,clip2=Deinted)
clip=clip.crop(0,110,0,-306).TDecimate(mode=1,clip2=clip)
return clip
}

Reverted back to 1.0.14 and all was fine.

TFM - Can't override to use clip2 deinterlacer when PP is initially set to 0

Bug Description :

If in the initial tfm call PP is set to 0 and clip2 is defined as an external deinterlacer source, changing the PP value to greater than 1 in the override file will not invoke the clip2 external deinterlacer as expected.

Notes :

I am not really sure if this is a bug, or a feature request, or if I am fundamentally just trying to use the wrong tool for the job. Thank you for this excellent tool in any case.

What I am trying to do is to just stitch/weave all frames together (ideally without any processing on frame match or comb detection) except for the specific frames i specify in the override file which need to be deinterlaced (using QTGMC, not the internal deinterlacer - and ideally only applying the deinterlacing to the detected comb "mask").

My video source is perfect 25p interlaced to 50i except for the credits which have no matching fields (and are followed by more 25p interlaced to 50i content).

This is what I am using to try an accomplish this. Should this work, or am I going about this the wrong way?

avs script :

mpeg2source("nirvana.d2v")
deint = QTGMC(Preset="Very Slow")
tfm(d2v="nirvana.d2v",mode=0,pp=0,slow=0,debug=True,ovr="override.txt",clip2=deint.SelectEven())

override.txt :

72325,73025 m 5
72325,73025 +
72325,73025 P 5

I have already worked around the issue by changing the initial PP value to 5 and explicitly setting every other frame than the range above as PP=0 and not combed in the override - but is that supposed to be required?

also, the notes for clip2 say

if PP >= 5 (i.e. using motion adaptation)
then TFM will build the mask as usual and only pixels in moving areas will be taken
from the frames in clip2.

Is this correct and am I using it properly above? Is the particular deinterlacing type specified by the PP value (5=blend,6=cubic,7=modified-ela) simply ignored when calling qtgmc - meaning that choosing 5,6, or 7 will produce the same output and only editing the qtgmc settings will change the deinterlace mode (this is what I assume is happening)?

also, can the slow value be changed in the override? I didn't see any mention of that in the documentation.

frame properties

Hi, in case you didn't note, but Asd-g added frame properties to MPEG2Dec/D2VSource, and since TIVTC and others used hints hack I think it's time to support frame properties to use it instead of hints if it available

There is a problem with blend deinterlacing in post processes.

Blend deinterlacing of PP = 2 and 5, frames will become a mess. Please refer to the image of the following URL.
http://i.imgur.com/LprKo5Z.jpg

LWLibavVideoSource("source.ts",dr =true).CropBottom(1008)
TFMstacker(opt=3)
Overlay(version(),60)
return last #
function TFMstacker(clip last, int "opt"){
c0=TFM(PP=0,opt=opt,MI=0).subtitle("PP=0").subtitle("opt="+String(opt),y=20)
c1=TFM(PP=1,opt=opt,MI=0).subtitle("PP=1").subtitle("opt="+String(opt),y=20)
c2=TFM(PP=2,opt=opt,MI=0).subtitle("PP=2").subtitle("opt="+String(opt),y=20)
c3=TFM(PP=3,opt=opt,MI=0).subtitle("PP=3").subtitle("opt="+String(opt),y=20)
c4=TFM(PP=4,opt=opt,MI=0).subtitle("PP=4").subtitle("opt="+String(opt),y=20)
c5=TFM(PP=5,opt=opt,MI=0).subtitle("PP=5").subtitle("opt="+String(opt),y=20)
c6=TFM(PP=6,opt=opt,MI=0).subtitle("PP=6").subtitle("opt="+String(opt),y=20)
c7=TFM(PP=7,opt=opt,MI=0).subtitle("PP=7").subtitle("opt="+String(opt),y=20)
return StackVertical(c0,c1,c2,c3,c4,c5,c6,c7)}

Crashes in v1.0.19

The following script crashes in latest Avisynth+ x64 using TIVTC v1.0.19
mpeg2source("rule6.d2v")
TFM(pp=1,display=true)

Was able to reproduce:

  • in Virtualdub2, Avspmod, avsmeter, ffmpeg and x264
  • when OSD is enabled (display=true) AND,
  • when postprocessing is set to mode 1 (PP=1)
  • with multiple sources
  • using multiple source filters (LSMASHSource, ffms2 and mpegdecplus)
  • with autoloading disabled and enabled

Was not able to reproduce:

  • with TIVTC v1.0.17
  • when OSD disabled (display=false) OR,
  • when postprocessing is disabled or set to mode >1

The crashes also only seem to occur (or at least easier to reproduce) on sources that need postprocessing. Bug can also be pretty easily reproduced on any source by setting the MI parameter very low to force TFM to detect lots of frames as combed.

CFrameDiff prevf=-2

Hello, I tried to PM you on doom9 but it says your inbox is full.

I was wondering if you might be available to add a small feature: CFrameDiff(prevf=-2) to compare current frame with 2 frames behind, similar to Avisynth YDifferenceToNext(-2). Also positive number to compare current with n frames ahead if possible.

Seem to be able to do it with...

ScriptClip(last,
\ """
	# compare current_frame with current_frame-2

	FDiff = CFrameDiff(prevf=true,
	\ DeleteFrame(current_frame-1)
	\ .DuplicateFrame(current_frame-2))

\ """ , after_frame=true )

...but not sure if this only works as a fluke since adding the duplicate frame to the end of the clip does NOT work, so something is fishy with the above solution in the way that Avisynth references frames internally which I don't understand - especially since I require multithreading which isn't really threadsafe with ScriptClips in the first place.

Any guide to build the x64 dll?

visual studio 2017 15.2(26430.12)
windows sdk 10.0.15063.0

win32 works fine but when building x64 it says.

memset_simd.cpp(30): error C4235: 使用了非标准扩展: 不支持在此结构上使用“__asm”关键字

Also there's warning of using sprintf not sprintf_s

x64 version is broken

TFM can't find combed frames in x64 mode. Test script:

MPEG2Source("test.d2v") # Any DVD Video
tfm(pp=1,output="01.txt")

It was triggered by my friend but he can't speak English, that's why I'm reporting it.

unusual glitchy "scratch" artifacts on one source

I'm using TDeint 1.7 with Staxrip 2.1.3.0
I've opened a .d2v source and have no other filters in my script except for TDeint(), no parameters just the defaults

I'm getting these very strange artifacts that look a bit like film scratches - mostly appearing in the top right corner here https://ibb.co/wJf41Dd but with a couple of lighter coloured artifacts elsewhere across the frame as well

They aren't present in the source (this part of the source is very blurry so there's no hard edges like this at all), and they don't appear if I use other deinterlacers such as FieldDeinterlace(). They remain consistent, not changing at all over multiple frames, usually only disappearing (and new ones appearing) when there's a scene change, but they will stay fixed in place even as the camera pans around etc, so they don't appear to be attached to the image itself, although they do change when there's a scene change

Staxrip is bundled with TD 1.5 and it was doing it on that as well, prompting me to look for an update, which I have installed, and it's still doing it on 1.7. I've switched to FieldDeinterlace(full = false, blend = false) and the artifacts are gone, so that's sorted my project for now at least, but I felt this warranted investigation anyway

I'm aware that there's possibly some parameters that might solve this if adjusted, but as I have no idea what could possibly lead to such artifacts, I also have no idea what to change to try and resolve them. This is an unusual source in that most of the video is not interlaced, but the intro sequence has a mixture of interlaced and non-interlaced scenes, and for most of it the picture is split vertically to show two scenes simultaneously, side-by-side, and sometimes one side is interlaced and the other is not. So it needs an adaptive deinterlacer to sort it.

Access Violation

Hi pinterf,

I tried to made a VFR encode in 2 pass. No problem in the pass one, but on the pass 2, avisynth says I has access violation. It's the first time i has that. I made many VFR encode in the past, I never his any errors. I tried with your last release and the old version of TIVTC (1.0.5), the error is same.

Can you check where this error is coming from? Thanks you for advance.

https://puu.sh/FNncc.png

something is wrong with slow=2 mode

I used tritical's TIVTC(1.05) with slow=2 option, and the result is diffrent from yours.
and I noticed that in TFM.cpp, compareFieldsSlow2 with field!=0 section something is wrong.
(just compared with asm block.)
--arround line 1720 the address of nxtnnf and prvnnf does not updated.
--at line 1685, may "(eax & 7)" instead of "56"?
--at line 1708, may "(diff_n_c > 42)" instead of "2" ?
--at line 1709, may "(eax & 2)" instead of "16"?

Feeding TFM a .d2v leads to unreliable results

disk_num = "42"
tff = True
if tff:
    order = "1"
else:
    order = "0"

dvdraw = core.dgdecode.MPEG2Source(r"D:\Bleach 41-49\BLEACH_DISC_42\VIDEO_TS\bleach42.d2v")
dvdraw = depth(dvdraw, 16)
dvdraw = core.std.SetFrameProp(dvdraw, prop="_Transfer", intval=6)
dvdraw = core.std.SetFrameProp(dvdraw, prop="_Primaries", intval=6)

generate_TFM_metrics = core.tivtc.TFM(dvdraw, order=order, PP=1, slow=2, chroma=True, cthresh=8, d2v = f"encodestuff/bleach{disk_num}.d2v", output = f"ivtc/bleach{disk_num}_matches.txt")

Running this multiple times results in a different matches file every time. However, setting flags=3, which restricts the amount of data from the d2v sent to TDecimate, causes the matches file to always be the same. The wrong d2v-related data that TDecimate receives sometimes leads to catastrophic results (for example, tdecimate metrics data indicating that a frame is not a dupe when in fact it is).

My d2v is generated by DGIndex. I have TIVTC v1.0.26. OS is Windows 10.

bleach42_matches2.txt
bleach42_matches3.txt
Examples of 2 match files generated by the above script

TFM 1.0.27 not detecting field order?

There may be an issue with TFM not detecting the field order properly in v1.0.27.

The order=-1 parameter is supposed to auto detect the field order from Avisynth.

From my end it seems like v1.0.26 correctly detects the field order on a per-frame basis, but perhaps v1.0.27 does not?

For debugging convenience you can force a field order change per-frame with this:

DoubleWeave()  # alternates the field order per-frame
ScriptClip("""SubTitle(String(GetParity(current_frame)))""")

The subtitle should alternate between true/false every frame, and TFM v1.0.27 should see this internally (I suspect it's just interpreting all frames as either TFF or BFF).

I could be wrong, but if my hypothesis is true it would explain why I am seeing a failure to fieldmatch in 1.0.27 but not in 1.0.26, for source clips whose field order changes on a per-frame basis.

Thank you

TFM overriding combed frame detection doesn't work in mode 7

if you have an overrides file for TFM and you override combed frame detection :
500,530 -
650,675 +

this works fine in modes 0-6, and all those frames will be "clean frame (forced)" or "combed frame (forced)", but not in mode 7. in mode 7 it ignores these instructions and just goes with the standard detection, unless you also override a field match
500,530 -
520 p
650,675 +
660 c

this will result in "clean frame (forced)" on frame 520 and "combed frame (forced)" on frame 660 but the other frames will not follow the overrides

so you can work around the problem of a range of frames being incorrectly detected by also manually overriding the field matches with whatever it matched anyway, or by changing the MI value for a range of frames, but it would be simpler if this could behave as expected!

TDeint 1.8 crashes with AviSynth 2.6.0

I have a movie with a resolution of 720x576 pixels. I have the following AVS script (hash not in quotes):

mpeg2source("K:\Recorder\aaa\aaa.d2v")
"#" crop(2,2,696,572)
TDeint()

  • I can open and play it with GordianKnot
  • I can open and play it with the MPC-HC
  • I can open and play it with the MSU VQMT
  • I can process it with AVSMeter 3.0.9.0

This works with TDeint 1.1 (latest version of tritical) as well as with TDeint 1.8 (20201214, latest version of pinterf).
It works with AviSynth 2.6.0.5 and AviSynth+ 3.7.0.

If I now remove the hash before the crop, it still works fine with TDeint 1.1 and with TDeint 1.8, when AviSynth+ is used.
It still works fine with TDeint 1.1 when AviSynth 2.6.0 is used.

But with TDeint 1.8 and AviSynth 2.6.0, it no longer works.

GordianKnot and MSU VQMT show the following:
Avisynth: access violation at 0x000032A0 in C:\Program Files\ AviSynth 2.5\plugins\TDeint.dll, attemting to read from 0xFFFFFF.

The MPC-HC crashes completely:
WARNING: Following frames may be wrong.
tdeint!Ordinal0+0x32a0
tdeint!Ordinal0+0x7355

AVSMeter 3.0.9.0 shows:
Exception 0xC0000005 [STATUS_ACCESS_VIOLATION]
Module: C:\test\TDeint.dll
Address: 0x6D8932A0

Tested on Win7 and WIn10.

Best regards

akapuma

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.