#ifndef IZ_PREDICT_H #define IZ_PREDICT_H 1 #include "intmacros.h" namespace IZ { #define UNUSED(x) { x = x; } template class Predictor3med { public: static int predict(int x, int y, int xy) { int dx, dy, dxy, s; dy = x - xy; dx = xy - y; dxy = x - y; s = oppositeSign(dy, dx); dxy &= oppositeSign(dxy, dy); return selectVal(s, y + dy, x - dxy); } }; template class Predictor3alpha { public: static int predict(int x, int y, int xy) { return clamp0(clampMax(x + y - xy, Sample(~0))); } }; template class Predictor3plane { public: static int predict(int x, int y, int xy) { return x + y - xy; } }; template class Predictor3avgplane { public: static int predict(int x, int y, int xy) { return (3 * x + 3 * y - 2 * xy + 2) >> 2; } }; template class Predictor2avg { public: static int predict(int x, int y, int xy) { UNUSED(xy); return (x + y + 1) >> 1; } }; template class Predictor1x { public: static int predict(int x, int y, int xy) { UNUSED(y); UNUSED(xy); return x; } }; template class Predictor1y { public: static int predict(int x, int y, int xy) { UNUSED(x); UNUSED(xy); return y; } }; template class Predictor0 { public: static int predict(int x, int y, int xy) { UNUSED(x); UNUSED(y); UNUSED(xy); return 0; } }; } // namespace IZ #endif