mirror of https://bitbucket.org/ausocean/av.git
adding variable to choose how many frames to skip before filtering
This commit is contained in:
parent
b39a440105
commit
6f16f68611
|
@ -139,8 +139,9 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write to destination, past 4 frames then current frame.
|
// Write to destination, past 4 frames then current frame.
|
||||||
for _, h := range m.hold {
|
for i, h := range m.hold {
|
||||||
_, err := m.dst.Write(h)
|
_, err := m.dst.Write(h)
|
||||||
|
m.hold[i] = nil
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
@ -149,5 +150,4 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
|
||||||
hfCount = 0
|
hfCount = 0
|
||||||
return m.dst.Write(f)
|
return m.dst.Write(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,11 +273,19 @@ type Config struct {
|
||||||
Width uint // Width defines the input video width Raspivid input.
|
Width uint // Width defines the input video width Raspivid input.
|
||||||
Bitrate uint // Bitrate specifies the bitrate for constant bitrate in kbps.
|
Bitrate uint // Bitrate specifies the bitrate for constant bitrate in kbps.
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input.
|
HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input.
|
||||||
VerticalFlip bool // VerticalFlip flips video vertically for Raspivid input.
|
VerticalFlip bool // VerticalFlip flips video vertically for Raspivid input.
|
||||||
Filters []int // Defines the methods of filtering to be used in between lexing and encoding.
|
Filters []int // Defines the methods of filtering to be used in between lexing and encoding.
|
||||||
FilterFrames int // Sets the number of frames that are held before the filter is used (on the nth frame)
|
FilterFrames int // Sets the number of frames that are held before the filter is used (on the nth frame)
|
||||||
PSITime int // Sets the time between a packet being sent.
|
PSITime int // Sets the time between a packet being sent.
|
||||||
|
=======
|
||||||
|
HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input.
|
||||||
|
VerticalFlip bool // VerticalFlip flips video vertically for Raspivid input.
|
||||||
|
Filter int // Defines the method of filtering to be used in between lexing and encoding.
|
||||||
|
FilterFrames int // Sets the number of frames that are held before the filter is used (on the nth frame)
|
||||||
|
PSITime int // Sets the time between a packet being sent
|
||||||
|
>>>>>>> d097308e... adding variable to choose how many frames to skip before filtering
|
||||||
|
|
||||||
// Ring buffer parameters.
|
// Ring buffer parameters.
|
||||||
RBMaxElements int // The maximum possible number of elements in ring buffer.
|
RBMaxElements int // The maximum possible number of elements in ring buffer.
|
||||||
|
|
|
@ -344,6 +344,7 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
|
||||||
|
|
||||||
r.encoders = multiWriter(encoders...)
|
r.encoders = multiWriter(encoders...)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
l := len(r.cfg.Filters)
|
l := len(r.cfg.Filters)
|
||||||
r.filters = []filter.Filter{filter.NewNoOp(r.encoders)}
|
r.filters = []filter.Filter{filter.NewNoOp(r.encoders)}
|
||||||
if l != 0 {
|
if l != 0 {
|
||||||
|
@ -365,6 +366,20 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
|
||||||
}
|
}
|
||||||
dst = r.filters[i]
|
dst = r.filters[i]
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
switch r.cfg.Filter {
|
||||||
|
case config.FilterNoOp:
|
||||||
|
r.filter = filter.NewNoOp(r.encoders)
|
||||||
|
case config.FilterMOG:
|
||||||
|
r.filter = filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows, r.cfg.FilterFrames)
|
||||||
|
case config.FilterVariableFPS:
|
||||||
|
r.filter = filter.NewVariableFPSFilter(r.encoders, minFPS, filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows, r.cfg.FilterFrames))
|
||||||
|
case config.FilterKNN:
|
||||||
|
r.filter = filter.NewKNNFilter(r.encoders, knnMinArea, knnThreshold, knnHistory, knnKernel, r.cfg.ShowWindows)
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic("Undefined Filter")
|
||||||
|
>>>>>>> d097308e... adding variable to choose how many frames to skip before filtering
|
||||||
}
|
}
|
||||||
|
|
||||||
switch r.cfg.Input {
|
switch r.cfg.Input {
|
||||||
|
@ -694,6 +709,16 @@ func (r *Revid) Update(vars map[string]string) error {
|
||||||
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterFrames var", "value", value)
|
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterFrames var", "value", value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
r.cfg.Filter = v
|
||||||
|
case "FilterFrames":
|
||||||
|
v, err := strconv.Atoi(value)
|
||||||
|
if err != nil || v < 0 {
|
||||||
|
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterFrames var", "value", value)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
>>>>>>> d097308e... adding variable to choose how many frames to skip before filtering
|
||||||
r.cfg.FilterFrames = v
|
r.cfg.FilterFrames = v
|
||||||
case "PSITime":
|
case "PSITime":
|
||||||
v, err := strconv.Atoi(value)
|
v, err := strconv.Atoi(value)
|
||||||
|
|
Loading…
Reference in New Issue