summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/image/vp8/idct.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-07-12 09:39:47 +0000
committerLibravatar GitHub <noreply@github.com>2024-07-12 09:39:47 +0000
commitcde2fb6244a791b3c5b746112e3a8be3a79f39a4 (patch)
tree6079d6fb66d90ffbe8c1623525bb86829c162459 /vendor/golang.org/x/image/vp8/idct.go
parent[chore] Add interaction policy gtsmodels (#3075) (diff)
downloadgotosocial-cde2fb6244a791b3c5b746112e3a8be3a79f39a4.tar.xz
[feature] support processing of (many) more media types (#3090)
* initial work replacing our media decoding / encoding pipeline with ffprobe + ffmpeg * specify the video codec to use when generating static image from emoji * update go-storage library (fixes incompatibility after updating go-iotools) * maintain image aspect ratio when generating a thumbnail for it * update readme to show go-ffmpreg * fix a bunch of media tests, move filesize checking to callers of media manager for more flexibility * remove extra debug from error message * fix up incorrect function signatures * update PutFile to just use regular file copy, as changes are file is on separate partition * fix remaining tests, remove some unneeded tests now we're working with ffmpeg/ffprobe * update more tests, add more code comments * add utilities to generate processed emoji / media outputs * fix remaining tests * add test for opus media file, add license header to utility cmds * limit the number of concurrently available ffmpeg / ffprobe instances * reduce number of instances * further reduce number of instances * fix envparsing test with configuration variables * update docs and configuration with new media-{local,remote}-max-size variables
Diffstat (limited to 'vendor/golang.org/x/image/vp8/idct.go')
-rw-r--r--vendor/golang.org/x/image/vp8/idct.go98
1 files changed, 0 insertions, 98 deletions
diff --git a/vendor/golang.org/x/image/vp8/idct.go b/vendor/golang.org/x/image/vp8/idct.go
deleted file mode 100644
index 929af2cc9..000000000
--- a/vendor/golang.org/x/image/vp8/idct.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package vp8
-
-// This file implements the inverse Discrete Cosine Transform and the inverse
-// Walsh Hadamard Transform (WHT), as specified in sections 14.3 and 14.4.
-
-func clip8(i int32) uint8 {
- if i < 0 {
- return 0
- }
- if i > 255 {
- return 255
- }
- return uint8(i)
-}
-
-func (z *Decoder) inverseDCT4(y, x, coeffBase int) {
- const (
- c1 = 85627 // 65536 * cos(pi/8) * sqrt(2).
- c2 = 35468 // 65536 * sin(pi/8) * sqrt(2).
- )
- var m [4][4]int32
- for i := 0; i < 4; i++ {
- a := int32(z.coeff[coeffBase+0]) + int32(z.coeff[coeffBase+8])
- b := int32(z.coeff[coeffBase+0]) - int32(z.coeff[coeffBase+8])
- c := (int32(z.coeff[coeffBase+4])*c2)>>16 - (int32(z.coeff[coeffBase+12])*c1)>>16
- d := (int32(z.coeff[coeffBase+4])*c1)>>16 + (int32(z.coeff[coeffBase+12])*c2)>>16
- m[i][0] = a + d
- m[i][1] = b + c
- m[i][2] = b - c
- m[i][3] = a - d
- coeffBase++
- }
- for j := 0; j < 4; j++ {
- dc := m[0][j] + 4
- a := dc + m[2][j]
- b := dc - m[2][j]
- c := (m[1][j]*c2)>>16 - (m[3][j]*c1)>>16
- d := (m[1][j]*c1)>>16 + (m[3][j]*c2)>>16
- z.ybr[y+j][x+0] = clip8(int32(z.ybr[y+j][x+0]) + (a+d)>>3)
- z.ybr[y+j][x+1] = clip8(int32(z.ybr[y+j][x+1]) + (b+c)>>3)
- z.ybr[y+j][x+2] = clip8(int32(z.ybr[y+j][x+2]) + (b-c)>>3)
- z.ybr[y+j][x+3] = clip8(int32(z.ybr[y+j][x+3]) + (a-d)>>3)
- }
-}
-
-func (z *Decoder) inverseDCT4DCOnly(y, x, coeffBase int) {
- dc := (int32(z.coeff[coeffBase+0]) + 4) >> 3
- for j := 0; j < 4; j++ {
- for i := 0; i < 4; i++ {
- z.ybr[y+j][x+i] = clip8(int32(z.ybr[y+j][x+i]) + dc)
- }
- }
-}
-
-func (z *Decoder) inverseDCT8(y, x, coeffBase int) {
- z.inverseDCT4(y+0, x+0, coeffBase+0*16)
- z.inverseDCT4(y+0, x+4, coeffBase+1*16)
- z.inverseDCT4(y+4, x+0, coeffBase+2*16)
- z.inverseDCT4(y+4, x+4, coeffBase+3*16)
-}
-
-func (z *Decoder) inverseDCT8DCOnly(y, x, coeffBase int) {
- z.inverseDCT4DCOnly(y+0, x+0, coeffBase+0*16)
- z.inverseDCT4DCOnly(y+0, x+4, coeffBase+1*16)
- z.inverseDCT4DCOnly(y+4, x+0, coeffBase+2*16)
- z.inverseDCT4DCOnly(y+4, x+4, coeffBase+3*16)
-}
-
-func (d *Decoder) inverseWHT16() {
- var m [16]int32
- for i := 0; i < 4; i++ {
- a0 := int32(d.coeff[384+0+i]) + int32(d.coeff[384+12+i])
- a1 := int32(d.coeff[384+4+i]) + int32(d.coeff[384+8+i])
- a2 := int32(d.coeff[384+4+i]) - int32(d.coeff[384+8+i])
- a3 := int32(d.coeff[384+0+i]) - int32(d.coeff[384+12+i])
- m[0+i] = a0 + a1
- m[8+i] = a0 - a1
- m[4+i] = a3 + a2
- m[12+i] = a3 - a2
- }
- out := 0
- for i := 0; i < 4; i++ {
- dc := m[0+i*4] + 3
- a0 := dc + m[3+i*4]
- a1 := m[1+i*4] + m[2+i*4]
- a2 := m[1+i*4] - m[2+i*4]
- a3 := dc - m[3+i*4]
- d.coeff[out+0] = int16((a0 + a1) >> 3)
- d.coeff[out+16] = int16((a3 + a2) >> 3)
- d.coeff[out+32] = int16((a0 - a1) >> 3)
- d.coeff[out+48] = int16((a3 - a2) >> 3)
- out += 64
- }
-}