1/*
2 * Copyright (C) 2011 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
18package android.filterfw.format;
19
20import android.filterfw.core.FrameFormat;
21import android.filterfw.core.MutableFrameFormat;
22
23/**
24 * @hide
25 */
26public class PrimitiveFormat {
27
28    public static MutableFrameFormat createByteFormat(int count, int target) {
29        return createFormat(FrameFormat.TYPE_BYTE, count, target);
30    }
31
32    public static MutableFrameFormat createInt16Format(int count, int target) {
33        return createFormat(FrameFormat.TYPE_INT16, count, target);
34    }
35
36    public static MutableFrameFormat createInt32Format(int count, int target) {
37        return createFormat(FrameFormat.TYPE_INT32, count, target);
38    }
39
40    public static MutableFrameFormat createFloatFormat(int count, int target) {
41        return createFormat(FrameFormat.TYPE_FLOAT, count, target);
42    }
43
44    public static MutableFrameFormat createDoubleFormat(int count, int target) {
45        return createFormat(FrameFormat.TYPE_DOUBLE, count, target);
46    }
47
48    public static MutableFrameFormat createByteFormat(int target) {
49        return createFormat(FrameFormat.TYPE_BYTE, target);
50    }
51
52    public static MutableFrameFormat createInt16Format(int target) {
53        return createFormat(FrameFormat.TYPE_INT16, target);
54    }
55
56    public static MutableFrameFormat createInt32Format(int target) {
57        return createFormat(FrameFormat.TYPE_INT32, target);
58    }
59
60    public static MutableFrameFormat createFloatFormat(int target) {
61        return createFormat(FrameFormat.TYPE_FLOAT, target);
62    }
63
64    public static MutableFrameFormat createDoubleFormat(int target) {
65        return createFormat(FrameFormat.TYPE_DOUBLE, target);
66    }
67
68    private static MutableFrameFormat createFormat(int baseType, int count, int target) {
69        MutableFrameFormat result = new MutableFrameFormat(baseType, target);
70        result.setDimensions(count);
71        return result;
72    }
73
74    private static MutableFrameFormat createFormat(int baseType, int target) {
75        MutableFrameFormat result = new MutableFrameFormat(baseType, target);
76        result.setDimensionCount(1);
77        return result;
78    }
79}
80