shithub: libvpx

Download patch

ref: 11a222f5d963097fb72cec7bf6e06ff8c3d96fa4
parent: d3e9409bb07e6411ff867935883bd5d56d2f9041
author: Tero Rintaluoma <tero.rintaluoma@on2.com>
date: Mon Jan 24 06:21:40 EST 2011

Adds "armvX-none-rvct" targets

Adds following targets to configure script to support RVCT compilation
without operating system support (for Profiler or bare metal images).
 - armv5te-none-rvct
 - armv6-none-rvct
 - armv7-none-rvct

To strip OS specific parts from the code "os_support"-config was added
to script and CONFIG_OS_SUPPORT flag is used in the code to exclude OS
specific parts such as OS specific includes and function calls for
timers and threads etc. This was done to enable RVCT compilation for
profiling purposes or running the image on bare metal target with
Lauterbach.

Removed separate AREA directives for READONLY data in armv6 and neon
assembly files to fix the RVCT compilation. Otherwise
"ldr <reg>, =label" syntax would have been needed to prevent linker
errors. This syntax is not supported by older gnu assemblers.

Change-Id: I14f4c68529e8c27397502fbc3010a54e505ddb43

--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -664,7 +664,7 @@
             elif enabled armv7
             then
                 check_add_cflags -march=armv7-a -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp  #-ftree-vectorize
-        check_add_asflags -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp  #-march=armv7-a
+                check_add_asflags -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp  #-march=armv7-a
             else
                 check_add_cflags -march=${tgt_isa}
                 check_add_asflags -march=${tgt_isa}
@@ -695,10 +695,17 @@
             arch_int=${arch_int%%te}
             check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\""
             enabled debug && add_asflags -g
+            add_cflags --gnu
+            add_cflags --enum_is_int
+            add_cflags --wchar32
         ;;
         esac
 
         case ${tgt_os} in
+        none*)
+            disable multithread
+            disable os_support
+            ;;
         darwin*)
             SDK_PATH=/Developer/Platforms/iPhoneOS.platform/Developer
             TOOLCHAIN_PATH=${SDK_PATH}/usr/bin
@@ -747,13 +754,9 @@
                     || die "Must supply --libc when targetting *-linux-rvct"
 
                 # Set up compiler
-                add_cflags --gnu
-                add_cflags --enum_is_int
                 add_cflags --library_interface=aeabi_glibc
                 add_cflags --no_hide_all
-                add_cflags --wchar32
                 add_cflags --dwarf2
-                add_cflags --gnu
 
                 # Set up linker
                 add_ldflags --sysv --no_startup --no_ref_cpp_init
--- a/configure
+++ b/configure
@@ -79,11 +79,13 @@
 # alphabetically by architecture, generic-gnu last.
 all_platforms="${all_platforms} armv5te-linux-rvct"
 all_platforms="${all_platforms} armv5te-linux-gcc"
+all_platforms="${all_platforms} armv5te-none-rvct"
 all_platforms="${all_platforms} armv5te-symbian-gcc"
 all_platforms="${all_platforms} armv5te-wince-vs8"
 all_platforms="${all_platforms} armv6-darwin-gcc"
 all_platforms="${all_platforms} armv6-linux-rvct"
 all_platforms="${all_platforms} armv6-linux-gcc"
+all_platforms="${all_platforms} armv6-none-rvct"
 all_platforms="${all_platforms} armv6-symbian-gcc"
 all_platforms="${all_platforms} armv6-wince-vs8"
 all_platforms="${all_platforms} iwmmxt-linux-rvct"
@@ -95,6 +97,7 @@
 all_platforms="${all_platforms} armv7-darwin-gcc"    #neon Cortex-A8
 all_platforms="${all_platforms} armv7-linux-rvct"    #neon Cortex-A8
 all_platforms="${all_platforms} armv7-linux-gcc"     #neon Cortex-A8
