Project Ne10
An Open Optimized Software Library Project for the ARM Architecture
NE10_init_imgproc.c
1 /*
2  * Copyright 2013-15 ARM Limited and Contributors.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of ARM Limited nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY ARM LIMITED AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED AND CONTRIBUTORS BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include <stdio.h>
29 
30 #include "NE10_imgproc.h"
31 
32 ne10_result_t ne10_init_imgproc (ne10_int32_t is_NEON_available)
33 {
34  if (NE10_OK == is_NEON_available)
35  {
36  ne10_img_resize_bilinear_rgba = ne10_img_resize_bilinear_rgba_neon;
37 
38 #ifdef ENABLE_NE10_IMG_ROTATE_RGBA_NEON
39  ne10_img_rotate_rgba = ne10_img_rotate_rgba_neon;
40 #else
41  ne10_img_rotate_rgba = ne10_img_rotate_rgba_c;
42 #endif
43  ne10_img_boxfilter_rgba8888 = ne10_img_boxfilter_rgba8888_neon;
44  }
45  else
46  {
47  ne10_img_resize_bilinear_rgba = ne10_img_resize_bilinear_rgba_c;
48  ne10_img_rotate_rgba = ne10_img_rotate_rgba_c;
49  ne10_img_boxfilter_rgba8888 = ne10_img_boxfilter_rgba8888_c;
50  }
51  return NE10_OK;
52 }
53 
54 // These are actual definitions of our function pointers that are declared in inc/NE10_imgproc.h
55 void (*ne10_img_resize_bilinear_rgba) (ne10_uint8_t* dst,
56  ne10_uint32_t dst_width,
57  ne10_uint32_t dst_height,
58  ne10_uint8_t* src,
59  ne10_uint32_t src_width,
60  ne10_uint32_t src_height,
61  ne10_uint32_t src_stride);
62 void (*ne10_img_rotate_rgba) (ne10_uint8_t* dst,
63  ne10_uint32_t* dst_width,
64  ne10_uint32_t* dst_height,
65  ne10_uint8_t* src,
66  ne10_uint32_t src_width,
67  ne10_uint32_t src_height,
68  ne10_int32_t angle);
69 void (*ne10_img_boxfilter_rgba8888) (const ne10_uint8_t *src,
70  ne10_uint8_t *dst,
71  ne10_size_t src_size,
72  ne10_int32_t src_stride,
73  ne10_int32_t dst_stride,
74  ne10_size_t kernel_size);
void ne10_img_boxfilter_rgba8888_neon(const ne10_uint8_t *src, ne10_uint8_t *dst, ne10_size_t src_size, ne10_int32_t src_stride, ne10_int32_t dst_stride, ne10_size_t kernel_size)
neon optimized box filter
void ne10_img_boxfilter_rgba8888_c(const ne10_uint8_t *src, ne10_uint8_t *dst, ne10_size_t src_size, ne10_int32_t src_stride, ne10_int32_t dst_stride, ne10_size_t kernel_size)
box filter
void ne10_img_resize_bilinear_rgba_neon(ne10_uint8_t *dst, ne10_uint32_t dst_width, ne10_uint32_t dst_height, ne10_uint8_t *src, ne10_uint32_t src_width, ne10_uint32_t src_height, ne10_uint32_t src_stride) asm("ne10_img_resize_bilinear_rgba_neon")
image resize of 8-bit data.
Definition: NE10_resize.c:508
void ne10_img_resize_bilinear_rgba_c(ne10_uint8_t *dst, ne10_uint32_t dst_width, ne10_uint32_t dst_height, ne10_uint8_t *src, ne10_uint32_t src_width, ne10_uint32_t src_height, ne10_uint32_t src_stride)
image resize of 8-bit data.
Definition: NE10_resize.c:367
void ne10_img_rotate_rgba_c(ne10_uint8_t *dst, ne10_uint32_t *dst_width, ne10_uint32_t *dst_height, ne10_uint8_t *src, ne10_uint32_t src_width, ne10_uint32_t src_height, ne10_int32_t angle)
image resize of 8-bit data.
Definition: NE10_rotate.c:231