-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathraw_buffer.h
More file actions
36 lines (27 loc) · 973 Bytes
/
Copy pathraw_buffer.h
File metadata and controls
36 lines (27 loc) · 973 Bytes
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
#pragma once
using namespace std;
/*
The RawBuffer stores data from a raw file in pinned memory.
Its format is row-major:
input[block][antenna][coarse-channel][time-within-block][polarization][real or imag]
*/
class RawBuffer {
public:
const int num_blocks;
const int num_antennas;
const int num_coarse_channels;
const int timesteps_per_block;
const int npol;
int8_t* data;
size_t size;
RawBuffer(int num_blocks, int num_antennas, int num_coarse_channels,
int timesteps_per_block, int npol);
~RawBuffer();
// Returns a pointer to where data for the given block should start
char* blockPointer(int block) const;
void set(int block, int antenna, int coarse_channel,
int timestep, int pol, bool imag, int8_t value);
};
// Helper function to determine memory size needed
size_t rawBufferSize(int num_blocks, int num_antennas, int num_coarse_channels,
int timesteps_per_block, int npol);