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

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th June 2017, 16:18   #441  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
I understand now why you rewrote this thing like, entirely...
the code was full of weird bullshit and insanely fucking stupid stuff..

I managed to upgrade FakeBlockData and FakePlaneOfBlocks to normal C++14 but got stuck at FakeGroupOfPlanes
there's this bloody "update()" function throughout MVTools code,

it's like
Code:
void FakeBlockData::Update(const int *array) {
	vector.x = array[0];
	vector.y = array[1];
	vector.sad = array[2];
}
in FakeBlockData and I recoded it to
Code:
	auto Update(const VectorStructure *NewVectorPointer) {
		Vector = *NewVectorPointer;
	}
and in FakePlaneOfBlocks
Code:
void FakePlaneOfBlocks::Update(const int *array) {
	array += 0;
	for (int i = 0; i < nBlkCount; i++) {
		blocks[i].Update(array);
		array += N_PER_BLOCK;
	}
}
I, again recoded it like
Code:
	auto Update(const void *VectorStream) {
		auto StreamCursor = reinterpret_cast<const VectorStructure *>(VectorStream);
		for (auto i = 0; i < nBlkCount; ++i) {
			blocks[i].Update(StreamCursor);
			++StreamCursor;
		}
	}
.....

and there's one in FakeGroupOfPlanes like
Code:
void FakeGroupOfPlanes::Update(const int *array) {
	const int *pA = array;
	validity = GetValidity(array);
	pA += 2;
	for (int i = nLvCount_ - 1; i >= 0; i--)
		pA += pA[0];
	pA++;
	pA = array;
	pA += 2;
	for (int i = nLvCount_ - 1; i >= 0; i--) {
		planes[i]->Update(pA + 1);
		pA += pA[0];
	}
}
I mean like, dude, what the fuck??? this one is 11 out of 10 kinda wicked fucked up, all that weird abnormal pointer arithmetics with "pA" makes it impossible to recode...
I guess you should know all about that wicked update() function cuz you once converted MVTools to C
could you help me with this and explain that "FakeGroupOfPlanes::Update()", please?
feisty2 is offline   Reply With Quote
Old 20th June 2017, 16:52   #442  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by feisty2 View Post
and there's one in FakeGroupOfPlanes like
Code:
void FakeGroupOfPlanes::Update(const int *array) {
	const int *pA = array;
	validity = GetValidity(array);
	pA += 2;
	for (int i = nLvCount_ - 1; i >= 0; i--)
		pA += pA[0];
	pA++;
	pA = array;
	pA += 2;
	for (int i = nLvCount_ - 1; i >= 0; i--) {
		planes[i]->Update(pA + 1);
		pA += pA[0];
	}
}
I mean like, dude, what the fuck??? this one is 11 out of 10 kinda wicked fucked up, all that weird abnormal pointer arithmetics with "pA" makes it impossible to recode...
I guess you should know all about that wicked update() function cuz you once converted MVTools to C
could you help me with this and explain that "FakeGroupOfPlanes::Update()", please?
Well, see, half that function is redundant: https://github.com/dubhater/vapoursy...79f802d212L110
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 20th June 2017, 17:10   #443  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
something I failed to understand
Code:
const int *pA = array + 2;
what's that "+2"? some kind of offset value? will it be affected if I change the structure of vector stream? like if I change "sad" in the vector to double?

and this,
Code:
pA += pA[0];
I suppose it should be something like
Code:
constexpr auto StreamHeaderOffset = 2;
auto pA = reinterpret_cast<const VectorStructure *>(array + StreamHeaderOffset);
auto MoveOnToTheNextVector = [](auto &VectorPointer) {
	constexpr auto AbsoluteVectorSize = sizeof(std::decay_t<decltype(*VectorPointer)>);
	constexpr auto RelativeVectorSize = AbsoluteVectorSize / sizeof(int);
	auto ForwardDistance = VectorPointer->x / RelativeVectorSize;
	VectorPointer += ForwardDistance;
};
MoveOnToTheNextVector(pA);
?

and that's why I hate C and old C++ so much cuz it's like fucking deciphering assembly code, what's so hard about defining weird constants with constexpr variables with proper names and writing some nested closure functions to tell others what the hell you're doing exactly?

