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 "third_party/fastfeat/fast.h"
19 :
20 : #include "av1/encoder/corner_detect.h"
21 :
22 : // Fast_9 wrapper
23 : #define FAST_BARRIER 18
24 0 : int fast_corner_detect(unsigned char *buf, int width, int height, int stride,
25 : int *points, int max_points) {
26 : int num_points;
27 0 : xy *const frm_corners_xy = fast9_detect_nonmax(buf, width, height, stride,
28 : FAST_BARRIER, &num_points);
29 0 : num_points = (num_points <= max_points ? num_points : max_points);
30 0 : if (num_points > 0 && frm_corners_xy) {
31 0 : memcpy(points, frm_corners_xy, sizeof(*frm_corners_xy) * num_points);
32 0 : free(frm_corners_xy);
33 0 : return num_points;
34 : }
35 0 : free(frm_corners_xy);
36 0 : return 0;
37 : }
|