VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 44 of 44
Thread
  1. yes, it is marked correctly in that avisynth script, all clips seams to be fine, except after that last line:
    Code:
    # 4) LAYOUT
    limit=stackhorizontal(checkLevels,stackvertical(checkLuma,checkChroma),IllegalRGB.horizontalreduceby2().subtitle("highlight illegal RGB"))
    return limit
    If I test all clips in script before that end line, clips generated above in the script: checkLevels,checkLuma,checkChroma,IllegalRGB they look fine, only after that last block it changes the color, what could that be?
    Or just:
    Code:
    # 4) LAYOUT
    limit=stackhorizontal(checkLevels,stackvertical(checkLuma,checkChroma),IllegalRGB.subtitle("highlight illegal RGB"))
    return limit
    It's weird, maybe my old avisynth version is problem, don't know, stackvertical is fine, and as soon as I put it as argument inside stackhorizontal, color shifts
    Last edited by _Al_; 8th Nov 2020 at 11:12.
    Quote Quote  
  2. The programmer in me couldn't resist:

    #---------------- FUNCTION © jagabo@videohelp -------------------------------------------------------------------------------
    # https://forum.videohelp.com/threads/360935-Capturing-Correct-Chroma-and-Hue-Levels-Fro...gb#post2289672
    function HighlightIllegalRGB(clip vid, int "color")
    {
    color = default(color, $ff0000)
    badcolor = BlankClip(vid, color=color)
    Subtract(ConvertToYV24(vid), ConvertToYV24(vid).ConvertToRGB().ConvertToYV24())
    absY = Overlay(ColorYUV(off_y=-126), Invert().ColorYUV(off_y=-130), mode="add")
    absU = Overlay(UtoY().ColorYUV(off_y=-128), UtoY().Invert().ColorYUV(off_y=-128), mode="add")
    absV = Overlay(VtoY().ColorYUV(off_y=-128), VtoY().Invert().ColorYUV(off_y=-128), mode="add")
    Overlay(absU,absV, mode="add")
    Overlay(last,absY, mode="add")
    ColorYUV(gain_y=65000)
    Overlay(vid,badcolor,0,0,last).subtitle("Highlight Illegal RGB")
    }

    #---------------- FUNCTION © sharc@videohelp -------------------------------------------------------------------------------
    #https://forum.videohelp.com/threads/399404-Level()-And-Why-Does-It-Also-Modify-Chroma#post2600146
    function HighlightIllegalCbCr(clip vid)
    {
    width = vid.width()
    height = vid.height()
    return Limiter(vid, 16, 235, 16, 240, show="chroma_grey").bilinearresize(width/2, height/2).subtitle("Highlight Illegal Chroma Cb,Cr")
    }


    #---------------- FUNCTION © sharc@videohelp -------------------------------------------------------------------------------
    #https://forum.videohelp.com/threads/399404-Level()-And-Why-Does-It-Also-Modify-Chroma#post2600146
    function HighlightIllegalLumaY(clip vid)
    {
    width = vid.width()
    height = vid.height()
    return Limiter(vid, 16, 235, 16, 240, show="luma_grey").bilinearresize(width/2,height/2).subtitle("Highlight Ilegal Luma Y")
    }

    function HighlightIllegal(clip vid, string "histogram")
    {
    histomode = default(histogram, "levels")
    planar = converttoYV12(vid)
    illegal_rgb = HighlightIllegalRGB(planar)
    illegal_cbcr = HighlightIllegalCbCr(planar)
    illegal_luma = HighlightIllegalLumaY(planar)

    checkLevels = colorYUV(planar, analyze=true).Histogram(histomode).subtitle("Sourc e (filtered)") #Note: The histogram includes the analyze text
    return stackhorizontal(checkLevels, stackvertical(illegal_luma, illegal_cbcr), illegal_rgb.horizontalreduceby2())
    }
    Nothing of this is mine of-course, I just changed the structure to more easily access the different function. HighlightIllegalRGB() will return the inner cube illegal values, HighlightIllegalCbCr() the outer cube illegal values, and HighlightIllegalLumaY() the Luma. If you want them all in a single view, HighlightIllegal() do that. Here's couple of questions to make it better:

    1. What does the color variable in jagbo inner cube method? I didn't pass it as argument to the "HightlightIllegal()" as I wasn't sure what it does. And shouldn't Sharc methods also take that color pick into consideration?

    2. The conversion to Planar object (converttoYV12) - I did it only on "HighlightIllegal(). It means that if you call the method separately, you will have to do it externally. I did so because on other functions I used, it was expected of you to supply the video object in the format they expect (rather then the function do the conversion for you). Does that makes sense?

    3. I calculate the width/height twice, but that's because I want the separated method to work not not being just internal methods.

    4. I wasn't able to make it happen because the image width is not the same and I wasn't sure how to fix it, but It would be nicer to save some real-estate, and have the Histogram and the Ilegall RGB values on the saw vertical Stack. So instead of 3 stacks, you will have 2 (and the proportion of the ilegal rgb values box will be the same as the other checks.

    5. Another thing I don't understand:

    The HighlightBadRGB() I posted assumes limited range rec.601 colors.
    How does I know which range my video use? and if that's based on the source, I assume this should be a parameter to HighlightIllegal()? does it also effect sharc methods?
    Quote Quote  
  3. Originally Posted by Okiba View Post
    1. What does the color variable in jagbo inner cube method?
    It sets the color that indicates the illegal pixels. The default is red. But sometimes you have a picture with a lot of reds so you want to use a different color to mark the illegal pixels.

    Originally Posted by Okiba View Post
    The HighlightBadRGB() I posted assumes limited range rec.601 colors.
    How does I know which range my video use? and if that's based on the source, I assume this should be a parameter to HighlightIllegal()? does it also effect sharc methods?
    Almost all video is limited range YUV. Y 16 to 235, U and V 16 to 240. Full range is a special editing mode which is sometimes used when you need to convert to RGB but don't want to lose YUV values outside those ranges. In the end you almost always want to produce limited range. DVD, Blu-ray, youtube... all are limited range. Some DSLR's produce full range and MJPEG sources are usually full range -- but you'll want to convert to limited range for your final output.

    SD is usually rec.601, HD is usually rec.709.
    Quote Quote  
  4. Oh, pretty cool. It seems Limiter() doesn't allow you to change the "bad color", so there is no way to choose color for the other functions that use Limiter(). So HighlightIllegal will just go with the default and won't use color as parameter. I did however added an option to change your matrix if you use:


    function HighlightIllegal(clip vid, string "histogram", string "matrix")
    {
    histogram_mode = default(histogram, "levels")
    conversion_mode = default(matrix, "Rec601")

    planar = converttoYV12(vid, matrix=conversion_mode)
    illegal_rgb = HighlightIllegalRGB(planar)
    illegal_cbcr = HighlightIllegalCbCr(planar)
    illegal_luma = HighlightIllegalLumaY(planar)

    checkLevels = colorYUV(planar, analyze=true).Histogram(histogram_mode).subtitle(" Source (filtered)") #Note: The histogram includes the analyze text
    return stackhorizontal(checkLevels, stackvertical(illegal_luma, illegal_cbcr), illegal_rgb.horizontalreduceby2())
    }
    Quote Quote  
  5. I didn't upload it but I just used a separate function for rec.709, HighlightBadRGBHD().
    Quote Quote  
  6. custom color can be applied as long as you have mask ready, which could be done similar like using in vapoursynth,
    I do not have avisynth+, that is needed for Expr() function, but it could be something like this:
    Code:
    function HighlightBadLuma(clip vid, int "color")
    {
      color = default(color, $00ff00)
      illegal_luma_mask  = Expr(vid,  "x 16 < x 235 > or 255 0 ?",  format="Y8")
      #or this if above does not work
      #illegal_luma_mask  = Expr(ColorYUV(vid, off_u=-256, off_v=-256).ColorYUV(off_u=128, off_v=128), "x 16 < x 235 > or 255 0 ?",  format="Y8")
      illegal_luma_color   = BlankClip(vid, color=color) 
      return MaskedMerge(vid, illegal_luma_color, illegal_luma_mask)
    }
    Last edited by _Al_; 9th Nov 2020 at 19:51.
    Quote Quote  
  7. I wonder what the difference between AviSynth and (a fork I assume) vapoursynth?
    Quote Quote  
  8. Originally Posted by Okiba View Post
    1. What does the color variable in jagbo inner cube method? I didn't pass it as argument to the "HightlightIllegal()" as I wasn't sure what it does. And shouldn't Sharc methods also take that color pick into consideration?
    Another possibility to make the highlights more eye-catching is to show the video in grayscale

    Limiter(....,show="luma_grey",...)
    Limiter(....,show="chroma_grey",...)

    and in jagabo's function:
    Overlay(vid.grayscale(),......
    Quote Quote  
  9. Originally Posted by Okiba View Post
    I wonder what the difference between AviSynth and (a fork I assume) vapoursynth?
    vs:
    +language is Python, so yo can do lots of magic right in the script, python has a ton of standard library modules available
    +comfortable work with any bitdepth, but avisynth+ allows that as well
    + threading, for example, running QTGMC on SD video runs with 100% of my CPU's by just running basic line, no threading setup necessary like in avisynth
    +nice for developers, you can run script within script as to say, or you can freeze scripts (it is Python) and use it as standalone you can add simple gui if needed, or you need 10 lines of a code to have a preview yourself , sort of this things, but that does not appeal to users that simply want to fix video as they do in avisynth
    +I add this one, it seams not as important but it is: while changing YUV to RGB or RGB to YUV you have to specify matrix or matrix must be stored in props, there is no default behind scenes, so you will not make a mistake (using a defaults) like in avisynth or ffmpeg.

    - no official audio support, version with audio support are not for release just yet, but it might be out there soon
    - not many build in internal functions, so you have to work your way around, something I did in that script, but tons of filters are missing comparing to avs
    - syntax is python, so as a blessing for someone it might be other complain if demanding utter simplicity

    avs:
    +easy syntax
    +tons of build in filters and help how to use them, tradition - enough said, that is why is being used a lot and will be used

    - sometimes you can fall into abyss of filters not being compatible with dependencies, there is many versions out there, but with persistence you will make it work
    Quote Quote  
  10. I actually come from a background of Python, so this sounds super cool to me. I will keep an eye for that. But for the casual things I do - having all the traditional AviSyth plugin is currently better (as while I know Python, Video is not my main thing). It's easier AviSynth have everything wrapped so easily.
    Quote Quote  
  11. yes, stay with it, you have guys like jagabo and others to help,

    I just do this o regular basis,to go from their avs advice's to construct it in vs, sometimes I post those scripts, it is a great learning method, because with vs you have to go with basics.
    Quote Quote  
  12. So here comes a new variant to try.
    The bottom shows the RGB waveforms which provide additional info as to which components (R,G,B) exceed the legal range.
    The script is based on scripts from this forum as discussed before, and from Avisynth/doom9. I hope I did not mess these up too much

    Image
    [Attachment 55799 - Click to enlarge]
    Image Attached Files
    Quote Quote  
  13. Sweetttt. Should really publish it into the AviSynth wiki under plugin if all owners of the code agree...
    Quote Quote  
  14. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    BTW, changing colorspace also screws with color.

    This is yet another reason why DV 4:1:1 used as a conversion format augments VHS tape colors. What I've referred to as "cooked" for years now. Hues and tints change, contrast changes.

    Not too different from rec.6xx/7xx changes.

    With video, everything is push-pull. You cannot change one aspect without affecting another.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!