1*77c1e3ccSAndroid Build Coastguard Worker // Copyright (c) 2006, 2008 Edward Rosten 2*77c1e3ccSAndroid Build Coastguard Worker // All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker // 4*77c1e3ccSAndroid Build Coastguard Worker // Redistribution and use in source and binary forms, with or without 5*77c1e3ccSAndroid Build Coastguard Worker // modification, are permitted provided that the following conditions 6*77c1e3ccSAndroid Build Coastguard Worker // are met: 7*77c1e3ccSAndroid Build Coastguard Worker // 8*77c1e3ccSAndroid Build Coastguard Worker // *Redistributions of source code must retain the above copyright 9*77c1e3ccSAndroid Build Coastguard Worker // notice, this list of conditions and the following disclaimer. 10*77c1e3ccSAndroid Build Coastguard Worker // 11*77c1e3ccSAndroid Build Coastguard Worker // *Redistributions in binary form must reproduce the above copyright 12*77c1e3ccSAndroid Build Coastguard Worker // notice, this list of conditions and the following disclaimer in the 13*77c1e3ccSAndroid Build Coastguard Worker // documentation and/or other materials provided with the distribution. 14*77c1e3ccSAndroid Build Coastguard Worker // 15*77c1e3ccSAndroid Build Coastguard Worker // *Neither the name of the University of Cambridge nor the names of 16*77c1e3ccSAndroid Build Coastguard Worker // its contributors may be used to endorse or promote products derived 17*77c1e3ccSAndroid Build Coastguard Worker // from this software without specific prior written permission. 18*77c1e3ccSAndroid Build Coastguard Worker // 19*77c1e3ccSAndroid Build Coastguard Worker // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20*77c1e3ccSAndroid Build Coastguard Worker // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21*77c1e3ccSAndroid Build Coastguard Worker // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22*77c1e3ccSAndroid Build Coastguard Worker // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 23*77c1e3ccSAndroid Build Coastguard Worker // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24*77c1e3ccSAndroid Build Coastguard Worker // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25*77c1e3ccSAndroid Build Coastguard Worker // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26*77c1e3ccSAndroid Build Coastguard Worker // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27*77c1e3ccSAndroid Build Coastguard Worker // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28*77c1e3ccSAndroid Build Coastguard Worker // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29*77c1e3ccSAndroid Build Coastguard Worker // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30*77c1e3ccSAndroid Build Coastguard Worker 31*77c1e3ccSAndroid Build Coastguard Worker // clang-format off 32*77c1e3ccSAndroid Build Coastguard Worker #ifndef FAST_H 33*77c1e3ccSAndroid Build Coastguard Worker #define FAST_H 34*77c1e3ccSAndroid Build Coastguard Worker 35*77c1e3ccSAndroid Build Coastguard Worker typedef struct { int x, y; } xy; 36*77c1e3ccSAndroid Build Coastguard Worker typedef unsigned char byte; 37*77c1e3ccSAndroid Build Coastguard Worker 38*77c1e3ccSAndroid Build Coastguard Worker int aom_fast9_corner_score(const byte* p, const int pixel[], int bstart); 39*77c1e3ccSAndroid Build Coastguard Worker 40*77c1e3ccSAndroid Build Coastguard Worker // Returns NULL on memory allocation failure. 41*77c1e3ccSAndroid Build Coastguard Worker xy* aom_fast9_detect(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners); 42*77c1e3ccSAndroid Build Coastguard Worker 43*77c1e3ccSAndroid Build Coastguard Worker // If num_corners > 0, returns NULL on memory allocation failure. 44*77c1e3ccSAndroid Build Coastguard Worker int* aom_fast9_score(const byte* i, int stride, const xy* corners, int num_corners, int b); 45*77c1e3ccSAndroid Build Coastguard Worker 46*77c1e3ccSAndroid Build Coastguard Worker // Sets *ret_num_corners to -1 (and returns NULL) on memory allocation failure. 47*77c1e3ccSAndroid Build Coastguard Worker // Sets *ret_num_corners to 0 if nothing went wrong but no corners were found. 48*77c1e3ccSAndroid Build Coastguard Worker xy* aom_fast9_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, 49*77c1e3ccSAndroid Build Coastguard Worker int** ret_scores, int* ret_num_corners); 50*77c1e3ccSAndroid Build Coastguard Worker 51*77c1e3ccSAndroid Build Coastguard Worker xy* aom_nonmax_suppression(const xy* corners, const int* scores, int num_corners, 52*77c1e3ccSAndroid Build Coastguard Worker int** ret_scores, int* ret_num_nonmax); 53*77c1e3ccSAndroid Build Coastguard Worker 54*77c1e3ccSAndroid Build Coastguard Worker 55*77c1e3ccSAndroid Build Coastguard Worker #endif 56*77c1e3ccSAndroid Build Coastguard Worker // clang-format on 57