IPTestListJB.java revision d3caba7c611de6f90bf7914ab00d425ff0ff0067
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    public static final int FULL_FP = 0;
28    public static final int RELAXED_FP = 1;
29    public static final int INTRINSIC = 2;
30
31    /**
32     * Define enum type for test names
33     */
34    public enum TestName {
35        LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed", RELAXED_FP, 55.6f),
36        LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed", RELAXED_FP, 39.1f),
37        LEVELS_VEC3_FULL ("Levels Vec3 Full", FULL_FP, 57.4f),
38        LEVELS_VEC4_FULL ("Levels Vec4 Full", FULL_FP, 68.1f),
39        BLUR_RADIUS_25 ("Blur radius 25", RELAXED_FP, 1045.f),
40        INTRINSIC_BLUR_RADIUS_25 ("Intrinsic Blur radius 25", INTRINSIC, 643.f),
41        GREYSCALE ("Greyscale", RELAXED_FP, 38.3f),
42        GRAIN ("Grain", RELAXED_FP, 57.8f),
43        FISHEYE_FULL ("Fisheye Full", FULL_FP, 211.2f),
44        FISHEYE_RELAXED ("Fisheye Relaxed", RELAXED_FP, 198.1f),
45        FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full", FULL_FP, 211.0f),
46        FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed", RELAXED_FP, 190.1f),
47        VIGNETTE_FULL ("Vignette Full", FULL_FP, 98.6f),
48        VIGNETTE_RELAXED ("Vignette Relaxed", RELAXED_FP, 110.7f),
49        VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full", FULL_FP, 80.6f),
50        VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed", RELAXED_FP, 87.9f),
51        GROUP_TEST_EMULATED ("Group Test (emulated)", INTRINSIC, 37.81f),
52        GROUP_TEST_NATIVE ("Group Test (native)", INTRINSIC, 37.8f),
53        CONVOLVE_3X3 ("Convolve 3x3", RELAXED_FP, 62.1f),
54        INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3", INTRINSIC, 24.5f),
55        COLOR_MATRIX ("ColorMatrix", RELAXED_FP, 25.5f),
56        INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix", INTRINSIC, 13.3f),
57        INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey", INTRINSIC, 13.4f),
58        COPY ("Copy", RELAXED_FP, 25.6f),
59        CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)", INTRINSIC, 18.6f),
60        CONVOLVE_5X5 ("Convolve 5x5", RELAXED_FP, 215.8f),
61        INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5", INTRINSIC, 29.8f),
62        MANDELBROT ("Mandelbrot", FULL_FP, 108.1f),
63        INTRINSICS_BLEND ("Intrinsics Blend", INTRINSIC, 94.2f),
64        INTRINSICS_BLUR_25G ("Intrinsics Blur 25 uchar", INTRINSIC, 173.3f),
65        VIBRANCE ("Vibrance", RELAXED_FP, 88.3f),
66        BW_FILTER ("BW Filter", RELAXED_FP, 69.7f),
67        SHADOWS ("Shadows", RELAXED_FP, 155.3f),
68        CONTRAST ("Contrast", RELAXED_FP, 27.0f),
69        EXPOSURE ("Exposure", RELAXED_FP, 64.7f),
70        WHITE_BALANCE ("White Balance", RELAXED_FP, 160.1f),
71        COLOR_CUBE ("Color Cube", RELAXED_FP, 85.3f),
72        COLOR_CUBE_3D_INTRINSIC ("Color Cube (3D LUT intrinsic)", INTRINSIC, 49.5f);
73
74
75        private final String name;
76        public final int group;
77        public final float baseline;
78
79        private TestName(String s, int g, float base) {
80            name = s;
81            group = g;
82            baseline = base;
83        }
84        private TestName(String s, int g) {
85            name = s;
86            group = g;
87            baseline = 1.f;
88        }
89
90        // return quoted string as displayed test name
91        public String toString() {
92            return name;
93        }
94    }
95
96    static TestBase newTest(TestName testName) {
97        switch(testName) {
98        case LEVELS_VEC3_RELAXED:
99            return new LevelsV4(false, false);
100        case LEVELS_VEC4_RELAXED:
101            return new LevelsV4(false, true);
102        case LEVELS_VEC3_FULL:
103            return new LevelsV4(true, false);
104        case LEVELS_VEC4_FULL:
105            return new LevelsV4(true, true);
106        case BLUR_RADIUS_25:
107            return new Blur25(false);
108        case INTRINSIC_BLUR_RADIUS_25:
109            return new Blur25(true);
110        case GREYSCALE:
111            return new Greyscale();
112        case GRAIN:
113            return new Grain();
114        case FISHEYE_FULL:
115            return new Fisheye(false, false);
116        case FISHEYE_RELAXED:
117            return new Fisheye(false, true);
118        case FISHEYE_APPROXIMATE_FULL:
119            return new Fisheye(true, false);
120        case FISHEYE_APPROXIMATE_RELAXED:
121            return new Fisheye(true, true);
122        case VIGNETTE_FULL:
123            return new Vignette(false, false);
124        case VIGNETTE_RELAXED:
125            return new Vignette(false, true);
126        case VIGNETTE_APPROXIMATE_FULL:
127            return new Vignette(true, false);
128        case VIGNETTE_APPROXIMATE_RELAXED:
129            return new Vignette(true, true);
130        case GROUP_TEST_EMULATED:
131            return new GroupTest(false);
132        case GROUP_TEST_NATIVE:
133            return new GroupTest(true);
134        case CONVOLVE_3X3:
135            return new Convolve3x3(false);
136        case INTRINSICS_CONVOLVE_3X3:
137            return new Convolve3x3(true);
138        case COLOR_MATRIX:
139            return new ColorMatrix(false, false);
140        case INTRINSICS_COLOR_MATRIX:
141            return new ColorMatrix(true, false);
142        case INTRINSICS_COLOR_MATRIX_GREY:
143            return new ColorMatrix(true, true);
144        case COPY:
145            return new Copy();
146        case CROSS_PROCESS_USING_LUT:
147            return new CrossProcess();
148        case CONVOLVE_5X5:
149            return new Convolve5x5(false);
150        case INTRINSICS_CONVOLVE_5X5:
151            return new Convolve5x5(true);
152        case MANDELBROT:
153            return new Mandelbrot();
154        case INTRINSICS_BLEND:
155            return new Blend();
156        case INTRINSICS_BLUR_25G:
157            return new Blur25G();
158        case VIBRANCE:
159            return new Vibrance();
160        case BW_FILTER:
161            return new BWFilter();
162        case SHADOWS:
163            return new Shadows();
164        case CONTRAST:
165            return new Contrast();
166        case EXPOSURE:
167            return new Exposure();
168        case WHITE_BALANCE:
169            return new WhiteBalance();
170        case COLOR_CUBE:
171            return new ColorCube(false);
172        case COLOR_CUBE_3D_INTRINSIC:
173            return new ColorCube(true);
174        }
175        return null;
176    }
177}
178
179