Line data Source code
1 : /* 2 : * Copyright (c) 2016, Alliance for Open Media. All rights reserved 3 : * 4 : * This source code is subject to the terms of the BSD 2 Clause License and 5 : * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 : * was not distributed with this source code in the LICENSE file, you can 7 : * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 : * Media Patent License 1.0 was not distributed with this source code in the 9 : * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 : */ 11 : 12 : #include <stdlib.h> 13 : #include <stdio.h> 14 : #include <memory.h> 15 : #include <math.h> 16 : #include <assert.h> 17 : 18 : #include <fast.h> 19 : 20 : #include "corner_detect.h" 21 : 22 : // Fast_9 wrapper 23 : #define FAST_BARRIER 18 24 226 : int av1_fast_corner_detect(unsigned char *buf, int width, int height, 25 : int stride, int *points, int max_points) { 26 : int num_points; 27 226 : xy *const frm_corners_xy = aom_fast9_detect_nonmax(buf, width, height, stride, 28 : FAST_BARRIER, &num_points); 29 226 : num_points = (num_points <= max_points ? num_points : max_points); 30 226 : if (num_points > 0 && frm_corners_xy) { 31 226 : memcpy(points, frm_corners_xy, sizeof(*frm_corners_xy) * num_points); 32 226 : free(frm_corners_xy); 33 226 : return num_points; 34 : } 35 0 : free(frm_corners_xy); 36 0 : return 0; 37 : }