Source File
idct.go
Belonging Package
image/jpeg
package jpeg
const blockSize = 64 // A DCT block is 8x8.
type block [blockSize]int32
const (
w1 = 2841 // 2048*sqrt(2)*cos(1*pi/16)
w2 = 2676 // 2048*sqrt(2)*cos(2*pi/16)
w3 = 2408 // 2048*sqrt(2)*cos(3*pi/16)
w5 = 1609 // 2048*sqrt(2)*cos(5*pi/16)
w6 = 1108 // 2048*sqrt(2)*cos(6*pi/16)
w7 = 565 // 2048*sqrt(2)*cos(7*pi/16)
w1pw7 = w1 + w7
w1mw7 = w1 - w7
w2pw6 = w2 + w6
w2mw6 = w2 - w6
w3pw5 = w3 + w5
w3mw5 = w3 - w5
r2 = 181 // 256/sqrt(2)
)
for := 0; < 8; ++ {
:= * 8
if [1] == 0 && [2] == 0 && [3] == 0 &&
[4] == 0 && [5] == 0 && [6] == 0 && [7] == 0 {
:= [0] << 3
[0] =
[1] =
[2] =
[3] =
[4] =
[5] =
[6] =
[7] =
continue
}
:= ([0] << 11) + 128
:= [4] << 11
:= [6]
:= [2]
:= [1]
:= [7]
:= [5]
:= [3]
[0] = ( + ) >> 8
[1] = ( + ) >> 8
[2] = ( + ) >> 8
[3] = ( + ) >> 8
[4] = ( - ) >> 8
[5] = ( - ) >> 8
[6] = ( - ) >> 8
[7] = ( - ) >> 8
}
:= [ : +57 : +57] // Small cap improves performance, see https://golang.org/issue/27857
:= ([8*0] << 8) + 8192
:= [8*4] << 8
:= [8*6]
:= [8*2]
:= [8*1]
:= [8*7]
:= [8*5]
:= [8*3]
[8*0] = ( + ) >> 14
[8*1] = ( + ) >> 14
[8*2] = ( + ) >> 14
[8*3] = ( + ) >> 14
[8*4] = ( - ) >> 14
[8*5] = ( - ) >> 14
[8*6] = ( - ) >> 14
[8*7] = ( - ) >> 14
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |