IPTestListJB.java revision dbad8eb5a8bb16488351c5236974812d282b7b82
1/*
2 * Copyright (C) 2012 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
17package com.android.rs.imagejb;
18
19import android.app.Activity;
20import android.view.View;
21import android.util.Log;
22
23public class IPTestListJB {
24    private final String TAG = "Img";
25    public final String RESULT_FILE = "image_processing_result.csv";
26
27    /**
28     * Define enum type for test names
29     */
30    public enum TestName {
31        // totally there are 38 test cases
32        LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed", 1),
33        LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed", 1),
34        LEVELS_VEC3_FULL ("Levels Vec3 Full", 0),
35        LEVELS_VEC4_FULL ("Levels Vec4 Full", 0),
36        BLUR_RADIUS_25 ("Blur radius 25", 1),
37        INTRINSIC_BLUE_RADIUS_25 ("Intrinsic Blur radius 25", 2),
38        GREYSCALE ("Greyscale", 1),
39        GRAIN ("Grain", 1),
40        FISHEYE_FULL ("Fisheye Full", 0),
41        FISHEYE_RELAXED ("Fisheye Relaxed", 1),
42        FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full", 0),
43        FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed", 1),
44        VIGNETTE_FULL ("Vignette Full", 0),
45        VIGNETTE_RELAXED ("Vignette Relaxed", 1),
46        VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full", 0),
47        VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed", 1),
48        GROUP_TEST_EMULATED ("Group Test (emulated)", 2),
49        GROUP_TEST_NATIVE ("Group Test (native)", 2),
50        CONVOLVE_3X3 ("Convolve 3x3", 1),
51        INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3", 2),
52        COLOR_MATRIX ("ColorMatrix", 1),
53        INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix", 2),
54        INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey", 2),
55        COPY ("Copy", 1),
56        CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)", 2),
57        CONVOLVE_5X5 ("Convolve 5x5", 1),
58        INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5", 2),
59        MANDELBROT ("Mandelbrot", 0),
60        INTRINSICS_BLEND ("Intrinsics Blend", 2),
61        VIBRANCE ("Vibrance", 1),
62        BW_FILTER ("BW Filter", 1),
63        SHADOWS ("Shadows", 1),
64        CONTRAST ("Contrast", 1),
65        EXPOSURE ("Exposure", 1),
66        WHITE_BALANCE ("White Balance", 1);
67
68
69        private final String name;
70        public final int group;
71
72        private TestName(String s, int g) {
73            name = s;
74            group = g;
75        }
76
77        // return quoted string as displayed test name
78        public String toString() {
79            return name;
80        }
81    }
82
83    static TestBase newTest(TestName testName) {
84        switch(testName) {
85        case LEVELS_VEC3_RELAXED:
86            return new LevelsV4(false, false);
87        case LEVELS_VEC4_RELAXED:
88            return new LevelsV4(false, true);
89        case LEVELS_VEC3_FULL:
90            return new LevelsV4(true, false);
91        case LEVELS_VEC4_FULL:
92            return new LevelsV4(true, true);
93        case BLUR_RADIUS_25:
94            return new Blur25(false);
95        case INTRINSIC_BLUE_RADIUS_25:
96            return new Blur25(true);
97        case GREYSCALE:
98            return new Greyscale();
99        case GRAIN:
100            return new Grain();
101        case FISHEYE_FULL:
102            return new Fisheye(false, false);
103        case FISHEYE_RELAXED:
104            return new Fisheye(false, true);
105        case FISHEYE_APPROXIMATE_FULL:
106            return new Fisheye(true, false);
107        case FISHEYE_APPROXIMATE_RELAXED:
108            return new Fisheye(true, true);
109        case VIGNETTE_FULL:
110            return new Vignette(false, false);
111        case VIGNETTE_RELAXED:
112            return new Vignette(false, true);
113        case VIGNETTE_APPROXIMATE_FULL:
114            return new Vignette(true, false);
115        case VIGNETTE_APPROXIMATE_RELAXED:
116            return new Vignette(true, true);
117        case GROUP_TEST_EMULATED:
118            return new GroupTest(false);
119        case GROUP_TEST_NATIVE:
120            return new GroupTest(true);
121        case CONVOLVE_3X3:
122            return new Convolve3x3(false);
123        case INTRINSICS_CONVOLVE_3X3:
124            return new Convolve3x3(true);
125        case COLOR_MATRIX:
126            return new ColorMatrix(false, false);
127        case INTRINSICS_COLOR_MATRIX:
128            return new ColorMatrix(true, false);
129        case INTRINSICS_COLOR_MATRIX_GREY:
130            return new ColorMatrix(true, true);
131        case COPY:
132            return new Copy();
133        case CROSS_PROCESS_USING_LUT:
134            return new CrossProcess();
135        case CONVOLVE_5X5:
136            return new Convolve5x5(false);
137        case INTRINSICS_CONVOLVE_5X5:
138            return new Convolve5x5(true);
139        case MANDELBROT:
140            return new Mandelbrot();
141        case INTRINSICS_BLEND:
142            return new Blend();
143        case VIBRANCE:
144            return new Vibrance();
145        case BW_FILTER:
146            return new BWFilter();
147        case SHADOWS:
148            return new Shadows();
149        case CONTRAST:
150            return new Contrast();
151        case EXPOSURE:
152            return new Exposure();
153        case WHITE_BALANCE:
154            return new WhiteBalance();
155        }
156        return null;
157    }
158
159}
160
161