yashsingh1/xdaforums huggingface dataset:
[ZenFone 2 Themes and Apps] dreckneck:
"(as far as I can tell the asus camera log show the app being able to identify the camera, although it gives an error that only one camera is present)"

That explains the crash! Since Raw Dumper knows your device has 2 cameras and assumes they are both working, it tries to obtain information from both of them during the app loading. It crashes while trying to obtain information from your front camera. Mystery solved!

Well, now I just need to think a new strategy to make the app work when one of the cameras is broken hmmmm
[ZenFone 2 Themes and Apps] dreckneck:
Hi, I made a new version that should work on your phone. Tell me if it's working so I update the GitHub repo.

The apk is here
[ZenFone 2 Themes and Apps] pcaquercia:
It's working now!

Thank you!
[ZenFone 2 Themes and Apps] SpiderPack:
[MENTION=7094526]dreckneck[/MENTION]

I was wondering about the .so file... Does it "affect" other camera apps?

Can you give a insight about it? What changes have you done in it and why?

I'll will understand if don't want to share any sensitive information, but any, would easily satisfy my curiosity. :)
[ZenFone 2 Themes and Apps] dreckneck:
It's quite complex, but I'll try to explain everything.

Here is the source code of AtomCommon.cpp, a source file that contains general configurations for the AtomISP camera (AtomISP is the image signal processor of the atom processors). Inside that file, there is a function called "getGFXHALPixelFormatFromV4L2Format" that converts image formats using a switch-case loop.

Looking at the end of the code of the function, you can see this:

if (halPixelFormat == BAD_VALUE) {
LOGE("@%s Unknown / unsupported preview pixel format: fatal error, aborting",
__FUNCTION__);
abort();
}

The code snippet above says that if the function can't convert the image format, the function calls abort(), crashing the ENTIRE camera subsystem.

Now, looking back at the switch-case loop of the function, we can find this code snippet:

case V4L2_PIX_FMT_SGRBG8:
case V4L2_PIX_FMT_SGBRG10:
case V4L2_PIX_FMT_SBGGR10:
case V4L2_PIX_FMT_SRGGB10:
halPixelFormat = HAL_PIXEL_FORMAT_RGBA_8888;
break;

These are RAW bayer image formats, they are needed for taking raw pictures:

V4L2_PIX_FMT_SGRBG8 means: Green, Red, Blue, Green raw bayer pattern, where each pixel needs 8 bits

V4L2_PIX_FMT_SGBRG10 means: Green, Blue, Red, Green raw bayer pattern, where each pixel needs 10 bits

V4L2_PIX_FMT_SBGGR10 means: Blue, Green, Green, Red, raw bayer pattern, where each pixel needs 10 bits

V4L2_PIX_FMT_SRGGB10 means: Red, Green, Green, Blue raw bayer pattern, where each pixel needs 10 bits

All raw image formats are using 10 bits EXCEPT THE FIRST ONE!

The rear camera sensor of the Zenfone 2 uses V4L2_PIX_FMT_SGRBG10 format BUT THIS FORMAT IS NOT LISTED! THAT'S A BUG! So, the function fails to convert the raw format and crashes the application!

