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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st January 2014, 12:24   #721  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
@mawen1250,
dither-1.24.0.zip contains this mod which seems to work OK
Code:
Function Dither_replace_string (string str, string findstr, string repstr)
{
	strl     = LCase (str)
	findstrl = LCase (findstr)
	lenf     = StrLen (findstr)

	pos = FindStr (strl, findstrl)
	pos2 = (pos <= 0) ? 1 : pos           # EDIT: seems superflous
	rep  = (pos <= 0) ? "" : LeftStr (str, pos-1) + repstr + Dither_replace_string (MidStr (str, pos + lenf), findstr, repstr)

	return ((pos <= 0) ? str : rep)
}
EDIT: On comparing with your version, the "pos2 = (pos <= 0) ? 1 : pos" line in v1.24.0 seems superflous.
Your version with the added '-1' causes Avisynth halt without producng clip or error message and is not working as you expected.
EDIT: Your version keeps trying to replace the same string over and over again, until it runs out of stack.

EDIT: This
Code:
colorbars

Function Dither_replace_string (string str, string findstr, string repstr)
{
  strl     = LCase (str)
  findstrl = LCase (findstr)
  lenf     = StrLen (findstr)

  pos = FindStr (strl, findstrl)
#  pos2 = (pos <= 0) ? 1 : pos
  rep  = (pos <= 0) ? "" : LeftStr (str, pos-1) + repstr + Dither_replace_string (MidStr (str, pos + lenf), findstr, repstr)

  return ((pos <= 0) ? str : rep)
}

S = " x 32768 <= x x 32768 - ? "
F=" x "
R=" 123 "
O=Dither_replace_string(S,F,R)
RT_DebugF("%s\n%s",S,O)
S2 = " x 32768 <= x  x 32768 - ? "
O2=Dither_replace_string(S2,F,R)
RT_DebugF("%s\n%s",S2,O2)

return Last
Produces this:
Code:
00000013    72.02262115 [1948] RT_DebugF:  x 32768 <= x x 32768 - ?     
00000014    72.02263641 [1948] RT_DebugF:  123 32768 <= 123 x 32768 - ?     # Problem
00000015    72.03427887 [1948] RT_DebugF:  x 32768 <= x  x 32768 - ?    
00000016    72.03430176 [1948] RT_DebugF:  123 32768 <= 123  123 32768 - ?  # OK
AMENDED as per Gavino post below.
__________________
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; 21st January 2014 at 14:21.
StainlessS is offline   Reply With Quote
Old 21st January 2014, 13:03   #722  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by StainlessS View Post
Code:
S2 = " x 32768 <= x  x 32768 - ? "
O2=Dither_replace_string(S,F,R)
RT_DebugF("%s\n%s",S2,O2)
Shouldn't this be S2?

Try F=" x " R=" 123 " and you will see the issue mawen1250 is talking about.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 21st January 2014, 14:12   #723  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by StainlessS View Post
EDIT: Your version keeps trying to replace the same string over and over again, until it runs out of stack.
Only if the search string is a single character.
I think his point is that the way the function is used in Dither_lut16, both the search and replacement strings always have added spaces, so his fix works.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 21st January 2014, 15:54   #724  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Thank you big G, you got me there.
As omission of space could cause problem, how bout this:


Code:
colorbars

Function Dither_replace_string_MOD (string str, string findstr, string repstr) {
    strl        = LCase (str)                   # case independent for FindStr
    findstrl    = LCase (findstr)               # 
    lenf        = StrLen (findstr)
    pos         = FindStr (strl, findstrl)
    lenr        = Strlen(repstr)
    # Below string comparison 'RightStr(repstr,1) == LeftStr(findstr,1)' is case insignificant
    # If last char in replace matches 1st char in find, then 
    # we replace with all but last char of replace, and re-search remainder but with prepended first char of replace.
    rep  = (pos <= 0) 
        \ ? ""
        \ : (lenf>1 && lenr>1 && RightStr(repstr,1) == LeftStr(findstr,1))
            \ ? LeftStr (str, pos-1) + LeftStr(repstr,lenr-1) +  Dither_replace_string_MOD (RightStr(repstr,1) 
                \ + MidStr (str, pos + lenf), findstr, repstr)
            \ : LeftStr (str, pos-1) + repstr + Dither_replace_string_MOD (MidStr (str, pos + lenf), findstr, repstr)
    return ((pos <= 0) ? str : rep)
}

S1 = " x 32768 <= x  x 32768 - ? "
F=" x "
R=" ABC "
O1=Dither_replace_string_MOD(S1,F,R)
RT_DebugF("S1='%s'            :   F='%s'   R='%s'\nO1='%s'\n",S1,F,R,O1)
R="ABC"
O2=Dither_replace_string_MOD(S1,F,R)
RT_DebugF("S1='%s'            :   F='%s'   R='%s'\nO2='%s\n",S1,F,R,O2)

S2 = " x 32768 <= x x 32768 - ? "
F=" x "
R=" ABC "
O3=Dither_replace_string_MOD(S2,F,R)
RT_DebugF("S2='%s'            :   F='%s'   R='%s'\nO3='%s\n",S2,F,R,O3)
R="ABC"
O4=Dither_replace_string_MOD(S2,F,R)
RT_DebugF("S2='%s'            :   F='%s'   R='%s'\nO4='%s\n",S2,F,R,O4)
return Last
Code:
00000005    2.31286550  [2940] RT_DebugF: S1=' x 32768 <= x  x 32768 - ? '            :   F=' x '   R=' ABC '   
00000006    2.31392574  [2940] RT_DebugF: O1=' ABC 32768 <= ABC  ABC 32768 - ? '    
00000007    2.31412077  [2940] RT_DebugF:   
00000008    2.33118415  [2940] RT_DebugF: S1=' x 32768 <= x  x 32768 - ? '            :   F=' x '   R='ABC' 
00000009    2.37454796  [2940] RT_DebugF: O2='ABC32768 <=ABCABC32768 - ?    
00000010    2.37459588  [2940] RT_DebugF:   
00000011    2.39530826  [2940] RT_DebugF: S2=' x 32768 <= x x 32768 - ? '            :   F=' x '   R=' ABC '    
00000012    2.39533472  [2940] RT_DebugF: O3=' ABC 32768 <= ABC ABC 32768 - ?   
00000013    2.39536095  [2940] RT_DebugF:   
00000014    2.40840435  [2940] RT_DebugF: S2=' x 32768 <= x x 32768 - ? '            :   F=' x '   R='ABC'  
00000015    2.41166806  [2940] RT_DebugF: O4='ABC32768 <=ABCx 32768 - ?     
00000016    2.41172385  [2940] RT_DebugF:
so long as repstr surounded by space, no problems.
Not much testing but seems to work. Spot any problems Gavino ?

PS, Whatever happend to the 'quick reply' spell checker when I was on 'vacation' ???

EDIT:
This causes silent crash in Mawen1250 mod, no error message, could be hard to trace bug
Code:
S1 = " x 32768 <= x  x 32768 - ? "
F="x"
R="A"
O1=Dither_replace_string(S1,F,R)
but not above mod which produces this

Code:
00000005    2.15423131  [2144] RT_DebugF: S1=' x 32768 <= x x 32768 - ? '            :   F='x'   R='A'  
00000006    2.15425491  [2144] RT_DebugF: O1=' A 32768 <= A A 32768 - ? '
__________________
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; 21st January 2014 at 17:23.
StainlessS is offline   Reply With Quote
Old 22nd January 2014, 05:02   #725  |  Link
mawen1250
Registered User
 
Join Date: Aug 2011
Posts: 103
The original Dither_replace_string works correctly for pure linear string replacement, but it is only used in Dither_lut16, while the string replacement in Dither_lut16 is somewhat meant to be non-linear...
So the modified Dither_replace_string should be renamed to something like Dither_expr_replace_string IMO.

Last edited by mawen1250; 22nd January 2014 at 05:08.
mawen1250 is offline   Reply With Quote
Old 22nd January 2014, 11:30   #726  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Because there isn’t currently any operator starting with the letter "x", I think replacing " x" instead of " x " in Dither_lut16_expr() is a simpler solution.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 2nd March 2014, 09:37   #727  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Dither 1.25.0:
  • Added a 64-bit version. Source code projects ported to MSVC 2012.
  • Added modes 5–10 to Dither_repair16.
  • Added ref clip to GradFun3.
  • The order of the luma, y, u and v parameters in Dither_merge16 is now the same as in Dither_merge16_8. The documentation has been fixed accordingly.
  • Slight speed improvement in Dither_srgb_display when there is no resizing nor gamma correction.
  • Fixed a problem in Dither_lut16 with expressions containing two consecutive “x” arguments.
  • Fixed artefacts (overflow occuring when input pixels are close to 0) and inaccuracy in mode 20 of Dither_removegrain16.
Edit: important bug found. Please use the version 1.25.1 instead.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 3rd March 2014 at 22:14.
cretindesalpes is offline   Reply With Quote
Old 2nd March 2014, 11:10   #728  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by cretindesalpes View Post
Added a 64-bit version. Source code projects ported to MSVC 2012.
Do you plan to release x64 version for other dll in the package too?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 2nd March 2014, 13:44   #729  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Do you mean avstp.dll? Most likely not. With this 64-bit version, I’m supporting AviSynth+, not the old 64-bit AviSynth which is abandoned. Avs+ already has frame-based multi-threading capabilities, and I’ll probably make avstp use its internal thread pool interface in the future.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 2nd March 2014, 15:07   #730  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by cretindesalpes View Post
Do you mean avstp.dll?
And MVTools too.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 3rd March 2014, 00:49   #731  |  Link
mawen1250
Registered User
 
Join Date: Aug 2011
Posts: 103
It seems plane copy of Dither_merge16 is broken in 1.25.0.
mawen1250 is offline   Reply With Quote
Old 3rd March 2014, 22:11   #732  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Damn! Your’re right. Fixed in Dither 1.25.1
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 5th March 2014, 21:41   #733  |  Link
DeathAngelBR
Registered User
 
Join Date: Nov 2006
Posts: 83
Just wondering... is this the expected encode speed for a Q8400 and 4GB RAM?

(avstp.dll is in the autoload plugin folder)



Code:
setmemorymax(512)

LoadPlugin("D:\Edição de video\MeGUI\tools\dgavcindex\DGAVCDecode.dll")
LoadPlugin("D:\Arquivos de programas\AviSynth 2.5\plugins\removegrain\RemoveGrainSSE2.dll")
LoadPlugin("D:\Arquivos de programas\AviSynth 2.5\plugins\removegrain\RepairSSE2.dll")
LoadPlugin("D:\Arquivos de programas\AviSynth 2.5\plugins\removegrain\RSharpenSSE2.dll")
LoadPlugin("D:\Arquivos de programas\AviSynth 2.5\plugins\outros\mt_masktools-26.dll")
LoadPlugin("D:\Arquivos de programas\AviSynth 2.5\plugins\outros\AddGrainC.dll")
LoadPlugin("D:\Arquivos de programas\AviSynth 2.5\plugins\outros\dither.dll")
Import("D:\Arquivos de programas\AviSynth 2.5\plugins\outros\dither.avs")

AVCSource("I:\BDMV Symphogear G Vol. 2\BDMV\STREAM\00003.dga")
spline64resize(1280,720)
dither_convert_8_to_16()
gradfun3(lsb_in=true,lsb=true,smode=2)
dither_out()
DeathAngelBR is offline   Reply With Quote
Old 5th March 2014, 23:24   #734  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
No idea. If you want to check the speed of the script, use AVSMeter. If you want to check the speed of x264, keep only AVCSource + resize and use 10bit-x264 with 8-bit input.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 6th March 2014, 20:01   #735  |  Link
spawnbsd
Registered User
 
Join Date: Jun 2006
Posts: 30
Quote:
Originally Posted by tormento View Post
And MVTools too.
@ cretindesalpes, any chance we'll get a 64bit mvtools build as well ?
spawnbsd is offline   Reply With Quote
Old 7th March 2014, 08:34   #736  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Not right now. This is a serious beast, and I have things to finish before (porting dfttest and eedi3 to 64-bits/VS/Avs+/high bit depth). But I plan to work on it. I think Myrsloik and tp7 are already poking it too.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 7th March 2014, 13:14   #737  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
are you planning on porting nnedi3 to high bit depth too?
feisty2 is offline   Reply With Quote
Old 9th March 2014, 10:16   #738  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 249
Hello

When I try Martin53's AWB function, i get error " Unable to call Dither_convert_yuv_to_rgb(). Required dither package 1.23.0 or higher installed ? http://forum.doom9.org/showthread.php?p=1386559"

I have writted this short script for checking

LoadPlugin("C:\RT_Stats_25&26_dll_v1.30_20131219\Avisynth26\RT_Stats26.dll")
LoadPlugin("C:\dither-1.25.1\win32\dither.dll")
assert(RT_FunctionExist("""Dither_convert_yuv_to_rgb"""), "Unable to call Dither_convert_yuv_to_rgb().")
return last

I get the same error. I use avisynth 2.60A5 (CVS 20130920, ICL 10).

What is missing ?

Thanks
Bernardd is offline   Reply With Quote
Old 9th March 2014, 10:58   #739  |  Link
the_weirdo
Yes, I'm weird.
 
the_weirdo's Avatar
 
Join Date: May 2010
Location: Southeast Asia
Posts: 271
@Bernardd:

Function Dither_convert_yuv_to_rgb is implemented as a script function in dither.avsi, so you need to import dither.avsi or have it in autoload folder.
__________________
“Never argue with stupid people, they will drag you down to their level and then beat you with experience.” — Mark Twain
the_weirdo is offline   Reply With Quote
Old 9th March 2014, 12:08   #740  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 249
@ the_weirdo :

Thanks for your quick answer. It is ok now.
Bernardd is offline   Reply With Quote
Reply

Tags
color banding, deblocking, noise reduction


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


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