The OEM camera stack is a complex black box in Android world. For example, Sony as an Android OEM has a long history of supporting developers. Their Open Devices is a gem, as they provide everything a developer can ask about. Unfortunately even their stance with the camera stack and unlocked bootloader is complicated:

For devices running recent software versions, for instance Xperia Z3, the removal of DRM security keys may affect advanced camera functionality. For example, noise reduction algorithms might be removed, and performance when taking photos in low-light conditions might be affected.

Before Android 5 Lollipop, the camera API provided by Android was pretty basic. Third party camera apps couldn’t do anything better because of the limitations of the official APIs. Thus camera sensor makers and OEMs came up with numerous closed sourced implementations.

android_camera2_model
Image source: AnandTech

Google introduced a new refined API with Android Lollipop to answer these shortcomings. Dubbed as ‘Camera2’, it revolutionizes the way of smartphone photography and we talked about it a little in this article. One of the most significant feature in Camera2 was the ability to capture and output photos in RAW.

Pro photographers prefer to shoot and process RAW, as they want to take the control in their hands. Parameters like color, saturation or white balance are automatically calculated by the camera stack on Android phones when the output mode is set to compressed formats like JPEG.

I’m not a photography expert, but I (like many others) have noticed the the differences between a RAW capture and the compressed version of the same picture taken by same phone. Sometimes the noise reduction level set by OEMs is so much extravagant that it results in the infamous watercolor or oil painting effect.

Indie developer Amir Zaidi, also known as AmirZ, became a popular name after his works on Rootless Pixel Launcher. His contributions were already known to the community, and the Pixel Launcher port just skyrocketed it. He has secretly been working with, you know, a secret project for some days – and the end result is DNG Processor.

dng_processor_working
DNG Processor in action

So, what does this DNG Processor app do?

It waits for new RAW images captured using the OEM camera app, or any other camera app that can capture RAWs, and then processes them into JPEGs in the background. It does this by using the power of your phone’s GPU for up to a few seconds. The results are placed in the folder /DCIM/Processed. Google Camera RAWs do NOT work since they include multiple frames, and I have not written any code to handle that.

Amir started to think about developing a revamped third party camera app called “Night Camera” after the ‘cameragate’ with OnePlus 5. The project was abandoned due to various shortcomings of the camera APIs.

Afterwards, he changed the focus and planned to post process the raw captured images in background with the prototype which ultimately becomes DNG Processor. The name is based on the Digital Negative (DNG) format of storing raw images.

Zaidi took a University course on image processing and shifted the whole operation framework from RenderScript to  OpenGL Shading Language. The transition is quite helpful to achieve quicker GPU accelerated processing.

I rewrote the entire Renderscript processing pipeline in GLSL, and that brought the runtime down to an incredible 1.5s on my OnePlus 3T. On a more modern phone like the OnePlus 6, I’ve heard reports that it takes less than half a second. Finally, a lot of tuning was done using samples from the OnePlus 3, 5 and 6. Artifacts were removed, noise reduction was improved, curves that make the result look crunchy and colourful were tuned for every situation.

The project in its current stage should be considered as alpha, as it may crash on many phones due to lack of free memory or improper OpenGL drivers. Newer OnePlus phones are reported to be working, as well as Poco F1 is on the same list. Notable non-working phones are Samsung Galaxy S8 and Note 9.

We got in touch with Amir regarding the current status of the app. He confirmed us to bring more fixes and increase device compatibility.

DNG Processor by Amir Zaidi in action

Like Amir’s other creations, DNG Processor is free and open source. The first version of the app can be found on Play Store by visiting this link manually as it is marked as early access. The APK is available on the GitHub release page for sideloading fans.

Before trying this app, remember to find and turn on the option to enable RAW mode shooting in your camera app.

Interested readers are requested to share their feedbacks via GitHub issue tracker.

PiunikaWeb is a unique initiative that mainly focuses on investigative journalism. This means we do a lot of hard work to come up with news stories that are either ‘exclusive,’ ‘breaking,’ or ‘curated’ in nature. Perhaps that’s the reason our work has been picked by the likes of Forbes, Foxnews, Gizmodo, TechCrunch, Engadget, The Verge, Macrumors, and more. Do take a tour of our website to get a feel of our work. And if you like what we do, stay connected with us on Twitter (@PiunikaWeb) and other social media channels to receive timely updates on stories we publish.

Kingshuk De
896 Posts

I came from a mixed background of Statistics and Computer Science. My research domains included embedded computer systems, mobile computing and delay tolerant networks in post-disaster scenarios. Apart from tinkering with gadgets or building hackintosh, I like to hop on various subreddits and forums like MyDigitalLife and XDA.

Next article View Article

[Updated] Instagram crashing on all Android phones, but there are workarounds

Here's the crux of the article in video form: New updates are being added at the bottom of this story……. Original story from (June 5, 2018) follows: We're...
Jul 10, 2023 6 Min Read