FORUMS
Remove All Ads from XDA

[GUIDE] Color correction. Loadable mDNIe color profiles.

547 posts
Thanks Meter: 160
 
By heyjoe66, Senior Member on 25th July 2014, 09:47 PM
Post Reply Email Thread
I hope I've brought something useful here.
I figured out how to load mDNIe color profiles from sdcard.


So this I found out so far:

1. you have to be rooted;

2. profiles MUST be placed in /sdcard/mdnie folder;

3. profile is a text file and can be edited with any text editor;

4. file name is irrelevant ;

5. you have to edit two titles inside profile file to correspond to profile, you're going to override, eg. you're using AMOLED cinema mode. It's internal name is DYNAMIC_UI, so titles inside profile should be DYNAMIC_UI_1 for longer array and DYNAMIC_UI_2 for shorter one.
The whole list of model with corresponding internal names:
AMOLED cinema mode - DYNAMIC_UI;
AMOLED photo - STANDARD_UI;
Basic - NATURAL_UI;

6. first lines (bytes) of arrays are special marks (0xEC and 0xEB) and should not be touched;

7. to enable profile you have to write into /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning:
echo 1 > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
echo "profile file name without path and spaces" > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning

8. PROFILE WILL RESET AFTER SCREEN OFF/ON CYCLE. For now I'm using Tasker to refresh it on screen on event. Maybe later we'll figure out some more elegant way;


UPDATE:
Written a small app for PC to tune colors through ADB. Useful for displaying some fullscreen test picture on device and drag sliders on PC to see effect (if any).

Profile structure description is in 2nd post.


That's it by now. There are comments from kernel source, but not too much descriptive (attached here).
I'd extracted and formated properly some major profiles. Attaching them here. Now we need to play allot with them to find out what each byte is doing exactly.
All profiles attached here have matching line numbers. I suggest to keep this pattern, so it will allow us to refer particular byte by line number while discussing here.
Attached Files
File Type: zip mdnie.zip - [Click for QR Code] (19.0 KB, 465 views)
File Type: zip tuner_app.zip - [Click for QR Code] (22.5 KB, 422 views)
The Following 10 Users Say Thank You to heyjoe66 For This Useful Post: [ View ] Gift heyjoe66 Ad-Free
 
 
30th July 2014, 12:18 PM |#2  
OP Senior Member
Thanks Meter: 160
 
More
Profile bytes with description:
Description will be updated as figured out.

Code:
  1 :  BYPASS_2			
  2 :  {			
  3 :  0xEB,			
  4 :  0x01,	/* mdnie_en */		
  5 :  0x00,   /* data_width mask 00 0000 */			
  6 :  0x00,   /* ascr_roi 1 ascr 00 1 0 */ (only odd values 1-155, affects lines 132-155)			
  7 :  0x02,   /* algo_roi 1 algo lce_roi 1 lce 00 1 0 00 1 0 */			
  8 :  0x00,   /* roi_ctrl 00 */			
  9 :  0x00,   /* roi0_x_start 12 */			
 10 :  0x00,   			
 11 :  0x00,   /* roi0_x_end */			
 12 :  0x00,   			
 13 :  0x00,   /* roi0_y_start */			
 14 :  0x00,   			
 15 :  0x00,   /* roi0_y_end */			
 16 :  0x00,   			
 17 :  0x00,   /* roi1_x_strat */			
 18 :  0x00,   			
 19 :  0x00,   /* roi1_x_end */			
 20 :  0x00,   			
 21 :  0x00,   /* roi1_y_start */			
 22 :  0x00,   			
 23 :  0x00,   /* roi1_y_end */			
 24 :  0x00,			
 25 :  };			
 26 :  BYPASS_1			
 27 :  {			
 28 :  0xEC,			
 29 :  0x18,	/* lce_on 0 lce_gain 0 0 00 0000 */		
 30 :  0x24,   /* lce_color_gain 00 0000 */			
 31 :  0x10,   /* lce_scene_change_on scene_trans 0 0000 */			
 32 :  0x14,   /* lce_min_diff */			
 33 :  0xb3,   /* lce_illum_gain */			
 34 :  0x01,   /* lce_ref_offset 9 */			
 35 :  0x0e,   			
 36 :  0x01,   /* lce_ref_gain 9 */			
 37 :  0x00,   			
 38 :  0x66,   /* lce_block_size h v 0000 0000 */			
 39 :  0xfa,   /* lce_bright_th */			
 40 :  0x2d,   /* lce_bin_size_ratio */			
 41 :  0x03,   /* lce_dark_th 000 */			
 42 :  0x96,   /* lce_min_ref_offset */			
 43 :  0x00,   /* nr sharp cs gamma 0000 */ 	(unsharpen mask radius (0-15))			
 44 :  0xff,   /* nr_mask_th */			(unsharpen mask threshold)
 45 :  0x00,   /* sharpen_weight 10 */		(unsharpen mask strength (0-199))	
 46 :  0x00,   			
 47 :  0x07,   /* sharpen_maxplus 11 */			
 48 :  0xff,   			
 49 :  0x07,   /* sharpen_maxminus 11 */			
 50 :  0xff,   			
 51 :  0x01,   /* cs_gain 10 */			
 52 :  0x00,   			
 53 :  0x00,   /* curve_1_b */			
 54 :  0x20,   /* curve_1_a */			
 55 :  0x00,   /* curve_2_b */			
 56 :  0x20,   /* curve_2_a */			
 57 :  0x00,   /* curve_3_b */			
 58 :  0x20,   /* curve_3_a */			
 59 :  0x00,   /* curve_4_b */			
 60 :  0x20,   /* curve_4_a */			
 61 :  0x00,   /* curve_5_b */			
 62 :  0x20,   /* curve_5_a */			
 63 :  0x00,   /* curve_6_b */			
 64 :  0x20,   /* curve_6_a */			
 65 :  0x00,   /* curve_7_b */			
 66 :  0x20,   /* curve_7_a */			
 67 :  0x00,   /* curve_8_b */			
 68 :  0x20,   /* curve_8_a */			
 69 :  0x00,   /* curve_9_b */			
 70 :  0x20,   /* curve_9_a */			
 71 :  0x00,   /* curve10_b */			
 72 :  0x20,   /* curve10_a */			
 73 :  0x00,   /* curve11_b */			
 74 :  0x20,   /* curve11_a */			
 75 :  0x00,   /* curve12_b */			
 76 :  0x20,   /* curve12_a */			
 77 :  0x00,   /* curve13_b */			
 78 :  0x20,   /* curve13_a */			
 79 :  0x00,   /* curve14_b */			
 80 :  0x20,   /* curve14_a */			
 81 :  0x00,   /* curve15_b */			
 82 :  0x20,   /* curve15_a */			
 83 :  0x00,   /* curve16_b */			
 84 :  0x20,   /* curve16_a */			
 85 :  0x00,   /* curve17_b */			
 86 :  0x20,   /* curve17_a */			
 87 :  0x00,   /* curve18_b */			
 88 :  0x20,   /* curve18_a */			
 89 :  0x00,   /* curve19_b */			
 90 :  0x20,   /* curve19_a */			
 91 :  0x00,   /* curve20_b */			
 92 :  0x20,   /* curve20_a */			
 93 :  0x00,   /* curve21_b */			
 94 :  0x20,   /* curve21_a */			
 95 :  0x00,   /* curve22_b */			
 96 :  0x20,   /* curve22_a */			
 97 :  0x00,   /* curve23_b */			
 98 :  0x20,   /* curve23_a */			
 99 :  0x00,   /* curve24_b */			
100 :  0xff,   /* curve24_a */			
101 :  0x20,   /* ascr_skin_on strength 0 00000 */			
102 :  0x67,   /* ascr_skin_cb */			
103 :  0xa9,   /* ascr_skin_cr */			
104 :  0x0c,   /* ascr_dist_up */			
105 :  0x0c,   /* ascr_dist_down */			
106 :  0x0c,   /* ascr_dist_right */			
107 :  0x0c,   /* ascr_dist_left */			
108 :  0x00,   /* ascr_div_up 20 */			
109 :  0xaa,   			
110 :  0xab,   			
111 :  0x00,   /* ascr_div_down */			
112 :  0xaa,   			
113 :  0xab,   			
114 :  0x00,   /* ascr_div_right */			
115 :  0xaa,   			
116 :  0xab,   			
117 :  0x00,   /* ascr_div_left */			
118 :  0xaa,   			
119 :  0xab,   			
120 :  0xff,   /* ascr_skin_Rr */			
121 :  0x00,   /* ascr_skin_Rg */			
122 :  0x00,   /* ascr_skin_Rb */			
123 :  0xff,   /* ascr_skin_Yr */			
124 :  0xff,   /* ascr_skin_Yg */			
125 :  0x00,   /* ascr_skin_Yb */			
126 :  0xff,   /* ascr_skin_Mr */			
127 :  0x00,   /* ascr_skin_Mg */			
128 :  0xff,   /* ascr_skin_Mb */			
129 :  0xff,   /* ascr_skin_Wr */			
130 :  0xff,   /* ascr_skin_Wg */			
131 :  0xff,   /* ascr_skin_Wb */			
132 :  0x00,   /* ascr_Cr */	red in cyan		
133 :  0xff,   /* ascr_Rr */	red in red 		
134 :  0xff,   /* ascr_Cg */	green in cyan		
135 :  0x00,   /* ascr_Rg */	green in red		
136 :  0xff,   /* ascr_Cb */	blue in cyan		
137 :  0x00,   /* ascr_Rb */	blue in red		
138 :  0xff,   /* ascr_Mr */	red in magenta		
139 :  0x00,   /* ascr_Gr */	red in green		
140 :  0x00,   /* ascr_Mg */	green in magenta		
141 :  0xff,   /* ascr_Gg */	green in green		
142 :  0xff,   /* ascr_Mb */	blue in magenta		
143 :  0x00,   /* ascr_Gb */	blue in green		
144 :  0xff,   /* ascr_Yr */	red in yellow		
145 :  0x00,   /* ascr_Br */	red in blue		
146 :  0xff,   /* ascr_Yg */	green in yellow		
147 :  0x00,   /* ascr_Bg */	green in blue		
148 :  0x00,   /* ascr_Yb */	blue in yellow		
149 :  0xff,   /* ascr_Bb */	blue in blue		
150 :  0xff,   /* ascr_Wr */	red in white		
151 :  0x00,   /* ascr_Kr */	red in black		
152 :  0xff,   /* ascr_Wg */	green in white		
153 :  0x00,   /* ascr_Kg */	green in black		
154 :  0xff,   /* ascr_Wb */	blue in white		
155 :  0x00,   /* ascr_Kb */	blue in black		
156 :  };
The Following User Says Thank You to heyjoe66 For This Useful Post: [ View ] Gift heyjoe66 Ad-Free
31st July 2014, 06:20 PM |#3  
Account currently disabled
Flag Phuket, Thailand
Thanks Meter: 15,895
 
Donate to Me
More
Hey, this looks useful.

Do you mind if I incorporate a variation of this into my SkyHigh kernel. Just an idea ATM to make it Synapse compatible and switchable etc. I'm sure it's doable

Won't be able to try for a few weeks though, still away and have some other kernel commitments on my return

Sent from my SM-N9005 using XDA Premium 4 mobile app
The Following User Says Thank You to UpInTheAir For This Useful Post: [ View ] Gift UpInTheAir Ad-Free
31st July 2014, 09:24 PM |#4  
OP Senior Member
Thanks Meter: 160
 
More
Quote:
Originally Posted by UpInTheAir

Hey, this looks useful.

Do you mind if I incorporate a variation of this into my SkyHigh kernel. Just an idea ATM to make it Synapse compatible and switchable etc. I'm sure it's doable

Won't be able to try for a few weeks though, still away and have some other kernel commitments on my return

Sent from my SM-N9005 using XDA Premium 4 mobile app

Actually, there is nothing here to do with kernel, stock kernel is already capable of loading profiles.
On the other hand, to load profile I do use Tasker so as for reloading on every screen on, 'cause it gets reset every time.
And I do understand that not every user can handle this with such creepy app like Tasker.
So implementing some easy way to handle choosing/loading/reloading plofiles sounds really useful.

The method and app I introduced here are only a comfortable way to investigate a profile structure and build a fine tuned, personolized profile for a particular display and taste. Further usage of that profile yet needs to be developed.
31st July 2014, 09:42 PM |#5  
Account currently disabled
Flag Phuket, Thailand
Thanks Meter: 15,895
 
