mirror of https://bitbucket.org/ausocean/av.git
filter: benchmark: change from wiriting output to file, to wiritng to dummy struct
This commit is contained in:
parent
d7fa988272
commit
87498f125d
|
@ -25,18 +25,9 @@ LICENSE
|
||||||
package filter
|
package filter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
outBasic = "testout/test_outBasic.mjpeg"
|
|
||||||
outDiff = "testout/test_outDiff.mjpeg"
|
|
||||||
outKNN = "testout/test_outKNN.mjpeg"
|
|
||||||
outMOG = "testout/test_outMOG.mjpeg"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
debug = false
|
debug = false
|
||||||
motionDownscaling = 1
|
motionDownscaling = 1
|
||||||
|
@ -57,9 +48,15 @@ const (
|
||||||
MOGHistory = 500
|
MOGHistory = 500
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type d struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *d) Write(p []byte) (int, error) { return len(p), nil }
|
||||||
|
func (d *d) Close() error { return nil }
|
||||||
|
|
||||||
func BenchmarkBasic(b *testing.B) {
|
func BenchmarkBasic(b *testing.B) {
|
||||||
file, _ := os.Create(outBasic)
|
buffer := &d{}
|
||||||
f := NewBasic(io.WriteCloser(file), debug, BasicThreshold, BasicPixels)
|
f := NewBasic(buffer, debug, BasicThreshold, BasicPixels)
|
||||||
b.Log("Frames: ", len(testPackets))
|
b.Log("Frames: ", len(testPackets))
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
|
@ -72,8 +69,8 @@ func BenchmarkBasic(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkDifference(b *testing.B) {
|
func BenchmarkDifference(b *testing.B) {
|
||||||
file, _ := os.Create(outDiff)
|
buffer := &d{}
|
||||||
f := NewDifference(io.WriteCloser(file), debug, DiffThreshold)
|
f := NewDifference(buffer, debug, DiffThreshold)
|
||||||
b.Log("Frames: ", len(testPackets))
|
b.Log("Frames: ", len(testPackets))
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
|
@ -86,8 +83,8 @@ func BenchmarkDifference(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkKNN(b *testing.B) {
|
func BenchmarkKNN(b *testing.B) {
|
||||||
file, _ := os.Create(outKNN)
|
buffer := &d{}
|
||||||
f := NewKNN(io.WriteCloser(file), KNNMinArea, KNNThreshold, KNNHistory, KNNKernel, debug, motionInterval, motionDownscaling)
|
f := NewKNN(buffer, KNNMinArea, KNNThreshold, KNNHistory, KNNKernel, debug, motionInterval, motionDownscaling)
|
||||||
b.Log("Frames: ", len(testPackets))
|
b.Log("Frames: ", len(testPackets))
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
|
@ -100,8 +97,8 @@ func BenchmarkKNN(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkMOG(b *testing.B) {
|
func BenchmarkMOG(b *testing.B) {
|
||||||
file, _ := os.Create(outMOG)
|
buffer := &d{}
|
||||||
f := NewMOG(io.WriteCloser(file), MOGMinArea, MOGThreshold, MOGHistory, debug, motionInterval, motionDownscaling)
|
f := NewMOG(buffer, MOGMinArea, MOGThreshold, MOGHistory, debug, motionInterval, motionDownscaling)
|
||||||
b.Log("Frames: ", len(testPackets))
|
b.Log("Frames: ", len(testPackets))
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
|
|
Loading…
Reference in New Issue