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 18th November 2019, 02:10   #21  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
"YUV422P8" == YV16. YUY2 and YV16 are both 4:2:2 formats, but YV16/YUV422P8 is planar (and is what AviSynth+ works in for 4:2:2, internally) and YUY2 is not.
qyot27 is offline   Reply With Quote
Old 18th November 2019, 09:19   #22  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 29
There is "planar" and there is "interleaved". So can someone explain the difference to me?
astronob is offline   Reply With Quote
Old 18th November 2019, 15:23   #23  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by astronob View Post
There is "planar" and there is "interleaved". So can someone explain the difference to me?
Planar is the regular one; it's what the majority of encoders expect, it's what 4:2:2 based formats like XDCAM use.

yv16 is 4:2:2 planar.

YUY2 is 4:2:2 interleaved; it dates back many years ago when Avisynth only had support for yv12 and YUY2. YUY2 was the first way to have 4:2:2 support inside Avisynth as yv12 was 4:2:0 planar. Since we didn't officially have support, YUY2 was a "workaround" to introduce support to have more precision. As a matter of fact, many filters back then were supporting yv12 only and were quickly ported to YUY2. Later on, the official 4:2:2 planar support arrived (yv16) along with 4:4:4 planar (yv24). Everything I've been talking about is 8bit.

Now I'm gonna confuse you a bit (sorry about that).

The situation described above with everything in planar and only 4:2:2 available in both planar (yv16) and interleaved (YUY2) has been what we have been using for years and with time people stopped using interleaved in favor of planar except for a few old filters that still required interleaved (but since the conversion between yv16 and YUY2 was lossless, nobody cared). The reason why I said that I'm gonna confuse you a bit is that after this configuration, people were seeking more precision 'cause high bit depth arrived. Since Avisynth was working with 8bit only, what was invented back then was 16bit stacked, namely a 16bit with 8bit MSB and 8bit LSB stacked one on top of the other. This allowed people to have much more precision in their calculations and in particular in operations like denoise, debanding etc. Most importantly, it was possible to index 10bit and above sources and maintain 10bit precision by having 16bit stacked (MSB and LSB stacked one on top of the other). This whole project was called "Dither_Tools". At the same time, another developer started working on an alternative solution for the "high bit depth problem" and he "invented" 16bit interleaved which was pretty much the same as stacked but this time MSB and LSB were inteleaved one with the other. 16bit stacked was often called "Double Height" 'cause MSB and LSB were stacked one on top of the other while 16bit interleaved was often called "Double Width" as MSB and LSB were interleaved one with the other. The "antagonist" of Dither_Tools (16bit stacked) was HDRCore (16bit interleaved) and since those two were developed at the same time and since there wasn't official high bit depth support for Avisynth (16bit planar), developers were left in the dark and started supporting one or the other or both. For instance, f3kdb supports 16bit stacked and 16bit interleaved but not planar (although there has been a recent fork called f3kdb neo which dropped support to stacked and interleaved and introduced support to planar just to confuse things further). Eventually, developers started supporting Dither_Tools more and it became more popular than 16bit interleaved. Many years later (2016), the development of the official Avisynth project stopped and the repository froze. As a consequence, people migrated to Avisynth+ which is a project that aimed to introduce many renovations inside Avisynth and one of them was official planar high bit depth support which superseded 16bit stacked and 16bit interleaved. Unfortunately, though, we're at a point in which many filters were already supporting either 16bit stacked or interleaved and developers didn't bother to support planar and this is where we are now: many filters were ported to support planar high bit depth, but many others are still relying on stacked and/or interleaved.

I probably repeated this story thousands of times as it's very confusing for a lot of people who join the Avisynth community in recent times but have not been part of the "change" as it's extremely difficult to get around all those particular things.
All this is actually documented on the wiki: http://avisynth.nl/index.php/ConvertStacked
Anyway, I understand that it still creates a lot of confusion among new people who join this wonderful encoding world.

Last edited by FranceBB; 18th November 2019 at 15:30.
FranceBB is online now   Reply With Quote
Old 18th November 2019, 17:59   #24  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Avisynth Colorspaces on Wiki (there is probably a graphic somewhere):- http://avisynth.nl/index.php/Color_spaces

Wikipedia:- https://en.wikipedia.org/wiki/YUV

VLC:- https://wiki.videolan.org/YUV

