Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffv1: remove pred{16,32}.go and use type parameterized deriveBorders #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions ffv1/genhbd

This file was deleted.

8 changes: 2 additions & 6 deletions ffv1/pred.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package ffv1

// This file is used as a template for pred16.go (high bit depth median prediction)
// Please run 'go generate' if you modify the following function.
//
//go:generate ./genhbd 16
//go:generate ./genhbd 32
// This file implements 8, 16 and 32 bit depth median prediction.

// Calculates all the neighbouring pixel values given:
//
Expand Down Expand Up @@ -36,7 +32,7 @@ package ffv1
//
// See: * 3.1. Border
// * 3.2. Samples
func deriveBorders(plane []uint8, x int, y int, width int, height int, stride int) (int, int, int, int, int, int) {
func deriveBorders[U interface{ uint8 | uint16 | uint32 }](plane []U, x int, y int, width int, height int, stride int) (int, int, int, int, int, int) {
var T int
var L int
var t int
Expand Down
59 changes: 0 additions & 59 deletions ffv1/pred16.go

This file was deleted.

59 changes: 0 additions & 59 deletions ffv1/pred32.go

This file was deleted.

4 changes: 2 additions & 2 deletions ffv1/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ func (d *Decoder) decodeLine(c *rangecoder.Coder, gc *golomb.Coder, s *slice, fr
if d.record.bits_per_raw_sample == 8 && d.record.colorspace_type != 1 {
T, L, t, l, tr, tl = deriveBorders(buf, x, y, w, h, stride)
} else if d.record.bits_per_raw_sample == 16 && d.record.colorspace_type == 1 {
T, L, t, l, tr, tl = deriveBorders32(buf32, x, y, w, h, stride)
T, L, t, l, tr, tl = deriveBorders(buf32, x, y, w, h, stride)
} else {
T, L, t, l, tr, tl = deriveBorders16(buf16, x, y, w, h, stride)
T, L, t, l, tr, tl = deriveBorders(buf16, x, y, w, h, stride)
}

// See pred.go for details.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/dwbuiten/go-ffv1

go 1.12
go 1.18