FORUMS
Remove All Ads from XDA

[MOD] Custom camera HAL with 4K UHD/DCI and 30 FPS video recording [Apr. 22, 2016]

6,312 posts
Thanks Meter: 36,935
 
By Sultanxda, Recognized Developer on 15th February 2016, 10:58 AM
Post Reply Email Thread
Code:
/*
* Your warranty is... still valid?
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this mod
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*
*/
Installing this mod will give you the ability to record 4K UHD/DCI videos on your OnePlus X, as well as record videos at a consistent 30 frames per second in all lighting conditions (no more frame drops/stuttering when recording videos at night). This mod is compatible with most ROMs.

This is a custom camera HAL I created using CAF's vanilla camera HAL sources. As a lot of reverse engineering was involved in this, there are some caveats (see below).

Do NOT install this on my CM13 ROM!

Note that some ROMs using older proprietary camera libraries (such as the newest version of H2OS) will not benefit from 30 FPS video or my anti-shake algorithm.

If the 4K option does not appear in the camera app you're using, or your camera stops working, then clear data for the camera app that you're using.


Notable features:
  • 4K UHD and DCI video recording
  • Consistent 30 FPS video recording in all lighting conditions
  • Intelligent anti-shake algorithm (significantly reduces motion blur when capturing photos)
  • Faster autofocus in low lighting conditions
  • No stuttering in camera viewfinder
  • Improved photo quality
  • Photo capture up to 4208x3120 resolution (instead of 4160x3120)

Caveats:
  • No ClearImage
  • No manual mode only in the OnePlus Camera app (other apps that support manual ISO and manual exposure work fine)

Installation instructions:
Install the 60 Hz Anti-banding file if you are in any of the following countries:

American Samoa
Anguilla
Antigua
Aruba
Bahamas
Belize
Bermuda
Brazil
Canada
Cayman Islands
Colombia
Costa Rica
Cuba
Dominican Republic
Ecuador
El Salvador
Guam
Guatemala
Guyana
Haiti
Honduras
Liberia
Mexico
Micronesia
Montserrat Islands
Nicaragua
Okinawa
Palmyra Atoll
Panama
Peru
Philippines
Puerto Rico
St. Kitts & Nevis Islands
Saudi Arabia
South Korea
Suriname
Tahiti
Taiwan
Trinidad & Tobago
United States
Venezuela
Virgin Islands


Instructions:
  1. Download the camera HAL and copy it to your device
  2. Reboot to recovery
  3. Install the camera HAL
  4. OPTIONAL install the 60 Hz Anti-banding file ONLY if you are in any of the countries listed above
  5. Reboot

Downloads:
Camera HAL: http://forum.xda-developers.com/devd...t/dl/?id=18115

60 Hz Anti-banding: http://forum.xda-developers.com/devd...t/dl/?id=17356


XDA:DevDB Information
Custom camera HAL for OPX, Device Specific App for the OnePlus X

Contributors
Sultanxda

Version Information
Status: Stable

Created 2016-02-15
Last Updated 2016-08-10
The Following 175 Users Say Thank You to Sultanxda For This Useful Post: [ View ]
 
 
15th February 2016, 10:58 AM |#2  
Sultanxda's Avatar
OP Recognized Developer
Flag California
Thanks Meter: 36,935
 
Donate to Me
More
Changelog:

April 22, 2016:
*Fixed slow-motion recording in the OnePlus Camera app (for OxygenOS)
*Fixed delay when moving camera while recording high-speed and slow-motion videos
*Fewer frames are dropped when recording high-speed and slow-motion videos now

April 20, 2016:
*Fixed blue tint when recording slow-motion and high-speed videos (60 FPS and 120 FPS videos)

April 17, 2016:
*Made anti-shake algorithm even less aggressive (images are less noisy and better quality now)

March 26, 2016:
*Made anti-shake algorithm less aggressive (images are less noisy and better quality now)
*Reduced JPEG quality to 95% (image files are smaller with no visible impact to quality)
*Improved image clarity

March 13, 2016:
*Fixed anti-banding setting in camera apps
*Set default anti-banding mode to 50 Hz (for Europe)
*Added flashable zip to change default anti-banding mode to 60 Hz (for the USA; see the installation instructions for details)
*Fixed rare flashing in camera viewfinder

March 7, 2016:
*Fixed graphical glitches when using HDR
*Fixed graphical glitches when taking photos with the front camera
*Fixed many other minor bugs

March 6, 2016:
*Fixed noisy HDR photos
*Fixed incorrect maker, model, and aperture displayed in image info

March 5, 2016:
*Fixed HDR
*Fixed manual exposure control
*Fixed manual ISO control

February 26, 2016:
*Implemented stronger, more intelligent anti-shake algorithm (significantly reduces motion blur when capturing photos)
*Fixed Panorama mode not working in Google Camera after recording video
*Fixed Photo Sphere mode not working in Google Camera after recording video
*Fixed photo capture not working while recording 4K video

February 22, 2016:
*Fixed compatibility with H2OS (note: 30 FPS video is not guaranteed in H2OS, as well as some out-of-date ROMs)
*Fixed long delay when turning off the flashlight in some ROMs
*Fixed long delay when switching between the front and back camera in some ROMs
*Improved image sharpness and clarity

February 16, 2016:
*Fixed compatibility with all ROMs

February 15, 2016:
*Initial release
The Following 49 Users Say Thank You to Sultanxda For This Useful Post: [ View ]
15th February 2016, 10:58 AM |#3  
Sultanxda's Avatar
OP Recognized Developer
Flag California
Thanks Meter: 36,935
 
Donate to Me
More
Reserved
The Following 14 Users Say Thank You to Sultanxda For This Useful Post: [ View ]
15th February 2016, 11:01 AM |#4  
Senior Member
Thanks Meter: 482
 
More
will test this soon and hope it works. you will be saviour for us.
15th February 2016, 11:05 AM |#5  
Sultanxda's Avatar
OP Recognized Developer
Flag California
Thanks Meter: 36,935
 
Donate to Me
More
Quote:
Originally Posted by saurabh40629

will test this soon and hope it works. you will be saviour for us.

I tested it on CM12.1 and OxygenOS 2.2.0, and it appears to be working. Tested 4k UHD recording in Google Camera and it works.

The 4k video option won't show up in the OxygenOS camera app until you clear data for the app.

Let's see how this goes
The Following 16 Users Say Thank You to Sultanxda For This Useful Post: [ View ]
15th February 2016, 11:12 AM |#6  
Member
Thanks Meter: 6
 
More
Holy crap the legendary sultan developing for the one x?!?! Any plans for a oneplus x rom as well?
The Following 2 Users Say Thank You to surronix For This Useful Post: [ View ] Gift surronix Ad-Free
15th February 2016, 11:14 AM |#7  
Senior Member
Flag Rennes
Thanks Meter: 12
 
More
Super nice, waiting for Manuel Camera Controls as said in the post but this is already awesome
15th February 2016, 11:14 AM |#8  
Senior Member
Thanks Meter: 482
 
More
Quote:
Originally Posted by Sultanxda

I tested it on CM12.1 and OxygenOS 2.2.0, and it appears to be working. Tested 4k UHD recording in Google Camera and it works.

The 4k video option won't show up in the OxygenOS camera app until you clear data for the app.

Let's see how this goes

Because of Enormously crappy camera videos, I was having thoughts of selling this one. Seems like my money is saved. Kudos to you.
15th February 2016, 11:34 AM |#9  
Junior Member
Thanks Meter: 6
 
More
If the camera had the capability to record to 4k,why didn't one plus include it in oos?
The Following 2 Users Say Thank You to sathyakaushik4 For This Useful Post: [ View ] Gift sathyakaushik4 Ad-Free
15th February 2016, 11:38 AM |#10  
mieru's Avatar
Senior Member
Thanks Meter: 77
 
More
Flashed on temasek v4.0 and had a bootloop after that. Needed to reflash the rom.
15th February 2016, 11:49 AM |#11  
Sultanxda's Avatar
OP Recognized Developer
Flag California
Thanks Meter: 36,935
 
Donate to Me
More
Quote:
Originally Posted by sathyakaushik4

If the camera had the capability to record to 4k,why didn't one plus include it in oos?

They didn't know how to fix it. There's a software bug with 4k on Snapdragon 800/801 chips that causes the 4k video to record at 7 FPS. This is a very difficult bug to fix (took me weeks to originally fix it on my OPO), so it isn't surprising that they decided to move on to other things instead of trying to solve it.

Quote:
Originally Posted by mieru

Flashed on temasek v4.0 and had a bootloop after that. Needed to reflash the rom.

The media_profiles.xml that comes with my package probably has some things in it that your ROM doesn't like. I'll have to test it myself to get a log so I can fix it.

Quote:
Originally Posted by surronix

Holy crap the legendary sultan developing for the one x?!?! Any plans for a oneplus x rom as well?

Not enough time/energy/motivation for that right now. Have a camera HAL instead
The Following 26 Users Say Thank You to Sultanxda For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes