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_FLOAT ("Mandelbrot (fp32)", FULL_FP, 108.1f),
63        MANDELBROT_DOUBLE ("Mandelbrot (fp64)", FULL_FP, 108.1f),
64        INTRINSICS_BLEND ("Intrinsics Blend", INTRINSIC, 94.2f),
65        INTRINSICS_BLUR_25G ("Intrinsics Blur 25 uchar", INTRINSIC, 173.3f),
66        VIBRANCE ("Vibrance", RELAXED_FP, 88.3f),
67        BW_FILTER ("BW Filter", RELAXED_FP, 69.7f),
68        SHADOWS ("Shadows", RELAXED_FP, 155.3f),
69        CONTRAST ("Contrast", RELAXED_FP, 27.0f),
70        EXPOSURE ("Exposure", RELAXED_FP, 64.7f),
71        WHITE_BALANCE ("White Balance", RELAXED_FP, 160.1f),
72        COLOR_CUBE ("Color Cube", RELAXED_FP, 85.3f),
73        COLOR_CUBE_3D_INTRINSIC ("Color Cube (3D LUT intrinsic)", INTRINSIC, 49.5f),
74        ARTISTIC1 ("Artistic 1", RELAXED_FP, 120.f),
75        RESIZE_BI_SCRIPT ("Resize BiCubic Script", RELAXED_FP, 100.f),
76        RESIZE_BI_INTRINSIC ("Resize BiCubic Intrinsic", INTRINSIC, 100.f);
77
78
79        private final String name;
80        public final int group;
81        public final float baseline;
82
83        private TestName(String s, int g, float base) {
84            name = s;
85            group = g;
86            baseline = base;
87        }
88        private TestName(String s, int g) {
89            name = s;
90            group = g;
91            baseline = 1.f;
92        }
93
94        // return quoted string as displayed test name
95        public String toString() {
96            return name;
97        }
98    }
99
100    static TestBase newTest(TestName testName) {
101        switch(testName) {
102        case LEVELS_VEC3_RELAXED:
103            return new LevelsV4(false, false);
104        case LEVELS_VEC4_RELAXED:
105            return new LevelsV4(false, true);
106        case LEVELS_VEC3_FULL:
107            return new LevelsV4(true, false);
108        case LEVELS_VEC4_FULL:
109            return new LevelsV4(true, true);
110        case BLUR_RADIUS_25:
111            return new Blur25(false);
112        case INTRINSIC_BLUR_RADIUS_25:
113            return new Blur25(true);
114        case GREYSCALE:
115            return new Greyscale();
116        case GRAIN:
117            return new Grain();
118        case FISHEYE_FULL:
119            return new Fisheye(false, false);
120        case FISHEYE_RELAXED:
121            return new Fisheye(false, true);
122        case FISHEYE_APPROXIMATE_FULL:
123            return new Fisheye(true, false);
124        case FISHEYE_APPROXIMATE_RELAXED:
125            return new Fisheye(true, true);
126        case VIGNETTE_FULL:
127            return new Vignette(false, false);
128        case VIGNETTE_RELAXED:
129            return new Vignette(false, true);
130        case VIGNETTE_APPROXIMATE_FULL:
131            return new Vignette(true, false);
132        case VIGNETTE_APPROXIMATE_RELAXED:
133            return new Vignette(true, true);
134        case GROUP_TEST_EMULATED:
135            return new GroupTest(false);
136        case GROUP_TEST_NATIVE:
137            return new GroupTest(true);
138        case CONVOLVE_3X3:
139            return new Convolve3x3(false);
140        case INTRINSICS_CONVOLVE_3X3:
141            return new Convolve3x3(true);
142        case COLOR_MATRIX:
143            return new ColorMatrix(false, false);
144        case INTRINSICS_COLOR_MATRIX:
145            return new ColorMatrix(true, false);
146        case INTRINSICS_COLOR_MATRIX_GREY:
147            return new ColorMatrix(true, true);
148        case COPY:
149            return new Copy();
150        case CROSS_PROCESS_USING_LUT:
151            return new CrossProcess();
152        case CONVOLVE_5X5:
153            return new Convolve5x5(false);
154        case INTRINSICS_CONVOLVE_5X5:
155            return new Convolve5x5(true);
156        case MANDELBROT_FLOAT:
157            return new Mandelbrot(false);
158        case MANDELBROT_DOUBLE:
159            return new Mandelbrot(true);
160        case INTRINSICS_BLEND:
161            return new Blend();
162        case INTRINSICS_BLUR_25G:
163            return new Blur25G();
164        case VIBRANCE:
165            return new Vibrance();
166        case BW_FILTER:
167            return new BWFilter();
168        case SHADOWS:
169            return new Shadows();
170        case CONTRAST:
171            return new Contrast();
172        case EXPOSURE:
173            return new Exposure();
174        case WHITE_BALANCE:
175            return new WhiteBalance();
176        case COLOR_CUBE:
177            return new ColorCube(false);
178        case COLOR_CUBE_3D_INTRINSIC:
179            return new ColorCube(true);
180        case ARTISTIC1:
181            return new Artistic1();
182        case RESIZE_BI_SCRIPT:
183            return new Resize(false);
184        case RESIZE_BI_INTRINSIC:
185            return new Resize(true);
186        }
187        return null;
188    }
189}
190
191