971 {
972 constexpr int shift = 2 * R;
974
975
976
977 RGB_T *bufs[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
978 for (int i = 0; i <= R; ++i)
979 bufs[i] = scratch + i * w;
980 RGB_T *zero_row = scratch + (R + 1) * w;
981
982
984
985 for (
int y = 0;
y < h; ++
y) {
986 RGB_T *out_row = pixels +
y * w;
987
988
990
991
992 const RGB_T *fwd[4] = {zero_row, zero_row, zero_row, zero_row};
993 for (int k = 0; k < R; ++k)
994 fwd[k] = (
y + 1 + k < h) ? (pixels + (
y + 1 + k) * w) : zero_row;
995
996
997
998
999 {
1000 const int prefetch_y =
y + R + 2;
1001 if (prefetch_y < h) {
1002 const char *pf = (const char *)(pixels + prefetch_y * w);
1003 const int row_bytes = w * (int)sizeof(RGB_T);
1004 for (int off = 0; off < row_bytes; off += 64)
1005 __builtin_prefetch(pf + off, 0, 3);
1006 }
1007 }
1008
1009
1010
1011
1012
1013
1014 if (sizeof(typename RGB_T::fp) == 1 && !ApplyAlpha) {
1015
1016 const int nbytes = w * (int)sizeof(RGB_T);
1017 u8 *ob = (
u8 *)out_row;
1018
1020 } else {
1021
1022 for (
int x = 0;
x < w; ++
x) {
1024
1026
1027 if (ApplyAlpha) {
1028 out_row[
x] = P::make(
static_cast<acc_t
>(r >> shift),
1029 static_cast<acc_t
>(
g >> shift),
1030 static_cast<acc_t>(b >> shift), alpha);
1031 } else {
1032 out_row[
x] = P::make(
static_cast<acc_t
>(r >> shift),
1033 static_cast<acc_t
>(
g >> shift),
1034 static_cast<acc_t>(b >> shift));
1035 }
1036 }
1037 }
1038
1039
1040 RGB_T *recycled = bufs[0];
1041 for (int i = 0; i < R; ++i) bufs[i] = bufs[i + 1];
1042 bufs[R] = recycled;
1043 }
1044}
#define FL_BUILTIN_MEMCPY(dest, src, n)
#define FL_BUILTIN_MEMSET(dest, val, n)
FASTLED_FORCE_INLINE fl::u8 P(fl::u8 x) FL_NO_EXCEPT