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      * The number of milliseconds to hold tap-to-expose/metering after the
75      * last payload frame is received before returning to continuous 3A.
76      */
77     private static final int GCAM_POST_SHOT_FOCUS_HOLD_MILLIS = 1000;
78 
79     /**
80      * Width of touch metering region in [0,1] relative to shorter edge of the
81      * current crop region. Multiply this number by the number of pixels along
82      * shorter edge of the current crop region's width to get a value in pixels.
83      *
84      * <p>
85      * This value has been tested on Nexus 5 and Shamu, but will need to be
86      * tuned per device depending on how its ISP interprets the metering box and weight.
87      * </p>
88      *
89      * <p>
90      * Was fixed at 300px x 300px prior to L release.
91      * </p>
92      */
93     private static final float GCAM_METERING_REGION_FRACTION = 0.1225f;
94 
95     /**
96      * Weight of a touch metering region, in [0, \inf).
97      *
98      * <p>
99      * This value has been tested on Nexus 5 and Shamu, but will need to be
100      * tuned per device.
101      * </p>
102      *
103      * <p>
104      * Was fixed at 15.0f prior to L release.
105      * </p>
106      */
107     private static final float GCAM_METERING_REGION_WEIGHT = 45.0f;
108 
getAutoFocusRegionWidth()109     public static float getAutoFocusRegionWidth() {
110         return AF_REGION_BOX;
111     }
112 
getMeteringRegionWidth()113     public static float getMeteringRegionWidth() {
114         return AE_REGION_BOX;
115     }
116 
getMeteringRegionWeight()117     public static float getMeteringRegionWeight() {
118         return REGION_WEIGHT;
119     }
120 
getGcamMeteringRegionFraction()121     public static float getGcamMeteringRegionFraction() {
122         return GCAM_METERING_REGION_FRACTION;
123     }
124 
getGcamMeteringRegionWeight()125     public static float getGcamMeteringRegionWeight() {
126         return GCAM_METERING_REGION_WEIGHT;
127     }
128 
getFocusHoldMillis()129     public static int getFocusHoldMillis() {
130         return FOCUS_HOLD_MILLIS;
131     }
132 
getGcamPostShotFocusHoldMillis()133     public static int getGcamPostShotFocusHoldMillis() {
134         return GCAM_POST_SHOT_FOCUS_HOLD_MILLIS;
135     }
136 }
137