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

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd December 2020, 08:00   #741  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Pitch value for Y,U,V planes

In case of YUV data like YV12, YV16 I remember to have read that u and V pitches are guaranteed to be equal. In case of YV24 or YUV444 will all 3 planes have identical pitch value?
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 3rd December 2020, 08:05   #742  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by StainlessS View Post
...
Perhaps could do with variation where FourCC = arg type Int. (Or parse and convert style "G3[0][16]" or "G4[0][16]").
I'm planning to implement the second one.
pinterf is offline   Reply With Quote
Old 3rd December 2020, 08:15   #743  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by vcmohan View Post
In case of YUV data like YV12, YV16 I remember to have read that u and V pitches are guaranteed to be equal. In case of YV24 or YUV444 will all 3 planes have identical pitch value?
Yes, they are equal.
pinterf is offline   Reply With Quote
Old 4th December 2020, 00:02   #744  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
I'm planning to implement the second one.
Nice one

Quote:
Yes, they are equal.
Might also be worth mentioning [maybe not for V.C.M, but for others] that pitch can change at every frame, not a clip constant value.

EDIT:
Code:
ColorBars.KillAudio
ConvertToYV12

PitchTortureTest
info
Return Last

Function PitchTortureTest(clip c) { # IanB:- https://forum.doom9.org/showthread.php?p=1628159#post1628159
	c
	A=SelectEvery(4, 0)
	B=SelectEvery(4, 1).AddBorders(0,0,8,0).Crop(0,0,-8,0)
	C=SelectEvery(4, 2).AddBorders(0,0,16,0).Crop(0,0,-16,0)
	D=SelectEvery(4, 3).AddBorders(2,0,22,0).Crop(2,0,-22,0)
	Interleave(A,B,C,D)
}
EDIT:
Quote:
Originally Posted by IanB View Post
You must use the GetPitch() method on each and every PVideoFrame you get.
__________________
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; 4th December 2020 at 00:32.
StainlessS is offline   Reply With Quote
Old 4th December 2020, 00:42   #745  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
# Below all nonsense.
Further to above,
Quote:
Yes, they are equal.
Is it also possible that something similar to PitchTortureTest() could be applied to any of the color channels, even an alpha channel,
so maybe could argue that above quote should maybe read

Quote:
they are usually but not guaranteed equal.
so pitch should be ascertained for each frame and for each every channel, or problems could arrise, however infrequently.
Above maybe true (changable) on source frames only, if using NewVideoFrame(), then all frames same channel are equal,
and if YV24 or YV444 then all frames, all channels, are equal.

I think, maybe, perhaps, ???

I usually use SrcPitchU for V channel too, so maybe I amongst many am potentially wrong too.
Discuss.
EDIT:
[Are PitchU and PitchV, internally the same variable ?]
EDIT: Seems that in v2.58 header, VideoFrame there is a variable pitchUV, so single value for both[in v2.58].

