Improve raw noise model for N5.

Replace the current raw noise model, calibrated using Android's
dng_noise_model.py script, with an improved noise model, using an
updated version of that script.

The new raw noise model has a different parameterization in terms
of ISO:

- The formula for 'S' scales with ISO. While shot noise should
  be zero for a completely dark signal, we still include an offset
  here to help compensate for black level variations with ISO.

- The new formula for 'O' scales with ISO^2, not ISO. This form is
  required because 'O' corresponds to the *variance* due to read
  noise. The new formula also treats analog and digital gain
  separately. While pre-ADC read noise is affected by both types
  of gain, post-ADC read noise is affected *only* by digital gain.

Bug: 16273313
Change-Id: If7d1e48138230a487a5b270e5686c699e80ff419
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 480259a..d86bb31 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -4410,8 +4410,8 @@
  *==========================================================================*/
 
 double QCamera3HardwareInterface::computeNoiseModelEntryS(int32_t sens) {
-   double s = 1.693069e-06 * sens + 3.480007e-05;
-   return s < 0.0 ? 0.0 : s;
+    double s = 1.691405e-06 * sens + 2.694004e-06;
+    return s < 0.0 ? 0.0 : s;
 }
 
 /*===========================================================================
@@ -4427,8 +4427,10 @@
  *==========================================================================*/
 
 double QCamera3HardwareInterface::computeNoiseModelEntryO(int32_t sens) {
-   double o = 1.301416e-07 * sens + -2.262256e-04;
-   return o < 0.0 ? 0.0 : o
+    double digital_gain = sens / 800.0;
+    digital_gain = digital_gain < 1.0 ? 1.0 : digital_gain;
+    double o = 1.445877e-11 * sens * sens + 2.506080e-07 * digital_gain * digital_gain;
+    return o < 0.0 ? 0.0 : o
 ;}
 
 /*===========================================================================