public void NextFrame(int width, int height, byte[] frame) { if (_lastFrame != null && FrameUtil.CompareBuffers(frame, 0, _lastFrame, 0, frame.Length)) { // identical frame, skip. return; } if (_lastFrame?.Length != frame.Length) { _lastFrame = new byte[frame.Length]; } SetDimensions(width, height); _framesGray4.OnNext(frame); Buffer.BlockCopy(frame, 0, _lastFrame, 0, frame.Length); }
public void NextFrame(DMDFrame frame) { if (_lastFrameFormat.Value == FrameFormat.Rgb24 && _lastFrame != null && FrameUtil.CompareBuffers(frame.Data, 0, _lastFrame, 0, frame.Data.Length)) { // identical frame, drop. return; } if (_lastFrame?.Length != frame.Data.Length) { _lastFrame = new byte[frame.Data.Length]; } SetDimensions(frame.width, frame.height); _framesRgb24.OnNext(frame); Buffer.BlockCopy(frame.Data, 0, _lastFrame, 0, frame.Data.Length); _lastFrameFormat.OnNext(FrameFormat.Rgb24); }