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 > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th August 2013, 07:59   #1  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
MDec2 - v1.02 - 26 Apr 2018

dll's for Avisynth v2.58, Avs+v2.6 x86 and x64.
Requires CPP runtimes for VS 2008.

Code:
MDec2 by StainlessS

MDec2, MultiDecimate like decimating filter.

Planar, YUY2, RGB

MDEC2(clip c,float "rate"=24.0,bool "show"=false,bool "create"=false,string "dir"="C:\",bool "chroma"=true,bool "ver"=false)

MDec2 is a 2 pass decimating filter, acting much like the Multidecimate filter by Donald A. Graft.
Requires MultiDecimate.Exe & ProcessMD.Exe from MultiDecimate package.

Args:-

 c, clip. No default

 Rate=24.0, final output frame rate, used only on 2nd pass.

 show=false. 1st pass, shows metrics on frame, 2nd pass shows frame being used.

 create=false. Set true for 1st pass, false on 2nd pass after using MultiDecimate.Exe.

 dir="C:\". Path to data files (mfile.txt, cfile.txt, dfile.txt).

 chroma=true. If false then only use luma for metrics. (RGB not used).

 ver=false. True shows version on frame.

 See MultiDecimate docs for further info.


Metrics:-
 MDec2, modified metrics based on FDecimate by Donald Graft.
 Splits frames into blocks and returns metric of block with greatest difference.
 YUV Metrics weight combined chroma with same weight as luma.

NOTE, if wanting to eg decimate 29.97 to 25.0, then numbers dont work and will throw an error because of
mismatch to what it is expecting. In such circomstance, use something like:-
>>>>>>>>>>>
    SHOW=True
    ORG=Last
    AssumeFPS(30.0,sync_audio=True)
#    ResampleAudio(ORG.AudioRate)
    Mdec2(Rate=25.0,create=True,Show=True,Dir="")    # Pass 1 [Dir="", files in current directory]
    ###
    Use MultiDecimate.Exe, eg drop 1 frame in every 6.
    ######
    SHOW=False
    ORG=Last
    AssumeFPS(30.0,sync_audio=True)
    ResampleAudio(ORG.AudioRate)
    Mdec2(Rate=25.0,create=False,Show=SHOW,Dir="")    # Pass 2, output 25 fps.
<<<<<<<<<<<

StainlessS
Script included in zip, MDec2_MetricsTest.avs
Code:
########################################################################
# Script to test metrics of MultiDecimate, FDecimate and MDec2.        #
# MultiDecimate v1.07 & FDecimate v1.02/v1.10 metrics are both bugged. #
########################################################################

#Loadplugin("MDec2_x86.dll")
Loadplugin("Multidecimate.dll")
#Loadplugin("FDecimate.dll")

MODE=1   #    Testing Mode, 0 = MDec2 : 1=MultiDecimate : 2=FDecimate (All three should show metrics as 100.0%)
         # 0) MDec2, any valid 8 bit ColorSpace. Metrics shown on frame. (only 100.0% @ PC Levels)
         # 1) MultiDecimate YUY2 ONLY, Metrics stored script directory MFile.txt. (YUY2, Shows 108.51% Qual=2, 217.02% Qual=3)
         # 2) FDecimate YV12 and YUY2, Metrics shown on frame. (Shows 187.68% for YV12, 112.61% YUY2)

C="YUY2" # Choose Test Colorspace (must be valid for the called dll)

MDQUAL=2 # MultiDecimate Quality setting default 2. 2=Luma Only : 3=Luma+Chroma

IsRGBClip=FindStr(C,"RGB")!=0

W=(IsRGBClip) ? BlankClip(Pixel_Type=C,Color=$FFFFFF) : BlankClip(Pixel_Type=C,Color_YUV=$FFFFFF)
K=(IsRGBClip) ? BlankClip(Pixel_Type=C,Color=$000000) : BlankClip(Pixel_Type=C,Color_YUV=$000000)
Interleave(W,K) # White/Black(RGB) or Pink/Green(YUV) alternate frames

MODE==0  ? MDec2(rate=25.0,create=true,Show=true,dir="",Ver=True,Chroma=true) : \
MODE==1  ? MultiDecimate(Pass=1,Show=True,quality=MDQUAL) : \
           FDecimate(Rate=25.0,Metrics=true)
Return Last
EDIT: Above script modified on-line.

Zip contains dll's + source + FDecimate() original source. (metrics modified from FDecimate metrics).
Zip ~ 120KB.

See MediaFire or SendSpace below this post in my sig.

EDIT: Original MultiDecimate page gone, so also available here:- http://www.mediafire.com/file/bw4i71...ecimate107.zip
(maybe of use for docs, and MultiDecimate.exe and ProcessMD.exe).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th April 2018 at 01:05. Reason: Update
StainlessS is offline   Reply With Quote
Old 25th November 2013, 08:39   #2  |  Link
Marsu42
Huba Huba
 
Marsu42's Avatar
 
Join Date: Aug 2005
Location: Palumbian Jungle
Posts: 56
Quote:
Originally Posted by StainlessS View Post
See MediaFire in sig.
MediaFire link seems to be dead (404) - can you please re-upload? Thanks!
__________________
"The innocent have nothing to fear" :stupid:
Marsu42 is offline   Reply With Quote
Old 25th November 2013, 19:51   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
404 is a MediaFire problem, I have reported it. this should work: LINK REMOVED

EDIT: Link in sig now working OK.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th November 2013 at 14:36.
StainlessS is offline   Reply With Quote
Old 11th December 2013, 16:31   #4  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
Can this be used to keep the 2nd copy of a set of repeating frames? There's a few cases for this. For one thing, imagine 24fps film encoded to 720p60. There's up to 3 repeated frames, but because of the encoding, the first in the sequence is low quality, and it's better to get the frame after, where the P frame is correcting the last I frame.

Another case is pulldown. I'd like to average the two repeating fields for better quality. Another use is dot crawl; if you average the same image on two frames it perfectly removes dot crawl, as if it were s-video. There was one other use I can't remember.
jmac698 is offline   Reply With Quote
Old 11th December 2013, 16:52   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
Sorry no. It is MultiDecimate.Exe that selects which frames to keep, MDEC2 only provides the metrics.
Source for MutiDecimate.Exe/Process.Exe was (I think) never published.

EDIT: Source for the dll was never published either.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th December 2013 at 17:29.
StainlessS is offline   Reply With Quote
Old 11th December 2013, 17:10   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,184
I am not sure I understand what problem this is solving. I use TFM all the time to create metrics in pass 1 which I then pass through Multidecimate.exe. In pass 2 I use "MultiDecimate(pass=2)" to read the metric files created by Multidecimate.exe (mfile.txt, etc.) and actually decimate the file by some arbitrary amount (i.e., non repeating patterns).

So what part of this workflow is MDec2 designed to replace, and what advantages does it have over existing solutions?
johnmeyer is offline   Reply With Quote
Old 11th December 2013, 17:24   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
Hi john, I wrote it for myself for the YUY2 and YV12 and RGB capability, someone in some thread asked where to get source for Multidecimate,
so I (cleaned up and extended) posted what I had done. Multidecimate even in pass 2 does not support YV12 (EDIT: Or was it YUY2), even though all that is needed is return the next
non decimated frame without actually needing any knowledge of the colorspace (unless metrics required).

EDIT: You could continue to use TFM and Multidecimate.exe and just use MDEC2 for the second pass if you like (if YV12 or RGB).
I've no idea offhand what colorspaces TFM supports to provide metrics.

EDIT: Forgot, v2.6 planar compatible.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 30th March 2015 at 21:48.
StainlessS is offline   Reply With Quote
Old 11th December 2013, 17:38   #8  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,184
Quote:
Originally Posted by StainlessS View Post
Hi john, I wrote it for myself for the YV12 and RGB capability.
Perfect. That explains it. I didn't see the thread that prompted this work. Thanks!
johnmeyer is offline   Reply With Quote
Old 11th December 2013, 17:57   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
Posting prompted this: http://forum.doom9.org/showthread.ph...16#post1577816

A bit more here: http://forum.doom9.org/showthread.ph...69#post1644669
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 12th December 2013 at 00:50.
StainlessS is offline   Reply With Quote
Old 30th March 2015, 20:44   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
MDec2 v1.01, 30 Mar 2015. Recompile v2.6 dll with Avisynth Version 6 Header.
See 1st post.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 26th April 2018, 22:25   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
MDec2() v1.02, 26 Apr 2018, new version.
Dll's for avs v2.58, avs+ v2.60 x86 and x64, see first post.

EDIT:
Code:
 Modified by StainlessS, metrics from FDecimate by Donald A. Graft (Neuron2).

  v1.00,  9 Aug 2013. Early release.
  v1.01, 30 Mar 2015. Recompile v2.6 dll with Avisynth Version 6 Header.
  v1.02, 26 Apr 2018. Fix pitch can change. Add x64 dll. Recompile VS2008.
Added MDec2_MetricsTest.avs showing bugs in Multidecimate and FDecimate metrics.
FDecimate metrics bug adds chroma difference to the wrong luma difference block.

Here FDEcimate on YV12 (v1.02, v1.10 same bug).


MultiDecimate is also bugged but dont seem as bad. (no source to check)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th April 2018 at 13:20.
StainlessS is offline   Reply With Quote
Reply

Tags
decimate, fdecimate, multidecimate

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 03:08.


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