mirror of https://bitbucket.org/ausocean/av.git
filter: benchmarks: tidying up code
This commit is contained in:
parent
97dac2fc37
commit
e31934a7e3
|
@ -25,7 +25,7 @@ LICENSE
|
||||||
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// To make a new file for testing please go to test repository test/test-data/av/input/motion-detection/byte_saver.go
|
// To make a new file for testing please go to test repository test/test-data/av/input/motion-detection/byte_saver.go.
|
||||||
|
|
||||||
package filter
|
package filter
|
||||||
|
|
||||||
|
@ -36,13 +36,11 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
//frames into a byte slice of 10
|
|
||||||
|
|
||||||
func BenchmarkBasic(b *testing.B) {
|
func BenchmarkBasic(b *testing.B) {
|
||||||
file, _ := os.Create("testout/test_outBasic.mjpeg")
|
file, _ := os.Create("testout/test_outBasic.mjpeg")
|
||||||
w := io.WriteCloser(file)
|
w := io.WriteCloser(file)
|
||||||
f := NewBasic(w, false, 45000, 1000)
|
f := NewBasic(w, false, 45000, 1000)
|
||||||
fmt.Print("\nFrames: ", len(testPackets))
|
fmt.Print("\nFrames: ", len(testPackets), "\t")
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
f.Write(x)
|
f.Write(x)
|
||||||
|
@ -54,7 +52,7 @@ func BenchmarkDifference(b *testing.B) {
|
||||||
file, _ := os.Create("testout/test_outDiff.mjpeg")
|
file, _ := os.Create("testout/test_outDiff.mjpeg")
|
||||||
w := io.WriteCloser(file)
|
w := io.WriteCloser(file)
|
||||||
f := NewDifference(w, false, 3)
|
f := NewDifference(w, false, 3)
|
||||||
fmt.Print("\nFrames: ", len(testPackets))
|
fmt.Print("\nFrames: ", len(testPackets), "\t")
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
f.Write(x)
|
f.Write(x)
|
||||||
|
@ -66,7 +64,7 @@ func BenchmarkKNN(b *testing.B) {
|
||||||
file, _ := os.Create("testout/test_outKNN.mjpeg")
|
file, _ := os.Create("testout/test_outKNN.mjpeg")
|
||||||
w := io.WriteCloser(file)
|
w := io.WriteCloser(file)
|
||||||
f := NewKNN(w, 25, 20, 300, 9, false, 1, 1)
|
f := NewKNN(w, 25, 20, 300, 9, false, 1, 1)
|
||||||
fmt.Print("\nFrames: ", len(testPackets))
|
fmt.Print("\nFrames: ", len(testPackets), "\t")
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
f.Write(x)
|
f.Write(x)
|
||||||
|
@ -78,7 +76,7 @@ func BenchmarkMOG(b *testing.B) {
|
||||||
file, _ := os.Create("testout/test_outMOG.mjpeg")
|
file, _ := os.Create("testout/test_outMOG.mjpeg")
|
||||||
w := io.WriteCloser(file)
|
w := io.WriteCloser(file)
|
||||||
f := NewMOG(w, 25, 20, 500, false, 1, 1)
|
f := NewMOG(w, 25, 20, 500, false, 1, 1)
|
||||||
fmt.Print("\nFrames: ", len(testPackets))
|
fmt.Print("\nFrames: ", len(testPackets), "\t")
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
f.Write(x)
|
f.Write(x)
|
||||||
|
|
Loading…
Reference in New Issue