am e737cda6: audioflinger: refine latency latency calculation.

* commit 'e737cda649acbfa43fc1b74612a83f2fac9aa449':
  audioflinger: refine latency latency calculation.
diff --git a/media/libstagefright/codecs/avc/common/src/deblock.cpp b/media/libstagefright/codecs/avc/common/src/deblock.cpp
index 5ed4c82..de2d2b6 100644
--- a/media/libstagefright/codecs/avc/common/src/deblock.cpp
+++ b/media/libstagefright/codecs/avc/common/src/deblock.cpp
@@ -294,7 +294,8 @@
     int     filterLeftMbEdgeFlag = (mb_x != 0);
     int     filterTopMbEdgeFlag  = (mb_y != 0);
     int     pitch = video->currPic->pitch;
-    int     indexA, indexB, tmp;
+    int     indexA, indexB;
+    int     *tmp;
     int     Alpha, Beta, Alpha_c, Beta_c;
     int     mbNum = mb_y * video->PicWidthInMbs + mb_x;
     int     *clipTable, *clipTable_c, *qp_clip_tab;
@@ -386,7 +387,7 @@
     /* Save Alpha,  Beta and clipTable for future use, with the obselete variables filterLeftMbEdgeFlag, mbNum amd tmp */
     filterLeftMbEdgeFlag = Alpha;
     mbNum = Beta;
-    tmp = (int)clipTable;
+    tmp = clipTable;
 
     indexA = MbQ->QPc + video->FilterOffsetA;
     indexB = MbQ->QPc + video->FilterOffsetB;
@@ -486,7 +487,7 @@
     /* Note that Alpha_c, Beta_c and clipTable_c for chroma is already calculated */
     Alpha = filterLeftMbEdgeFlag;
     Beta = mbNum;
-    clipTable = (int *)tmp;
+    clipTable = tmp;
 
     GetStrength_HorizontalEdges(Strength + 4, MbQ); // Strength for 4 blks in 1 stripe, 0 => vertical edge
 
diff --git a/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp b/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp
index d39885d..6d43142 100644
--- a/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp
@@ -573,7 +573,7 @@
     recon->pitch = currFS->frame.pitch;
     recon->disp_order = currFS->PicOrderCnt;
     recon->coding_order = currFS->FrameNum;
-    recon->id = (uint32) currFS->base_dpb; /* use the pointer as the id */
+    recon->id = (intptr_t) currFS->base_dpb; /* use the pointer as the id */
 
     currFS->IsOutputted |= 1;
 
diff --git a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
index ac62d78..a390f88 100644
--- a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
@@ -198,7 +198,7 @@
     out_offset = 24 - blkwidth;
 
     //switch(x_pos&0x3){
