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 5th March 2020, 14:01   #61  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,665
OK, I think that maybe I did YV24 correct after all, If no bug reports prior to about Saturday, I'll release v1.50 without beta,
perhaps G2K4 finds it within his good self to add an x64 dll.

I was absolutely knackered when I was doing this plug, up until yesterday I had hardly slept a single wink for about 10 days,
for about 3 or 4 days I was shagged out, but after that it sort of became the norm and did not feel so much tired.
One day last week I had 5 pints of ale, no effect at all, not a wink slept, but last night about 10 pints did the trick, finally got some sleep.
__________________
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 online now   Reply With Quote
Old 5th March 2020, 16:14   #62  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 4,639
Quote:
Originally Posted by StainlessS View Post
If no bug reports prior to about Saturday, I'll release v1.50 without beta,
perhaps G2K4 finds it within his good self to add an x64 dll.
Will do. Just let me know where the modified source is.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 5th March 2020, 18:18   #63  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,665
Modded source on my SendSpace below this post. [ SubtitleEx_a25_a26_x86_v1.50_20200305.zip ]

I've made Version resource v1.50, and added x64 code into AntiAliaser.cpp as so [switched via '_WIN64' define)

Code:
// ssS:
#ifdef _WIN64
            unsigned __int64 tmp;
            __asm
            {           // test if the whole area isn't just plain black
                mov edx, srcpitch
Define both WIN32 and _WIN64 for x64 build.

zip contains Avs v2.60/+ x86 and v2.58 dll's.

I'm more than happy for you to host in your repository.
__________________
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; 5th March 2020 at 18:58.
StainlessS is online now   Reply With Quote
Old 5th March 2020, 18:40   #64  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 4,639
Quote:
Originally Posted by StainlessS View Post
Modded source on my SendSpace
I keep getting 'bad gateway" on Sendspace. Can you upload to mediafire?
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 5th March 2020, 18:56   #65  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,665
I've re-uploaded to SendSpace [I had problems uploading the first time, real slow connection], and here on MediaFire:- http://www.mediafire.com/file/c4lmeh...00305.zip/file
__________________
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 online now   Reply With Quote
Old 5th March 2020, 19:18   #66  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 4,639
Quote:
Originally Posted by StainlessS View Post
Got it, thanks.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 10th March 2020, 11:37   #67  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 4,639
Quote:
Originally Posted by StainlessS View Post
Modded source on my SendSpace below this post. [ SubtitleEx_a25_a26_x86_v1.50_20200305.zip ]

I've made Version resource v1.50, and added x64 code into AntiAliaser.cpp as so [switched via '_WIN64' define)

Code:
// ssS:
#ifdef _WIN64
            unsigned __int64 tmp;
            __asm
            {           // test if the whole area isn't just plain black
                mov edx, srcpitch
Define both WIN32 and _WIN64 for x64 build.

zip contains Avs v2.60/+ x86 and v2.58 dll's.

I finally had some time to build a 64 bit version with your modifications. All good except that the top y coords are now shifted, see here:

Script:
Code:
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio()
converttorgb32()
SubTitleEx(x=0, y=0, font="Arial", size=50, "First line (x=0, y=0)")
Result:


Result with the first version I made:
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 10th March 2020, 14:03   #68  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,375
Quote:
Originally Posted by StainlessS View Post
Code:
// ssS:
#ifdef _WIN64
            unsigned __int64 tmp;
            __asm
            {           // test if the whole area isn't just plain black
                mov edx, srcpitch
That asm part can safely be replaced by
Code:
  const BYTE* src2 = src - 8 * srcpitch - 1;
  unsigned int tmp = 0;
  for (int i = 0; i < 24; i++) {
    tmp |= *(unsigned int*)(src2);
    src2 += srcpitch;
  }
  tmp &= 0x00ffffff;
Checked, compiler generates the same or better asm code for that part. No need for special 64 bit tmp, 32 bit is enough.
pinterf is offline   Reply With Quote
Old 10th March 2020, 17:13   #69  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,665
WOW thanks P, smashing.

G2K4,
Yeah, I decded to revert to original SubtitleEx method, before the Kai version.
from post 58
Quote:
Originally Posted by StainlessS View Post
v1.50Beta mod StainlessS.

Given version number of v1.50Beta
Made output same as original SubtitleEx for y=0 and Y=-1. (Y=0, Baseline of first line of text is at YCoord 0, Y=-1, BaseLine of Last line of text is at YCoord Height-1).
Where "|" inserts a NewLine in text, "||" will now print a single Pipe "|" character, without NewLine.
Add support for all v2.60 Std Colorspaces except YV411.

It only became obvious what original SubtitleEx intended when rendering multiline where Y=0, and Y=-1 were viewed simultaneously, have implemented as original.


YV24

YV12

Actually, looks like I got it right, YV24 and YV12 look similar-ish on D9 post, I had not seen them side by side.

EDIT: Bottom/top baseline relative stuff
Code:
    const char *s=m_Info.text;
    char *p;
    int currLine;
    for(currLine=0; currLine < LineCount; ++currLine) {
        p=buf;
        while(*s) {
            if(s[1]!='\0') {
                if(IsDBCSLeadByte(s[0]) == TRUE) {
                    *p++ = *s++;            // Lead multi-byte
                    *p++ = *s++;            // trail multi-byte
                    continue;
                }
                if(s[0]=='|' && s[1]=='|') {
                    ++s;                    // Skip escape char
                    *p++ = *s++;            // copy escaped pipe
                    continue;
                }
            }
            if(s[0]=='|') {
                ++s;                        // skip n/l pipe
                break;                      // End of current line
            }
            *p++ = *s++;                    // copy normal char
        }
        *p='\0';
        if (m_Info.org_y >= 0) {
            // ssS: linemargin Takes effect only where currline > 0
            m_pAnti->AntialiserTextOut(buf, x, y + m_Info.linemargin * currLine, currLine);
        } else {
            // ssS: ie for 3 lines then from top, (currLine - LineCount + 1) = -2, -1, 0.
            m_pAnti->AntialiserTextOut(buf, x, y + m_Info.linemargin * (currLine - LineCount + 1), currLine - LineCount + 1);
        }
    }
Original pre Kai version always positioned at baseline(otherwise cannot go upwards and partially off frame because of the Y= -1 thing).
I'm happy to leave as the author intended.
__________________
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; 10th March 2020 at 17:18.
StainlessS is online now   Reply With Quote
Old 10th March 2020, 17:39   #70  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 4,639
Quote:
Originally Posted by StainlessS View Post
Original pre Kai version always positioned at baseline(otherwise cannot go upwards and partially off frame because of the Y= -1 thing).
I'm happy to leave as the author intended.
OK, fair enough.

I forgot to mention, the x86 / x64 distinction in the version resource does not work. It always shows 'x86'. I had a quick look but could not find any error in the conditional logic in version.h. And yes, I did define "WIN32" and "_WIN64".

Edit - With a temporary workaround the version in the x64 DLL is now OK. Here is the plugin.
__________________
Groucho's Avisynth Stuff

Last edited by Groucho2004; 10th March 2020 at 17:52.
Groucho2004 is offline   Reply With Quote
Old 10th March 2020, 18:35   #71  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,665
Thanks g, [no you cant have big G, thats Gavino's moniker].

I would have preferred if implemented with say optonal keypad base align arg, and forget x=-1 type stuff, maybe separate eg Vcent arg (for real centering, rather than print downwards from center), and where
Align defined then x and y relative to alignment, else relative 0,0. [EDIT: And maybe separate args for justification, eg right aligned, left justified. I think RT_subtitle can do that but forgot how]

The the command line for resource compiler whatsit on VS2008,
Code:
/d "_WIN64" /d "_UNICODE" /d "UNICODE" /fo"x64\Debug/DDigitTest.res"
Although I undefine UNICODE type stuff in "Compiler.h" (for the plug code)
Code:
#ifndef __COMPILER_H__
	#define __COMPILER_H__

    #ifdef UNICODE
    	#undef UNICODE													// Avoid default wide character stuff
    #endif
    #ifdef _UNICODE
    	#undef _UNICODE													// Avoid default wide character stuff
    #endif
	#ifdef MBCS 
		#undef MBCS 
	#endif
	#ifdef _MBCS 
		#undef _MBCS 
	#endif
    
    #define _CRT_SECURE_NO_WARNINGS

    // Compile for minimum supported system. MUST be defined before includes.
    // NEED to use SDK for updated headers, TK3 will give error messages/Warnings about Beta versions.
	#ifdef _WIN64
		#define WINVER			0x0502			// XP 64 Bit or Server 2003
		#define _WIN32_WINNT	0x0502			// XP 64 Bit or Server 2003
		#define NTDDI_VERSION	0x05020000		// Server 2003 SP0
		#define _WIN32_IE		0x0700			// 0x0700=IE 7 SP0
	#else
		#define WINVER			0x0501			// XP 32 bit
		#define _WIN32_WINNT	0x0501			// XP 32 bit
		#define NTDDI_VERSION	0x05010300		// XP SP3
		#define _WIN32_IE		0x0603			// 0x0603=IE 6 SP2
	#endif
EDIT: Arh, I dont define WIN32 for resource compiler, maybe that was it.
When compile for v2.58, I also add AVISYNTH_PLUGIN_25 to Resource and CPP Preprocessor definitions.

EDIT:
Linker command line
Code:
/OUT:"M:\SJ\SOURCE ARCHIVE\VC\AVISYNTH FILTERS\2K8x64\DDigitTest\x64\Release\DDigitTest_x64.dll"
/INCREMENTAL:NO /NOLOGO /DLL /MANIFEST /MANIFESTFILE:"x64\Release\DDigitTest_x64.dll.intermediate.manifest"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/DEBUG /PDB:"M:\SJ\SOURCE ARCHIVE\VC\AVISYNTH FILTERS\2K8x64\DDigitTest\x64\Release\DDigitTest_x64.pdb"
/SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X64 /ERRORREPORT:PROMPT kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
CPP command line
Code:
/O2 /Ob2 /Oi /Ot /GL /D "_WIN64" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "DDIGITTEST_EXPORTS" /D "_WINDLL"
/D "_UNICODE" /D "UNICODE" /FD /EHsc /MD /Gy /Fo"x64\Release\\" /Fd"x64\Release\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
EDIT: For line breaks. EDIT: Above looks like for debug version. FIXED.

EDIT: Does it work proper with that there squiggly writin' ?
__________________
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; 10th March 2020 at 19:29.
StainlessS is online now   Reply With Quote
Old 11th March 2020, 23:35   #72  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,665
SubtitleEx() v1.51. See Mediafire in my sig below this post. In the HOSTED folder.
Also availabe for 30 days from my Sendspace, also below this post.
Or direct link to MediaFire here:- http://www.mediafire.com/file/amek5s...00311.zip/file

Dll's for avs v2.58, avs/+ x86 and x64.
+ source and project files for VS 2008.
Requires CPP runtimes 2008.

Removed ASM as suggested by Pinterf several posts ahead, no need for Intel compiler for x64 anymore.
__________________
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 March 2020 at 23:46.
StainlessS is online now   Reply With Quote
Old 15th March 2020, 18:16   #73  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,132
StainlessS, thank you very much for taking the time to update this plugin! I've tried it out for a few things and all seems to be well .
I've updated the wiki also: http://avisynth.nl/index.php/SubtitleEx
Reel.Deel is offline   Reply With Quote
Old 29th March 2020, 16:01   #74  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,665
User fieliapm (not on-site since Oct 2018)

Has posted a few SubtitleEx() related script functions on Github:- https://github.com/fieliapm/avsi4comp
Go up 1 directory to see other available fieliapm stuff.

One of the available items is also posted in devs forum, (VideoInputSource - grab video frame from video capture card or webcam in real-time):- https://forum.doom9.org/showthread.php?t=170311
EDIT: Also here in Avs Usage (OP post only):- https://forum.doom9.org/showthread.p...deoInputSource

I posted this some time ago in that thread (cant remember what I did though, was simple I think):-
Quote:
Originally Posted by StainlessS View Post
Thank you, I've just got it up working on remote machine, and serving to local machine via TcpServer(), Tcpsource(), pair, works fine.
__________________
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 March 2020 at 16:56.
StainlessS is online now   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 18:55.


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