Log in

View Full Version : HBVFWSource.dll - VFW sourcefilter for HighBitDepth YUV


Chikuzen
4th October 2012, 08:53
I wrote a small plugin

HBVFWSource-0.2.2.dll (http://www.mediafire.com/download.php?ac1yk95aw3ui4y1)

https://dl.dropbox.com/u/19797864/forum/hbvfdsource_00.jpg

enjoy!

EDIT:
2012/10/12
updated to 0.2.2

parasa
4th October 2012, 09:33
Awesome work!
That's exactly what I am waiting for!

Keiyakusha
4th October 2012, 13:18
Hi. Thanks for this plugin, but I have some problems:
HBVFWSource-0.1.0.dll (http://imgby.com/CYUBe.png)
HBVFWSource-0.1.1.dll (http://imgby.com/PF8iw.png)

Source is h264 Hi10P. VS produces output as shown in console window. I can't open 1920x1080 video at all - access violation.

P.S. Had hard time uploading images. It seems some hostings don't like doom9 anymore and block links coming from it...

Reel.Deel
4th October 2012, 13:32
The plugin worked for me but I also I had the same problems when I cropped in the vpy script.

Error 1
Avisynth read error:
Avisynth access violation at 0x00002023 in c:\HBVFWSource.dll,
attempting to read from 0x04419000

Error 2
Avisynth read error:
Avisynth access violation at 0x00002023 in c:\HBVFWSource.dll,
attempting to read from 0x04428000

Also when I crop, at the top of the video I see a green line a couple of pixels in height but in full length.

Chikuzen
4th October 2012, 14:13
update to 0.1.2

about access violation, I can't reproduce. please give me the sample and .vpy.

about green line, I noticed that, too.
When P016/P010 is read, V-plane will shift under one line.
Although I reread the code, the cause is not known yet :(

Pat357
4th October 2012, 14:29
With HBVFWSource v0.1.2 I still get access violation 0x00001FB0 in HBVFWSource.dll.

VPY: test11_10b.vpy
import vapoursynth as vs
import sys
core = vs.Core(accept_lowercase=True)
core.std.LoadPlugin(r'k:\programs\ffms2-r725-icl\ffms2.dll')
ret = core.ffms2.Source(r"k:\film\10bit\Madoka_opening_10-bit_1080p.mkv")
last = ret

This test11_10b.vpy plays as 1920x1080 H264 Hi10P video in MPC-HC (with Madvr)

AVS :
LoadPlugin("k:\programs\AviSynth 2.5\special filters\flash3kyuu_deband_1.5.1_x86\flash3kyuu_deband.dll")
LoadPlugin("k:\programs\AviSynth 2.5\special filters\HighBitDepth_VFWSource-0.1.2\HBVFWSource.dll")
# LoadPlugin("")
HBVFWSource("k:\film\Vapoursynth\test11_10b.vpy")
f3kdb_dither(stacked=false, input_depth=10)
info()

What Am I doing wrong ?

Im using AVISynth v2.6.0.3 with the latest "Seth" MT version .DLL.

Chikuzen
4th October 2012, 15:17
ok, reproduced and (maybe) fixed.
I need some more test.
please wait a little.

Reel.Deel
4th October 2012, 15:25
So I think that the access violation is only happening when the video is not mod16.

I loaded my canon dslr video without cropping (1920,1088) and it worked. :)

I also had another dvd file that was letterboxed and the cropping problem that I had earlier was also solved by cropping to mod16 dimensions.

Unfortunately the green bar is still present.

* Edit*

Too slow, seems Chikuzen might of figured it out. :)

Chikuzen
4th October 2012, 15:55
update.
please try v0.1.3

Reel.Deel
4th October 2012, 16:18
Quickly tried with 1080p file and cropping to non mod16. They both work.
Also, no more green bar. Thanks Chikuzen.

Can't test anymore, gotta get to work.:(

Keiyakusha
4th October 2012, 16:46
Yes, seems to be working now. Thanks!

vdcrim
4th October 2012, 16:50
If someone's wondering why AvsPmod shows 'YV12' on the status bar, that's a bug and will be fixed.

Thanks Chikuzen!

Groucho2004
4th October 2012, 17:16
If someone's wondering why AvsPmod shows 'YV12' on the status bar, that's a bug and will be fixed.
From what I can see, AVSPmod simply does not support the new 2.6 interface (AVISYNTH_INTERFACE_VERSION 5). I would hardly call that a bug, rather a limited feature set. ;)

vdcrim
4th October 2012, 17:38
From what I can see, AVSPmod simply does not support the new 2.6 interface (AVISYNTH_INTERFACE_VERSION 5). I would hardly call that a bug, rather a limited feature set. ;)
Let's say 'it will be improved' then :D

Wilbert
4th October 2012, 21:00
@Chikuzen, great stuff! Would you be willing to open source this plugin and vsavsreader?