+all_platforms="${all_platforms} armv7-none-rvct"     #neon Cortex-A8
 all_platforms="${all_platforms} mips32-linux-gcc"
 all_platforms="${all_platforms} ppc32-darwin8-gcc"
 all_platforms="${all_platforms} ppc32-darwin9-gcc"
@@ -159,6 +162,7 @@
 enable md5
 enable spatial_resampling
 enable multithread
+enable os_support
 
 [ -d ${source_path}/../include ] && enable alt_tree_layout
 for d in vp8; do
@@ -253,6 +257,7 @@
     small
     arm_asm_detok
     postproc_visualizer
+    os_support
 "
 CMDLINE_SELECT="
     extra_warnings
--- a/examples.mk
+++ b/examples.mk
@@ -93,8 +93,16 @@
 
 
 # Handle extra library flags depending on codec configuration
-CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
 
+# We should not link to math library (libm) on RVCT
+# when building for bare-metal targets
+ifeq ($(CONFIG_OS_SUPPORT), yes)
+CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
+else
+    ifeq ($(CONFIG_GCC), yes)
+    CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
+    endif
+endif
 #
 # End of specified files. The rest of the build rules should happen
 # automagically from here.
--- a/md5_utils.c
+++ b/md5_utils.c
@@ -20,8 +20,6 @@
  * Still in the public domain.
  */
 
-#include <sys/types.h>    /* for stupid systems */
-
 #include <string.h>   /* for memcpy() */
 
 #include "md5_utils.h"
--- a/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
+++ b/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
@@ -243,8 +243,6 @@
     ENDP
 
 ;-----------------
-    AREA    subpelfilters8_dat, DATA, READWRITE         ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
 ;One word each is reserved. Label filter_coeff can be used to access the data.
 ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
 _filter8_coeff_
--- a/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
@@ -350,10 +350,7 @@
     ENDP
 
 ;-----------------
-    AREA    bifilters16_dat, DATA, READWRITE            ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _bifilter16_coeff_
     DCD     bifilter16_coeff
 bifilter16_coeff
--- a/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
@@ -123,10 +123,7 @@
     ENDP
 
 ;-----------------
-    AREA    bilinearfilters4_dat, DATA, READWRITE           ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _bifilter4_coeff_
     DCD     bifilter4_coeff
 bifilter4_coeff
--- a/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
@@ -128,10 +128,7 @@
     ENDP
 
 ;-----------------
-    AREA    bifilters8x4_dat, DATA, READWRITE           ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _bifilter8x4_coeff_
     DCD     bifilter8x4_coeff
 bifilter8x4_coeff
--- a/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
+++ b/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
@@ -176,10 +176,7 @@
     ENDP
 
 ;-----------------
-    AREA    bifilters8_dat, DATA, READWRITE         ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _bifilter8_coeff_
     DCD     bifilter8_coeff
 bifilter8_coeff
--- a/vp8/common/arm/neon/loopfilter_neon.asm
+++ b/vp8/common/arm/neon/loopfilter_neon.asm
@@ -397,7 +397,8 @@
     bx          lr
     ENDP        ; |vp8_loop_filter_horizontal_edge_y_neon|
 
-    AREA    loopfilter_dat, DATA, READONLY
+;-----------------
+
 _lf_coeff_
     DCD     lf_coeff
 lf_coeff
--- a/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
+++ b/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
@@ -104,10 +104,7 @@
     ENDP        ; |vp8_loop_filter_simple_horizontal_edge_neon|
 
 ;-----------------
-    AREA    hloopfiltery_dat, DATA, READWRITE           ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 16 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _lfhy_coeff_
     DCD     lfhy_coeff
 lfhy_coeff
--- a/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
+++ b/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
@@ -145,10 +145,7 @@
     ENDP        ; |vp8_loop_filter_simple_vertical_edge_neon|
 
 ;-----------------
-    AREA    vloopfiltery_dat, DATA, READWRITE           ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 16 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _vlfy_coeff_
     DCD     vlfy_coeff
 vlfy_coeff
--- a/vp8/common/arm/neon/mbloopfilter_neon.asm
+++ b/vp8/common/arm/neon/mbloopfilter_neon.asm
@@ -505,7 +505,8 @@
     bx          lr
     ENDP        ; |vp8_mbloop_filter_neon|
 
-    AREA    mbloopfilter_dat, DATA, READONLY
+;-----------------
+
 _mblf_coeff_
     DCD     mblf_coeff
 mblf_coeff
--- a/vp8/common/arm/neon/shortidct4x4llm_neon.asm
+++ b/vp8/common/arm/neon/shortidct4x4llm_neon.asm
@@ -113,10 +113,7 @@
     ENDP
 
 ;-----------------
-    AREA    idct4x4_dat, DATA, READWRITE            ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _idct_coeff_
     DCD     idct_coeff
 idct_coeff
--- a/vp8/common/arm/neon/sixtappredict16x16_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict16x16_neon.asm
@@ -476,10 +476,7 @@
     ENDP
 
 ;-----------------
-    AREA    subpelfilters16_dat, DATA, READWRITE            ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _filter16_coeff_
     DCD     filter16_coeff
 filter16_coeff
--- a/vp8/common/arm/neon/sixtappredict4x4_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict4x4_neon.asm
@@ -407,10 +407,7 @@
     ENDP
 
 ;-----------------
-    AREA    subpelfilters4_dat, DATA, READWRITE         ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _filter4_coeff_
     DCD     filter4_coeff
 filter4_coeff
--- a/vp8/common/arm/neon/sixtappredict8x4_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict8x4_neon.asm
@@ -458,10 +458,7 @@
     ENDP
 
 ;-----------------
-    AREA    subpelfilters8_dat, DATA, READWRITE         ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _filter8_coeff_
     DCD     filter8_coeff
 filter8_coeff
--- a/vp8/common/arm/neon/sixtappredict8x8_neon.asm
+++ b/vp8/common/arm/neon/sixtappredict8x8_neon.asm
@@ -509,10 +509,7 @@
     ENDP
 
 ;-----------------
-    AREA    subpelfilters8_dat, DATA, READWRITE         ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _filter8_coeff_
     DCD     filter8_coeff
 filter8_coeff
--- a/vp8/common/threading.h
+++ b/vp8/common/threading.h
@@ -14,6 +14,8 @@
 
 #define VPXINFINITE 10000       /* 10second. */
 
+#if CONFIG_OS_SUPPORT
+
 /* Thread management macros */
 #ifdef _WIN32
 /* Win32 */
@@ -87,5 +89,9 @@
 #else
 #define x86_pause_hint()
 #endif
+
+#else /* CONFIG_OS_SUPPORT = 0 */
+#define THREAD_FUNCTION void *
+#endif /* CONFIG_OS_SUPPORT */
 
 #endif
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -9,7 +9,7 @@
  */
 
 
-#ifndef WIN32
+#if !defined(WIN32) && CONFIG_OS_SUPPORT == 1
 # include <unistd.h>
 #endif
 #ifdef __APPLE__
--- a/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
+++ b/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
@@ -112,10 +112,7 @@
     ENDP
 
 ;-----------------
-    AREA    fastfdct_dat, DATA, READONLY
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _ffdct_coeff_
     DCD     ffdct_coeff
 ffdct_coeff
--- a/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
+++ b/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
@@ -165,10 +165,7 @@
     ENDP
 
 ;-----------------
-    AREA    fastfdct8x4_dat, DATA, READONLY
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _ffdct8_coeff_
     DCD     ffdct8_coeff
 ffdct8_coeff
--- a/vp8/encoder/arm/neon/shortfdct_neon.asm
+++ b/vp8/encoder/arm/neon/shortfdct_neon.asm
@@ -122,10 +122,7 @@
     ENDP
 
 ;-----------------
-    AREA    dct4x4_dat, DATA, READONLY
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _dct_matrix_
     DCD     dct_matrix
 dct_matrix
