FastLED 3.10.8
Loading...
Searching...
No Matches
frame_interpolator.cpp.hpp
Go to the documentation of this file.
3#include "fl/math/math.h"
5
6#include "fl/log/log.h"
7
8#include "fl/math/math.h"
9#include "fl/math/math.h"
10#include "fl/stl/noexcept.h"
11
12#define DBG FL_DBG
13
14namespace fl {
15namespace video {
16
17FrameInterpolator::FrameInterpolator(size_t nframes, float fps)
19 size_t capacity = fl::max(1, nframes);
20 mFrames.reserve(capacity);
21}
22
24 bool ok = draw(now, dst->rgb());
25 return ok;
26}
27
29 fl::u32 frameNumber, nextFrameNumber;
30 u8 amountOfNextFrame;
31 // DBG("now: " << now);
32 mFrameTracker.get_interval_frames(now, &frameNumber, &nextFrameNumber,
33 &amountOfNextFrame);
34 if (!has(frameNumber)) {
35 return false;
36 }
37
38 if (has(frameNumber) && !has(nextFrameNumber)) {
39 // just paint the current frame
40 Frame *frame = get(frameNumber).get();
41 frame->draw(leds);
42 return true;
43 }
44
45 Frame *frame1 = get(frameNumber).get();
46 Frame *frame2 = get(nextFrameNumber).get();
47
48 Frame::interpolate(*frame1, *frame2, amountOfNextFrame, leds);
49 return true;
50}
51
52} // namespace video
53} // namespace fl
CRGB leds[1]
fl::Video video(NUM_LEDS, 2.0f)
void interpolate(const Frame &frame1, const Frame &frame2, u8 amountOfFrame2) FL_NO_EXCEPT
void draw(fl::span< CRGB > leds, DrawMode draw_mode=DrawMode::DRAW_MODE_OVERWRITE) const FL_NO_EXCEPT
Definition frame.cpp.hpp:49
FrameInterpolator(size_t nframes, float fpsVideo) FL_NO_EXCEPT
size_t capacity() const FL_NO_EXCEPT
bool has(fl::u32 frameNum) const FL_NO_EXCEPT
bool draw(fl::u32 adjustable_time, Frame *dst) FL_NO_EXCEPT
void draw(float pos)
Definition curr.h:526
Centralized logging categories for FastLED hardware interfaces and subsystems.
unsigned char u8
Definition stdint.h:131
constexpr common_type_t< T, U > max(T a, U b) FL_NO_EXCEPT
Definition math.h:75
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
pair_element< I, T1, T2 >::type & get(pair< T1, T2 > &p) FL_NO_EXCEPT
Definition pair.h:119
Base definition for an LED controller.
Definition crgb.hpp:179