mastrboy
4th October 2012, 21:02
@Chikuzen, great stuff! Would you be willing to open source this plugin and vsavsreader?

vsavsreader is open already: https://github.com/chikuzen/VS_AvsReader/

VFR maniac
4th October 2012, 21:04
https://github.com/chikuzen

He has already opened their sources.

Keiyakusha
4th October 2012, 21:50
@Chikuzen, great stuff! Would you be willing to open source this plugin and vsavsreader?

You can at least check readme.txt before asking.

Reel.Deel
5th October 2012, 03:04
Hi Chikuzen, just out of curiosity, what was causing the access violation problems?

Chikuzen
5th October 2012, 04:15
Hi Chikuzen, just out of curiosity, what was causing the access violation problems?

I was mistaken in calculation of width of U/V plane.
I'm wondering why 0.1.2 was working depending on some case:p

Reel.Deel
6th October 2012, 18:02
Hi Chikuzen, since HBVFWSource is able to convert Vapoursynth's YUV42xP10/16 format into Dither's interleaved msb/lsb.
I was wondering if is possible to output the stacked msb/lsb also? It can be usefull for futher proccesing.

I tried converting the interleaved format to stacked msb/lsb manually, but I was unsuccessful. Also, I don't know if the results would be *correct*.

* Edit *

I don't know if this is also correct but did manage to output stacked msb/lsb using f3kdb. The thing is I don't want to deband :).

HBVFWSource("16-bit test.vpy")

f3kdb(input_mode=2, input_depth=16, output_mode=1, output_depth=16)

Chikuzen
6th October 2012, 18:36
I was wondering if is possible to output the stacked msb/lsb also?

it is possible for me to add stacked format output mode.
however, Since it will be slower than interleaved mode, I don't want to implement it not much.

HBVFWSource("16-bit test.vpy")
f3kdb(input_mode=2, input_depth=16, output_mode=1, output_depth=16)

f3kdb's manual says "If output_depth = 16, dither algorithm specified by dither_algo won't be applied."
thus, Your purpose is already achieved.

Reel.Deel
6th October 2012, 18:47
f3kdb's manual says "If output_depth = 16, dither algorithm specified by dither_algo won't be applied."
thus, Your purpose is already achieved.

Yeah, I read that too, while no dithering is taking place isn't f3kdb still debanding? I'll read the documentation some more and see if I can come up with a conclusion.

If I find a way to turn interleaved into stacked manually I'll report back. Thanks anyways Chikuzen.

Keiyakusha
6th October 2012, 19:12
Reel.Deel
Set all thresholds/noise generation to 0 if you want to be super sure is does nothing. I did that myself some time ago.

Also this probably works:
turnleft().separatefields()
StackHorizontal(Selectodd(),Selecteven()).Turnright()

Reel.Deel
6th October 2012, 23:34
Set all thresholds/noise generation to 0 if you want to be super sure is does nothing.

Thanks for the suggestion.f3kdb(range=0, y=0, Cb=0, Cr=0, GrainY=0, grainC=0, blur_first=false, input_mode=2, input_depth=16, output_mode=1, output_depth=16)


Also this probably works:
turnleft().separatefields()
StackHorizontal(Selectodd(),Selecteven()).Turnright()

I tried the same thing earlier. Strangely it doesn't work, I guess we must be doing something wrong. :)

Keiyakusha
6th October 2012, 23:42
I tried the same thing earlier. Strangely it doesn't work, I guess we must be doing something wrong. :)
Just checked. Works for me, both solutions give the same result.
edit: but f3kdb approach 2 times faster

Reel.Deel
6th October 2012, 23:49
I just double checked. You're correct, sorry. It only worked when the colorspace YUV420P16 but fails with YUV422P16.Turning interleaved YUV422P16 to Stacked 4:2:2 msb/lsb must be another ballgame. :)

Keiyakusha
7th October 2012, 00:10
I just double checked. You're correct, sorry. It only worked when the colorspace YUV420P16 but fails with YUV422P16.Turning interleaved YUV422P16 to Stacked 4:2:2 msb/lsb must be another ballgame. :)

I see, since you said this, I'm not sure if separatefields approach is correct in respect of chroma...

But I'll post another try anyway. Seems to be working: ;)

SeparateColumns(2)
StackVertical(Selectodd(),Selecteven())

^avisynth 2.6 required

edit: it also ~30% faster than f3kdb

Reel.Deel
7th October 2012, 00:14
It works, thanks for your help Keiyakusha. Lesson learned. :)

Chikuzen
7th October 2012, 07:06
stacked output was implemented.

as I said, that is slower than interleaved mode.
but that may be faster than separatecolumns.

Chikuzen
8th October 2012, 10:28
update to 0.2.1

a bit faster stacked output.

Reel.Deel
8th October 2012, 12:21
Take a look at the bright side. HBVFWSource uses less resources than f3kdb and SeparateColumns.
Thanks again Chikuzen.