EDIT: and in v2.60
Code:
class VideoFrame {
  volatile long refcount;
  VideoFrameBuffer* const vfb;
  const size_t offset;
  const int pitch, row_size, height;
  const size_t offsetU, offsetV;  // U&V offsets are from top of picture.
  const int pitchUV, row_sizeUV, heightUV;
Am I talkin' crazy above, do say
__________________
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; 4th December 2020 at 01:53.
StainlessS is offline   Reply With Quote
Old 4th December 2020, 01:52   #746  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Got my answer to above daft post, can create separate clips where Y clip, U clip, V clip, all have changable pitch,
but in 'merging' the channels together into single clip - we create a NewVideoFrame which guarantees fixed pitch and copies
source channels into the new fixed pitch clip. Doh!

Code:
ColorBars.KillAudio
ConvertToYV24
ShowFrameNumber
K=Last.BlankClip(Length=1)

Y=(Last).PitchTortureTest.ExtractY                          # differently changing pitch for each channel
U=(K+Last).PitchTortureTest.Trim(1,0).ExtractU              #
V=(K+K+Last).PitchTortureTest.Trim(2,0).ExtractV            #

#Return Y.Info           # Y,      shows pitch change
#Return U.Info           # U as Y, shows pitch change
#Return V.Info           # V as Y, shows pitch change

#Return YtoUV(U,V,Y).info # NO pitch change : Creates and copies into NewVideoFrame() where fixed pitch

H=StackHorizontal(Y.Info,U.Info,V.Info)
Return H.BlankClip.StackVertical(H).Info    # Top shows final fixed return clip pitch, bot individual changing channel pitchs

########
Function PitchTortureTest(clip c) { # IanB:- https://forum.doom9.org/showthread.php?p=1628159#post1628159
    c
    A=SelectEvery(4, 0)
    B=SelectEvery(4, 1).AddBorders(0,0,8,0).Crop(0,0,-8,0)
    C=SelectEvery(4, 2).AddBorders(0,0,16,0).Crop(0,0,-16,0)
    D=SelectEvery(4, 3).AddBorders(2,0,22,0).Crop(2,0,-22,0)
    Interleave(A,B,C,D)
}
Return H.BlankClip.StackVertical(H).Info
# Top shows final fixed return clip pitch, bot individual changing channel pitchs [Y, U, V]


NOTE, ExtractY/U/V does not produce fixed pitch clips, it must just drop unused channels from source and not produce NewVideoFrame().
In shown image @ bottom, Y has pitch of 704, as does U, but V has pitch of 640 [before combining with Stackhorizontal].
__________________
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; 4th December 2020 at 02:49.
StainlessS is offline   Reply With Quote
Old 5th December 2020, 15:10   #747  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Thank you, Ferenc! FFT3D is now working just fine even on 32bit float!
FranceBB is offline   Reply With Quote
Old 8th December 2020, 12:57   #748  |  Link
Fjord
Registered User
 
Join Date: Dec 2005
Location: Denmark
Posts: 52
Crash using AverageB() on YUV422Pxx clips

Calling the internal runtime function AverageB() on a high-bit YUV422Pxx clip (within ScriptClip() or FrameEvaluate()) causes immediate crash of the calling app - either AvsPmod or VirtualDub2. The app just disappears without warning or error message. I assume it is an AviSynth+ bug.

I first encountered this on a ProRes 422 HQ clip, but the script below provides a minimal script below for this reproducible crash, using ColorBarsHD().

The related runtime functions AverageR() and AverageG() work fine on YUV422Pxx clips. AverageB() also works fine on YUV444Pxx clips, so this problems is specific to YUV422Pxx pixel formats. I have confirmed the crash on YUV422P10, YUV422P12, YUV422P16 and YUV422PS clips.

I am using AviSynth+ 3.5 (r3043, master, x86_64), with both AvsPmod v2.6.5.0 (Windows (x86-64) and VirtualDub2 build 44282, on Win10 x64.

Minimal reproducible script:

Code:
# This script crashes AviSynth+ 3.5 (r3043)
# 
ColorBarsHD ( 1024, 576, pixel_type="YUV444P10" ) # 10-bit
ConvertToYUV422()	# change clip to YUV422P10
# show the PixelType
Subtitle("PixelType=" + last.PixelType, Align=9, Size=40)
# show the average value of Blue on each frame (causes crash)
ScriptClip("""
	Subtitle("AverageB=" + String(AverageB()), align=7, size=40)
""")
Return last
You can comment out the line with ConvertToYUV422() to see that AverageB() works ok on YUV444P10. I am not familiar with debugging procedures in these apps, so I hope someone can trace where the problem arises.
Fjord is offline   Reply With Quote
Old 8th December 2020, 13:27   #749  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by Fjord View Post
Calling the internal runtime function AverageB() on a high-bit YUV422Pxx clip (within ScriptClip() or FrameEvaluate()) causes immediate crash of the calling app - either AvsPmod or VirtualDub2. The app just disappears without warning or error message. I assume it is an AviSynth+ bug.
This is a bug, because this AverageX family is not checked against format mismatch errors. So you are not allowed to call AverageB on a YUV clip. Internally it will use the dimensions of the Y plane and can cause memory overread --> exception. If not, it's only pure luck.
pinterf is offline   Reply With Quote
Old 8th December 2020, 16:02   #750  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
EDIT: use test6
Avisynth+ 3.6.2 test6 (20201210)


Code:
20201210 3.6.2-test6
-----------------------
- AviSource: fix test5 regression which refused handling old formats like YV24

20201208 3.6.2-test5
-----------------------
- Resizers: throw error on too small dimensions vs. taps
- Add ShowCRC32 debug filter. Parameters are the same as in ShowFrameNumber
- Overlay: allow 4:1:1 input
- Overlay: fix crash when mask is YUV411 and greymask=false
- Overlay: may work quicker, most input/overlay/mask/output clip format conversions moved to filter constructor
- RemoveAlphaPlane: do nothing on YUY2 instead of throwing an error message
- AviSource: support non-printing characters in fourCC code: allow [number] style, e.g. G3[0][16]
- AviSource: add Y410 (YUVA444P10) format support. Allow 'Y410' pixel_type hints.
- AviSource: decode b64a, b48r, v210, P210, P010, P016, P216, v410, Y416, r210, R10k, v308, v408, Y410 fourCCs natively.
- Fix: Average...: check for valid colorspace (e.g. no AverageB for a YUV clip)
- Add: AverageA
- New: Average...: allow YUY2, RGB24/32/48/64 inputs

20201112 3.6.2-test4
--------------------
- Fix: Overlay: Actual frame of a mask clip would be freed up too early in MT environment
- Fix: ConvertBits to ignore dither parameter instead of throwing error, in a 8 to 8 bit case

Last edited by pinterf; 10th December 2020 at 08:46. Reason: Replace broken version
pinterf is offline   Reply With Quote
Old 8th December 2020, 16:08   #751  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Thanks
kedautinh12 is offline   Reply With Quote
Old 8th December 2020, 16:42   #752  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by pinterf View Post
I added this build to the Universal Installer. Should be handy to switch between versions for testing.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 8th December 2020, 18:42   #753  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Thankyou P & G.
__________________
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 8th December 2020, 18:49   #754  |  Link
Fjord
Registered User
 
Join Date: Dec 2005
Location: Denmark
Posts: 52
[Solved] Crash using AverageB() on YUV422Pxx clips

Quote:
Originally Posted by pinterf View Post
This is a bug, because this AverageX family is not checked against format mismatch errors. ... it will ... cause memory overread --> exception. If not, it's only pure luck.
Thanks. Oops. I had "luck" with AverageR and AverageG, so I "forgot" that it didn't make sense to calculate R, G & B stats on a YUV clip in the first place.
I will convert YUV to RGB [ConvertToPlanarRGB()] before using AverageR/G/B.
Fjord is offline   Reply With Quote
Old 9th December 2020, 08:49   #755  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,782
Quote:
Originally Posted by StainlessS View Post
Thankyou P & G.
Procter & Gamble?!
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 9th December 2020, 19:41   #756  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Parental & Guidance, or Propylene & Glycol (as opposed to V & G).
__________________
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 December 2020 at 19:40.
StainlessS is offline   Reply With Quote
Old 9th December 2020, 23:47   #757  |  Link
gispos
Registered User
 
Join Date: Oct 2018
Location: Germany
Posts: 1,000
Quote:
Originally Posted by pinterf View Post
Avisynth+ 3.6.2.-test5 (20201208)

Code:
20201208 3.6.2-test5
-----------------------
- Resizers: throw error on too small dimensions vs. taps
- Add ShowCRC32 debug filter. Parameters are the same as in ShowFrameNumber
- Overlay: allow 4:1:1 input
- Overlay: fix crash when mask is YUV411 and greymask=false
- Overlay: may work quicker, most input/overlay/mask/output clip format conversions moved to filter constructor
- RemoveAlphaPlane: do nothing on YUY2 instead of throwing an error message
- AviSource: support non-printing characters in fourCC code: allow [number] style, e.g. G3[0][16]
- AviSource: add Y410 (YUVA444P10) format support. Allow 'Y410' pixel_type hints.
- AviSource: decode b64a, b48r, v210, P210, P010, P016, P216, v410, Y416, r210, R10k, v308, v408, Y410 fourCCs natively.
- Fix: Average...: check for valid colorspace (e.g. no AverageB for a YUV clip)
- Add: AverageA
- New: Average...: allow YUY2, RGB24/32/48/64 inputs

20201112 3.6.2-test4
--------------------
- Fix: Overlay: Actual frame of a mask clip would be freed up too early in MT environment
- Fix: ConvertBits to ignore dither parameter instead of throwing error, in a 8 to 8 bit case
Can't open an avisynth script with AviSource. What has changed?

__________________
Live and let live
gispos is offline   Reply With Quote
Old 10th December 2020, 02:56   #758  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by gispos View Post
Can't open an avisynth script with AviSource. What has changed?
Confirmed.
Worked OK in all + versions [prior to 3.6.2 test 5] in latest Groucho2004 Universal Avisynth Installer whotsit.

Import() works as it should though, was quite a surprise to me when I originally found that
AviSource loaded Avs scripts, so I'm no longer surprised any more
__________________
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 December 2020 at 02:59.
StainlessS is offline   Reply With Quote
Old 10th December 2020, 07:30   #759  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by StainlessS View Post
Confirmed.
Worked OK in all + versions [prior to 3.6.2 test 5] in latest Groucho2004 Universal Avisynth Installer whotsit.

Import() works as it should though, was quite a surprise to me when I originally found that
AviSource loaded Avs scripts, so I'm no longer surprised any more
Checking...
pinterf is offline   Reply With Quote
Old 10th December 2020, 08:26   #760  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by pinterf View Post
Checking...
oops, poor old formats like YV24 were forgotten in test5, fix is on the way
pinterf is offline   Reply With Quote
Reply


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 08:55.


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