mirror of https://bitbucket.org/ausocean/av.git
filter: benchmarks: tidying up code
This commit is contained in:
parent
06a854c661
commit
73454cb9bc
|
@ -22,18 +22,26 @@ LICENSE
|
||||||
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
// To make a new file for testing please go to test repository test/test-data/av/input/motion-detection/byte_saver.go.
|
||||||
|
|
||||||
|
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
|
||||||
package filter
|
package filter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
type d struct {
|
type d struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *d) Write(p []byte) (int, error) { return len(p), nil }
|
func (d *d) Write(p []byte) (int, error) { return len(p), nil }
|
||||||
func (d *d) Close() error { return nil }
|
func (d *d) Close() error { return nil }
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
|
||||||
func BenchmarkBasic(b *testing.B) {
|
func BenchmarkBasic(b *testing.B) {
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
const BasicThreshold = 45000
|
const BasicThreshold = 45000
|
||||||
|
@ -45,8 +53,12 @@ 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)
|
||||||
|
<<<<<<< HEAD
|
||||||
fmt.Print("\nFrames: ", len(testPackets))
|
fmt.Print("\nFrames: ", len(testPackets))
|
||||||
>>>>>>> 31ccc30a... benchmark testing file
|
>>>>>>> 31ccc30a... benchmark testing file
|
||||||
|
=======
|
||||||
|
fmt.Print("\nFrames: ", len(testPackets), "\t")
|
||||||
|
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
_, err := f.Write(x)
|
_, err := f.Write(x)
|
||||||
|
@ -73,7 +85,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)
|
||||||
|
@ -97,8 +109,12 @@ 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)
|
||||||
|
<<<<<<< HEAD
|
||||||
fmt.Print("\nFrames: ", len(testPackets))
|
fmt.Print("\nFrames: ", len(testPackets))
|
||||||
>>>>>>> 31ccc30a... benchmark testing file
|
>>>>>>> 31ccc30a... benchmark testing file
|
||||||
|
=======
|
||||||
|
fmt.Print("\nFrames: ", len(testPackets), "\t")
|
||||||
|
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
_, err := f.Write(x)
|
_, err := f.Write(x)
|
||||||
|
@ -123,8 +139,12 @@ 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)
|
||||||
|
<<<<<<< HEAD
|
||||||
fmt.Print("\nFrames: ", len(testPackets))
|
fmt.Print("\nFrames: ", len(testPackets))
|
||||||
>>>>>>> 31ccc30a... benchmark testing file
|
>>>>>>> 31ccc30a... benchmark testing file
|
||||||
|
=======
|
||||||
|
fmt.Print("\nFrames: ", len(testPackets), "\t")
|
||||||
|
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
_, err := f.Write(x)
|
_, err := f.Write(x)
|
||||||
|
|
Loading…
Reference in New Issue