Last edited by feisty2; 20th June 2017 at 17:36.
feisty2 is offline   Reply With Quote
Old 20th June 2017, 18:06   #444  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by feisty2 View Post
something I failed to understand
Code:
const int *pA = array + 2;
what's that "+2"? some kind of offset value? will it be affected if I change the structure of vector stream? like if I change "sad" in the vector to double?

and this,
Code:
pA += pA[0];
This is what Analyse and Recalculate attach to each frame they return, and what the "array" parameter points to:
Code:
int total_size; // Size of the entire thing, i.e. the last int you may access is array[total_size - 1]
int validity; // 0 if the frame is too close to the beginning or end of the clip, otherwise 1
int first_level_size;
VECTOR first_level_vectors[first_level_size];
int second_level_size;
VECTOR second_level_vectors[second_level_size];
...
int last_level_size;
VECTOR last_level_vectors[last_level_size];
int divided_extra_level_size; // may not exist
VECTOR divided_extra_level_vectors[divided_extra_level_size]; //may not exist
So that +2 skips over the total size and validity. And then pA += pA[0] skips over the "current" level.

You may have noticed that all those size fields store numbers of ints, rather than numbers of bytes. This is probably because everything in there used to be an int (the sizes, validity, VECTOR's members, other things that used to be stored there). This is weird already, and it would have become weirder when I made the type of VECTOR::sad int64_t, so since v19 all these sizes store numbers of bytes.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 20th June 2017, 20:00   #445  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
thanks for the detailed explanation, I can now finally reshape that weird piece of shit into something readable...
Code:
	auto Update(const std::int32_t *VectorStream) {
		constexpr auto StreamHeaderOffset = 2;
		auto StreamCursor = VectorStream + StreamHeaderOffset;
		auto GetValidity = [&]() {
			return VectorStream[1] == 1;
		};
		auto UpdateVectorsForEachLevel = [&](auto Level) {
			constexpr auto LevelHeaderOffset = 1;
			auto LevelLength = StreamCursor[0];
			auto CalibratedStreamCursor = reinterpret_cast<const VectorStructure *>(StreamCursor + LevelHeaderOffset);
			planes[Level]->Update(CalibratedStreamCursor);
			StreamCursor += LevelLength;
		};
		validity = GetValidity();
		for (auto Level = nLvCount_ - 1; Level >= 0; --Level)
			UpdateVectorsForEachLevel(Level);
	}
guess Imma stick to the int-based size for now cuz I don't want no extra trouble...

just for comparison, this was the original version
Code:
void FakeGroupOfPlanes::Update(const int *array) {
	const int *pA = array;
	validity = GetValidity(array);
	pA += 2;
	for (int i = nLvCount_ - 1; i >= 0; i--)
		pA += pA[0];
	pA++;
	pA = array;
	pA += 2;
	for (int i = nLvCount_ - 1; i >= 0; i--) {
		planes[i]->Update(pA + 1);
		pA += pA[0];
	}
}
now you see why I said modern C++ is python with pointers
feisty2 is offline   Reply With Quote
Old 9th July 2018, 12:35   #446  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
Would it be possible to have the 'star' motion search method from x265 included in MVTools?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 9th July 2018, 16:02   #447  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by Boulder View Post
Would it be possible to have the 'star' motion search method from x265 included in MVTools?
It probably is.

But instead here is v20 with a small bug fix.

Code:
   * Fix green edges in the output of FlowBlur, FlowFPS, BlockFPS when pelclip is used and pel=2 (bug introduced in v12).
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 9th July 2018, 16:25   #448  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
Quote:
Originally Posted by jackoneill View Post
Thank you for even considering it, and thanks for the fix It's always nice to see plugins being maintained.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 31st July 2018, 05:36   #449  |  Link
edcrfv94
Registered User
 
Join Date: Apr 2015
Posts: 84
Vapoursynth mvtools not support DegrainN?(some script need tr=6)
edcrfv94 is offline   Reply With Quote
Old 31st July 2018, 06:32   #450  |  Link
Wolfberry
Helenium(Easter)
 
Wolfberry's Avatar
 
Join Date: Aug 2017
Location: Hsinchu, Taiwan
Posts: 99
Quote:
Originally Posted by feisty2 View Post

1. Binary Part: Extended Degrain to Degrain24 (24, it's my lucky number!)
2. Resurrected vmulti features from MVTools 2.6.0.5, implemented via a python module, "tr" works up to 24, guess no one will ever use a time radius > 24.... maybe?
3. Resurrected StoreVect and RestoreVect from MVTools 2.6.0.5, implemented via a python module

vmulti demos:
1. DegrainN
Code:
import vapoursynth as vs
import mvmulti
core = vs.core
sup = core.mvsf.Super(clp)
vec = mvmulti.Analyze(sup,tr=6,blksize=8,overlap=4)
vec = mvmulti.Recalculate(sup,vec,tr=6,blksize=4,overlap=2)
clp = mvmulti.DegrainN(clp, sup, vec, tr=6)
clp.set_output()
DegrainN is available in mvsf (mvtools single precision), the python module can be obtained here
__________________
Monochrome Anomaly
Wolfberry is offline   Reply With Quote
Old 29th October 2018, 07:28   #451  |  Link
edcrfv94
Registered User
 
Join Date: Apr 2015
Posts: 84
vapoursynth mvtools v20
Code:
c_in = src

sup_a = core.mv.Super(c_in, pel=2)
sup = sup_a

analyse_args_df = dict(blksize=16, overlap=8, search=5, searchparam=4, dct=5)
bVec1 = core.mv.Analyse(sup_a, isb=True, delta=1, **analyse_args_df)
fVec1 = core.mv.Analyse(sup_a, isb=False, delta=1, **analyse_args_df)
bVec2 = core.mv.Analyse(sup_a, isb=True, delta=2, **analyse_args_df)
fVec2 = core.mv.Analyse(sup_a, isb=False, delta=2, **analyse_args_df)
bVec3 = core.mv.Analyse(sup_a, isb=True, delta=3, **analyse_args_df)
fVec3 = core.mv.Analyse(sup_a, isb=False, delta=3, **analyse_args_df)

compensate_args_df = dict(thsad=400)
bc1 = core.mv.Compensate(c_in, sup, bVec1, **compensate_args_df)
fc1 = core.mv.Compensate(c_in, sup, fVec1, **compensate_args_df)
bc2 = core.mv.Compensate(c_in, sup, bVec2, **compensate_args_df)
fc2 = core.mv.Compensate(c_in, sup, fVec2, **compensate_args_df)
bc3 = core.mv.Compensate(c_in, sup, bVec3, **compensate_args_df)
fc3 = core.mv.Compensate(c_in, sup, fVec3, **compensate_args_df)

cmp = core.std.Interleave([bc3, bc2, bc1, c_in, fc1, fc2, fc3])
#cmp = core.std.Interleave([fc3, fc2, fc1, c_in, bc1, bc2, bc3])

AviSynth+ mvtools-2.7.33
Code:
c_in = last

sup_a =  c_in.MSuper(pel=2)
sup   = sup_a

vec_norm = sup_a.MAnalyse(multi=true, delta=3, blksize=16, overlap=8, search=5, searchparam=4, DCT=5)
cmp = c_in.MCompensate(sup, vec_norm, tr=3, thSAD=400)
or

Code:
c_in = last

sup_a =  c_in.MSuper(pel=2)
sup   = sup_a

#vec = sup_a.MAnalyse(multi=true, delta=3, blksize=16, overlap=8, search=5, searchparam=4, DCT=5)
#cmp = c_in.MCompensate(sup, vec, tr=3, thSAD=400)

bVec1 = MAnalyse(sup_a, isb=True, delta=1, blksize=16, overlap=8, search=5, searchparam=4, dct=5)
fVec1 = MAnalyse(sup_a, isb=False, delta=1, blksize=16, overlap=8, search=5, searchparam=4, dct=5)
bVec2 = MAnalyse(sup_a, isb=True, delta=2, blksize=16, overlap=8, search=5, searchparam=4, dct=5)
fVec2 = MAnalyse(sup_a, isb=False, delta=2, blksize=16, overlap=8, search=5, searchparam=4, dct=5)
bVec3 = MAnalyse(sup_a, isb=True, delta=3, blksize=16, overlap=8, search=5, searchparam=4, dct=5)
fVec3 = MAnalyse(sup_a, isb=False, delta=3, blksize=16, overlap=8, search=5, searchparam=4, dct=5)

bc1 = MCompensate(c_in, sup, bVec1, thsad=400)
fc1 = MCompensate(c_in, sup, fVec1, thsad=400)
bc2 = MCompensate(c_in, sup, bVec2, thsad=400)
fc2 = MCompensate(c_in, sup, fVec2, thsad=400)
bc3 = MCompensate(c_in, sup, bVec3, thsad=400)
fc3 = MCompensate(c_in, sup, fVec3, thsad=400)

cmp = Interleave(bc3, bc2, bc1, c_in, fc1, fc2, fc3)
#cmp = Interleave(fc3, fc2, fc1, c_in, bc1, bc2, bc3)
Very different from the reslts of AviSynth version, not sure which one correct.
edcrfv94 is offline   Reply With Quote
Old 13th March 2019, 16:52   #452  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
v21 fixes three bugs:
Code:
   * BlockFPS, Flow, FlowFPS, FlowInter: Fix crash with certain blksize/overlapv
     ratios, like 8/2. Thanks to pinterf for finding the cause and the solution.
   * Flow, FlowBlur, FlowFPS, FlowInter: Fix crash due to motion vectors pointing
     outside the frame. Thanks to pinterf for finding the cause and the solution.
   * Analyse: Fix use of an uninitialised variable. Only dct modes 2, 6, and 9 were
     affected. The result was probably just nondeterministic output. This
     uninitialised variable was inherited from the Avisynth plugin, version 2.5.11.3.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 13th March 2019, 17:03   #453  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Awesome!
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 2nd November 2019, 10:02   #454  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Isn't it time for a v22 - AVX2 booster edition?
Or at least a test build so we can test it?
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 2nd November 2019, 17:00   #455  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by ChaosKing View Post
Isn't it time for a v22 - AVX2 booster edition?
Or at least a test build so we can test it?
I should figure out issue #38 first.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 6th April 2020, 10:57   #456  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,542
Quote:
Originally Posted by jackoneill View Post
I should figure out issue #38 first.
Would you please add MDegrainN (up to 6, at least)?

I need it to run G41Fun.py on noisy material.

I have tried MVTools single precision but it's simply too slow to have any use of it, at least the one without AVX2 requirement.
__________________
@turment on Telegram

Last edited by tormento; 6th April 2020 at 11:04.
tormento is offline   Reply With Quote
Old 4th May 2020, 18:40   #457  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
Thank you for the new release

Lemmy said that speed is good for you.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 4th May 2020, 21:44   #458  |  Link
bin.n2f
Registered User
 
Join Date: May 2015
Posts: 18
Quote:
Originally Posted by tormento View Post
Would you please add MDegrainN (up to 6, at least)?

I need it to run G41Fun.py on noisy material.

I have tried MVTools single precision but it's simply too slow to have any use of it, at least the one without AVX2 requirement.
yes please
bin.n2f is offline   Reply With Quote
Old 5th May 2020, 05:22   #459  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
I'm getting quite strange results considering the possible speed increases on my Ryzen 3900X. I would have expected the new Zen generation to be able to utilize the AVX2 optimizations really well, because they did help the first gen one when I tested Stephen R. Savage's early builds.

The first 2500 frames using vspipe:
v21 : 57.25 fps
v22 : 55.14 fps

Test script, normal Blu-ray source.
Code:
clp = core.dgdecodenv.DGSource(r"test.dgi")

degrain16 = core.fmtc.bitdepth(clp, bits=16)
superanalyse8 = core.mv.Super(clp, pel=2, chroma=True, rfilter=4, sharp=1)
supermdg16 = core.mv.Super(degrain16, pel=2, chroma=True, rfilter=4, levels=1, sharp=1)

analyze_args = dict(blksize=16, overlap=8, search=5, searchparam=8, pelsearch=8, truemotion=False)
degrain_args_16 = dict(thsad=200, thsadc=100, limit=1*256, limitc=2*256, thscd1=300, thscd2=80)

bv1_8 = core.mv.Analyse(superanalyse8, isb=True, delta=1, **analyze_args)
fv1_8 = core.mv.Analyse(superanalyse8, isb=False, delta=1, **analyze_args)

finalclip8 = core.mv.Degrain1(degrain16, supermdg16, bv1_8, fv1_8, **degrain_args_16)
finalclip8.set_output()
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...

Last edited by Boulder; 5th May 2020 at 07:55.
Boulder is offline   Reply With Quote
Old 13th May 2020, 15:59   #460  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
What does MFinest actually do? There's no real documentation anywhere to be found.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Reply

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 13:01.


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