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