Vapoursynth script
import vapoursynth as vs
core = vs.Core(accept_lowercase=True)
core.std.LoadPlugin(path=r'C:\Vapoursynth\FFMS2\ffms2.dll')

# Source is 720p60 YUV420P8
src = core.ffms2.source(source=r"X:\MVI_1597.MOV")
src = core.resize.Spline(clip=src, format=vs.YUV420P16)
last = src

Results using HBVFWSource-0.2.1.

AVSMeter v1.40b3
[AVISynth version]
AviSynth 2.60, build:May 16 2012 [03:31:34]
Active MT Mode: 0


HBVFWSource Interleaved f3kdb Stacked
[Clip info] [Clip info]
Number of frames: 5736 Number of frames: 5736
Length (hh:mm:ss.ms): 00:01:35.694 Length (hh:mm:ss.ms): 00:01:35.694
Frame width: 2560 Frame width: 1280
Frame height: 720 Frame height: 1440
Framerate: 59.940 (60000/1001) Framerate: 59.940 (60000/1001)
Progressive: Yes Progressive: Yes
Colorspace: YV12 Colorspace: YV12


[AVSMeter runtime info] [AVSMeter runtime info]
Frames processed: 5736 Frames processed: 5736
FPS (min | max | avg): 94.3 | 149.0 | 129.5 FPS (min | max | avg): 55.0 | 78.4 | 74.8
CPU usage (average): 87% CPU usage (average): 69%
Physical Memory usage (peak): 389 MB Physical Memory usage (peak): 633 MB
Virtual Memory usage (peak): 393 MB Virtual Memory usage (peak): 637 MB
Time (elapsed): 00:00:44.305 Time (elapsed): 00:01:16.722


[Script] [Script]

HBVFWSource("test.vpy", stacked=false) HBVFWSource("test.vpy", stacked=false)

f3kdb(range=0,y=0,Cb=0,Cr=0,GrainY=0,grainC=0,blur_first=false,input_mode=2,input_depth=16,output_mode=1,output_depth=16)

_________________________________________________________________________________________________________________________________________________________________________________


HBVFWSource Stacked Separate Columns Stacked
[Clip info] [Clip info]
Number of frames: 5736 Number of frames: 5736
Length (hh:mm:ss.ms): 00:01:35.694 Length (hh:mm:ss.ms): 00:01:35.694
Frame width: 1280 Frame width: 1280
Frame height: 1440 Frame height: 1440
Framerate: 59.940 (60000/1001) Framerate: 59.940 (60000/1001)
Progressive: Yes Progressive: yes
Colorspace: YV12 Colorspace: YV12


[AVSMeter runtime info] [AVSMeter runtime info]
Frames processed: 5736 Frames processed: 5736
FPS (min | max | avg): 85.8 | 131.7 | 124.2 FPS (min | max | avg): 35.2 | 91.5 | 88.7
CPU usage (average): 86% CPU usage (average): 64%
Physical Memory usage (peak): 385 MB Physical Memory usage (peak): 613 MB
Virtual Memory usage (peak): 387 MB Virtual Memory usage (peak): 614 MB
Time (elapsed): 00:00:46.194 Time (elapsed): 00:01:04.703


[Script] [Script]

HBVFWSource("test.vpy", stacked=true) HBVFWSource("test.vpy", stacked=false)

SeparateColumns(2)
StackVertical(Selectodd(),Selecteven())

Chikuzen
8th October 2012, 16:20
@Reel.Deel
HBVFWSource is not able to use on avisynth2.5x. (because I need YV16 for P210/P216)
thus, you should use SeparateColumns script on your comparison.
The cost of TurnLeft/Right is quite high.

Reel.Deel
9th October 2012, 05:40
@Chikuzen
Updated to SeparateColumns.

Chikuzen
12th October 2012, 03:33
sorry, I found a very stupid bug.

updated to 0.2.2

Pat357
16th October 2012, 19:37
I removed my post.
It was a false alarm : I made a mistake and I reported it as a bug.
My apologies for this.

Pat357
28th April 2017, 21:42
It seems that this plugin is broken.
My scripts that used to work (https://forum.doom9.org/showthread.php?p=1594176#post1594176), now give an error :
[avisynth @ 025a6e00] Cache: Filter returned invalid response to CACHE_GETCHILD_CACHE_MODE. 87825032
(K:\film\Vapoursynth\hbVFWSource_test.avs, line 6)
K:\film\Vapoursynth\hbVFWSource_test.avs: Unknown error occurred


I also tried the the posted scripts from reel.deel (see https://forum.doom9.org/showthread.php?p=1594778#post1594778), and got the same error.
If I just replace HBVFWSource by VSImport (VapourSource plugin) and replace last in the .vpy script by last.set_output(), everything works !

Any help on this issue would be more than welcome !!