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

◆ draw_line()

FL_ALWAYS_INLINE void fl::third_party::vorbis::draw_line ( float * output,
int32_t x0,
int32_t y0,
int32_t x1,
int32_t y1,
int32_t n )

Definition at line 1762 of file stb_vorbis.cpp.hpp.

1763{
1764 int32_t dy = y1 - y0;
1765 int32_t adx = x1 - x0;
1766 int32_t ady = abs(dy);
1767 int32_t base;
1768 int32_t x=x0,y=y0;
1769 int32_t err = 0;
1770 int32_t sy;
1771
1772#ifdef FL_STB_VORBIS_DIVIDE_TABLE
1773 if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) {
1774 if (dy < 0) {
1775 base = -integer_divide_table[ady][adx];
1776 sy = base-1;
1777 } else {
1778 base = integer_divide_table[ady][adx];
1779 sy = base+1;
1780 }
1781 } else {
1782 base = dy / adx;
1783 if (dy < 0)
1784 sy = base - 1;
1785 else
1786 sy = base+1;
1787 }
1788#else
1789 base = dy / adx;
1790 if (dy < 0)
1791 sy = base - 1;
1792 else
1793 sy = base+1;
1794#endif
1795 ady -= abs(base) * adx;
1796 if (x1 > n) x1 = n;
1797 if (x < x1) {
1798 FL_STBV_LINE_OP(output[x], inverse_db_table[y&255]);
1799 for (++x; x < x1; ++x) {
1800 err += ady;
1801 if (err >= adx) {
1802 err -= adx;
1803 y += sy;
1804 } else
1805 y += base;
1806 FL_STBV_LINE_OP(output[x], inverse_db_table[y&255]);
1807 }
1808 }
1809}
int8 integer_divide_table[DIVTAB_NUMER][DIVTAB_DENOM]
static constexpr int32_t DIVTAB_DENOM
static float inverse_db_table[256]
static constexpr int32_t DIVTAB_NUMER
fl::i32 int32_t
Definition coder.h:220
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT
#define FL_STBV_LINE_OP(a, b)

References fl::abs(), DIVTAB_DENOM, DIVTAB_NUMER, FL_ALWAYS_INLINE, FL_NOEXCEPT, FL_STBV_LINE_OP, integer_divide_table, inverse_db_table, fl::x, and fl::y.

Referenced by do_floor().

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