]> granicus.if.org Git - libvpx/commitdiff
Use lrand48 on Android
authorJohann <johannkoenig@google.com>
Fri, 13 Jun 2014 02:16:59 +0000 (19:16 -0700)
committerJohann <johannkoenig@google.com>
Fri, 13 Jun 2014 02:57:25 +0000 (19:57 -0700)
When building x86 assembly use lrand48 instead of the
undocumented inlined _rand function.

Android now supports rand()
https://android-review.googlesource.com/97731
but only for new versions. Original workaround:
https://gerrit.chromium.org/gerrit/15744

Change-Id: I130566837d5bfc9e54187ebe9807350d1a7dab2a

vp8/common/x86/postproc_mmx.asm
vp8/common/x86/postproc_sse2.asm
vp8/common/x86/postproc_x86.c [deleted file]
vp8/vp8_common.mk
vp9/common/x86/vp9_postproc_mmx.asm
vp9/common/x86/vp9_postproc_sse2.asm
vpx_ports/x86_abi_support.asm

index 8be3431f9b04882f6161450e58c6ea528bbe52ce..a2b16327f08ae97fadce7aa96ce942235eefe275 100644 (file)
@@ -246,7 +246,6 @@ sym(vp8_mbpost_proc_down_mmx):
 ;                            unsigned char whiteclamp[16],
 ;                            unsigned char bothclamp[16],
 ;                            unsigned int Width, unsigned int Height, int Pitch)
-extern sym(rand)
 global sym(vp8_plane_add_noise_mmx) PRIVATE
 sym(vp8_plane_add_noise_mmx):
     push        rbp
@@ -258,7 +257,7 @@ sym(vp8_plane_add_noise_mmx):
     ; end prolog
 
 .addnoise_loop:
-    call sym(rand) WRT_PLT
+    call sym(LIBVPX_RAND) WRT_PLT
     mov     rcx, arg(1) ;noise
     and     rax, 0xff
     add     rcx, rax
index f53daa7e50830e95463758f864d510aa55dcbf52..fed4ee5ccf801d2ff576c62d0f51617ef3936923 100644 (file)
@@ -660,7 +660,6 @@ sym(vp8_mbpost_proc_across_ip_xmm):
 ;                            unsigned char whiteclamp[16],
 ;                            unsigned char bothclamp[16],
 ;                            unsigned int Width, unsigned int Height, int Pitch)
-extern sym(rand)
 global sym(vp8_plane_add_noise_wmt) PRIVATE
 sym(vp8_plane_add_noise_wmt):
     push        rbp
@@ -672,7 +671,7 @@ sym(vp8_plane_add_noise_wmt):
     ; end prolog
 
 .addnoise_loop:
-    call sym(rand) WRT_PLT
+    call sym(LIBVPX_RAND) WRT_PLT
     mov     rcx, arg(1) ;noise
     and     rax, 0xff
     add     rcx, rax
diff --git a/vp8/common/x86/postproc_x86.c b/vp8/common/x86/postproc_x86.c
deleted file mode 100644 (file)
index 3ec0106..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-/* On Android NDK, rand is inlined function, but postproc needs rand symbol */
-#if defined(__ANDROID__)
-#define rand __rand
-#include <stdlib.h>
-#undef rand
-
-extern int rand(void)
-{
-  return __rand();
-}
-#else
-/* ISO C forbids an empty translation unit. */
-int vp8_unused;
-#endif
index 0b1ac9eeb3028da5ffd6c4c701458b8ba65d0410..6db031fa5afa84ba575be66691cd669d65e24416 100644 (file)
@@ -107,7 +107,6 @@ VP8_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/variance_impl_ssse3.asm
 VP8_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/sad_sse4.asm
 
 ifeq ($(CONFIG_POSTPROC),yes)
-VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/postproc_x86.c
 VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/postproc_mmx.asm
 VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/mfqe_sse2.asm
 VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/postproc_sse2.asm
index c2118dbb74e7d0e0011b042e613eea8a322f1d66..5b8deef6b415e26a80ed40b2b7b26c3a2ceeb88f 100644 (file)
@@ -464,7 +464,6 @@ sym(vp9_mbpost_proc_down_mmx):
 ;                            unsigned char whiteclamp[16],
 ;                            unsigned char bothclamp[16],
 ;                            unsigned int width, unsigned int height, int pitch)
-extern sym(rand)
 global sym(vp9_plane_add_noise_mmx) PRIVATE
 sym(vp9_plane_add_noise_mmx):
     push        rbp
@@ -476,7 +475,7 @@ sym(vp9_plane_add_noise_mmx):
     ; end prolog
 
 .addnoise_loop:
-    call sym(rand) WRT_PLT
+    call sym(LIBVPX_RAND) WRT_PLT
     mov     rcx, arg(1) ;noise
     and     rax, 0xff
     add     rcx, rax
index 858fc99b6b4000a5fac3da137aca8d1e2517e4cd..ec8bfdb18fa819f50c8312ab9af3305892d7621d 100644 (file)
@@ -629,7 +629,6 @@ sym(vp9_mbpost_proc_across_ip_xmm):
 ;                            unsigned char whiteclamp[16],
 ;                            unsigned char bothclamp[16],
 ;                            unsigned int width, unsigned int height, int pitch)
-extern sym(rand)
 global sym(vp9_plane_add_noise_wmt) PRIVATE
 sym(vp9_plane_add_noise_wmt):
     push        rbp
@@ -641,7 +640,7 @@ sym(vp9_plane_add_noise_wmt):
     ; end prolog
 
 .addnoise_loop:
-    call sym(rand) WRT_PLT
+    call sym(LIBVPX_RAND) WRT_PLT
     mov     rcx, arg(1) ;noise
     and     rax, 0xff
     add     rcx, rax
index eccbfa35c2080965025fd4d7c831a89dfe78de19..3814ef443802d1532b9718f73d4d9041efea0c6d 100644 (file)
@@ -393,3 +393,14 @@ section .note.GNU-stack noalloc noexec nowrite progbits
 section .text
 %endif
 
+; On Android platforms use lrand48 when building postproc routines. Prior to L
+; rand() was not available.
+%if CONFIG_POSTPROC=1
+%ifdef __ANDROID__
+extern sym(lrand48)
+%define LIBVPX_RAND lrand48
+%else
+extern sym(rand)
+%define LIBVPX_RAND rand
+%endif
+%endif ; CONFIG_POSTPROC