Home | History | Annotate | Download | only in jni
      1 #include <stdlib.h>
      2 
      3 static /*__attribute__ ((noinline))*/ int Sub3(int a, int b, int c) {
      4   const int pb = b - c;
      5   const int pa = a - c;
      6   return abs(pb) - abs(pa);
      7 }
      8 
      9 static unsigned Select(unsigned a, unsigned b, unsigned c) {
     10   const int pa_minus_pb =
     11       Sub3((a >> 24) & 0xff, (b >> 24) & 0xff, (c >> 24) & 0xff) +
     12       Sub3((a >> 16) & 0xff, (b >> 16) & 0xff, (c >> 16) & 0xff) +
     13       Sub3((a >>  8) & 0xff, (b >>  8) & 0xff, (c >>  8) & 0xff) +
     14       Sub3((a >>  0) & 0xff, (b >>  0) & 0xff, (c >>  0) & 0xff);
     15   return (pa_minus_pb <= 0) ? a : b;
     16 }
     17 
     18 static unsigned Predictor11(unsigned left, const unsigned* const top) {
     19   const unsigned pred = Select(top[0], left, top[-1]);
     20   return pred;
     21 }
     22 
     23 typedef unsigned (*VP8LPredictorFunc)(unsigned left, const unsigned* const top);
     24 
     25 const VP8LPredictorFunc kPredictorsC[] = {
     26   Predictor11,
     27 };
     28