mirror of https://github.com/status-im/resize.git
Resolve image artifacts due to wrong coefficient index lookup.
This commit is contained in:
parent
581d15cb53
commit
0c6a628df5
14
converter.go
14
converter.go
|
@ -49,7 +49,7 @@ func resizeGeneric(in image.Image, out *image.RGBA64, scale float64, coeffs []in
|
|||
var rgba [4]int64
|
||||
var sum int64
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
coeff := coeffs[ci+i]
|
||||
if coeff != 0 {
|
||||
|
@ -96,7 +96,7 @@ func resizeRGBA(in *image.RGBA, out *image.RGBA, scale float64, coeffs []int16,
|
|||
var rgba [4]int32
|
||||
var sum int32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
coeff := coeffs[ci+i]
|
||||
if coeff != 0 {
|
||||
|
@ -136,7 +136,7 @@ func resizeRGBA64(in *image.RGBA64, out *image.RGBA64, scale float64, coeffs []i
|
|||
var rgba [4]int64
|
||||
var sum int64
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
coeff := coeffs[ci+i]
|
||||
if coeff != 0 {
|
||||
|
@ -184,7 +184,7 @@ func resizeGray(in *image.Gray, out *image.Gray, scale float64, coeffs []int16,
|
|||
var gray int32
|
||||
var sum int32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
coeff := coeffs[ci+i]
|
||||
if coeff != 0 {
|
||||
|
@ -216,7 +216,7 @@ func resizeGray16(in *image.Gray16, out *image.Gray16, scale float64, coeffs []i
|
|||
var gray int64
|
||||
var sum int64
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
coeff := coeffs[ci+i]
|
||||
if coeff != 0 {
|
||||
|
@ -252,7 +252,7 @@ func resizeYCbCr(in *ycc, out *ycc, scale float64, coeffs []int16, offset []int,
|
|||
var p [3]int32
|
||||
var sum int32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
coeff := coeffs[ci+i]
|
||||
if coeff != 0 {
|
||||
|
@ -290,7 +290,7 @@ func nearestYCbCr(in *ycc, out *ycc, scale float64, coeffs []bool, offset []int,
|
|||
var p [3]float32
|
||||
var sum float32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
if coeffs[ci+i] {
|
||||
xi := start + i
|
||||
|
|
10
nearest.go
10
nearest.go
|
@ -43,7 +43,7 @@ func nearestGeneric(in image.Image, out *image.RGBA64, scale float64, coeffs []b
|
|||
var rgba [4]float32
|
||||
var sum float32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
if coeffs[ci+i] {
|
||||
xi := start + i
|
||||
|
@ -89,7 +89,7 @@ func nearestRGBA(in *image.RGBA, out *image.RGBA, scale float64, coeffs []bool,
|
|||
var rgba [4]float32
|
||||
var sum float32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
if coeffs[ci+i] {
|
||||
xi := start + i
|
||||
|
@ -128,7 +128,7 @@ func nearestRGBA64(in *image.RGBA64, out *image.RGBA64, scale float64, coeffs []
|
|||
var rgba [4]float32
|
||||
var sum float32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
if coeffs[ci+i] {
|
||||
xi := start + i
|
||||
|
@ -175,7 +175,7 @@ func nearestGray(in *image.Gray, out *image.Gray, scale float64, coeffs []bool,
|
|||
var gray float32
|
||||
var sum float32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
if coeffs[ci+i] {
|
||||
xi := start + i
|
||||
|
@ -206,7 +206,7 @@ func nearestGray16(in *image.Gray16, out *image.Gray16, scale float64, coeffs []
|
|||
var gray float32
|
||||
var sum float32
|
||||
start := offset[y]
|
||||
ci := (y - newBounds.Min.Y) * filterLength
|
||||
ci := y * filterLength
|
||||
for i := 0; i < filterLength; i++ {
|
||||
if coeffs[ci+i] {
|
||||
xi := start + i
|
||||
|
|
Loading…
Reference in New Issue