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

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd November 2014, 13:43   #21  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by TheFluff View Post
_fseeki64() and _ftelli64() are what you want but who knows if they're available in your ancient runtime
(looks like they're not, VS2005 or newer I think)
Either that, or just use the _fstati64() function, which avoids having to move the file pointer around. Also you don't need to go down to the Win32 API this way.

It appears to be available in VS 6.0:
http://msdn.microsoft.com/en-us/libr...=vs.60%29.aspx
Code:
#include <sys/stat.h>

__int64 getFileSize64(FILE *const fp)
{
	struct _stati64 stat;
	if(_fstati64(_fileno(fp), &stat) != 0)
	{
		return -1; /*some error occurred*/
	}
	return stat.st_size;
}

Quote:
Originally Posted by StainlessS View Post
I'm not altogether happy about mixing eg file handles and FILE*, but will investigate all things suggested.
On Windows, each FILE* has an associated "native" operating system HANDLE, which you can get via _get_osfhandle(), if you really need to.

It is returned as an intptr_t, but you can typecast to HANDLE safely. I would still prefer the fstat()-based solution, since it's cross-platform.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 23rd November 2014 at 14:02.
LoRd_MuldeR is offline   Reply With Quote
Old 23rd November 2014, 17:23   #22  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Thanx everybody for input, I shall investigate all (bit busy doing something else at the moment).

Quote:
Originally Posted by foxyshadis View Post
Loop unrolling would be dramatically more beneficial than bashing one byte at a time here
True, I used something like that in ShowChannels(), perhaps a bit of copy and paste is needed.

Quote:
Originally Posted by foxyshadis View Post
Hell, accessing the pointers as ulongs (or ulong longs in 64-bit) would be a great improvement, without having to get into intrinsic/ASM/OpenMP territory.
I'm not altogether sure I know what you mean there, are you meaning ULONG *, accessing 4 bytes at a time with shift, and AND extraction ? I have no knowledge of the inner workings or peculiarities of i86 assembler or what instructions execute faster.

EDIT: Perhaps you meant something like,

Code:
    sum += ((BYTE*)srcp)[x+0];
    sum += ((BYTE*)srcp)[x+1];
    sum += ((BYTE*)srcp)[x+2];
    sum += ((BYTE*)srcp)[x+3];
where srcp is ULONG*, and ULONG aligned.


EDIT: I have SDK 2003 installed but can find no docs on _fseek64 and so thought it was not available, also searched include directory.
It does exist in the src\crt\ directory (header and source) , dont know if that means that it is included in libs or not (I assume it is), I shall have to investigate.
__________________
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; 23rd November 2014 at 18:22.
StainlessS is offline   Reply With Quote
Old 23rd November 2014, 17:32   #23  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by StainlessS View Post
EDIT: I have SDK 2003 installed but can find no docs on _fseek64 and so thought it was not available, also searched include directory.
It does exist in the src\crt\ directory (header an source) , dont know if that means that it is included in libs or not (I assume it is), I shall have to investigate.
Functions like _fseeki64(), _ftelli64() and _fstati64() are from the C-Runtime (CRT), not the Win32 API, and thus will not be found in the Win32 SDK.

And you don't need to link a special library for those CRT functions, because the VC linker will link against the suitable MSVCRTxxx.DLL automatically, unless you explicitly prevent linking of that library.

The CRT headers should be in "VS_INSTALL_PATH\VC\include" (at least that's how it is with recent VisualStudio). Simply include <sys/stat.h> to get _fstati64(), for example.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 23rd November 2014 at 17:44.
LoRd_MuldeR is offline   Reply With Quote
Old 23rd November 2014, 17:55   #24  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Windows search on SDK Include directory failed to find _fseek64, but looking into
"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt\sys\stat.h"
It is there. (EDIT: All files and folders, search system files, search hidden files, search subfolders, case insensitive)

Thank you mi'lud.

EDIT: Just did search again, not found again ???

EDIT: And I really should read the VS documentation one day.
__________________
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; 23rd November 2014 at 18:04.
StainlessS is offline   Reply With Quote
Old 23rd November 2014, 18:20   #25  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
I think what you are looking for should be _fseeki64(), not _fseek64(). As a little extra challenge for us, Linux/glibc calls this fseeko64()

Also, any reason you prefer determining the file size using the _fseeki64() plus _ftelli64() "workaround" rather than calling _fstati64() right away?

EDIT: I just noticed that the MSVC CRT even has a _filelengthi64() function, available in VC 6.0, which makes it even simpler

Code:
#include <io.h>

__int64 getFileSize64(FILE *const fp)
{
	return _filelengthi64(_fileno(fp));
}
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 23rd November 2014 at 22:06.
LoRd_MuldeR is offline   Reply With Quote
Old 23rd November 2014, 18:35   #26  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Oops yes, I meant _fseeki64, just re-did search again, still not found.

I was just looking for that one to get file location, wanted _ftelli64() too but did not search on that (EDIT: searched on that too, still not found).
Also, thanx for the getFileSize64 thing, I had already located that one on net.
__________________
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 23rd November 2014, 19:43   #27  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK, think I'll give VS2008 another try,
perhaps that will placate the Fluffy one (why is he so angry, all of the time).

Been having a few crashes lately due to trying a hack up of adb over USB for three Android devices,
think I've screwed my registry and need to re-ghost or do fresh install, might as well get rid of all trace of VS6
and install 2008.
__________________
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; 26th November 2014 at 17:36.
StainlessS is offline   Reply With Quote
Reply

Tags
file system, large file support

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:50.


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