• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Auto-generated file. Do not edit!
2 //   Template: src/f32-ibilinear-chw/scalar.c.in
3 //   Generator: tools/xngen
4 //
5 // Copyright 2020 Google LLC
6 //
7 // This source code is licensed under the BSD-style license found in the
8 // LICENSE file in the root directory of this source tree.
9 
10 #include <assert.h>
11 
12 #include <xnnpack/ibilinear.h>
13 
14 
xnn_f32_ibilinear_chw_ukernel__scalar_p1(size_t output_pixels,size_t channels,const float ** restrict input,size_t input_offset,const float * restrict weights,float * restrict output,size_t input_increment)15 void xnn_f32_ibilinear_chw_ukernel__scalar_p1(
16     size_t output_pixels,
17     size_t channels,
18     const float**restrict input,
19     size_t input_offset,
20     const float*restrict weights,
21     float*restrict output,
22     size_t input_increment)
23 {
24   assert(output_pixels != 0);
25   assert(channels != 0);
26   assert(input_increment % sizeof(float) == 0);
27 
28   size_t c = channels;
29   do {
30     const float** i = input;
31     const float* w = weights;
32 
33     size_t p = output_pixels;
34     do {
35       const float* itl = (const float*) ((uintptr_t) i[0] + input_offset);
36       const float* ibl = (const float*) ((uintptr_t) i[1] + input_offset);
37       i += 2;
38 
39       const float valphah = w[0];
40       const float valphav = w[1];
41       w += 2;
42 
43       const float vtl = itl[0];
44       const float vtr = itl[1];
45       const float vbl = ibl[0];
46       const float vbr = ibl[1];
47 
48       const float vtd = vtr - vtl;
49       const float vbd = vbr - vbl;
50 
51       const float vt = vtl + vtd * valphah;
52       const float vb = vbl + vbd * valphah;
53 
54       const float vd = vb - vt;
55 
56       const float vo = vt + vd * valphav;
57 
58       *output++ = vo;
59     } while (--p != 0);
60 
61     input_offset += input_increment;
62 
63     c--;
64   } while (c != 0);
65 }
66