blob: eda972d4e2328b42283b7e1b32353a1caa9d6f54 [file] [log] [blame]
The Android Open Source Project30957f52008-10-21 07:00:00 -07001/*
2 * Copyright (C) 2008 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#ifndef bbf_FUNCTIONS_EM_H
18#define bbf_FUNCTIONS_EM_H
19
20/**
21 * This files contains gerneral purpose functions.
22 */
23
24/* ---- includes ----------------------------------------------------------- */
25
26#include "b_BasicEm/Context.h"
27#include "b_TensorEm/Int16Rect.h"
28#include "b_ImageEm/UInt32Image.h"
29#include "b_ImageEm/UInt16ByteImage.h"
30
31/* ---- related objects --------------------------------------------------- */
32
33/* ---- typedefs ----------------------------------------------------------- */
34
35/* ---- constants ---------------------------------------------------------- */
36
37/** table to quickly determine the number of set bits in an 8 bit variable */
38extern const uint16 bbf_bit8TblG[ 256 ];
39
40/* ---- external functions ------------------------------------------------- */
41
42/** sums up bits in 8 bit variable */
43#define bbf_BIT_SUM_8( vA ) ( bbf_bit8TblG[ vA ] )
44
45/** sums up bits in 16 bit variable */
46#define bbf_BIT_SUM_16( vA ) ( bbf_bit8TblG[ vA & 0x00FF ] + bbf_bit8TblG[ ( vA >> 8 ) & 0x00FF ] )
47
48/** sums up bits in 16 bit variable */
49#define bbf_BIT_SUM_32( vA ) ( bbf_bit8TblG[ vA & 0x00FF ] + bbf_bit8TblG[ ( vA >> 8 ) & 0x00FF ] + bbf_bit8TblG[ ( vA >> 16 ) & 0x00FF ] + bbf_bit8TblG[ ( vA >> 24 ) & 0x00FF ] )
50
51
52#endif /* bbf_FUNCTIONS_EM_H */
53