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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread
Old 10th October 2015, 01:44   #1  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,455
Can I Pass Clip Metadata Between Filters

Is it possible to pass metadata from one filter to the next?

Here's what I want to do. Instead of this... (which if you tried SuperRes/Shader, you'll see it is very expensive on memory)

Quote:
input = input.Shader("YuvToRgb.cso")
diff1 = input.Shader("DiffA.cso")
diff2 = input.Shader("DiffB.cso")
diff3 = input.Shader("DiffC.cso")
input = diff1.Shader("Merge.cso", clip2=diff2, clip3=diff3)
input = input.Shader("RgbToYuv.cso")
I want to do this

Quote:
input = input.Shader("YuvToRgb.cso")
diff1 = input.Shader("DiffA.cso", output=2)
diff2 = input.Shader("DiffB.cso", output=3)
diff3 = input.Shader("DiffC.cso", output=4)
input = input.Shader("Merge.cso", clip1=2, clip2=3, clip3=4)
input = input.Shader("RgbToYuv.cso")
input = input.ShaderExecute()
Basically, if the Shader commands could simply add metadata to the clip, then ShaderExecute could execute all the commands in the chain at once, saving tremendous memory and threads.

Is it possible?

Well... yes it is possible, worse case scenario I could store the metadata as a struct within the input video's memory but that would be VERY ugly programming. Is there a better way to pass metadata from one filter to the next?
MysteryX is offline   Reply With Quote
Old 10th October 2015, 03:46   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,625
Check the source code of MSuper
feisty2 is offline   Reply With Quote
Old 10th October 2015, 05:26   #3  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,455
OK. It wouldn't be doing the hack of storing in vi.num_audio_samples if it was possible to pass parameters. I'd need to pass more data than that, too.

So I guess the only way to do it would be to encode the structure as a byte array to replace the frame data.

In .NET, serializing data in such a way is easy. In C++, however, I'm not sure how I would do it. String data would be especially complicated to serialize. That's when I wish I was using C#...

Is there an easy way in C++ to convert an array of structures into binary, when it contains strings and each item in the list has a different length?
MysteryX is offline   Reply With Quote
Old 10th October 2015, 11:07   #4  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,888
Quote:
Originally Posted by MysteryX View Post
Is there an easy way in C++ to convert an array of structures into binary, when it contains strings and each item in the list has a different length?
If you mean C++ structs, they are a fixed size. A string in a struct is either fixed length or a fixed length pointer to an externally stored string.

Code:
struct my_struct x[100];
memcpy(storage, x, 100*sizeof(my_object));

...

struct my_struct y[100];
memcpy(y, storage, 100*sizeof(my_object));
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 10th October 2015 at 11:11.
wonkey_monkey is offline   Reply With Quote
Old 10th October 2015, 16:16   #5  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,455
Yeah I know what a struct is and how to store it.

I just realized. I'm not serializing data to the hard drive or over the network or something like that. I'm only storing it in memory to read it afterwards. Truth is, by simply passing a pointer into any field of VideoInfo, we could pass unlimited data.

Since it's only storing it in memory to read it afterwards, simply passing pointers to the strings should be good enough. Simple regular structs then. Flushing the video data, and storing one struct per line. Each call to Shader would add one row to the clip.
MysteryX is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 16:55.


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