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. |
14th October 2012, 01:00 | #1 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
image reader for VapourSynth
New plugins for VapourSynth r19 or later.
vsimagereader-0.2.1.zip source code https://github.com/chikuzen/vsimagereader helper module to read image sequense Code:
#vsimghelper.py import os import vapoursynth as vs class ImageReader(object): def __init__(self, path): self.core = vs.get_core() try: hasattr(core, 'imgr') except: self.core.std.LoadPlugin(path) def read(self, dir, ext, fpsnum=24, fpsden=1): srcs = [dir + '/' + src for src in os.listdir(dir) if src.endswith(ext)] return self.core.imgr.Read(srcs, fpsnum, fpsden) usage: Code:
>>> import vapoursynth as vs >>> import vsimghelper as ih >>> imgr = ih.ImageReader('/path/to/the/vsimagereader.dll') >>> clip = imgr.read('/path/to/the/image/directory', ext='jpeg') EDIT: 2013/07/31 Release vsimagereader-0.2.1
__________________
my repositories Last edited by Chikuzen; 31st July 2013 at 10:12. |
14th October 2012, 13:39 | #2 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,664
|
Hi Chikuzen, thanks again for another VS plugin.
I know if the width is not mod4, padding will be added, but what color is the padding supposed to be? I assume is black. The reason I ask is because I see both green and black padding. Also, here's the source just in case if you want to try to reproduce the results below. * Edit * Updated to vsjpgreader 0.1.1 Code:
import vapoursynth as vs core = vs.Core() core.std.LoadPlugin(path=r'C:\vsjpgreader.dll') src = core.jpgr.Read(['C:\test.jpg']) # Only used to test YUV440P8 input since VFW/VSFS in not able to output that colorspace. #src = core.resize.Bicubic(clip=src, format=vs.YUV422P8) last = src Code:
Tested through VFW and VSFS using VapourSynth r13 and vsjpgreader 0.1.1. Gimp 2.8 was used for jpg compression. 1) width=597 height=398 4:2:0 Works correctly. Gets padded to 600x398. 4:2:2 YUV440P8. Works correctly. Gets padded to 600x398. 4:2:2 YUV422P8. Works correctly. Gets padded to 600x398. 4:4:4 Works correctly. Gets padded to 600x398. 2) width=598 height=399. 4:2:0 Works Correctly. Gets padded to 600x400. 4:2:2 YUV440P8. works correctly. Gets padded to 600x400. 4:2:2 YUV422P8. works correctly. Gets padded to 600x399. 4:4:4 Works correctly. Gets padded to 600x399. 3) width=599 height=399 4:2:0 Works Correctly. Gets padded to 600x400. 4:2:2 YUV440P8. Works correctly. Gets padded to 600x400. 4:2:2 YUV422P8. Works correctly. Gets padded to 600x399. 4:4:4 Works Correctly. Gets padded to 600x399. 4) width=600 height=400 All input colorspaces work correctly. 5) width=602 height=401 4:2:0 Green diagonal lines appear. Gets padded to 604x402. 4:2:2 YUV440P8. Works correctly. Gets padded to 604x402. 4:2:2 YUV422P8. Green diagonal lines appear. Gets padded to 604x401. 4:4:4 Works correctly. Gets padded to 604x401. 6) width=602 height=402 4:2:0 Green diagonal lines appear. Gets padded to 604x402. 4:2:2 YUV440P8. Works correctly. Gets padded to 604x402. 4:2:2 YUV422P8. Green diagonal lines appear. Gets padded to 604x402. 4:4:4 Works correctly. Gets padded to 604x402. Last edited by Reel.Deel; 15th October 2012 at 22:19. |
14th October 2012, 15:20 | #3 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
@Reel.Deel
Thanks for the report I fixed odd height issue, and updated to 0.1.1. About the color of padding, it is based on the jpeg decode library which is used by this plugin. It seems that the library do padding by zero. so, this is normal behavior.
__________________
my repositories Last edited by Chikuzen; 14th October 2012 at 15:28. |
15th October 2012, 22:51 | #4 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,664
|
I updated my post above to vsjpgreader 0.1.1. While that solved some of the issues, there's still one remaining.
The diagonal lines only appear on image 5 & 6, only on the 4:2:0 and 4:2:2(YUV422P8) colorspace. Last edited by Reel.Deel; 16th October 2012 at 03:50. Reason: grammar |
16th October 2012, 04:05 | #5 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
@Reel.Deel
Updated to 0.1.2. Please try again.
__________________
my repositories |
16th October 2012, 04:48 | #7 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
sorry, I found a typo in code.
updated to 0.1.2-2
__________________
my repositories |
16th October 2012, 05:30 | #9 | Link | |
typo lover
Join Date: May 2009
Posts: 595
|
Quote:
I tested all your 24 samples again. But seems no problem.
__________________
my repositories Last edited by Chikuzen; 16th October 2012 at 06:00. |
|
16th October 2012, 12:42 | #11 | Link | |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,664
|
Quote:
Here's the problematic samples, If someone else wants to reproduce the distorted image through VSFS. ___________ @Kolak Yes, I'm using r13. Last edited by Reel.Deel; 16th October 2012 at 12:56. |
|
16th October 2012, 16:49 | #12 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Quote:
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
16th October 2012, 22:57 | #14 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@Myrsloik,
You may not have a bug here per se', there is some confusion in the world about the line packing of planar YUV formats. Dib derived formats like RGB24, RGB32 and Y800 (Y8, GREY) always have lines that are 32 bit DWORD aligned. There seems to be universal conformance for this. However planar YUV formats are apparently supposed to be packed with the line pitch equal to the rowsize. Some documentation is quite vague on this point. Avery Lee has convinced me it is true and VirtualDub implements this. However a sizeable chunk of the world assume planar lines are 32 bit DWORD aligned. I abandoned the moral high ground in favour of a functional user solution. On input I check the returned full frame size to see if it matches a 32 bit DWORD aligned size and crib the spec accordingly. On output there is the "OPT_AVIPadScanlines" option to force 32 bit DWORD aligned output through the AVIFile interface. |
22nd October 2012, 11:02 | #15 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
I wrote vsbmpreader, and added it to the first post.
__________________
my repositories |
22nd October 2012, 11:03 | #16 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Maybe you should merge them or use a library to make a complete image reader? That'd be really good to have
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
22nd October 2012, 12:11 | #17 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
I will think after writing png and tga about it.
__________________
my repositories |
23rd October 2012, 07:29 | #18 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
added vspngreader to the first post.
__________________
my repositories |
23rd October 2012, 14:04 | #19 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,664
|
@Chikuzen
I was wondering if the 8bit limitation is due to libpng? If not, I think it would be great if it was compatible with 16bit png's. Thanks again for another plugin, will test when I have some free time. @Myrsloik Any update of the problem above? |
23rd October 2012, 14:41 | #20 | Link | ||
typo lover
Join Date: May 2009
Posts: 595
|
Quote:
Quote:
__________________
my repositories Last edited by Chikuzen; 23rd October 2012 at 14:51. |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|