This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[BUG] VapourSynth Levels filter does not work for RGB24 image streams
#1
Bug 
Using Hybrid Dev version 2020.10.15.1.

Do a VapourSynth Levels filter for a RGB24 png image. (I attached the one I used in the below image, but I've tested it and the problem affects any image stream I've tried so far.)

Turn the Levels filter on for VapourSynth, no need to even adjust anything.

The script inserts some really strange numbers into the in/out levels, and the preview turns to weird hallucination colors.

[Image: cpO27HV.jpg]

This appears to only affect image stream input.

[attachment=1063]
Reply
#2
I see the problem. Smile
Due to some bug Hybrid assumes a 'bit depth' of 24bit for the input and it also identifies the image as RGB32. Wink


Strange thing is that when I open the attached image here it's detected as:
# current color space: RGB24, bit depth: 8, resolution: 1440x1080, fps: 25, color matrix: 709, yuv luminance scale: full, scanorder: progressive
and thus the whole script looks fine:
# Imports
import vapoursynth as vs
core = vs.get_core()
# source: 'C:/Users/Selur/Desktop/Test-AdobeRGB.png'
# current color space: RGB24, bit depth: 8, resolution: 1440x1080, fps: 25, color matrix: 709, yuv luminance scale: full, scanorder: progressive
# Loading C:\Users\Selur\Desktop\Test-AdobeRGB.png using vsImageReader
clip = core.imwri.Read(["C:/Users/Selur/Desktop/Test-AdobeRGB.png"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# Color Adjustment
clip = core.std.Limiter(clip=clip, min=0, max=255)
# adjusting output color from: RGB24 to YUV420P8 for x264Model (i420@8-bit)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_s="full")
# Output
clip.set_output()

Got it, seems like I fixed that yesterday after uploading the dev version.
-> will send you a new link in ~1/2 hour.

Cu Selur
Reply
#3
Seems there is also a problem that 16 bit RGB image imported to Hybrid incorrectly processed as 8 bit RGB24

# Imports
import vapoursynth as vs
core = vs.get_core()
# loading source: /Users/shph/Desktop/No name.tif
# color sampling RGB24@16, matrix:709, scantyp: progressive
# luminance scale PC
# resolution: 800x600
# frame rate: -1 fps
# Loading /Users/shph/Desktop/No name.tif using vsImageReader
clip = core.imwri.Read(["/Users/shph/Desktop/No name.tif"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# adjusting output color from: RGB24 to YUV422P10 for ProResModel (i422)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, matrix_s="709", range_s="full")
# Output
clip.set_output()
Reply
#4
And here is how it looks if i apply Levels to 16 bit image. min_in=4096, max_in=60160 are correct numbers for 16 bit but it should detect it as RGB48 instead of RGB24
# Imports
import vapoursynth as vs
core = vs.get_core()
# loading source: /Users/shph/Desktop/No name.tif
# color sampling RGB24@16, matrix:709, scantyp: progressive
# luminance scale PC
# resolution: 800x600
# frame rate: 25 fps
# Loading /Users/shph/Desktop/No name.tif using vsImageReader
clip = core.imwri.Read(["/Users/shph/Desktop/No name.tif"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# Color Adjustment
clip = core.std.Levels(clip=clip, min_in=4096, max_in=60160, min_out=4096, max_out=60160)
# adjusting output color from: RGB24 to YUV422P10 for ProResModel (i422)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, matrix_s="709", range_s="full")
# Output
clip.set_output()

Same problem with 32 bit imported image:
# Imports
import vapoursynth as vs
core = vs.get_core()
# loading source: /Users/shph/Desktop/No name 32bit.tif
# color sampling RGB32@32, matrix:709, scantyp: progressive
# luminance scale PC
# resolution: 800x600
# frame rate: 25 fps
# Loading /Users/shph/Desktop/No name 32bit.tif using vsImageReader
clip = core.imwri.Read(["/Users/shph/Desktop/No name 32bit.tif"])
clip = core.std.Loop(clip=clip, times=100)
# Input color space is assumed to be RGB24.
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# Color Adjustment
clip = core.std.Levels(clip=clip, min_in=268435456, max_in=-352321536, min_out=268435456, max_out=-352321536)
# adjusting output color from: RGB24 to YUV422P10 for ProResModel (i422)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, matrix_s="709", range_s="full")
# Output
clip.set_output()

Also seems it depends of file format:
8 bit JPEG and TIFF image detected by Levels correctly: "min_in=16, max_in=235"
8 bit PNG image detected by Levels incorrectly: "min_in=1048576, max_in=15400960"
Reply
#5
can you share example images?
Reply
#6
Here are updated test images with different bit depth.
Reply
#7
32bit png should be RGB 24bit + 8bit alpha, right?

Vapoursynth supports the following color spaces:
RGB24 = 8bit per component
RGB27 = 9bit per component
RGB30 = 10bit per component
RGB48 = 16bit per component
RGBH = float half percision
RGBS = single precision
COMPATBGR32 = no clue

Question is how should Hybrid map color types of images?
Reply
#8
Not sure how to generate PNG 32-bit. When i try to export PNG as 32 bit from image editor it give me message: "Images with unsupported bit depth"

For images only need:
RGB24 = 8bit per component
RGB48 = 16bit per component
RGBS = single precision (probably used for 32 bit TIFF file)
Reply
#9
I don't think Hybrid can support 32 bit PNGs or TIFFs since I have no clue which color space to map them in Vapoursynth.
Name        | MediaInfo    | Vapoursynth   
TIFF 8-bit  | RGB 8-bit    | RGB24
TIFF 16-bit | RGB 16-bit   | RGB48
TIFF 32-bit | RGB 32-bit   | RGBS
PNG  8-bit  | RGB 8-bit    | RGB24
PNG  16-bit | RGB 16-bit   | RGB48
JPEG 8-bit  | 4:2:0 8-bit  | YUV420P8
PNG 32-bit  | RGB 32-bit   | ??? (RGBS?)

Okay, I can adjust Hybrid to this,..
Reply
#10
JPEG may be different depending of settings. If enable high quality at export Jpeg became 444. Hybrid can detect 420 and 444 JPEG. Not sure why it detects JPEG as YUV444P8@8 and same time other image formats as RGB24@8. Maybe JPEG is somehow special...

In most cases "high quality" is always enabled in JPEG. Seems i just uncheck it by accident when exported test image.

Have no any idea about how 32-bit PNG works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)