This file is indexed.

/usr/include/pdal/io/BpfHeader.hpp is in libpdal-dev 1.4.0-1+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
/******************************************************************************
* Copyright (c) 2014, Howard Butler, hobu.inc@gmail.com
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
*     * Redistributions of source code must retain the above copyright
*       notice, this list of conditions and the following disclaimer.
*     * Redistributions in binary form must reproduce the above copyright
*       notice, this list of conditions and the following disclaimer in
*       the documentation and/or other materials provided
*       with the distribution.
*     * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the
*       names of its contributors may be used to endorse or promote
*       products derived from this software without specific prior
*       written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
****************************************************************************/

#pragma once

#include <stdint.h>
#include <string>
#include <vector>

#include <pdal/Dimension.hpp>
#include <pdal/Log.hpp>
#include <pdal/Metadata.hpp>

namespace pdal
{

class ILeStream;
class OLeStream;

struct BpfMuellerMatrix
{
    BpfMuellerMatrix()
    {
        static const double vals[] = {1.0, 0.0, 0.0, 0.0,
                         0.0, 1.0, 0.0, 0.0,
                         0.0, 0.0, 1.0, 0.0,
                         0.0, 0.0, 0.0, 1.0};
        memcpy(m_vals, vals, sizeof(vals));
    }

    double m_vals[16];

    void dump()
    {
        for (size_t i = 0; i < 4; ++i)
            std::cerr << m_vals[i] << '\t';
        std::cerr << "\n";
        for (size_t i = 4; i < 8; ++i)
            std::cerr << m_vals[i] << '\t';
        std::cerr << "\n";
        for (size_t i = 8; i < 12; ++i)
            std::cerr << m_vals[i] << '\t';
        std::cerr << "\n";
        for (size_t i = 12; i < 16; ++i)
            std::cerr << m_vals[i] << '\t';
        std::cerr << "\n\n";

    }

    void apply(double& x, double& y, double& z)
    {
        double w = x * m_vals[12] + y * m_vals[13] + z * m_vals[14] +
            m_vals[15];

        x = (x * m_vals[0] + y * m_vals[1] + z * m_vals[2] + m_vals[3]) / w;
        y = (x * m_vals[4] + y * m_vals[5] + z * m_vals[6] + m_vals[7]) / w;
        z = (x * m_vals[8] + y * m_vals[9] + z * m_vals[10] + m_vals[11]) / w;
    }
};
ILeStream& operator >> (ILeStream& stream, BpfMuellerMatrix& m);
OLeStream& operator << (OLeStream& stream, BpfMuellerMatrix& m);

enum class BpfFormat
{
    DimMajor,
    PointMajor,
    ByteMajor
};

std::istream& operator >> (std::istream& in, BpfFormat& format);
std::ostream& operator << (std::ostream& in, const BpfFormat& format);

enum class BpfCoordType
{
    Cartesian,
    UTM,
    TCR,
    ENU
};

enum class BpfCompression
{
    None,
    QuickLZ,
    FastLZ,
    Zlib
};

struct BpfDimension
{
    BpfDimension() : m_offset(0.0),
        m_min((std::numeric_limits<double>::max)()),
        m_max(std::numeric_limits<double>::lowest()),
        m_id(Dimension::Id::Unknown)
    {}

    double m_offset;
    double m_min;
    double m_max;
    std::string m_label;
    Dimension::Id m_id;

    static bool read(ILeStream& stream, std::vector<BpfDimension>& dims,
        size_t start);
    static bool write(OLeStream& stream, std::vector<BpfDimension>& dims);
};
typedef std::vector<BpfDimension> BpfDimensionList;

struct BpfHeader
{
    BpfHeader() : m_version(0), m_len(176), m_numDim(0),
        m_compression(Utils::toNative(BpfCompression::None)), m_numPts(0),
        m_coordType(Utils::toNative(BpfCoordType::Cartesian)), m_coordId(0),
        m_spacing(0.0), m_startTime(0.0), m_endTime(0.0)
    {}

    int32_t m_version;
    std::string m_ver;
    int32_t m_len;
    int32_t m_numDim;
    BpfFormat m_pointFormat;
    uint8_t m_compression;
    int32_t m_numPts;
    int32_t m_coordType;
    int32_t m_coordId;
    float m_spacing;
    BpfMuellerMatrix m_xform;
    double m_startTime;
    double m_endTime;
    std::vector<BpfDimension> m_staticDims;
    LogPtr m_log;

    PDAL_DLL void setLog(const LogPtr& log)
         { m_log = log; }
    PDAL_DLL bool read(ILeStream& stream);
    bool write(OLeStream& stream);
    bool readV3(ILeStream& stream);
    bool readV1(ILeStream& stream);
    PDAL_DLL bool readDimensions(ILeStream& stream,
        std::vector<BpfDimension>& dims);
    void writeDimensions(OLeStream& stream, std::vector<BpfDimension>& dims);
    void dump();
};

struct BpfUlemHeader
{
    uint32_t m_numFrames;
    uint16_t m_year;
    uint8_t m_month;
    uint8_t m_day;
    uint16_t m_lidarMode;
    uint16_t m_wavelen;  // In nm.
    uint16_t m_pulseFreq;  // In Hz.
    uint16_t m_focalWidth;
    uint16_t m_focalHeight;
    float m_pixelPitchWidth;
    float m_pixelPitchHeight;
    std::string m_classCode;

    bool read(ILeStream& stream);
};

struct BpfUlemFrame
{
    int32_t m_num;
    double m_roll; //x
    double m_pitch; //y
    double m_heading; //z
    BpfMuellerMatrix m_xform;
    int16_t m_shortEncoder;
    int16_t m_longEncoder;

    bool read(ILeStream& stream);
};

struct BpfUlemFile
{
    uint32_t m_len;
    std::string m_filename;
    std::vector<char> m_buf;
    std::string m_filespec;

    BpfUlemFile() : m_len(0)
    {}

    BpfUlemFile(uint32_t len, const std::string& filename,
            const std::string& filespec) :
        m_len(len), m_filename(filename), m_filespec(filespec)
    {}

    bool read(ILeStream& stream);
    bool write(OLeStream& stream);
};

struct BpfPolarStokesParam
{
    float m_x;
    float m_y;
    float m_z;
    float m_a;

    bool read(ILeStream& stream);
};

struct BpfPolarHeader
{
    uint32_t m_numFrames;
    uint16_t m_fpaId;
    uint32_t m_numXmit;
    uint32_t m_numRcv;
    std::vector<BpfPolarStokesParam> m_xmitStates;
    std::vector<BpfMuellerMatrix> m_psaSettings;

    bool read(ILeStream& stream);
};

struct BpfPolarFrame
{
public:
    uint32_t m_num;
    int16_t m_stokesIdx;
    float m_stokesParam[4];
    float m_stokesOutParam[4];
    BpfMuellerMatrix m_xform;
    int16_t m_truncation;

    bool read(ILeStream& stream);
};

} //namespace pdal