The patched blob replaces one UNUSED image format (I don't remember which one) with V4L2_PIX_FMT_SGRBG10, so the camera subsystem doesn't crash and it's possible to take raw pictures.

Note: Asus fixed this bug on the Marshmallow blobs, so that's why a patch isn't needed by the ones using stock MM rom.

Answering your question: No, since only two bytes of one raw format are changed, the patch shouldn't affect other camera apps.
[ZenFone 2 Themes and Apps] SpiderPack:
Wow! Seriously? You just had to change one of the switch-case options (the one unused) for a compatible one, and that's done?

You're a beast for getting it.

Another question: those with MM blobs (i.e. using stock MM rom) are able to ser exposure to 16s? Is it locked to the "blob limitation"? If I'm not wrong, the longest for lollipop's is 1/2s.
[ZenFone 2 Themes and Apps] dreckneck:
The long exposure feature was only implemented after the Marshmallow update, because it requires some changes on the camera sensor's drivers.

Note: they implemented long exposure (Zen2 sensors's drivers are open source btw) even for the front camera sensor. Oddly enough, that feature is never used since the manual mode is available for the rear camera only
[ZenFone 2 Themes and Apps] RealYoti:
How about Zenfone Zoom support? Z00XS, Z3580/Z3590.
[ZenFone 2 Themes and Apps] dreckneck:
It's going to happen when the Zenfone Zoom I ordered during the black friday finally arrives ;)

PS: I'm really excited to hack this device and get raw pictures with optical zoom! :D
[ZenFone 2 Themes and Apps] dreckneck:
I got my new Zenfone Zoom today and I tried to take raw pictures aaaaaaaaand it doesn't work :(

The raw feature ***almost*** works (I even got some interesting logs).

However, when the "take a raw picture" command gets in the low-level driver, the driver enters in a loop state because the feature was disabled.

Since the m10mo driver is open-source, and because the raw feature is literally just commented out from the code, it *should* be possible to recompile the driver, making the raw capture work. However, a custom kernel is probably needed :b

(Why Asus is always difficulting my life?!)

Btw: raw works on the front camera (using a hack)

An interesting logcat I got:

D/Camera_ControlThread: requested size 1920x1080, sensor output size: 4736x3552, aspect diff 0.444444

Yes, the raw feature will output a F*CKING 4736x3552 IMAGE! That's almost 17 megapixels and 33.6MB of data! However, the actual picture will be smaller (about 4208x3152): it will contain some black borders that are used to perform black-level calibration (so it's possible to perfectly black-level calibrate each picture)

Ps: the zenfone zoom can take some GREAT pictures. The color calibration is so much better (than the Zenfone 2), optical zoom and optical stabilization are just AWESOME
[ZenFone 2 Themes and Apps] michaeldesanctis:
news on a release for Zenfone Zoom?
[ZenFone 2 Themes and Apps] badboy21102000:
can you help us port stock camera app from asus, with fix some bug
[ZenFone 2 Themes and Apps] Athulcs:
Keeps crashing in zenfone 2 ze550ml Lineage os :(.

Yes,I did change the camera driver in system/libs.
[ZenFone 2 Themes and Apps] kenbo111:
Is this dead?
[ZenFone 2 Themes and Apps] dreckneck:
Which Lineage OS version are you using?

Could you send me a log?
[ZenFone 2 Themes and Apps] dreckneck:
It's not dead.

I just got frustrated because I tried to develop some different features and none of them worked haha :(

Also, this could impact the app's ability to take raw pictures since I'm mostly using an undocumented API to do that :/

(of course, only if an Android P Lineage OS version is ever created for the Zen2)

PS: AsusCamera itself also uses the hidden addRawBufferCallback API ~facepalm
[ZenFone 2 Themes and Apps] dreckneck:
Hey guys, I've updated the app!

I tested it on latest Lineage OS and it appears to be working :)

I added more advanced focus features, manual focus, gpu-accelerated viewfinder and the ability to take raw pictures on the selfie cam of Zenfone Zoom too (the rear camera still doesn't works :( )

I *REALLY* want your feedback about this version because I'm going to release it on Google Play, yay! :D

For a more detailed description about this release: click HERE
[ZenFone 2 Themes and Apps] SpiderPack:
Manual focous is perfect! Also the focous presets are well tuned.

Currently I'm on ZE551ML with NutOS (unofficial LineageOS)

If you are in a bug hunt, I'd advise looking in the shutterspeed slider. Once I reach the fastest (1/10000), it loses track of my swapping gesture. Unless I click on a slower speed, I'm stuck there.

Once again you've nailed, Sir!

Outstanding job!
[ZenFone 2 Themes and Apps] dreckneck:
The slider problem is well known. I'm using a small slider library but I'm probably going to create my own.

Thank you so much for your feedback! :)

Update: the app is already in the Play Store, YAY! So you guys can now update the app from there :)

Note: I REALLY need to redo the app's description at the Play Store
[ZenFone 2 Themes and Apps] SpiderPack:
HOLY S***! Focus Peaking!

This is what's missing from any manual camera app!

Guys, go ahead and download it from Play Store. Updates like that must not be missed!
[ZenFone 2 Themes and Apps] dreckneck:
What's the model of your phone? Are you using a custom rom?
[ZenFone 2 Themes and Apps] dreckneck:
Could you please attach a log file using the app Syslog?
[ZenFone 2 Themes and Apps] SpiderPack:
Same model, same ROM. Did you flash the root zip? Did you replaced the .lib file? (Read op)
[ZenFone 2 Themes and Apps] dreckneck:
Hi, I've analyzed your logcat and it appears that none of your cameras are recognized by Android.

Question 1: did your cameras were working before replacing the lib file?

Question 2: there is a directory called "m10mo" inside /system/lib/hw/ ?

Question 3: do any other camera app works after rebooting your phone?
[ZenFone 2 Themes and Apps] dreckneck:
You don't need root access to see if the /system/lib/hw/m10mo folder exists

Since you don't have root access, the app should complain about it, but it crashes even before checking root access :b
[ZenFone 2 Themes and Apps] AlexBBxelA:
Sorry can you explain me how to replace the .lib ?

thanks
[ZenFone 2 Themes and Apps] SpiderPack:
Sure! First you will need to be sure you have root access and a file explorer capable of accessing your root directory. I'd recommend using MiXplorer (download it in XDA labs)

After that, access MiXplorer sidebar and select the option "ROOT". It will show you the partition very similar to Linux. Find your way through: /system/lib/hw/

Once you reach that folder, paste OP's .lib file in there. When questioned, select "replace". Reboot your phone and you are good to go.
[ZenFone 2 Themes and Apps] AlexBBxelA:
Thanks ! i will try ASAP!
[ZenFone 2 Themes and Apps] dreckneck:
Hi guys, got some news

I've been recently playing with more color-related stuff. I'm planning to implement an advanced LSC - Lens Shading Correction (or Lens Vignetting Correction, if you prefer) because I found the "official" LSC files: inside /factory directory. And, because they are text files, it's easy to parse them, yay!

But the real game changer here is a new white balance algorithm, mainly because it *almost* works everytime. It has some performance implications and some disadvantages, but the results are pretty :) The algorithm: force the camera HAL to operate in a special debug mode where *everything* is printed on logcat; and then, use the logcat command to read all the info to search for the AWB sensor gains. It's hacky, will interfere with other apps' logs and requires (about) more 10% processor usage.

