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 27th August 2021, 12:18   #1281  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,375
Yes I know, but as I was suggested you can help the rounding by declaring more float values or like in the example I posted adding or substracting epsilon

I would like to know where I can read more about this, precisely related to the Expr rounding method, and if this also affects summation and not only multiplications.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 29th August 2021, 19:41   #1282  |  Link
RRD
Registered User
 
RRD's Avatar
 
Join Date: Nov 2009
Location: France
Posts: 21
On https://avs-plus.net/, at the bottom of the page, "You can find us on our Doom9 thread" links to the old thread instead of the new one.
RRD is offline   Reply With Quote
Old 7th September 2021, 20:12   #1283  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,375
Since mid-grey in YUV (128) is not centered within the range (16-235), is it ok that range conversions don't keep mid-grey? Converting from TV range 128 to PC range leads to 130, and the opposite to 126. Shouldn't we compensate for that?
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 7th September 2021, 20:52   #1284  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,654
"Mid-grey" is different in TV range than in PC range, just as black and white are. No need for compensation, I think.

Also bearing gamma in mind it's not even really "mid".
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 7th September 2021, 21:58   #1285  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,375
I thought mid-grey for PC levels was also 128, at least for sRGB. I wasn't talking about scene referred middle grey.
Here's a little experiment, ColorYUV "correctly" converts mid grey to PC range 130, but then when converting that to RGB it keeps 130 when RGB mid-grey is known to be 128 for sRGB.
Code:
BlankClip(width=256,height=256,color=$828282,pixel_type="YV12")
ColorYUV(levels="TV->PC",matrix="Rec709")
ConvertToPlanarRGB(matrix="PC.709")
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 7th September 2021, 22:39   #1286  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,320
Can Avisynth+ support sequential function calling in scripting with freeing memory after each return ? I trying to make full-frame 1080p (and need 2160p) rasterizer of text for shifting with Animate(). Text is rendered with Subtitle and 100x SSAA with small blocks, but number of blocks is about 12 and system died with swapping at 4 GB memory PC. I think it is because all calls to function with Subtitle() and Overlay() are performed in parallel for each frame ? May exist solution for serializing ?

I can not even fill 1080p frame with text - I trying to render blocks of 132 lines into raw files for later stacking.

Current script:
Code:
LoadPlugin("plugins_JPSDR.dll")

function Ast1(clip c, int iFontSize, string strText, string strFont, float fHPos, int iVPos)
{
  iHSubPos=fHPos*10 - (10*Int(fHPos)) 
  temp=BlankClip(c, width=8000, height=(iFontSize*15)+40, color=$101010)
  temp=Subtitle(temp, strText, x=iHSubPos, font=strFont, size=iFontSize*10, align=4, halo_color=$FF000000, text_color=$00e0e0e0)
  temp=UserDefined2ResizeMT(temp, temp.width/10, temp.height/10, b=130,c=23)
  return Overlay(c, temp, Int(fHPos), iVPos)
}

function Ast2(clip c, int iFontSize, string strText, string strFont, float fHPos, int iVPos)
{
  iHSubPos=fHPos*10 - (10*Int(fHPos)) 
  temp=BlankClip(c, width=8000, height=(iFontSize*15)+60, color=$101010)
  temp=Subtitle(temp, strText, x=iHSubPos, font=strFont, size=iFontSize*10, align=4, halo_color=$FF000000, text_color=$00e0e0e0)
  temp=UserDefined2ResizeMT(temp, temp.width/10, temp.height/10, b=95,c=-10)
  return Overlay(c, temp, Int(fHPos), iVPos)
}

