PDA

View Full Version : how to get rid of this type of pixellation ?


badshah
18th August 2007, 05:39
sample - http://www.sendspace.com/file/rivn - 940 KB

Source - DVD-9

Overall Video Bitrate - 1200kbps

2 Pass encoding

Matrice - Didde's Six of Nine HVS.cqm

please help :(

neuron2
18th August 2007, 06:18
"Pixellation" is a nothing word. What exactly are you drawing our attention too?

badshah
18th August 2007, 08:23
"Pixellation" is a nothing word. What exactly are you drawing our attention too?

if u see clip in full screen mode u can clearly see square pixells all over the screen ... though here is a pic

http://i9.tinypic.com/4u2zi91.png

I have used fft3dfilter(sigma=3) thats why the effect is low ... but its still visible

if i remove that, quality will be even more horrible

halsboss
18th August 2007, 09:29
Hmm, just a guess, maybe something like this prior to filtering ?


ConvertToYV12(interlaced=FALSE)
Deblock_QED_MT2() #default quant1=20
#Deblock_QED_MT2(quant1=25)
#Deblock_QED_MT2(quant1=30)
#Deblock_QED_MT2(quant1=35)
Deblock_QED_MT2(quant1=40)


this is my copy of Deblock_QED_MT2 although I'm not sure if it's the latest :-

function Deblock_QED_MT2 ( clip clp, int "quant1", int "quant2",
\ int "aOff1", int "bOff1", int "aOff2", int "bOff2", int "uv" )
{
# MT2 version ( hopefully the right one from http://avisynth.org/mediawiki/Wiki/Deblock_QED )
# 26/01/2007 comments added per http://forum.doom9.org/showthread.php?p=944459#post944459
# 26/01/2007 extra checks added per http://forum.doom9.org/showthread.php?p=933643#post933643

quant1 = default( quant1, 20 )
quant2 = default( quant2, 40 )
aOff1 = default( aOff1, quant1/2 ) # I've no clue if these are clever values or not!
bOff1 = default( bOff1, quant1/4 ) # So:
aOff2 = default( aOff2, quant1/4 ) # Also try all these 4 values @ 0 (zero),
bOff2 = default( bOff2, quant1/8 ) # and quant1=30, quant2=40~45 instead.
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()
#--- 26/01/2007 start per http://forum.doom9.org/showthread.php?p=944459#post944459
# Deblock_QED is fully based on Deblock() (implementation of H.264 deblocking,
# contained in DGDecode / older MVTools / Fizick's stand-alone plugin)
# Deblock() has the parameters "quant", "aOff" and "bOff".
# How these work has been discussed in several threads, do a search.
# In Deblock_QED(), the meaning of these parameters is exactly the same.
# The difference is that Deblock_QED internally uses two different instances of deblock() -
# one for block borders, and one for block interiors.
# That's why the function has those "xxx1" and "xxx2" parameters.
# Very roughly,
# "quant1" can be seen as "strength" for borders
# "quant2" can be seen as "strength" for block interiors
# "bOff1" is "sensitivity to detect blocking" for borders
# "bOff2" is "sensitivity to detect blocking" for block interiors
# "aOff1" is halfway "sensitivity", halfway a strength modifier for borders
# "aOff2" is halfway "sensitivity", halfway a strength modifier for block interiors
#--- 26/01/2007 end

#--- 26/01/2007 start per http://forum.doom9.org/showthread.php?p=933643#post933643
Assert(clp.isplanar(),"Deblock_QED_MT2: Requires planar YUV (YV12, YV16, YV24, Y8).")
Assert(clp.width() % 8 == 0 && clp.height() % 8 == 0,"Deblock_QED_MT2: Requires mod8 video.")
#--- 26/01/2007 end

ox = clp.width()
oy = clp.height()

# With avisynth scripting, there is no information available about the position of the currently
# processed pixel ... there simply is no such thing like an "actual" processed pixel.
# So first I've to build up a grid covering the transitions between all 8x8 blocks,
# and make some LUTmania with it later. Yes, this is cumbersome.

block = blankclip(clp,width=6*4,height=6*4,color=$000000).addborders(4,4,4,4,color=$FFFFFF)
block = stackhorizontal( block,block,block,block)
block = stackvertical( block,block,block,block) .pointresize(32,32) .mt_binarize(upper=false)
block = stackhorizontal( block,block,block,block,block,block,block,block)
block = stackvertical( block,block,block,block,block,block)
block = stackhorizontal( block,block,block)
block = stackvertical( block,block,block)
block = stackhorizontal( block,block,block)
block = stackvertical( block,block)
#return clp.subtitle(string(block.width)+"x"+string(block.height))
block = block .crop(0,0,ox,oy)
block = (uv!=3) ? block
\ : YtoUV(block.crop(0,0,ox/2,oy/2),block.crop(0,0,ox/2,oy/2),block)
block = block.trim(1,1) .loop(framecount(clp))

# create normal deblocking (for block borders) and strong deblocking (for block interiour)
normal = clp.deblock(quant=quant1,aOffset=aOff1,bOffset=bOff1)
strong = clp.deblock(quant=quant2,aOffset=aOff2,bOffset=bOff2)

# build difference maps of both
normalD = mt_makediff(clp,normal,chroma=uv>2?"process":"ignore")
strongD = mt_makediff(clp,strong,chroma=uv>2?"process":"ignore")

# separate border values of the difference maps, and set the interiours to '128'
strongD2 = mt_lutxy(StrongD,block,expr="y 255 == x 128 ?",U=uv,V=uv)
normalD2 = mt_lutxy(normalD,block,expr="y 255 == x 128 ?",U=uv,V=uv)

# interpolate the border values over the whole block: DCTFilter can do it. (Kiss to Tom Barry!)
# (Note: this is not fully accurate, but a reasonable approximation.)
strongD3 = strongD2.mt_lut(expr="x 128 - 1.01 * 128 +",U=uv,V=uv).dctfilter(1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0)# .yv12lut("x 128 - 2 / 128 +")

# apply compensation from "normal" deblocking to the borders of the full-block-compensations calculated
# from "strong" deblocking ...
strongD4 = mt_lutxy(strongD3,normalD2,expr="y 128 == x y ?",U=uv,V=uv)

# ... and apply it.
deblocked= mt_makediff(clp,strongD4,chroma=uv>2?"process":"ignore")

# simple decisions how to treat chroma
deblocked = (uv<0) ? deblocked.mergechroma(strong) : uv<2 ? deblocked.mergechroma(normal) : deblocked

deblocked
return( last )
}

CWR03
18th August 2007, 11:10
What you're indicating is quite normal in Xvid encoding, particularly with large areas of similar color as in your sample shot. It can be lessened, but you'll never get rid of it completely. Higher bitrate helps.

badshah
18th August 2007, 12:09
What you're indicating is quite normal in Xvid encoding, particularly with large areas of similar color as in your sample shot. It can be lessened, but you'll never get rid of it completely. Higher bitrate helps.

how can I lessen it, besides going for higher bitrate. :o

Terranigma
18th August 2007, 16:34
how can I lessen it, besides going for higher bitrate. :o
You can hide it with grain or noise. Try out blockbuster (Avisynth filter) in dither mode.

Sharktooth
18th August 2007, 16:34
1 - using a "soft" matrix (jawor's 1CD for example)
2 - disabling AQ (it does hurt when there is blocking)
3 - using zones to differentiate quantization in particularly blocky scenes
4 - blockbuster avisynth filter
5 - rising compressibility with avisynth filters
6 - using post processing (deblock) while watching it

badshah
18th August 2007, 18:37
thank you everyone ... and thank you sharktooth ... I will try out ur solutions ! :)