-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathImgPlane.cpp
More file actions
63 lines (49 loc) · 1.44 KB
/
ImgPlane.cpp
File metadata and controls
63 lines (49 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <Halide.h>
#include "ImgPlane.h"
#include "ip.h"
// Halide generators
#include "ip_uv.h"
#include "ip_k.h"
#include "ip_v_hat.h"
#include "ip_u_hat.h"
#include "ip_pixel_locs.h"
using namespace std;
using Halide::Runtime::Buffer;
ImgPlane img_plane_create(PlatformData &pd, double res_factor,
const float *_n_hat, double aspect, bool upsample) {
int nu;
int nv;
if (upsample) {
nu = ip_upsample(pd.nsamples);
nv = ip_upsample(pd.npulses);
} else {
nu = pd.nsamples;
nv = pd.npulses;
}
double d_u = ip_du(pd.delta_r, res_factor, pd.nsamples, nu);
double d_v = ip_dv(aspect, d_u);
Buffer<double, 1> u(nu);
ip_uv(nu, d_u, u);
u.set_host_dirty();
Buffer<double, 1> v(nv);
ip_uv(nv, d_v, v);
v.set_host_dirty();
Buffer<double, 1> k_u(nu);
ip_k(nu, d_u, k_u);
k_u.set_host_dirty();
Buffer<double, 1> k_v(nv);
ip_k(nv, d_v, k_v);
k_v.set_host_dirty();
Buffer<const float, 1> n_hat(_n_hat, 3);
n_hat.set_host_dirty();
Buffer<double, 1> v_hat(3);
ip_v_hat(n_hat, pd.R_c, v_hat);
v_hat.set_host_dirty();
Buffer<double, 1> u_hat(3);
ip_u_hat(v_hat, n_hat, u_hat);
u_hat.set_host_dirty();
Buffer<double, 2> pixel_locs(nu*nv, 3);
ip_pixel_locs(u, v, u_hat, v_hat, pixel_locs);
pixel_locs.set_host_dirty();
return ImgPlane(nu, nv, d_u, d_v, u, v, k_u, k_v, u_hat, v_hat, pixel_locs);
}