VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    I just found out that according to the creator of Deblock_QED, that function should be used before deinterlacing. The problem is that Delock_QED works only with progressive videos, so he provided this workaround:

    Code:
    par=getparity()
    SeparateFields().PointResize(width,height)
    Deblock_QED()
    AssumeFrameBased()
    SeparateFields()
    Merge(SelectEven(),SelectOdd())
    par ? AssumeTFF() : AssumeBFF()
    Weave()
    I'm trying to make a generic function to be used on every video with interlacing that needs deblocking. I wrote this code:

    Code:
    function Deblock_QED_Interlaced_Source(clip c, int quant1, int quant2)
    {
        par=getparity(c)
        SeparateFields(c).PointResize(c.width, c.height)
        Deblock_QED(c, quant1, quant2)
        AssumeFrameBased(c)
        SeparateFields(c)
        Merge(SelectEven(c),SelectOdd(c))
        AssumeFieldBased(c)
        par ? AssumeTFF(c) : AssumeBFF(c)
        Weave(c)
    }
    
    
    Deblock_QED_Interlaced_Source(30, 30)
    but I got the error "Weave should be applied on field based material. Use AssumeFieldBased() beforehand." Where is the issue?
    Quote Quote  
  2. Where is the issue?
    You are applying Weave on c which was not modified by any of the other lines.
    You might want to read up on variable use and assignments in Avisynth.

    I assume:
    Code:
    function Deblock_QED_Interlaced_Source(clip c, int quant1, int quant2)
    {
        par=getparity(c)
        c = SeparateFields(c).PointResize(c.width, c.height)
        c = Deblock_QED(c, quant1, quant2)
        c = AssumeFrameBased(c)
        c = SeparateFields(c)
        c = Merge(SelectEven(c),SelectOdd(c))
        c  = AssumeFieldBased(c)
        c = par ? AssumeTFF(c) : AssumeBFF(c)
        return Weave(c)
    }
    or
    Code:
    function Deblock_QED_Interlaced_Source(clip c, int quant1, int quant2)
    {
        par=getparity(c)
        c = c.SeparateFields().PointResize(c.width, c.height)
        c = c.Deblock_QED(quant1, quant2)
        c = c.AssumeFrameBased()
        c = c.SeparateFields()
        c = c.Merge(c.SelectEven(),c.SelectOdd())
        c  = c.AssumeFieldBased()
        c = par ? c.AssumeTFF() : c.AssumeBFF()
        return c.Weave()
    }
    is what you are trying to do,.. (didn't test this, but I think I didn't miss anything)

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    Originally Posted by Selur View Post
    Where is the issue?
    You are applying Weave on c which was not modified by any of the other lines.
    You might want to read up on variable use and assignments in Avisynth.

    I assume:
    Code:
    function Deblock_QED_Interlaced_Source(clip c, int quant1, int quant2)
    {
        par=getparity(c)
        c = SeparateFields(c).PointResize(c.width, c.height)
        c = Deblock_QED(c, quant1, quant2)
        c = AssumeFrameBased(c)
        c = SeparateFields(c)
        c = Merge(SelectEven(c),SelectOdd(c))
        c  = AssumeFieldBased(c)
        c = par ? AssumeTFF(c) : AssumeBFF(c)
        return Weave(c)
    }
    or
    Code:
    function Deblock_QED_Interlaced_Source(clip c, int quant1, int quant2)
    {
        par=getparity(c)
        c = c.SeparateFields().PointResize(c.width, c.height)
        c = c.Deblock_QED(quant1, quant2)
        c = c.AssumeFrameBased()
        c = c.SeparateFields()
        c = c.Merge(c.SelectEven(),c.SelectOdd())
        c  = c.AssumeFieldBased()
        c = par ? c.AssumeTFF() : c.AssumeBFF()
        return c.Weave()
    }
    is what you are trying to do,.. (didn't test this, but I think I didn't miss anything)

    Cu Selur
    Thanks, that's what I'm trying to do (deblock interlaced video before deinterlacing). The first code you provided worked, the second one has an error (Invalid arguments to function Merge).
    Quote Quote  
  4. "Invalid arguments to function Merge"
    Code:
    c.Merge(c.SelectEven(),c.SelectOdd())
    needs to be
    Code:
    Merge(c.SelectEven(),c.SelectOdd())
    without the 'c.' at the start.

    Cu Selur

    Ps.: Depending on your content, using QTGMC to deinterlace, then apply Deblock_QED and re-interlace might be better.
    Last edited by Selur; 10th Sep 2024 at 13:03.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  5. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    Originally Posted by Selur View Post
    "Invalid arguments to function Merge"
    Code:
    c.Merge(c.SelectEven(),c.SelectOdd())
    needs to be
    Code:
    Merge(c.SelectEven(),c.SelectOdd())
    without the 'c.' at the start.

    Cu Selur

    Ps.: Depending on your content, using QTGMC to deinterlace, then apply Deblock_QED and re-interlace might be better.
    I hate interlacing and all the troubles it causes. The results of my Avisynth scripts are always progressive. Thanks for help.
    Quote Quote  
  6. I just found out that according to the creator of Deblock_QED, that function should be used before deinterlacing.
    Where? What you linked was a workaround mentioned, if you don't want to deinterlace.
    I can't remember that Didée ever wrote that Deblock_QED should be used before deinterlacing.
    (I think that statement is simply wrong.)

    The results of my Avisynth scripts are always progressive
    then deblock after deinterlacing,..

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  7. Here's my version of deblock_QED_i() for interlaced video. It requires deblock_QED().

    Code:
    function Deblock_QED_i ( clip clp, int "quant1", int "quant2", int "aOff1", int "bOff1", int "aOff2", int "bOff2", int "uv" )
    {
        quant1 = default( quant1, 24 ) # Strength of block edge deblocking
        quant2 = default( quant2, 26 ) # Strength of block internal deblocking
    
        aOff1 = default( aOff1, 1 ) # halfway "sensitivity" and halfway a strength modifier for borders
        aOff2 = default( aOff2, 1 ) # halfway "sensitivity" and halfway a strength modifier for block interiors
        bOff1 = default( bOff1, 2 ) # "sensitivity to detect blocking" for borders
        bOff2 = default( bOff2, 2 ) # "sensitivity to detect blocking" for block interiors
    
        uv    = default( uv, 3 )    # u=3 -> use proposed method for chroma deblocking
                                    # u=2 -> no chroma deblocking at all (fastest method)
                                    # u=1|-1 -> directly use chroma debl. from the normal|strong deblock()
    
        last=clp
        par=getparity()
        SeparateFields().PointResize(width,height)
        Deblock_QED(last, quant1, quant2, aOff1, aOff2, bOff1, bOff2, uv)
        AssumeFrameBased()
        SeparateFields()
        Merge(SelectEven(),SelectOdd())
        par ? AssumeTFF() : AssumeBFF()
        Weave() 
    }
    Quote Quote  



Similar Threads

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