Using AWB sensor gains has some key advantages:

1) They work on EVERY white balance mode available (auto, manual, tungsten, daylight, cloudy...)

2) They require absolutely no hard math to be implemented

3) They work independently of the color calibration that I'm using. THIS CHANGES EVERYTHING. So, it doesn't matter if the color calibration is sh*tty, the white balance will be right (even with odd colors)

And, finally, I made this image, comparing the old maker-note-based-white-balance (before) with the new logcat-parsing-white-balance (after):

PS: the after picture also has lens shading correction applied

PS2: the pics were just opened on Lightroom Mobile and saved.
[ZenFone 2 Themes and Apps] SpiderPack:
Definitely looking forward. Gotta confess I didn't know our camera had problems with vignetting. Is it across all devices? Or only for those with optical zoom?

Either way, a better white balance algorithm got me hyped lol. Cheers for all work done so far!
[ZenFone 2 Themes and Apps] dreckneck:
All cameras have some sort of vignetting (and distortion) due to lens imperfections. However, cameras with wide angle lenses (like Zenfone 2 front camera) and zoom lenses have a tendency to a stronger vignetting.

I released today a new version of the app with the new auto white balance algorithm, so check it out! :D

The app still needs a better color calibration, however, that would only be possible after finishing the gain map feature </3
[ZenFone 2 Themes and Apps] PedroCaseiro:
Hey man. I just tried this 20 mins ago and I'm very pleased with the results.

