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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th November 2012, 18:21   #21  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 615
fmtconv r2:
  • resample: optimized paths involving float input or output
  • resample: fixed white/magenta screen with 8-bit input and float output
  • bitdepth: implemented fast dither mode (but not in SSE2 yet)
  • bitdepth: optimized float-to-integer path
  • bitdepth: faster dithering when ampo = 1 and ampn = 0
  • matrix: enabled the SSE path for float operations

Note: I'll rename the "bitdepth" argument in the bitdepth() function in "bits" in the next release.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r22 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 18th November 2012 at 18:41.
cretindesalpes is offline   Reply With Quote
Old 19th November 2012, 02:46   #22  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
this is beautiful. thankyou very much.

any speed losses in this plugin are made up for by the parallelism gained from using VS, and it can only get faster. i'm breaking realtime on BD transcodes for the first time ever, and in higher quality than i was ever able to achieve.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 19th November 2012, 02:58   #23  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,576
Quote:
Originally Posted by Mug Funky View Post
any speed losses in this plugin are made up for by the parallelism gained from using VS, and it can only get faster.
I don't understand how this is possible.
If that is true, this means x264 or whatever software you use fails to fill all available CPU resources.
If we assume that A filter twice as fast compared to B filter (both in one thread), then under 100% cpu load A still will be twice faster, regardless of how much threads you put in filter B. Even if B will output result faster, it will eat cycles that otherwise will go to x264, so overall there shouldn't be speed gain or unchanged speed, there should be speed loss.

