View Single Post
Old 14th January 2014, 06:21   #3  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Okay, so I had some time and I did some test to try to figure out the correct offsets regarding chroma position. Since I want to leave the chroma untouched the alternative is to shift the luma when resizing.
I don't really know what I'm doing so I tried a handful of different offset values.

Just a sample:
Code:
# 1920x1080p Source
DGSource("00042.dgi")

# Processing
Y  = ConvertToY8(matrix="Rec709").Spline36Resize(width/2, height/2, src_left=0.00, src_top=0.00).Subtitle("Y")
Y2 = ConvertToY8(matrix="Rec709").Spline36Resize(width/2, height/2, src_left=0.25, src_top=0.00).Subtitle("Y2")
Y3 = ConvertToY8(matrix="Rec709").Spline36Resize(width/2, height/2, src_left=0.50, src_top=0.00).Subtitle("Y3")
Y4 = ConvertToY8(matrix="Rec709").Spline36Resize(width/2, height/2, src_left=0.50, src_top=0.75).Subtitle("Y4")
Y5 = ConvertToY8(matrix="Rec709").Spline36Resize(width/2, height/2, src_left=1.00, src_top=1.00).Subtitle("Y5")

U = UToY8()
V = VToY8()

Y  = YToUV(U, V, Y)
Y2 = YToUV(U, V, Y2)
Y3 = YToUV(U, V, Y3)
Y4 = YToUV(U, V, Y4)
Y5 = YToUV(U, V, Y5)

Interleave(Y, Y2, Y3, Y4, Y5)
PointResize(width*2, Height*2) # for testing only
ConvertToRGB24(matrix="Rec709")
After all that I think src_left=0.50, src_top=0.75 produced better results (at least to my eyes) although I think it's incorrect. In the end, I'm still left with uncertainty.

Does anyone know the math involved to calculate the correct offsets?

Quote:
Originally Posted by rean View Post
No. It is incorrect code. I tried this way some time ago and got color artifacts (chroma placement)...
To be honest I do not see any obvious color artifacts, if anything the incorrect offsets are hardly noticeable.
Reel.Deel is offline   Reply With Quote