diff --git a/common/videolink/rgb32conv.cpp b/common/videolink/rgb32conv.cpp old mode 100755 new mode 100644 index e37342bd..17a674d3 --- a/common/videolink/rgb32conv.cpp +++ b/common/videolink/rgb32conv.cpp @@ -17,9 +17,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "rgb32conv.h" -#include "videolink.h" #include "array.h" #include "gbint.h" +#include "videolink.h" #include namespace { @@ -34,6 +34,13 @@ static bool isBigEndian() { } class Rgb32ToUyvy { +public: + Rgb32ToUyvy(); + void operator()(gambatte::uint_least32_t *d, std::ptrdiff_t dstPitch, + gambatte::uint_least32_t const *s, std::ptrdiff_t srcPitch, + unsigned w, unsigned h); + +private: struct CacheUnit { gambatte::uint_least32_t rgb32; gambatte::uint_least32_t uyvy; @@ -41,78 +48,80 @@ class Rgb32ToUyvy { enum { cache_size = 0x100 }; enum { cache_mask = cache_size - 1 }; - - CacheUnit cache[cache_size]; - -public: - Rgb32ToUyvy(); - void operator()(const gambatte::uint_least32_t *s, gambatte::uint_least32_t *d, - unsigned w, unsigned h, std::ptrdiff_t srcPitch, std::ptrdiff_t dstPitch); + CacheUnit cache_[cache_size]; }; Rgb32ToUyvy::Rgb32ToUyvy() { if (isBigEndian()) { - CacheUnit c = { 0, 128ul << 24 | 16ul << 16 | 128 << 8 | 16 }; - std::fill(cache, cache + cache_size, c); + CacheUnit c = { 0, 128ul << 24 | 16ul << 16 | 128u << 8 | 16 }; + std::fill(cache_, cache_ + cache_size, c); } else { CacheUnit c = { 0, 16ul << 24 | 128ul << 16 | 16 << 8 | 128 }; - std::fill(cache, cache + cache_size, c); + std::fill(cache_, cache_ + cache_size, c); } } -void Rgb32ToUyvy::operator()(const gambatte::uint_least32_t *s, gambatte::uint_least32_t *d, - const unsigned w, unsigned h, const std::ptrdiff_t s_pitch, const std::ptrdiff_t d_pitch) +void Rgb32ToUyvy::operator()(gambatte::uint_least32_t *dst, + std::ptrdiff_t const dstPitch, + gambatte::uint_least32_t const *src, + std::ptrdiff_t const srcPitch, + unsigned const w, + unsigned h) { while (h--) { - unsigned n = w >> 1; - - do { - if ((cache[s[0] & cache_mask].rgb32 - s[0]) | (cache[s[1] & cache_mask].rgb32 - s[1])) { - cache[s[0] & cache_mask].rgb32 = s[0]; - cache[s[1] & cache_mask].rgb32 = s[1]; - - const unsigned long r = (s[0] >> 16 & 0x000000FF) | (s[1] & 0x00FF0000); - const unsigned long g = (s[0] >> 8 & 0x000000FF) | (s[1] << 8 & 0x00FF0000); - const unsigned long b = (s[0] & 0x000000FF) | (s[1] << 16 & 0x00FF0000); - - const unsigned long y = r * 66 + g * 129 + b * 25 + ( 16 * 256 + 128) * 0x00010001ul; - const unsigned long u = b * 112 - r * 38 - g * 74 + (128 * 256 + 128) * 0x00010001ul; - const unsigned long v = r * 112 - g * 94 - b * 18 + (128 * 256 + 128) * 0x00010001ul; + gambatte::uint_least32_t *d = dst; + gambatte::uint_least32_t const *s = src; + gambatte::uint_least32_t const *const sEnd = s + w - 1; + while (s < sEnd) { + if ((cache_[s[0] & cache_mask].rgb32 - s[0]) | (cache_[s[1] & cache_mask].rgb32 - s[1])) { + cache_[s[0] & cache_mask].rgb32 = s[0]; + cache_[s[1] & cache_mask].rgb32 = s[1]; + unsigned long const r = (s[0] >> 16 & 0x000000FF) | (s[1] & 0x00FF0000); + unsigned long const g = (s[0] >> 8 & 0x000000FF) | (s[1] << 8 & 0x00FF0000); + unsigned long const b = (s[0] & 0x000000FF) | (s[1] << 16 & 0x00FF0000); + unsigned long const y = r * 66 + g * 129 + b * 25 + ( 16 * 256 + 128) * 0x00010001ul; + unsigned long const u = b * 112 - r * 38 - g * 74 + (128 * 256 + 128) * 0x00010001ul; + unsigned long const v = r * 112 - g * 94 - b * 18 + (128 * 256 + 128) * 0x00010001ul; if (isBigEndian()) { - cache[s[0] & cache_mask].uyvy = (u << 16 & 0xFF000000) - | (y << 8 & 0x00FF0000) - | (v & 0x0000FF00) - | (y >> 8 & 0x000000FF); - cache[s[1] & cache_mask].uyvy = (u & 0xFF000000) - | (y >> 8 & 0x00FF0000) - | (v >> 16 & 0x0000FF00) - | y >> 24 ; + cache_[s[0] & cache_mask].uyvy = (u << 16 & 0xFF000000) + | (y << 8 & 0x00FF0000) + | (v & 0x0000FF00) + | (y >> 8 & 0x000000FF); + cache_[s[1] & cache_mask].uyvy = (u & 0xFF000000) + | (y >> 8 & 0x00FF0000) + | (v >> 16 & 0x0000FF00) + | y >> 24 ; } else { - cache[s[0] & cache_mask].uyvy = (y << 16 & 0xFF000000) - | (v << 8 & 0x00FF0000) - | (y & 0x0000FF00) - | (u >> 8 & 0x000000FF); - cache[s[1] & cache_mask].uyvy = (y & 0xFF000000) - | (v >> 8 & 0x00FF0000) - | (y >> 16 & 0x0000FF00) - | u >> 24 ; + cache_[s[0] & cache_mask].uyvy = (y << 16 & 0xFF000000) + | (v << 8 & 0x00FF0000) + | (y & 0x0000FF00) + | (u >> 8 & 0x000000FF); + cache_[s[1] & cache_mask].uyvy = (y & 0xFF000000) + | (v >> 8 & 0x00FF0000) + | (y >> 16 & 0x0000FF00) + | u >> 24 ; } } - d[0] = cache[s[0] & cache_mask].uyvy; - d[1] = cache[s[1] & cache_mask].uyvy; + gambatte::uint_least32_t const s0 = s[0], s1 = s[1]; + d[0] = cache_[s0 & cache_mask].uyvy; + d[1] = cache_[s1 & cache_mask].uyvy; s += 2; d += 2; - } while (--n); + } - s += s_pitch - static_cast(w); - d += d_pitch - static_cast(w); + src += srcPitch; + dst += dstPitch; } } -static void rgb32ToRgb16(const gambatte::uint_least32_t *s, gambatte::uint_least16_t *d, - const unsigned w, unsigned h, const std::ptrdiff_t srcPitch, const std::ptrdiff_t dstPitch) +static void rgb32ToRgb16(gambatte::uint_least16_t *d, + std::ptrdiff_t const dstPitch, + gambatte::uint_least32_t const *s, + std::ptrdiff_t const srcPitch, + unsigned const w, + unsigned h) { do { std::ptrdiff_t i = -static_cast(w); @@ -129,51 +138,58 @@ static void rgb32ToRgb16(const gambatte::uint_least32_t *s, gambatte::uint_least } class Rgb32ToUyvyLink : public VideoLink { - const Array inbuf_; - Rgb32ToUyvy rgb32ToUyvy; - const unsigned width_; - const unsigned height_; - public: Rgb32ToUyvyLink(unsigned width, unsigned height) - : inbuf_(static_cast(width) * height), - width_(width), - height_(height) + : inbuf_(static_cast(width) * height) + , width_(width) + , height_(height) { } - virtual void* inBuf() const { return inbuf_; } + virtual void * inBuf() const { return inbuf_; } virtual std::ptrdiff_t inPitch() const { return width_; } - virtual void draw(void *dst, std::ptrdiff_t dstpitch) { - rgb32ToUyvy(inbuf_, static_cast(dst), width_, height_, inPitch(), dstpitch); + virtual void draw(void *dst, std::ptrdiff_t dstPitch) { + rgb32ToUyvy_(static_cast(dst), dstPitch, + inbuf_, width_, width_, height_); } + +private: + SimpleArray const inbuf_; + Rgb32ToUyvy rgb32ToUyvy_; + unsigned const width_; + unsigned const height_; }; class Rgb32ToRgb16Link : public VideoLink { - const Array inbuf_; - const unsigned width_; - const unsigned height_; - public: Rgb32ToRgb16Link(unsigned width, unsigned height) - : inbuf_(static_cast(width) * height), - width_(width), - height_(height) + : inbuf_(static_cast(width) * height) + , width_(width) + , height_(height) { } - virtual void* inBuf() const { return inbuf_; } + virtual void * inBuf() const { return inbuf_; } virtual std::ptrdiff_t inPitch() const { return width_; } - virtual void draw(void *dst, std::ptrdiff_t dstpitch) { - rgb32ToRgb16(inbuf_, static_cast(dst), width_, height_, inPitch(), dstpitch); + virtual void draw(void *dst, std::ptrdiff_t dstPitch) { + if (!inbuf_) + return; + + rgb32ToRgb16(static_cast(dst), dstPitch, + inbuf_, width_, width_, height_); } + +private: + SimpleArray const inbuf_; + unsigned const width_; + unsigned const height_; }; } // anon namespace -VideoLink* Rgb32Conv::create(PixelFormat pf, unsigned width, unsigned height) { +VideoLink * Rgb32Conv::create(PixelFormat pf, unsigned width, unsigned height) { switch (pf) { case RGB16: return new Rgb32ToRgb16Link(width, height); case UYVY: return new Rgb32ToUyvyLink(width, height); diff --git a/common/videolink/rgb32conv.h b/common/videolink/rgb32conv.h old mode 100755 new mode 100644 index 278259dd..bbde8e1f --- a/common/videolink/rgb32conv.h +++ b/common/videolink/rgb32conv.h @@ -24,7 +24,7 @@ class VideoLink; class Rgb32Conv { public: enum PixelFormat { RGB32, RGB16, UYVY }; - static VideoLink* create(PixelFormat pf, unsigned width, unsigned height); + static VideoLink * create(PixelFormat pf, unsigned width, unsigned height); }; #endif diff --git a/common/videolink/vfilterinfo.cpp b/common/videolink/vfilterinfo.cpp old mode 100755 new mode 100644 index 75d84da0..71436242 --- a/common/videolink/vfilterinfo.cpp +++ b/common/videolink/vfilterinfo.cpp @@ -23,26 +23,26 @@ #include "vfilters/maxsthq2x.h" #include "vfilters/maxsthq3x.h" -static VideoLink* createNone() { return 0; } +static VideoLink * createNone() { return 0; } template -static VideoLink* createT() { return new T; } +static VideoLink * createT() { return new T; } -#define VFINFO(handle, Type) { handle, Type::OUT_WIDTH, Type::OUT_HEIGHT, createT } +#define VFINFO(handle, Type) { handle, Type::out_width, Type::out_height, createT } -static const VfilterInfo vfinfos[] = { - { "None", VfilterInfo::IN_WIDTH, VfilterInfo::IN_HEIGHT, createNone }, +static VfilterInfo const vfinfos[] = { + { "None", VfilterInfo::in_width, VfilterInfo::in_height, createNone }, VFINFO("Bicubic Catmull-Rom spline 2x", Catrom2x), VFINFO("Bicubic Catmull-Rom spline 3x", Catrom3x), VFINFO("Kreed's 2xSaI", Kreed2xSaI), VFINFO("MaxSt's hq2x", MaxStHq2x), - VFINFO("MaxSt's hq3x", MaxStHq3x) + VFINFO("MaxSt's hq3x", MaxStHq3x), }; std::size_t VfilterInfo::numVfilters() { return sizeof vfinfos / sizeof vfinfos[0]; } -const VfilterInfo& VfilterInfo::get(std::size_t n) { +VfilterInfo const & VfilterInfo::get(std::size_t n) { return vfinfos[n]; } diff --git a/common/videolink/vfilterinfo.h b/common/videolink/vfilterinfo.h old mode 100755 new mode 100644 index c9edb2e6..35086789 --- a/common/videolink/vfilterinfo.h +++ b/common/videolink/vfilterinfo.h @@ -24,15 +24,15 @@ class VideoLink; struct VfilterInfo { - enum { IN_WIDTH = 160 }; - enum { IN_HEIGHT = 144 }; + enum { in_width = 160 }; + enum { in_height = 144 }; - const char *handle; + char const *handle; unsigned outWidth; unsigned outHeight; - VideoLink* (*create)(); + VideoLink * (*create)(); - static const VfilterInfo& get(std::size_t n); + static VfilterInfo const & get(std::size_t n); static std::size_t numVfilters(); }; diff --git a/common/videolink/vfilters/catrom2x.cpp b/common/videolink/vfilters/catrom2x.cpp old mode 100755 new mode 100644 index 070f22ca..97f91dfb --- a/common/videolink/vfilters/catrom2x.cpp +++ b/common/videolink/vfilters/catrom2x.cpp @@ -21,26 +21,24 @@ namespace { -enum { WIDTH = VfilterInfo::IN_WIDTH }; -enum { HEIGHT = VfilterInfo::IN_HEIGHT }; -enum { PITCH = WIDTH + 3 }; +enum { in_width = VfilterInfo::in_width }; +enum { in_height = VfilterInfo::in_height }; +enum { in_pitch = in_width + 3 }; struct Colorsum { gambatte::uint_least32_t r, g, b; }; -static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) { - unsigned w = WIDTH; - - while (w--) { +static void mergeColumns(gambatte::uint_least32_t *dest, Colorsum const *sums) { + for (unsigned w = in_width; w--;) { { gambatte::uint_least32_t rsum = sums[1].r; gambatte::uint_least32_t gsum = sums[1].g; gambatte::uint_least32_t bsum = sums[1].b; - if (rsum & 0x80000000) rsum = 0; - if (gsum & 0x80000000) gsum = 0; - if (bsum & 0x80000000) bsum = 0; + if (rsum >= 0x80000000) rsum = 0; + if (gsum >= 0x80000000) gsum = 0; + if (bsum >= 0x80000000) bsum = 0; rsum <<= 12; rsum += 0x008000; @@ -73,9 +71,9 @@ static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) gsum -= sums[3].g; bsum -= sums[3].b; - if (rsum & 0x80000000) rsum = 0; - if (gsum & 0x80000000) gsum = 0; - if (bsum & 0x80000000) bsum = 0; + if (rsum >= 0x80000000) rsum = 0; + if (gsum >= 0x80000000) gsum = 0; + if (bsum >= 0x80000000) bsum = 0; rsum <<= 8; rsum += 0x008000; @@ -95,15 +93,16 @@ static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) } } -static void filter(gambatte::uint_least32_t *dline, const std::ptrdiff_t pitch, const gambatte::uint_least32_t *sline) { - Colorsum sums[PITCH]; - - for (unsigned h = HEIGHT; h--;) { +static void filter(gambatte::uint_least32_t *dline, + std::ptrdiff_t const pitch, + gambatte::uint_least32_t const *sline) +{ + Colorsum sums[in_pitch]; + for (unsigned h = in_height; h--;) { { - const gambatte::uint_least32_t *s = sline; + gambatte::uint_least32_t const *s = sline; Colorsum *sum = sums; - unsigned n = PITCH; - + unsigned n = in_pitch; while (n--) { unsigned long pixel = *s; sum->r = pixel >> 12 & 0x000FF0 ; @@ -116,31 +115,30 @@ static void filter(gambatte::uint_least32_t *dline, const std::ptrdiff_t pitch, } } - merge_columns(dline, sums); + mergeColumns(dline, sums); dline += pitch; { - const gambatte::uint_least32_t *s = sline; + gambatte::uint_least32_t const *s = sline; Colorsum *sum = sums; - unsigned n = PITCH; - + unsigned n = in_pitch; while (n--) { unsigned long pixel = *s; unsigned long rsum = (pixel >> 16) * 9; unsigned long gsum = (pixel & 0x00FF00) * 9; unsigned long bsum = (pixel & 0x0000FF) * 9; - pixel = s[-1*PITCH]; + pixel = s[-1 * in_pitch]; rsum -= pixel >> 16; gsum -= pixel & 0x00FF00; bsum -= pixel & 0x0000FF; - pixel = s[1*PITCH]; + pixel = s[1 * in_pitch]; rsum += (pixel >> 16) * 9; gsum += (pixel & 0x00FF00) * 9; bsum += (pixel & 0x0000FF) * 9; - pixel = s[2*PITCH]; + pixel = s[2 * in_pitch]; rsum -= pixel >> 16; gsum -= pixel & 0x00FF00; bsum -= pixel & 0x0000FF; @@ -154,28 +152,28 @@ static void filter(gambatte::uint_least32_t *dline, const std::ptrdiff_t pitch, } } - merge_columns(dline, sums); + mergeColumns(dline, sums); dline += pitch; - sline += PITCH; + sline += in_pitch; } } } // anon namespace Catrom2x::Catrom2x() -: buffer_((HEIGHT + 3UL) * PITCH) +: buffer_((in_height + 3UL) * in_pitch) { std::fill_n(buffer_.get(), buffer_.size(), 0); } -void* Catrom2x::inBuf() const { - return buffer_ + PITCH + 1; +void * Catrom2x::inBuf() const { + return buffer_ + in_pitch + 1; } std::ptrdiff_t Catrom2x::inPitch() const { - return PITCH; + return in_pitch; } -void Catrom2x::draw(void *const dbuffer, const std::ptrdiff_t pitch) { - ::filter(static_cast(dbuffer), pitch, buffer_ + PITCH); +void Catrom2x::draw(void *dbuffer, std::ptrdiff_t pitch) { + ::filter(static_cast(dbuffer), pitch, buffer_ + in_pitch); } diff --git a/common/videolink/vfilters/catrom2x.h b/common/videolink/vfilters/catrom2x.h old mode 100755 new mode 100644 index 4da87040..0b74509b --- a/common/videolink/vfilters/catrom2x.h +++ b/common/videolink/vfilters/catrom2x.h @@ -25,15 +25,17 @@ #include "gbint.h" class Catrom2x : public VideoLink { - const Array buffer_; public: - enum { OUT_WIDTH = VfilterInfo::IN_WIDTH * 2 }; - enum { OUT_HEIGHT = VfilterInfo::IN_HEIGHT * 2 }; + enum { out_width = VfilterInfo::in_width * 2 }; + enum { out_height = VfilterInfo::in_height * 2 }; Catrom2x(); - virtual void* inBuf() const; + virtual void * inBuf() const; virtual std::ptrdiff_t inPitch() const; virtual void draw(void *dst, std::ptrdiff_t dstpitch); + +private: + Array const buffer_; }; #endif diff --git a/common/videolink/vfilters/catrom3x.cpp b/common/videolink/vfilters/catrom3x.cpp old mode 100755 new mode 100644 index faa55827..bc7dbd15 --- a/common/videolink/vfilters/catrom3x.cpp +++ b/common/videolink/vfilters/catrom3x.cpp @@ -21,50 +21,48 @@ namespace { -enum { WIDTH = VfilterInfo::IN_WIDTH }; -enum { HEIGHT = VfilterInfo::IN_HEIGHT }; -enum { PITCH = WIDTH + 3 }; +enum { in_width = VfilterInfo::in_width }; +enum { in_height = VfilterInfo::in_height }; +enum { in_pitch = in_width + 3 }; struct Colorsum { gambatte::uint_least32_t r, g, b; }; -static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) { - unsigned w = WIDTH; - - while (w--) { +static void mergeColumns(gambatte::uint_least32_t *dest, Colorsum const *sums) { + for (unsigned w = in_width; w--;) { { gambatte::uint_least32_t rsum = sums[1].r; gambatte::uint_least32_t gsum = sums[1].g; gambatte::uint_least32_t bsum = sums[1].b; - if (rsum & 0x80000000) + if (rsum >= 0x80000000) { rsum = 0; - else if (rsum > 6869) + } else if (rsum > 6869) { rsum = 0xFF0000; - else { + } else { rsum *= 607; rsum <<= 2; rsum += 0x008000; rsum &= 0xFF0000; } - if (gsum & 0x80000000) + if (gsum >= 0x80000000) { gsum = 0; - else if (gsum > 1758567) + } else if (gsum > 1758567) { gsum = 0xFF00; - else { + } else { gsum *= 607; gsum >>= 14; gsum += 0x000080; gsum &= 0x00FF00; } - if (bsum & 0x80000000) + if (bsum >= 0x80000000) { bsum = 0; - else if (bsum > 6869) + } else if (bsum > 6869) { bsum = 0xFF; - else { + } else { bsum *= 607; bsum += 8192; bsum >>= 14; @@ -103,22 +101,22 @@ static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) gsum -= sums[3].g; bsum -= sums[3].b; - if (rsum & 0x80000000) + if (rsum >= 0x80000000) { rsum = 0; - else if (rsum > 185578) + } else if (rsum > 185578) { rsum = 0xFF0000; - else { + } else { rsum *= 719; rsum >>= 3; rsum += 0x008000; rsum &= 0xFF0000; } - if (gsum & 0x80000000) + if (gsum >= 0x80000000) { gsum = 0; - else if (gsum > 47508223) + } else if (gsum > 47508223) { gsum = 0x00FF00; - else { + } else { gsum >>= 8; gsum *= 719; gsum >>= 11; @@ -126,11 +124,11 @@ static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) gsum &= 0x00FF00; } - if (bsum & 0x80000000) + if (bsum >= 0x80000000) { bsum = 0; - else if (bsum > 185578) + } else if (bsum > 185578) { bsum = 0x0000FF; - else { + } else { bsum *= 719; bsum += 0x040000; bsum >>= 19; @@ -169,22 +167,22 @@ static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) gsum -= sums[3].g << 1; bsum -= sums[3].b << 1; - if (rsum & 0x80000000) + if (rsum >= 0x80000000) { rsum = 0; - else if (rsum > 185578) + } else if (rsum > 185578) { rsum = 0xFF0000; - else { + } else { rsum *= 719; rsum >>= 3; rsum += 0x008000; rsum &= 0xFF0000; } - if (gsum & 0x80000000) + if (gsum >= 0x80000000) { gsum = 0; - else if (gsum > 47508223) + } else if (gsum > 47508223) { gsum = 0xFF00; - else { + } else { gsum >>= 8; gsum *= 719; gsum >>= 11; @@ -192,11 +190,11 @@ static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) gsum &= 0x00FF00; } - if (bsum & 0x80000000) + if (bsum >= 0x80000000) { bsum = 0; - else if (bsum > 185578) + } else if (bsum > 185578) { bsum = 0x0000FF; - else { + } else { bsum *= 719; bsum += 0x040000; bsum >>= 19; @@ -218,21 +216,23 @@ static void merge_columns(gambatte::uint_least32_t *dest, const Colorsum *sums) *dest++ = rsum/*&0xFF0000*/ | gsum/*&0x00FF00*/ | bsum; } + ++sums; } } -static void filter(gambatte::uint_least32_t *dline, const std::ptrdiff_t pitch, const gambatte::uint_least32_t *sline) { - Colorsum sums[PITCH]; - - for (unsigned h = HEIGHT; h--;) { +static void filter(gambatte::uint_least32_t *dline, + std::ptrdiff_t const pitch, + gambatte::uint_least32_t const *sline) +{ + Colorsum sums[in_pitch]; + for (unsigned h = in_height; h--;) { { - const gambatte::uint_least32_t *s = sline; + gambatte::uint_least32_t const *s = sline; Colorsum *sum = sums; - unsigned n = PITCH; - + unsigned n = in_pitch; while (n--) { - const unsigned long pixel = *s; + unsigned long const pixel = *s; sum->r = (pixel >> 16) * 27; sum->g = (pixel & 0x00FF00) * 27; sum->b = (pixel & 0x0000FF) * 27; @@ -242,32 +242,31 @@ static void filter(gambatte::uint_least32_t *dline, const std::ptrdiff_t pitch, } } - merge_columns(dline, sums); + mergeColumns(dline, sums); dline += pitch; { - const gambatte::uint_least32_t *s = sline; + gambatte::uint_least32_t const *s = sline; Colorsum *sum = sums; - unsigned n = PITCH; - + unsigned n = in_pitch; while (n--) { unsigned long pixel = *s; unsigned long rsum = (pixel >> 16) * 21; unsigned long gsum = (pixel & 0x00FF00) * 21; unsigned long bsum = (pixel & 0x0000FF) * 21; - pixel = s[-1 * PITCH]; + pixel = s[-1 * in_pitch]; rsum -= (pixel >> 16) << 1; pixel <<= 1; gsum -= pixel & 0x01FE00; bsum -= pixel & 0x0001FE; - pixel = s[1 * PITCH]; + pixel = s[1 * in_pitch]; rsum += (pixel >> 16) * 9; gsum += (pixel & 0x00FF00) * 9; bsum += (pixel & 0x0000FF) * 9; - pixel = s[2 * PITCH]; + pixel = s[2 * in_pitch]; rsum -= pixel >> 16; gsum -= pixel & 0x00FF00; bsum -= pixel & 0x0000FF; @@ -281,31 +280,30 @@ static void filter(gambatte::uint_least32_t *dline, const std::ptrdiff_t pitch, } } - merge_columns(dline, sums); + mergeColumns(dline, sums); dline += pitch; { - const gambatte::uint_least32_t *s = sline; + gambatte::uint_least32_t const *s = sline; Colorsum *sum = sums; - unsigned n = PITCH; - + unsigned n = in_pitch; while (n--) { unsigned long pixel = *s; unsigned long rsum = (pixel >> 16) * 9; unsigned long gsum = (pixel & 0x00FF00) * 9; unsigned long bsum = (pixel & 0x0000FF) * 9; - pixel = s[-1 * PITCH]; + pixel = s[-1 * in_pitch]; rsum -= pixel >> 16; gsum -= pixel & 0x00FF00; bsum -= pixel & 0x0000FF; - pixel = s[1 * PITCH]; + pixel = s[1 * in_pitch]; rsum += (pixel >> 16) * 21; gsum += (pixel & 0x00FF00) * 21; bsum += (pixel & 0x0000FF) * 21; - pixel = s[2 * PITCH]; + pixel = s[2 * in_pitch]; rsum -= (pixel >> 16) << 1; pixel <<= 1; gsum -= pixel & 0x01FE00; @@ -320,28 +318,28 @@ static void filter(gambatte::uint_least32_t *dline, const std::ptrdiff_t pitch, } } - merge_columns(dline, sums); + mergeColumns(dline, sums); dline += pitch; - sline += PITCH; + sline += in_pitch; } } } // anon namespace Catrom3x::Catrom3x() -: buffer_((HEIGHT + 3UL) * PITCH) +: buffer_((in_height + 3UL) * in_pitch) { std::fill_n(buffer_.get(), buffer_.size(), 0); } -void* Catrom3x::inBuf() const { - return buffer_ + PITCH + 1; +void * Catrom3x::inBuf() const { + return buffer_ + in_pitch + 1; } std::ptrdiff_t Catrom3x::inPitch() const { - return PITCH; + return in_pitch; } -void Catrom3x::draw(void *const dbuffer, const std::ptrdiff_t pitch) { - ::filter(static_cast(dbuffer), pitch, buffer_ + PITCH); +void Catrom3x::draw(void *dbuffer, std::ptrdiff_t pitch) { + ::filter(static_cast(dbuffer), pitch, buffer_ + in_pitch); } diff --git a/common/videolink/vfilters/catrom3x.h b/common/videolink/vfilters/catrom3x.h old mode 100755 new mode 100644 index 92b48553..7baf5b7c --- a/common/videolink/vfilters/catrom3x.h +++ b/common/videolink/vfilters/catrom3x.h @@ -25,15 +25,17 @@ #include "gbint.h" class Catrom3x : public VideoLink { - const Array buffer_; public: - enum { OUT_WIDTH = VfilterInfo::IN_WIDTH * 3 }; - enum { OUT_HEIGHT = VfilterInfo::IN_HEIGHT * 3 }; + enum { out_width = VfilterInfo::in_width * 3 }; + enum { out_height = VfilterInfo::in_height * 3 }; Catrom3x(); - virtual void* inBuf() const; + virtual void * inBuf() const; virtual std::ptrdiff_t inPitch() const; virtual void draw(void *dst, std::ptrdiff_t dstpitch); + +private: + Array const buffer_; }; #endif diff --git a/common/videolink/vfilters/kreed2xsai.cpp b/common/videolink/vfilters/kreed2xsai.cpp old mode 100755 new mode 100644 index d7948fb6..5a16251e --- a/common/videolink/vfilters/kreed2xsai.cpp +++ b/common/videolink/vfilters/kreed2xsai.cpp @@ -23,7 +23,11 @@ namespace { -static inline int getResult1(const unsigned long a, const unsigned long b, const unsigned long c, const unsigned long d) { +static int getResult1(unsigned long const a, + unsigned long const b, + unsigned long const c, + unsigned long const d) +{ int x = 0; int y = 0; int r = 0; @@ -35,13 +39,16 @@ static inline int getResult1(const unsigned long a, const unsigned long b, const else if (b == d) ++y; if (x <= 1) ++r; - if (y <= 1) --r; return r; } -static inline int getResult2(const unsigned long a, const unsigned long b, const unsigned long c, const unsigned long d) { +static int getResult2(unsigned long const a, + unsigned long const b, + unsigned long const c, + unsigned long const d) +{ int x = 0; int y = 0; int r = 0; @@ -53,122 +60,111 @@ static inline int getResult2(const unsigned long a, const unsigned long b, const else if (b == d) ++y; if (x <= 1) --r; - if (y <= 1) ++r; return r; } -static inline unsigned long interpolate(const unsigned long a, const unsigned long b) { +static unsigned long interpolate(unsigned long a, unsigned long b) { return (a + b - ((a ^ b) & 0x010101)) >> 1; } -static inline unsigned long qInterpolate(const unsigned long a, const unsigned long b, - const unsigned long c, const unsigned long d) { - const unsigned long lowBits = ((a & 0x030303) + (b & 0x030303) + (c & 0x030303) + (d & 0x030303)) & 0x030303; - +static unsigned long qInterpolate(unsigned long const a, + unsigned long const b, + unsigned long const c, + unsigned long const d) +{ + unsigned long lowBits = ((a & 0x030303) + + (b & 0x030303) + + (c & 0x030303) + + (d & 0x030303)) & 0x030303; return (a + b + c + d - lowBits) >> 2; } template -static void filter(gambatte::uint_least32_t *dstPtr, const std::ptrdiff_t dstPitch, - const gambatte::uint_least32_t *srcPtr) +static void filter(gambatte::uint_least32_t *dstPtr, + std::ptrdiff_t const dstPitch, + gambatte::uint_least32_t const *srcPtr) { - unsigned h = height; - - while (h--) { - const gambatte::uint_least32_t *bP = srcPtr; + for (unsigned h = height; h--;) { + gambatte::uint_least32_t const *bP = srcPtr; gambatte::uint_least32_t *dP = dstPtr; + for (unsigned w = width; w--;) { + unsigned long colorA, colorB, colorC, colorD, + colorE, colorF, colorG, colorH, + colorI, colorJ, colorK, colorL, + colorM, colorN, colorO/*, colorP*/; - for (unsigned finish = width; finish--;) { - register unsigned long colorA, colorB; - unsigned long colorC, colorD, - colorE, colorF, colorG, colorH, - colorI, colorJ, colorK, colorL, + //--------------------------------------- + // Map of the pixels: I|E F|J + // G|A B|K + // H|C D|L + // M|N O|P - colorM, colorN, colorO, colorP; - unsigned long product, product1, product2; - - //--------------------------------------- - // Map of the pixels: I|E F|J - // G|A B|K - // H|C D|L - // M|N O|P colorI = *(bP - srcPitch - 1); - colorE = *(bP - srcPitch); + colorE = *(bP - srcPitch ); colorF = *(bP - srcPitch + 1); colorJ = *(bP - srcPitch + 2); colorG = *(bP - 1); - colorA = *(bP); + colorA = *(bP ); colorB = *(bP + 1); colorK = *(bP + 2); colorH = *(bP + srcPitch - 1); - colorC = *(bP + srcPitch); + colorC = *(bP + srcPitch ); colorD = *(bP + srcPitch + 1); colorL = *(bP + srcPitch + 2); colorM = *(bP + srcPitch * 2 - 1); - colorN = *(bP + srcPitch * 2); + colorN = *(bP + srcPitch * 2 ); colorO = *(bP + srcPitch * 2 + 1); - colorP = *(bP + srcPitch * 2 + 2); + // colorP = *(bP + srcPitch * 2 + 2); + unsigned long product0, product1, product2; if (colorA == colorD && colorB != colorC) { - if ((colorA == colorE && colorB == colorL) || - (colorA == colorC && colorA == colorF - && colorB != colorE && colorB == colorJ)) { - product = colorA; - } else { - product = interpolate(colorA, colorB); - } - - if ((colorA == colorG && colorC == colorO) || - (colorA == colorB && colorA == colorH - && colorG != colorC && colorC == colorM)) { - product1 = colorA; - } else { - product1 = interpolate(colorA, colorC); - } + product0 = (colorA == colorE && colorB == colorL) + || (colorA == colorC && colorA == colorF + && colorB != colorE && colorB == colorJ) + ? colorA + : interpolate(colorA, colorB); + product1 = (colorA == colorG && colorC == colorO) + || (colorA == colorB && colorA == colorH + && colorG != colorC && colorC == colorM) + ? colorA + : interpolate(colorA, colorC); product2 = colorA; } else if (colorB == colorC && colorA != colorD) { - if ((colorB == colorF && colorA == colorH) || - (colorB == colorE && colorB == colorD - && colorA != colorF && colorA == colorI)) { - product = colorB; - } else { - product = interpolate(colorA, colorB); - } - - if ((colorC == colorH && colorA == colorF) || - (colorC == colorG && colorC == colorD - && colorA != colorH && colorA == colorI)) { - product1 = colorC; - } else { - product1 = interpolate(colorA, colorC); - } + product0 = (colorB == colorF && colorA == colorH) + || (colorB == colorE && colorB == colorD + && colorA != colorF && colorA == colorI) + ? colorB + : interpolate(colorA, colorB); + product1 = (colorC == colorH && colorA == colorF) + || (colorC == colorG && colorC == colorD + && colorA != colorH && colorA == colorI) + ? colorC + : interpolate(colorA, colorC); product2 = colorB; } else if (colorA == colorD && colorB == colorC) { if (colorA == colorB) { - product = colorA; + product0 = colorA; product1 = colorA; product2 = colorA; } else { - register int r = 0; - + product0 = interpolate(colorA, colorB); product1 = interpolate(colorA, colorC); - product = interpolate(colorA, colorB); + int r = 0; r += getResult1(colorA, colorB, colorG, colorE); r += getResult2(colorB, colorA, colorK, colorF); r += getResult2(colorB, colorA, colorH, colorN); r += getResult1(colorA, colorB, colorL, colorO); - - if (r > 0) + if (r > 0) { product2 = colorA; - else if (r < 0) + } else if (r < 0) { product2 = colorB; - else { + } else { product2 = qInterpolate(colorA, colorB, colorC, colorD); } } @@ -176,32 +172,32 @@ static void filter(gambatte::uint_least32_t *dstPtr, const std::ptrdiff_t dstPit product2 = qInterpolate(colorA, colorB, colorC, colorD); if (colorA == colorC && colorA == colorF - && colorB != colorE && colorB == colorJ) { - product = colorA; - } else if (colorB == colorE && colorB == colorD - && colorA != colorF && colorA == colorI) { - product = colorB; - } else { - product = interpolate(colorA, colorB); - } + && colorB != colorE && colorB == colorJ) { + product0 = colorA; + } else if (colorB == colorE && colorB == colorD + && colorA != colorF && colorA == colorI) { + product0 = colorB; + } else { + product0 = interpolate(colorA, colorB); + } if (colorA == colorB && colorA == colorH - && colorG != colorC && colorC == colorM) { - product1 = colorA; - } else if (colorC == colorG && colorC == colorD - && colorA != colorH && colorA == colorI) { - product1 = colorC; - } else { - product1 = interpolate(colorA, colorC); - } + && colorG != colorC && colorC == colorM) { + product1 = colorA; + } else if (colorC == colorG && colorC == colorD + && colorA != colorH && colorA == colorI) { + product1 = colorC; + } else { + product1 = interpolate(colorA, colorC); + } } - *dP = colorA; - *(dP + 1) = product; - *(dP + dstPitch) = product1; - *(dP + dstPitch + 1) = product2; - ++bP; + *(dP ) = colorA; + *(dP + 1) = product0; + *(dP + dstPitch ) = product1; + *(dP + dstPitch + 1) = product2; dP += 2; + ++bP; } srcPtr += srcPitch; @@ -209,28 +205,29 @@ static void filter(gambatte::uint_least32_t *dstPtr, const std::ptrdiff_t dstPit } } -enum { WIDTH = VfilterInfo::IN_WIDTH }; -enum { HEIGHT = VfilterInfo::IN_HEIGHT }; -enum { PITCH = WIDTH + 3 }; -enum { BUF_SIZE = (HEIGHT + 3) * PITCH }; -enum { BUF_OFFSET = PITCH + 1 }; +enum { in_width = VfilterInfo::in_width }; +enum { in_height = VfilterInfo::in_height }; +enum { in_pitch = in_width + 3 }; +enum { buf_size = (in_height + 3ul) * in_pitch }; +enum { buf_offset = in_pitch + 1 }; } // anon namespace Kreed2xSaI::Kreed2xSaI() -: buffer_(BUF_SIZE) +: buffer_(buf_size) { std::fill_n(buffer_.get(), buffer_.size(), 0); } -void* Kreed2xSaI::inBuf() const { - return buffer_ + BUF_OFFSET; +void * Kreed2xSaI::inBuf() const { + return buffer_ + buf_offset; } std::ptrdiff_t Kreed2xSaI::inPitch() const { - return PITCH; + return in_pitch; } -void Kreed2xSaI::draw(void *const dbuffer, const std::ptrdiff_t pitch) { - ::filter(static_cast(dbuffer), pitch, buffer_ + BUF_OFFSET); +void Kreed2xSaI::draw(void *dbuffer, std::ptrdiff_t dpitch) { + ::filter(static_cast(dbuffer), + dpitch, buffer_ + buf_offset); } diff --git a/common/videolink/vfilters/kreed2xsai.h b/common/videolink/vfilters/kreed2xsai.h old mode 100755 new mode 100644 index d57e028b..ddebeb47 --- a/common/videolink/vfilters/kreed2xsai.h +++ b/common/videolink/vfilters/kreed2xsai.h @@ -25,15 +25,17 @@ #include "gbint.h" class Kreed2xSaI : public VideoLink { - const Array buffer_; public: - enum { OUT_WIDTH = VfilterInfo::IN_WIDTH * 2 }; - enum { OUT_HEIGHT = VfilterInfo::IN_HEIGHT * 2 }; + enum { out_width = VfilterInfo::in_width * 2 }; + enum { out_height = VfilterInfo::in_height * 2 }; Kreed2xSaI(); - virtual void* inBuf() const; + virtual void * inBuf() const; virtual std::ptrdiff_t inPitch() const; virtual void draw(void *dst, std::ptrdiff_t dstpitch); + +private: + Array const buffer_; }; #endif diff --git a/common/videolink/vfilters/maxsthq2x.cpp b/common/videolink/vfilters/maxsthq2x.cpp old mode 100755 new mode 100644 index d5e8eb73..021ee2aa --- a/common/videolink/vfilters/maxsthq2x.cpp +++ b/common/videolink/vfilters/maxsthq2x.cpp @@ -21,106 +21,110 @@ ***************************************************************************/ #include "maxsthq2x.h" -static /*inline*/ unsigned long Interp1(const unsigned long c1, const unsigned long c2) { - const unsigned long lowbits = ((c1 & 0x030303) * 3 + (c2 & 0x030303)) & 0x030303; - +static unsigned long blend1(unsigned long c1, unsigned long c2) { + unsigned long lowbits = ((c1 & 0x030303) * 3 + (c2 & 0x030303)) & 0x030303; return (c1 * 3 + c2 - lowbits) >> 2; } -static /*inline*/ unsigned long Interp2(const unsigned long c1, const unsigned long c2, const unsigned long c3) { - const unsigned long lowbits = ((c1 * 2 & 0x020202) + (c2 & 0x030303) + (c3 & 0x030303)) & 0x030303; - +static unsigned long blend2(unsigned long c1, unsigned long c2, unsigned long c3) { + unsigned long lowbits = ((c1 & 0x030303) * 2 + + (c2 & 0x030303) + + (c3 & 0x030303)) & 0x030303; return (c1 * 2 + c2 + c3 - lowbits) >> 2; } -static /*inline*/ unsigned long Interp6(const unsigned long c1, const unsigned long c2, const unsigned long c3) { - const unsigned long lowbits = ((c1 & 0x070707) * 5 + (c2 * 2 & 0x060606) + (c3 & 0x070707)) & 0x070707; - +static unsigned long blend6(unsigned long c1, unsigned long c2, unsigned long c3) { + unsigned long lowbits = ((c1 & 0x070707) * 5 + + (c2 & 0x070707) * 2 + + (c3 & 0x070707)) & 0x070707; return ((c1 * 5 + c2 * 2 + c3) - lowbits) >> 3; } -static /*inline*/ unsigned long Interp7(const unsigned long c1, const unsigned long c2, const unsigned long c3) { - const unsigned long lowbits = ((c1 & 0x070707) * 6 + (c2 & 0x070707) + (c3 & 0x070707)) & 0x070707; - +static unsigned long blend7(unsigned long c1, unsigned long c2, unsigned long c3) { + unsigned long lowbits = ((c1 & 0x070707) * 6 + + (c2 & 0x070707) + + (c3 & 0x070707)) & 0x070707; return ((c1 * 6 + c2 + c3) - lowbits) >> 3; } -static /*inline*/ unsigned long Interp9(unsigned long c1, const unsigned long c2, const unsigned long c3) { - const unsigned long lowbits = ((c1 * 2 & 0x070707) + ((c2 & 0x070707) + (c3 & 0x070707)) * 3) & 0x070707; - +static unsigned long blend9(unsigned long c1, unsigned long c2, unsigned long c3) { + unsigned long lowbits = ((c1 & 0x070707) * 2 + + ((c2 & 0x070707) + (c3 & 0x070707)) * 3) & 0x070707; return (c1 * 2 + (c2 + c3) * 3 - lowbits) >> 3; } -static /*inline*/ unsigned long Interp10(const unsigned long c1, const unsigned long c2, const unsigned long c3) { - const unsigned long lowbits = ((c1 & 0x0F0F0F) * 14 + (c2 & 0x0F0F0F) + (c3 & 0x0F0F0F)) & 0x0F0F0F; - +static unsigned long blend10(unsigned long c1, unsigned long c2, unsigned long c3) { + unsigned long lowbits = ((c1 & 0x0F0F0F) * 14 + + (c2 & 0x0F0F0F) + + (c3 & 0x0F0F0F)) & 0x0F0F0F; return (c1 * 14 + c2 + c3 - lowbits) >> 4; } -#define PIXEL00_0 *pOut = w[5]; -#define PIXEL00_10 *pOut = Interp1(w[5], w[1]); -#define PIXEL00_11 *pOut = Interp1(w[5], w[4]); -#define PIXEL00_12 *pOut = Interp1(w[5], w[2]); -#define PIXEL00_20 *pOut = Interp2(w[5], w[4], w[2]); -#define PIXEL00_21 *pOut = Interp2(w[5], w[1], w[2]); -#define PIXEL00_22 *pOut = Interp2(w[5], w[1], w[4]); -#define PIXEL00_60 *pOut = Interp6(w[5], w[2], w[4]); -#define PIXEL00_61 *pOut = Interp6(w[5], w[4], w[2]); -#define PIXEL00_70 *pOut = Interp7(w[5], w[4], w[2]); -#define PIXEL00_90 *pOut = Interp9(w[5], w[4], w[2]); -#define PIXEL00_100 *pOut = Interp10(w[5], w[4], w[2]); -#define PIXEL01_0 *(pOut+1) = w[5]; -#define PIXEL01_10 *(pOut+1) = Interp1(w[5], w[3]); -#define PIXEL01_11 *(pOut+1) = Interp1(w[5], w[2]); -#define PIXEL01_12 *(pOut+1) = Interp1(w[5], w[6]); -#define PIXEL01_20 *(pOut+1) = Interp2(w[5], w[2], w[6]); -#define PIXEL01_21 *(pOut+1) = Interp2(w[5], w[3], w[6]); -#define PIXEL01_22 *(pOut+1) = Interp2(w[5], w[3], w[2]); -#define PIXEL01_60 *(pOut+1) = Interp6(w[5], w[6], w[2]); -#define PIXEL01_61 *(pOut+1) = Interp6(w[5], w[2], w[6]); -#define PIXEL01_70 *(pOut+1) = Interp7(w[5], w[2], w[6]); -#define PIXEL01_90 *(pOut+1) = Interp9(w[5], w[2], w[6]); -#define PIXEL01_100 *(pOut+1) = Interp10(w[5], w[2], w[6]); -#define PIXEL10_0 *(pOut+dstPitch) = w[5]; -#define PIXEL10_10 *(pOut+dstPitch) = Interp1(w[5], w[7]); -#define PIXEL10_11 *(pOut+dstPitch) = Interp1(w[5], w[8]); -#define PIXEL10_12 *(pOut+dstPitch) = Interp1(w[5], w[4]); -#define PIXEL10_20 *(pOut+dstPitch) = Interp2(w[5], w[8], w[4]); -#define PIXEL10_21 *(pOut+dstPitch) = Interp2(w[5], w[7], w[4]); -#define PIXEL10_22 *(pOut+dstPitch) = Interp2(w[5], w[7], w[8]); -#define PIXEL10_60 *(pOut+dstPitch) = Interp6(w[5], w[4], w[8]); -#define PIXEL10_61 *(pOut+dstPitch) = Interp6(w[5], w[8], w[4]); -#define PIXEL10_70 *(pOut+dstPitch) = Interp7(w[5], w[8], w[4]); -#define PIXEL10_90 *(pOut+dstPitch) = Interp9(w[5], w[8], w[4]); -#define PIXEL10_100 *(pOut+dstPitch) = Interp10(w[5], w[8], w[4]); -#define PIXEL11_0 *(pOut+dstPitch+1) = w[5]; -#define PIXEL11_10 *(pOut+dstPitch+1) = Interp1(w[5], w[9]); -#define PIXEL11_11 *(pOut+dstPitch+1) = Interp1(w[5], w[6]); -#define PIXEL11_12 *(pOut+dstPitch+1) = Interp1(w[5], w[8]); -#define PIXEL11_20 *(pOut+dstPitch+1) = Interp2(w[5], w[6], w[8]); -#define PIXEL11_21 *(pOut+dstPitch+1) = Interp2(w[5], w[9], w[8]); -#define PIXEL11_22 *(pOut+dstPitch+1) = Interp2(w[5], w[9], w[6]); -#define PIXEL11_60 *(pOut+dstPitch+1) = Interp6(w[5], w[8], w[6]); -#define PIXEL11_61 *(pOut+dstPitch+1) = Interp6(w[5], w[6], w[8]); -#define PIXEL11_70 *(pOut+dstPitch+1) = Interp7(w[5], w[6], w[8]); -#define PIXEL11_90 *(pOut+dstPitch+1) = Interp9(w[5], w[6], w[8]); -#define PIXEL11_100 *(pOut+dstPitch+1) = Interp10(w[5], w[6], w[8]); +#define PIXEL00_0 *(out ) = w[5]; +#define PIXEL00_10 *(out ) = blend1(w[5], w[1]); +#define PIXEL00_11 *(out ) = blend1(w[5], w[4]); +#define PIXEL00_12 *(out ) = blend1(w[5], w[2]); +#define PIXEL00_20 *(out ) = blend2(w[5], w[4], w[2]); +#define PIXEL00_21 *(out ) = blend2(w[5], w[1], w[2]); +#define PIXEL00_22 *(out ) = blend2(w[5], w[1], w[4]); +#define PIXEL00_60 *(out ) = blend6(w[5], w[2], w[4]); +#define PIXEL00_61 *(out ) = blend6(w[5], w[4], w[2]); +#define PIXEL00_70 *(out ) = blend7(w[5], w[4], w[2]); +#define PIXEL00_90 *(out ) = blend9(w[5], w[4], w[2]); +#define PIXEL00_100 *(out ) = blend10(w[5], w[4], w[2]); +#define PIXEL01_0 *(out + 1) = w[5]; +#define PIXEL01_10 *(out + 1) = blend1(w[5], w[3]); +#define PIXEL01_11 *(out + 1) = blend1(w[5], w[2]); +#define PIXEL01_12 *(out + 1) = blend1(w[5], w[6]); +#define PIXEL01_20 *(out + 1) = blend2(w[5], w[2], w[6]); +#define PIXEL01_21 *(out + 1) = blend2(w[5], w[3], w[6]); +#define PIXEL01_22 *(out + 1) = blend2(w[5], w[3], w[2]); +#define PIXEL01_60 *(out + 1) = blend6(w[5], w[6], w[2]); +#define PIXEL01_61 *(out + 1) = blend6(w[5], w[2], w[6]); +#define PIXEL01_70 *(out + 1) = blend7(w[5], w[2], w[6]); +#define PIXEL01_90 *(out + 1) = blend9(w[5], w[2], w[6]); +#define PIXEL01_100 *(out + 1) = blend10(w[5], w[2], w[6]); +#define PIXEL10_0 *(out + dstPitch ) = w[5]; +#define PIXEL10_10 *(out + dstPitch ) = blend1(w[5], w[7]); +#define PIXEL10_11 *(out + dstPitch ) = blend1(w[5], w[8]); +#define PIXEL10_12 *(out + dstPitch ) = blend1(w[5], w[4]); +#define PIXEL10_20 *(out + dstPitch ) = blend2(w[5], w[8], w[4]); +#define PIXEL10_21 *(out + dstPitch ) = blend2(w[5], w[7], w[4]); +#define PIXEL10_22 *(out + dstPitch ) = blend2(w[5], w[7], w[8]); +#define PIXEL10_60 *(out + dstPitch ) = blend6(w[5], w[4], w[8]); +#define PIXEL10_61 *(out + dstPitch ) = blend6(w[5], w[8], w[4]); +#define PIXEL10_70 *(out + dstPitch ) = blend7(w[5], w[8], w[4]); +#define PIXEL10_90 *(out + dstPitch ) = blend9(w[5], w[8], w[4]); +#define PIXEL10_100 *(out + dstPitch ) = blend10(w[5], w[8], w[4]); +#define PIXEL11_0 *(out + dstPitch + 1) = w[5]; +#define PIXEL11_10 *(out + dstPitch + 1) = blend1(w[5], w[9]); +#define PIXEL11_11 *(out + dstPitch + 1) = blend1(w[5], w[6]); +#define PIXEL11_12 *(out + dstPitch + 1) = blend1(w[5], w[8]); +#define PIXEL11_20 *(out + dstPitch + 1) = blend2(w[5], w[6], w[8]); +#define PIXEL11_21 *(out + dstPitch + 1) = blend2(w[5], w[9], w[8]); +#define PIXEL11_22 *(out + dstPitch + 1) = blend2(w[5], w[9], w[6]); +#define PIXEL11_60 *(out + dstPitch + 1) = blend6(w[5], w[8], w[6]); +#define PIXEL11_61 *(out + dstPitch + 1) = blend6(w[5], w[6], w[8]); +#define PIXEL11_70 *(out + dstPitch + 1) = blend7(w[5], w[6], w[8]); +#define PIXEL11_90 *(out + dstPitch + 1) = blend9(w[5], w[6], w[8]); +#define PIXEL11_100 *(out + dstPitch + 1) = blend10(w[5], w[6], w[8]); -static /*inline*/ bool Diff(const unsigned long w1, const unsigned long w2) { - const unsigned rdiff = (w1 >> 16) - (w2 >> 16); - const unsigned gdiff = (w1 >> 8 & 0xFF) - (w2 >> 8 & 0xFF); - const unsigned bdiff = (w1 & 0xFF) - (w2 & 0xFF); +static bool diff(unsigned long const w1, unsigned long const w2) { + unsigned rdiff = (w1 >> 16 ) - (w2 >> 16 ); + unsigned gdiff = (w1 >> 8 & 0xFF) - (w2 >> 8 & 0xFF); + unsigned bdiff = (w1 & 0xFF) - (w2 & 0xFF); - return rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 || - rdiff - bdiff + 0x1CU > 0x1CU * 2 || - gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2; + return rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 + || rdiff - bdiff + 0x1CU > 0x1CU * 2 + || gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2; } -template -static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch, const gambatte::uint_least32_t *pIn) +template +static void filter(gambatte::uint_least32_t *out, + std::ptrdiff_t const dstPitch, + gambatte::uint_least32_t const *in) { unsigned long w[10]; - // +----+----+----+ // | | | | // | w1 | w2 | w3 | @@ -132,29 +136,26 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch // | w7 | w8 | w9 | // +----+----+----+ - for (unsigned j = 0; j < Yres; j++) { - const unsigned prevline = j > 0 ? Xres : 0; - const unsigned nextline = j < Yres - 1 ? Xres : 0; - - for (unsigned i = 0; i < Xres; i++) { - w[2] = *(pIn - prevline); - w[5] = *(pIn); - w[8] = *(pIn + nextline); - + for (int j = 0; j < y_res; j++) { + std::ptrdiff_t const prevline = j > 0 ? -x_res : 0; + std::ptrdiff_t const nextline = j < y_res - 1 ? x_res : 0; + for (int i = 0; i < x_res; i++) { + w[2] = *(in + prevline); + w[5] = *(in ); + w[8] = *(in + nextline); if (i > 0) { - w[1] = *(pIn - prevline - 1); - w[4] = *(pIn - 1); - w[7] = *(pIn + nextline - 1); + w[1] = *(in + prevline - 1); + w[4] = *(in - 1); + w[7] = *(in + nextline - 1); } else { w[1] = w[2]; w[4] = w[5]; w[7] = w[8]; } - - if (i < Xres - 1) { - w[3] = *(pIn - prevline + 1); - w[6] = *(pIn + 1); - w[9] = *(pIn + nextline + 1); + if (i < x_res - 1) { + w[3] = *(in + prevline + 1); + w[6] = *(in + 1); + w[9] = *(in + nextline + 1); } else { w[3] = w[2]; w[6] = w[5]; @@ -164,48 +165,46 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch unsigned pattern = 0; { + unsigned const r1 = w[5] >> 16; + unsigned const g1 = w[5] >> 8 & 0xFF; + unsigned const b1 = w[5] & 0xFF; unsigned flag = 1; - - const unsigned r1 = w[5] >> 16; - const unsigned g1 = w[5] >> 8 & 0xFF; - const unsigned b1 = w[5] & 0xFF; - - for (unsigned k = 1; k < 10; ++k) { - if (k == 5) continue; + for (int k = 1; k < 10; ++k) { + if (k == 5) + continue; if (w[k] != w[5]) { - const unsigned rdiff = r1 - (w[k] >> 16); - const unsigned gdiff = g1 - (w[k] >> 8 & 0xFF); - const unsigned bdiff = b1 - (w[k] & 0xFF); - - if (rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 || - rdiff - bdiff + 0x1CU > 0x1CU * 2 || - gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2) + unsigned const rdiff = r1 - (w[k] >> 16 ); + unsigned const gdiff = g1 - (w[k] >> 8 & 0xFF); + unsigned const bdiff = b1 - (w[k] & 0xFF); + if (rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 + || rdiff - bdiff + 0x1CU > 0x1CU * 2 + || gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2) { pattern |= flag; + } } flag <<= 1; } } - switch (pattern) - { - case 0: - case 1: - case 4: - case 32: - case 128: - case 5: - case 132: - case 160: - case 33: - case 129: - case 36: - case 133: - case 164: - case 161: - case 37: - case 165: + switch (pattern) { + case 0: + case 1: + case 4: + case 32: + case 128: + case 5: + case 132: + case 160: + case 33: + case 129: + case 36: + case 133: + case 164: + case 161: + case 37: + case 165: { PIXEL00_20 PIXEL01_20 @@ -213,10 +212,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 2: - case 34: - case 130: - case 162: + case 2: + case 34: + case 130: + case 162: { PIXEL00_22 PIXEL01_21 @@ -224,10 +223,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 16: - case 17: - case 48: - case 49: + case 16: + case 17: + case 48: + case 49: { PIXEL00_20 PIXEL01_22 @@ -235,10 +234,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 64: - case 65: - case 68: - case 69: + case 64: + case 65: + case 68: + case 69: { PIXEL00_20 PIXEL01_20 @@ -246,10 +245,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 8: - case 12: - case 136: - case 140: + case 8: + case 12: + case 136: + case 140: { PIXEL00_21 PIXEL01_20 @@ -257,10 +256,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 3: - case 35: - case 131: - case 163: + case 3: + case 35: + case 131: + case 163: { PIXEL00_11 PIXEL01_21 @@ -268,10 +267,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 6: - case 38: - case 134: - case 166: + case 6: + case 38: + case 134: + case 166: { PIXEL00_22 PIXEL01_12 @@ -279,10 +278,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 20: - case 21: - case 52: - case 53: + case 20: + case 21: + case 52: + case 53: { PIXEL00_20 PIXEL01_11 @@ -290,10 +289,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 144: - case 145: - case 176: - case 177: + case 144: + case 145: + case 176: + case 177: { PIXEL00_20 PIXEL01_22 @@ -301,10 +300,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 192: - case 193: - case 196: - case 197: + case 192: + case 193: + case 196: + case 197: { PIXEL00_20 PIXEL01_20 @@ -312,10 +311,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 96: - case 97: - case 100: - case 101: + case 96: + case 97: + case 100: + case 101: { PIXEL00_20 PIXEL01_20 @@ -323,10 +322,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 40: - case 44: - case 168: - case 172: + case 40: + case 44: + case 168: + case 172: { PIXEL00_21 PIXEL01_20 @@ -334,10 +333,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 9: - case 13: - case 137: - case 141: + case 9: + case 13: + case 137: + case 141: { PIXEL00_12 PIXEL01_20 @@ -345,11 +344,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 18: - case 50: + case 18: + case 50: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -361,13 +360,13 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 80: - case 81: + case 80: + case 81: { PIXEL00_20 PIXEL01_22 PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -377,12 +376,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 72: - case 76: + case 72: + case 76: { PIXEL00_21 PIXEL01_20 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -393,10 +392,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 10: - case 138: + case 10: + case 138: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -409,7 +408,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 66: + case 66: { PIXEL00_22 PIXEL01_21 @@ -417,7 +416,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 24: + case 24: { PIXEL00_21 PIXEL01_22 @@ -425,9 +424,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 7: - case 39: - case 135: + case 7: + case 39: + case 135: { PIXEL00_11 PIXEL01_12 @@ -435,9 +434,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 148: - case 149: - case 180: + case 148: + case 149: + case 180: { PIXEL00_20 PIXEL01_11 @@ -445,9 +444,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 224: - case 228: - case 225: + case 224: + case 228: + case 225: { PIXEL00_20 PIXEL01_20 @@ -455,9 +454,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 41: - case 169: - case 45: + case 41: + case 169: + case 45: { PIXEL00_12 PIXEL01_20 @@ -465,11 +464,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 22: - case 54: + case 22: + case 54: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -481,13 +480,13 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 208: - case 209: + case 208: + case 209: { PIXEL00_20 PIXEL01_22 PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -497,12 +496,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 104: - case 108: + case 104: + case 108: { PIXEL00_21 PIXEL01_20 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -513,10 +512,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 11: - case 139: + case 11: + case 139: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -529,10 +528,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 19: - case 51: + case 19: + case 51: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL00_11 PIXEL01_10 @@ -546,11 +545,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 146: - case 178: + case 146: + case 178: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 PIXEL11_12 @@ -563,11 +562,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_20 break; } - case 84: - case 85: + case 84: + case 85: { PIXEL00_20 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL01_11 PIXEL11_10 @@ -580,12 +579,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_21 break; } - case 112: - case 113: + case 112: + case 113: { PIXEL00_20 PIXEL01_22 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL10_12 PIXEL11_10 @@ -597,12 +596,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 200: - case 204: + case 200: + case 204: { PIXEL00_21 PIXEL01_20 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 PIXEL11_11 @@ -614,10 +613,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 73: - case 77: + case 73: + case 77: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL00_12 PIXEL10_10 @@ -631,10 +630,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 42: - case 170: + case 42: + case 170: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 PIXEL10_11 @@ -648,10 +647,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 14: - case 142: + case 14: + case 142: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 PIXEL01_12 @@ -665,7 +664,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 67: + case 67: { PIXEL00_11 PIXEL01_21 @@ -673,7 +672,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 70: + case 70: { PIXEL00_22 PIXEL01_12 @@ -681,7 +680,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 28: + case 28: { PIXEL00_21 PIXEL01_11 @@ -689,7 +688,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 152: + case 152: { PIXEL00_21 PIXEL01_22 @@ -697,7 +696,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 194: + case 194: { PIXEL00_22 PIXEL01_21 @@ -705,7 +704,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 98: + case 98: { PIXEL00_22 PIXEL01_21 @@ -713,7 +712,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 56: + case 56: { PIXEL00_21 PIXEL01_22 @@ -721,7 +720,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 25: + case 25: { PIXEL00_12 PIXEL01_22 @@ -729,10 +728,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 26: - case 31: + case 26: + case 31: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -740,7 +739,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_20 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -752,11 +751,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 82: - case 214: + case 82: + case 214: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -765,7 +764,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_20 } PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -775,12 +774,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 88: - case 248: + case 88: + case 248: { PIXEL00_21 PIXEL01_22 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -788,7 +787,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_20 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -798,10 +797,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 74: - case 107: + case 74: + case 107: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -810,7 +809,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_20 } PIXEL01_21 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -821,9 +820,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 27: + case 27: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -836,10 +835,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 86: + case 86: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -851,12 +850,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 216: + case 216: { PIXEL00_21 PIXEL01_22 PIXEL10_10 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -866,11 +865,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 106: + case 106: { PIXEL00_10 PIXEL01_21 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -881,10 +880,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 30: + case 30: { PIXEL00_10 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -896,12 +895,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 210: + case 210: { PIXEL00_22 PIXEL01_10 PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -911,11 +910,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 120: + case 120: { PIXEL00_21 PIXEL01_22 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -926,9 +925,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 75: + case 75: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -941,7 +940,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 29: + case 29: { PIXEL00_12 PIXEL01_11 @@ -949,7 +948,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 198: + case 198: { PIXEL00_22 PIXEL01_12 @@ -957,7 +956,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 184: + case 184: { PIXEL00_21 PIXEL01_22 @@ -965,7 +964,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 99: + case 99: { PIXEL00_11 PIXEL01_21 @@ -973,7 +972,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 57: + case 57: { PIXEL00_12 PIXEL01_22 @@ -981,7 +980,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 71: + case 71: { PIXEL00_11 PIXEL01_12 @@ -989,7 +988,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 156: + case 156: { PIXEL00_21 PIXEL01_11 @@ -997,7 +996,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 226: + case 226: { PIXEL00_22 PIXEL01_21 @@ -1005,7 +1004,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 60: + case 60: { PIXEL00_21 PIXEL01_11 @@ -1013,7 +1012,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 195: + case 195: { PIXEL00_11 PIXEL01_21 @@ -1021,7 +1020,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 102: + case 102: { PIXEL00_22 PIXEL01_12 @@ -1029,7 +1028,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 153: + case 153: { PIXEL00_12 PIXEL01_22 @@ -1037,9 +1036,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 58: + case 58: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1047,7 +1046,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1059,10 +1058,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 83: + case 83: { PIXEL00_11 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1071,7 +1070,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_70 } PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1081,11 +1080,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 92: + case 92: { PIXEL00_21 PIXEL01_11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1093,7 +1092,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1103,9 +1102,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 202: + case 202: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1114,7 +1113,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_70 } PIXEL01_21 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1125,9 +1124,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 78: + case 78: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1136,7 +1135,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_70 } PIXEL01_12 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1147,9 +1146,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 154: + case 154: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1157,7 +1156,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1169,10 +1168,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 114: + case 114: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1181,7 +1180,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_70 } PIXEL10_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1191,11 +1190,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 89: + case 89: { PIXEL00_12 PIXEL01_22 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1203,7 +1202,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1213,9 +1212,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 90: + case 90: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1223,7 +1222,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1231,7 +1230,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_70 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1239,7 +1238,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1249,10 +1248,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 55: - case 23: + case 55: + case 23: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL00_11 PIXEL01_0 @@ -1266,11 +1265,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 182: - case 150: + case 182: + case 150: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 PIXEL11_12 @@ -1283,11 +1282,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_20 break; } - case 213: - case 212: + case 213: + case 212: { PIXEL00_20 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL01_11 PIXEL11_0 @@ -1300,12 +1299,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_21 break; } - case 241: - case 240: + case 241: + case 240: { PIXEL00_20 PIXEL01_22 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL10_12 PIXEL11_0 @@ -1317,12 +1316,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 236: - case 232: + case 236: + case 232: { PIXEL00_21 PIXEL01_20 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 PIXEL11_11 @@ -1334,10 +1333,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 109: - case 105: + case 109: + case 105: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL00_12 PIXEL10_0 @@ -1351,10 +1350,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 171: - case 43: + case 171: + case 43: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 PIXEL10_11 @@ -1368,10 +1367,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 143: - case 15: + case 143: + case 15: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 PIXEL01_12 @@ -1385,11 +1384,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 124: + case 124: { PIXEL00_21 PIXEL01_11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -1400,9 +1399,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 203: + case 203: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -1415,10 +1414,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 62: + case 62: { PIXEL00_10 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -1430,12 +1429,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 211: + case 211: { PIXEL00_11 PIXEL01_10 PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -1445,10 +1444,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 118: + case 118: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -1460,12 +1459,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 217: + case 217: { PIXEL00_12 PIXEL01_22 PIXEL10_10 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -1475,11 +1474,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 110: + case 110: { PIXEL00_10 PIXEL01_12 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -1490,9 +1489,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 155: + case 155: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -1505,7 +1504,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 188: + case 188: { PIXEL00_21 PIXEL01_11 @@ -1513,7 +1512,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 185: + case 185: { PIXEL00_12 PIXEL01_22 @@ -1521,7 +1520,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 61: + case 61: { PIXEL00_12 PIXEL01_11 @@ -1529,7 +1528,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 157: + case 157: { PIXEL00_12 PIXEL01_11 @@ -1537,7 +1536,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 103: + case 103: { PIXEL00_11 PIXEL01_12 @@ -1545,7 +1544,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 227: + case 227: { PIXEL00_11 PIXEL01_21 @@ -1553,7 +1552,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 230: + case 230: { PIXEL00_22 PIXEL01_12 @@ -1561,7 +1560,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 199: + case 199: { PIXEL00_11 PIXEL01_12 @@ -1569,11 +1568,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 220: + case 220: { PIXEL00_21 PIXEL01_11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1581,7 +1580,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -1591,9 +1590,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 158: + case 158: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1601,7 +1600,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -1613,9 +1612,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 234: + case 234: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1624,7 +1623,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_70 } PIXEL01_21 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -1635,10 +1634,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 242: + case 242: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1647,7 +1646,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_70 } PIXEL10_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -1657,9 +1656,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 59: + case 59: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -1667,7 +1666,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_20 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1679,11 +1678,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 121: + case 121: { PIXEL00_12 PIXEL01_22 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -1691,7 +1690,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_20 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1701,10 +1700,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 87: + case 87: { PIXEL00_11 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -1713,7 +1712,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_20 } PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1723,9 +1722,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 79: + case 79: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -1734,7 +1733,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_20 } PIXEL01_12 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1745,9 +1744,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 122: + case 122: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1755,7 +1754,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1763,7 +1762,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_70 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -1771,7 +1770,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_20 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1781,9 +1780,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 94: + case 94: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1791,7 +1790,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -1799,7 +1798,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_20 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1807,7 +1806,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1817,9 +1816,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 218: + case 218: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1827,7 +1826,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1835,7 +1834,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_70 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1843,7 +1842,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -1853,9 +1852,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 91: + case 91: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -1863,7 +1862,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_20 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1871,7 +1870,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_70 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1879,7 +1878,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1889,7 +1888,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 229: + case 229: { PIXEL00_20 PIXEL01_20 @@ -1897,7 +1896,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 167: + case 167: { PIXEL00_11 PIXEL01_12 @@ -1905,7 +1904,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 173: + case 173: { PIXEL00_12 PIXEL01_20 @@ -1913,7 +1912,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 181: + case 181: { PIXEL00_20 PIXEL01_11 @@ -1921,9 +1920,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 186: + case 186: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1931,7 +1930,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_70 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1943,10 +1942,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 115: + case 115: { PIXEL00_11 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -1955,7 +1954,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_70 } PIXEL10_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1965,11 +1964,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 93: + case 93: { PIXEL00_12 PIXEL01_11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -1977,7 +1976,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_70 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -1987,9 +1986,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 206: + case 206: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -1998,7 +1997,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_70 } PIXEL01_12 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -2009,12 +2008,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 205: - case 201: + case 205: + case 201: { PIXEL00_12 PIXEL01_20 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_10 } @@ -2025,10 +2024,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 174: - case 46: + case 174: + case 46: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_10 } @@ -2041,11 +2040,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 179: - case 147: + case 179: + case 147: { PIXEL00_11 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_10 } @@ -2057,13 +2056,13 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 117: - case 116: + case 117: + case 116: { PIXEL00_20 PIXEL01_11 PIXEL10_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_10 } @@ -2073,7 +2072,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 189: + case 189: { PIXEL00_12 PIXEL01_11 @@ -2081,7 +2080,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 231: + case 231: { PIXEL00_11 PIXEL01_12 @@ -2089,10 +2088,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 126: + case 126: { PIXEL00_10 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2100,7 +2099,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_20 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2111,9 +2110,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 219: + case 219: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2123,7 +2122,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } PIXEL01_10 PIXEL10_10 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2133,9 +2132,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 125: + case 125: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL00_12 PIXEL10_0 @@ -2149,10 +2148,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 221: + case 221: { PIXEL00_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL01_11 PIXEL11_0 @@ -2165,9 +2164,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_10 break; } - case 207: + case 207: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 PIXEL01_12 @@ -2181,11 +2180,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 238: + case 238: { PIXEL00_10 PIXEL01_12 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 PIXEL11_11 @@ -2197,10 +2196,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 190: + case 190: { PIXEL00_10 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 PIXEL11_12 @@ -2213,9 +2212,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_11 break; } - case 187: + case 187: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 PIXEL10_11 @@ -2229,11 +2228,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 243: + case 243: { PIXEL00_11 PIXEL01_10 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL10_12 PIXEL11_0 @@ -2245,9 +2244,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 119: + case 119: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL00_11 PIXEL01_0 @@ -2261,12 +2260,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 237: - case 233: + case 237: + case 233: { PIXEL00_12 PIXEL01_20 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2277,10 +2276,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 175: - case 47: + case 175: + case 47: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2293,11 +2292,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_20 break; } - case 183: - case 151: + case 183: + case 151: { PIXEL00_11 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2309,13 +2308,13 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 245: - case 244: + case 245: + case 244: { PIXEL00_20 PIXEL01_11 PIXEL10_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2325,11 +2324,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 250: + case 250: { PIXEL00_10 PIXEL01_10 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2337,7 +2336,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_20 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2347,9 +2346,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 123: + case 123: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2358,7 +2357,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_20 } PIXEL01_10 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2369,9 +2368,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 95: + case 95: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2379,7 +2378,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_20 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2391,10 +2390,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 222: + case 222: { PIXEL00_10 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2403,7 +2402,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_20 } PIXEL10_10 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2413,11 +2412,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 252: + case 252: { PIXEL00_21 PIXEL01_11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2425,7 +2424,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_20 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2435,11 +2434,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 249: + case 249: { PIXEL00_12 PIXEL01_22 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2447,7 +2446,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_100 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2457,9 +2456,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 235: + case 235: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2468,7 +2467,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_20 } PIXEL01_21 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2479,9 +2478,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 111: + case 111: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2490,7 +2489,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_100 } PIXEL01_12 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2501,9 +2500,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_22 break; } - case 63: + case 63: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2511,7 +2510,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_100 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2523,9 +2522,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_21 break; } - case 159: + case 159: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2533,7 +2532,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_20 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2545,10 +2544,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 215: + case 215: { PIXEL00_11 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2557,7 +2556,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_100 } PIXEL10_21 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2567,10 +2566,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 246: + case 246: { PIXEL00_22 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2579,7 +2578,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_20 } PIXEL10_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2589,10 +2588,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 254: + case 254: { PIXEL00_10 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2600,7 +2599,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_20 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2608,7 +2607,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_20 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2618,11 +2617,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 253: + case 253: { PIXEL00_12 PIXEL01_11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2630,7 +2629,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_100 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2640,9 +2639,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 251: + case 251: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2651,7 +2650,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_20 } PIXEL01_10 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2659,7 +2658,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_100 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2669,9 +2668,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 239: + case 239: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2680,7 +2679,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_100 } PIXEL01_12 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2691,9 +2690,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_11 break; } - case 127: + case 127: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2701,7 +2700,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_100 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2709,7 +2708,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_20 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2720,9 +2719,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_10 break; } - case 191: + case 191: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2730,7 +2729,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_100 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2742,9 +2741,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11_12 break; } - case 223: + case 223: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2752,7 +2751,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_20 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2761,7 +2760,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_100 } PIXEL10_10 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2771,10 +2770,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 247: + case 247: { PIXEL00_11 - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2783,7 +2782,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_100 } PIXEL10_12 - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2793,9 +2792,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 255: + case 255: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_0 } @@ -2803,7 +2802,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_100 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_0 } @@ -2811,7 +2810,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL01_100 } - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_0 } @@ -2819,7 +2818,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL10_100 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL11_0 } @@ -2830,27 +2829,30 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch break; } } - ++pIn; - pOut += 2; + + ++in; + out += 2; } - pOut += dstPitch * 2 - static_cast(Xres * 2); + + out += dstPitch * 2 - std::ptrdiff_t(x_res) * 2; } } MaxStHq2x::MaxStHq2x() -: buffer_(VfilterInfo::IN_HEIGHT * VfilterInfo::IN_WIDTH) +: buffer_(std::size_t(VfilterInfo::in_height) * VfilterInfo::in_width) { } -void* MaxStHq2x::inBuf() const { +void * MaxStHq2x::inBuf() const { return buffer_; } std::ptrdiff_t MaxStHq2x::inPitch() const { - return VfilterInfo::IN_WIDTH; + return VfilterInfo::in_width; } -void MaxStHq2x::draw(void *const dbuffer, const std::ptrdiff_t pitch) { - ::filter(static_cast(dbuffer), - pitch, buffer_); +void MaxStHq2x::draw(void *dbuffer, std::ptrdiff_t dpitch) { + ::filter( + static_cast(dbuffer), dpitch, + buffer_); } diff --git a/common/videolink/vfilters/maxsthq2x.h b/common/videolink/vfilters/maxsthq2x.h old mode 100755 new mode 100644 index ad6dca1b..d008969d --- a/common/videolink/vfilters/maxsthq2x.h +++ b/common/videolink/vfilters/maxsthq2x.h @@ -25,15 +25,17 @@ #include "gbint.h" class MaxStHq2x : public VideoLink { - const Array buffer_; public: - enum { OUT_WIDTH = VfilterInfo::IN_WIDTH * 2 }; - enum { OUT_HEIGHT = VfilterInfo::IN_HEIGHT * 2 }; + enum { out_width = VfilterInfo::in_width * 2 }; + enum { out_height = VfilterInfo::in_height * 2 }; MaxStHq2x(); - virtual void* inBuf() const; + virtual void * inBuf() const; virtual std::ptrdiff_t inPitch() const; virtual void draw(void *dst, std::ptrdiff_t dstpitch); + +private: + SimpleArray const buffer_; }; #endif diff --git a/common/videolink/vfilters/maxsthq3x.cpp b/common/videolink/vfilters/maxsthq3x.cpp old mode 100755 new mode 100644 index ba0c0837..dd46fa9a --- a/common/videolink/vfilters/maxsthq3x.cpp +++ b/common/videolink/vfilters/maxsthq3x.cpp @@ -21,103 +21,103 @@ ***************************************************************************/ #include "maxsthq3x.h" -static /*inline*/ unsigned long Interp1(const unsigned long c1, const unsigned long c2) { - const unsigned long lowbits = ((c1 & 0x030303) * 3 + (c2 & 0x030303)) & 0x030303; - +static unsigned long blend1(unsigned long c1, unsigned long c2) { + unsigned long lowbits = ((c1 & 0x030303) * 3 + (c2 & 0x030303)) & 0x030303; return (c1 * 3 + c2 - lowbits) >> 2; } -static /*inline*/ unsigned long Interp2(const unsigned long c1, const unsigned long c2, const unsigned long c3) { - const unsigned long lowbits = ((c1 * 2 & 0x020202) + (c2 & 0x030303) + (c3 & 0x030303)) & 0x030303; - +static unsigned long blend2(unsigned long c1, unsigned long c2, unsigned long c3) { + unsigned long lowbits = ((c1 & 0x030303) * 2 + + (c2 & 0x030303) + + (c3 & 0x030303)) & 0x030303; return (c1 * 2 + c2 + c3 - lowbits) >> 2; } -static /*inline*/ unsigned long Interp3(const unsigned long c1, const unsigned long c2) { - const unsigned long lowbits = ((c1 & 0x070707) * 7 + (c2 & 0x070707)) & 0x070707; - +static unsigned long blend3(unsigned long c1, unsigned long c2) { + unsigned long lowbits = ((c1 & 0x070707) * 7 + (c2 & 0x070707)) & 0x070707; return (c1 * 7 + c2 - lowbits) >> 3; } -static /*inline*/ unsigned long Interp4(const unsigned long c1, const unsigned long c2, const unsigned long c3) { - const unsigned long lowbits = ((c1 * 2 & 0x0E0E0E) + ((c2 & 0x0F0F0F) + (c3 & 0x0F0F0F)) * 7) & 0x0F0F0F; - +static unsigned long blend4(unsigned long c1, unsigned long c2, unsigned long c3) { + unsigned long lowbits = ((c1 & 0x0F0F0F) * 2 + + ((c2 & 0x0F0F0F) + (c3 & 0x0F0F0F)) * 7) & 0x0F0F0F; return (c1 * 2 + (c2 + c3) * 7 - lowbits) >> 4; } -static /*inline*/ unsigned long Interp5(const unsigned long c1, const unsigned long c2) { +static unsigned long blend5(unsigned long c1, unsigned long c2) { return (c1 + c2 - ((c1 ^ c2) & 0x010101)) >> 1; } -#define PIXEL00_1M *pOut = Interp1(w[5], w[1]); -#define PIXEL00_1U *pOut = Interp1(w[5], w[2]); -#define PIXEL00_1L *pOut = Interp1(w[5], w[4]); -#define PIXEL00_2 *pOut = Interp2(w[5], w[4], w[2]); -#define PIXEL00_4 *pOut = Interp4(w[5], w[4], w[2]); -#define PIXEL00_5 *pOut = Interp5(w[4], w[2]); -#define PIXEL00_C *pOut = w[5]; +#define PIXEL00_1M *(out ) = blend1(w[5], w[1]); +#define PIXEL00_1U *(out ) = blend1(w[5], w[2]); +#define PIXEL00_1L *(out ) = blend1(w[5], w[4]); +#define PIXEL00_2 *(out ) = blend2(w[5], w[4], w[2]); +#define PIXEL00_4 *(out ) = blend4(w[5], w[4], w[2]); +#define PIXEL00_5 *(out ) = blend5(w[4], w[2]); +#define PIXEL00_C *(out ) = w[5]; -#define PIXEL01_1 *(pOut+1) = Interp1(w[5], w[2]); -#define PIXEL01_3 *(pOut+1) = Interp3(w[5], w[2]); -#define PIXEL01_6 *(pOut+1) = Interp1(w[2], w[5]); -#define PIXEL01_C *(pOut+1) = w[5]; +#define PIXEL01_1 *(out + 1) = blend1(w[5], w[2]); +#define PIXEL01_3 *(out + 1) = blend3(w[5], w[2]); +#define PIXEL01_6 *(out + 1) = blend1(w[2], w[5]); +#define PIXEL01_C *(out + 1) = w[5]; -#define PIXEL02_1M *(pOut+2) = Interp1(w[5], w[3]); -#define PIXEL02_1U *(pOut+2) = Interp1(w[5], w[2]); -#define PIXEL02_1R *(pOut+2) = Interp1(w[5], w[6]); -#define PIXEL02_2 *(pOut+2) = Interp2(w[5], w[2], w[6]); -#define PIXEL02_4 *(pOut+2) = Interp4(w[5], w[2], w[6]); -#define PIXEL02_5 *(pOut+2) = Interp5(w[2], w[6]); -#define PIXEL02_C *(pOut+2) = w[5]; +#define PIXEL02_1M *(out + 2) = blend1(w[5], w[3]); +#define PIXEL02_1U *(out + 2) = blend1(w[5], w[2]); +#define PIXEL02_1R *(out + 2) = blend1(w[5], w[6]); +#define PIXEL02_2 *(out + 2) = blend2(w[5], w[2], w[6]); +#define PIXEL02_4 *(out + 2) = blend4(w[5], w[2], w[6]); +#define PIXEL02_5 *(out + 2) = blend5(w[2], w[6]); +#define PIXEL02_C *(out + 2) = w[5]; -#define PIXEL10_1 *(pOut+dstPitch) = Interp1(w[5], w[4]); -#define PIXEL10_3 *(pOut+dstPitch) = Interp3(w[5], w[4]); -#define PIXEL10_6 *(pOut+dstPitch) = Interp1(w[4], w[5]); -#define PIXEL10_C *(pOut+dstPitch) = w[5]; +#define PIXEL10_1 *(out + dstPitch ) = blend1(w[5], w[4]); +#define PIXEL10_3 *(out + dstPitch ) = blend3(w[5], w[4]); +#define PIXEL10_6 *(out + dstPitch ) = blend1(w[4], w[5]); +#define PIXEL10_C *(out + dstPitch ) = w[5]; -#define PIXEL11 *(pOut+dstPitch+1) = w[5]; +#define PIXEL11 *(out + dstPitch + 1) = w[5]; -#define PIXEL12_1 *(pOut+dstPitch+2) = Interp1(w[5], w[6]); -#define PIXEL12_3 *(pOut+dstPitch+2) = Interp3(w[5], w[6]); -#define PIXEL12_6 *(pOut+dstPitch+2) = Interp1(w[6], w[5]); -#define PIXEL12_C *(pOut+dstPitch+2) = w[5]; +#define PIXEL12_1 *(out + dstPitch + 2) = blend1(w[5], w[6]); +#define PIXEL12_3 *(out + dstPitch + 2) = blend3(w[5], w[6]); +#define PIXEL12_6 *(out + dstPitch + 2) = blend1(w[6], w[5]); +#define PIXEL12_C *(out + dstPitch + 2) = w[5]; -#define PIXEL20_1M *(pOut+dstPitch*2) = Interp1(w[5], w[7]); -#define PIXEL20_1D *(pOut+dstPitch*2) = Interp1(w[5], w[8]); -#define PIXEL20_1L *(pOut+dstPitch*2) = Interp1(w[5], w[4]); -#define PIXEL20_2 *(pOut+dstPitch*2) = Interp2(w[5], w[8], w[4]); -#define PIXEL20_4 *(pOut+dstPitch*2) = Interp4(w[5], w[8], w[4]); -#define PIXEL20_5 *(pOut+dstPitch*2) = Interp5(w[8], w[4]); -#define PIXEL20_C *(pOut+dstPitch*2) = w[5]; +#define PIXEL20_1M *(out + dstPitch * 2 ) = blend1(w[5], w[7]); +#define PIXEL20_1D *(out + dstPitch * 2 ) = blend1(w[5], w[8]); +#define PIXEL20_1L *(out + dstPitch * 2 ) = blend1(w[5], w[4]); +#define PIXEL20_2 *(out + dstPitch * 2 ) = blend2(w[5], w[8], w[4]); +#define PIXEL20_4 *(out + dstPitch * 2 ) = blend4(w[5], w[8], w[4]); +#define PIXEL20_5 *(out + dstPitch * 2 ) = blend5(w[8], w[4]); +#define PIXEL20_C *(out + dstPitch * 2 ) = w[5]; -#define PIXEL21_1 *(pOut+dstPitch*2+1) = Interp1(w[5], w[8]); -#define PIXEL21_3 *(pOut+dstPitch*2+1) = Interp3(w[5], w[8]); -#define PIXEL21_6 *(pOut+dstPitch*2+1) = Interp1(w[8], w[5]); -#define PIXEL21_C *(pOut+dstPitch*2+1) = w[5]; +#define PIXEL21_1 *(out + dstPitch * 2 + 1) = blend1(w[5], w[8]); +#define PIXEL21_3 *(out + dstPitch * 2 + 1) = blend3(w[5], w[8]); +#define PIXEL21_6 *(out + dstPitch * 2 + 1) = blend1(w[8], w[5]); +#define PIXEL21_C *(out + dstPitch * 2 + 1) = w[5]; -#define PIXEL22_1M *(pOut+dstPitch*2+2) = Interp1(w[5], w[9]); -#define PIXEL22_1D *(pOut+dstPitch*2+2) = Interp1(w[5], w[8]); -#define PIXEL22_1R *(pOut+dstPitch*2+2) = Interp1(w[5], w[6]); -#define PIXEL22_2 *(pOut+dstPitch*2+2) = Interp2(w[5], w[6], w[8]); -#define PIXEL22_4 *(pOut+dstPitch*2+2) = Interp4(w[5], w[6], w[8]); -#define PIXEL22_5 *(pOut+dstPitch*2+2) = Interp5(w[6], w[8]); -#define PIXEL22_C *(pOut+dstPitch*2+2) = w[5]; +#define PIXEL22_1M *(out + dstPitch * 2 + 2) = blend1(w[5], w[9]); +#define PIXEL22_1D *(out + dstPitch * 2 + 2) = blend1(w[5], w[8]); +#define PIXEL22_1R *(out + dstPitch * 2 + 2) = blend1(w[5], w[6]); +#define PIXEL22_2 *(out + dstPitch * 2 + 2) = blend2(w[5], w[6], w[8]); +#define PIXEL22_4 *(out + dstPitch * 2 + 2) = blend4(w[5], w[6], w[8]); +#define PIXEL22_5 *(out + dstPitch * 2 + 2) = blend5(w[6], w[8]); +#define PIXEL22_C *(out + dstPitch * 2 + 2) = w[5]; -static /*inline*/ bool Diff(const unsigned long w1, const unsigned long w2) { - const unsigned rdiff = (w1 >> 16) - (w2 >> 16); - const unsigned gdiff = (w1 >> 8 & 0xFF) - (w2 >> 8 & 0xFF); - const unsigned bdiff = (w1 & 0xFF) - (w2 & 0xFF); +static bool diff(unsigned long const w1, unsigned long const w2) { + unsigned rdiff = (w1 >> 16 ) - (w2 >> 16 ); + unsigned gdiff = (w1 >> 8 & 0xFF) - (w2 >> 8 & 0xFF); + unsigned bdiff = (w1 & 0xFF) - (w2 & 0xFF); - return rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 || - rdiff - bdiff + 0x1CU > 0x1CU * 2 || - gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2; + return rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 + || rdiff - bdiff + 0x1CU > 0x1CU * 2 + || gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2; } -template -static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch, const gambatte::uint_least32_t *pIn) +template +static void filter(gambatte::uint_least32_t *out, + std::ptrdiff_t const dstPitch, + gambatte::uint_least32_t const *in) { unsigned long w[10]; - // +----+----+----+ // | | | | // | w1 | w2 | w3 | @@ -129,29 +129,26 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch // | w7 | w8 | w9 | // +----+----+----+ - for (unsigned j = 0; j < Yres; j++) { - const unsigned prevline = j > 0 ? Xres : 0; - const unsigned nextline = j < Yres - 1 ? Xres : 0; - - for (unsigned i = 0; i < Xres; i++) { - w[2] = *(pIn - prevline); - w[5] = *(pIn); - w[8] = *(pIn + nextline); - + for (int j = 0; j < y_res; j++) { + std::ptrdiff_t const prevline = j > 0 ? -x_res : 0; + std::ptrdiff_t const nextline = j < y_res - 1 ? x_res : 0; + for (int i = 0; i < x_res; i++) { + w[2] = *(in + prevline); + w[5] = *(in ); + w[8] = *(in + nextline); if (i > 0) { - w[1] = *(pIn - prevline - 1); - w[4] = *(pIn - 1); - w[7] = *(pIn + nextline - 1); + w[1] = *(in + prevline - 1); + w[4] = *(in - 1); + w[7] = *(in + nextline - 1); } else { w[1] = w[2]; w[4] = w[5]; w[7] = w[8]; } - - if (i < Xres - 1) { - w[3] = *(pIn - prevline + 1); - w[6] = *(pIn + 1); - w[9] = *(pIn + nextline + 1); + if (i < x_res - 1) { + w[3] = *(in + prevline + 1); + w[6] = *(in + 1); + w[9] = *(in + nextline + 1); } else { w[3] = w[2]; w[6] = w[5]; @@ -161,48 +158,46 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch unsigned pattern = 0; { + unsigned const r1 = w[5] >> 16 ; + unsigned const g1 = w[5] >> 8 & 0xFF; + unsigned const b1 = w[5] & 0xFF; unsigned flag = 1; - - const unsigned r1 = w[5] >> 16; - const unsigned g1 = w[5] >> 8 & 0xFF; - const unsigned b1 = w[5] & 0xFF; - - for (unsigned k = 1; k < 10; ++k) { - if (k == 5) continue; + for (int k = 1; k < 10; ++k) { + if (k == 5) + continue; if (w[k] != w[5]) { - const unsigned rdiff = r1 - (w[k] >> 16); - const unsigned gdiff = g1 - (w[k] >> 8 & 0xFF); - const unsigned bdiff = b1 - (w[k] & 0xFF); - - if (rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 || - rdiff - bdiff + 0x1CU > 0x1CU * 2 || - gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2) + unsigned const rdiff = r1 - (w[k] >> 16 ); + unsigned const gdiff = g1 - (w[k] >> 8 & 0xFF); + unsigned const bdiff = b1 - (w[k] & 0xFF); + if (rdiff + gdiff + bdiff + 0xC0U > 0xC0U * 2 + || rdiff - bdiff + 0x1CU > 0x1CU * 2 + || gdiff * 2 - rdiff - bdiff + 0x30U > 0x30U * 2) { pattern |= flag; + } } flag <<= 1; } } - switch (pattern) - { - case 0: - case 1: - case 4: - case 32: - case 128: - case 5: - case 132: - case 160: - case 33: - case 129: - case 36: - case 133: - case 164: - case 161: - case 37: - case 165: + switch (pattern) { + case 0: + case 1: + case 4: + case 32: + case 128: + case 5: + case 132: + case 160: + case 33: + case 129: + case 36: + case 133: + case 164: + case 161: + case 37: + case 165: { PIXEL00_2 PIXEL01_1 @@ -215,10 +210,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 2: - case 34: - case 130: - case 162: + case 2: + case 34: + case 130: + case 162: { PIXEL00_1M PIXEL01_C @@ -231,10 +226,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 16: - case 17: - case 48: - case 49: + case 16: + case 17: + case 48: + case 49: { PIXEL00_2 PIXEL01_1 @@ -247,10 +242,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 64: - case 65: - case 68: - case 69: + case 64: + case 65: + case 68: + case 69: { PIXEL00_2 PIXEL01_1 @@ -263,10 +258,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 8: - case 12: - case 136: - case 140: + case 8: + case 12: + case 136: + case 140: { PIXEL00_1M PIXEL01_1 @@ -279,10 +274,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 3: - case 35: - case 131: - case 163: + case 3: + case 35: + case 131: + case 163: { PIXEL00_1L PIXEL01_C @@ -295,10 +290,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 6: - case 38: - case 134: - case 166: + case 6: + case 38: + case 134: + case 166: { PIXEL00_1M PIXEL01_C @@ -311,10 +306,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 20: - case 21: - case 52: - case 53: + case 20: + case 21: + case 52: + case 53: { PIXEL00_2 PIXEL01_1 @@ -327,10 +322,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 144: - case 145: - case 176: - case 177: + case 144: + case 145: + case 176: + case 177: { PIXEL00_2 PIXEL01_1 @@ -343,10 +338,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 192: - case 193: - case 196: - case 197: + case 192: + case 193: + case 196: + case 197: { PIXEL00_2 PIXEL01_1 @@ -359,10 +354,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 96: - case 97: - case 100: - case 101: + case 96: + case 97: + case 100: + case 101: { PIXEL00_2 PIXEL01_1 @@ -375,10 +370,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 40: - case 44: - case 168: - case 172: + case 40: + case 44: + case 168: + case 172: { PIXEL00_1M PIXEL01_1 @@ -391,10 +386,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 9: - case 13: - case 137: - case 141: + case 9: + case 13: + case 137: + case 141: { PIXEL00_1U PIXEL01_1 @@ -407,11 +402,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 18: - case 50: + case 18: + case 50: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_1M @@ -430,8 +425,8 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 80: - case 81: + case 80: + case 81: { PIXEL00_2 PIXEL01_1 @@ -439,7 +434,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_1 PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -453,15 +448,15 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 72: - case 76: + case 72: + case 76: { PIXEL00_1M PIXEL01_1 PIXEL02_2 PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_1M @@ -476,10 +471,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 10: - case 138: + case 10: + case 138: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M PIXEL01_C @@ -499,7 +494,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 66: + case 66: { PIXEL00_1M PIXEL01_C @@ -512,7 +507,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 24: + case 24: { PIXEL00_1M PIXEL01_1 @@ -525,9 +520,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 7: - case 39: - case 135: + case 7: + case 39: + case 135: { PIXEL00_1L PIXEL01_C @@ -540,9 +535,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 148: - case 149: - case 180: + case 148: + case 149: + case 180: { PIXEL00_2 PIXEL01_1 @@ -555,9 +550,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 224: - case 228: - case 225: + case 224: + case 228: + case 225: { PIXEL00_2 PIXEL01_1 @@ -570,9 +565,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 41: - case 169: - case 45: + case 41: + case 169: + case 45: { PIXEL00_1U PIXEL01_1 @@ -585,11 +580,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 22: - case 54: + case 22: + case 54: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -608,8 +603,8 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 208: - case 209: + case 208: + case 209: { PIXEL00_2 PIXEL01_1 @@ -617,7 +612,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_1 PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -631,15 +626,15 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 104: - case 108: + case 104: + case 108: { PIXEL00_1M PIXEL01_1 PIXEL02_2 PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -654,10 +649,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 11: - case 139: + case 11: + case 139: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -677,10 +672,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 19: - case 51: + case 19: + case 51: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL00_1L PIXEL01_C @@ -701,10 +696,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 146: - case 178: + case 146: + case 178: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_1M @@ -725,10 +720,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL21_1 break; } - case 84: - case 85: + case 84: + case 85: { - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL02_1U PIXEL12_C @@ -749,10 +744,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_1M break; } - case 112: - case 113: + case 112: + case 113: { - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL20_1L @@ -773,10 +768,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11 break; } - case 200: - case 204: + case 200: + case 204: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_1M @@ -797,10 +792,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_1 break; } - case 73: - case 77: + case 73: + case 77: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL00_1U PIXEL10_C @@ -821,10 +816,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 42: - case 170: + case 42: + case 170: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M PIXEL01_C @@ -845,10 +840,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 14: - case 142: + case 14: + case 142: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M PIXEL01_C @@ -869,7 +864,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 67: + case 67: { PIXEL00_1L PIXEL01_C @@ -882,7 +877,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 70: + case 70: { PIXEL00_1M PIXEL01_C @@ -895,7 +890,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 28: + case 28: { PIXEL00_1M PIXEL01_1 @@ -908,7 +903,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 152: + case 152: { PIXEL00_1M PIXEL01_1 @@ -921,7 +916,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 194: + case 194: { PIXEL00_1M PIXEL01_C @@ -934,7 +929,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 98: + case 98: { PIXEL00_1M PIXEL01_C @@ -947,7 +942,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 56: + case 56: { PIXEL00_1M PIXEL01_1 @@ -960,7 +955,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 25: + case 25: { PIXEL00_1U PIXEL01_1 @@ -973,10 +968,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 26: - case 31: + case 26: + case 31: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL10_C @@ -987,7 +982,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_3 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C PIXEL12_C @@ -1003,11 +998,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 82: - case 214: + case 82: + case 214: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -1021,7 +1016,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11 PIXEL12_C PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL21_C PIXEL22_C @@ -1033,14 +1028,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 88: - case 248: + case 88: + case 248: { PIXEL00_1M PIXEL01_1 PIXEL02_1M PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -1051,7 +1046,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_4 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL22_C @@ -1063,10 +1058,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 74: - case 107: + case 74: + case 107: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -1080,7 +1075,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C PIXEL21_C @@ -1093,9 +1088,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 27: + case 27: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -1115,10 +1110,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 86: + case 86: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -1137,7 +1132,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 216: + case 216: { PIXEL00_1M PIXEL01_1 @@ -1145,7 +1140,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -1159,14 +1154,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 106: + case 106: { PIXEL00_1M PIXEL01_C PIXEL02_1M PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -1181,10 +1176,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 30: + case 30: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -1203,7 +1198,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 210: + case 210: { PIXEL00_1M PIXEL01_C @@ -1211,7 +1206,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_1 PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -1225,14 +1220,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 120: + case 120: { PIXEL00_1M PIXEL01_1 PIXEL02_1M PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -1247,9 +1242,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 75: + case 75: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -1269,7 +1264,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 29: + case 29: { PIXEL00_1U PIXEL01_1 @@ -1282,7 +1277,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 198: + case 198: { PIXEL00_1M PIXEL01_C @@ -1295,7 +1290,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 184: + case 184: { PIXEL00_1M PIXEL01_1 @@ -1308,7 +1303,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 99: + case 99: { PIXEL00_1L PIXEL01_C @@ -1321,7 +1316,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 57: + case 57: { PIXEL00_1U PIXEL01_1 @@ -1334,7 +1329,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 71: + case 71: { PIXEL00_1L PIXEL01_C @@ -1347,7 +1342,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 156: + case 156: { PIXEL00_1M PIXEL01_1 @@ -1360,7 +1355,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 226: + case 226: { PIXEL00_1M PIXEL01_C @@ -1373,7 +1368,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 60: + case 60: { PIXEL00_1M PIXEL01_1 @@ -1386,7 +1381,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 195: + case 195: { PIXEL00_1L PIXEL01_C @@ -1399,7 +1394,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 102: + case 102: { PIXEL00_1M PIXEL01_C @@ -1412,7 +1407,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 153: + case 153: { PIXEL00_1U PIXEL01_1 @@ -1425,9 +1420,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 58: + case 58: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -1436,7 +1431,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -1452,11 +1447,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 83: + case 83: { PIXEL00_1L PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -1469,7 +1464,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_C PIXEL20_1M PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -1479,7 +1474,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 92: + case 92: { PIXEL00_1M PIXEL01_1 @@ -1487,7 +1482,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -1496,7 +1491,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -1506,9 +1501,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 202: + case 202: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -1521,7 +1516,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -1533,9 +1528,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 78: + case 78: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -1548,7 +1543,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -1560,9 +1555,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 154: + case 154: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -1571,7 +1566,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -1587,11 +1582,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 114: + case 114: { PIXEL00_1M PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -1604,7 +1599,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_C PIXEL20_1L PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -1614,7 +1609,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 89: + case 89: { PIXEL00_1U PIXEL01_1 @@ -1622,7 +1617,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -1631,7 +1626,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -1641,9 +1636,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 90: + case 90: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -1652,7 +1647,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -1663,7 +1658,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -1672,7 +1667,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -1682,10 +1677,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 55: - case 23: + case 55: + case 23: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL00_1L PIXEL01_C @@ -1706,10 +1701,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 182: - case 150: + case 182: + case 150: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -1730,10 +1725,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL21_1 break; } - case 213: - case 212: + case 213: + case 212: { - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL02_1U PIXEL12_C @@ -1754,10 +1749,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_1M break; } - case 241: - case 240: + case 241: + case 240: { - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL20_1L @@ -1778,10 +1773,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11 break; } - case 236: - case 232: + case 236: + case 232: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -1802,10 +1797,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_1 break; } - case 109: - case 105: + case 109: + case 105: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL00_1U PIXEL10_C @@ -1826,10 +1821,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 171: - case 43: + case 171: + case 43: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -1850,10 +1845,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 143: - case 15: + case 143: + case 15: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -1874,14 +1869,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 124: + case 124: { PIXEL00_1M PIXEL01_1 PIXEL02_1U PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -1896,9 +1891,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 203: + case 203: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -1918,10 +1913,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 62: + case 62: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -1940,7 +1935,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 211: + case 211: { PIXEL00_1L PIXEL01_C @@ -1948,7 +1943,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_1 PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -1962,10 +1957,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 118: + case 118: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -1984,7 +1979,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 217: + case 217: { PIXEL00_1U PIXEL01_1 @@ -1992,7 +1987,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -2006,14 +2001,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 110: + case 110: { PIXEL00_1M PIXEL01_C PIXEL02_1R PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -2028,9 +2023,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 155: + case 155: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -2050,7 +2045,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 188: + case 188: { PIXEL00_1M PIXEL01_1 @@ -2063,7 +2058,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 185: + case 185: { PIXEL00_1U PIXEL01_1 @@ -2076,7 +2071,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 61: + case 61: { PIXEL00_1U PIXEL01_1 @@ -2089,7 +2084,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 157: + case 157: { PIXEL00_1U PIXEL01_1 @@ -2102,7 +2097,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 103: + case 103: { PIXEL00_1L PIXEL01_C @@ -2115,7 +2110,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 227: + case 227: { PIXEL00_1L PIXEL01_C @@ -2128,7 +2123,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 230: + case 230: { PIXEL00_1M PIXEL01_C @@ -2141,7 +2136,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 199: + case 199: { PIXEL00_1L PIXEL01_C @@ -2154,14 +2149,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 220: + case 220: { PIXEL00_1M PIXEL01_1 PIXEL02_1U PIXEL10_C PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2169,7 +2164,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL20_2 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -2183,9 +2178,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 158: + case 158: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2193,7 +2188,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_2 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -2212,9 +2207,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 234: + case 234: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2226,7 +2221,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL02_1M PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -2241,11 +2236,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 242: + case 242: { PIXEL00_1M PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2256,7 +2251,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_1 PIXEL11 PIXEL20_1L - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -2270,9 +2265,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 59: + case 59: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -2284,7 +2279,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_3 PIXEL10_3 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2299,14 +2294,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 121: + case 121: { PIXEL00_1U PIXEL01_1 PIXEL02_1M PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -2318,7 +2313,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_4 PIXEL21_3 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2328,10 +2323,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 87: + case 87: { PIXEL00_1L - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -2347,7 +2342,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11 PIXEL20_1M PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2357,9 +2352,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 79: + case 79: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -2374,7 +2369,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL02_1R PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2386,9 +2381,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 122: + case 122: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2397,7 +2392,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2407,7 +2402,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -2419,7 +2414,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_4 PIXEL21_3 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2429,9 +2424,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 94: + case 94: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2439,7 +2434,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL00_2 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -2453,7 +2448,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } PIXEL10_C PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2462,7 +2457,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2472,9 +2467,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 218: + case 218: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2483,7 +2478,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2493,7 +2488,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } PIXEL10_C PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2501,7 +2496,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch { PIXEL20_2 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -2515,9 +2510,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 91: + case 91: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -2529,7 +2524,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_3 PIXEL10_3 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2539,7 +2534,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2548,7 +2543,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2558,7 +2553,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 229: + case 229: { PIXEL00_2 PIXEL01_1 @@ -2571,7 +2566,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 167: + case 167: { PIXEL00_1L PIXEL01_C @@ -2584,7 +2579,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 173: + case 173: { PIXEL00_1U PIXEL01_1 @@ -2597,7 +2592,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 181: + case 181: { PIXEL00_2 PIXEL01_1 @@ -2610,9 +2605,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 186: + case 186: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2621,7 +2616,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2637,11 +2632,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 115: + case 115: { PIXEL00_1L PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2654,7 +2649,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_C PIXEL20_1L PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2664,7 +2659,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 93: + case 93: { PIXEL00_1U PIXEL01_1 @@ -2672,7 +2667,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2681,7 +2676,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2691,9 +2686,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 206: + case 206: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2706,7 +2701,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2718,8 +2713,8 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 205: - case 201: + case 205: + case 201: { PIXEL00_1U PIXEL01_1 @@ -2727,7 +2722,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_1M } @@ -2739,10 +2734,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 174: - case 46: + case 174: + case 46: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_1M } @@ -2760,12 +2755,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 179: - case 147: + case 179: + case 147: { PIXEL00_1L PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_1M } @@ -2781,8 +2776,8 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 117: - case 116: + case 117: + case 116: { PIXEL00_2 PIXEL01_1 @@ -2792,7 +2787,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_C PIXEL20_1L PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_1M } @@ -2802,7 +2797,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 189: + case 189: { PIXEL00_1U PIXEL01_1 @@ -2815,7 +2810,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 231: + case 231: { PIXEL00_1L PIXEL01_C @@ -2828,10 +2823,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 126: + case 126: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -2844,7 +2839,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_3 } PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -2859,9 +2854,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 219: + case 219: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -2876,7 +2871,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL02_1M PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -2890,9 +2885,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 125: + case 125: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL00_1U PIXEL10_C @@ -2913,9 +2908,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 221: + case 221: { - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL02_1U PIXEL12_C @@ -2936,9 +2931,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_1M break; } - case 207: + case 207: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -2959,9 +2954,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 238: + case 238: { - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -2982,9 +2977,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_1 break; } - case 190: + case 190: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -3005,9 +3000,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL21_1 break; } - case 187: + case 187: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -3028,9 +3023,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 243: + case 243: { - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL20_1L @@ -3051,9 +3046,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11 break; } - case 119: + case 119: { - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL00_1L PIXEL01_C @@ -3074,8 +3069,8 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 237: - case 233: + case 237: + case 233: { PIXEL00_1U PIXEL01_1 @@ -3083,7 +3078,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C } @@ -3095,10 +3090,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 175: - case 47: + case 175: + case 47: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C } @@ -3116,12 +3111,12 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_2 break; } - case 183: - case 151: + case 183: + case 151: { PIXEL00_1L PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C } @@ -3137,8 +3132,8 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 245: - case 244: + case 245: + case 244: { PIXEL00_2 PIXEL01_1 @@ -3148,7 +3143,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_C PIXEL20_1L PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_C } @@ -3158,13 +3153,13 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 250: + case 250: { PIXEL00_1M PIXEL01_C PIXEL02_1M PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -3175,7 +3170,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_4 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL22_C @@ -3187,9 +3182,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 123: + case 123: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -3203,7 +3198,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C PIXEL21_C @@ -3216,9 +3211,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 95: + case 95: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL10_C @@ -3229,7 +3224,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_3 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C PIXEL12_C @@ -3245,10 +3240,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 222: + case 222: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -3262,7 +3257,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11 PIXEL12_C PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL21_C PIXEL22_C @@ -3274,14 +3269,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 252: + case 252: { PIXEL00_1M PIXEL01_1 PIXEL02_1U PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -3292,7 +3287,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_4 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_C } @@ -3302,14 +3297,14 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 249: + case 249: { PIXEL00_1U PIXEL01_1 PIXEL02_1M PIXEL10_C PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C } @@ -3318,7 +3313,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL22_C @@ -3330,9 +3325,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 235: + case 235: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -3346,7 +3341,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C } @@ -3358,9 +3353,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 111: + case 111: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C } @@ -3373,7 +3368,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C PIXEL21_C @@ -3386,9 +3381,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 63: + case 63: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C } @@ -3397,7 +3392,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C PIXEL12_C @@ -3414,9 +3409,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 159: + case 159: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL10_C @@ -3427,7 +3422,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_3 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C } @@ -3442,11 +3437,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 215: + case 215: { PIXEL00_1L PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C } @@ -3458,7 +3453,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL11 PIXEL12_C PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL21_C PIXEL22_C @@ -3470,10 +3465,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 246: + case 246: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -3488,7 +3483,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_C PIXEL20_1L PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_C } @@ -3498,10 +3493,10 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 254: + case 254: { PIXEL00_1M - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -3512,7 +3507,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL02_4 } PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -3522,7 +3517,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_3 PIXEL20_4 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL21_C @@ -3536,7 +3531,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 253: + case 253: { PIXEL00_1U PIXEL01_1 @@ -3544,7 +3539,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C } @@ -3553,7 +3548,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_C } @@ -3563,9 +3558,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 251: + case 251: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -3577,7 +3572,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } PIXEL02_1M PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL10_C PIXEL20_C @@ -3589,7 +3584,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 PIXEL21_3 } - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL12_C PIXEL22_C @@ -3601,9 +3596,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 239: + case 239: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C } @@ -3616,7 +3611,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_1 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C } @@ -3628,9 +3623,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1R break; } - case 127: + case 127: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL01_C @@ -3642,7 +3637,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL01_3 PIXEL10_3 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C PIXEL12_C @@ -3653,7 +3648,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_3 } PIXEL11 - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C PIXEL21_C @@ -3666,9 +3661,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1M break; } - case 191: + case 191: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C } @@ -3677,7 +3672,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C } @@ -3693,9 +3688,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL22_1D break; } - case 223: + case 223: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C PIXEL10_C @@ -3705,7 +3700,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_4 PIXEL10_3 } - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL01_C PIXEL02_C @@ -3719,7 +3714,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } PIXEL11 PIXEL20_1M - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL21_C PIXEL22_C @@ -3731,11 +3726,11 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 247: + case 247: { PIXEL00_1L PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C } @@ -3748,7 +3743,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL12_C PIXEL20_1L PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_C } @@ -3758,9 +3753,9 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch } break; } - case 255: + case 255: { - if (Diff(w[4], w[2])) + if (diff(w[4], w[2])) { PIXEL00_C } @@ -3769,7 +3764,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL00_2 } PIXEL01_C - if (Diff(w[2], w[6])) + if (diff(w[2], w[6])) { PIXEL02_C } @@ -3780,7 +3775,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL10_C PIXEL11 PIXEL12_C - if (Diff(w[8], w[4])) + if (diff(w[8], w[4])) { PIXEL20_C } @@ -3789,7 +3784,7 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch PIXEL20_2 } PIXEL21_C - if (Diff(w[6], w[8])) + if (diff(w[6], w[8])) { PIXEL22_C } @@ -3800,27 +3795,30 @@ static void filter(gambatte::uint_least32_t *pOut, const std::ptrdiff_t dstPitch break; } } - ++pIn; - pOut += 3; + + ++in; + out += 3; } - pOut += dstPitch * 3 - static_cast(Xres * 3); + + out += dstPitch * 3 - std::ptrdiff_t(x_res) * 3; } } MaxStHq3x::MaxStHq3x() -: buffer_(VfilterInfo::IN_HEIGHT * VfilterInfo::IN_WIDTH) +: buffer_(std::size_t(VfilterInfo::in_height) * VfilterInfo::in_width) { } -void* MaxStHq3x::inBuf() const { +void * MaxStHq3x::inBuf() const { return buffer_; } std::ptrdiff_t MaxStHq3x::inPitch() const { - return VfilterInfo::IN_WIDTH; + return VfilterInfo::in_width; } -void MaxStHq3x::draw(void *const dbuffer, const std::ptrdiff_t pitch) { - ::filter(static_cast(dbuffer), - pitch, buffer_); +void MaxStHq3x::draw(void *dbuffer, std::ptrdiff_t dpitch) { + ::filter( + static_cast(dbuffer), dpitch, + buffer_); } diff --git a/common/videolink/vfilters/maxsthq3x.h b/common/videolink/vfilters/maxsthq3x.h old mode 100755 new mode 100644 index 48d5288c..df9fc13a --- a/common/videolink/vfilters/maxsthq3x.h +++ b/common/videolink/vfilters/maxsthq3x.h @@ -25,15 +25,17 @@ #include "gbint.h" class MaxStHq3x : public VideoLink { - const Array buffer_; public: - enum { OUT_WIDTH = VfilterInfo::IN_WIDTH * 3 }; - enum { OUT_HEIGHT = VfilterInfo::IN_HEIGHT * 3 }; + enum { out_width = VfilterInfo::in_width * 3 }; + enum { out_height = VfilterInfo::in_height * 3 }; MaxStHq3x(); - virtual void* inBuf() const; + virtual void * inBuf() const; virtual std::ptrdiff_t inPitch() const; virtual void draw(void *dst, std::ptrdiff_t dstpitch); + +private: + SimpleArray const buffer_; }; #endif diff --git a/common/videolink/videolink.h b/common/videolink/videolink.h old mode 100755 new mode 100644 index d52d56fc..19b316ed --- a/common/videolink/videolink.h +++ b/common/videolink/videolink.h @@ -24,7 +24,7 @@ class VideoLink { public: virtual ~VideoLink() {} - virtual void* inBuf() const = 0; + virtual void * inBuf() const = 0; virtual std::ptrdiff_t inPitch() const = 0; virtual void draw(void *dst, std::ptrdiff_t dstpitch) = 0; };