parent
76408c992f
commit
7acc0696af
|
@ -51,6 +51,7 @@ list(APPEND enabled_blocks
|
||||||
satnogs_waterfall_sink.block.yml
|
satnogs_waterfall_sink.block.yml
|
||||||
satnogs_whitening_ccsds.block.yml
|
satnogs_whitening_ccsds.block.yml
|
||||||
satnogs_whitening.block.yml
|
satnogs_whitening.block.yml
|
||||||
|
satnogs_sstv_pd120_sink.block.yml
|
||||||
satnogs.tree.yml
|
satnogs.tree.yml
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
- satnogs_waterfall_sink
|
- satnogs_waterfall_sink
|
||||||
- satnogs_whitening_ccsds
|
- satnogs_whitening_ccsds
|
||||||
- satnogs_whitening
|
- satnogs_whitening
|
||||||
|
- satnogs_sstv_pd120_sink
|
||||||
- Debug:
|
- Debug:
|
||||||
- satnogs_cw_encoder
|
- satnogs_cw_encoder
|
||||||
- satnogs_cw_to_symbol
|
- satnogs_cw_to_symbol
|
||||||
|
@ -34,4 +35,3 @@
|
||||||
- satnogs_debug_msg_source
|
- satnogs_debug_msg_source
|
||||||
- satnogs_morse_debug_source
|
- satnogs_morse_debug_source
|
||||||
- satnogs_multi_format_msg_sink
|
- satnogs_multi_format_msg_sink
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
id: satnogs_sstv_pd120_sink
|
||||||
|
label: SSTV PD120 sink
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
- id: filename_png
|
||||||
|
label: Output PNG Filename
|
||||||
|
dtype: file_save
|
||||||
|
|
||||||
|
- id: split
|
||||||
|
label: Flip Image
|
||||||
|
dtype: bool
|
||||||
|
default: False
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
- label: in
|
||||||
|
domain: stream
|
||||||
|
dtype: float
|
||||||
|
|
||||||
|
templates:
|
||||||
|
imports: import satnogs
|
||||||
|
make: satnogs.sstv_pd120_sink(${filename_png}, ${split})
|
||||||
|
|
||||||
|
file_format: 1
|
|
@ -24,7 +24,7 @@
|
||||||
add_subdirectory(libfec)
|
add_subdirectory(libfec)
|
||||||
|
|
||||||
list(APPEND DEBUG_HEADER_FILES
|
list(APPEND DEBUG_HEADER_FILES
|
||||||
cw_encoder.h
|
cw_encoder.h
|
||||||
debug_msg_source_raw.h
|
debug_msg_source_raw.h
|
||||||
debug_msg_source.h
|
debug_msg_source.h
|
||||||
morse_debug_source.h
|
morse_debug_source.h
|
||||||
|
@ -73,6 +73,7 @@ list(APPEND HEADER_FILES
|
||||||
utils.h
|
utils.h
|
||||||
waterfall_sink.h
|
waterfall_sink.h
|
||||||
whitening.h
|
whitening.h
|
||||||
|
sstv_pd120_sink.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${INCLUDE_DEBUG_BLOCKS})
|
if(${INCLUDE_DEBUG_BLOCKS})
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/*
|
||||||
|
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017, Libre Space Foundation <http://librespacefoundation.org/>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_SATNOGS_SSTV_PD120_SINK_H
|
||||||
|
#define INCLUDED_SATNOGS_SSTV_PD120_SINK_H
|
||||||
|
|
||||||
|
#include <satnogs/api.h>
|
||||||
|
#include <gnuradio/sync_block.h>
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace satnogs {
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief <+description of block+>
|
||||||
|
* \ingroup satnogs
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class SATNOGS_API sstv_pd120_sink : virtual public gr::sync_block
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef boost::shared_ptr<sstv_pd120_sink> sptr;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return a shared_ptr to a new instance of satnogs::sstv_pd120_sink.
|
||||||
|
*
|
||||||
|
* To avoid accidental use of raw pointers, satnogs::sstv_pd120_sink's
|
||||||
|
* constructor is in a private implementation
|
||||||
|
* class. satnogs::sstv_pd120_sink::make is the public interface for
|
||||||
|
* creating new instances.
|
||||||
|
*/
|
||||||
|
static sptr make(const char *filename_png, bool split);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace satnogs
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_SATNOGS_SSTV_PD120_SINK_H */
|
|
@ -65,6 +65,7 @@ list(APPEND satnogs_sources
|
||||||
udp_msg_source_impl.cc
|
udp_msg_source_impl.cc
|
||||||
waterfall_sink_impl.cc
|
waterfall_sink_impl.cc
|
||||||
whitening.cc
|
whitening.cc
|
||||||
|
sstv_pd120_sink_impl.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${INCLUDE_DEBUG_BLOCKS})
|
if(${INCLUDE_DEBUG_BLOCKS})
|
||||||
|
@ -147,4 +148,3 @@ foreach(qa_file ${test_satnogs_sources})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
|
${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
|
||||||
)
|
)
|
||||||
endforeach(qa_file)
|
endforeach(qa_file)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/*
|
||||||
|
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018, Libre Space Foundation <http://librespacefoundation.org/>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include "sstv_pd120_sink_impl.h"
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace satnogs {
|
||||||
|
|
||||||
|
const size_t image_width = 640;
|
||||||
|
const size_t sync_length = 105;
|
||||||
|
const size_t sync_thresh = 100;
|
||||||
|
const size_t porch_length = 10;
|
||||||
|
const size_t line_length = sync_length + porch_length + 4 * image_width;
|
||||||
|
|
||||||
|
const float max_dev = 600;
|
||||||
|
const float center = 1750;
|
||||||
|
const float min_freq = 1200;
|
||||||
|
const float max_freq = 2300;
|
||||||
|
|
||||||
|
const float color_low = 1500;
|
||||||
|
const float color_high = max_freq;
|
||||||
|
|
||||||
|
|
||||||
|
sstv_pd120_sink::sptr
|
||||||
|
sstv_pd120_sink::make(const char *filename_png, bool split)
|
||||||
|
{
|
||||||
|
return gnuradio::get_initial_sptr
|
||||||
|
(new sstv_pd120_sink_impl(filename_png, split));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The private constructor
|
||||||
|
*/
|
||||||
|
sstv_pd120_sink_impl::sstv_pd120_sink_impl(const char *filename_png, bool split)
|
||||||
|
: gr::sync_block("sstv_pd120_sink",
|
||||||
|
gr::io_signature::make (1, 1, sizeof(float)),
|
||||||
|
gr::io_signature::make (0, 0, 0)),
|
||||||
|
d_filename_png (filename_png),
|
||||||
|
d_split (split),
|
||||||
|
d_has_sync(false)
|
||||||
|
{
|
||||||
|
set_history(sync_length);
|
||||||
|
d_line = new float[line_length];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Our virtual destructor.
|
||||||
|
*/
|
||||||
|
sstv_pd120_sink_impl::~sstv_pd120_sink_impl()
|
||||||
|
{
|
||||||
|
delete[] d_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
sstv_pd120_sink_impl::to_frequency(float sample) {
|
||||||
|
float freq = center + sample * max_dev;
|
||||||
|
freq = std::max(min_freq, freq);
|
||||||
|
freq = std::min(max_freq, freq);
|
||||||
|
return freq;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
sstv_pd120_sink_impl::is_sync(size_t pos, const float *samples) {
|
||||||
|
size_t count = 0;
|
||||||
|
for(size_t i = 0; i < sync_length; i++) {
|
||||||
|
float sample = to_frequency(samples[pos - (sync_length - 1) + i]);
|
||||||
|
if(sample < color_low) {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool res = count > sync_length && !d_has_sync;
|
||||||
|
d_has_sync = count > sync_length;
|
||||||
|
|
||||||
|
std::cout << "Count: " << count << " " << d_has_sync << std::endl;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
sstv_pd120_sink_impl::work(int noutput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
const float *in = (const float *) input_items[0];
|
||||||
|
|
||||||
|
std::cout << "foo" << std::endl;
|
||||||
|
for (size_t i = sync_length - 1;
|
||||||
|
i < noutput_items + sync_length - 1; i++) {
|
||||||
|
|
||||||
|
if(is_sync(i, in)) {
|
||||||
|
std::cout << "Sync: " << i << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell runtime system how many output items we produced.
|
||||||
|
return noutput_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace satnogs */
|
||||||
|
} /* namespace gr */
|
|
@ -0,0 +1,55 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/*
|
||||||
|
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018, Libre Space Foundation <http://librespacefoundation.org/>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_SATNOGS_SSTV_PD120_SINK_IMPL_H
|
||||||
|
#define INCLUDED_SATNOGS_SSTV_PD120_SINK_IMPL_H
|
||||||
|
|
||||||
|
#include <satnogs/sstv_pd120_sink.h>
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace satnogs {
|
||||||
|
|
||||||
|
class sstv_pd120_sink_impl : public sstv_pd120_sink
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::string d_filename_png;
|
||||||
|
bool d_split;
|
||||||
|
bool d_has_sync;
|
||||||
|
|
||||||
|
float *d_line;
|
||||||
|
|
||||||
|
float to_frequency(float sample);
|
||||||
|
bool is_sync(size_t pos, const float *samples);
|
||||||
|
|
||||||
|
public:
|
||||||
|
sstv_pd120_sink_impl(const char *filename_png, bool split);
|
||||||
|
~sstv_pd120_sink_impl();
|
||||||
|
|
||||||
|
// Where all the action really happens
|
||||||
|
int work(int noutput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace satnogs
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_SATNOGS_SSTV_PD120_SINK_IMPL_H */
|
|
@ -34,6 +34,7 @@
|
||||||
#include "satnogs/ogg_encoder.h"
|
#include "satnogs/ogg_encoder.h"
|
||||||
#include "satnogs/ogg_source.h"
|
#include "satnogs/ogg_source.h"
|
||||||
#include "satnogs/noaa_apt_sink.h"
|
#include "satnogs/noaa_apt_sink.h"
|
||||||
|
#include "satnogs/sstv_pd120_sink.h"
|
||||||
#include "satnogs/frame_file_sink.h"
|
#include "satnogs/frame_file_sink.h"
|
||||||
#include "satnogs/iq_sink.h"
|
#include "satnogs/iq_sink.h"
|
||||||
#include "satnogs/json_converter.h"
|
#include "satnogs/json_converter.h"
|
||||||
|
@ -99,6 +100,9 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, ogg_source);
|
||||||
%include "satnogs/noaa_apt_sink.h"
|
%include "satnogs/noaa_apt_sink.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(satnogs, noaa_apt_sink);
|
GR_SWIG_BLOCK_MAGIC2(satnogs, noaa_apt_sink);
|
||||||
|
|
||||||
|
%include "satnogs/sstv_pd120_sink.h"
|
||||||
|
GR_SWIG_BLOCK_MAGIC2(satnogs, sstv_pd120_sink);
|
||||||
|
|
||||||
%include "satnogs/frame_file_sink.h"
|
%include "satnogs/frame_file_sink.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(satnogs, frame_file_sink);
|
GR_SWIG_BLOCK_MAGIC2(satnogs, frame_file_sink);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue