Image-processing algorithm on mobile device
Just loop over the index.
The first clamp is unnecessary. (X &amp; 0xff) will always be between 0 and 255.
Look at it algebraically. There are some expressions that do not depend on R, B, or B that you can extract from the loop.
You can extract some common expressions and calculate them at the same time as grey.


.

void applyLevels(unsigned int *rgb, const unsigned int width, const unsigned int height, const float exposure, const float brightness, const float contrast, const float saturation)
{
    const float exposureFactor   = powf(2.0f, exposure);
    const float brightnessFactor = brightness / 10.0f;
    const float contrastFactor   = contrast &gt; 0.0f ? contrast : 0.0f;
    const float saturationFactor = 1.0f - saturation;

    const float f01 = exposureFactor / 255.0f * contrastFactor;
    const float f02 = 0.5f * (1.0f - contrastFactor);

    const unsigned int nPixel = width * height;
    for(unsigned int pixelIndex = 0; pixelIndex &lt; nPixel; ++pixelIndex)
    {
        const unsigned int pixelValue = rgb[pixelIndex];
        float R = static_cast&lt;float&gt;((pixelValue &gt;&gt; 16) &amp; 0xff);
        float G = static_cast&lt;float&gt;((pixelValue &gt;&gt;  8) &amp; 0xff);
        float B = static_cast&lt;float&gt;((pixelValue      ) &amp; 0xff);

        R = R * f01 + f02;
        G = G * f01 + f02;
        B = B * f01 + f02;

        const float f03 = ((R * 0.3f) + (G * 0.59f) + (B * 0.11f)) * saturationFactor + brightnessFactor;

        R = (R * saturation + f03) * 255.0f;
        G = (G * saturation + f03) * 255.0f;
        B = (B * saturation + f03) * 255.0f;

        R = R &gt; 255.0f ? 255.0f : R &lt; 0.0f ? 0.0f : R;
        G = G &gt; 255.0f ? 255.0f : G &lt; 0.0f ? 0.0f : G;
        B = B &gt; 255.0f ? 255.0f : B &lt; 0.0f ? 0.0f : B;

        rgb[pixelIndex] =
            (static_cast&lt;unsigned int&gt;(R) &lt;&lt; 16) |
            (static_cast&lt;unsigned int&gt;(G) &lt;&lt;  8) |
            (static_cast&lt;unsigned int&gt;(B)      );
    }
}


Other optimizations:


Do you need an entire 8MP image? Can you downscale the image or even grab a portion?
How often do you need to apply all four operations to an image? If it is common for some images to only require exposure and saturation then make separate functions.
Convert the for to a parallel for and use neon and other intrinsics.
Rather than doing the previous suggestion I would recommend using Renderscript. It will use your GPU if it can. If it uses the CPU it is automatically multithreaded.