Last edited by Keiyakusha; 19th November 2012 at 03:05.
Keiyakusha is offline   Reply With Quote
Old 19th November 2012, 07:09   #24  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
i'm comparing to encoding the same blu-ray through avisynth, which is single threaded. often it's the bottleneck when encoding, especially if using intermediate formats (because sometimes x264 isn't the final destination )
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 19th November 2012, 08:33   #25  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,576
Quote:
Originally Posted by Mug Funky View Post
i'm comparing to encoding the same blu-ray through avisynth, which is single threaded. often it's the bottleneck when encoding, especially if using intermediate formats (because sometimes x264 isn't the final destination )
If you were some new user, I could understand this response, but you're not, so it's kind of trolling. Anyhow, I got your point.

Last edited by Keiyakusha; 19th November 2012 at 22:00.
Keiyakusha is offline   Reply With Quote
Old 19th November 2012, 11:42   #26  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
cretindesalpes: thank you for your work. Quick test are promising- all seams to be working well and speed is very good. Are you going to implement adding noise? I found that whatever dithering method you use it's always good put put a bit of noise anyway.

Great job
kolak is offline   Reply With Quote
Old 19th November 2012, 12:12   #27  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
Have crash on these lines:

ret = core.ffms2.Source(source=r'S:\test.mov') -10bit DNxHD source
b= core.fmtc.resample(clip=ret, w=720, h=576)
c= core.fmtc.matrix (clip=b, mats="709", matd="601", col_fam=vs.YUV)
a= core.fmtc.bitdepth (clip=c, bitdepth=8, dmode=3)

It's matrix line, as without it all was working fine.
It also looks like dithering mode=5 does not work at all- video looks like it's without any dithering.

Any idea why (vs R16)?

Last edited by kolak; 19th November 2012 at 15:25.
kolak is offline   Reply With Quote
Old 20th November 2012, 00:19   #28  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 615
I couldn’t reproduce your problems here (with both VS r15 and r16). Your script works and dmode=5 is effective. Are your sure your input is 4:4:4? Matrix needs 4:4:4 to work, but it should issue an error message, not a crash.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r22 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 20th November 2012, 01:01   #29  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
Quote:
Originally Posted by cretindesalpes View Post
I couldn’t reproduce your problems here (with both VS r15 and r16). Your script works and dmode=5 is effective. Are your sure your input is 4:4:4? Matrix needs 4:4:4 to work, but it should issue an error message, not a crash.
No- source is 4:2:2 10bit (most likely YUV422P10 color space).
So I need to add line with conversion to 4:4:4 before matrix?

It crashes Vdub badly- straight away, no log etc.

Another question - how lossless is/can be YUV->RGB->YUV with your tool?
If source is YUV will it stay in YUV for all conversions?

Last edited by kolak; 20th November 2012 at 01:04.
kolak is offline   Reply With Quote
Old 20th November 2012, 01:23   #30  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,576
kolak
Maybe I miss something but you not supposed to open in VDub anything that is not V210 or 8bit formats. Sure it crashes,closes,whatever, it doesn't supports whats coming into it.
Edit: and yes in theory it should give an error, but on practice for me just after some message pops-up, the process terminates.

Last edited by Keiyakusha; 20th November 2012 at 01:26.
Keiyakusha is offline   Reply With Quote
Old 20th November 2012, 01:25   #31  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,035
Quote:
Originally Posted by Keiyakusha View Post
kolak
Maybe I miss something but you not supposed to open in VDub anything that is not V210 or 8bit formats. Sure it crashes,closes,whatever, it doesn't supports whats coming into it.
Stop trolling around. Vdub doesn't crash on unsupported formats. It simply says it can't decode that fourcc.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 20th November 2012, 01:29   #32  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,576
Quote:
Originally Posted by Myrsloik View Post
Stop trolling around. Vdub doesn't crash on unsupported formats. It simply says it can't decode that fourcc.
It does. Not sure if it's a crash or whatever but it stops working
Keiyakusha is offline   Reply With Quote
Old 20th November 2012, 01:35   #33  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
I convert to v210 or YUY2 if I want to see it in Vdub- I know Vdub very well. Read above.
kolak is offline   Reply With Quote
Old 20th November 2012, 08:34   #34  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 615
Quote:
Originally Posted by kolak View Post
No- source is 4:2:2 10bit (most likely YUV422P10 color space).
So I need to add line with conversion to 4:4:4 before matrix?
Yes, just add css="444" in your resample line.

Quote:
Another question - how lossless is/can be YUV->RGB->YUV with your tool?
It's not lossless. For the matrix operation, it will be bound by numerical error noise. So the higher the bitdepth, the better. Anyway a 16-bit chain should be enough to process a 10-bit input.

And if you add inverse and direct chroma subsampling, it will add more errors because of the aliasing and the limited kernel bandwidth. Even using a very large kernel, the losslessness will not be guaranteed.

If you want more chance to recover the original pixels, dither with dmode=1 at the very last step. But if you inserted some operations in your processing like color or level correction, use a real dithering and forget about losslessness.

Quote:
If source is YUV will it stay in YUV for all conversions?
I'm not sure if I correctly understand your question. We now have real high-bitdepth and planar RGB colorspaces in Vapoursynth, so there is no need to use the same tricks as in the Dither tools for Avisynth. When you specify a RGB colorspace in matrix, the clip is really converted to this colorspace.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r22 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 20th November 2012 at 13:36.
cretindesalpes is offline   Reply With Quote
Old 20th November 2012, 12:19   #35  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
If import filter reads file as eg. YUV422P10 and I want to scale it to SD staying in YUV mode is this possible (or will it always go to RGB during internal conversions)?
Like in the case above- DNxHD scaled to PAL with 709->601 conversion- will this stay in YUV ?

I don't want to go to RGB when source file is read as YUV.

Thanks for your clear answers
kolak is offline   Reply With Quote
Old 20th November 2012, 13:12   #36  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 615
Yes of course, resample and matrix will keep the same colorspace family by default. For matrix, you can specify another family as target colorspace.

If your input is YUV422P10 it must be converted to 4:4:4 before applying the matrix, and converted back to 4:2:2 after. This is how it should be done. This will yield a more reliable result than for example ColorMatrix, which processes the chroma without taking the luma into account (well, this is not important for the specific 601<->709 case), and processes the luma by point-resizing the chroma on the fly. This approximation is fast but not very accurate.

If resampling the chroma twice is not acceptable for you, there is another possibility, a bit more complex to set up: use the basic 4:4:4 conversion to generate the luma plane, resample the luma to match exactly the initial chroma (half-sized 4:4:4) to generate the chroma planes, and merge the resulting planes.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r22 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 20th November 2012 at 13:34.
cretindesalpes is offline   Reply With Quote
Old 20th November 2012, 13:17   #37  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
Well- if it stays in YUV or RGB depending on incoming format by default, than this is good for me

I did try YUV->RGB->YUV but it end up quite far from being lossless.

Source is YUY2, than:

ret= core.fmtc.resample(clip=ret, css="444")
ret= core.fmtc.matrix (clip=ret, mat="601", col_fam=vs.RGB)
ret= core.fmtc.matrix (clip=ret, mat="601", col_fam=vs.YUV)
ret= core.fmtc.resample (clip=ret, css="422")
ret = core.fmtc.bitdepth (clip=ret, bitdepth=8, dmode=1)

dmode=-1 keeps crashing.
kolak is offline   Reply With Quote
Old 20th November 2012, 13:37   #38  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 615
Hmm right it's dmode=1 now, it was -1 in the Dither tools for avisynth so I got confused. I fixed my previous message. Also, for this kind of stuff, you can resample with a better kernel than the default (a 8-tap Blackman for example).
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r22 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 20th November 2012 at 13:39.
cretindesalpes is offline   Reply With Quote
Old 20th November 2012, 13:53   #39  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
Are all kernels as in dither, should I look in dither docs? I used spline36 I think (it was just a guess ).

Sorry- I used spline36 when I tested resizing.
kolak is offline   Reply With Quote
Old 20th November 2012, 14:55   #40  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,117
Hi cretindesalpes, like always thank you very much for another awesome tool.
For testing purposes only, I used one of your resizing examples in the Dither documentation. I don't know if I'm doing something wrong but I'm getting some strange results.

Example in Dither doc:
Code:
Sharpening the luma using the convolver of the resizer: 
 
Dither_convert_8_to_16 () 
Dither_resize16 (Width (), Height () / 2, kernel="impulse -1 6 -1", 
\                fh=-1, fv=-1, cnorm=true, center=false, y=3, u=2, v=2) 
DitherPost ()
My Script:
Code:
import vapoursynth as vs 
import sys 
core = vs.Core() 
 
# Load Plugins 
core.std.LoadPlugin(path=r'C:\Vapoursynth\FMTConv\fmtconv.dll') 
core.avs.LoadPlugin(path=r'C:\AviSynth 2.5\plugins\DGDecodeNV.dll') 
 
# Blu-ray source cropped to 1920x1080 by DGSource
src = core.avs.DGSource(dgi=r'X:\Test.dgi') 
  
# Processing 
src = core.fmtc.resample(clip=src, w=960, h=540, impulse="-1 6 -1", fh=-1, fv=-1, cnorm=1, css="420", planes="3,2,2", center=2) 
src = core.fmtc.bitdepth(clip=src, bitdepth=8) 
 
# VDub Output 
last = src
The problems I'm encountering:
Sometimes it opens without resizing at all.
Sometimes it resizes to 960x1080 or to 1920x540.
Sometimes (rare) it resizes correctly.
But most of the time VDub gives me the following error:
Quote:
Avisynth open failure:
python exception: 'resample: argument clip is required'
I tried removing some parameters to try to find the problem. The following still produces the problems mentioned above.
Code:
..... 
src = core.fmtc.resample(clip=src, w=960, h=540, impulse="-1 6 -1") 
src = core.fmtc.bitdepth(clip=src, bitdepth=8) 
.....
I'm using VS r16 on 32-bit Windows XP SP3.

*edit*
Using the following, the correct results are more consistent but the other problems still remain.
Code:
src = core.fmtc.resample(clip=src, w=1920, h=540, impulse="-1 6 -1")

Last edited by Reel.Deel; 20th November 2012 at 16:20. Reason: username misspelling
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 19:04.


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