stagefright aacenc: Fix inline asm constraints

Output-only parameters should use =r or =&r constrains, never +r.

This fixes a lot of warnings about the variable 'result' being
used uninitialized.

Change-Id: Ie689fce8c6ecd874d4fc66e87687c67551d9ab6a
stagefright aacenc: Fix inline asm

- don't write input-only registers
- use temp variables instead of hardcoded regs
- don't build constants manually, specify as asm inputs
- remove unnecessary volatile qualifiers

Change-Id: I3b9bb2d30768bcf409dc478bde4489135eeb50d7
stagefright aacenc: Add const declarations to some pointers

This avoids some compilation warnings.

Change-Id: Ia89ab94020a9f1ee4c1df48823fb89325cca7d36
stagefright aacenc: Avoid warnings about incompatible pointer types

Change-Id: Ida53cd1030ebb9feb0d6916e42e8ba67a90e86c7
stagefright aacenc: Zero-initialize a struct

This avoids using uninitialized data in some cases, according
to valgrind.

Change-Id: I2eb5242b93c4d83a1cf6a15f022ec9579e0742a4
stagefright amrnb: Properly negate all values

Initially, input values -32768 weren't negated properly.

This was committed on the master branch of the opencore
repository in commit f532d145194e474cb30d8644b8eee83873ad24cc,
based on AOSP contribution 10906.

Change-Id: I903353c5539a8fe94b7fc5f26b95eaeac57df5f4
stagefright aacenc: Fix an inline asm constraint

Output-only parameters should use =r or =&r constrains, never +r.

This avoids a warning about the variable 'result' being used
uninitialized.

This avoids loading the uninitialized value into the register,
before it is overwritten by the multiplication.

Change-Id: I0ef6179e133c35d290feb8e12bea180ecae11a05
stagefright aacenc: Make the bits to write in WriteBits unsigned

They shouldn't, as far as I know, ever be a signed value.

Change-Id: I64429c7c0b2b52bec768a04d3c3eb0eb252955fa
stagefright amrnb: Fix a bug on architectures where long is 64 bit

Initially, this code gave a warning "comparison is always
false due to limited range of data type" if long was 64 bit.
Additionally, the output from the AMR encoder was mostly noise.

This was committed on the master branch of the opencore
repository in commit f532d145194e474cb30d8644b8eee83873ad24cc,
based on AOSP contribution 10904.

Change-Id: I822dcc74beeae548d3032ffda759de9c8cd1fcfe
stagefright aacenc: Don't address a Word32 with a Word16 pointer

Currently, a pointer to a Word32 is used as a pointer to Word16, which
doesn't work as intended on big endian architectures.

This change needs to be analyzed and tested properly so that it doesn't
cause issues with overflows in these variables. Another solution would be
to change all the scf arrays to 32 bit instead.

Change-Id: I53d9eb83bdaf8d3b1530eb5064dd10b08bce737a
stagefright amrwbenc: Change keyword ordering

This avoids warnings about 'static' not being at the beginning
of the declarations.

Change-Id: I80f91b8a0f7f61edcdca96c206fedbd74ec0d88e
stagefright amrwb: Make a global const array static

This fixes compilation as C - while the source files are named
.cpp, they actually are compileable as pure C. Prior to this,
this table produced multiple definitions of the same symbol.

This was committed on the master branch of the opencore
repository in commit a803bd49a631317e0d52ff060cf1799f7741a47e,
based on AOSP contribution 10017.

Change-Id: Id76274964242b119ab61b8181e557477df1e1521
stagefright aacenc: Remove a stray semicolon

This avoids warnings about an empty body in an if statement.

mem_free does the same null check, so the accidental extra
semicolon was harmless, and the whole if statement actually
is needless. But if removing the if statements, all the
other ones should be removed too, for consistency.
(This could be done as a separate change).

Change-Id: I1b6064dedd15ffa949043bb5396148aaed9b43f6
stagefright aacenc: Simplify the definition of __inline

This reduces the amount of ifdefs needed, into something that
works on both gcc and MSVC. This removes one occurrance of the
LINUX ifdef, simplifying compiling on various platforms.

Change-Id: I1e2af6c2517410dc280197ba922df877cf7afbd5
stagefright amrwbenc: Remove a useless check

Since the Length field is unsigned, the comparison will always
be false. The corresponding code in the aac encoder doesn't have
any check for Length.

This avoids a warning about comparison always being false.

Change-Id: I57c28ff9d09cb9ac4effeaeb40db608ab976acc6
stagefright amrnb: Add missing const qualifier to table declarations in headers

This was committed on the master branch of the opencore
repository in commit 5ce7a6fdf125116ffce2e692e14eafef1c807628,
based on AOSP contribution 10301.

Change-Id: Ie32b32c7407f449e382c0b4fd2d60a664e0daa33
stagefright amrnb: Add includes for prototype declarations of tables

This was committed on the master branch of the opencore
repository in commit da3d0463c999871ee584a0d750be65be65d19b00,
based on AOSP contribution 10302.

Change-Id: I4ad5526634efecc2d2bb3d2169184b8d4d4d7671
stagefright amrnb: Remove extern from table definitions

Local prototype declarations are added where no suitable ones are
available in headers.

This fixes warnings when compiling as C - while the source
files are named .cpp, they actually are compileable as pure C.

This was committed on the master branch of the opencore
repository in commit a0acb494ea6682ca966b5ebbd3676c89c56d63a6,
based on AOSP contribution 10303.

Change-Id: Ib4e27ea30302c66e0233e63e5a4652f6339bc940
stagefright amrwb: Change a C++ style cast into a C style cast

This fixes compilation as C - while the source files are named
.cpp, they actually are compileable as pure C (except for this
cast).

This was committed on the master branch of the opencore
repository in commit ae27d9b2ef68c4e6fc383a8cab93d6baa235ff6b,
based on AOSP contribution 10014.

Change-Id: I4f533313be041ad3e0a03ffc5f4207480894ddd1
stagefright amrwb: Make local const arrays static

Some of these tables exist in both the amrnb and amrwb libraries,
but with different content.

This avoids some cases of multiple definitions of symbols, if
linking in both libraries statically into the same executable,
if the libraries are built as C. (As C++, the local symbols
get mangled so they don't conflict with the external C symbols
in amrnb, that are unmangled.)

Most of this was committed on the master branch of the opencore
repository in commit 0cd4b3ac412dd0a8370ce339e89cf346c6cfe395,
based on AOSP contribution 10016.

Change-Id: I5387e699ce54a56dc43fcfa0396dee5c99280fd9