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 Development

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 17th January 2010, 22:19   #1  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
How would you make this code 64 bit compatible?

Here is the original file. It's from the svn for ffdshow trunk
link

Here is the Diff File code. Note it's for x86 machines.
Code:
Index: src/imgFilters/avisynth/TimgFilterAvisynth.h
===================================================================
--- src/imgFilters/avisynth/TimgFilterAvisynth.h (revision 2975)
+++ src/imgFilters/avisynth/TimgFilterAvisynth.h (working copy)
@@ -99,7 +99,12 @@
 
    static AVS_VideoFrame* AVSC_CC get_frame(AVS_FilterInfo *, int n);
    static int AVSC_CC get_parity(AVS_FilterInfo *, int n) {return 0;}
-   static int AVSC_CC set_cache_hints(AVS_FilterInfo *, int cachehints, int frame_range) {return 0;}
+   static int AVSC_CC set_cache_hints(AVS_FilterInfo *_this, int cachehints, int frame_range)
+   {
+//    if (cachehints == 0x8666 && frame_range) // identify as Cache instance
+//     *(int*)frame_range = (int)(INT_PTR)_this;
+    return 0;
+   }
    static void AVSC_CC free_filter(AVS_FilterInfo *);
 
   public:
The diff file I made is in post #10
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity.

Last edited by Jeremy Duncan; 20th January 2010 at 08:18.
Jeremy Duncan is offline  
Old 18th January 2010, 06:05   #2  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
The // is for end of line comments, so the 2 diffs have no net code change, only some thought exercise comments.
IanB is offline  
Old 18th January 2010, 07:37   #3  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
IanB, Your right, I forgot about that.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity.

Last edited by Jeremy Duncan; 20th January 2010 at 08:16.
Jeremy Duncan is offline  
Old 18th January 2010, 09:55   #4  |  Link
Groucho2004
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Posts: 3,321
@Jeremy Duncan
You remind me of the "The infinite monkey theorem"

It states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare.
Groucho2004 is offline  
Old 18th January 2010, 10:48   #5  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
Yes the code you have un-commented is wrong. The _this pointer is not appropriate. Also if you intend to mate this with Squids 64 bit Avisynth, then you need to base it on that code base, not any of the current 32 bit versions.
IanB is offline  
Old 18th January 2010, 11:36   #6  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
The diff file I made was built for use with the ffdshow svn trunk imgfilters, avisynth folder.
I made a ffdshow installer and tried it in windows 7 64 bit and the problem I had using the old diff file was gone and there was no problems with the picture.

I am amazed that even though there is incorrect code in the diff file as seen in post 3, the problem is gone.
I wonder what would happen if the code was correct?
The problem I was getting using the old diff file was the resizing was wrong, all bad, no definition worth speaking of, but this diff file I uploaded fixes that problem so windows 7 64 bit acts just like xp mce 32 bit.

Groucho2004, I have done as you said. But I am only one munkey on a typewritter.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity.

Last edited by Jeremy Duncan; 20th January 2010 at 08:39.
Jeremy Duncan is offline  
Old 19th January 2010, 16:22   #7  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
you are continuing to prove you have absolutely no clue about what you're doing when attempting to alter code.

I would ask you to stop fruitless efforts but you have continued to do so from others' warnings, so it seems you'll never take the hint.
__________________
custom x264 builds & patches | F@H | My Specs

Last edited by kemuri-_9; 19th January 2010 at 16:43. Reason: typo
kemuri-_9 is offline  
Old 20th January 2010, 01:36   #8  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
I didn't understand what you meant by the word Pointer, so I looked it up taday and saw you were referring to the int in 64 bits. ha ha.

Kemuri, I asked for help but nobody made the code for me.
In that case I just went out and did it myself.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity.

Last edited by Jeremy Duncan; 20th January 2010 at 07:21.
Jeremy Duncan is offline  
Old 20th January 2010, 02:23   #9  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
Quote:
Originally Posted by Jeremy Duncan View Post
Kemuri, I asked for help but nobody made the code for me.
In that case I just went out and did it myself.
A) if you're going to paste an entire file and it's already available on the internet, just link to the file (http://ffdshow-tryout.svn.sourceforg...lterAvisynth.h)
B) there was no real code change in the difference in the original diff
C) the indicated file gives no indication of even being x86_64 incompatible in the first place.
D) you obviously don't know what you're doing if you're changing set_cache_hints for a source filter
E) excluding above points, the code you made can be better done by monkeys; including myself, everyone has been dumbfounded at how illogical it is.
__________________
custom x264 builds & patches | F@H | My Specs

Last edited by kemuri-_9; 20th January 2010 at 02:25.
kemuri-_9 is offline  
Old 20th January 2010, 07:27   #10  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Hi Kemuri-_9, I will try to answer your abc list to the best of my ability.
a.) Never thought about that.
b.) Don't know what you mean. With that bit the code broke ffdshow in windows 7 64 bit, without the diff file the ffdshow works in windows 7 64 bit.
I alter this bit of code from the diff file and it works again in windows 7 64 bit.
So this bit of code from the diff file we are talking about does have a effect in windows 7 64 bit.
c.) That doesn't mean it works. I ttested it. Other people I help with ffdshow tested it in windows 7 64 it and the diff file with no alterations does not work in windows 7 64 bit.
d.) Funny that as when I munkey around with it the windows 7 64 bit using 32 bit ffdshow and diff file works again.
e.) Good for you. Now I made a new code I tested to work in xp mce and will post it below. I am now going to test it in windows 7 64 bit. Edit, it works in windows 7 64 bit:

