Home | History | Annotate | Download | only in camera
      1 <html devsite>
      2   <head>
      3     <title>3A Modes and State Transition</title>
      4     <meta name="project_path" value="/_project.yaml" />
      5     <meta name="book_path" value="/_book.yaml" />
      6   </head>
      7   <body>
      8   <!--
      9       Copyright 2017 The Android Open Source Project
     10 
     11       Licensed under the Apache License, Version 2.0 (the "License");
     12       you may not use this file except in compliance with the License.
     13       You may obtain a copy of the License at
     14 
     15           http://www.apache.org/licenses/LICENSE-2.0
     16 
     17       Unless required by applicable law or agreed to in writing, software
     18       distributed under the License is distributed on an "AS IS" BASIS,
     19       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     20       See the License for the specific language governing permissions and
     21       limitations under the License.
     22   -->
     23 
     24 
     25 
     26 <p>
     27   While the actual 3A algorithms are up to the HAL implementation, a high-level 
     28   state machine description is defined by the HAL interface to allow the HAL 
     29   device and the framework to communicate about the current state of 3A and 
     30   trigger 3A events.</p>
     31 <p>When the device is opened, all the individual 3A states must be STATE_INACTIVE. 
     32   Stream configuration does not reset 3A. For example, locked focus must be 
     33   maintained across the configure() call.</p>
     34 <p>Triggering a 3A action involves simply setting the relevant trigger entry in the 
     35   settings for the next request to indicate start of trigger. For example, the 
     36   trigger for starting an autofocus scan is setting the entry 
     37   ANDROID_CONTROL_AF_TRIGGER to ANDROID_CONTROL_AF_TRIGGER_START for one request; 
     38   and cancelling an autofocus scan is triggered by setting 
     39   ANDROID_CONTROL_AF_TRIGGER to ANDROID_CONTRL_AF_TRIGGER_CANCEL. Otherwise, the 
     40   entry will not exist or be set to ANDROID_CONTROL_AF_TRIGGER_IDLE. Each request 
     41   with a trigger entry set to a non-IDLE value will be treated as an independent 
     42   triggering event.</p>
     43 <p>At the top level, 3A is controlled by the ANDROID_CONTROL_MODE setting. It 
     44   selects between no 3A (ANDROID_CONTROL_MODE_OFF), normal AUTO mode 
     45   (ANDROID_CONTROL_MODE_AUTO), and using the scene mode setting 
     46   (ANDROID_CONTROL_USE_SCENE_MODE):</p>
     47 <ul>
     48   <li>In OFF mode, each of the individual Auto-focus(AF), auto-exposure (AE), and 
     49     auto-whitebalance (AWB) modes are effectively OFF, and none of the capture 
     50     controls may be overridden by the 3A routines.</li>
     51   <li>In AUTO mode, AF, AE, and AWB modes all run their own independent algorithms, 
     52     and have their own mode, state, and trigger metadata entries, as listed in the 
     53     next section.</li>
     54   <li>In USE_SCENE_MODE, the value of the ANDROID_CONTROL_SCENE_MODE entry must be 
     55     used to determine the behavior of 3A routines. In SCENE_MODEs other than 
     56     FACE_PRIORITY, the HAL must override the values of 
     57     ANDROID_CONTROL_AE/AWB/AF_MODE to be the mode it prefers for the selected 
     58     SCENE_MODE. For example, the HAL may prefer SCENE_MODE_NIGHT to use 
     59     CONTINUOUS_FOCUS AF mode. Any user selection of AE/AWB/AF_MODE when scene must 
     60     be ignored for these scene modes.</li>
     61   <li>For SCENE_MODE_FACE_PRIORITY, the AE/AWB/AFMODE controls work as in 
     62     ANDROID_CONTROL_MODE_AUTO, but the 3A routines must bias toward metering and 
     63     focusing on any detected faces in the scene.</li>
     64 </ul>
     65 <h2 id="auto-focus">Auto-focus settings and result entries</h2>
     66 <p>Main metadata entries:<br/>
     67   ANDROID_CONTROL_AF_MODE: Control for selecting the current autofocus mode. Set 
     68   by the framework in the request settings.<br/>
     69   AF_MODE_OFF: AF is disabled; the framework/app directly controls lens position.<br/>
     70   AF_MODE_AUTO: Single-sweep autofocus. No lens movement unless AF is triggered.<br/>
     71   AF_MODE_MACRO: Single-sweep up-close autofocus. No lens movement unless AF is 
     72   triggered.<br/>
     73   AF_MODE_CONTINUOUS_VIDEO: Smooth continuous focusing, for recording video. 
     74   Triggering immediately locks focus in current position. Canceling resumes 
     75   continuous focusing.<br/>
     76   AF_MODE_CONTINUOUS_PICTURE: Fast continuous focusing, for zero-shutter-lag still 
     77   capture. Triggering locks focus once currently active sweep concludes. Canceling 
     78   resumes continuous focusing.<br/>
     79   AF_MODE_EDOF: Advanced extended depth of field focusing. There is no autofocus 
     80   scan, so triggering one or canceling one has no effect. Images are focused 
     81   automatically by the HAL.<br/>
     82   ANDROID_CONTROL_AF_STATE: Dynamic metadata describing the current AF algorithm 
     83   state, reported by the HAL in the result metadata.<br/>
     84   AF_STATE_INACTIVE: No focusing has been done, or algorithm was reset. Lens is 
     85   not moving. Always the state for MODE_OFF or MODE_EDOF. When the device is 
     86   opened, it must start in this state.<br/>
     87   AF_STATE_PASSIVE_SCAN: A continuous focus algorithm is currently scanning for 
     88   good focus. The lens is moving.<br/>
     89   AF_STATE_PASSIVE_FOCUSED: A continuous focus algorithm believes it is well 
     90   focused. The lens is not moving. The HAL may spontaneously leave this state.<br/>
     91   AF_STATE_PASSIVE_UNFOCUSED: A continuous focus algorithm believes it is not well 
     92   focused. The lens is not moving. The HAL may spontaneously leave this state.<br/>
     93   AF_STATE_ACTIVE_SCAN: A scan triggered by the user is underway.<br/>
     94   AF_STATE_FOCUSED_LOCKED: The AF algorithm believes it is focused. The lens is 
     95   not moving.<br/>
     96   AF_STATE_NOT_FOCUSED_LOCKED: The AF algorithm has been unable to focus. The lens 
     97   is not moving.<br/>
     98   ANDROID_CONTROL_AFTRIGGER: Control for starting an autofocus scan, the meaning 
     99   of which depends on mode and state. Set by the framework in the request 
    100   settings.<br/>
    101   AF_TRIGGER_IDLE: No current trigger.<br/>
    102   AF_TRIGGER_START: Trigger start of AF scan. Effect depends on mode and state.<br/>
    103   AF_TRIGGER_CANCEL: Cancel current AF scan if any, and reset algorithm to 
    104   default.<br/>
    105   Additional metadata entries:<br/>
    106   ANDROID_CONTROL_AF_REGIONS: Control for selecting the regions of the field of 
    107   view (FOV) that should be used to determine good focus. This applies to all AF 
    108   modes that scan for focus. Set by the framework in the request settings.</p>
    109 <h2 id="auto-exposure">Auto-exposure settings and result entries</h2>
    110 <p>Main metadata entries:<br/>
    111   ANDROID_CONTROL_AE_MODE: Control for selecting the current auto-exposure mode. 
    112   Set by the framework in the request settings.<br/>
    113   AE_MODE_OFF: Autoexposure is disabled; the user controls exposure, gain, frame 
    114   duration, and flash.<br/>
    115   AE_MODE_ON: Standard autoexposure, with flash control disabled. User may set 
    116   flash to fire or to torch mode.<br/>
    117   AE_MODE_ON_AUTO_FLASH: Standard autoexposure, with flash on at HAL's discretion 
    118   for precapture and still capture. User control of flash disabled.<br/>
    119   AE_MODE_ON_ALWAYS_FLASH: Standard autoexposure, with flash always fired for 
    120   capture, and at HAL's discretion for precapture. User control of flash disabled.<br/>
    121   AE_MODE_ON_AUTO_FLASH_REDEYE: Standard autoexposure, with flash on at HAL's 
    122   discretion for precapture and still capture. Use a flash burst at end of 
    123   precapture sequence to reduce redeye in the final picture. User control of flash 
    124   disabled.<br/>
    125   ANDROID_CONTROL_AE_STATE: Dynamic metadata describing the current AE algorithm 
    126   state, reported by the HAL in the result metadata.<br/>
    127   AE_STATE_INACTIVE: Initial AE state after mode switch. When the device is 
    128   opened, it must start in this state.<br/>
    129   AE_STATE_SEARCHING: AE is not converged to a good value and is adjusting 
    130   exposure parameters.<br/>
    131   AE_STATE_CONVERGED: AE has found good exposure values for the current scene, and 
    132   the exposure parameters are not changing. HAL may spontaneously leave this state 
    133   to search for a better solution.<br/>
    134   AE_STATE_LOCKED: AE has been locked with the AE_LOCK control. Exposure values 
    135   are not changing.<br/>
    136   AE_STATE_FLASH_REQUIRED: The HAL has converged exposure but believes flash is 
    137   required for a sufficiently bright picture. Used for determining if a 
    138   zero-shutter-lag frame can be used.<br/>
    139   AE_STATE_PRECAPTURE: The HAL is in the middle of a precapture sequence. 
    140   Depending on AE mode, this mode may involve firing the flash for metering or a 
    141   burst of flash pulses for redeye reduction.<br/>
    142   ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER: Control for starting a metering sequence 
    143   before capturing a high-quality image. Set by the framework in the request 
    144   settings.<br/>
    145   PRECAPTURE_TRIGGER_IDLE: No current trigger.<br/>
    146   PRECAPTURE_TRIGGER_START: Start a precapture sequence. The HAL should use the 
    147   subsequent requests to measure good exposure/white balance for an upcoming 
    148   high-resolution capture.<br/>
    149   Additional metadata entries:<br/>
    150   ANDROID_CONTROL_AE_LOCK: Control for locking AE controls to their current 
    151   values.<br/>
    152   ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION: Control for adjusting AE algorithm 
    153   target brightness point.<br/>
    154   ANDROID_CONTROL_AE_TARGET_FPS_RANGE: Control for selecting the target frame rate 
    155   range for the AE algorithm. The AE routine cannot change the frame rate to be 
    156   outside these bounds.<br/>
    157   ANDROID_CONTROL_AE_REGIONS: Control for selecting the regions of the FOV that 
    158   should be used to determine good exposure levels. This applies to all AE modes 
    159   besides OFF.</p>
    160 <h2 id="auto-wb">Auto-whitebalance settings and result entries</h2>
    161 <p>Main metadata entries:<br/>
    162   ANDROID_CONTROL_AWB_MODE: Control for selecting the current white-balance mode.<br/>
    163   AWB_MODE_OFF: Auto-whitebalance is disabled. User controls color matrix.<br/>
    164   AWB_MODE_AUTO: Automatic white balance is enabled; 3A controls color transform, 
    165   possibly using more complex transforms than a simple matrix.<br/>
    166   AWB_MODE_INCANDESCENT: Fixed white balance settings good for indoor incandescent 
    167   (tungsten) lighting, roughly 2700K.<br/>
    168   AWB_MODE_FLUORESCENT: Fixed white balance settings good for fluorescent 
    169   lighting, roughly 5000K.<br/>
    170   AWB_MODE_WARM_FLUORESCENT: Fixed white balance settings good for fluorescent 
    171   lighting, roughly 3000K.<br/>
    172   AWB_MODE_DAYLIGHT: Fixed white balance settings good for daylight, roughly 
    173   5500K.<br/>
    174   AWB_MODE_CLOUDY_DAYLIGHT: Fixed white balance settings good for clouded 
    175   daylight, roughly 6500K.<br/>
    176   AWB_MODE_TWILIGHT: Fixed white balance settings good for near-sunset/sunrise, 
    177   roughly 15000K.<br/>
    178   AWB_MODE_SHADE: Fixed white balance settings good for areas indirectly lit by 
    179   the sun, roughly 7500K.<br/>
    180   ANDROID_CONTROL_AWB_STATE: Dynamic metadata describing the current AWB algorithm 
    181   state, reported by the HAL in the result metadata.<br/>
    182   AWB_STATE_INACTIVE: Initial AWB state after mode switch. When the device is 
    183   opened, it must start in this state.<br/>
    184   AWB_STATE_SEARCHING: AWB is not converged to a good value and is changing color 
    185   adjustment parameters.<br/>
    186   AWB_STATE_CONVERGED: AWB has found good color adjustment values for the current 
    187   scene, and the parameters are not changing. HAL may spontaneously leave this 
    188   state to search for a better solution.<br/>
    189   AWB_STATE_LOCKED: AWB has been locked with the AWB_LOCK control. Color 
    190   adjustment values are not changing.<br/>
    191   Additional metadata entries:<br/>
    192   ANDROID_CONTROL_AWB_LOCK: Control for locking AWB color adjustments to their 
    193   current values.<br/>
    194   ANDROID_CONTROL_AWB_REGIONS: Control for selecting the regions of the FOV that 
    195   should be used to determine good color balance. This applies only to 
    196   auto-whitebalance mode.</p>
    197 <h2 id="state-transition">General state machine transition notes</h2>
    198 <p>Switching between AF, AE, or AWB modes always resets the algorithm's state to 
    199   INACTIVE. Similarly, switching between CONTROL_MODE or CONTROL_SCENE_MODE if 
    200   CONTROL_MODE == USE_SCENE_MODE resets all the algorithm states to INACTIVE.<br/>
    201   The tables below are per-mode.</p>
    202 <h2 id="af-state">AF state machines</h2>
    203 <table>
    204   <tr>
    205     <td><strong>mode = AF_MODE_OFF or AF_MODE_EDOF</strong></td>
    206     <td></td>
    207     <td></td>
    208     <td></td>
    209   </tr>
    210   <tr>
    211     <th>State</th>
    212     <th>Transformation cause</th>
    213     <th>New state</th>
    214     <th>Notes</th>
    215   </tr>
    216   <tr>
    217     <td>INACTIVE</td>
    218     <td></td>
    219     <td></td>
    220     <td>AF is disabled</td>
    221   </tr>
    222   <tr>
    223     <td><strong>mode = AF_MODE_AUTO or AF_MODE_MACRO</strong></td>
    224     <td></td>
    225     <td></td>
    226     <td></td>
    227   </tr>
    228   <tr>
    229     <th>State</th>
    230     <th>Transformation cause</th>
    231     <th>New state</th>
    232     <th>Notes</th>
    233   </tr>
    234   <tr>
    235     <td>INACTIVE</td>
    236     <td>AF_TRIGGER</td>
    237     <td>ACTIVE_SCAN</td>
    238     <td>Start AF sweep
    239       Lens now moving</td>
    240   </tr>
    241   <tr>
    242     <td>ACTIVE_SCAN</td>
    243     <td>AF sweep done</td>
    244     <td>FOCUSED_LOCKED</td>
    245     <td>If AF successful
    246       Lens now locked</td>
    247   </tr>
    248   <tr>
    249     <td>ACTIVE_SCAN</td>
    250     <td>AF sweep done</td>
    251     <td>NOT_FOCUSED_LOCKED</td>
    252     <td>If AF successful
    253       Lens now locked</td>
    254   </tr>
    255   <tr>
    256     <td>ACTIVE_SCAN</td>
    257     <td>AF_CANCEL</td>
    258     <td>INACTIVE</td>
    259     <td>Cancel/reset AF
    260       Lens now locked</td>
    261   </tr>
    262   <tr>
    263     <td>FOCUSED_LOCKED</td>
    264     <td>AF_CANCEL</td>
    265     <td>INACTIVE</td>
    266     <td>Cancel/reset AF</td>
    267   </tr>
    268   <tr>
    269     <td>FOCUSED_LOCKED</td>
    270     <td>AF_TRIGGER</td>
    271     <td>ACTIVE_SCAN</td>
    272     <td>Start new sweep
    273       Lens now moving</td>
    274   </tr>
    275   <tr>
    276     <td>NOT_FOCUSED_LOCKED</td>
    277     <td>AF_CANCEL</td>
    278     <td>INACTIVE</td>
    279     <td>Cancel/reset AF</td>
    280   </tr>
    281   <tr>
    282     <td>NOT_FOCUSED_LOCKED</td>
    283     <td>AF_TRIGGER</td>
    284     <td>ACTIVE_SCAN</td>
    285     <td>Start new sweep
    286       Lens now moving</td>
    287   </tr>
    288   <tr>
    289     <td>All states</td>
    290     <td>mode change</td>
    291     <td>INACTIVE</td>
    292     <td></td>
    293   </tr>
    294   <tr>
    295     <td><strong>mode = AF_MODE_CONTINUOUS_VIDEO</strong></td>
    296     <td></td>
    297     <td></td>
    298     <td></td>
    299   </tr>
    300   <tr>
    301     <th>State</th>
    302     <th>Transformation cause</th>
    303     <th>New state</th>
    304     <th>Notes</th>
    305   </tr>
    306   <tr>
    307     <td>INACTIVE</td>
    308     <td>HAL initiates new scan</td>
    309     <td>PASSIVE_SCAN</td>
    310     <td>Start AF sweep
    311       Lens now moving</td>
    312   </tr>
    313   <tr>
    314     <td>INACTIVE</td>
    315     <td>AF_TRIGGER</td>
    316     <td>NOT_FOCUSED_LOCKED</td>
    317     <td>AF state query 
    318       Lens now locked</td>
    319   </tr>
    320   <tr>
    321     <td>PASSIVE_SCAN</td>
    322     <td>HAL completes current scan</td>
    323     <td>PASSIVE_FOCUSED</td>
    324     <td>End AF scan
    325       Lens now locked </td>
    326   </tr>
    327   <tr>
    328     <td>PASSIVE_SCAN</td>
    329     <td>AF_TRIGGER</td>
    330     <td>FOCUSED_LOCKED</td>
    331     <td>Immediate transformation
    332       if focus is good
    333       Lens now locked</td>
    334   </tr>
    335   <tr>
    336     <td>PASSIVE_SCAN</td>
    337     <td>AF_TRIGGER</td>
    338     <td>NOT_FOCUSED_LOCKED</td>
    339     <td>Immediate transformation
    340       if focus is bad
    341       Lens now locked</td>
    342   </tr>
    343   <tr>
    344     <td>PASSIVE_SCAN</td>
    345     <td>AF_CANCEL</td>
    346     <td>INACTIVE</td>
    347     <td>Reset lens position
    348       Lens now locked</td>
    349   </tr>
    350   <tr>
    351     <td>PASSIVE_FOCUSED</td>
    352     <td>HAL initiates new scan</td>
    353     <td>PASSIVE_SCAN</td>
    354     <td>Start AF scan
    355       Lens now moving</td>
    356   </tr>
    357   <tr>
    358     <td>PASSIVE_FOCUSED</td>
    359     <td>AF_TRIGGER</td>
    360     <td>FOCUSED_LOCKED</td>
    361     <td>Immediate transformation
    362       if focus is good
    363       Lens now locked</td>
    364   </tr>
    365   <tr>
    366     <td>PASSIVE_FOCUSED</td>
    367     <td>AF_TRIGGER</td>
    368     <td>NOT_FOCUSED_LOCKED</td>
    369     <td>Immediate transformation
    370       if focus is bad
    371       Lens now locked</td>
    372   </tr>
    373   <tr>
    374     <td>FOCUSED_LOCKED</td>
    375     <td>AF_TRIGGER</td>
    376     <td>FOCUSED_LOCKED</td>
    377     <td>No effect</td>
    378   </tr>
    379   <tr>
    380     <td>FOCUSED_LOCKED</td>
    381     <td>AF_CANCEL</td>
    382     <td>INACTIVE</td>
    383     <td>Restart AF scan</td>
    384   </tr>
    385   <tr>
    386     <td>NOT_FOCUSED_LOCKED</td>
    387     <td>AF_TRIGGER</td>
    388     <td>NOT_FOCUSED_LOCKED</td>
    389     <td>No effect</td>
    390   </tr>
    391   <tr>
    392     <td>NOT_FOCUSED_LOCKED</td>
    393     <td>AF_CANCEL</td>
    394     <td>INACTIVE</td>
    395     <td>Restart AF scan</td>
    396   </tr>
    397   <tr>
    398     <td><strong>mode = AF_MODE_CONTINUOUS_PICTURE</strong></td>
    399     <td></td>
    400     <td></td>
    401     <td></td>
    402   </tr>
    403   <tr>
    404     <th>State</th>
    405     <th>Transformation cause</th>
    406     <th>New state</th>
    407     <th>Notes</th>
    408   </tr>
    409   <tr>
    410     <td>INACTIVE</td>
    411     <td>HAL initiates new scan</td>
    412     <td>PASSIVE_SCAN</td>
    413     <td>Start AF scan
    414       Lens now moving</td>
    415   </tr>
    416   <tr>
    417     <td>INACTIVE</td>
    418     <td>AF_TRIGGER</td>
    419     <td>NOT_FOCUSED_LOCKED</td>
    420     <td>AF state query
    421       Lens now locked</td>
    422   </tr>
    423   <tr>
    424     <td>PASSIVE_SCAN</td>
    425     <td>HAL completes current scan</td>
    426     <td>PASSIVE_FOCUSED</td>
    427     <td>End AF scan
    428       Lens now locked</td>
    429   </tr>
    430   <tr>
    431     <td>PASSIVE_SCAN</td>
    432     <td>AF_TRIGGER</td>
    433     <td>FOCUSED_LOCKED</td>
    434     <td>Eventual transformation once focus good
    435       Lens now locked</td>
    436   </tr>
    437   <tr>
    438     <td>PASSIVE_SCAN</td>
    439     <td>AF_TRIGGER</td>
    440     <td>NOT_FOCUSED_LOCKED</td>
    441     <td>Eventual transformation if cannot focus
    442       Lens now locked</td>
    443   </tr>
    444   <tr>
    445     <td>PASSIVE_SCAN</td>
    446     <td>AF_CANCEL</td>
    447     <td>INACTIVE</td>
    448     <td>Reset lens position
    449       Lens now locked</td>
    450   </tr>
    451   <tr>
    452     <td>PASSIVE_FOCUSED</td>
    453     <td>HAL initiates new scan</td>
    454     <td>PASSIVE_SCAN</td>
    455     <td>Start AF scan
    456       Lens now moving</td>
    457   </tr>
    458   <tr>
    459     <td>PASSIVE_FOCUSED</td>
    460     <td>AF_TRIGGER</td>
    461     <td>FOCUSED_LOCKED</td>
    462     <td>Immediate transformation if focus is good
    463       Lens now locked</td>
    464   </tr>
    465   <tr>
    466     <td>PASSIVE_FOCUSED</td>
    467     <td>AF_TRIGGER</td>
    468     <td>NOT_FOCUSED_LOCKED</td>
    469     <td>Immediate transformation if focus is bad
    470       Lens now locked</td>
    471   </tr>
    472   <tr>
    473     <td>FOCUSED_LOCKED</td>
    474     <td>AF_TRIGGER</td>
    475     <td>FOCUSED_LOCKED</td>
    476     <td>No effect</td>
    477   </tr>
    478   <tr>
    479     <td>FOCUSED_LOCKED</td>
    480     <td>AF_CANCEL</td>
    481     <td>INACTIVE</td>
    482     <td>Restart AF scan</td>
    483   </tr>
    484   <tr>
    485     <td>NOT_FOCUSED_LOCKED</td>
    486     <td>AF_TRIGGER</td>
    487     <td>NOT_FOCUSED_LOCKED</td>
    488     <td>No effect</td>
    489   </tr>
    490   <tr>
    491     <td>NOT_FOCUSED_LOCKED</td>
    492     <td>AF_CANCEL</td>
    493     <td>INACTIVE</td>
    494     <td>Restart AF scan</td>
    495   </tr>
    496 </table>
    497 <h2 id="ae-wb">AE and AWB state machines</h2>
    498 <p>The AE and AWB state machines are mostly identical. AE has additional 
    499   FLASH_REQUIRED and PRECAPTURE states. So rows below that refer to those two 
    500   states should be ignored for the AWB state machine.</p>
    501 <table>
    502   <tr>
    503     <td><strong>mode = AE_MODE_OFF / AWB mode not AUTO</strong></td>
    504     <td></td>
    505     <td></td>
    506     <td></td>
    507   </tr>
    508   <tr>
    509     <th>State</th>
    510     <th>Transformation cause</th>
    511     <th>New state</th>
    512     <th>Notes</th>
    513   </tr>
    514   <tr>
    515     <td>INACTIVE</td>
    516     <td></td>
    517     <td></td>
    518     <td>AE/AWB disabled</td>
    519   </tr>
    520   <tr>
    521     <td><strong>mode = AE_MODE_ON_* / AWB_MODE_AUTO</strong></td>
    522     <td></td>
    523     <td></td>
    524     <td></td>
    525   </tr>
    526   <tr>
    527     <th>State</th>
    528     <th>Transformation cause</th>
    529     <th>New state</th>
    530     <th>Notes</th>
    531   </tr>
    532   <tr>
    533     <td>INACTIVE</td>
    534     <td>HAL initiates AE/AWB scan</td>
    535     <td>SEARCHING</td>
    536     <td></td>
    537   </tr>
    538   <tr>
    539     <td>INACTIVE</td>
    540     <td>AE/AWB_LOCK on</td>
    541     <td>LOCKED</td>
    542     <td>Values locked</td>
    543   </tr>
    544   <tr>
    545     <td>SEARCHING</td>
    546     <td>HAL finishes AE/AWB scan</td>
    547     <td>CONVERGED</td>
    548     <td>Good values, not changing</td>
    549   </tr>
    550   <tr>
    551     <td>SEARCHING</td>
    552     <td>HAL finishes AE scan</td>
    553     <td>FLASH_REQUIRED</td>
    554     <td>Converged but too dark without flash</td>
    555   </tr>
    556   <tr>
    557     <td>SEARCHING</td>
    558     <td>AE/AWB_LOCK on</td>
    559     <td>LOCKED</td>
    560     <td>Values locked</td>
    561   </tr>
    562   <tr>
    563     <td>CONVERGED</td>
    564     <td>HAL initiates AE/AWB scan</td>
    565     <td>SEARCHING</td>
    566     <td>Values locked</td>
    567   </tr>
    568   <tr>
    569     <td>CONVERGED</td>
    570     <td>AE/AWB_LOCK on</td>
    571     <td>LOCKED</td>
    572     <td>Values locked</td>
    573   </tr>
    574   <tr>
    575     <td>FLASH_REQUIRED</td>
    576     <td>HAL initiates AE/AWB scan</td>
    577     <td>SEARCHING</td>
    578     <td>Values locked</td>
    579   </tr>
    580   <tr>
    581     <td>FLASH_REQUIRED</td>
    582     <td>AE/AWB_LOCK on</td>
    583     <td>LOCKED</td>
    584     <td>Values locked</td>
    585   </tr>
    586   <tr>
    587     <td>LOCKED</td>
    588     <td>AE/AWB_LOCK off</td>
    589     <td>SEARCHING</td>
    590     <td>Values not good after unlock</td>
    591   </tr>
    592   <tr>
    593     <td>LOCKED</td>
    594     <td>AE/AWB_LOCK off</td>
    595     <td>CONVERGED</td>
    596     <td>Values good after unlock</td>
    597   </tr>
    598   <tr>
    599     <td>LOCKED</td>
    600     <td>AE_LOCK off</td>
    601     <td>FLASH_REQUIRED</td>
    602     <td>Exposure good, but too dark</td>
    603   </tr>
    604   <tr>
    605     <td>All AE states</td>
    606     <td>PRECAPTURE_START</td>
    607     <td>PRECAPTURE</td>
    608     <td>Start precapture sequence</td>
    609   </tr>
    610   <tr>
    611     <td>PRECAPTURE</td>
    612     <td>Sequence done, AE_LOCK off</td>
    613     <td>CONVERGED</td>
    614     <td>Ready for high-quality capture</td>
    615   </tr>
    616   <tr>
    617     <td>PRECAPTURE</td>
    618     <td>Sequence done, AE_LOCK on</td>
    619     <td>LOCKED</td>
    620     <td>Ready for high-quality capture</td>
    621   </tr>
    622 </table>
    623 <h2 id="manual-control">Enabling manual control</h2>
    624 <p>Several controls are also involved in configuring the device 3A blocks to allow 
    625   for direct application control.</p>
    626 <p>The HAL model for 3A control is that for each request, the HAL inspects the 
    627   state of the 3A control fields. If any 3A routine is enabled, then that routine 
    628   overrides the control variables that relate to that routine, and these override 
    629   values are then available in the result metadata for that capture.  So for 
    630   example, if auto-exposure is enabled in a request, the HAL should overwrite the 
    631   exposure, gain, and frame duration fields (and potentially the flash fields, 
    632   depending on AE mode) of the request. The list of relevant controls is:</p>
    633 <table>
    634   <tr>
    635     <th>Control name</th>
    636     <th>Unit</th>
    637     <th>Notes</th>
    638   </tr>
    639   <tr>
    640     <td>android.control.mode</td>
    641     <td>enum: OFF, AUTO, USE_SCENE_MODE</td>
    642     <td>High-level 3A control. When set to OFF, all 3A control by the HAL is disabled. The application must set the fields for capture parameters itself.
    643       When set to AUTO, the individual algorithm controls in android.control.* are in effect, such as android.control.afMode.
    644       When set to USE_SCENE_MODE, the individual controls in android.control.* are mostly disabled, and the HAL implements one of the scene mode settings (such as ACTION, SUNSET, or PARTY) as it wishes.</td>
    645   </tr>
    646   <tr>
    647     <td>android.control.afMode</td>
    648     <td>enum</td>
    649     <td>OFF means manual control of lens focusing through android.lens.focusDistance.</td>
    650   </tr>
    651   <tr>
    652     <td>android.control.aeMode</td>
    653     <td>enum</td>
    654     <td>OFF means manual control of exposure/gain/frame duration through android.sensor.exposureTime / .sensitivity / .frameDuration</td>
    655   </tr>
    656   <tr>
    657     <td>android.control.awbMode</td>
    658     <td>enum</td>
    659     <td>OFF means manual control of white balance. </td>
    660   </tr>
    661 </table>
    662 
    663   </body>
    664 </html>
    665