--- a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
@@ -416,10 +416,7 @@
     ENDP
 
 ;-----------------
-    AREA    vp8e_bilinear_taps_dat, DATA, READWRITE          ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _BilinearTaps_coeff_
     DCD     bilinear_taps_coeff
 bilinear_taps_coeff
--- a/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
@@ -215,10 +215,7 @@
     ENDP
 
 ;-----------------
-    AREA    bilinear_taps_dat, DATA, READWRITE           ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 _BilinearTaps_coeff_
     DCD     bilinear_taps_coeff
 bilinear_taps_coeff
--- a/vpx_ports/vpx_timer.h
+++ b/vpx_ports/vpx_timer.h
@@ -12,6 +12,8 @@
 #ifndef VPX_TIMER_H
 #define VPX_TIMER_H
 
+#if CONFIG_OS_SUPPORT
+
 #if defined(_WIN32)
 /*
  * Win32 specific includes
@@ -93,5 +95,27 @@
 #endif
 }
 
+#else /* CONFIG_OS_SUPPORT = 0*/
+
+/* Empty timer functions if CONFIG_OS_SUPPORT = 0 */
+#ifndef timersub
+#define timersub(a, b, result)
+#endif
+
+struct vpx_usec_timer
+{
+    void *dummy;
+};
+
+static void
+vpx_usec_timer_start(struct vpx_usec_timer *t) { }
+
+static void
+vpx_usec_timer_mark(struct vpx_usec_timer *t) { }
+
+static long
+vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { return 0; }
+
+#endif /* CONFIG_OS_SUPPORT */
 
 #endif
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -17,14 +17,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <limits.h>
-#if defined(_WIN32)
-#include <io.h>
-#define snprintf _snprintf
-#define isatty   _isatty
-#define fileno   _fileno
-#else
-#include <unistd.h>
-#endif
+
 #define VPX_CODEC_DISABLE_COMPAT 1
 #include "vpx_config.h"
 #include "vpx/vpx_decoder.h"
@@ -38,6 +31,17 @@
 #include "tools_common.h"
 #include "nestegg/include/nestegg/nestegg.h"
 
+#if CONFIG_OS_SUPPORT
+#if defined(_WIN32)
+#include <io.h>
+#define snprintf _snprintf
+#define isatty   _isatty
+#define fileno   _fileno
+#else
+#include <unistd.h>
+#endif
+#endif
+
 #ifndef PATH_MAX
 #define PATH_MAX 256
 #endif
@@ -866,7 +870,7 @@
                 strcmp(fn, "-") ? fn : "stdin");
         return EXIT_FAILURE;
     }
-
+#if CONFIG_OS_SUPPORT
     /* Make sure we don't dump to the terminal, unless forced to with -o - */
     if(!outfile_pattern && isatty(fileno(stdout)) && !do_md5 && !noblit)
     {
@@ -875,7 +879,7 @@
                 "override.\n");
         return EXIT_FAILURE;
     }
-
+#endif
     input.infile = infile;
     if(file_is_ivf(infile, &fourcc, &width, &height, &fps_den,
                    &fps_num))
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -12,7 +12,7 @@
 /* This is a simple program that encodes YV12 files and generates ivf
  * files using the new interface.
  */
-#if defined(_WIN32)
+#if defined(_WIN32) || !CONFIG_OS_SUPPORT
 #define USE_POSIX_MMAP 0
 #else
 #define USE_POSIX_MMAP 1
@@ -56,6 +56,14 @@
 #define LITERALU64(n) n
 #else
 #define LITERALU64(n) n##LLU
+#endif
+
+/* We should use 32-bit file operations in WebM file format
+ * when building ARM executable file (.axf) with RVCT */
+#if !CONFIG_OS_SUPPORT
+typedef long off_t;
+#define fseeko fseek
+#define ftello ftell
 #endif
 
 static const char *exec_name;
--