Home | History | Annotate | Download | only in one
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.camera.one;
     18 
     19 /**
     20  * Contains 3A parameters common to all camera flavors.
     21  * TODO: Move to GservicesHelper.
     22  */
     23 public class Settings3A {
     24 
     25     /**
     26      * Width of touch AF region in [0,1] relative to shorter edge of the current
     27      * crop region. Multiply this number by the number of pixels along the
     28      * shorter edge of the current crop region's width to get a value in pixels.
     29      *
     30      * <p>
     31      * This value has been tested on Nexus 5 and Shamu, but will need to be
     32      * tuned per device depending on how its ISP interprets the metering box and weight.
     33      * </p>
     34      *
     35      * <p>
     36      * Values prior to L release:
     37      * Normal mode: 0.125 * longest edge
     38      * Gcam: Fixed at 300px x 300px.
     39      * </p>
     40      */
     41     private static final float AF_REGION_BOX = 0.2f;
     42 
     43     /**
     44      * Width of touch metering region in [0,1] relative to shorter edge of the
     45      * current crop region. Multiply this number by the number of pixels along
     46      * shorter edge of the current crop region's width to get a value in pixels.
     47      *
     48      * <p>
     49      * This value has been tested on Nexus 5 and Shamu, but will need to be
     50      * tuned per device depending on how its ISP interprets the metering box and weight.
     51      * </p>
     52      *
     53      * <p>
     54      * Values prior to L release:
     55      * Normal mode: 0.1875 * longest edge
     56      * Gcam: Fixed at 300px x 300px.
     57      * </p>
     58      */
     59     private static final float AE_REGION_BOX = 0.3f;
     60 
     61     /** Metering region weight between 0 and 1.
     62      *
     63      * <p>
     64      * This value has been tested on Nexus 5 and Shamu, but will need to be
     65      * tuned per device depending on how its ISP interprets the metering box and weight.
     66      * </p>
     67      */
     68     private static final float REGION_WEIGHT = 0.022f;
     69 
     70     /** Duration to hold after manual tap to focus. */
     71     private static final int FOCUS_HOLD_MILLIS = 3000;
     72 
     73     /**
     74      * Width of touch metering region in [0,1] relative to shorter edge of the
     75      * current crop region. Multiply this number by the number of pixels along
     76      * shorter edge of the current crop region's width to get a value in pixels.
     77      *
     78      * <p>
     79      * This value has been tested on Nexus 5 and Shamu, but will need to be
     80      * tuned per device depending on how its ISP interprets the metering box and weight.
     81      * </p>
     82      *
     83      * <p>
     84      * Was fixed at 300px x 300px prior to L release.
     85      * </p>
     86      */
     87     private static final float GCAM_METERING_REGION_FRACTION = 0.1225f;
     88 
     89     /**
     90      * Weight of a touch metering region, in [0, \inf).
     91      *
     92      * <p>
     93      * This value has been tested on Nexus 5 and Shamu, but will need to be
     94      * tuned per device.
     95      * </p>
     96      *
     97      * <p>
     98      * Was fixed at 15.0f prior to L release.
     99      * </p>
    100      */
    101     private static final float GCAM_METERING_REGION_WEIGHT = 22.0f;
    102 
    103     public static float getAutoFocusRegionWidth() {
    104         return AF_REGION_BOX;
    105     }
    106 
    107     public static float getMeteringRegionWidth() {
    108         return AE_REGION_BOX;
    109     }
    110 
    111     public static float getMeteringRegionWeight() {
    112         return REGION_WEIGHT;
    113     }
    114 
    115     public static float getGcamMeteringRegionFraction() {
    116         return GCAM_METERING_REGION_FRACTION;
    117     }
    118 
    119     public static float getGcamMeteringRegionWeight() {
    120         return GCAM_METERING_REGION_WEIGHT;
    121     }
    122 
    123     public static int getFocusHoldMillis() {
    124         return FOCUS_HOLD_MILLIS;
    125     }
    126 }
    127