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, 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        HISTOGRAM_SCRIPT ("Histogram script", RELAXED_FP, 20.f),
80        HISTOGRAM_INTRINSIC ("Histogram intrinsic", INTRINSIC, 18.f);
81
82
83        private final String name;
84        public final int group;
85        public final float baseline;
86
87        private TestName(String s, int g, float base) {
88            name = s;
89            group = g;
90            baseline = base;
91        }
92        private TestName(String s, int g) {
93            name = s;
94            group = g;
95            baseline = 1.f;
96        }
97
98        // return quoted string as displayed test name
99        public String toString() {
100            return name;
101        }
102    }
103
104    static TestBase newTest(TestName testName) {
105        switch(testName) {
106        case LEVELS_VEC3_RELAXED:
107            return new LevelsV4(false, false);
108        case LEVELS_VEC4_RELAXED:
109            return new LevelsV4(false, true);
110        case LEVELS_VEC3_FULL:
111            return new LevelsV4(true, false);
112        case LEVELS_VEC4_FULL:
113            return new LevelsV4(true, true);
114        case BLUR_RADIUS_25:
115            return new Blur25(false);
116        case INTRINSIC_BLUR_RADIUS_25:
117            return new Blur25(true);
118        case GREYSCALE:
119            return new Greyscale();
120        case GRAIN:
121            return new Grain();
122        case FISHEYE_FULL:
123            return new Fisheye(false, false);
124        case FISHEYE_RELAXED:
125            return new Fisheye(false, true);
126        case FISHEYE_APPROXIMATE_FULL:
127            return new Fisheye(true, false);
128        case FISHEYE_APPROXIMATE_RELAXED:
129            return new Fisheye(true, true);
130        case VIGNETTE_FULL:
131            return new Vignette(false, false);
132        case VIGNETTE_RELAXED:
133            return new Vignette(false, true);
134        case VIGNETTE_APPROXIMATE_FULL:
135            return new Vignette(true, false);
136        case VIGNETTE_APPROXIMATE_RELAXED:
137            return new Vignette(true, true);
138        case GROUP_TEST_EMULATED:
139            return new GroupTest(false);
140        case GROUP_TEST_NATIVE:
141            return new GroupTest(true);
142        case CONVOLVE_3X3:
143            return new Convolve3x3(false);
144        case INTRINSICS_CONVOLVE_3X3:
145            return new Convolve3x3(true);
146        case COLOR_MATRIX:
147            return new ColorMatrix(false, false);
148        case INTRINSICS_COLOR_MATRIX:
149            return new ColorMatrix(true, false);
150        case INTRINSICS_COLOR_MATRIX_GREY:
151            return new ColorMatrix(true, true);
152        case COPY:
153            return new Copy();
154        case CROSS_PROCESS_USING_LUT:
155            return new CrossProcess();
156        case CONVOLVE_5X5:
157            return new Convolve5x5(false);
158        case INTRINSICS_CONVOLVE_5X5:
159            return new Convolve5x5(true);
160        case MANDELBROT_FLOAT:
161            return new Mandelbrot(false);
162        case MANDELBROT_DOUBLE:
163            return new Mandelbrot(true);
164        case INTRINSICS_BLEND:
165            return new Blend();
166        case INTRINSICS_BLUR_25G:
167            return new Blur25G();
168        case VIBRANCE:
169            return new Vibrance();
170        case BW_FILTER:
171            return new BWFilter();
172        case SHADOWS:
173            return new Shadows();
174        case CONTRAST:
175            return new Contrast();
176        case EXPOSURE:
177            return new Exposure();
178        case WHITE_BALANCE:
179            return new WhiteBalance();
180        case COLOR_CUBE:
181            return new ColorCube(false);
182        case COLOR_CUBE_3D_INTRINSIC:
183            return new ColorCube(true);
184        case ARTISTIC1:
185            return new Artistic1();
186        case RESIZE_BI_SCRIPT:
187            return new Resize(false);
188        case RESIZE_BI_INTRINSIC:
189            return new Resize(true);
190        case POSTERIZE_INVOKE:
191            return new Posterize(true);
192        case POSTERIZE_SET:
193            return new Posterize(false);
194        case HISTOGRAM_SCRIPT:
195            return new Histogram(false);
196        case HISTOGRAM_INTRINSIC:
197            return new Histogram(true);
198        }
199        return null;
200    }
201}
202
203