1 // Auto-generated file. Do not edit!
2 // Template: src/f32-ibilinear/scalar.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2019 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_ukernel__scalar_c2(size_t output_pixels,size_t channels,const float ** restrict input,size_t input_offset,const float * restrict weights,float * restrict output,size_t output_increment)15 void xnn_f32_ibilinear_ukernel__scalar_c2(
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 output_increment)
23 {
24 assert(output_pixels != 0);
25 assert(channels != 0);
26 assert(channels % sizeof(float) == 0);
27
28 do {
29 const float* i0 = (const float*) ((uintptr_t) input[0] + input_offset);
30 const float* i1 = (const float*) ((uintptr_t) input[1] + input_offset);
31 const float* i2 = (const float*) ((uintptr_t) input[2] + input_offset);
32 const float* i3 = (const float*) ((uintptr_t) input[3] + input_offset);
33 input += 4;
34
35 const float valphah = weights[0];
36 const float valphav = weights[1];
37 weights += 2;
38
39 size_t c = channels;
40 for (; c >= 2 * sizeof(float); c -= 2 * sizeof(float)) {
41 const float vtl0 = i0[0];
42 const float vtr0 = i1[0];
43 const float vbl0 = i2[0];
44 const float vbr0 = i3[0];
45 const float vtl1 = i0[1];
46 const float vtr1 = i1[1];
47 const float vbl1 = i2[1];
48 const float vbr1 = i3[1];
49 i0 += 2;
50 i1 += 2;
51 i2 += 2;
52 i3 += 2;
53
54 const float vtd0 = vtr0 - vtl0;
55 const float vbd0 = vbr0 - vbl0;
56 const float vtd1 = vtr1 - vtl1;
57 const float vbd1 = vbr1 - vbl1;
58
59 const float vt0 = vtl0 + vtd0 * valphah;
60 const float vb0 = vbl0 + vbd0 * valphah;
61 const float vt1 = vtl1 + vtd1 * valphah;
62 const float vb1 = vbl1 + vbd1 * valphah;
63
64 const float vd0 = vb0 - vt0;
65 const float vd1 = vb1 - vt1;
66
67 const float vo0 = vt0 + vd0 * valphav;
68 const float vo1 = vt1 + vd1 * valphav;
69
70 output[0] = vo0;
71 output[1] = vo1;
72 output += 2;
73 }
74 for (; c >= sizeof(float); c -= sizeof(float)) {
75 const float vtl = *i0++;
76 const float vtr = *i1++;
77 const float vbl = *i2++;
78 const float vbr = *i3++;
79
80 const float vtd = vtr - vtl;
81 const float vbd = vbr - vbl;
82
83 const float vt = vtl + vtd * valphah;
84 const float vb = vbl + vbd * valphah;
85
86 const float vd = vb - vt;
87
88 const float vo = vt + vd * valphav;
89
90 *output++ = vo;
91 }
92
93 output = (float*) ((uintptr_t) output + output_increment);
94 } while (--output_pixels != 0);
95 }
96