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) {
24 bool ok = draw(now, dst->rgb());
28bool FrameInterpolator::draw(uint32_t now,
CRGB* leds) {
29 uint32_t frameNumber, nextFrameNumber;
30 uint8_t amountOfNextFrame;
32 mFrameTracker.get_interval_frames(now, &frameNumber, &nextFrameNumber, &amountOfNextFrame);
33 if (!has(frameNumber)) {
37 if (has(frameNumber) && !has(nextFrameNumber)) {
39 Frame* frame = get(frameNumber).get();
44 Frame* frame1 = get(frameNumber).get();
45 Frame* frame2 = get(nextFrameNumber).get();
47 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)