14 Commits

Author SHA1 Message Date
Neil Fuller
c2a0b4482d resolved conflicts for merge of ee665151 to lmp-mr1-dev-plus-aosp
Change-Id: I2588c65b7a9fa43f968151a206924a804f0595a7
2014-10-02 14:32:37 +01:00
Neil Fuller
33253a4baa Switch from FloatMath -> Math and Math.hypot where possible
The motivation is an API change: FloatMath is going to be
deprecated and/or removed. Performance is not the goal of
this change.

That said...

Math is faster than FloatMath with AOT compilation.

While making the change, occurances of:

{Float}Math.sqrt(x * x + y * y) and
{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))

have been replaced with:

{(float)} Math.hypot(x, y)

Right now there is no runtime intrinsic for hypot so is not faster
in all cases for AOT compilation:

Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with
AOT, but all other combinations of FloatMath, use of pow() etc.
are slower than hypot().

hypot() has the advantage of being self documenting and
could be optimized in future. None of the behavior differences
around NaN and rounding appear to be important for the cases
looked at: they all assume results and arguments are in range
and usually the results are cast to float.

Different implementations measured on hammerhead / L:

AOT compiled:

[FloatMath.hypot(x, y)]
benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials

[FloatMath.sqrt(x*x + y*y)]
benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials

[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]
benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials

[(float) Math.hypot(x, y)]
benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials

[(float) Math.sqrt(x*x + y*y)]
benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials

[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]
benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials

Interpreter:

benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials
benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials
benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials
benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I06c91f682095e627cb547d60d936ef87941be692
2014-10-01 14:04:15 +01:00
Eino-Ville Talvala
fd887436bd Camera2: Final API revisions
- Rename listeners to callbacks. Listeners are single-method and are interfaces,
  while callbacks are abstract may get more methods in the future.
- Use register/unregister for registering callbacks, not add/remove.

Bug: 17389922
Change-Id: Ic6b46ad79cb43a43a85e2a4b63f059d3af99798b
2014-09-05 12:43:11 -07:00
Eino-Ville Talvala
0a160acf29 Camera2: Hide all the deprecated methods and interfaces
Leave them in for now until bundled clients complete updating

Change-Id: Ibd0fc971258ce6b649000c48dd7a6716f1ab91d4
2014-07-06 17:31:14 -07:00
Sol Boucher
b84fdffad4 Add CameraToo, a sample point-and-shoot camera app
It demonstrates basic use of the features of the new Camera2 API.

Change-Id: I593bc682e5c6203754e9a3ee9a78efbd1b208513
2014-06-11 21:47:49 +00:00
Igor Murashkin
db075afc85 camera2: Add partial results to the capture listener (API change)
* Also adds capture sequence aborted callback

Bug: 12492876
Change-Id: I56ec8edbcda8b64c2262ff7472961ac78042c7f4
2014-05-27 11:25:24 -07:00
John Spurlock
8a985d24ce Tabs -> spaces in frameworks/base.
Change-Id: I5a84e8e93ac99b5ed0212b37bf66efa5e53864be
2014-02-25 09:49:29 -05:00
Andy Hung
83511d2f49 Add "throws IOException" to MediaCodec factory methods
android.media.MediaCodec
(createByCodecName|createDecoderByType|createEncoderByType)
now explicitly throws IOException.

Requires changes to existing code for declaration compatibility.

Bug: 11364276
Change-Id: I105ecb7c4bd49bf803111253cd23bab161c988f9
Signed-off-by: Andy Hung <hunga@google.com>
2014-01-16 12:35:15 -08:00
Andy Hung
8ca55fc980 Revert "Add "throws IOException" to MediaCodec constructors (3)"
This reverts commit 52d8aa79a31c5042d2b43d06f08fa28489b27d1b.

Change-Id: Ic706e0fb469931664499d00fa3a221726b258673
2013-11-07 04:06:31 +00:00
Andy Hung
52d8aa79a3 Add "throws IOException" to MediaCodec constructors (3)
Change to add "throws IOException" to android.media.MediaCodec
(createByCodecName|createDecoderByType|createEncoderByType).  The exception was
previously thrown through the native JNI, but not explicitly declared.

Requires changes to existing code for declaration compatibility.

Bug: 11364276
Change-Id: Ia0d3481397285cb1503bedde37d4651934b3a481
Signed-off-by: Andy Hung <hunga@google.com>
2013-11-05 18:54:43 -08:00
Igor Murashkin
69b94f7c55 SmartCamera: Fix to build against latest camera2 api
Bug: 10818732
Change-Id: I536021b9663331532e2f4c21a4fc0f3de5da9aa9
2013-10-15 15:23:07 -07:00
Igor Murashkin
bd7f343c75 Camera2Tests: update SmartCamera for async api
Change-Id: I6eb541c96ee50756c35e7785fdae63e8e45e2726
2013-10-15 15:11:41 -07:00
Benjamin Hendricks
227b47625d Camera2Tests: Add SmartCamera App
Bug: 10818732
Change-Id: I6ac08ecab3a1e04116be2f7764d0d5d4f29c5cd9
2013-10-15 15:11:34 -07:00
Igor Murashkin
b7c255ce91 Camera2Tests: create new directory for manual camera2 test apps
Bug: 10818732
Change-Id: Idbc7e370d43a95e8f647541ab1e20071c212382d
2013-09-18 10:51:25 -07:00