Donate to Me
More
Quote:
Originally Posted by heyjoe66

Actually, there is nothing here to do with kernel, stock kernel is already capable of loading profiles.
On the other hand, to load profile I do use Tasker so as for reloading on every screen on, 'cause it gets reset every time.
And I do understand that not every user can handle this with such creepy app like Tasker.
So implementing some easy way to handle choosing/loading/reloading plofiles sounds really useful.

The method and app I introduced here are only a comfortable way to investigate a profile structure and build a fine tuned, personolized profile for a particular display and taste. Further usage of that profile yet needs to be developed.

Yes, I understand that. I wish to add the control into Synapse, no need for scripts or other apps, that's all

I do have control for similar with my Note 3 kernel. I just might try implement some of it, stock or not.


Sent from my SM-N9005 using XDA Premium 4 mobile app
The Following 4 Users Say Thank You to UpInTheAir For This Useful Post: [ View ] Gift UpInTheAir Ad-Free
26th August 2014, 12:46 AM |#6  
Senior Member
Thanks Meter: 52
 
More
Ok, let me be the first who admits it, I have no glue how to calibrate the screen with your tools. Could you post a step by step guide or even Youtube video? That would be awesome.
26th August 2014, 04:37 PM |#7  
Orphee's Avatar
Senior Member
Thanks Meter: 594
 
More
Hi,

There is an application on the PlayStore : ColorTRUE
A workmate has the Colormonki Display calibration tool.

I will ask him share it to see how it works and if I can make a "real life" calibrated color screen.
The Following User Says Thank You to Orphee For This Useful Post: [ View ] Gift Orphee Ad-Free
29th August 2014, 11:33 PM |#8  
OP Senior Member
Thanks Meter: 160
 
More
Quote:
Originally Posted by Orphee

Hi,

There is an application on the PlayStore : ColorTRUE
A workmate has the Colormonki Display calibration tool.

I will ask him share it to see how it works and if I can make a "real life" calibrated color screen.

Hi,

(from app description)
Quote:

Look for other ColorTRUE Aware Apps
Unlike your laptop or desktop operating system, Android mobile apps do not have system wide color management capabilities. Therefore, each app must apply color profiles individually. For this reason, X-Rite has created the ColorTRUE Aware Partner Program. We are currently collaborating with other app developers to allow them to seamlessly access your ColorTRUE profile so any app can display colors accurately and consistently. ColorTRUE Aware apps will be color managed once you create a profile with ColorTRUE. Just look for the ColorTRUE Aware logo for compatibility.

Looks like it doesn't use mdnie.
10th September 2014, 01:31 PM |#9  
Orphee's Avatar
Senior Member
Thanks Meter: 594
 
More
Quote:
Originally Posted by heyjoe66

Hi,

(from app description)


Looks like it doesn't use mdnie.

You are right, I tried the display calibration tool, it only works in X-rite app.

I don't know if it can help, but I extracted ICC profile from data application.

mDNIe is quite obscure for me...

Edit : There is a tool to open ICC profiles here : http://www.color.org/profileinspector.xalter
Attached Files
File Type: zip icc.zip - [Click for QR Code] (383.6 KB, 48 views)
11th September 2014, 09:59 PM |#10  
OP Senior Member
Thanks Meter: 160
 
More
Quote:
Originally Posted by Orphee

You are right, I tried the display calibration tool, it only works in X-rite app.

I don't know if it can help, but I extracted ICC profile from data application.

mDNIe is quite obscure for me...

Edit : There is a tool to open ICC profiles here : http://www.color.org/profileinspector.xalter

Not sure if I know what to do with this. I can see some values in the Profile Explorer you provided, but I have no idea, what threy mean.
I tried to read a bit about ICC, like here and here, but seriously, that's too much new info for me right now.

The most terrible thing about color here that bothers me is that color reproduction is heavily depend on screen brightness. With low brightness level grayscale goes totally green. I think I'll try to implement some callback for brightness changes in mdnie in kernel and apply some color correction there. Have no idea, how I'm gonna do that, but I'll try.
11th September 2014, 10:20 PM |#11  
Orphee's Avatar
Senior Member
Thanks Meter: 594
 
More
Do you want me to do a titanium backup of X-rite ColorTrue to leave you try it (with it own gallery)
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