function MyFullFrameTextH(clip c, string strText, float fHPos, int iVShift)
{
  c=Ast1(c, 10, strText, "Arial", fHPos + 10, iVShift + 20)
  c=Ast1(c, 10, strText, "Times New Roman", fHPos + 70, iVShift + 20)
  c=Ast1(c, 10, strText, "Wolfgang Amadeus Mozart", fHPos + 130, iVShift + 20)

  c=Ast1(c, 20, strText, "Arial", fHPos + 180, iVShift + 20)
  c=Ast1(c, 20, strText, "Times New Roman", fHPos + 300, iVShift + 20)
  c=Ast1(c, 20, strText, "Wolfgang Amadeus Mozart", fHPos + 410, iVShift + 20)

  c=Ast1(c, 35, strText, "Arial", fHPos + 490, iVShift + 20)
  c=Ast1(c, 35, strText, "Times New Roman", fHPos + 690, iVShift + 20)
  c=Ast1(c, 35, strText, "Wolfgang Amadeus Mozart", fHPos + 880, iVShift + 20)

  c=Ast1(c, 50, strText, "Arial", fHPos + 1000, iVShift + 20)
  c=Ast1(c, 50, strText, "Times New Roman", fHPos + 1280, iVShift + 20)
  c=Ast1(c, 50, strText, "Wolfgang Amadeus Mozart", fHPos + 1550, iVShift + 20)

  c=Ast2(c, 10, strText, "Arial", fHPos + 10, iVShift + 80)
  c=Ast2(c, 10, strText, "Times New Roman", fHPos + 70, iVShift + 80)
  c=Ast2(c, 10, strText, "Wolfgang Amadeus Mozart", fHPos + 130, iVShift + 80)

  c=Ast2(c, 20, strText, "Arial", fHPos + 180, iVShift + 80)
  c=Ast2(c, 20, strText, "Times New Roman", fHPos + 300, iVShift + 80)
  c=Ast2(c, 20, strText, "Wolfgang Amadeus Mozart", fHPos + 410, iVShift + 80)

  c=Ast2(c, 35, strText, "Arial", fHPos + 490, iVShift + 80)
  c=Ast2(c, 35, strText, "Times New Roman", fHPos + 690, iVShift + 80)
  c=Ast2(c, 35, strText, "Wolfgang Amadeus Mozart", fHPos + 880, iVShift + 80)

  c=Ast2(c, 50, strText, "Arial", fHPos + 1000, iVShift + 80)
  c=Ast2(c, 50, strText, "Times New Roman", fHPos + 1280, iVShift + 80)
  c=Ast2(c, 50, strText, "Wolfgang Amadeus Mozart", fHPos + 1550, iVShift + 80)
  
  return c

}

function MyFullFrameTextH_upper(clip c, string strText, float fHPos, int iVShift)
{
  c=Ast1(c, 10, strText, "Arial", fHPos + 10, iVShift + 20)
  c=Ast1(c, 10, strText, "Times New Roman", fHPos + 70, iVShift + 20)
  c=Ast1(c, 10, strText, "Wolfgang Amadeus Mozart", fHPos + 130, iVShift + 20)

  c=Ast1(c, 20, strText, "Arial", fHPos + 180, iVShift + 20)
  c=Ast1(c, 20, strText, "Times New Roman", fHPos + 300, iVShift + 20)
  c=Ast1(c, 20, strText, "Wolfgang Amadeus Mozart", fHPos + 410, iVShift + 20)

  c=Ast1(c, 35, strText, "Arial", fHPos + 490, iVShift + 20)
  c=Ast1(c, 35, strText, "Times New Roman", fHPos + 690, iVShift + 20)
  c=Ast1(c, 35, strText, "Wolfgang Amadeus Mozart", fHPos + 880, iVShift + 20)

  c=Ast1(c, 50, strText, "Arial", fHPos + 1000, iVShift + 20)
  c=Ast1(c, 50, strText, "Times New Roman", fHPos + 1280, iVShift + 20)
  c=Ast1(c, 50, strText, "Wolfgang Amadeus Mozart", fHPos + 1550, iVShift + 20)

  return c

}

function MyFullFrameTextH_lower(clip c, string strText, float fHPos, int iVShift)
{
  c=Ast2(c, 10, strText, "Arial", fHPos + 10, iVShift + 80)
  c=Ast2(c, 10, strText, "Times New Roman", fHPos + 70, iVShift + 80)
  c=Ast2(c, 10, strText, "Wolfgang Amadeus Mozart", fHPos + 130, iVShift + 80)

  c=Ast2(c, 20, strText, "Arial", fHPos + 180, iVShift + 80)
  c=Ast2(c, 20, strText, "Times New Roman", fHPos + 300, iVShift + 80)
  c=Ast2(c, 20, strText, "Wolfgang Amadeus Mozart", fHPos + 410, iVShift + 80)

  c=Ast2(c, 35, strText, "Arial", fHPos + 490, iVShift + 80)
  c=Ast2(c, 35, strText, "Times New Roman", fHPos + 690, iVShift + 80)
  c=Ast2(c, 35, strText, "Wolfgang Amadeus Mozart", fHPos + 880, iVShift + 80)

  c=Ast2(c, 50, strText, "Arial", fHPos + 1000, iVShift + 80)
  c=Ast2(c, 50, strText, "Times New Roman", fHPos + 1280, iVShift + 80)
  c=Ast2(c, 50, strText, "Wolfgang Amadeus Mozart", fHPos + 1550, iVShift + 80)
  
  return c

}


function MyAnimFF(clip c, float fHPos, int VPos)
{
 temp=MyFullFrameTextH_upper(c, " TXT Sample ", fHPos, VPos)
  return MyFullFrameTextH_lower(temp, " TXT Sample ", fHPos, VPos)
#   MyFullFrameTextH(c, " TXT Sample ", fHPos, VPos)
}

full=BlankClip(501,1920,135,"Y16",fps=25, color=$101010)

Animate(full, 1,500, "MyAnimFF", 50, 0, 1, 0)

ConvertToRGB24()
Attempt to make cut function MyFullFrameTextH(clip c, string strText, float fHPos, int iVShift) into 2 pieces did not helps any - the amount of used memory is the same. The size of intermediate frames for AA operation is max about 8000x810 and it is about 12 MByte in size in Y16 format.

Last edited by DTL; 7th September 2021 at 22:43.
DTL is offline   Reply With Quote
Old 8th September 2021, 01:08   #1287  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,625
Quote:
Originally Posted by Dogway View Post
I thought mid-grey for PC levels was also 128, at least for sRGB. I wasn't talking about scene referred middle grey.
Here's a little experiment, ColorYUV "correctly" converts mid grey to PC range 130, but then when converting that to RGB it keeps 130 when RGB mid-grey is known to be 128 for sRGB.
Code:
BlankClip(width=256,height=256,color=$828282,pixel_type="YV12")
ColorYUV(levels="TV->PC",matrix="Rec709")
ConvertToPlanarRGB(matrix="PC.709")


But if you use that assumption , and defining "middle grey" in sRGB as 128,128,128, shouldn't you should start with sRGB ?

RGB 128,128,128 => Y 126 in limited range, Y 128 in full range

So how are you defining "middle grey" in Y ?


Code:
BlankClip(width=256,height=256, color=$808080, pixel_type="RGB24")
ConvertToYV12(matrix="Rec709")
ColorYUV(levels="TV->PC",matrix="Rec709")
ConvertToPlanarRGB(matrix="PC.709")
RGB 128,128,128
poisondeathray is offline   Reply With Quote
Old 8th September 2021, 02:46   #1288  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,375
Well, YUV can also be sRGB (aka PC.709), so it wasn't a fault on my part, but reading on YCbCr I concluded that Y middle grey is actually 125.5.

Coming from analog (full range) RGB where 0.5 is asummed to be middle grey and converting to YUV by 0.5*(235-16)+16 = 125.5

This actually correctly transforms to 127.5 in PC range.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 10th September 2021, 22:16   #1289  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,375
Can this be fixed? Expr() gets the variables mixed in the first example.

