ITS: test_ev_compensation_basic loosen RTOL at high EV comp values

bug: 204915612
Change-Id: I577aa98ea48770564d21f05bcd8a98a23fea33dc
diff --git a/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py b/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py
index 379cc11..7d8b9f2 100644
--- a/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py
+++ b/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py
@@ -29,7 +29,8 @@
 import its_session_utils
 
 LOCKED = 3
-LUMA_LOCKED_TOL = 0.05
+LUMA_LOCKED_RTOL_EV_SM = 0.05
+LUMA_LOCKED_RTOL_EV_LG = 0.10
 NAME = os.path.splitext(os.path.basename(__file__))[0]
 NUM_UNSATURATED_EVS = 3
 PATCH_H = 0.1  # center 10%
@@ -87,6 +88,11 @@
           props['android.control.aeCompensationStep'])
       steps_per_ev = int(1.0 / ev_per_step)
       evs = range(-2 * steps_per_ev, 2 * steps_per_ev + 1, steps_per_ev)
+      luma_locked_rtols = [LUMA_LOCKED_RTOL_EV_LG,
+                           LUMA_LOCKED_RTOL_EV_SM,
+                           LUMA_LOCKED_RTOL_EV_SM,
+                           LUMA_LOCKED_RTOL_EV_SM,
+                           LUMA_LOCKED_RTOL_EV_LG]
 
       # Converge 3A, and lock AE once converged. skip AF trigger as
       # dark/bright scene could make AF convergence fail and this test
@@ -100,7 +106,8 @@
       fmt = capture_request_utils.get_smallest_yuv_format(
           props, match_ar=match_ar)
       lumas = []
-      for ev in evs:
+      for j, ev in enumerate(evs):
+        luma_locked_rtol = luma_locked_rtols[j]
         # Capture a single shot with the same EV comp and locked AE.
         req = create_request_with_ev(ev)
         caps = cam.do_capture([req]*THRESH_CONVERGE_FOR_EV, fmt)
@@ -112,14 +119,19 @@
             image_processing_utils.write_image(
                 img, f'{test_name_w_path}_ev{ev}_frame{i}.jpg')
           if cap['metadata']['android.control.aeState'] == LOCKED:
+            ev_meta = cap['metadata']['android.control.aeExposureCompensation']
+            logging.debug('cap EV compensation: %d', ev_meta)
+            if ev != ev_meta:
+              raise AssertionError(
+                  f'EV compensation cap != req! cap: {ev_meta}, req: {ev}')
             luma = extract_luma_from_capture(cap)
             luma_locked.append(luma)
             if i == THRESH_CONVERGE_FOR_EV-1:
               lumas.append(luma)
               if not math.isclose(min(luma_locked), max(luma_locked),
-                                  rel_tol=LUMA_LOCKED_TOL):
+                                  rel_tol=luma_locked_rtol):
                 raise AssertionError(f'AE locked lumas: {luma_locked}, '
-                                     f'RTOL: {LUMA_LOCKED_TOL}')
+                                     f'RTOL: {luma_locked_rtol}')
       logging.debug('lumas in AE locked captures: %s', str(lumas))
       if caps[THRESH_CONVERGE_FOR_EV-1]['metadata'][
           'android.control.aeState'] != LOCKED: