[x265] [PATCH] slicetype: added x265_median_mv

gopu at multicorewareinc.com gopu at multicorewareinc.com
Mon Aug 12 06:45:19 CEST 2013


# HG changeset patch
# User ggopu
# Date 1376282472 25200
# Node ID 824d394ce8da4fc41aef7d4721ac0e3b06442f9a
# Parent  4085c992877ae1f1269807cb16543baf947df04d
slicetype: added x265_median_mv

diff -r 4085c992877a -r 824d394ce8da source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Sun Aug 11 22:56:50 2013 +0530
+++ b/source/encoder/slicetype.cpp	Sun Aug 11 21:41:12 2013 -0700
@@ -76,6 +76,22 @@
     int estimateCUCost(int cux, int cuy, int p0, int p1, int b, int do_search[2]);
 };
 
+static inline int16_t x265_median( int16_t a, int16_t b, int16_t c )
+{
+    int16_t t = (a-b)&((a-b)>>31);
+    a -= t;
+    b += t;
+    b -= (b-c)&((b-c)>>31);
+    b += (a-b)&((a-b)>>31);
+    return b;
+}
+
+static inline void x265_median_mv( MV &dst, MV a, MV b, MV c )
+{
+    dst.x = x265_median( a.x, b.x, c.x );
+    dst.y = x265_median( a.y, b.y, c.y );
+}
+
 int Lookahead::estimateFrameCost(int p0, int p1, int b, int bIntraPenalty)
 {
     int score = 0;
@@ -183,8 +199,7 @@
             mvp = mvc[0];
         else
         {
-            //TODO x265_median_mv(mvp, mvc[0], mvc[1], mvc[2])
-            ;
+            x265_median_mv(mvp, mvc[0], mvc[1], mvc[2]);           
         }
 
         *fenc_costs[i] = me.motionEstimate(i ? fref1 : fref0, mvmin, mvmax, mvp, numc, mvc, merange, *fenc_mvs[i]);


More information about the x265-devel mailing list