Code:
Expr("x[0,0] M^ x[1,0] N^ x[2,0] O^ 
      M N + WA@ O + WB@ N - WB WA + + 4 /","")


Expr("x[0,0] M^ x[1,0] N^ x[2,0] O^ 
      M N + W@ O + X@ N - X W + + 4 /","")
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 11th September 2021, 05:56   #1290  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,473
Quote:
Originally Posted by Dogway View Post
Can this be fixed? Expr() gets the variables mixed in the first example.

Code:
Expr("x[0,0] M^ x[1,0] N^ x[2,0] O^ 
      M N + WA@ O + WB@ N - WB WA + + 4 /","")


Expr("x[0,0] M^ x[1,0] N^ x[2,0] O^ 
      M N + W@ O + X@ N - X W + + 4 /","")
Sure. WA and WB? Anyway that must be an obvious bug, thanks for the report
EDIT: there was a bug with handling multi-letter parameter names ended with @. Fix is coming soon

Last edited by pinterf; 11th September 2021 at 07:21.
pinterf is offline   Reply With Quote
Old 11th September 2021, 07:48   #1291  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,473
Fixed in
Avisynth+ 3.7.1 test build 11 (20210911)
pinterf is offline   Reply With Quote
Old 11th September 2021, 08:51   #1292  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,675
Pinterf,

I found a bug in Overlay when the bitdepth is 16 and opacity is less than 1. Happens in RGB and YUV but the problem goes away at any other lower bitdepths.

Code:
base = Blankclip(width=270, height=69, color=$FFFFFF, pixel_type="YUV444P16")
over = Blankclip(width=270, height=19, color=$FF0000, pixel_type="YUV444P16")
mask = ExtractY(over).mt_lutspa(mode="relative", expr="x range_max *")

Overlay(base, over, mask=mask, x=0, y=3, mode="blend", opacity=.75)
Reel.Deel is offline   Reply With Quote
Old 11th September 2021, 09:41   #1293  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,473
Quote:
Originally Posted by Reel.Deel View Post
Pinterf,
I found a bug in Overlay when the bitdepth is 16 and opacity is less than 1. Happens in RGB and YUV but the problem goes away at any other lower bitdepths.
What processor type do you have?
edit: issue emerges from SSE4.1 and up

Last edited by pinterf; 11th September 2021 at 09:52.
pinterf is offline   Reply With Quote
Old 11th September 2021, 09:52   #1294  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,675
Quote:
Originally Posted by pinterf View Post
What processor type do you have?
Intel i7 4930k. Let me update to the latest test version avs+. I have 3.7 installed right now.

Edit:



Edit 2:

Still the same behavior with latest test version and setting SetMaxCPU("sse3") or less fixes the problem.

Last edited by Reel.Deel; 11th September 2021 at 10:18.
Reel.Deel is offline   Reply With Quote
Old 11th September 2021, 12:38   #1295  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,473
Fixed.
Avisynth+ 3.7.1 test build 12 (20210911)
pinterf is offline   Reply With Quote
Old 11th September 2021, 13:46   #1296  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,212
Wow, so many builds, so little time to upgrade ehehehehe
Thanks for the new version, Ferenc, testing now.
FranceBB is offline   Reply With Quote
Old 11th September 2021, 19:11   #1297  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,375
Quote:
Originally Posted by pinterf View Post
Sure. WA and WB? Anyway that must be an obvious bug, thanks for the report
EDIT: there was a bug with handling multi-letter parameter names ended with @. Fix is coming soon
Thank you! It was hard to work around it, I will test new version and if it works it allows for great optimizations in Expr()
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 11th September 2021, 20:23   #1298  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,675
Quote:
Originally Posted by pinterf View Post
Just tested the new build and the shift is still there. It is not as drastic as before but with opacity < 1 it shifts the overlay image by 6 pixels to the left. Now the shift is consistent, before it would change depending on the opacity value.
Reel.Deel is offline   Reply With Quote
Old 12th September 2021, 06:46   #1299  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,473
Quote:
Originally Posted by Reel.Deel View Post
Just tested the new build and the shift is still there. It is not as drastic as before but with opacity < 1 it shifts the overlay image by 6 pixels to the left. Now the shift is consistent, before it would change depending on the opacity value.
Thanks. I'm curious. Since I accidentally switched off my remote developer PC instead of the actual one over TeamViewer we'll have to wait until Monday.
pinterf is offline   Reply With Quote
Old 12th September 2021, 20:16   #1300  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,675
Quote:
Originally Posted by pinterf View Post
Thanks. I'm curious. Since I accidentally switched off my remote developer PC instead of the actual one over TeamViewer we'll have to wait until Monday.
Excellent way to get off of working on a Sunday

----

I think I found another discrepancy. Using the color presets from here I cannot get the same results in Blankclip; it returns a different color.

Code:
Blankclip(width=132, height=152, color=$9400D3, pixel_type="rgb24") # color_darkviolet
I know it worked in the past but have not needed a colored blankclip in a while.
Reel.Deel is offline   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 01:57.


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