1#include "fx/video/frame_interpolator.h"
2#include "fl/circular_buffer.h"
3#include "fx/video/pixel_stream.h"
4#include "fl/math_macros.h"
9#include "fl/math_macros.h"
12#define DBG FASTLED_DBG
17FrameInterpolator::FrameInterpolator(
size_t nframes,
float fps)
18 : mFrameTracker(fps) {
19 size_t capacity = MAX(1, nframes);
20 mFrames.setMaxSize(capacity);
23bool FrameInterpolator::draw(uint32_t now, Frame *dst) {
25 bool ok = draw(now, dst->rgb());
32bool FrameInterpolator::draw(uint32_t now,
CRGB* leds) {
33 uint32_t frameNumber, nextFrameNumber;
34 uint8_t amountOfNextFrame;
36 mFrameTracker.get_interval_frames(now, &frameNumber, &nextFrameNumber, &amountOfNextFrame);
37 if (!has(frameNumber)) {
41 if (has(frameNumber) && !has(nextFrameNumber)) {
43 Frame* frame = get(frameNumber).get();
48 Frame* frame1 = get(frameNumber).get();
49 Frame* frame2 = get(nextFrameNumber).get();
51 Frame::interpolate(*frame1, *frame2, amountOfNextFrame, leds);
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Representation of an RGB pixel (Red, Green, Blue)