-    switch (((uint32)ref)&0x3)
+    switch (((intptr_t)ref)&0x3)
     {
         case 1:
             offset =  picpitch - blkwidth - 3;
@@ -268,9 +268,9 @@
 void eHorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
                     int blkwidth, int blkheight, int dx)
 {
-    uint8 *p_ref;
+    uint8 *p_ref, *tmp;
     uint32 *p_cur;
-    uint32 tmp, pkres;
+    uint32 pkres;
     int result, curr_offset, ref_offset;
     int j;
     int32 r0, r1, r2, r3, r4, r5;
@@ -288,14 +288,14 @@
         r13 = 0;
         for (j = blkheight; j > 0; j--)
         {
-            tmp = (uint32)(p_ref + blkwidth);
+            tmp = p_ref + blkwidth;
             r0 = p_ref[0];
             r1 = p_ref[2];
             r0 |= (r1 << 16);           /* 0,c,0,a */
             r1 = p_ref[1];
             r2 = p_ref[3];
             r1 |= (r2 << 16);           /* 0,d,0,b */
-            while ((uint32)p_ref < tmp)
+            while (p_ref < tmp)
             {
                 r2 = *(p_ref += 4); /* move pointer to e */
                 r3 = p_ref[2];
@@ -360,8 +360,8 @@
                 p_ref -= (ref_offset + blkwidth);   /* input */
                 p_cur -= (outpitch >> 2);
 
-                tmp = (uint32)(p_ref + blkwidth);
-                for (; (uint32)p_ref < tmp;)
+                tmp = p_ref + blkwidth;
+                for (; p_ref < tmp;)
                 {
 
                     r0 = *p_ref++;
@@ -434,14 +434,14 @@
         r13 = 0;
         for (j = blkheight; j > 0; j--)
         {
-            tmp = (uint32)(p_ref + blkwidth);
+            tmp = p_ref + blkwidth;
             r0 = p_ref[0];
             r1 = p_ref[2];
             r0 |= (r1 << 16);           /* 0,c,0,a */
             r1 = p_ref[1];
             r2 = p_ref[3];
             r1 |= (r2 << 16);           /* 0,d,0,b */
-            while ((uint32)p_ref < tmp)
+            while (p_ref < tmp)
             {
                 r2 = *(p_ref += 4); /* move pointer to e */
                 r3 = p_ref[2];
@@ -494,8 +494,8 @@
                 p_ref -= (ref_offset + blkwidth);   /* input */
                 p_cur -= (outpitch >> 2);
 
-                tmp = (uint32)(p_ref + blkwidth);
-                for (; (uint32)p_ref < tmp;)
+                tmp = p_ref + blkwidth;
+                for (; p_ref < tmp;)
                 {
 
                     r0 = *p_ref++;
@@ -558,9 +558,9 @@
 void eHorzInterp2MC(int *in, int inpitch, uint8 *out, int outpitch,
                     int blkwidth, int blkheight, int dx)
 {
-    int *p_ref;
+    int *p_ref, *tmp;
     uint32 *p_cur;
-    uint32 tmp, pkres;
+    uint32 pkres;
     int result, result2, curr_offset, ref_offset;
     int j, r0, r1, r2, r3, r4, r5;
 
@@ -575,8 +575,8 @@
 
         for (j = blkheight; j > 0 ; j--)
         {
-            tmp = (uint32)(p_ref + blkwidth);
-            for (; (uint32)p_ref < tmp;)
+            tmp = p_ref + blkwidth;
+            for (; p_ref < tmp;)
             {
 
                 r0 = p_ref[-2];
@@ -654,8 +654,8 @@
     {
         for (j = blkheight; j > 0 ; j--)
         {
-            tmp = (uint32)(p_ref + blkwidth);
-            for (; (uint32)p_ref < tmp;)
+            tmp = p_ref + blkwidth;
+            for (; p_ref < tmp;)
             {
 
                 r0 = p_ref[-2];
@@ -717,9 +717,8 @@
 void eHorzInterp3MC(uint8 *in, int inpitch, int *out, int outpitch,
                     int blkwidth, int blkheight)
 {
-    uint8 *p_ref;
+    uint8 *p_ref, *tmp;
     int   *p_cur;
-    uint32 tmp;
     int result, curr_offset, ref_offset;
     int j, r0, r1, r2, r3, r4, r5;
 
@@ -730,8 +729,8 @@
 
     for (j = blkheight; j > 0 ; j--)
     {
-        tmp = (uint32)(p_ref + blkwidth);
-        for (; (uint32)p_ref < tmp;)
+        tmp = p_ref + blkwidth;
+        for (; p_ref < tmp;)
         {
 
             r0 = p_ref[-2];
@@ -782,15 +781,14 @@
 void eVertInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
                     int blkwidth, int blkheight, int dy)
 {
-    uint8 *p_cur, *p_ref;
-    uint32 tmp;
+    uint8 *p_cur, *p_ref, *tmp;
     int result, curr_offset, ref_offset;
     int j, i;
     int32 r0, r1, r2, r3, r4, r5, r6, r7, r8, r13;
     uint8  tmp_in[24][24];
 
     /* not word-aligned */
-    if (((uint32)in)&0x3)
+    if (((intptr_t)in)&0x3)
     {
         eCreateAlign(in, inpitch, -2, &tmp_in[0][0], blkwidth, blkheight + 5);
         in = &tmp_in[2][0];
@@ -811,8 +809,8 @@
             r13 = 0;
             p_ref = in;
             p_cur -= outpitch;  /* compensate for the first offset */
-            tmp = (uint32)(p_ref + ref_offset); /* limit */
-            while ((uint32)p_ref < tmp)  /* the loop un-rolled  */
+            tmp = p_ref + ref_offset; /* limit */
+            while (p_ref < tmp)  /* the loop un-rolled  */
             {
                 r0 = *((uint32*)(p_ref - (inpitch << 1))); /* load 4 bytes */
                 p_ref += inpitch;
@@ -885,8 +883,8 @@
                     p_ref = in + i;
                     p_cur -= outpitch;  /* compensate for the first offset */
 
-                    tmp = (uint32)(p_ref + ref_offset); /* limit */
-                    while ((uint32)p_ref < tmp)
+                    tmp = p_ref + ref_offset; /* limit */
+                    while (p_ref < tmp)
                     {                           /* loop un-rolled */
                         r0 = *(p_ref - (inpitch << 1));
                         r1 = *(p_ref - inpitch);
@@ -959,8 +957,8 @@
             r13 = 0;
             p_ref = in;
             p_cur -= outpitch;  /* compensate for the first offset */
-            tmp = (uint32)(p_ref + ref_offset); /* limit */
-            while ((uint32)p_ref < tmp)  /* the loop un-rolled  */
+            tmp = p_ref + ref_offset; /* limit */
+            while (p_ref < tmp)  /* the loop un-rolled  */
             {
                 r0 = *((uint32*)(p_ref - (inpitch << 1))); /* load 4 bytes */
                 p_ref += inpitch;
@@ -1023,8 +1021,8 @@
                 {
                     p_ref = in + i;
                     p_cur -= outpitch;  /* compensate for the first offset */
-                    tmp = (uint32)(p_ref + ref_offset); /* limit */
-                    while ((uint32)p_ref < tmp)
+                    tmp = p_ref + ref_offset; /* limit */
+                    while (p_ref < tmp)
                     {                           /* loop un-rolled */
                         r0 = *(p_ref - (inpitch << 1));
                         r1 = *(p_ref - inpitch);
@@ -1086,8 +1084,7 @@
                     int blkwidth, int blkheight)
 {
     int *p_cur;
-    uint8 *p_ref;
-    uint32 tmp;
+    uint8 *p_ref, *tmp;
     int result, curr_offset, ref_offset;
     int j, r0, r1, r2, r3, r4, r5;
 
@@ -1100,8 +1097,8 @@
         p_cur -= outpitch; /* compensate for the first offset */
         p_ref = in++;
 
-        tmp = (uint32)(p_ref + ref_offset); /* limit */
-        while ((uint32)p_ref < tmp)
+        tmp = p_ref + ref_offset; /* limit */
+        while (p_ref < tmp)
         {                           /* loop un-rolled */
             r0 = *(p_ref - (inpitch << 1));
             r1 = *(p_ref - inpitch);
@@ -1152,8 +1149,7 @@
                     int blkwidth, int blkheight, int dy)
 {
     uint8 *p_cur;
-    int *p_ref;
-    uint32 tmp;
+    int *p_ref, *tmp;
     int result, result2, curr_offset, ref_offset;
     int j, r0, r1, r2, r3, r4, r5;
 
@@ -1170,8 +1166,8 @@
             p_cur -= outpitch; /* compensate for the first offset */
             p_ref = in++;
 
-            tmp = (uint32)(p_ref + ref_offset); /* limit */
-            while ((uint32)p_ref < tmp)
+            tmp = p_ref + ref_offset; /* limit */
+            while (p_ref < tmp)
             {                           /* loop un-rolled */
                 r0 = *(p_ref - (inpitch << 1));
                 r1 = *(p_ref - inpitch);
@@ -1250,8 +1246,8 @@
             p_cur -= outpitch; /* compensate for the first offset */
             p_ref = in++;
 
-            tmp = (uint32)(p_ref + ref_offset); /* limit */
-            while ((uint32)p_ref < tmp)
+            tmp = p_ref + ref_offset; /* limit */
+            while (p_ref < tmp)
             {                           /* loop un-rolled */
                 r0 = *(p_ref - (inpitch << 1));
                 r1 = *(p_ref - inpitch);
@@ -1313,11 +1309,11 @@
 {
     int j, i;
     int result;
-    uint8 *p_cur, *p_ref, *p_tmp8;
+    uint8 *p_cur, *p_ref, *p_tmp8, *tmp;
     int curr_offset, ref_offset;
     uint8 tmp_res[24][24], tmp_in[24][24];
     uint32 *p_tmp;
-    uint32 tmp, pkres, tmp_result;
+    uint32 pkres, tmp_result;
     int32 r0, r1, r2, r3, r4, r5;
     int32 r6, r7, r8, r9, r10, r13;
 
@@ -1337,7 +1333,7 @@
     for (j = blkheight; j > 0; j--)
     {
         r13 = 0;
-        tmp = (uint32)(p_ref + blkwidth);
+        tmp = p_ref + blkwidth;
 
         //r0 = *((uint32*)p_ref);   /* d,c,b,a */
         //r1 = (r0>>8)&0xFF00FF;    /* 0,d,0,b */
@@ -1350,7 +1346,7 @@
         r2 = p_ref[3];
         r1 |= (r2 << 16);           /* 0,d,0,b */
 
-        while ((uint32)p_ref < tmp)
+        while (p_ref < tmp)
         {
             //r2 = *((uint32*)(p_ref+=4));/* h,g,f,e */
             //r3 = (r2>>8)&0xFF00FF;  /* 0,h,0,f */
@@ -1406,8 +1402,8 @@
             /* move back to the beginning of the line */
             p_ref -= (ref_offset + blkwidth);   /* input */
             p_tmp -= 6; /* intermediate output */
-            tmp = (uint32)(p_ref + blkwidth);
-            while ((uint32)p_ref < tmp)
+            tmp = p_ref + blkwidth;
+            while (p_ref < tmp)
             {
                 r0 = *p_ref++;
                 r1 = *p_ref++;
@@ -1465,7 +1461,7 @@
 
     /*  perform vertical interpolation */
     /* not word-aligned */
-    if (((uint32)in2)&0x3)
+    if (((intptr_t)in2)&0x3)
     {
         eCreateAlign(in2, inpitch, -2, &tmp_in[0][0], blkwidth, blkheight + 5);
         in2 = &tmp_in[2][0];
@@ -1485,8 +1481,8 @@
         p_tmp8 = &(tmp_res[0][j]); /* intermediate result */
         p_tmp8 -= 24;  /* compensate for the first offset */
         p_cur -= outpitch;  /* compensate for the first offset */
-        tmp = (uint32)(p_ref + pkres); /* limit */
-        while ((uint32)p_ref < tmp)  /* the loop un-rolled  */
+        tmp = p_ref + pkres; /* limit */
+        while (p_ref < tmp)  /* the loop un-rolled  */
         {
             /* Read 1 byte at a time is too slow, too many read and pack ops, need to call CreateAlign */
             /*p_ref8 = p_ref-(inpitch<<1);          r0 = p_ref8[0];         r1 = p_ref8[2];
@@ -1579,8 +1575,8 @@
                 p_tmp8 = &(tmp_res[0][j+i]); /* intermediate result */
                 p_tmp8 -= 24;  /* compensate for the first offset */
                 p_cur -= outpitch;  /* compensate for the first offset */
-                tmp = (uint32)(p_ref + pkres); /* limit */
-                while ((uint32)p_ref < tmp)  /* the loop un-rolled  */
+                tmp = p_ref + pkres; /* limit */
+                while (p_ref < tmp)  /* the loop un-rolled  */
                 {
                     r0 = *(p_ref - (inpitch << 1));
                     r1 = *(p_ref - inpitch);
@@ -1659,7 +1655,7 @@
     uint32 temp;
     uint8 byte;
 
-    if (((uint32)in)&3)
+    if (((intptr_t)in)&3)
     {
         for (j = blkheight; j > 0; j--)
         {
@@ -1720,7 +1716,7 @@
         else start = ref + x_pos;
 
         /* word-align start */
-        offset = (uint32)start & 0x3;
+        offset = (intptr_t)start & 0x3;
         if (offset) start -= offset;
 
         word1 = *((uint32*)start);
@@ -1746,7 +1742,7 @@
         else    start = ref + picpitch * (picheight - 1) + x_pos;
 
         /* word-align start */
-        offset = (uint32)start & 0x3;
+        offset = (intptr_t)start & 0x3;
         if (offset) start -= offset;
 
         word1 = *((uint32*)start);
@@ -2121,7 +2117,7 @@
     uint16 temp;
     uint8 byte;
 
-    if (((uint32)pRef)&1)
+    if (((intptr_t)pRef)&1)
     {
         for (j = blkheight; j > 0; j--)
         {
diff --git a/media/libstagefright/codecs/avc/enc/src/sad_inline.h b/media/libstagefright/codecs/avc/enc/src/sad_inline.h
index f39794f..3f18483 100644
--- a/media/libstagefright/codecs/avc/enc/src/sad_inline.h
+++ b/media/libstagefright/codecs/avc/enc/src/sad_inline.h
@@ -80,7 +80,7 @@
 
         x9 = 0x80808080; /* const. */
 
-        x8 = (uint32)ref & 0x3;
+        x8 = (intptr_t)ref & 0x3;
         if (x8 == 3)
             goto SadMBOffset3;
         if (x8 == 2)
diff --git a/media/libstagefright/codecs/common/Android.mk b/media/libstagefright/codecs/common/Android.mk
index af8795a..77fe934 100644
--- a/media/libstagefright/codecs/common/Android.mk
+++ b/media/libstagefright/codecs/common/Android.mk
@@ -16,17 +16,6 @@
 
 LOCAL_CFLAGS := $(VO_CFLAGS)
 
-ifeq ($(VOTT), v5)
-LOCAL_CFLAGS += -DARM -DASM_OPT
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E
-endif
-
-ifeq ($(VOTT), v7)
-LOCAL_CFLAGS += -DARM -DARMV7 -DASM_OPT
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV7
-endif
-
 include $(BUILD_SHARED_LIBRARY)