What I don't understand is:

1 - Does it improve picture quality in other apps like snapchat or instagram and even Google Camera?

2 - Does it make the PixelMaster's features that don't work on LineageOS work (Auto optimization, TimeLapse, Miniature etc...) ?

Thanks for your great work. I will certainly accompany the project and hope that you have sucess in future updates and features you want to add
[ZenFone 2 Themes and Apps] PedroCaseiro:
Update:

The lib messed up the recording of videos on Snapchat and Instagram. On Snapchat if I start recording a video in the preview it only shows half of what I've recorded... Same for Instagram

And lot's of misbehaviour on both apps.
[ZenFone 2 Themes and Apps] SpiderPack:
I'm assuming that you've also tested with the original .lib... Right?

I mean: are you sure those issues aren't related to LOS?
[ZenFone 2 Themes and Apps] PedroCaseiro:
No, I use the modified lib in the first post. I'm very sure it aren't LOS issues because I restored the original lib from the backup I've made and it started working normally
[ZenFone 2 Themes and Apps] dreckneck:
No, it shouldn't affect other apps (at least in theory)

The PixelMaster's features need some .so files that are probably missing on Lineage OS (and it should have some other incompatibilities)

Thank you for your support :)
[ZenFone 2 Themes and Apps] dreckneck:
That's really weird, could you please send me the lib file of your backup?

PS: I have briefly tested recording a video on Instagram stories and it apparently worked well
[ZenFone 2 Themes and Apps] PedroCaseiro:
Here is the lib file https://drive.google.com/open?id=1PRK_NTqq0TMIHrg41ymlTl9iklkgfCvu
[ZenFone 2 Themes and Apps] dreckneck:
The file appears to be the patched lib, not the original one
[ZenFone 2 Themes and Apps] PedroCaseiro:
That's weird. I'm sure it's the backed up version
[ZenFone 2 Themes and Apps] Jenzen:
Thanks for all your work, unfortunately I get the 'known bug in the camera driver' message for the rear camera. I read in a previous post that you had created a patch for the driver but I can't find it. I'm using ZE551ML with stock lollipop ROM.

Thanks
[ZenFone 2 Themes and Apps] Azmaluth:
Great job!

Hi! I understand that it's asking a lot, but are you planning on making the custom kernel for the zoom version? I don't mind learning how to making one, this app is the only reason I rooted my phone. Keep up the great work, you rock for doing this! :good::good::good:
[ZenFone 2 Themes and Apps] dreckneck:
Hi, link to the patch is here:
[ZenFone 2 Themes and Apps] dreckneck:
Thank you for your feedback! Yes, I'm planning to make a custom kernel for zenfone zoom. However, I failed to compile the kernel every time I tried so I got really unmotivated :(
[ZenFone 2 Themes and Apps] itizar1:
I have been getting driver error in 2 last versions although I changed the driver after all rom updates. It's tried on both NutOS and Groovy Android. I have both Magisk and Xposed. What am I doing wrong?
[ZenFone 2 Themes and Apps] dreckneck:
I recently installed Groovy Android on my Zen2, and after replacing the .so file, the app worked.

So the custom rom is not the problem...

I'm planning to create a flashable zip file (or even a Magisk module) anyway, so the process becomes a little bit easier
[ZenFone 2 Themes and Apps] dreckneck:
Hi, I've got some news:

I successfully compiled some custom kernels, so *maybe* I can enable raw capture on the Zenfone Zoom

