File: phase_unwrap_impl.h

package info (click to toggle)
gr-satellites 5.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,836 kB
  • sloc: python: 29,546; cpp: 5,448; ansic: 1,247; sh: 118; makefile: 24
file content (49 lines) | stat: -rw-r--r-- 1,119 bytes parent folder | download | duplicates (2)
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
/* -*- c++ -*- */
/*
 * Copyright 2022 Daniel Estevez <daniel@destevez.net>.
 *
 * This file is part of gr-satellites
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#ifndef INCLUDED_SATELLITES_PHASE_UNWRAP_IMPL_H
#define INCLUDED_SATELLITES_PHASE_UNWRAP_IMPL_H

#include <gnuradio/math.h>
#include <satellites/phase_unwrap.h>
#include <cstdint>

namespace gr {
namespace satellites {

class phase_unwrap_impl : public phase_unwrap
{
private:
    int64_t d_integer_cycles;
    float d_last_phase;

    // Implementation taken from gr::block::control_loop but modified to yield
    // values in [0, 2pi).
    inline float phase_wrap(float phase) const
    {
        while (phase > (2 * GR_M_PI))
            phase -= 2 * GR_M_PI;
        while (phase < 0)
            phase += 2 * GR_M_PI;
        return phase;
    }

public:
    phase_unwrap_impl();
    ~phase_unwrap_impl();

    int work(int noutput_items,
             gr_vector_const_void_star& input_items,
             gr_vector_void_star& output_items);
};

} // namespace satellites
} // namespace gr

#endif /* INCLUDED_SATELLITES_PHASE_UNWRAP_IMPL_H */