FastLED 3.9.15
Loading...
Searching...
No Matches

◆ plm_video_decode_motion_vector()

int fl::third_party::plm_video_decode_motion_vector ( plm_video_t * self,
int r_size,
int motion )

Definition at line 2600 of file pl_mpeg.hpp.

2600 {
2601 int fscale = 1 << r_size;
2602 int m_code = plm_buffer_read_vlc(self->buffer, PLM_VIDEO_MOTION);
2603 int r = 0;
2604 int d;
2605
2606 if ((m_code != 0) && (fscale != 1)) {
2607 r = plm_buffer_read(self->buffer, r_size);
2608 d = ((fl::abs(m_code) - 1) << r_size) + r + 1;
2609 if (m_code < 0) {
2610 d = -d;
2611 }
2612 }
2613 else {
2614 d = m_code;
2615 }
2616
2617 motion += d;
2618 if (motion > (fscale << 4) - 1) {
2619 motion -= fscale << 5;
2620 }
2621 else if (motion < (int)((unsigned)(-fscale) << 4)) {
2622 motion += fscale << 5;
2623 }
2624
2625 return motion;
2626}
int plm_buffer_read(plm_buffer_t *self, int count) FL_NOEXCEPT
Definition pl_mpeg.hpp:1017
static const plm_vlc_t PLM_VIDEO_MOTION[]
Definition pl_mpeg.hpp:1846
int16_t plm_buffer_read_vlc(plm_buffer_t *self, const plm_vlc_t *table) FL_NOEXCEPT
Definition pl_mpeg.hpp:1111
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT

References fl::abs(), FL_NOEXCEPT, plm_buffer_read(), plm_buffer_read_vlc(), and PLM_VIDEO_MOTION.

Referenced by plm_video_decode_motion_vectors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: