VideoHelp Forum




+ Reply to Thread
Results 1 to 1 of 1
  1. Member
    Join Date
    Aug 2007
    Location
    Isle of Man
    Search Comp PM
    Hi All,

    Here's a utility for displaying the effect of a specified filter on clip luma to look for clipping and/or banding. It displays the filtered clip and histogram on the right alongside the original clip and histogram on the left. It's useful for testing whether a specific filter would cause clipping or banding of the current luma range, and for visualising luma normalisation and/or dithering settings.

    Click image for larger version

Name:	ShowFilterLumaEffect.png
Views:	170
Size:	1.09 MB
ID:	16743

    The display is actually jagabo's idea. I just wrapped it in a function and parameterised the filter for convenient testing.

    Updated to 1.1.0 - added identifying subtitles on top

    Code:
    #-------------------------------------------
    # ShowFilterLumaEffect 1.1.0
    #   Visualises effect of specified filter on clip luma, with specific emphasis on clipping and/or banding
    #   - displays the filtered clip and histogram alongside the original clip and histogram
    #
    #   Useful when
    #
    #       Testing whether specified filter or function would cause clipping or banding of current luma range
    #           - this is useful when one intends to do initial filtering before normalising the luma range
    #       Normalising clip luma range (provide normalising filter or function as input to the function for visualising results)
    #       Dithering colour banding (provide dithering filter or function as input to the function for visualising results)
    #
    #   ShowFilterLumaEffect(clip c, string filter)
    #
    #       <c>         input clip
    #       <filter>    filter expressed in OOP notation
    #
    #   Usage
    #
    #       # Testing whether specific filter would cause clipping or banding of current luma range
    #       ShowFilterLumaEffect(OpenDMLSource("DV encode test source.avi"), """QTGMC(Preset="Slower").Crop(0, 8, -10, 0).Spline64Resize(720, 576)""")
    #       # Visualising effect of normalising, dithering, etc.
    #       ShowFilterLumaEffect(OpenDMLSource("DV encode test source.avi"), "levels(0, 1.0, 255, 2, 235, coring=false)")
    #
    #   Requirements
    #
    #       input clip must meet specified filter's criteria
    #       filter parameter must be provided in OOP notation
    #
    #   Version history
    #
    #       1.1.0 Francois Visagie
    #           added identifying subtitles
    #
    #       1.0.0 Francois Visagie
    #
    
    function ShowFilterLumaEffect(clip c, string filter) {
        original    = c
        filtered    = Eval("original." + filter)
        orghisto    = original.Histogram(mode="classic").Crop(original.Width(), 0, 0, 0).TurnLeft()
        orghisto    = orghisto.Spline64Resize(original.Width(), orghisto.Height())
        filhisto    = filtered.Histogram(mode="classic").Crop(filtered.Width(), 0, 0, 0).TurnLeft()
        filhisto    = filhisto.Spline64Resize(filtered.Width(), filhisto.Height())
        return(StackHorizontal(StackVertical(orghisto, original.Subtitle("original", align=1)), StackVertical(filhisto, filtered.Subtitle(filter, align=1))))
    }
    I hope you find it useful. Feel free to post any comments or improvements.

    Cheers,
    Francois
    Last edited by fvisagie; 14th Mar 2013 at 14:44.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!