Code:
    static AVS_VideoFrame* AVSC_CC get_frame(AVS_FilterInfo *, int n);
    static int AVSC_CC get_parity(AVS_FilterInfo *, int n) {return 0;}
-   static int AVSC_CC set_cache_hints(AVS_FilterInfo *, int cachehints, int frame_range) {return 0;}
+   static int AVSC_CC set_cache_hints(AVS_FilterInfo *_this, int cachehints, int frame_range)
+   {
+	   if (cachehints == 0x64 && frame_range) // identify as Cache instance
+		   *(int64*)frame_range = (int64)(INT_PTR)_this, int64 cachehints, int64 frame_range;
+	   return 0;
       continue;
+	   else if (cachehints == 0x8666 && frame_range) // identify as Cache instance
+		   *(int*)frame_range = (int)(INT_PTR)_this, int cachehints, int frame_range;
+	   return 0;
+   }
    static void AVSC_CC free_filter(AVS_FilterInfo *);
 
   public:
diff file i made
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity.

Last edited by Jeremy Duncan; 20th January 2010 at 08:19.
Jeremy Duncan is offline  
Old 20th January 2010, 07:50   #11  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
Jeremy

The code you are randomising is just plain wrong. It is supposed to simply be :-
Code:
 static int AVSC_CC set_cache_hints(AVS_FilterInfo *, int cachehints, int frame_range) {return 0;}
The comments in the original diff are just that, comments someone added as an incomplete thought marker. If you really want to know about it then chase the person who first checked in the comments and ask them what they were intending for the complete thought process.


And as I said if you are going to play with 64 bit Avisynth then you must use Squid's source base, which is a functional subset somewhere between 2.5.5 and 2.5.6 feature wise but yet a little bit different from either.
IanB is offline  
Old 20th January 2010, 08:24   #12  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
I thought about deleting that section of the diff file so the code remains as IanB said in post #11, but I got the diff file working with the code in post #10 in 32 bit xp mce and 64 bit windows 7, so I have no real reason to delete that part of the code, other than to be efficient.

Why should I use the code IanB suggests if the code in post #10 works? I'm interested to read your comments, especially kemuri-_9's.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity.
Jeremy Duncan is offline  
Old 20th January 2010, 08:54   #13  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
Fine include strange random code that you have no idea what it's purpose is. While you are at it here is some other real beaut code. I think it is something to do with capturing credit card numbers for the Russian Mafia, please include this as well.
Code:
@@ -626,25 +634,26 @@
 AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env, 
                                const AVS_VideoInfo * vi)
   {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
+#endif

-AVSC_API(int) avs_make_writable(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf);
+AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf);
 
-AVSC_API(void) avs_bit_blt(AVS_ScriptEnvironment *, BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height);
+AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height);
 
 typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env);
-AVSC_API(void) avs_at_exit(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data);
+AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data);
 
-AVSC_API(AVS_VideoFrame *) avs_subframe(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height);
+AVSC_API(AVS_VideoFrame *, avs_subframe)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height);
 // The returned video frame must be be released
 
-AVSC_API(int) avs_set_memory_max(AVS_ScriptEnvironment *, int mem);
+AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem);
 
-AVSC_API(int) avs_set_working_dir(AVS_ScriptEnvironment *, const char * newdir);
+AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir);
 
 // avisynth.dll exports this; it's a way to use it as a library, without
 // writing an AVS script or without going through AVIFile.
-AVSC_API(AVS_ScriptEnvironment *) avs_create_script_environment(int version);
+AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version);
 
 // this symbol is the entry point for the plugin and must
 // be defined
...
IanB is offline  
Old 20th January 2010, 12:20   #14  |  Link
Groucho2004
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Posts: 3,321
Jeremy, I told you before that your ability to download Visual Studio and install it does not automatically enable you to know everything about C/C++.

Even the fact that you read about pointers on Wikipedia and that you now know what a code comment looks like won't change that.
Groucho2004 is offline  
Old 20th January 2010, 17:06   #15  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
Quote:
Originally Posted by Jeremy Duncan View Post
Why should I use the code IanB suggests if the code in post #10 works? I'm interested to read your comments, especially kemuri-_9's.
how about the fact that your code in that block is never used or called, it's plainly a waste of space?
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline  
Old 20th January 2010, 18:10   #16  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 532
you can add
Code:
// voodoo
// make it work
this will do the same...
hanfrunz is offline  
Old 22nd January 2010, 10:07   #17  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
I have made a mistake with the code in post #10.
I discovered my mistake like so: I downloaded the ffdshow trunk svn 3215 and from the diff file this thread is about I added the changes directly to the files then made a installer and it ran ok in xp mce but in windows 7 the frame doubler ran at 8 fps, so I thought I had to include the code in the file from post ten, so I made a new file with the code and visual studio through a error at me and wouldn't compile ffdshow.ax

So adding the code from post 10 directly to the file showed my error, when I used the diff file including the code from post 10 in the 3200 svn the video ran flawlessly in xp 32 bit and windows 7 64 bit.

I don't know why one svn that used the diff ran ok and the other didn't.
And the funny thing is I had to tweak the code in the code from post ten if the 3200 svn played the video ok or not.

So you were right and I was wrong. I'm sorry for doubting you.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity.
Jeremy Duncan is offline  
Old 23rd January 2010, 00:36   #18  |  Link
Groucho2004
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Posts: 3,321
Please, somebody make him stop.
Groucho2004 is offline  
Old 23rd January 2010, 01:36   #19  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
^+1
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline  
Old 26th January 2010, 18:58   #20  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: Waterloo, WI - USA
Posts: 649
Wha....what just happened?
osgZach 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 22:32.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.