Log in

View Full Version : Visualization YUV pixel difference (quality comparison)


NoX1911
8th August 2011, 23:08
Hi,
this is a script to compare raw pixel differences divided into Y and UV (somewhat amplified). Greylevel pictures have been used (no difference = 128 luma [0..255]) that were inverted/added to get both "sides" of greylevel picture. I'm not 100% sure if its correct or can be optimized any further. Any ideas or suggestions?

http://www.abload.de/thumb/compare-quality---yuv-0jtc.jpg (http://www.abload.de/img/compare-quality---yuv-0jtc.jpg)
# Amplify
AmpYUV=2048
AmpY=8

##########

File1=FFVideoSource("Original.mp4")
File2=FFVideoSource("Compressed.mp4")

Diff=Subtract(File1,File2)

#Y
DiffY=Overlay(Diff,Diff.invert(),x=0,y=0,mode="lighten",opacity=1).ColorYUV(off_y=-128).Levels(0,1,256/AmpY,0,255,coring=false).greyscale()

#YUV
#DiffYUV=DiffY.MergeChroma(Diff.ColorYUV(cont_u=AmpYUV,cont_v=AmpYUV))

#UV
DiffYUV=Diff.ColorYUV(off_y=-255,cont_u=AmpYUV,cont_v=AmpYUV)

T=StackHorizontal(File1,File2)
B=StackHorizontal(DiffYUV,DiffY).ColorYUV(levels="PC->TV")
StackVertical(T,B)

jmac698
9th August 2011, 01:42
What about this?

T=stackhorizontal(file1,file2)
diff=subtract(file2,file1)
B=stackhorizontal(diff.tweak(sat=2,bright=-255).tweak(bright=126),diff.tweak(cont=2,bright=-126,sat=0))
stackvertical(t,b)

NoX1911
9th August 2011, 02:13
Yep, its much faster but not black based. That Subtract/StackHorizontal/StackVertical is a nice speedup though. Thx.

J_Darnley
12th August 2011, 16:51
You could probably use a single mt_lutxy to make the difference view. Perhaps with something like: x y - abs 8 *