Google Camera pink tint fix for Omnivision sensors(MIDO)

chickentuna

Senior Member
Feb 13, 2012
1,464
576
133
A few days ago I was browsing reddit r/Xiaomi section and commented on this thread: https://www.reddit.com/r/Xiaomi/comments/77p2va/i_have_a_note_4x_with_an_omnivision_sensor/dot4b9e/ about the pink tint issue that we are experiencing on Omnivision sensors. To make it short, a redditor (GeorgeKiarie) asked to post samples of the pink tint issue.

I was providing him samples of photos with pink tint and basically running some tests for him. Right off the bat when he saw the photo with pink tint, he came to a conclusion that the black levels in the camera libraries are incorrect. According to GeorgeKiarie, the default black levels was 16 16 on the Omnivision camera libs which is incorrect as it should have been 64 16.

The fix: GeorgeKiarie has modified libmmcamera_ov13855_qtech.so and change the black levels from 16 16 to 64 16.

Requirements:
- TWRP Recovery
- Root(to enable camera2 api obviously)
- Camera2 API
- GCAM version 4.0(attached)

Disclaimer: I have not done extensive testing on this fix. I have only tested this on my device (16/3gb RAM variant) so I cannot guarantee that this will also work for you. I am not responsible for any kind of damage (if any) that it may cause once you've flashed the fix but I will provide a flashable zip to revert back to default just in case. As usual, flash at your on risk.

I've also NOT tested the fix on other GCAM versions besides the one I've attached and the latest GCAM 5.1 but in theory, it should work on all GCAM ports for mido. Take note that most of my tests were done with gcam 4.0. I've also tested it on gcam 5.1 and it seems to work fine but I've only took a few shots with it.

Steps:
1. Download the attachment "Pink Tint Fix.zip"
2. Reboot to recovery and flash zip.
3. Download and install Gcam 4.0 from here: https://drive.google.com/open?id=0B6OCKwxBBePEQmowWm5mRUR3Tk0
4. Enable HDR+ and enjoy good quality low light photos

Bugs:
- Camera crashes after taking photos in good lighting conditions but only when HDR+ is enabled.
- Random camera crashes even in low light conditions
- Camera stuck in "processing" when taking a photo under good lighting conditions
- Shutter button is greyed out and/or not responding when taking a photo under good lighting conditions
- All other bugs present in Google Cam 4.0 port.

All the above mentioned bugs only happens when HDR+ is enabled. It seems that HDR+ does not work when enabled under good lighting conditions. Please do not ask me to fix it as I am no developer. I only helped in testing. Hopefully someone smarter than me can fix these bugs. Please feel free to post fixes If you've found one and I'd include it in the OP.

All credits go to redditor GeorgeKiarie. I only helped in testing the fix and creating a flashable zip. If you wanna thank him, just visit the reddit link above and message him or something.

PS: As mentioned above, I am not a developer so all these has been written the way I've understood the issue and how it was fixed, I'm just relaying the information provided to me. Please feel free to correct me if you see something wrong and I'd gladly edit my post.
 

Attachments

Last edited:
P

PolLovesAndroid

Guest
I did not experience this when I've tried the latest version. Probably the settings? Then again I haven't tested thoroughly on the latest version.

Let me explain: the latest test version from the guy that ported the camera to other phones has removed the pink tint that was previously present, and replaced it with a slightly less obnoxious white tint.

It's not great still, but also with the fix you posted my camera crashes a lot, sometimes it snaps on hdr+ sometimes nothing happens and it freezes. So the basic idea may be right, but someone can hopefully improve it
 

SamYang

Member
Sep 19, 2016
45
6
0
Cool. Please do post a feedback if it works for you
it worked. but the photos will get some coloros in the low light/at night,it's normal?(you can see the photo below,plz ignore my poor camera technology:().maybe it will work better in the daytime(so i will still test it tomorrow)
anyway, it's better than the pink photos, and better than no HDR+ . :cool:
and thank you very much for doing this.:good:
(sorry for my poor English, hope you can get my meaning)
 

chickentuna

Senior Member
Feb 13, 2012
1,464
576
133
It's not great still, but also with the fix you posted my camera crashes a lot, sometimes it snaps on hdr+ sometimes nothing happens and it freezes. So the basic idea may be right, but someone can hopefully improve it
That's basically the plan. I know that this fix was not perfect but I still posted it in hopes that someone can make something out of it.


Sent from my Redmi Note 4 using Tapatalk
 
  • Like
Reactions: Emyyy53

xalexis2001

Senior Member
Mar 21, 2015
382
125
73
Love you @chickentuna!!!?? You have no ide how much I've been waiting for this moment ?

---------- Post added at 05:58 PM ---------- Previous post was at 05:57 PM ----------

Love you @chickentuna!!!?? You have no ide how much I've been waiting for this moment ?
 

chickentuna

Senior Member
Feb 13, 2012
1,464
576
133
Let me explain: the latest test version from the guy that ported the camera to other phones has removed the pink tint that was previously present, and replaced it with a slightly less obnoxious white tint.
I have a modified apk(gcam 4.2) which came from GeorgeKiarie that has the fix hardcoded in it. I'm currently testing it and it seems that it produces much sharper HDR+ images. However there are no extra settings and you use is as it is. No HDR+ configurations just HDR+ OFF, AUTO and ON. It still crashes randomly but I think it's much stable than modifying the camera libs. Colors are rich and look better too. Perhaps I should add it in the OP for you guys to test?

Android 6 CAN'T use :(
Sorry mate, forgot to include that I've only tested this in AOSP Extended 4.6 which is Android 7.1.2.

Ok @chickentuna the google hdr+ is working.
Using the magic manager to install google camera patch fix the slow motion error.
BUT.
What about the dark video recording?
Please read the OP. Current gcam bugs still exists, the fix is only for pink tint. I am not a developer so you'll need to wait till someone with the knowledge fixes the current gcam bugs.
 
  • Like
Reactions: aabenroi

aabenroi

Senior Member
Dec 6, 2011
353
210
63
Pontianak
I have a modified apk(gcam 4.2) which came from GeorgeKiarie that has the fix hardcoded in it. I'm currently testing it and it seems that it produces much sharper HDR+ images. However there are no extra settings and you use is as it is. No HDR+ configurations just HDR+ OFF, AUTO and ON. It still crashes randomly but I think it's much stable than modifying the camera libs. Colors are rich and look better too. Perhaps I should add it in the OP for you guys to test?
Sure buddy, just add it... We test it... Hahahaha...
Anyway, the modified libs works fine here, no crash for me on PA. Pixel (corr) + Nexus6P + Default
 

SamYang

Member
Sep 19, 2016
45
6
0
HDR+ is work, and photos no pink, but unfortunately the photo's quality is not so good
The photos get a lot noise even during the day:( only myself get this??