(or enable some new cool stuff since both front and rear sensors's drivers are open source)
[ZenFone 2 Themes and Apps] Me_Zaid:
I love how Asus puts great hardware in their phones and then ruins everything with poorly-made software that does not exploit its hardware capabilities at a maximum level. It's not only the RAW capability that's missing, but also the slow motion recording, which is a total joke! According to some, it's actually a 7 frames-per-second video in Zenfone Zoom's case (I suppose Zenfone 2's situation is likewise.), which means it's a slowed-down 30 fps video. WHY ON EARTH did they do that? To keep the humongous 1080p format? I don't care if it's a 480p video as long as it's PROPERLY slowed down. (They need to reduce the format in order to increase the frame rate, to keep hardware parameters and things safe.) Just do your goddamn job and respect the hardware capabilities that YOU opted for, Asus!

Maybe they don't have a legal obligation to make hardware components available at a max level, but they definitely have a moral obligation out of respect for the customer. Even Samsung SGH-I900 (Omnia) shoots better slow motion videos, no matter if the resolution's crap! Pity, 'cause these are amazing devices that could shoot some pretty decent (even pro quality) photography or videos! The ZX551ML is a supposed "camera phone" - it shoots great pictures, but it could have been much better.

I also love how nobody knows what camera model is in the Zenfone Zoom's rear. For instance, we all know that the front camera in both models, the ZE551ML and ZX551ML, is Omnivision's OV5670, while the Zenfone 2 has a Toshiba T4K37 rear sensor. In Zenfone Zoom (ZX551ML), the hardware-information-gathering apps only show "Fujitsu MO10M" as the camera make and model, which is the image processing engine actually, not the sensor. And as to the front camera, according to Omnivision's official papers, that little bugger is capable of shooting 60 fps 1080p VIDEOS! It is also capable of shooting 120 frames per second at a 480p resolution. I see none of these things possible in Asus' implementation or default camera app... the famous PixelMaster. I don't know who is responsible for all these things but I think I'd make "great friends" with the software engineer who made this s**t.

First of all, I want to thank you for your initiative of making RAW material extraction possible for the Zenfone 2. If you'll manage to implement RAW capture for one of Asus' most underrated and neglected phones (the Zenfone Zoom - amazing hardware and plainly awful software deployment), is it a way to make it possible without root? Thank you again, and keep up the good work!
[ZenFone 2 Themes and Apps] LSS4181:
I'm interested in what is needed to get the rear camera working with the app on Zenfone Zoom (Z00X) as well, but from what I saw the Zoom (Z00X) uses the same kernel base as Z00A... It seems more like a vendor software library difference than kernel drivers, or maybe differences in system configurations...
[ZenFone 2 Themes and Apps] SpiderPack:
Out of curiosity... Did you ever consider making possible to save pictures in JPEG as well? Or something like:

RAW

JPEG

RAW+JPEG

This feature could mean I would ditch the Asus' app when the goal was taking pictures.
[ZenFone 2 Themes and Apps] Me_Zaid:
Until RAW is available, you can use apps like Open Camera or MX Camera (from Magix) to shoot decent-quality JPEG photos. Asus' Pixel Master applies awful amounts of compression and does not have an option to set the JPEG quality, as those apps have. If you set it to 100, you can get 12 MB images, while Asus' PM will only reach 6 or 7 megabytes for about the same amount of image information; so the size gets almost doubled. Pixel Master uses the most aggressive compression algorithms.

You can see it by pointing your device on the same object, with about the same settings and focus, and holding it still, shooting a picture with Asus' Pixel Master camera app, then with a different app that has the option to set the JPEG quality (to 100). Then, compare the image sizes. Sure, compression is still there, but it's much better with a different app.

4 megabytes is not pretty decent for a complex and vibrant 13-megapixel image. Compression affects the quality seriously on a micro level, and Asus is best at ruining details this way. RAW capture or zero compression should not be a luxury.
[ZenFone 2 Themes and Apps] SpiderPack:
Well, thanks! I'm aware of this :)

But I'm more interested in the manual mode provided on either pixelmaster or (our beloved) Raw Dumper. The later goes even further because provides focus metering.

Just FYI: I have the Zenfone 2 ZE551ML and NutOS (LineageOS 14.1). That means Raw Dumper already works here. I've been giving feedback on this thread for quite some time lol
[ZenFone 2 Themes and Apps] userAmit:
Hello, my device is zenfone 2 ze551ml with lineage os 14.1 and is rooted with su. I installed raw dumper and replaced the .so file.

Other cameras work fine like google camera and zenflash. But when I open raw dumper it just disappears.

1: yes

2: no

3. yes

edit: the lib file means the .so file right?
[ZenFone 2 Themes and Apps] dreckneck:
A real slow-motion mode is lacking probably due some limitation of the Intel SoC (however I'm 100% sure that Atom Z3580 supports at least 1080p/60fps recording). Even Zenfone 3 (where the sensor and the SoC are 100% slo-mo capable) generates fake slo-mo videos. I think Asus's (and Intel's) image processing algorithms just weren't as mature as their competition. They focused less on the video recording features, and prioritized manual mode, beautify, low-light and super-resolution in their app.

PS: I guess Zenfone Zoom uses Panasonic MN34130 sensor but I'm not entirely sure.

Thank you for your interest :)

About the Zenfone Zoom case: it will require not only root but also a custom kernel; I successfully compiled and flashed the Zoom's kernel on my phone and I started developing it; however, enabling raw capture on this phone is WAY HARDER than I previously thought because the m10mo code is AWFUL and appears to have some weird thread-scheduling behavior. My next strategy is compare the m10mo code of all kernel versions, because I think raw capture worked in (at least) one of them. I'm also playing with the flash driver, maybe I can implement slow-sync flash or a powerful torch app where the user selects the LED power :)
[ZenFone 2 Themes and Apps] dreckneck:
They are similar, however the Zen Zoom uses a WAY different camera architecture; the processor is not connected directly to the camera sensor, it's connected to the m10mo Image Signal Processor (and the m10mo is connected to the sensor). And that's make everything much harder than it should be :)
[ZenFone 2 Themes and Apps] dreckneck:
Yes, I was planning to add JPG and WEBP (from the raw YUV streams) formats; however the camera gets too unstable and glitchy when switching formats, but I'll see what I can do.

RAW + JPG is currently not possible because the camera driver is dumb can't properly output both image streams at once. What I could do is to process the RAW file *inside the app* using a custom-made algorithm and generate an additional JPG, hmmm.

PS: the app development is going to be slower because I got a job haha
[ZenFone 2 Themes and Apps] dreckneck:
Yes, the lib file means the .so file, which file are you replacing?

Reading the logcat, the app is crashing due to an error when the app tries to send a SU command; there's probably a hard-to-reproduce bug in the app, because I also had some random SU issues before.
[ZenFone 2 Themes and Apps] LSS4181:
So the camera is connected indirectly on Z00X... if so then how would the stock Camera app handle the camera functions, such as zooming and laser focus? If it's being designed this way it's most likely not possible to interact with the camera through conventional means as the kernel/system only knows about m10mo and does not know about the actual camera sensor.

Also, this level of complexity probably explained why there weren't anyone trying to develop custom ROMs for Z00X (and the Z00X forum here being rather inactive), because it's just not possible to make camera work there.

Z00A custom ROMs can be flashed to Z00X (need to remove the ifwi assertions first). However on custom ROMs, SIM cards won't work (off-topic), and while camera works, I was not able to zoom or focus (that was on DotOS' default camera app, I'm not sure about others but most likely they won't, either). The laser sensor does appear to function a little, though, as I was able to see some slight red blinks coming out of it (which is also the behavior on stock ROM).