Greenend Image Formats:- http://www.chiark.greenend.org.uk/do...pi/pixfmt.html

M$:- https://docs.microsoft.com/en-us/win...ideo-rendering
M$ hi bit:- https://docs.microsoft.com/en-us/win...-video-formats
__________________
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 21st November 2019, 10:09   #25  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Of the denoising I tried, the two methods I preferred for the sample from post #8 were QTGMC in progressive mode or TemporalDegrain (the original version, not TemporalDegrain2). They both settle the picture wobble a bit.

FFVideoSource("E:\sheena-easton-machinery-small-sample.mov", threads=1, colorspace="YUV420P8")
QTGMC(InputType=1, EzDenoise=3)
CropResize(0,0, 16,4,-16,-4, NoResize=true, InDAR=15.0/11.0)
QTGMC.mkv

FFVideoSource("E:\sheena-easton-machinery-small-sample.mov", threads=1, colorspace="YUV420P8")
TemporalDegrain()
CropResize(0,0, 16,4,-16,-4, NoResize=true, InDAR=15.0/11.0)
TemporalDegrain.mkv
hello_hello is offline   Reply With Quote
Old 21st November 2019, 23:28   #26  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Something I was playing with [req avs+]
Code:
vFN="D:\WORK\Sheena Easton machinery small sample.mov"
BITS10=false        # Bit Depth, true=10 ::: True requires TemporalDegrain2(), false can change to TemporalDegrain().
#
CROP_X = 10         # Crop
CROP_Y = 0
CROP_W = -14
CROP_H = -0
#
DOLEV0=False        # Levels on C0, QTGMC
DOLEV1=False        # Levels on C1, TemporalDegrain
DOLEV2=True         # Levels on C2, McDegrainSharp
#
LEV_IPLO = 32       # Levels, Set using 8 bit TV range (SrcY is about 32 -> 255, ie hi and low too bright)
LEV_GAM  = 1.0
LEV_IPHI = 255
LEV_OPLO = 16
LEV_OPHI = 235
#
C2FRAMES=2            # For McDegrainSharp (1->3, 1=default, 3=max denoise)
ORG_LIMIT_TV = False  # Limit Output to TV_Range
C0_LIMIT_TV  = True
C1_LIMIT_TV  = True
C2_LIMIT_TV  = True
#
SUBS         = True  # Show subs
RET          = 3     # 0=C0, 1=C1, 2=C2, 3=Stack4
########### END CONFIG ##########
CSP=(BITS10) ? "YUV420P10" :  "YV12"    # FFVideoSource failed with Colorspace="YUV420P8", so using "YV12" [Unknown Colorspace, or similar].
LEV_SHFT = BITS10 ? 2 : 0
LEV_IPLO=BitLShift(LEV_IPLO,LEV_SHFT)
LEV_IPHI=BitLShift(LEV_IPHI,LEV_SHFT)
LEV_OPLO=BitLShift(LEV_OPLO,LEV_SHFT)
LEV_OPHI=BitLShift(LEV_OPHI,LEV_SHFT)
#
LIM_YLO =BitLShift(16, LEV_SHFT)
LIM_YHI =BitLShift(235,LEV_SHFT)
LIM_UVLO=BitLShift(16, LEV_SHFT)
LIM_UVHI=BitLShift(240,LEV_SHFT)
###########
FFIndex(vFN)
c=FFVideoSource(vFN, threads=1, colorspace=CSP)
a=FFAudioSource(vFN)
AudioDubEx(c,a)
Crop(CROP_X,CROP_Y,CROP_W,CROP_H)
#return Info
ORG=Last
OrgLev=Levels(LEV_IPLO,LEV_GAM,LEV_IPHI,LEV_OPLO,LEV_OPHI,coring=false) # NOT Applied to ORG
C0 = DOLEV0 ? OrgLev : ORG
C1 = DOLEV1 ? OrgLev : ORG
C2 = DOLEV2 ? OrgLev : ORG
#
C0=C0.QTGMC(InputType=1, EzDenoise=3)
C1=C1.TemporalDegrain2()
C2=C2.McDegrainSharp(frames=C2FRAMES)
#
ORG=(ORG_LIMIT_TV) ? ORG.Limiter(LIM_YLO,LIM_YHI,LIM_UVLO,LIM_UVHI) : ORG
C0 =(C0_LIMIT_TV)  ?  C0.Limiter(LIM_YLO,LIM_YHI,LIM_UVLO,LIM_UVHI) : C0
C1 =(C1_LIMIT_TV)  ?  C1.Limiter(LIM_YLO,LIM_YHI,LIM_UVLO,LIM_UVHI) : C1
C2 =(C2_LIMIT_TV)  ?  C2.Limiter(LIM_YLO,LIM_YHI,LIM_UVLO,LIM_UVHI) : C2
#
ORG=(SUBS)?ORG.Subtitle("ORG")             : ORG
C0 =(SUBS)?C0.Subtitle("C0.QTGMC")          : C0
C1 =(SUBS)?C1.Subtitle("C1.TemporalDegrain") : C1
C2 =(SUBS)?C2.Subtitle("C2.McDegrainSharp")  : C2
(Ret==0) ? C0 : (Ret==1) ? C1 : (Ret==2) ? C2 : StackVertical(StackHorizontal(ORG,C0),StackHorizontal(C1,C2))
# for MeGUI
MeGUI_darX=4                    # Whatever, Preset DAR for MeGUI
MeGUI_darY=3
(BITS10)?ConvertBits(16):NOP    # MeGUI requirement for 10 bit
ConvertToYUV420()
#info
Return last
__________________
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 November 2019 at 23:44.
StainlessS is offline   Reply With Quote
Old 22nd November 2019, 10:05   #27  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 29
Hi hello_hello & StainlesS, I got Temporaldegrain2 to eventually work, and quite liked the output. IMO, the de-grain is similar to the original Temporaldegrain, but it retains more detail, as others have noted. Fastdegrain is good too, certainly encoding is faster, but I did notice some detail was lost, as has been noted. MCDegrainsharp, at it's highest settings, is very slow and does remove practically all the grain, but too much detail is lost for my liking at the highest setting, things like skin tones become overly smoothed and "fake" looking. Ultimately everything is a tradeoff I guess, the big downside with using these filters at their highest settings is that encoding times slow to an absolute crawl, not even 1fps, and I never found personally, any increase in speed from using Avisynth+ in MT mode either. Ultimately, what I would like to see, is the developers somehow harnessing the power of the GPU to do some or all of the encoding, rather than just the CPU. The processing power of today's modern GPU's is just phenomenal. That is an area of development with great potential to improve these abysmally slow encoding times with these filters.
astronob is offline   Reply With Quote
Old 22nd November 2019, 10:43   #28  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Below, McDegrainSharp, 1st & 2nd tests 8 bit, 3rd 10 bit.
1st MCDegrainSharp Frames=2, 10.69FPS.
2nd MCDegrainSharp Frames=1, 18.68FPS.
3rd MCDegrainSharp Frames=1, 10Bit, 12.34FPS.
All with levelling, and also TV_Levels Limiting (for better compression).
Can also adjust sharpness[EDIT: "csharp"=0.6, I sometimes use 0.33] in McDegrainSharp, if required [or not use Sharp, ie Use McDegrain() instead].
Timing with AvsMeter on Core Duo Quad 2.88GHz CPU.
Of course, does not take encode time into account, but that is something else.



EDIT: McDegrainSharp blurs [hides] bad MC compensated areas, and sharpens good matching areas.

EDIT: Above without any kind of attempt at MT, I never use it.

EDIT:
MeGUI @ 10Bit, CRF=20.0, Slower, Audio=96Kb/s, 4.85 FPS, CPU @ 98.0%
[EDIT: FPS was still getting faster due to pause near start in MeGUI, clip was not long enough for better timing, guess that it might have hit about 5.5FPS if longer]


EDIT:
Added this after Audiodub and before any cropping/levelling etc
Code:
AudioDubEx(c,a)
Last++Last++Last++last # *4
Last++Last++Last       # *12
Crop(CROP_X,CROP_Y,CROP_W,CROP_H)
Made 12 times longer clip, 2:39, and re-encode as prev 10 bit clip, hit 5.35FPS, not quite as high as I anticipated.


EDIT: I would prefer Frames=2 or 3 with that noisy clip, but usually just use 1.
Those with "trained eyes" see grain as detail, my untrained eyes just see noise
__________________
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; 22nd November 2019 at 14:41.
StainlessS 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 00:11.


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