Tip:
Highlight text to annotate it
X
MALE SPEAKER: I think it's running.
So welcome back to Devoxx.
We're here to talk about more Android with Nicolas.
Welcome, Nicolas.
NICOLAS ROARD: Thanks.
MALE SPEAKER: Nicolas, here you're
talking about effective image manipulation on Android.
So obviously, Android is a constrained environment,
because it's a mobile environment.
What are the options for developers
that they can use when it comes to images?
NICOLAS ROARD: So there are various options
that you can use in your program.
The common ones are probably OpenGL and native.
And those two actually have a lot of issues
and a lot of constraints that you have to deal with.
One of the recent possibilities for Android
is Render Script, which is a new framework, a new [INAUDIBLE]
for processing images that has a lot of advantages compared
to those two other solutions.
MALE SPEAKER: OK, so we'll get to that,
and to your experience.
Anything against OpenGL specifically, or native?
I mean, what are the shortcomings
before we get to Render Script?
NICOLAS ROARD: No, nothing particularly.
The only thing is that I guess native--
by native, what I mean is that you simply
pass a bitmap to the native it.
You process it.
It's pretty easy to process.
The problem is that if you want to optimize,
you're going to have to optimize for particular devices.
It's going to be difficult to optimize for everything.
And compared to OpenGL, it's a bit slower.
You also have to deal with memory, et cetera, et cetera.
MALE SPEAKER: Oh, back to native.
NICOLAS ROARD: All the problems with native, right?
With some advantages, some inconvenience.
OpenGL, the good thing is that it should be fast.
The bad thing is well, [INAUDIBLE] OpenGL
depends a lot on drivers and some GPUs
appears better than others.
MALE SPEAKER: OK.
NICOLAS ROARD: And some GPUs have
constraints that others do not have.
You have like a maximum size of textures and stuff like that.
MALE SPEAKER: Right, OK.
So you're talking about this because you have experience
with this, and you've been building--
NICOLAS ROARD: I've been working this past year basically
on the new photo editing touring gallery.
MALE SPEAKER: Yes.
NICOLAS ROARD: Where we actually started
the first version really is, back last November, last year,
was mostly using native processing.
We're just passing the bitmaps through the native side,
doing something in C, and that's it.
But since then, we moved a lot more to [INAUDIBLE] Script
and for quite a few reasons.
The big difference for us is that we
want the software to run on as many devices as possible.
MALE SPEAKER: Of course, yeah.
NICOLAS ROARD: It gets difficult if you
have to test and be 100% sure that your code, OpenGL,
for instance, is going to work everywhere.
So that's why we originally went with native.
Even if it's not as fast as OpenGL,
it's a more tractable problem to be sure
that everything would work well.
But if we want to make it faster to have
really good interactive speed, then OpenGL
starts to look more appealing.
But then you end up with all those issues
with compatibility, and et cetera.
Render Script, on the other hand,
has quite a few nice advantages.
One of the advantages is that it's a specific language that
actually looks-- It's basically C99 with vector
extensions, which means that it's
both a good language for image processing because
of those vector extensions.
So you can actually write a version that
are cleaner and simpler and make a lot more sense.
And at the same time, it's not particularly
different than a [INAUDIBLE] or that C. It's C99.
You basically use it as a VM the compiler to generate that.
And then with the detect the scripts
and execute it through VM, do a bunch of optimization,
and more importantly, execute all of that in parallel.
So in terms of performances, what
you get is something that is completely paralyzed,
that really takes advantage of all the calls
on your device, which is pretty important to us.
MALE SPEAKER: How about the GPU?
Can we use the GPU as well?
NICOLAS ROARD: And that's one of the big thing this year,
is that we now support GPU drivers for Render Script.
So on all the Nexus devices, we do have GPU drivers.
MALE SPEAKER: But what does it mean?
Do you get to choose as a developer if it runs on one
of the other, what's available, what's--
NICOLAS ROARD: So you can either choose or not choose.
I mean, you have the option, right?
So if you don't do anything, Render Script
will just say I'm going to run on the fastest possible thing.
You can also specify, hey, I'm going
to run on the CPU, which sometimes
is a really good thing to do because the CPU is a lot more
predictable than the GPU.
So depending on what you do, that might be better.
MALE SPEAKER: OK, interesting.
So just so people have an idea of the work you've done,
this is the gallery, the editor in the gallery.
There's a video online available so people--
NICOLAS ROARD: Yes.
We posted it online and there's some reviews this past week
about it.
So that's the [INAUDIBLE].
MALE SPEAKER: And you're doing some pretty heavy lifting
with this.
It's not just adding a simple filter
and being done with it, right?
NICOLAS ROARD: And I think it's a good example of what
kind of script is there.
You can use it.
It works.
It's fast.
MALE SPEAKER: So give us examples of, I don't know,
the type of transformation it's doing, or work you're doing,
and the size of the image maybe you're able to work with.
NICOLAS ROARD: Yeah.
So the way it actually works on the arbitrary sizes of images.
MALE SPEAKER: And it's non-disruptive.
NICOLAS ROARD: It's non-disruptive.
We do a lot effects, not just global effects, but also
local effects.
All the common ones, vignette, contrast, saturation.
We do a bunch of interesting things like that.
What I'm really happy with is that it scales very well,
and it's non-disruptive, which means that you can always
come back, reapply an effect, change an effect,
and it's still going to be at the same point.
MALE SPEAKER: Right.
There's a pipeline effect you apply,
and you can move back too.
And how about the previews?
Do you actually compute those for the entire image,
or how do you make that so snappy?
NICOLAS ROARD: In general, the way you do it,
you can't actually run everything on the full image
all the time because it's going to be too slow.
So what you really care about is to have something that is fast,
that is really interactive for the user.
So you just ***.
What we do in the editor is that we compute everything
on a very small preview image, and because it's smaller,
we can run the stuff at an interactive speed.
The UI elements themselves are animated at 60fps,
so when you move something, when you move a control,
it always follows your actions, which
is really what's the important point.
The preview itself is very fast, and then
we have a progressive preview, so as soon
as you start moving stuff, we compute a higher resolution
image, and higher and higher, until you get the final 1:1
image.
MALE SPEAKER: And you have this nice way
of comparing before and after?
NICOLAS ROARD: Yeah, there is some--
MALE SPEAKER: Some [INAUDIBLE].
Or the other way you apply.
I encourage people to check it out
as end users, maybe not as developers.
So great.
Where should people go to learn more about Render Script?
NICOLAS ROARD: There is some documentation.
Online.
MALE SPEAKER: Maybe--
NICOLAS ROARD: The documentation that's there is sadly not as--
MALE SPEAKER: --comprehensive?
NICOLAS ROARD: --as I would like it to be,
but the Render Script team is working on that.
This past year, the focus has been
more on getting out compatibility library, which
means that-- and it's actually a very important point-- it means
that you can write from the script,
and you can run new applications using [INAUDIBLE] scripts
on devices that go back to I think Gingerbread [INAUDIBLE]
library.
But internally, we even made it run on Froyo.
It's good.
That actually-- it's very compatible.
It means I write some code, and I
know it's going to work everywhere.
MALE SPEAKER: That actually--
NICOLAS ROARD: And yet it's going
to be fast and [INAUDIBLE].
MALE SPEAKER: OK, so the Android website, there's documentation?
NICOLAS ROARD: Exactly.
On the website.
MALE SPEAKER: It's going to get better over time.
But there's something to start with.
Great, well Nicolas, thanks for your time.
That's what I wanted to cover here, and I'll see you soon.
NICOLAS ROARD: All right.
Thanks.