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.image2;
18
19import android.app.Activity;
20import android.view.View;
21import android.util.Log;
22
23public class IPTestList {
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, 61.1f),
36        LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed", RELAXED_FP, 44.6f),
37        LEVELS_VEC3_FULL ("Levels Vec3 Full", FULL_FP, 61.9f),
38        LEVELS_VEC4_FULL ("Levels Vec4 Full", FULL_FP, 73.f),
39        BLUR_RADIUS_25 ("Blur radius 25", RELAXED_FP, 1103.f),
40        INTRINSIC_BLUR_RADIUS_25 ("Intrinsic Blur radius 25", INTRINSIC, 176.f),
41        GREYSCALE ("Greyscale", RELAXED_FP, 43.7f),
42        GRAIN ("Grain", RELAXED_FP, 147.4f),
43        FISHEYE_FULL ("Fisheye Full", FULL_FP, 192.f),
44        FISHEYE_RELAXED ("Fisheye Relaxed", RELAXED_FP, 181.f),
45        FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full", FULL_FP, 193.f),
46        FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed", RELAXED_FP, 183.f),
47        VIGNETTE_FULL ("Vignette Full", FULL_FP, 101.f),
48        VIGNETTE_RELAXED ("Vignette Relaxed", RELAXED_FP, 116.f),
49        VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full", FULL_FP, 85.1f),
50        VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed", RELAXED_FP, 96.7f),
51        GROUP_TEST_EMULATED ("Group Test (emulated)", INTRINSIC, 51.7f),
52        GROUP_TEST_NATIVE ("Group Test (native)", INTRINSIC, 52.9f),
53        CONVOLVE_3X3 ("Convolve 3x3", RELAXED_FP, 74.2f),
54        INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3", INTRINSIC, 33.3f),
55        COLOR_MATRIX ("ColorMatrix", RELAXED_FP, 33.8f),
56        INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix", INTRINSIC, 21.3f),
57        INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey", INTRINSIC, 21.4f),
58        COPY ("Copy", RELAXED_FP, 21.4f),
59        CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)", INTRINSIC, 23.1f),
60        CONVOLVE_5X5 ("Convolve 5x5", RELAXED_FP, 236.f),
61        INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5", INTRINSIC, 39.6f),
62        MANDELBROT_FLOAT ("Mandelbrot (fp32)", FULL_FP, 117.f),
63        MANDELBROT_DOUBLE ("Mandelbrot (fp64)", FULL_FP, 136.f),
64        INTRINSICS_BLEND ("Intrinsics Blend", INTRINSIC, 105.f),
65        INTRINSICS_BLUR_25G ("Intrinsics Blur 25 uchar", INTRINSIC, 37.8f),
66        VIBRANCE ("Vibrance", RELAXED_FP, 103.f),
67        BW_FILTER ("BW Filter", RELAXED_FP, 86.f),
68        SHADOWS ("Shadows", RELAXED_FP, 130.f),
69        CONTRAST ("Contrast", RELAXED_FP, 45.4f),
70        EXPOSURE ("Exposure", RELAXED_FP, 73.4f),
71        WHITE_BALANCE ("White Balance", RELAXED_FP, 138.2f),
72        COLOR_CUBE ("Color Cube", RELAXED_FP, 83.9f),
73        COLOR_CUBE_3D_INTRINSIC ("Color Cube (3D LUT intrinsic)", INTRINSIC, 34.7f),
74        ARTISTIC1 ("Artistic 1", RELAXED_FP, 140.f),
75        RESIZE_BI_SCRIPT ("Resize BiCubic Script", RELAXED_FP, 253.f),
76        RESIZE_BI_INTRINSIC ("Resize BiCubic Intrinsic", INTRINSIC, 255.f),
77        POSTERIZE_INVOKE ("Posterize with invoke", RELAXED_FP, 215.f),
78        POSTERIZE_SET ("Posterize with set", INTRINSIC, 221.f);
79
80
81        private final String name;
82        public final int group;
83        public final float baseline;
84
85        private TestName(String s, int g, float base) {
86            name = s;
87            group = g;
88            baseline = base;
89        }
90        private TestName(String s, int g) {
91            name = s;
92            group = g;
93            baseline = 1.f;
94        }
95
96        // return quoted string as displayed test name
97        public String toString() {
98            return name;
99        }
100    }
101
102    static TestBase newTest(TestName testName) {
103        switch(testName) {
104        case LEVELS_VEC3_RELAXED:
105            return new LevelsV4(false, false);
106        case LEVELS_VEC4_RELAXED:
107            return new LevelsV4(false, true);
108        case LEVELS_VEC3_FULL:
109            return new LevelsV4(true, false);
110        case LEVELS_VEC4_FULL:
111            return new LevelsV4(true, true);
112        case BLUR_RADIUS_25:
113            return new Blur25(false);
114        case INTRINSIC_BLUR_RADIUS_25:
115            return new Blur25(true);
116        case GREYSCALE:
117            return new Greyscale();
118        case GRAIN:
119            return new Grain();
120        case FISHEYE_FULL:
121            return new Fisheye(false, false);
122        case FISHEYE_RELAXED:
123            return new Fisheye(false, true);
124        case FISHEYE_APPROXIMATE_FULL:
125            return new Fisheye(true, false);
126        case FISHEYE_APPROXIMATE_RELAXED:
127            return new Fisheye(true, true);
128        case VIGNETTE_FULL:
129            return new Vignette(false, false);
130        case VIGNETTE_RELAXED:
131            return new Vignette(false, true);
132        case VIGNETTE_APPROXIMATE_FULL:
133            return new Vignette(true, false);
134        case VIGNETTE_APPROXIMATE_RELAXED:
135            return new Vignette(true, true);
136        case GROUP_TEST_EMULATED:
137            return new GroupTest(false);
138        case GROUP_TEST_NATIVE:
139            return new GroupTest(true);
140        case CONVOLVE_3X3:
141            return new Convolve3x3(false);
142        case INTRINSICS_CONVOLVE_3X3:
143            return new Convolve3x3(true);
144        case COLOR_MATRIX:
145            return new ColorMatrix(false, false);
146        case INTRINSICS_COLOR_MATRIX:
147            return new ColorMatrix(true, false);
148        case INTRINSICS_COLOR_MATRIX_GREY:
149            return new ColorMatrix(true, true);
150        case COPY:
151            return new Copy();
152        case CROSS_PROCESS_USING_LUT:
153            return new CrossProcess();
154        case CONVOLVE_5X5:
155            return new Convolve5x5(false);
156        case INTRINSICS_CONVOLVE_5X5:
157            return new Convolve5x5(true);
158        case MANDELBROT_FLOAT:
159            return new Mandelbrot(false);
160        case MANDELBROT_DOUBLE:
161            return new Mandelbrot(true);
162        case INTRINSICS_BLEND:
163            return new Blend();
164        case INTRINSICS_BLUR_25G:
165            return new Blur25G();
166        case VIBRANCE:
167            return new Vibrance();
168        case BW_FILTER:
169            return new BWFilter();
170        case SHADOWS:
171            return new Shadows();
172        case CONTRAST:
173            return new Contrast();
174        case EXPOSURE:
175            return new Exposure();
176        case WHITE_BALANCE:
177            return new WhiteBalance();
178        case COLOR_CUBE:
179            return new ColorCube(false);
180        case COLOR_CUBE_3D_INTRINSIC:
181            return new ColorCube(true);
182        case ARTISTIC1:
183            return new Artistic1();
184        case RESIZE_BI_SCRIPT:
185            return new Resize(false);
186        case RESIZE_BI_INTRINSIC:
187            return new Resize(true);
188        case POSTERIZE_INVOKE:
189            return new Posterize(true);
190        case POSTERIZE_SET:
191            return new Posterize(false);
192        }
193        return null;
194    }
195}
196
197