Fix wrong colors of resized image.YCbCr images.
Fixes issue #31. The color value of every pixel of the resized image is created from the YCbCr colors of the input image. Therefore each of the three components have the same sample rate. This is the 4:4:4 chroma subsampling and the output images are now created accordingly.
This commit is contained in:
parent
a3789c3aed
commit
dc93e1b98c
|
@ -167,7 +167,7 @@ func Resize(width, height uint, img image.Image, interp InterpolationFunction) i
|
||||||
// accessing the YCbCr arrays in a tight loop is slow.
|
// accessing the YCbCr arrays in a tight loop is slow.
|
||||||
// converting the image to ycc increases performance by 2x.
|
// converting the image to ycc increases performance by 2x.
|
||||||
temp := newYCC(image.Rect(0, 0, input.Bounds().Dy(), int(width)), input.SubsampleRatio)
|
temp := newYCC(image.Rect(0, 0, input.Bounds().Dy(), int(width)), input.SubsampleRatio)
|
||||||
result := newYCC(image.Rect(0, 0, int(width), int(height)), input.SubsampleRatio)
|
result := newYCC(image.Rect(0, 0, int(width), int(height)), image.YCbCrSubsampleRatio444)
|
||||||
|
|
||||||
coeffs, offset, filterLength := createWeights8(temp.Bounds().Dy(), taps, blur, scaleX, kernel)
|
coeffs, offset, filterLength := createWeights8(temp.Bounds().Dy(), taps, blur, scaleX, kernel)
|
||||||
in := imageYCbCrToYCC(input)
|
in := imageYCbCrToYCC(input)
|
||||||
|
@ -409,7 +409,7 @@ func resizeNearest(width, height uint, scaleX, scaleY float64, img image.Image,
|
||||||
// accessing the YCbCr arrays in a tight loop is slow.
|
// accessing the YCbCr arrays in a tight loop is slow.
|
||||||
// converting the image to ycc increases performance by 2x.
|
// converting the image to ycc increases performance by 2x.
|
||||||
temp := newYCC(image.Rect(0, 0, input.Bounds().Dy(), int(width)), input.SubsampleRatio)
|
temp := newYCC(image.Rect(0, 0, input.Bounds().Dy(), int(width)), input.SubsampleRatio)
|
||||||
result := newYCC(image.Rect(0, 0, int(width), int(height)), input.SubsampleRatio)
|
result := newYCC(image.Rect(0, 0, int(width), int(height)), image.YCbCrSubsampleRatio444)
|
||||||
|
|
||||||
coeffs, offset, filterLength := createWeightsNearest(temp.Bounds().Dy(), taps, blur, scaleX)
|
coeffs, offset, filterLength := createWeightsNearest(temp.Bounds().Dy(), taps, blur, scaleX)
|
||||||
in := imageYCbCrToYCC(input)
|
in := imageYCbCrToYCC(input)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user