redfordxx
11th May 2006, 23:41
This deblocker attempts and wannabe:
brutal = it can deblock almost everything
adaptive = highly quantized areas will be deblocked & blurred more
high detail = all the real detail should be retained
experimental = there are many ways to use and implement this deblocker's basic idea, it's needed to find the best one
slow = it is now slower than it is necessary (there are ways to speed-up 1/some speed/quality trade off 2/optimization after it is really finished and tuned
not finished = two things: 1/ improve the algorithm coz this is very draft version 2/ lot of tuning necessary
challenge = if you find the idea interesting, I'll be glad for help, because there are things I am only trying to use correctly - example:
1/ DCTFilter - I do not know exactly how it works so I am trying
2/ MPEG codec algorithms - some more knowledge could maybe help somewhere
3/ Tuning on different sources - my hypothesis is that for one person's taste there should be one setting working on all sources.
Principle:
1/ Brutally deblock and smooth everything
2/ Guess quantization of source and produce mask(s) of detail amount
3/ Adaptively restore detail (in three or four stages - in example are four)
2a/ Restore low frequencies everywhere
2b/ Restore medium frequencies in medium quantized areas
2b/ Restore high frequencies in little quantized areas
2b/ Restore original in "nonquantized" areas
Following remarks are mainly for me but if you can help with ideas, welcome:
To do / to solve:
- retain real edges on block borders in highly quantized areas
- high-quantized but still high detail blocks (I guess this can happen due to motion compensation) can be misjudged for low-quantized blocks
- smooth edges correctlywhere is high detail block next to highly quantized block
- do hi-quantized blocks shift average values of high detail neighbours? Shouldn't
- sci-fi?: deringing incorporation, blocks on diagonal edges treatment
- tuning, tuning, tuning
- luma and chroma need probably diferent thresholds...
Questions:
- is DctFilterD better for this than DctFilter?
- is BlockBuster("show") or other filter more suitable for detail detection?
*******************************************
This is first version script:
The parameters are quite fast guessed, probably not enough detail retention. Should be changed.
MaxDeblock.avsi
###############################################
#
# MaxDeblock 0.00000000000000000001 by Redford
#
# imported Patterns.avsi
# plugged mt_masktools.dll
#
###############################################
function MaxDeblock1(clip "orig")
{
b0=orig.BlindPP(quant=31,cpu=4,moderate_h=1, moderate_v=1).Deblock().mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3)
d0=mt_makediff(orig,b0,y=3,u=3,v=3)
d0b=d0#.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c0=d0b.mt_convolution("1 1 1 1 1 1 1","1 1 1 1 1 1 1",y=3,u=3,v=3)
b1=mt_adddiff(b0,c0,y=3,u=3,v=3)
d2=mt_makediff(orig,b1,y=3,u=3,v=3)
d2b=d2#.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c2=d2b.mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3)
b3a=mt_adddiff(b1,c2,y=3,u=3,v=3)
q2=orig.QuantMask(7,0,10,0)#.mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3).mt_lut("x 4 *",y=3,u=3,v=3)
b3=mt_merge(b1,b3a,q2,y=3,u=3,v=3)
d3=mt_makediff(orig,b3,y=3,u=3,v=3)
d3b=d3.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c3=d3b.mt_convolution("1 2 1","1 2 1",y=3,u=3,v=3)
b4a=mt_adddiff(b3,c3,y=3,u=3,v=3)
q3=orig.QuantMask(6,0,10,0).mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3).mt_lut("x 4 *",y=3,u=3,v=3)
b4=mt_merge(b3,b4a,q3,y=3,u=3,v=3)
d4=mt_makediff(orig,b4,y=3,u=3,v=3)
d4b=d4.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c4=d4b
b5a=mt_adddiff(b4,c4,y=3,u=3,v=3)
q4=orig.QuantMask(4,0,10,0).mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3).mt_lut("x 4 *",y=3,u=3,v=3)
b5=mt_merge(b4,b5a,q4,y=3,u=3,v=3)
return(b5)
#return(d0).mt_lut("x 128 - 10 * 128 +",y=3,u=3,v=3)
}
And this (http://forum.doom9.org/showthread.php?p=825073#post825073) is necessary.
brutal = it can deblock almost everything
adaptive = highly quantized areas will be deblocked & blurred more
high detail = all the real detail should be retained
experimental = there are many ways to use and implement this deblocker's basic idea, it's needed to find the best one
slow = it is now slower than it is necessary (there are ways to speed-up 1/some speed/quality trade off 2/optimization after it is really finished and tuned
not finished = two things: 1/ improve the algorithm coz this is very draft version 2/ lot of tuning necessary
challenge = if you find the idea interesting, I'll be glad for help, because there are things I am only trying to use correctly - example:
1/ DCTFilter - I do not know exactly how it works so I am trying
2/ MPEG codec algorithms - some more knowledge could maybe help somewhere
3/ Tuning on different sources - my hypothesis is that for one person's taste there should be one setting working on all sources.
Principle:
1/ Brutally deblock and smooth everything
2/ Guess quantization of source and produce mask(s) of detail amount
3/ Adaptively restore detail (in three or four stages - in example are four)
2a/ Restore low frequencies everywhere
2b/ Restore medium frequencies in medium quantized areas
2b/ Restore high frequencies in little quantized areas
2b/ Restore original in "nonquantized" areas
Following remarks are mainly for me but if you can help with ideas, welcome:
To do / to solve:
- retain real edges on block borders in highly quantized areas
- high-quantized but still high detail blocks (I guess this can happen due to motion compensation) can be misjudged for low-quantized blocks
- smooth edges correctlywhere is high detail block next to highly quantized block
- do hi-quantized blocks shift average values of high detail neighbours? Shouldn't
- sci-fi?: deringing incorporation, blocks on diagonal edges treatment
- tuning, tuning, tuning
- luma and chroma need probably diferent thresholds...
Questions:
- is DctFilterD better for this than DctFilter?
- is BlockBuster("show") or other filter more suitable for detail detection?
*******************************************
This is first version script:
The parameters are quite fast guessed, probably not enough detail retention. Should be changed.
MaxDeblock.avsi
###############################################
#
# MaxDeblock 0.00000000000000000001 by Redford
#
# imported Patterns.avsi
# plugged mt_masktools.dll
#
###############################################
function MaxDeblock1(clip "orig")
{
b0=orig.BlindPP(quant=31,cpu=4,moderate_h=1, moderate_v=1).Deblock().mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3)
d0=mt_makediff(orig,b0,y=3,u=3,v=3)
d0b=d0#.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c0=d0b.mt_convolution("1 1 1 1 1 1 1","1 1 1 1 1 1 1",y=3,u=3,v=3)
b1=mt_adddiff(b0,c0,y=3,u=3,v=3)
d2=mt_makediff(orig,b1,y=3,u=3,v=3)
d2b=d2#.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c2=d2b.mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3)
b3a=mt_adddiff(b1,c2,y=3,u=3,v=3)
q2=orig.QuantMask(7,0,10,0)#.mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3).mt_lut("x 4 *",y=3,u=3,v=3)
b3=mt_merge(b1,b3a,q2,y=3,u=3,v=3)
d3=mt_makediff(orig,b3,y=3,u=3,v=3)
d3b=d3.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c3=d3b.mt_convolution("1 2 1","1 2 1",y=3,u=3,v=3)
b4a=mt_adddiff(b3,c3,y=3,u=3,v=3)
q3=orig.QuantMask(6,0,10,0).mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3).mt_lut("x 4 *",y=3,u=3,v=3)
b4=mt_merge(b3,b4a,q3,y=3,u=3,v=3)
d4=mt_makediff(orig,b4,y=3,u=3,v=3)
d4b=d4.BlindPP(quant=30,cpu=4,moderate_h=30, moderate_v=60)
c4=d4b
b5a=mt_adddiff(b4,c4,y=3,u=3,v=3)
q4=orig.QuantMask(4,0,10,0).mt_convolution("1 1 1 1 1","1 1 1 1 1",y=3,u=3,v=3).mt_lut("x 4 *",y=3,u=3,v=3)
b5=mt_merge(b4,b5a,q4,y=3,u=3,v=3)
return(b5)
#return(d0).mt_lut("x 128 - 10 * 128 +",y=3,u=3,v=3)
}
And this (http://forum.doom9.org/showthread.php?p=825073#post825073) is necessary.