├── python └── tempest │ ├── bindings │ ├── README.md │ ├── docstrings │ │ ├── README.md │ │ ├── frame_drop_pydoc_template.h │ │ ├── sync_detector_pydoc_template.h │ │ ├── fft_peak_fine_sampling_sync_pydoc_template.h │ │ ├── Hsync_pydoc_template.h │ │ ├── framing_pydoc_template.h │ │ ├── normalize_flow_pydoc_template.h │ │ ├── ssamp_correction_pydoc_template.h │ │ ├── infer_screen_resolution_pydoc_template.h │ │ ├── fine_sampling_synchronization_pydoc_template.h │ │ └── sampling_synchronization_pydoc_template.h │ ├── failed_conversions.txt │ ├── Hsync_python.cc │ ├── sync_detector_python.cc │ ├── frame_drop_python.cc │ ├── framing_python.cc │ ├── normalize_flow_python.cc │ ├── fft_peak_fine_sampling_sync_python.cc │ ├── ssamp_correction_python.cc │ ├── CMakeLists.txt │ ├── infer_screen_resolution_python.cc │ ├── sampling_synchronization_python.cc │ ├── fine_sampling_synchronization_python.cc │ ├── bind_oot_file.py │ ├── python_bindings.cc │ └── header_utils.py │ ├── .gitignore │ ├── __init__.py │ ├── qa_image_source.py │ ├── qa_message_to_var.py │ ├── qa_tempest_msgbtn.py │ ├── qa_framing.py │ ├── qa_frame_drop.py │ ├── qa_sync_detector.py │ ├── qa_normalize_flow.py │ ├── qa_ssamp_correction.py │ ├── qa_infer_screen_resolution.py │ ├── qa_sampling_synchronization.py │ ├── qa_fft_peak_fine_sampling_sync.py │ ├── qa_fine_sampling_synchronization.py │ ├── message_to_var.py │ ├── CMakeLists.txt │ ├── tempest_msgbtn.py │ └── image_source.py ├── Imagen_800_600.png ├── .gitignore ├── examples ├── README ├── Keep_1_in_N_frames.grc └── FFT_autocorrelate.grc ├── docs ├── doxygen │ ├── other │ │ ├── group_defs.dox │ │ └── main_page.dox │ ├── doxyxml │ │ ├── generated │ │ │ ├── __init__.py │ │ │ └── index.py │ │ ├── text.py │ │ ├── __init__.py │ │ └── base.py │ ├── pydoc_macros.h │ └── CMakeLists.txt ├── README.tempest └── CMakeLists.txt ├── apps └── CMakeLists.txt ├── cmake ├── Modules │ ├── targetConfig.cmake.in │ ├── gnuradio-tempestConfig.cmake │ └── CMakeParseArgumentsCopy.cmake └── cmake_uninstall.cmake.in ├── grc ├── tempest_Hsync.block.yml ├── tempest_message_to_var.block.yml ├── tempest_sampling_synchronization.block.yml ├── tempest_sync_detector.block.yml ├── tempest_framing.block.yml ├── tempest_normalize_flow.block.yml ├── tempest_infer_screen_resolution.block.yml ├── CMakeLists.txt ├── tempest_image_source.block.yml ├── tempest_fine_sampling_synchronization.block.yml ├── tempest_frame_drop.block.yml ├── tempest_ssamp_correction.block.yml ├── tempest_fft_peak_fine_sampling_sync.block.yml └── tempest_tempest_msgbtn.block.yml ├── include └── gnuradio │ └── tempest │ ├── api.h │ ├── CMakeLists.txt │ ├── sync_detector.h │ ├── Hsync.h │ ├── frame_drop.h │ ├── framing.h │ ├── ssamp_correction.h │ ├── fft_peak_fine_sampling_sync.h │ ├── infer_screen_resolution.h │ ├── normalize_flow.h │ ├── fine_sampling_synchronization.h │ └── sampling_synchronization.h ├── MANIFEST.md ├── lib ├── framing_impl.h ├── normalize_flow_impl.h ├── CMakeLists.txt ├── sampling_synchronization_impl.h ├── sync_detector_impl.h ├── fine_sampling_synchronization_impl.h ├── ssamp_correction_impl.h ├── normalize_flow_impl.cc ├── Hsync_impl.h ├── framing_impl.cc ├── frame_drop_impl.h ├── frame_drop_impl.cc ├── sampling_synchronization_impl.cc └── infer_screen_resolution_impl.h └── CMakeLists.txt /python/tempest/bindings/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/tempest/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.pyc 3 | *.pyo 4 | build*/ 5 | examples/grc/*.py 6 | -------------------------------------------------------------------------------- /Imagen_800_600.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/git-artes/gr-tempest/HEAD/Imagen_800_600.png -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/README.md: -------------------------------------------------------------------------------- 1 | This directory stores templates for docstrings that are scraped from the include header files for each block 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | examples/*.py 3 | draft 4 | viejos 5 | old 6 | logs 7 | *.bak 8 | *.log 9 | *.pyc 10 | *.bin 11 | *.hex 12 | *.py~ 13 | *.txt~ 14 | *.sh~ 15 | *~ 16 | *.swp 17 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | It is considered good practice to add examples in here to demonstrate the 2 | functionality of your OOT module. Python scripts, GRC flow graphs or other 3 | code can go here. 4 | -------------------------------------------------------------------------------- /docs/doxygen/other/group_defs.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | * \defgroup block GNU Radio TEMPEST C++ Signal Processing Blocks 3 | * \brief All C++ blocks that can be used from the TEMPEST GNU Radio 4 | * module are listed here or in the subcategories below. 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/generated/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains generated files produced by generateDS.py. 3 | 4 | These do the real work of parsing the doxygen xml files but the 5 | resultant classes are not very friendly to navigate so the rest of the 6 | doxyxml module processes them further. 7 | """ 8 | -------------------------------------------------------------------------------- /docs/doxygen/other/main_page.dox: -------------------------------------------------------------------------------- 1 | /*! \mainpage 2 | 3 | Welcome to the GNU Radio TEMPEST Block 4 | 5 | This is the intro page for the Doxygen manual generated for the TEMPEST 6 | block (docs/doxygen/other/main_page.dox). Edit it to add more detailed 7 | documentation about the new GNU Radio modules contained in this 8 | project. 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /python/tempest/bindings/failed_conversions.txt: -------------------------------------------------------------------------------- 1 | ./include/gnuradio/tempest/Hsync.hError occurred while running CASTXML xml file does not exist 2 | ./include/gnuradio/tempest/sampling_synchronization.hError occurred while running CASTXML xml file does not exist 3 | ./include/gnuradio/tempest/sync_detector.hError occurred while running CASTXML xml file does not exist 4 | -------------------------------------------------------------------------------- /apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | include(GrPython) 10 | 11 | GR_PYTHON_INSTALL( 12 | PROGRAMS 13 | DESTINATION bin 14 | ) 15 | -------------------------------------------------------------------------------- /cmake/Modules/targetConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | # 7 | 8 | include(CMakeFindDependencyMacro) 9 | 10 | set(target_deps "@TARGET_DEPENDENCIES@") 11 | foreach(dep IN LISTS target_deps) 12 | find_dependency(${dep}) 13 | endforeach() 14 | include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake") 15 | -------------------------------------------------------------------------------- /docs/README.tempest: -------------------------------------------------------------------------------- 1 | This is the tempest-write-a-block package meant as a guide to building 2 | out-of-tree packages. To use the tempest blocks, the Python namespaces 3 | is in 'tempest', which is imported as: 4 | 5 | import tempest 6 | 7 | See the Doxygen documentation for details about the blocks available 8 | in this package. A quick listing of the details can be found in Python 9 | after importing by using: 10 | 11 | help(tempest) 12 | -------------------------------------------------------------------------------- /grc/tempest_Hsync.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_Hsync 2 | label: Horizontal Sync 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.Hsync(${Htotal}, ${delay}) 7 | parameters: 8 | - id: Htotal 9 | label: Htotal 10 | dtype: int 11 | - id: delay 12 | label: Delay 13 | dtype: int 14 | inputs: 15 | - label: in 16 | domain: stream 17 | dtype: complex 18 | outputs: 19 | - label: out 20 | domain: stream 21 | dtype: complex 22 | file_format: 1 23 | -------------------------------------------------------------------------------- /grc/tempest_message_to_var.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_message_to_var 2 | label: message_to_var 3 | category: '[Tempest]' 4 | 5 | parameters: 6 | - id: target 7 | label: Variable 8 | dtype: string 9 | default: 'delay_0' 10 | optional: true 11 | inputs: 12 | - label: port0 13 | domain: message 14 | optional: true 15 | 16 | 17 | templates: 18 | imports: import tempest 19 | make: tempest.message_to_var(${ 'self.set_' + context.get('target')() }) 20 | 21 | file_format: 1 22 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Free Software Foundation, Inc. 3 | * 4 | * This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | * This file is a part of gr-tempest 6 | * 7 | * SPDX-License-Identifier: GPL-3.0-or-later 8 | * 9 | */ 10 | 11 | #ifndef INCLUDED_TEMPEST_API_H 12 | #define INCLUDED_TEMPEST_API_H 13 | 14 | #include 15 | 16 | #ifdef gnuradio_tempest_EXPORTS 17 | #define TEMPEST_API __GR_ATTR_EXPORT 18 | #else 19 | #define TEMPEST_API __GR_ATTR_IMPORT 20 | #endif 21 | 22 | #endif /* INCLUDED_TEMPEST_API_H */ 23 | -------------------------------------------------------------------------------- /grc/tempest_sampling_synchronization.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_sampling_synchronization 2 | label: Sampling synchronization 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.sampling_synchronization(${Htotal}, ${manual_correction}) 7 | callbacks: 8 | - set_Htotal(${Htotal}) 9 | - set_manual_correction(${manual_correction}) 10 | parameters: 11 | - id: Htotal 12 | label: Horizontal px (total) 13 | dtype: int 14 | - id: manual_correction 15 | label: Manual correction 16 | dtype: real 17 | inputs: 18 | - label: in 19 | domain: stream 20 | dtype: complex 21 | outputs: 22 | - label: out 23 | domain: stream 24 | dtype: complex 25 | file_format: 1 26 | -------------------------------------------------------------------------------- /grc/tempest_sync_detector.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_sync_detector 2 | label: Sync Detector 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.sync_detector(${hscreen}, ${vscreen}, ${hblanking}, ${vblanking}) 7 | parameters: 8 | - id: hscreen 9 | label: Hscreen 10 | dtype: int 11 | - id: vscreen 12 | label: Vscreen 13 | dtype: int 14 | - id: hblanking 15 | label: Hblanking 16 | dtype: int 17 | - id: vblanking 18 | label: Vblanking 19 | dtype: int 20 | inputs: 21 | - label: in 22 | domain: stream 23 | dtype: complex 24 | - label: en 25 | domain: message 26 | optional: true 27 | outputs: 28 | - label: out 29 | domain: stream 30 | dtype: complex 31 | file_format: 1 32 | 33 | -------------------------------------------------------------------------------- /grc/tempest_framing.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_framing 2 | label: Framing 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.framing(${Htotal}, ${Vtotal}, ${Hdisplay}, ${Vdisplay}) 7 | callbacks: 8 | - set_Htotal_and_Vtotal(${Htotal},${Vtotal}) 9 | parameters: 10 | - id: Htotal 11 | label: Horizontal px (total) 12 | dtype: int 13 | - id: Vtotal 14 | label: Vertical px (total) 15 | dtype: int 16 | - id: Hdisplay 17 | label: Horizontal px (display) 18 | dtype: int 19 | - id: Vdisplay 20 | label: Vertical px (display) 21 | dtype: int 22 | inputs: 23 | - label: in 24 | domain: stream 25 | dtype: float 26 | outputs: 27 | - label: out 28 | domain: stream 29 | dtype: float 30 | file_format: 1 31 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/frame_drop_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_frame_drop = R"doc()doc"; 18 | 19 | static const char *__doc_gr_tempest_frame_drop_frame_drop = R"doc()doc"; 20 | 21 | static const char *__doc_gr_tempest_frame_drop_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/tempest/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2008,2009 Free Software Foundation, Inc. 3 | # 4 | # SPDX-License-Identifier: GPL-3.0-or-later 5 | # 6 | 7 | # The presence of this file turns this directory into a Python package 8 | 9 | ''' 10 | This is the GNU Radio TEMPEST module. Place your Python package 11 | description here (python/__init__.py). 12 | ''' 13 | import os 14 | 15 | # import pybind11 generated symbols into the tempest namespace 16 | try: 17 | # this might fail if the module is python-only 18 | from .tempest_python import * 19 | except ModuleNotFoundError: 20 | pass 21 | 22 | # import any pure python here 23 | from .tempest_msgbtn import tempest_msgbtn 24 | from .message_to_var import message_to_var 25 | from .image_source import image_source 26 | # 27 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/sync_detector_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_sync_detector = R"doc()doc"; 18 | 19 | static const char *__doc_gr_tempest_sync_detector_sync_detector = R"doc()doc"; 20 | 21 | static const char *__doc_gr_tempest_sync_detector_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /MANIFEST.md: -------------------------------------------------------------------------------- 1 | title: The TEMPEST OOT Module 2 | brief: Short description of gr-tempest 3 | tags: # Tags are arbitrary, but look at CGRAN what other authors are using 4 | - sdr 5 | author: 6 | - Author Name 7 | copyright_owner: 8 | - Copyright Owner 1 9 | license: 10 | gr_supported_version: # Put a comma separated list of supported GR versions here 11 | #repo: # Put the URL of the repository here, or leave blank for default 12 | #website: # If you have a separate project website, put it here 13 | #icon: # Put a URL to a square image here that will be used as an icon on CGRAN 14 | --- 15 | A longer, multi-line description of gr-tempest. 16 | You may use some *basic* Markdown here. 17 | If left empty, it will try to find a README file instead. 18 | -------------------------------------------------------------------------------- /grc/tempest_normalize_flow.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_normalize_flow 2 | label: Normalize Flow 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.normalize_flow(${min}, ${max}, ${window}, ${alpha_avg}, ${update_proba}) 7 | callbacks: 8 | - set_min_max(${min},${max}) 9 | parameters: 10 | - id: min 11 | label: Minimum 12 | dtype: float 13 | - id: max 14 | label: Maximum 15 | dtype: float 16 | - id: window 17 | label: Window 18 | dtype: int 19 | - id: alpha_avg 20 | label: Alpha avg 21 | dtype: float 22 | - id: update_proba 23 | label: Update proba 24 | dtype: float 25 | inputs: 26 | - label: in 27 | domain: stream 28 | dtype: float 29 | outputs: 30 | - label: out 31 | domain: stream 32 | dtype: float 33 | file_format: 1 34 | -------------------------------------------------------------------------------- /grc/tempest_infer_screen_resolution.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_infer_screen_resolution 2 | label: Infers Screen Resolution 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.infer_screen_resolution(${sample_rate}, ${fft_size}, ${refresh_rate}, 7 | ${automatic_mode}) 8 | callbacks: 9 | - set_refresh_rate(${refresh_rate}) 10 | parameters: 11 | - id: sample_rate 12 | label: Sample rate 13 | dtype: int 14 | - id: fft_size 15 | label: Fft size 16 | dtype: int 17 | - id: refresh_rate 18 | label: Refresh rate 19 | dtype: float 20 | - id: automatic_mode 21 | label: Automatic_mode 22 | dtype: raw 23 | inputs: 24 | - label: in 25 | domain: stream 26 | dtype: float 27 | outputs: 28 | - label: out 29 | domain: stream 30 | dtype: float 31 | file_format: 1 32 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Install public header files 11 | ######################################################################## 12 | install(FILES 13 | api.h 14 | Hsync.h 15 | fft_peak_fine_sampling_sync.h 16 | fine_sampling_synchronization.h 17 | frame_drop.h 18 | framing.h 19 | infer_screen_resolution.h 20 | normalize_flow.h 21 | sampling_synchronization.h 22 | ssamp_correction.h 23 | sync_detector.h DESTINATION include/gnuradio/tempest 24 | ) 25 | -------------------------------------------------------------------------------- /grc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | install(FILES 9 | tempest_Hsync.block.yml 10 | tempest_fft_peak_fine_sampling_sync.block.yml 11 | tempest_fine_sampling_synchronization.block.yml 12 | tempest_frame_drop.block.yml 13 | tempest_framing.block.yml 14 | tempest_infer_screen_resolution.block.yml 15 | tempest_normalize_flow.block.yml 16 | tempest_sampling_synchronization.block.yml 17 | tempest_ssamp_correction.block.yml 18 | tempest_sync_detector.block.yml 19 | tempest_tempest_msgbtn.block.yml 20 | tempest_message_to_var.block.yml 21 | tempest_image_source.block.yml DESTINATION share/gnuradio/grc/blocks 22 | ) 23 | -------------------------------------------------------------------------------- /grc/tempest_image_source.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_image_source 2 | label: Image Source 3 | category: '[Tempest]' 4 | 5 | templates: 6 | imports: import tempest 7 | make: tempest.image_source(${image_file}, ${Hvisible}, ${Vvisible}, ${Htotal}, ${Vtotal}, ${repeatmode}) 8 | 9 | parameters: 10 | - id: image_file 11 | label: Image File 12 | dtype: file_open 13 | - id: Htotal 14 | label: Horizontal px (total) 15 | dtype: int 16 | - id: Vtotal 17 | label: Vertical px (total) 18 | dtype: int 19 | - id: Hvisible 20 | label: Horizontal px (visible) 21 | dtype: int 22 | - id: Vvisible 23 | label: Vertical px (visible) 24 | dtype: int 25 | - id: repeatmode 26 | label: Repeat 27 | dtype: enum 28 | options: ['1', '2'] 29 | option_labels: ['Yes', 'Yes, with file re-read'] 30 | 31 | outputs: 32 | - domain: stream 33 | dtype: float 34 | 35 | 36 | file_format: 1 37 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/fft_peak_fine_sampling_sync_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_fft_peak_fine_sampling_sync = R"doc()doc"; 18 | 19 | static const char 20 | *__doc_gr_tempest_fft_peak_fine_sampling_sync_fft_peak_fine_sampling_sync = 21 | R"doc()doc"; 22 | 23 | static const char *__doc_gr_tempest_fft_peak_fine_sampling_sync_make = 24 | R"doc()doc"; 25 | -------------------------------------------------------------------------------- /python/tempest/qa_image_source.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | from gnuradio.tempest import image_source 12 | 13 | class qa_image_source(gr_unittest.TestCase): 14 | 15 | def setUp(self): 16 | self.tb = gr.top_block() 17 | 18 | def tearDown(self): 19 | self.tb = None 20 | 21 | def test_instance(self): 22 | # FIXME: Test will fail until you pass sensible arguments to the constructor 23 | instance = image_source() 24 | 25 | def test_001_descriptive_test_name(self): 26 | # set up fg 27 | self.tb.run() 28 | # check data 29 | 30 | 31 | if __name__ == '__main__': 32 | gr_unittest.run(qa_image_source) 33 | -------------------------------------------------------------------------------- /python/tempest/qa_message_to_var.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | from gnuradio.tempest import message_to_var 12 | 13 | class qa_message_to_var(gr_unittest.TestCase): 14 | 15 | def setUp(self): 16 | self.tb = gr.top_block() 17 | 18 | def tearDown(self): 19 | self.tb = None 20 | 21 | def test_instance(self): 22 | # FIXME: Test will fail until you pass sensible arguments to the constructor 23 | instance = message_to_var() 24 | 25 | def test_001_descriptive_test_name(self): 26 | # set up fg 27 | self.tb.run() 28 | # check data 29 | 30 | 31 | if __name__ == '__main__': 32 | gr_unittest.run(qa_message_to_var) 33 | -------------------------------------------------------------------------------- /python/tempest/qa_tempest_msgbtn.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | from gnuradio.tempest import tempest_msgbtn 12 | 13 | class qa_tempest_msgbtn(gr_unittest.TestCase): 14 | 15 | def setUp(self): 16 | self.tb = gr.top_block() 17 | 18 | def tearDown(self): 19 | self.tb = None 20 | 21 | def test_instance(self): 22 | # FIXME: Test will fail until you pass sensible arguments to the constructor 23 | instance = tempest_msgbtn() 24 | 25 | def test_001_descriptive_test_name(self): 26 | # set up fg 27 | self.tb.run() 28 | # check data 29 | 30 | 31 | if __name__ == '__main__': 32 | gr_unittest.run(qa_tempest_msgbtn) 33 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/Hsync_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_Hsync = R"doc()doc"; 18 | 19 | static const char *__doc_gr_tempest_Hsync_Hsync_0 = R"doc()doc"; 20 | 21 | static const char *__doc_gr_tempest_Hsync_Hsync_1 = R"doc()doc"; 22 | 23 | static const char *__doc_gr_tempest_Hsync_make = R"doc()doc"; 24 | 25 | static const char *__doc_gr_tempest_Hsync_set_Htotal_and_delay = R"doc()doc"; 26 | -------------------------------------------------------------------------------- /docs/doxygen/pydoc_macros.h: -------------------------------------------------------------------------------- 1 | #ifndef PYDOC_MACROS_H 2 | #define PYDOC_MACROS_H 3 | 4 | #define __EXPAND(x) x 5 | #define __COUNT(_1, _2, _3, _4, _5, _6, _7, COUNT, ...) COUNT 6 | #define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1)) 7 | #define __CAT1(a, b) a##b 8 | #define __CAT2(a, b) __CAT1(a, b) 9 | #define __DOC1(n1) __doc_##n1 10 | #define __DOC2(n1, n2) __doc_##n1##_##n2 11 | #define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3 12 | #define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4 13 | #define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5 14 | #define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6 15 | #define __DOC7(n1, n2, n3, n4, n5, n6, n7) \ 16 | __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7 17 | #define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__)) 18 | 19 | #endif // PYDOC_MACROS_H 20 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Setup dependencies 11 | ######################################################################## 12 | find_package(Doxygen) 13 | 14 | ######################################################################## 15 | # Begin conditional configuration 16 | ######################################################################## 17 | if(ENABLE_DOXYGEN) 18 | 19 | ######################################################################## 20 | # Add subdirectories 21 | ######################################################################## 22 | add_subdirectory(doxygen) 23 | 24 | endif(ENABLE_DOXYGEN) 25 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/framing_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_framing = R"doc()doc"; 18 | 19 | static const char *__doc_gr_tempest_framing_framing_0 = R"doc()doc"; 20 | 21 | static const char *__doc_gr_tempest_framing_framing_1 = R"doc()doc"; 22 | 23 | static const char *__doc_gr_tempest_framing_make = R"doc()doc"; 24 | 25 | static const char *__doc_gr_tempest_framing_set_Htotal_and_Vtotal = R"doc()doc"; 26 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/normalize_flow_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_normalize_flow = R"doc()doc"; 18 | 19 | static const char *__doc_gr_tempest_normalize_flow_normalize_flow_0 = 20 | R"doc()doc"; 21 | 22 | static const char *__doc_gr_tempest_normalize_flow_normalize_flow_1 = 23 | R"doc()doc"; 24 | 25 | static const char *__doc_gr_tempest_normalize_flow_make = R"doc()doc"; 26 | 27 | static const char *__doc_gr_tempest_normalize_flow_set_min_max = R"doc()doc"; 28 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/ssamp_correction_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_ssamp_correction = R"doc()doc"; 18 | 19 | static const char *__doc_gr_tempest_ssamp_correction_ssamp_correction_0 = 20 | R"doc()doc"; 21 | 22 | static const char *__doc_gr_tempest_ssamp_correction_ssamp_correction_1 = 23 | R"doc()doc"; 24 | 25 | static const char *__doc_gr_tempest_ssamp_correction_make = R"doc()doc"; 26 | 27 | static const char *__doc_gr_tempest_ssamp_correction_set_Htotal_Vtotal = 28 | R"doc()doc"; 29 | -------------------------------------------------------------------------------- /grc/tempest_fine_sampling_synchronization.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_fine_sampling_synchronization 2 | label: Fine sampling synchronization 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.fine_sampling_synchronization(${Htotal}, ${Vtotal}, ${correct_sampling}, 7 | ${max_deviation}, ${update_proba}) 8 | callbacks: 9 | - set_Htotal_Vtotal(${Htotal}, ${Vtotal}) 10 | parameters: 11 | - id: Htotal 12 | label: Horizontal px 13 | dtype: int 14 | - id: Vtotal 15 | label: Vertical px 16 | dtype: int 17 | - id: correct_sampling 18 | label: Correct sampling? 19 | dtype: enum 20 | default: 1 21 | options: [1, 0] 22 | option_labels: ['Yes', 'No'] 23 | - id: max_deviation 24 | label: Max. deviation (%) 25 | dtype: float 26 | - id: update_proba 27 | label: Update proba. 28 | dtype: float 29 | inputs: 30 | - label: in 31 | domain: stream 32 | dtype: complex 33 | outputs: 34 | - label: out 35 | domain: stream 36 | dtype: complex 37 | file_format: 1 38 | -------------------------------------------------------------------------------- /cmake/Modules/gnuradio-tempestConfig.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig) 2 | 3 | PKG_CHECK_MODULES(PC_GR_TEMPEST gnuradio-tempest) 4 | 5 | FIND_PATH( 6 | GR_TEMPEST_INCLUDE_DIRS 7 | NAMES gnuradio/tempest/api.h 8 | HINTS $ENV{TEMPEST_DIR}/include 9 | ${PC_TEMPEST_INCLUDEDIR} 10 | PATHS ${CMAKE_INSTALL_PREFIX}/include 11 | /usr/local/include 12 | /usr/include 13 | ) 14 | 15 | FIND_LIBRARY( 16 | GR_TEMPEST_LIBRARIES 17 | NAMES gnuradio-tempest 18 | HINTS $ENV{TEMPEST_DIR}/lib 19 | ${PC_TEMPEST_LIBDIR} 20 | PATHS ${CMAKE_INSTALL_PREFIX}/lib 21 | ${CMAKE_INSTALL_PREFIX}/lib64 22 | /usr/local/lib 23 | /usr/local/lib64 24 | /usr/lib 25 | /usr/lib64 26 | ) 27 | 28 | include("${CMAKE_CURRENT_LIST_DIR}/gnuradio-tempestTarget.cmake") 29 | 30 | INCLUDE(FindPackageHandleStandardArgs) 31 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GR_TEMPEST DEFAULT_MSG GR_TEMPEST_LIBRARIES GR_TEMPEST_INCLUDE_DIRS) 32 | MARK_AS_ADVANCED(GR_TEMPEST_LIBRARIES GR_TEMPEST_INCLUDE_DIRS) 33 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/infer_screen_resolution_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_infer_screen_resolution = R"doc()doc"; 18 | 19 | static const char 20 | *__doc_gr_tempest_infer_screen_resolution_infer_screen_resolution_0 = 21 | R"doc()doc"; 22 | 23 | static const char 24 | *__doc_gr_tempest_infer_screen_resolution_infer_screen_resolution_1 = 25 | R"doc()doc"; 26 | 27 | static const char *__doc_gr_tempest_infer_screen_resolution_set_refresh_rate = 28 | R"doc()doc"; 29 | 30 | static const char *__doc_gr_tempest_infer_screen_resolution_make = R"doc()doc"; 31 | -------------------------------------------------------------------------------- /python/tempest/qa_framing.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import framing 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import framing 19 | 20 | class qa_framing(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = framing() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_framing) 40 | -------------------------------------------------------------------------------- /python/tempest/qa_frame_drop.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import frame_drop 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import frame_drop 19 | 20 | class qa_frame_drop(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = frame_drop() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_frame_drop) 40 | -------------------------------------------------------------------------------- /python/tempest/qa_sync_detector.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import sync_detector 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import sync_detector 19 | 20 | class qa_sync_detector(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = sync_detector() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_sync_detector) 40 | -------------------------------------------------------------------------------- /python/tempest/qa_normalize_flow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import normalize_flow 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import normalize_flow 19 | 20 | class qa_normalize_flow(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = normalize_flow() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_normalize_flow) 40 | -------------------------------------------------------------------------------- /python/tempest/qa_ssamp_correction.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import ssamp_correction 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import ssamp_correction 19 | 20 | class qa_ssamp_correction(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = ssamp_correction() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_ssamp_correction) 40 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/fine_sampling_synchronization_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_fine_sampling_synchronization = R"doc()doc"; 18 | 19 | static const char * 20 | __doc_gr_tempest_fine_sampling_synchronization_fine_sampling_synchronization_0 = 21 | R"doc()doc"; 22 | 23 | static const char * 24 | __doc_gr_tempest_fine_sampling_synchronization_fine_sampling_synchronization_1 = 25 | R"doc()doc"; 26 | 27 | static const char *__doc_gr_tempest_fine_sampling_synchronization_make = 28 | R"doc()doc"; 29 | 30 | static const char 31 | *__doc_gr_tempest_fine_sampling_synchronization_set_Htotal_Vtotal = 32 | R"doc()doc"; 33 | -------------------------------------------------------------------------------- /python/tempest/qa_infer_screen_resolution.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import infer_screen_resolution 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import infer_screen_resolution 19 | 20 | class qa_infer_screen_resolution(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = infer_screen_resolution() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_infer_screen_resolution) 40 | -------------------------------------------------------------------------------- /python/tempest/qa_sampling_synchronization.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import sampling_synchronization 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import sampling_synchronization 19 | 20 | class qa_sampling_synchronization(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = sampling_synchronization() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_sampling_synchronization) 40 | -------------------------------------------------------------------------------- /python/tempest/qa_fft_peak_fine_sampling_sync.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import fft_peak_fine_sampling_sync 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import fft_peak_fine_sampling_sync 19 | 20 | class qa_fft_peak_fine_sampling_sync(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = fft_peak_fine_sampling_sync() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_fft_peak_fine_sampling_sync) 40 | -------------------------------------------------------------------------------- /grc/tempest_frame_drop.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_frame_drop 2 | label: Frame Dropper 3 | category: '[Tempest]' 4 | templates: 5 | imports: from gnuradio import tempest 6 | make: tempest.frame_drop(${Htotal}, ${Vtotal}, ${correct_sampling}, ${max_deviation}, 7 | ${update_proba}, ${actual_samp_rate}) 8 | parameters: 9 | - id: Htotal 10 | label: Horizontal total 11 | dtype: int 12 | - id: Vtotal 13 | label: Vertical total 14 | dtype: int 15 | - id: correct_sampling 16 | label: Correct sampling? 17 | dtype: enum 18 | default: 1 19 | options: [1, 0] 20 | option_labels: ['Yes', 'No'] 21 | - id: max_deviation 22 | label: Max. deviation 23 | dtype: float 24 | - id: update_proba 25 | label: Update prob. 26 | dtype: float 27 | - id: actual_samp_rate 28 | label: Samp rate 29 | dtype: real 30 | inputs: 31 | - label: in 32 | domain: stream 33 | dtype: complex 34 | - label: en 35 | domain: message 36 | optional: true 37 | - label: smpl 38 | domain: message 39 | optional: true 40 | - label: ratio 41 | domain: message 42 | optional: true 43 | outputs: 44 | - label: out 45 | domain: stream 46 | dtype: complex 47 | - label: ratio 48 | domain: message 49 | optional: true 50 | file_format: 1 51 | -------------------------------------------------------------------------------- /python/tempest/bindings/docstrings/sampling_synchronization_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, tempest, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_tempest_sampling_synchronization = R"doc()doc"; 18 | 19 | static const char 20 | *__doc_gr_tempest_sampling_synchronization_sampling_synchronization_0 = 21 | R"doc()doc"; 22 | 23 | static const char 24 | *__doc_gr_tempest_sampling_synchronization_sampling_synchronization_1 = 25 | R"doc()doc"; 26 | 27 | static const char *__doc_gr_tempest_sampling_synchronization_make = R"doc()doc"; 28 | 29 | static const char *__doc_gr_tempest_sampling_synchronization_set_Htotal = 30 | R"doc()doc"; 31 | 32 | static const char 33 | *__doc_gr_tempest_sampling_synchronization_set_manual_correction = 34 | R"doc()doc"; 35 | -------------------------------------------------------------------------------- /python/tempest/qa_fine_sampling_synchronization.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2022 gr-tempest author. 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | from gnuradio import gr, gr_unittest 10 | # from gnuradio import blocks 11 | try: 12 | from gnuradio.tempest import fine_sampling_synchronization 13 | except ImportError: 14 | import os 15 | import sys 16 | dirname, filename = os.path.split(os.path.abspath(__file__)) 17 | sys.path.append(os.path.join(dirname, "bindings")) 18 | from gnuradio.tempest import fine_sampling_synchronization 19 | 20 | class qa_fine_sampling_synchronization(gr_unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.tb = gr.top_block() 24 | 25 | def tearDown(self): 26 | self.tb = None 27 | 28 | def test_instance(self): 29 | # FIXME: Test will fail until you pass sensible arguments to the constructor 30 | instance = fine_sampling_synchronization() 31 | 32 | def test_001_descriptive_test_name(self): 33 | # set up fg 34 | self.tb.run() 35 | # check data 36 | 37 | 38 | if __name__ == '__main__': 39 | gr_unittest.run(qa_fine_sampling_synchronization) 40 | -------------------------------------------------------------------------------- /grc/tempest_ssamp_correction.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_ssamp_correction 2 | label: Sampling Correction Interpolator 3 | category: '[Tempest]' 4 | 5 | templates: 6 | imports: from gnuradio import tempest 7 | make: tempest.ssamp_correction(${Htotal}, ${Vtotal}, ${correct_sampling}, ${max_deviation}) 8 | 9 | callbacks: 10 | - set_Htotal_Vtotal(${Htotal}, ${Vtotal}) 11 | # Make one 'parameters' list entry for every parameter you want settable from the GUI. 12 | # Keys include: 13 | # * id (makes the value accessible as \$keyname, e.g. in the make entry) 14 | # * label (label shown in the GUI) 15 | # * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...) 16 | 17 | parameters: 18 | - id: Htotal 19 | label: Horizontal px 20 | dtype: int 21 | - id: Vtotal 22 | label: Vertical px 23 | dtype: int 24 | - id: correct_sampling 25 | label: Correct sampling? 26 | dtype: enum 27 | default: 1 28 | options: [1, 0] 29 | option_labels: ['Yes', 'No'] 30 | - id: max_deviation 31 | label: Max. deviation (%) 32 | dtype: float 33 | default: 10 34 | inputs: 35 | - label: in 36 | domain: stream 37 | dtype: complex 38 | - label: ratio 39 | domain: message 40 | optional: true 41 | - label: en 42 | domain: message 43 | optional: true 44 | outputs: 45 | - label: out 46 | domain: stream 47 | dtype: complex 48 | 49 | file_format: 1 50 | -------------------------------------------------------------------------------- /grc/tempest_fft_peak_fine_sampling_sync.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_fft_peak_fine_sampling_sync 2 | label: fft_peak_fine_sampling_sync 3 | category: '[Tempest]' 4 | 5 | templates: 6 | imports: from gnuradio import tempest 7 | make: tempest.fft_peak_fine_sampling_sync(${sample_rate}, ${size}, ${refresh_rate}, ${Vvisible}, ${Hvisible}, ${automatic_mode}) 8 | 9 | # Make one 'parameters' list entry for every parameter you want settable from the GUI. 10 | # Keys include: 11 | # * id (makes the value accessible as \$keyname, e.g. in the make entry) 12 | # * label (label shown in the GUI) 13 | # * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...) 14 | parameters: 15 | - id: sample_rate 16 | label: Samp_rate 17 | dtype: int 18 | - id: size 19 | label: Fft_size 20 | dtype: int 21 | - id: refresh_rate 22 | label: Refresh_rate 23 | dtype: int 24 | - id: Vvisible 25 | label: vvisible 26 | dtype: int 27 | - id: Hvisible 28 | label: hvisible 29 | dtype: int 30 | - id: automatic_mode 31 | label: automatic_mode 32 | dtype: bool 33 | inputs: 34 | - label: in 35 | domain: stream 36 | dtype: float 37 | - label: en 38 | domain: message 39 | optional: true 40 | outputs: 41 | - label: out 42 | domain: stream 43 | dtype: float 44 | - label: en 45 | domain: message 46 | optional: true 47 | - label: ratio 48 | domain: message 49 | optional: true 50 | - label: rate 51 | domain: message 52 | optional: true 53 | file_format: 1 54 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/text.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | # This file is a part of gr-tempest 6 | # 7 | # SPDX-License-Identifier: GPL-3.0-or-later 8 | # 9 | # 10 | """ 11 | Utilities for extracting text from generated classes. 12 | """ 13 | 14 | 15 | def is_string(txt): 16 | if isinstance(txt, str): 17 | return True 18 | try: 19 | if isinstance(txt, str): 20 | return True 21 | except NameError: 22 | pass 23 | return False 24 | 25 | 26 | def description(obj): 27 | if obj is None: 28 | return None 29 | return description_bit(obj).strip() 30 | 31 | 32 | def description_bit(obj): 33 | if hasattr(obj, 'content'): 34 | contents = [description_bit(item) for item in obj.content] 35 | result = ''.join(contents) 36 | elif hasattr(obj, 'content_'): 37 | contents = [description_bit(item) for item in obj.content_] 38 | result = ''.join(contents) 39 | elif hasattr(obj, 'value'): 40 | result = description_bit(obj.value) 41 | elif is_string(obj): 42 | return obj 43 | else: 44 | raise Exception( 45 | 'Expecting a string or something with content, content_ or value attribute') 46 | # If this bit is a paragraph then add one some line breaks. 47 | if hasattr(obj, 'name') and obj.name == 'para': 48 | result += "\n\n" 49 | return result 50 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /docs/doxygen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Create the doxygen configuration file 11 | ######################################################################## 12 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) 13 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) 14 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir) 15 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir) 16 | 17 | set(HAVE_DOT ${DOXYGEN_DOT_FOUND}) 18 | set(enable_html_docs YES) 19 | set(enable_latex_docs NO) 20 | set(enable_mathjax NO) 21 | set(enable_xml_docs YES) 22 | 23 | configure_file( 24 | ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in 25 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 26 | @ONLY) 27 | 28 | set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html) 29 | 30 | ######################################################################## 31 | # Make and install doxygen docs 32 | ######################################################################## 33 | add_custom_command( 34 | OUTPUT ${BUILT_DIRS} 35 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 36 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 37 | COMMENT "Generating documentation with doxygen" 38 | ) 39 | 40 | add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS}) 41 | 42 | install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR}) 43 | -------------------------------------------------------------------------------- /python/tempest/bindings/Hsync_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(Hsync.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(4b1f3850f22ad7eebc5527bfbeb058ac) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_Hsync(py::module &m) { 33 | 34 | using Hsync = ::gr::tempest::Hsync; 35 | 36 | py::class_>( 37 | m, "Hsync", D(Hsync)) 38 | 39 | .def(py::init(&Hsync::make), py::arg("Htotal"), py::arg("delay"), 40 | D(Hsync, make)) 41 | 42 | .def("set_Htotal_and_delay", &Hsync::set_Htotal_and_delay, 43 | py::arg("Htotal"), py::arg("delay"), D(Hsync, set_Htotal_and_delay)) 44 | 45 | ; 46 | } 47 | -------------------------------------------------------------------------------- /python/tempest/bindings/sync_detector_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(sync_detector.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(b24aa30e78c0994c77a858ef18bf4ad6) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_sync_detector(py::module &m) { 33 | 34 | using sync_detector = ::gr::tempest::sync_detector; 35 | 36 | py::class_>(m, "sync_detector", 38 | D(sync_detector)) 39 | 40 | .def(py::init(&sync_detector::make), py::arg("hscreen"), 41 | py::arg("vscreen"), py::arg("hblanking"), py::arg("vblanking"), 42 | D(sync_detector, make)) 43 | 44 | ; 45 | } 46 | -------------------------------------------------------------------------------- /python/tempest/bindings/frame_drop_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(frame_drop.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(3fd7ca9cfc25a9cc21cf12941433e807) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_frame_drop(py::module &m) { 33 | 34 | using frame_drop = ::gr::tempest::frame_drop; 35 | 36 | py::class_>(m, "frame_drop", D(frame_drop)) 38 | 39 | .def(py::init(&frame_drop::make), py::arg("Htotal"), py::arg("Vtotal"), 40 | py::arg("correct_sampling"), py::arg("max_deviation"), 41 | py::arg("update_proba"), py::arg("actual_samp_rate"), 42 | D(frame_drop, make)) 43 | 44 | ; 45 | } 46 | -------------------------------------------------------------------------------- /python/tempest/bindings/framing_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(framing.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(0bb594965704996c7f7c8813cb903bc9) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_framing(py::module &m) { 33 | 34 | using framing = ::gr::tempest::framing; 35 | 36 | py::class_>( 37 | m, "framing", D(framing)) 38 | 39 | .def(py::init(&framing::make), py::arg("Htotal"), py::arg("Vtotal"), 40 | py::arg("Hdisplay"), py::arg("Vdisplay"), D(framing, make)) 41 | 42 | .def("set_Htotal_and_Vtotal", &framing::set_Htotal_and_Vtotal, 43 | py::arg("Htotal"), py::arg("Vtotal"), 44 | D(framing, set_Htotal_and_Vtotal)) 45 | 46 | ; 47 | } 48 | -------------------------------------------------------------------------------- /python/tempest/bindings/normalize_flow_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(normalize_flow.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(1a6ec1adf209d7f78e59e092cfccd7a9) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_normalize_flow(py::module &m) { 33 | 34 | using normalize_flow = ::gr::tempest::normalize_flow; 35 | 36 | py::class_>(m, "normalize_flow", 38 | D(normalize_flow)) 39 | 40 | .def(py::init(&normalize_flow::make), py::arg("min"), py::arg("max"), 41 | py::arg("window"), py::arg("alpha_avg"), py::arg("update_proba"), 42 | D(normalize_flow, make)) 43 | 44 | .def("set_min_max", &normalize_flow::set_min_max, py::arg("min"), 45 | py::arg("max"), D(normalize_flow, set_min_max)) 46 | 47 | ; 48 | } 49 | -------------------------------------------------------------------------------- /python/tempest/bindings/fft_peak_fine_sampling_sync_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(fft_peak_fine_sampling_sync.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(9cd5004b6b4d0f53c73f0f27ba44304d) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_fft_peak_fine_sampling_sync(py::module &m) { 33 | 34 | using fft_peak_fine_sampling_sync = 35 | ::gr::tempest::fft_peak_fine_sampling_sync; 36 | 37 | py::class_>( 39 | m, "fft_peak_fine_sampling_sync", D(fft_peak_fine_sampling_sync)) 40 | 41 | .def(py::init(&fft_peak_fine_sampling_sync::make), py::arg("sample_rate"), 42 | py::arg("size"), py::arg("refresh_rate"), py::arg("Vvisible"), 43 | py::arg("Hvisible"), py::arg("automatic_mode"), 44 | D(fft_peak_fine_sampling_sync, make)) 45 | 46 | ; 47 | } 48 | -------------------------------------------------------------------------------- /python/tempest/bindings/ssamp_correction_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(ssamp_correction.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(7eca001429a7aeb2a9617d987166861c) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_ssamp_correction(py::module &m) { 33 | 34 | using ssamp_correction = ::gr::tempest::ssamp_correction; 35 | 36 | py::class_>(m, "ssamp_correction", 38 | D(ssamp_correction)) 39 | 40 | .def(py::init(&ssamp_correction::make), py::arg("Htotal"), 41 | py::arg("Vtotal"), py::arg("correct_sampling"), 42 | py::arg("max_deviation"), D(ssamp_correction, make)) 43 | 44 | .def("set_Htotal_Vtotal", &ssamp_correction::set_Htotal_Vtotal, 45 | py::arg("Htotal"), py::arg("Vtotal"), 46 | D(ssamp_correction, set_Htotal_Vtotal)) 47 | 48 | ; 49 | } 50 | -------------------------------------------------------------------------------- /python/tempest/bindings/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | # 7 | 8 | ######################################################################## 9 | # Check if there is C++ code at all 10 | ######################################################################## 11 | if(NOT tempest_sources) 12 | MESSAGE(STATUS "No C++ sources... skipping python bindings") 13 | return() 14 | endif(NOT tempest_sources) 15 | 16 | ######################################################################## 17 | # Check for pygccxml 18 | ######################################################################## 19 | GR_PYTHON_CHECK_MODULE_RAW( 20 | "pygccxml" 21 | "import pygccxml" 22 | PYGCCXML_FOUND 23 | ) 24 | 25 | include(GrPybind) 26 | 27 | ######################################################################## 28 | # Python Bindings 29 | ######################################################################## 30 | list(APPEND tempest_python_files 31 | Hsync_python.cc 32 | fft_peak_fine_sampling_sync_python.cc 33 | fine_sampling_synchronization_python.cc 34 | frame_drop_python.cc 35 | framing_python.cc 36 | infer_screen_resolution_python.cc 37 | normalize_flow_python.cc 38 | sampling_synchronization_python.cc 39 | ssamp_correction_python.cc 40 | sync_detector_python.cc python_bindings.cc) 41 | 42 | GR_PYBIND_MAKE_OOT(tempest 43 | ../../.. 44 | gr::tempest 45 | "${tempest_python_files}") 46 | 47 | # copy in bindings .so file for use in QA test module 48 | add_custom_target( 49 | copy_bindings_for_tests ALL 50 | COMMAND 51 | ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/*.so" 52 | ${CMAKE_BINARY_DIR}/test_modules/gnuradio/tempest/ 53 | DEPENDS tempest_python) 54 | 55 | install(TARGETS tempest_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/tempest COMPONENT pythonapi) 56 | -------------------------------------------------------------------------------- /python/tempest/bindings/infer_screen_resolution_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(infer_screen_resolution.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(633c5a568b3952f46e08ef00f3b6db5e) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_infer_screen_resolution(py::module &m) { 33 | 34 | using infer_screen_resolution = ::gr::tempest::infer_screen_resolution; 35 | 36 | py::class_>( 38 | m, "infer_screen_resolution", D(infer_screen_resolution)) 39 | 40 | .def(py::init(&infer_screen_resolution::make), py::arg("sample_rate"), 41 | py::arg("fft_size"), py::arg("refresh_rate"), 42 | py::arg("automatic_mode"), D(infer_screen_resolution, make)) 43 | 44 | .def("set_refresh_rate", &infer_screen_resolution::set_refresh_rate, 45 | py::arg("refresh_rate"), 46 | D(infer_screen_resolution, set_refresh_rate)) 47 | 48 | ; 49 | } 50 | -------------------------------------------------------------------------------- /python/tempest/bindings/sampling_synchronization_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(sampling_synchronization.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(285ebbfbd6ce42068a267b547a63a9ff) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_sampling_synchronization(py::module &m) { 33 | 34 | using sampling_synchronization = ::gr::tempest::sampling_synchronization; 35 | 36 | py::class_>( 38 | m, "sampling_synchronization", D(sampling_synchronization)) 39 | 40 | .def(py::init(&sampling_synchronization::make), py::arg("Htotal"), 41 | py::arg("manual_correction"), D(sampling_synchronization, make)) 42 | 43 | .def("set_Htotal", &sampling_synchronization::set_Htotal, 44 | py::arg("Htotal"), D(sampling_synchronization, set_Htotal)) 45 | 46 | .def("set_manual_correction", 47 | &sampling_synchronization::set_manual_correction, 48 | py::arg("correction"), 49 | D(sampling_synchronization, set_manual_correction)) 50 | 51 | ; 52 | } 53 | -------------------------------------------------------------------------------- /python/tempest/bindings/fine_sampling_synchronization_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(fine_sampling_synchronization.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(f8258e986606f95db0329aa6b389a7f4) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_fine_sampling_synchronization(py::module &m) { 33 | 34 | using fine_sampling_synchronization = 35 | ::gr::tempest::fine_sampling_synchronization; 36 | 37 | py::class_>( 39 | m, "fine_sampling_synchronization", D(fine_sampling_synchronization)) 40 | 41 | .def(py::init(&fine_sampling_synchronization::make), py::arg("Htotal"), 42 | py::arg("Vtotal"), py::arg("correct_sampling"), 43 | py::arg("max_deviation"), py::arg("update_proba"), 44 | D(fine_sampling_synchronization, make)) 45 | 46 | .def("set_Htotal_Vtotal", 47 | &fine_sampling_synchronization::set_Htotal_Vtotal, py::arg("Htotal"), 48 | py::arg("Vtotal"), 49 | D(fine_sampling_synchronization, set_Htotal_Vtotal)) 50 | 51 | ; 52 | } 53 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/sync_detector.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_SYNC_DETECTOR_H 28 | #define INCLUDED_TEMPEST_SYNC_DETECTOR_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief <+description of block+> 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API sync_detector : virtual public gr::block 42 | { 43 | public: 44 | typedef std::shared_ptr sptr; 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of tempest::sync_detector. 48 | * 49 | * To avoid accidental use of raw pointers, tempest::sync_detector's 50 | * constructor is in a private implementation 51 | * class. tempest::sync_detector::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(int hscreen, int vscreen, int hblanking, int vblanking); 55 | }; 56 | 57 | } // namespace tempest 58 | } // namespace gr 59 | 60 | #endif /* INCLUDED_TEMPEST_SYNC_DETECTOR_H */ 61 | 62 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/Hsync.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | */ 25 | 26 | 27 | #ifndef INCLUDED_TEMPEST_HSYNC_H 28 | #define INCLUDED_TEMPEST_HSYNC_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief <+description of block+> 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API Hsync : virtual public gr::block 42 | { 43 | public: 44 | //typedef boost::shared_ptr sptr; 45 | typedef std::shared_ptr sptr; 46 | 47 | /*! 48 | * \brief Return a shared_ptr to a new instance of tempest::Hsync. 49 | * 50 | * To avoid accidental use of raw pointers, tempest::Hsync's 51 | * constructor is in a private implementation 52 | * class. tempest::Hsync::make is the public interface for 53 | * creating new instances. 54 | */ 55 | static sptr make(int Htotal, int delay); 56 | 57 | virtual void set_Htotal_and_delay(int Htotal, int delay) = 0; 58 | }; 59 | 60 | } // namespace tempest 61 | } // namespace gr 62 | 63 | #endif /* INCLUDED_TEMPEST_HSYNC_H */ 64 | 65 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | # This file is a part of gr-tempest 6 | # 7 | # SPDX-License-Identifier: GPL-3.0-or-later 8 | # 9 | # 10 | """ 11 | Python interface to contents of doxygen xml documentation. 12 | 13 | Example use: 14 | See the contents of the example folder for the C++ and 15 | doxygen-generated xml used in this example. 16 | 17 | >>> # Parse the doxygen docs. 18 | >>> import os 19 | >>> this_dir = os.path.dirname(globals()['__file__']) 20 | >>> xml_path = this_dir + "/example/xml/" 21 | >>> di = DoxyIndex(xml_path) 22 | 23 | Get a list of all top-level objects. 24 | 25 | >>> print([mem.name() for mem in di.members()]) 26 | [u'Aadvark', u'aadvarky_enough', u'main'] 27 | 28 | Get all functions. 29 | 30 | >>> print([mem.name() for mem in di.in_category(DoxyFunction)]) 31 | [u'aadvarky_enough', u'main'] 32 | 33 | Check if an object is present. 34 | 35 | >>> di.has_member(u'Aadvark') 36 | True 37 | >>> di.has_member(u'Fish') 38 | False 39 | 40 | Get an item by name and check its properties. 41 | 42 | >>> aad = di.get_member(u'Aadvark') 43 | >>> print(aad.brief_description) 44 | Models the mammal Aadvark. 45 | >>> print(aad.detailed_description) 46 | Sadly the model is incomplete and cannot capture all aspects of an aadvark yet. 47 | 48 | This line is uninformative and is only to test line breaks in the comments. 49 | >>> [mem.name() for mem in aad.members()] 50 | [u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness'] 51 | >>> aad.get_member(u'print').brief_description 52 | u'Outputs the vital aadvark statistics.' 53 | 54 | """ 55 | 56 | from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther 57 | 58 | 59 | def _test(): 60 | import os 61 | this_dir = os.path.dirname(globals()['__file__']) 62 | xml_path = this_dir + "/example/xml/" 63 | di = DoxyIndex(xml_path) 64 | # Get the Aadvark class 65 | aad = di.get_member('Aadvark') 66 | aad.brief_description 67 | import doctest 68 | return doctest.testmod() 69 | 70 | 71 | if __name__ == "__main__": 72 | _test() 73 | -------------------------------------------------------------------------------- /lib/framing_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_FRAMING_IMPL_H 28 | #define INCLUDED_TEMPEST_FRAMING_IMPL_H 29 | 30 | #include 31 | 32 | namespace gr { 33 | namespace tempest { 34 | 35 | class framing_impl : public framing 36 | { 37 | private: 38 | int d_Htotal; 39 | int d_Vtotal; 40 | int d_Hdisplay; 41 | int d_Vdisplay; 42 | int d_current_line; 43 | float * d_zeros; 44 | 45 | public: 46 | framing_impl(int Htotal, int Vtotal, int Hdisplay, int Vdisplay); 47 | ~framing_impl(); 48 | 49 | void set_Htotal_and_Vtotal(int Htotal, int Vtotal); 50 | 51 | // Where all the action really happens 52 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 53 | 54 | int general_work(int noutput_items, 55 | gr_vector_int &ninput_items, 56 | gr_vector_const_void_star &input_items, 57 | gr_vector_void_star &output_items); 58 | }; 59 | 60 | } // namespace tempest 61 | } // namespace gr 62 | 63 | #endif /* INCLUDED_TEMPEST_FRAMING_IMPL_H */ 64 | 65 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/frame_drop.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_FRAME_DROP_H 28 | #define INCLUDED_TEMPEST_FRAME_DROP_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief <+description of block+> 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API frame_drop : virtual public gr::block 42 | { 43 | public: 44 | typedef std::shared_ptr sptr; 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of tempest::frame_drop. 48 | * 49 | * To avoid accidental use of raw pointers, tempest::frame_drop's 50 | * constructor is in a private implementation 51 | * class. tempest::frame_drop::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(int Htotal, int Vtotal, int correct_sampling, float max_deviation, float update_proba, double actual_samp_rate); 55 | }; 56 | 57 | } // namespace tempest 58 | } // namespace gr 59 | 60 | #endif /* INCLUDED_TEMPEST_FRAME_DROP_H */ 61 | 62 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/generated/index.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Generated Mon Feb 9 19:08:05 2009 by generateDS.py. 5 | """ 6 | 7 | from xml.dom import minidom 8 | 9 | import os 10 | import sys 11 | from . import compound 12 | 13 | from . import indexsuper as supermod 14 | 15 | 16 | class DoxygenTypeSub(supermod.DoxygenType): 17 | def __init__(self, version=None, compound=None): 18 | supermod.DoxygenType.__init__(self, version, compound) 19 | 20 | def find_compounds_and_members(self, details): 21 | """ 22 | Returns a list of all compounds and their members which match details 23 | """ 24 | 25 | results = [] 26 | for compound in self.compound: 27 | members = compound.find_members(details) 28 | if members: 29 | results.append([compound, members]) 30 | else: 31 | if details.match(compound): 32 | results.append([compound, []]) 33 | 34 | return results 35 | 36 | 37 | supermod.DoxygenType.subclass = DoxygenTypeSub 38 | # end class DoxygenTypeSub 39 | 40 | 41 | class CompoundTypeSub(supermod.CompoundType): 42 | def __init__(self, kind=None, refid=None, name='', member=None): 43 | supermod.CompoundType.__init__(self, kind, refid, name, member) 44 | 45 | def find_members(self, details): 46 | """ 47 | Returns a list of all members which match details 48 | """ 49 | 50 | results = [] 51 | 52 | for member in self.member: 53 | if details.match(member): 54 | results.append(member) 55 | 56 | return results 57 | 58 | 59 | supermod.CompoundType.subclass = CompoundTypeSub 60 | # end class CompoundTypeSub 61 | 62 | 63 | class MemberTypeSub(supermod.MemberType): 64 | 65 | def __init__(self, kind=None, refid=None, name=''): 66 | supermod.MemberType.__init__(self, kind, refid, name) 67 | 68 | 69 | supermod.MemberType.subclass = MemberTypeSub 70 | # end class MemberTypeSub 71 | 72 | 73 | def parse(inFilename): 74 | 75 | doc = minidom.parse(inFilename) 76 | rootNode = doc.documentElement 77 | rootObj = supermod.DoxygenType.factory() 78 | rootObj.build(rootNode) 79 | 80 | return rootObj 81 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/framing.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | 28 | #ifndef INCLUDED_TEMPEST_FRAMING_H 29 | #define INCLUDED_TEMPEST_FRAMING_H 30 | 31 | #include 32 | #include 33 | 34 | namespace gr { 35 | namespace tempest { 36 | 37 | /*! 38 | * \brief <+description of block+> 39 | * \ingroup tempest 40 | * 41 | */ 42 | class TEMPEST_API framing : virtual public gr::block 43 | { 44 | public: 45 | typedef std::shared_ptr sptr; 46 | 47 | /*! 48 | * \brief Return a shared_ptr to a new instance of tempest::framing. 49 | * 50 | * To avoid accidental use of raw pointers, tempest::framing's 51 | * constructor is in a private implementation 52 | * class. tempest::framing::make is the public interface for 53 | * creating new instances. 54 | */ 55 | static sptr make(int Htotal, int Vtotal, int Hdisplay, int Vdisplay); 56 | 57 | virtual void set_Htotal_and_Vtotal(int Htotal, int Vtotal) = 0; 58 | }; 59 | 60 | } // namespace tempest 61 | } // namespace gr 62 | 63 | #endif /* INCLUDED_TEMPEST_FRAMING_H */ 64 | 65 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/ssamp_correction.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_SSAMP_CORRECTION_H 28 | #define INCLUDED_TEMPEST_SSAMP_CORRECTION_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief <+description of block+> 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API ssamp_correction : virtual public gr::block 42 | { 43 | public: 44 | typedef std::shared_ptr sptr; 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of tempest::ssamp_correction. 48 | * 49 | * To avoid accidental use of raw pointers, tempest::ssamp_correction's 50 | * constructor is in a private implementation 51 | * class. tempest::ssamp_correction::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(int Htotal, int Vtotal, int correct_sampling, float max_deviation); 55 | virtual void set_Htotal_Vtotal(int Htotal, int Vtotal) = 0; 56 | }; 57 | 58 | } // namespace tempest 59 | } // namespace gr 60 | 61 | #endif /* INCLUDED_TEMPEST_SSAMP_CORRECTION_H */ 62 | 63 | -------------------------------------------------------------------------------- /python/tempest/bindings/bind_oot_file.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | import argparse 3 | import os 4 | from gnuradio.bindtool import BindingGenerator 5 | import pathlib 6 | import sys 7 | import tempfile 8 | 9 | parser = argparse.ArgumentParser(description='Bind a GR Out of Tree Block') 10 | parser.add_argument('--module', type=str, 11 | help='Name of gr module containing file to bind (e.g. fft digital analog)') 12 | 13 | parser.add_argument('--output_dir', default=tempfile.gettempdir(), 14 | help='Output directory of generated bindings') 15 | parser.add_argument('--prefix', help='Prefix of Installed GNU Radio') 16 | parser.add_argument('--src', help='Directory of gnuradio source tree', 17 | default=os.path.dirname(os.path.abspath(__file__)) + '/../../..') 18 | 19 | parser.add_argument( 20 | '--filename', help="File to be parsed") 21 | 22 | parser.add_argument( 23 | '--defines', help='Set additional defines for precompiler', default=(), nargs='*') 24 | parser.add_argument( 25 | '--include', help='Additional Include Dirs, separated', default=(), nargs='*') 26 | 27 | parser.add_argument( 28 | '--status', help='Location of output file for general status (used during cmake)', default=None 29 | ) 30 | parser.add_argument( 31 | '--flag_automatic', default='0' 32 | ) 33 | parser.add_argument( 34 | '--flag_pygccxml', default='0' 35 | ) 36 | 37 | args = parser.parse_args() 38 | 39 | prefix = args.prefix 40 | output_dir = args.output_dir 41 | defines = tuple(','.join(args.defines).split(',')) 42 | includes = ','.join(args.include) 43 | name = args.module 44 | 45 | namespace = ['gr', name] 46 | prefix_include_root = name 47 | 48 | 49 | with warnings.catch_warnings(): 50 | warnings.filterwarnings("ignore", category=DeprecationWarning) 51 | 52 | bg = BindingGenerator(prefix, namespace, 53 | prefix_include_root, output_dir, define_symbols=defines, addl_includes=includes, 54 | catch_exceptions=False, write_json_output=False, status_output=args.status, 55 | flag_automatic=True if args.flag_automatic.lower() in [ 56 | '1', 'true'] else False, 57 | flag_pygccxml=True if args.flag_pygccxml.lower() in ['1', 'true'] else False) 58 | bg.gen_file_binding(args.filename) 59 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/fft_peak_fine_sampling_sync.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_FFT_PEAK_FINE_SAMPLING_SYNC_H 28 | #define INCLUDED_TEMPEST_FFT_PEAK_FINE_SAMPLING_SYNC_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief <+description of block+> 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API fft_peak_fine_sampling_sync : virtual public gr::block 42 | { 43 | public: 44 | typedef std::shared_ptr sptr; 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of tempest::fft_peak_fine_sampling_sync. 48 | * 49 | * To avoid accidental use of raw pointers, tempest::fft_peak_fine_sampling_sync's 50 | * constructor is in a private implementation 51 | * class. tempest::fft_peak_fine_sampling_sync::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(int sample_rate, int size, int refresh_rate, int Vvisible, int Hvisible, bool automatic_mode); 55 | }; 56 | 57 | } // namespace tempest 58 | } // namespace gr 59 | 60 | #endif /* INCLUDED_TEMPEST_FFT_PEAK_FINE_SAMPLING_SYNC_H */ 61 | 62 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/infer_screen_resolution.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_INFER_SCREEN_RESOLUTION_H 28 | #define INCLUDED_TEMPEST_INFER_SCREEN_RESOLUTION_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief <+description of block+> 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API infer_screen_resolution : virtual public gr::block 42 | { 43 | public: 44 | typedef std::shared_ptr sptr; 45 | 46 | virtual void set_refresh_rate(float refresh_rate) = 0; 47 | 48 | /*! 49 | * \brief Return a shared_ptr to a new instance of tempest::infer_screen_resolution. 50 | * 51 | * To avoid accidental use of raw pointers, tempest::infer_screen_resolution's 52 | * constructor is in a private implementation 53 | * class. tempest::infer_screen_resolution::make is the public interface for 54 | * creating new instances. 55 | */ 56 | static sptr make(int sample_rate, int fft_size, float refresh_rate, bool automatic_mode); 57 | }; 58 | 59 | } // namespace tempest 60 | } // namespace gr 61 | 62 | #endif /* INCLUDED_TEMPEST_INFER_SCREEN_RESOLUTION_H */ 63 | 64 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/normalize_flow.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_NORMALIZE_FLOW_H 28 | #define INCLUDED_TEMPEST_NORMALIZE_FLOW_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief Normalizes a flow between min and max. To be less CPU-intensive, it randomly chooses when to update the signal's maximum. 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API normalize_flow : virtual public gr::sync_block 42 | { 43 | public: 44 | typedef std::shared_ptr sptr; 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of tempest::normalize_flow. 48 | * 49 | * To avoid accidental use of raw pointers, tempest::normalize_flow's 50 | * constructor is in a private implementation 51 | * class. tempest::normalize_flow::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(float min, float max, int window, float alpha_avg, float update_proba); 55 | 56 | virtual void set_min_max(float min, float max) = 0; 57 | }; 58 | 59 | } // namespace tempest 60 | } // namespace gr 61 | 62 | #endif /* INCLUDED_TEMPEST_NORMALIZE_FLOW_H */ 63 | 64 | -------------------------------------------------------------------------------- /python/tempest/bindings/python_bindings.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | #include 11 | 12 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 13 | #include 14 | 15 | namespace py = pybind11; 16 | 17 | // Headers for binding functions 18 | /**************************************/ 19 | // The following comment block is used for 20 | // gr_modtool to insert function prototypes 21 | // Please do not delete 22 | /**************************************/ 23 | // BINDING_FUNCTION_PROTOTYPES( 24 | void bind_Hsync(py::module& m); 25 | void bind_fft_peak_fine_sampling_sync(py::module& m); 26 | void bind_fine_sampling_synchronization(py::module& m); 27 | void bind_frame_drop(py::module& m); 28 | void bind_framing(py::module& m); 29 | void bind_infer_screen_resolution(py::module& m); 30 | void bind_normalize_flow(py::module& m); 31 | void bind_sampling_synchronization(py::module& m); 32 | void bind_ssamp_correction(py::module& m); 33 | void bind_sync_detector(py::module& m); 34 | // ) END BINDING_FUNCTION_PROTOTYPES 35 | 36 | 37 | // We need this hack because import_array() returns NULL 38 | // for newer Python versions. 39 | // This function is also necessary because it ensures access to the C API 40 | // and removes a warning. 41 | void* init_numpy() 42 | { 43 | import_array(); 44 | return NULL; 45 | } 46 | 47 | PYBIND11_MODULE(tempest_python, m) 48 | { 49 | // Initialize the numpy C API 50 | // (otherwise we will see segmentation faults) 51 | init_numpy(); 52 | 53 | // Allow access to base block methods 54 | py::module::import("gnuradio.gr"); 55 | 56 | /**************************************/ 57 | // The following comment block is used for 58 | // gr_modtool to insert binding function calls 59 | // Please do not delete 60 | /**************************************/ 61 | // BINDING_FUNCTION_CALLS( 62 | bind_Hsync(m); 63 | bind_fft_peak_fine_sampling_sync(m); 64 | bind_fine_sampling_synchronization(m); 65 | bind_frame_drop(m); 66 | bind_framing(m); 67 | bind_infer_screen_resolution(m); 68 | bind_normalize_flow(m); 69 | bind_sampling_synchronization(m); 70 | bind_ssamp_correction(m); 71 | bind_sync_detector(m); 72 | // ) END BINDING_FUNCTION_CALLS 73 | } -------------------------------------------------------------------------------- /python/tempest/message_to_var.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2020 5 | # Federico "Larroca" La Rocca 6 | # 7 | # Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | # Universidad de la Republica, Uruguay. 9 | # 10 | # This is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 3, or (at your option) 13 | # any later version. 14 | # 15 | # This software is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this software; see the file COPYING. If not, write to 22 | # the Free Software Foundation, Inc., 51 Franklin Street, 23 | # Boston, MA 02110-1301, USA. 24 | # 25 | # 26 | 27 | 28 | import numpy 29 | import pmt 30 | from gnuradio import gr 31 | 32 | class message_to_var(gr.sync_block): 33 | """ 34 | docstring for block message_to_var 35 | """ 36 | def __init__(self, callback): 37 | gr.sync_block.__init__(self, 38 | name="message_to_var", 39 | in_sig=None, out_sig=None) 40 | 41 | self.callback = callback 42 | self.message_port_register_in(pmt.intern("port0")) 43 | self.set_msg_handler(pmt.intern("port0"), self.msg_handler_function) 44 | 45 | def work(self, input_items, output_items): 46 | return len(input_items[0]) 47 | 48 | def msg_handler_function(self, msg): 49 | if (pmt.is_pair(msg)): 50 | key = pmt.car(msg) # If is a pair, return the car, otherwise raise wrong_type 51 | val = pmt.cdr(msg) # If is a pair, return the cdr, otherwise raise wrong_type 52 | #(pmt::eq(key, pmt::string_to_symbol("ratio")) 53 | if(pmt.eq(pmt.intern("refresh_rate"),key) or 54 | pmt.eq(pmt.intern("Hvisible"),key) or 55 | pmt.eq(pmt.intern("Hblank"),key) or 56 | pmt.eq(pmt.intern("Vblank"),key) or 57 | pmt.eq(pmt.intern("Vvisible"),key)): 58 | if self.callback: 59 | self.callback(pmt.to_python(val)) 60 | 61 | def stop(self): 62 | return True 63 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/fine_sampling_synchronization.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | 28 | #ifndef INCLUDED_TEMPEST_FINE_SAMPLING_SYNCHRONIZATION_H 29 | #define INCLUDED_TEMPEST_FINE_SAMPLING_SYNCHRONIZATION_H 30 | 31 | #include 32 | #include 33 | 34 | namespace gr { 35 | namespace tempest { 36 | 37 | /*! 38 | * \brief <+description of block+> 39 | * \ingroup tempest 40 | * 41 | */ 42 | class TEMPEST_API fine_sampling_synchronization : virtual public gr::block 43 | { 44 | public: 45 | 46 | typedef std::shared_ptr sptr; 47 | 48 | /*! 49 | * \brief Return a shared_ptr to a new instance of tempest::fine_sampling_synchronization. 50 | * 51 | * To avoid accidental use of raw pointers, tempest::fine_sampling_synchronization's 52 | * constructor is in a private implementation 53 | * class. tempest::fine_sampling_synchronization::make is the public interface for 54 | * creating new instances. 55 | */ 56 | static sptr make(int Htotal, int Vtotal, int correct_sampling, float max_deviation, float update_proba); 57 | 58 | virtual void set_Htotal_Vtotal(int Htotal, int Vtotal) = 0; 59 | }; 60 | 61 | } // namespace tempest 62 | } // namespace gr 63 | 64 | #endif /* INCLUDED_TEMPEST_FINE_SAMPLING_SYNCHRONIZATION_H */ 65 | 66 | 67 | -------------------------------------------------------------------------------- /include/gnuradio/tempest/sampling_synchronization.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_SAMPLING_SYNCHRONIZATION_H 28 | #define INCLUDED_TEMPEST_SAMPLING_SYNCHRONIZATION_H 29 | 30 | #include 31 | #include 32 | 33 | namespace gr { 34 | namespace tempest { 35 | 36 | /*! 37 | * \brief It correlates the signal and estimates what's the most probable line length. It then corrects the sampling rate so that the line length's is Htotal. 38 | * \ingroup tempest 39 | * 40 | */ 41 | class TEMPEST_API sampling_synchronization : virtual public gr::block 42 | { 43 | public: 44 | typedef std::shared_ptr sptr; 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of tempest::sampling_synchronization. 48 | * 49 | * To avoid accidental use of raw pointers, tempest::sampling_synchronization's 50 | * constructor is in a private implementation 51 | * class. tempest::sampling_synchronization::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(int Htotal, double manual_correction); 55 | 56 | virtual void set_Htotal(int Htotal) = 0; 57 | 58 | virtual void set_manual_correction(double correction) = 0; 59 | 60 | }; 61 | 62 | } // namespace tempest 63 | } // namespace gr 64 | 65 | #endif /* INCLUDED_TEMPEST_SAMPLING_SYNCHRONIZATION_H */ 66 | 67 | -------------------------------------------------------------------------------- /lib/normalize_flow_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | 7 | * 8 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 9 | * Universidad de la Republica, Uruguay. 10 | * 11 | * This is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 3, or (at your option) 14 | * any later version. 15 | * 16 | * This software is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this software; see the file COPYING. If not, write to 23 | * the Free Software Foundation, Inc., 51 Franklin Street, 24 | * Boston, MA 02110-1301, USA. 25 | * 26 | */ 27 | 28 | #ifndef INCLUDED_TEMPEST_NORMALIZE_FLOW_IMPL_H 29 | #define INCLUDED_TEMPEST_NORMALIZE_FLOW_IMPL_H 30 | 31 | #include 32 | #include 33 | 34 | namespace gr { 35 | namespace tempest { 36 | 37 | class normalize_flow_impl : public normalize_flow 38 | { 39 | private: 40 | float d_min; 41 | float d_max; 42 | int d_win; 43 | float d_alpha_avg; 44 | 45 | float d_current_max; 46 | float d_current_min; 47 | 48 | float * d_minus_datain; 49 | 50 | float compute_max(const float * datain, const int datain_length); 51 | 52 | // to accelerate the process, I'll only update the interpolation 53 | // once every a random number of iterations with probability d_portion 54 | std::uniform_real_distribution d_dist; 55 | std::minstd_rand d_gen; 56 | float d_proba_of_updating; 57 | 58 | public: 59 | normalize_flow_impl(float min, float max, int window, float alpha_avg, float update_proba); 60 | ~normalize_flow_impl(); 61 | 62 | // Where all the action really happens 63 | int work(int noutput_items, 64 | gr_vector_const_void_star &input_items, 65 | gr_vector_void_star &output_items); 66 | 67 | void set_min_max(float min, float max); 68 | 69 | }; 70 | 71 | } // namespace tempest 72 | } // namespace gr 73 | 74 | #endif /* INCLUDED_TEMPEST_NORMALIZE_FLOW_IMPL_H */ 75 | 76 | -------------------------------------------------------------------------------- /grc/tempest_tempest_msgbtn.block.yml: -------------------------------------------------------------------------------- 1 | id: tempest_tempest_msgbtn 2 | label: GUI Button - Message Passer 3 | category: '[Tempest]' 4 | flags: [ show_id, python ] 5 | 6 | parameters: 7 | - id: label 8 | label: Label 9 | dtype: string 10 | hide: ${ ('none' if label else 'part') } 11 | - id: type 12 | label: Type 13 | dtype: enum 14 | default: bool 15 | options: [real, int, string, bool] 16 | option_labels: [Float, Integer, String, Boolean] 17 | option_attributes: 18 | conv: [float, int, str, bool] 19 | hide: part 20 | - id: msgName 21 | label: Message Property Name 22 | dtype: string 23 | default: 'pressed' 24 | - id: value 25 | label: Message Value 26 | dtype: ${ type } 27 | default: '1' 28 | - id: relBackgroundColor 29 | label: Button Background 30 | dtype: enum 31 | default: 'default' 32 | options: ['default', 'silver', 'gray', 'black', 'white', 'red', 'green', 'blue', 'navy', 'yellow', 'orange', 'purple', 'lime', 'aqua', 'teal'] 33 | option_labels: ['default', 'silver', 'gray', 'black', 'white', 'red', 'green', 'blue', 'navy', 'yellow', 'orange', 'purple', 'lime', 'aqua', 'teal'] 34 | hide: 'part' 35 | - id: relFontColor 36 | label: Button Font Color 37 | dtype: enum 38 | default: 'default' 39 | options: ['default', 'silver', 'gray', 'black', 'white', 'red', 'green', 'blue', 'navy', 'yellow', 'orange', 'purple', 'lime', 'aqua', 'teal'] 40 | option_labels: ['default', 'silver', 'gray', 'black', 'white', 'red', 'green', 'blue', 'navy', 'yellow', 'orange', 'purple', 'lime', 'aqua', 'teal'] 41 | hide: 'part' 42 | - id: gui_hint 43 | label: GUI Hint 44 | dtype: gui_hint 45 | hide: part 46 | 47 | outputs: 48 | - domain: message 49 | id: pressed 50 | optional: false 51 | 52 | templates: 53 | imports: import tempest 54 | var_make: self.${id} = None 55 | make: |- 56 | <% 57 | win = '_%s_toggle_button'%id 58 | %>\ 59 | ${win} = tempest.tempest_msgbtn(${(label if (len(label) - 2 > 0) else repr(id))}, ${msgName},${value},"${relBackgroundColor}","${relFontColor}") 60 | self.${id} = ${win} 61 | ${gui_hint() % win} 62 | 63 | 64 | documentation: |- 65 | This block creates a variable push button that creates a message when clicked. Leave the label blank to use the variable id as the label. 66 | You can define both the output message pmt name as well as the value and value type. 67 | The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional. 68 | file_format: 1 69 | -------------------------------------------------------------------------------- /python/tempest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Include python install macros 11 | ######################################################################## 12 | include(GrPython) 13 | if(NOT PYTHONINTERP_FOUND) 14 | return() 15 | endif() 16 | 17 | add_subdirectory(bindings) 18 | 19 | ######################################################################## 20 | # Install python sources 21 | ######################################################################## 22 | GR_PYTHON_INSTALL( 23 | FILES 24 | __init__.py 25 | tempest_msgbtn.py 26 | message_to_var.py 27 | image_source.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/tempest 28 | ) 29 | 30 | ######################################################################## 31 | # Handle the unit tests 32 | ######################################################################## 33 | include(GrTest) 34 | 35 | set(GR_TEST_TARGET_DEPS gnuradio-tempest) 36 | 37 | # Create a package directory that tests can import. It includes everything 38 | # from `python/`. 39 | add_custom_target( 40 | copy_module_for_tests ALL 41 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} 42 | ${CMAKE_BINARY_DIR}/test_modules/gnuradio/tempest/ 43 | ) 44 | GR_ADD_TEST(qa_fft_peak_fine_sampling_sync ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_fft_peak_fine_sampling_sync.py) 45 | GR_ADD_TEST(qa_fine_sampling_synchronization ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_fine_sampling_synchronization.py) 46 | GR_ADD_TEST(qa_frame_drop ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_frame_drop.py) 47 | GR_ADD_TEST(qa_framing ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_framing.py) 48 | GR_ADD_TEST(qa_infer_screen_resolution ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_infer_screen_resolution.py) 49 | GR_ADD_TEST(qa_normalize_flow ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_normalize_flow.py) 50 | GR_ADD_TEST(qa_sampling_synchronization ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_sampling_synchronization.py) 51 | GR_ADD_TEST(qa_ssamp_correction ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_ssamp_correction.py) 52 | GR_ADD_TEST(qa_sync_detector ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_sync_detector.py) 53 | GR_ADD_TEST(qa_tempest_msgbtn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_tempest_msgbtn.py) 54 | GR_ADD_TEST(qa_message_to_var ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_message_to_var.py) 55 | GR_ADD_TEST(qa_image_source ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_image_source.py) 56 | -------------------------------------------------------------------------------- /python/tempest/tempest_msgbtn.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2020 5 | # Federico "Larroca" La Rocca 6 | # 7 | # Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | # Universidad de la Republica, Uruguay. 9 | # 10 | # This is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 3, or (at your option) 13 | # any later version. 14 | # 15 | # This software is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this software; see the file COPYING. If not, write to 22 | # the Free Software Foundation, Inc., 51 Franklin Street, 23 | # Boston, MA 02110-1301, USA. 24 | # 25 | # 26 | 27 | from PyQt5 import Qt 28 | from gnuradio import gr 29 | import pmt 30 | 31 | class tempest_msgbtn(gr.sync_block, Qt.QPushButton): 32 | """ 33 | docstring for block tempest_msgbtn 34 | this was developed by ghostop14 35 | https://github.com/ghostop14/gr-guiextra/blob/maint-3.8/python/msgpushbutton.py 36 | """ 37 | def __init__(self, lbl, msgName, msgValue, relBackColor, relFontColor): 38 | gr.sync_block.__init__(self, name = "tempest_msgbtn", in_sig = None, out_sig = None) 39 | Qt.QPushButton.__init__(self,lbl) 40 | 41 | self.lbl = lbl 42 | self.msgName = msgName 43 | self.msgValue = msgValue 44 | 45 | styleStr = "" 46 | if (relBackColor != 'default'): 47 | styleStr = "background-color: " + relBackColor + "; " 48 | 49 | if (relFontColor): 50 | styleStr += "color: " + relFontColor + "; " 51 | 52 | self.setStyleSheet(styleStr) 53 | 54 | self.clicked[bool].connect(self.onBtnClicked) 55 | 56 | self.message_port_register_out(pmt.intern("pressed")) 57 | 58 | def onBtnClicked(self, pressed): 59 | if type(self.msgValue) == int: 60 | self.message_port_pub(pmt.intern("pressed"),pmt.cons( pmt.intern(self.msgName), pmt.from_long(self.msgValue) )) 61 | elif type(self.msgValue) == float: 62 | self.message_port_pub(pmt.intern("pressed"),pmt.cons( pmt.intern(self.msgName), pmt.from_float(self.msgValue) )) 63 | elif type(self.msgValue) == str: 64 | self.message_port_pub(pmt.intern("pressed"),pmt.cons( pmt.intern(self.msgName), pmt.intern(self.msgValue) )) 65 | elif type(self.msgValue) == bool: 66 | self.message_port_pub(pmt.intern("pressed"),pmt.cons( pmt.intern(self.msgName), pmt.from_bool(self.msgValue) )) 67 | 68 | -------------------------------------------------------------------------------- /python/tempest/bindings/header_utils.py: -------------------------------------------------------------------------------- 1 | # Utilities for reading values in header files 2 | 3 | from argparse import ArgumentParser 4 | import re 5 | 6 | 7 | class PybindHeaderParser: 8 | def __init__(self, pathname): 9 | with open(pathname, 'r') as f: 10 | self.file_txt = f.read() 11 | 12 | def get_flag_automatic(self): 13 | # p = re.compile(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)') 14 | # m = p.search(self.file_txt) 15 | m = re.search(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)', self.file_txt) 16 | if (m and m.group(1) == '1'): 17 | return True 18 | else: 19 | return False 20 | 21 | def get_flag_pygccxml(self): 22 | # p = re.compile(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)') 23 | # m = p.search(self.file_txt) 24 | m = re.search(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)', self.file_txt) 25 | if (m and m.group(1) == '1'): 26 | return True 27 | else: 28 | return False 29 | 30 | def get_header_filename(self): 31 | # p = re.compile(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)') 32 | # m = p.search(self.file_txt) 33 | m = re.search(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)', self.file_txt) 34 | if (m): 35 | return m.group(1) 36 | else: 37 | return None 38 | 39 | def get_header_file_hash(self): 40 | # p = re.compile(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)') 41 | # m = p.search(self.file_txt) 42 | m = re.search(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)', self.file_txt) 43 | if (m): 44 | return m.group(1) 45 | else: 46 | return None 47 | 48 | def get_flags(self): 49 | return f'{self.get_flag_automatic()};{self.get_flag_pygccxml()};{self.get_header_filename()};{self.get_header_file_hash()};' 50 | 51 | 52 | def argParse(): 53 | """Parses commandline args.""" 54 | desc = 'Reads the parameters from the comment block in the pybind files' 55 | parser = ArgumentParser(description=desc) 56 | 57 | parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=[ 58 | "flag_auto", "flag_pygccxml", "header_filename", "header_file_hash", "all"]) 59 | parser.add_argument( 60 | "pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc") 61 | 62 | return parser.parse_args() 63 | 64 | 65 | if __name__ == "__main__": 66 | # Parse command line options and set up doxyxml. 67 | args = argParse() 68 | 69 | pbhp = PybindHeaderParser(args.pathname) 70 | 71 | if args.function == "flag_auto": 72 | print(pbhp.get_flag_automatic()) 73 | elif args.function == "flag_pygccxml": 74 | print(pbhp.get_flag_pygccxml()) 75 | elif args.function == "header_filename": 76 | print(pbhp.get_header_filename()) 77 | elif args.function == "header_file_hash": 78 | print(pbhp.get_header_file_hash()) 79 | elif args.function == "all": 80 | print(pbhp.get_flags()) 81 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012,2016,2018,2019 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Setup library 11 | ######################################################################## 12 | include(GrPlatform) #define LIB_SUFFIX 13 | list(APPEND tempest_sources 14 | Hsync_impl.cc 15 | fft_peak_fine_sampling_sync_impl.cc 16 | fine_sampling_synchronization_impl.cc 17 | frame_drop_impl.cc 18 | framing_impl.cc 19 | infer_screen_resolution_impl.cc 20 | normalize_flow_impl.cc 21 | sampling_synchronization_impl.cc 22 | ssamp_correction_impl.cc 23 | sync_detector_impl.cc ) 24 | 25 | set(tempest_sources "${tempest_sources}" PARENT_SCOPE) 26 | if(NOT tempest_sources) 27 | MESSAGE(STATUS "No C++ sources... skipping lib/") 28 | return() 29 | endif(NOT tempest_sources) 30 | 31 | add_library(gnuradio-tempest SHARED ${tempest_sources}) 32 | target_link_libraries(gnuradio-tempest gnuradio::gnuradio-runtime gnuradio::gnuradio-blocks gnuradio::gnuradio-fft gnuradio::gnuradio-filter Volk::volk) 33 | target_include_directories(gnuradio-tempest 34 | PUBLIC $ 35 | PUBLIC $ 36 | ) 37 | set_target_properties(gnuradio-tempest PROPERTIES DEFINE_SYMBOL "gnuradio_tempest_EXPORTS") 38 | 39 | if(APPLE) 40 | set_target_properties(gnuradio-tempest PROPERTIES 41 | INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" 42 | ) 43 | endif(APPLE) 44 | 45 | ######################################################################## 46 | # Install built library files 47 | ######################################################################## 48 | include(GrMiscUtils) 49 | GR_LIBRARY_FOO(gnuradio-tempest) 50 | 51 | ######################################################################## 52 | # Print summary 53 | ######################################################################## 54 | message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") 55 | message(STATUS "Building for version: ${VERSION} / ${LIBVER}") 56 | 57 | ######################################################################## 58 | # Build and register unit test 59 | ######################################################################## 60 | include(GrTest) 61 | 62 | # If your unit tests require special include paths, add them here 63 | #include_directories() 64 | # List all files that contain Boost.UTF unit tests here 65 | list(APPEND test_tempest_sources 66 | ) 67 | # Anything we need to link to for the unit tests go here 68 | list(APPEND GR_TEST_TARGET_DEPS gnuradio-tempest) 69 | 70 | if(NOT test_tempest_sources) 71 | MESSAGE(STATUS "No C++ unit tests... skipping") 72 | return() 73 | endif(NOT test_tempest_sources) 74 | 75 | foreach(qa_file ${test_tempest_sources}) 76 | GR_ADD_CPP_TEST("tempest_${qa_file}" 77 | ${CMAKE_CURRENT_SOURCE_DIR}/${qa_file} 78 | ) 79 | endforeach(qa_file) 80 | -------------------------------------------------------------------------------- /python/tempest/image_source.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2015,2016 Chris Kuethe 5 | 6 | # Copyright 2020 (minor changes to generate blanking) 7 | # Federico "Larroca" La Rocca 8 | # 9 | # Instituto de Ingenieria Electrica, Facultad de Ingenieria, 10 | # Universidad de la Republica, Uruguay. 11 | # 12 | # This is free software; you can redistribute it and/or modify 13 | # it under the terms of the GNU General Public License as published by 14 | # the Free Software Foundation; either version 3, or (at your option) 15 | # any later version. 16 | # 17 | # This software is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | # GNU General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU General Public License 23 | # along with this software; see the file COPYING. If not, write to 24 | # the Free Software Foundation, Inc., 51 Franklin Street, 25 | # Boston, MA 02110-1301, USA. 26 | # 27 | # 28 | 29 | import numpy 30 | from gnuradio import gr 31 | from PIL import Image 32 | from PIL import ImageOps 33 | 34 | class image_source(gr.sync_block): 35 | """ 36 | Given an image file readable by Python-Imaging, this block 37 | produces a superposition of the three colors, plus the blanking around it 38 | (and scales it to match the desired resolution). 39 | """ 40 | 41 | image_file = None 42 | repeatmode = 1 43 | image_data = None 44 | 45 | def __init__(self, image_file, Hvisible, Vvisible, Htotal, Vtotal, repeatmode): 46 | gr.sync_block.__init__(self, 47 | name="image_source", 48 | in_sig=None, 49 | out_sig=[numpy.float32]) 50 | 51 | self.image_file = image_file 52 | self.repeatmode = repeatmode 53 | self.Vvisible = Vvisible 54 | self.Hvisible = Hvisible 55 | self.Htotal = Htotal 56 | self.Vtotal = Vtotal 57 | self.Hblanking = (Htotal - Hvisible)//2 58 | self.Vblanking = (Vtotal - Vvisible)//2 59 | self.load_image() 60 | 61 | def load_image(self): 62 | """decode the image into a buffer""" 63 | self.image_data = Image.open(self.image_file) 64 | self.image_data = ImageOps.grayscale(self.image_data) 65 | 66 | 67 | newsize = (self.Hvisible, self.Vvisible) 68 | self.image_data = self.image_data.resize(newsize) 69 | 70 | # I create the blanking 71 | background = Image.new('F', (self.Htotal, self.Vtotal), (0)) 72 | # I paste the image with the blankins 73 | offset = (self.Hblanking, self.Vblanking) 74 | background.paste(self.image_data, offset) 75 | self.image_data = background 76 | 77 | (self.image_width, self.image_height) = self.image_data.size 78 | 79 | self.set_output_multiple(self.image_width) 80 | 81 | self.image_data = list(self.image_data.getdata()) 82 | self.image_len = len(self.image_data) 83 | self.line_num = 0 84 | 85 | 86 | def work(self, input_items, output_items): 87 | out = output_items[0] 88 | out[:self.image_width] = self.image_data[self.image_width*self.line_num: self.image_width*(1+self.line_num)] 89 | 90 | self.line_num += 1 91 | if self.line_num >= self.image_height: 92 | self.line_num = 0 93 | 94 | if self.repeatmode == 2: 95 | self.load_image() 96 | return self.image_width 97 | 98 | -------------------------------------------------------------------------------- /lib/sampling_synchronization_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | 7 | * 8 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 9 | * Universidad de la Republica, Uruguay. 10 | * 11 | * This is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 3, or (at your option) 14 | * any later version. 15 | * 16 | * This software is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this software; see the file COPYING. If not, write to 23 | * the Free Software Foundation, Inc., 51 Franklin Street, 24 | * Boston, MA 02110-1301, USA. 25 | * 26 | */ 27 | 28 | #ifndef INCLUDED_TEMPEST_SAMPLING_SYNCHRONIZATION_IMPL_H 29 | #define INCLUDED_TEMPEST_SAMPLING_SYNCHRONIZATION_IMPL_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace gr { 36 | namespace tempest { 37 | 38 | class sampling_synchronization_impl : public sampling_synchronization 39 | { 40 | private: 41 | int d_Htotal; 42 | //the number of lines to consider for correlation 43 | int d_no_of_lines_for_corr; 44 | // the maximum number of pixels I'll search for the peak 45 | int d_max_deviation_px; 46 | // the maximum number of pixels I'll search for the peak in percentaje 47 | float d_max_deviation; 48 | // the estimated interpolation I'd have to use to have a correct sampling - 1 49 | double d_samp_inc_remainder; 50 | // a manual correction assigned by the user at run-time 51 | double d_samp_inc_correction; 52 | double d_samp_phase; 53 | float d_new_interpolation_ratio; 54 | 55 | float d_alpha_samp_inc; 56 | 57 | // to accelerate the process, I'll only update the interpolation 58 | // once every a random number of iterations with probability d_portion 59 | std::uniform_real_distribution d_dist; 60 | std::minstd_rand d_gen; 61 | float d_proba_of_updating; 62 | 63 | 64 | // the correlation 65 | gr_complex * d_historic_corr; 66 | float * d_abs_historic_corr; 67 | gr_complex * d_current_corr; 68 | gr_complex * d_in_conj; 69 | float d_alpha_corr; 70 | 71 | // the interpolating filter 72 | gr::filter::mmse_fir_interpolator_cc d_inter; 73 | 74 | void update_interpolation_ratio(const float * datain, const int datain_length); 75 | 76 | int interpolate_input(const gr_complex * in, gr_complex * out, int size); 77 | 78 | public: 79 | sampling_synchronization_impl(int Htotal, double manual_correction); 80 | ~sampling_synchronization_impl(); 81 | 82 | void set_Htotal(int Htotal); 83 | 84 | void set_manual_correction(double correction); 85 | 86 | // Where all the action really happens 87 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 88 | 89 | int general_work(int noutput_items, 90 | gr_vector_int &ninput_items, 91 | gr_vector_const_void_star &input_items, 92 | gr_vector_void_star &output_items); 93 | 94 | }; 95 | 96 | } // namespace tempest 97 | } // namespace gr 98 | 99 | #endif /* INCLUDED_TEMPEST_SAMPLING_SYNCHRONIZATION_IMPL_H */ 100 | 101 | -------------------------------------------------------------------------------- /lib/sync_detector_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2021 gr-tempest 4 | * Pablo Bertrand 5 | * Felipe Carrau 6 | * Victoria Severi 7 | * Adapted to 3.10 by Santiago Fernandez 8 | 9 | * 10 | * Instituto de Ingeniería Eléctrica, Facultad de Ingeniería, 11 | * Universidad de la República, Uruguay. 12 | * 13 | * This software is based on Martin Marinov's TempestSDR. 14 | * In particular, gaussianblur() function is entirely his, and 15 | * find_best_beta and find_shift are implementations of 16 | * findbestfit and findthesweetspot, respectively. 17 | * 18 | * This is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU General Public License as published by 20 | * the Free Software Foundation; either version 3, or (at your option) 21 | * any later version. 22 | * 23 | * This software is distributed in the hope that it will be useful, 24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | * GNU General Public License for more details. 27 | * 28 | * You should have received a copy of the GNU General Public License 29 | * along with this software; see the file COPYING. If not, write to 30 | * the Free Software Foundation, Inc., 51 Franklin Street, 31 | * Boston, MA 02110-1301, USA. 32 | */ 33 | 34 | #ifndef INCLUDED_SYNC_DETECTOR_IMPL_H 35 | #define INCLUDED_SYNC_DETECTOR_IMPL_H 36 | 37 | #include 38 | 39 | namespace gr { 40 | namespace tempest { 41 | 42 | class sync_detector_impl : public sync_detector 43 | { 44 | private: 45 | //Input data 46 | int d_hdisplay; 47 | int d_vdisplay; 48 | int d_hblanking; 49 | int d_vblanking; 50 | int d_Htotal; 51 | int d_Vtotal; 52 | 53 | //Blanking variables 54 | int d_blanking_size_h; 55 | int d_blanking_size_v; 56 | int d_blanking_index_h; 57 | int d_blanking_index_v; 58 | int d_working_index_h; 59 | 60 | //Flags 61 | int d_frame_average_complete; 62 | int d_frame_wait_for_blanking; 63 | int d_frame_output; 64 | 65 | 66 | //Counters 67 | int d_frame_height_counter; 68 | int d_blanking_wait_counter; 69 | int d_output_counter; 70 | 71 | // Control flag, and its mutex 72 | gr::thread::mutex d_mutex; 73 | bool d_start_sync_detect; 74 | 75 | //Arrays 76 | float * d_data_h; 77 | float * d_avg_h_line; 78 | float * d_avg_v_line; 79 | 80 | //Functions 81 | void find_best_beta (const float *data, const int total_line_size, const double total_sum, const int blanking_size, double *beta, int *beta_index); 82 | void find_shift (int *blanking_index, int *blanking_size, float *data, const int total_line_size, int min_blanking_size, double lowpasscoeff); 83 | void gaussianblur(float * data, int size); 84 | float calculate_gauss_coeff(float N, float i); 85 | void set_ena_msg(pmt::pmt_t msg); 86 | 87 | //Fixed parameters 88 | float d_LOWPASS_COEFF_V; 89 | float d_LOWPASS_COEFF_H; 90 | float d_GAUSSIAN_ALPHA; 91 | 92 | public: 93 | sync_detector_impl(int hscreen, int vscreen, int hblanking, int vblanking); 94 | ~sync_detector_impl(); 95 | 96 | // Where all the action really happens 97 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 98 | 99 | int general_work(int noutput_items, 100 | gr_vector_int &ninput_items, 101 | gr_vector_const_void_star &input_items, 102 | gr_vector_void_star &output_items); 103 | 104 | }; 105 | 106 | } // namespace sync_detector 107 | } // namespace gr 108 | 109 | #endif /* INCLUDED_SYNC_DETECTOR_IMPL_H */ 110 | -------------------------------------------------------------------------------- /lib/fine_sampling_synchronization_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifndef INCLUDED_TEMPEST_FINE_SAMPLING_SYNCHRONIZATION_IMPL_H 28 | #define INCLUDED_TEMPEST_FINE_SAMPLING_SYNCHRONIZATION_IMPL_H 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | namespace gr { 35 | namespace tempest { 36 | 37 | class fine_sampling_synchronization_impl : public fine_sampling_synchronization 38 | { 39 | private: 40 | int d_Htotal; 41 | int d_Vtotal; 42 | int d_correct_sampling; 43 | float d_max_deviation; 44 | 45 | // to accelerate the process, I'll only update the interpolation 46 | // once every a random number of iterations with probability d_proba_of_updating 47 | std::geometric_distribution d_dist; 48 | std::minstd_rand d_gen; 49 | float d_proba_of_updating; 50 | int d_next_update; 51 | 52 | double d_samp_inc_rem; 53 | double d_new_interpolation_ratio_rem; 54 | double d_samp_phase; 55 | 56 | float d_alpha_samp_inc; 57 | int d_max_deviation_px; 58 | 59 | // correlation with the last line 60 | gr_complex * d_current_line_corr; 61 | gr_complex * d_historic_line_corr; 62 | float * d_abs_historic_line_corr; 63 | // correlation with the last frame 64 | gr_complex * d_current_frame_corr; 65 | gr_complex * d_historic_frame_corr; 66 | float * d_abs_historic_frame_corr; 67 | 68 | // where is the line correlation peak 69 | int d_peak_line_index; 70 | 71 | float d_alpha_corr; 72 | 73 | // the interpolating filter 74 | gr::filter::mmse_fir_interpolator_cc d_inter; 75 | 76 | int interpolate_input(const gr_complex * in, gr_complex * out, int size); 77 | 78 | void update_interpolation_ratio(const gr_complex * in, int in_size); 79 | 80 | void estimate_peak_line_index(const gr_complex * in, int in_size); 81 | 82 | public: 83 | fine_sampling_synchronization_impl(int Htotal, int Vtotal, int correct_sampling, float max_deviation, float update_proba); 84 | ~fine_sampling_synchronization_impl(); 85 | 86 | void set_Htotal_Vtotal(int Htotal, int Vtotal); 87 | 88 | // Where all the action really happens 89 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 90 | 91 | int general_work(int noutput_items, 92 | gr_vector_int &ninput_items, 93 | gr_vector_const_void_star &input_items, 94 | gr_vector_void_star &output_items); 95 | }; 96 | 97 | } // namespace tempest 98 | } // namespace gr 99 | 100 | #endif /* INCLUDED_TEMPEST_FINE_SAMPLING_SYNCHRONIZATION_IMPL_H */ 101 | 102 | 103 | -------------------------------------------------------------------------------- /lib/ssamp_correction_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | 7 | * 8 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 9 | * Universidad de la Republica, Uruguay. 10 | * 11 | * This is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 3, or (at your option) 14 | * any later version. 15 | * 16 | * This software is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this software; see the file COPYING. If not, write to 23 | * the Free Software Foundation, Inc., 51 Franklin Street, 24 | * Boston, MA 02110-1301, USA. 25 | * 26 | */ 27 | 28 | #ifndef INCLUDED_TEMPEST_SSAMP_CORRECTION_IMPL_H 29 | #define INCLUDED_TEMPEST_SSAMP_CORRECTION_IMPL_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace gr { 36 | namespace tempest { 37 | 38 | class ssamp_correction_impl : public ssamp_correction 39 | { 40 | private: 41 | int d_Htotal; 42 | int d_Vtotal; 43 | int d_correct_sampling; 44 | float d_max_deviation; 45 | //Counters 46 | int d_frame_height_counter; 47 | int d_frames_counter; 48 | 49 | //Fixed parameter 50 | int d_discarded_amount_per_frame; 51 | 52 | 53 | 54 | // to accelerate the process, I'll only update the interpolation 55 | // once every a random number of iterations with probability d_proba_of_updating 56 | std::geometric_distribution d_dist; 57 | std::minstd_rand d_gen; 58 | 59 | int d_next_update; 60 | int d_required_for_interpolation; 61 | 62 | double d_samp_inc_rem; 63 | double d_new_interpolation_ratio_rem; 64 | double d_samp_phase; 65 | 66 | float d_alpha_samp_inc; 67 | int d_max_deviation_px; 68 | 69 | // correlation with the last line 70 | 71 | gr_complex * d_current_line_corr; 72 | gr_complex * d_historic_line_corr; 73 | float * d_abs_historic_line_corr; 74 | 75 | // correlation with the last frame 76 | 77 | gr_complex * d_current_frame_corr; 78 | gr_complex * d_historic_frame_corr; 79 | float * d_abs_historic_frame_corr; 80 | 81 | bool d_stop_fine_sampling_synch; 82 | // where is the line correlation peak 83 | int d_peak_line_index; 84 | 85 | float d_alpha_corr; 86 | 87 | // the interpolating filter 88 | gr::filter::mmse_fir_interpolator_cc d_inter; 89 | 90 | int interpolate_input(const gr_complex * in, gr_complex * out, int size); 91 | 92 | void update_interpolation_ratio(const gr_complex * in, int in_size); 93 | 94 | void estimate_peak_line_index(const gr_complex * in, int in_size); 95 | 96 | void set_iHsize_msg(pmt::pmt_t msg); 97 | 98 | void set_Vsize_msg(pmt::pmt_t msg); 99 | 100 | 101 | void set_ena_msg(pmt::pmt_t msg); 102 | gr::thread::mutex d_mutex; 103 | void set_ratio_msg(pmt::pmt_t msg); 104 | 105 | public: 106 | ssamp_correction_impl(int Htotal, int Vtotal, int correct_sampling, float max_deviation); 107 | ~ssamp_correction_impl(); 108 | 109 | 110 | void set_Htotal_Vtotal(int Htotal, int Vtotal) override; // Asynch Callback see: tempest_ssamp_correction.block.yml 111 | 112 | // Where all the action really happens 113 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 114 | 115 | int general_work(int noutput_items, 116 | gr_vector_int &ninput_items, 117 | gr_vector_const_void_star &input_items, 118 | gr_vector_void_star &output_items); 119 | 120 | }; 121 | 122 | } // namespace tempest 123 | } // namespace gr 124 | 125 | #endif /* INCLUDED_TEMPEST_SSAMP_CORRECTION_IMPL_H */ 126 | 127 | -------------------------------------------------------------------------------- /lib/normalize_flow_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | 7 | * 8 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 9 | * Universidad de la Republica, Uruguay. 10 | * 11 | * This is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 3, or (at your option) 14 | * any later version. 15 | * 16 | * This software is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this software; see the file COPYING. If not, write to 23 | * the Free Software Foundation, Inc., 51 Franklin Street, 24 | * Boston, MA 02110-1301, USA. 25 | * 26 | */ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include 33 | #include "normalize_flow_impl.h" 34 | #include 35 | 36 | namespace gr { 37 | namespace tempest { 38 | 39 | normalize_flow::sptr 40 | normalize_flow::make(float min, float max, int window, float alpha_avg, float update_proba) 41 | { 42 | return gnuradio::get_initial_sptr 43 | (new normalize_flow_impl(min, max, window, alpha_avg, update_proba)); 44 | } 45 | 46 | /* 47 | * The private constructor 48 | */ 49 | normalize_flow_impl::normalize_flow_impl(float min, float max, int window, float alpha_avg, float update_proba) 50 | : gr::sync_block("normalize_flow", 51 | gr::io_signature::make(1, 1, sizeof(float)), 52 | gr::io_signature::make(1, 1, sizeof(float))), 53 | d_dist(0, 1), 54 | d_gen(std::random_device{}()) 55 | { 56 | d_min = min; 57 | d_max = max; 58 | d_win = window; 59 | d_alpha_avg = alpha_avg; 60 | 61 | set_output_multiple(d_win); 62 | 63 | d_current_max = d_max; 64 | d_current_min = d_min; 65 | 66 | d_proba_of_updating = update_proba; 67 | } 68 | 69 | void normalize_flow_impl::set_min_max(float min, float max){ 70 | d_min = min; 71 | d_max = max; 72 | printf("[TEMPEST] setting min and max to %f and %f in the normalize flow block.\n",min, max); 73 | } 74 | 75 | float normalize_flow_impl::compute_max(const float * datain, const int datain_length){ 76 | uint16_t peak_index = 0; 77 | uint32_t d_datain_length = (uint32_t)datain_length; 78 | 79 | volk_32f_index_max_16u(&peak_index, &datain[0], d_datain_length); 80 | return datain[peak_index]; 81 | 82 | } 83 | 84 | /* 85 | * Our virtual destructor. 86 | */ 87 | normalize_flow_impl::~normalize_flow_impl() 88 | { 89 | } 90 | 91 | int 92 | normalize_flow_impl::work(int noutput_items, 93 | gr_vector_const_void_star &input_items, 94 | gr_vector_void_star &output_items) 95 | { 96 | const float *in = (const float *) input_items[0]; 97 | float *out = (float *) output_items[0]; 98 | 99 | 100 | 101 | if(d_dist(d_gen). 4 | * Adapted to 3.10 by Santiago Fernandez 5 | 6 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 7 | * Universidad de la Republica, Uruguay. 8 | * 9 | * This is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 3, or (at your option) 12 | * any later version. 13 | * 14 | * This software is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this software; see the file COPYING. If not, write to 21 | * the Free Software Foundation, Inc., 51 Franklin Street, 22 | * Boston, MA 02110-1301, USA. 23 | */ 24 | 25 | #ifndef INCLUDED_TEMPEST_HSYNC_IMPL_H 26 | #define INCLUDED_TEMPEST_HSYNC_IMPL_H 27 | 28 | #include 29 | 30 | namespace gr { 31 | namespace tempest { 32 | 33 | class Hsync_impl : public Hsync 34 | { 35 | private: 36 | int d_delay; 37 | int d_Htotal; 38 | 39 | int d_line_start; 40 | 41 | // the number of consecutive aligns in shorter ranges (to check whether we are locked) 42 | int d_consecutive_aligns; 43 | int d_consecutive_aligns_threshold; 44 | int d_shorter_range_size; 45 | int d_max_aligns; 46 | 47 | int d_line_found; 48 | // true means I'm sure where the line may be 49 | int d_line_locked; 50 | int d_out; 51 | int d_consumed; 52 | 53 | // For peak detector 54 | float d_threshold_factor_rise; 55 | float d_avg_alpha; 56 | float d_avg_max; 57 | float d_avg_min; 58 | 59 | // the correlation 60 | gr_complex * d_corr; 61 | float * d_abs_corr; 62 | 63 | 64 | /*! 65 | * \brief Initializes the parameters used in the peak_detect_process. 66 | * 67 | * \param threshold_factor_rise The algorithm keeps an average of minimum and maximum value. A peak is considered valid 68 | * when it's bigger than avg_max - threshold_factor_rise(avg_max-avg_min). 69 | * \param alpha The parameter used to update both the average maximum and minimum (exponential filter, or single-root iir). 70 | * 71 | */ 72 | void peak_detect_init(float threshold_factor_rise, float alpha); 73 | 74 | /*! 75 | * \brief Given datain and its length, the method return the peak position 76 | */ 77 | int peak_detect_process(const float * datain, const int datain_length, int * peak_pos); 78 | 79 | /*! 80 | * \brief Calculates the conjugate multipliplication of the signal and its delayed version, 81 | * and outputs the position of its absolute maximum. 82 | * 83 | * Given the input, it calculates the resulting likelihood function between indices lookup_stop and lookup_start. 84 | * It returns the beginning of the maximum 1-sample correlation, and an exponential modulated with minus the estimated 85 | * frequency error (in the pointer derot). to_consume and to_out was used as indicators of whether the peak was 86 | * correctly found or not. Now the return value is used (either true or false). 87 | * 88 | */ 89 | int max_corr_sync(const gr_complex * in, int lookup_start, int lookup_stop, int * max_corr_pos); 90 | 91 | 92 | public: 93 | Hsync_impl(int Htotal, int delay); 94 | ~Hsync_impl(); 95 | 96 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 97 | 98 | // Where all the action really happens 99 | int general_work(int noutput_items, 100 | gr_vector_int &ninput_items, 101 | gr_vector_const_void_star &input_items, 102 | gr_vector_void_star &output_items); 103 | 104 | void set_Htotal_and_delay(int Htotal, int delay); 105 | 106 | }; 107 | 108 | } // namespace tempest 109 | } // namespace gr 110 | 111 | #endif /* INCLUDED_TEMPEST_HSYNC_IMPL_H */ 112 | 113 | -------------------------------------------------------------------------------- /examples/Keep_1_in_N_frames.grc: -------------------------------------------------------------------------------- 1 | options: 2 | parameters: 3 | author: tempest 4 | catch_exceptions: 'True' 5 | category: '[Tempest]' 6 | cmake_opt: '' 7 | comment: '' 8 | copyright: '' 9 | description: '' 10 | gen_cmake: 'On' 11 | gen_linking: dynamic 12 | generate_options: hb 13 | hier_block_src_path: '.:' 14 | id: Keep_1_in_N_Frames 15 | max_nouts: '0' 16 | output_language: python 17 | placement: (0,0) 18 | qt_qss_theme: '' 19 | realtime_scheduling: '' 20 | run: 'True' 21 | run_command: '{python} -u {filename}' 22 | run_options: prompt 23 | sizing_mode: fixed 24 | thread_safe_setters: '' 25 | title: Keep_1_in_N_Frames 26 | window_size: '' 27 | states: 28 | bus_sink: false 29 | bus_source: false 30 | bus_structure: null 31 | coordinate: [7, 7] 32 | rotation: 0 33 | state: enabled 34 | 35 | blocks: 36 | - name: fac_size 37 | id: variable 38 | parameters: 39 | comment: '' 40 | value: fft_size 41 | states: 42 | bus_sink: false 43 | bus_source: false 44 | bus_structure: null 45 | coordinate: [310, 109] 46 | rotation: 0 47 | state: true 48 | - name: blocks_keep_one_in_n_0 49 | id: blocks_keep_one_in_n 50 | parameters: 51 | affinity: '' 52 | alias: '' 53 | comment: '' 54 | maxoutbuf: '0' 55 | minoutbuf: '0' 56 | n: fac_decimation 57 | type: complex 58 | vlen: fac_size 59 | states: 60 | bus_sink: false 61 | bus_source: false 62 | bus_structure: null 63 | coordinate: [498, 265] 64 | rotation: 0 65 | state: true 66 | - name: blocks_stream_to_vector_0 67 | id: blocks_stream_to_vector 68 | parameters: 69 | affinity: '' 70 | alias: '' 71 | comment: '' 72 | maxoutbuf: '0' 73 | minoutbuf: '0' 74 | num_items: fac_size 75 | type: complex 76 | vlen: '1' 77 | states: 78 | bus_sink: false 79 | bus_source: false 80 | bus_structure: null 81 | coordinate: [274, 314] 82 | rotation: 0 83 | state: enabled 84 | - name: blocks_vector_to_stream_0 85 | id: blocks_vector_to_stream 86 | parameters: 87 | affinity: '' 88 | alias: '' 89 | comment: '' 90 | maxoutbuf: '0' 91 | minoutbuf: '0' 92 | num_items: fac_size 93 | type: complex 94 | vlen: '1' 95 | states: 96 | bus_sink: false 97 | bus_source: false 98 | bus_structure: null 99 | coordinate: [718, 309] 100 | rotation: 0 101 | state: true 102 | - name: fac_decimation 103 | id: parameter 104 | parameters: 105 | alias: '' 106 | comment: '' 107 | hide: none 108 | label: N Frames 109 | short_id: '' 110 | type: intx 111 | value: '10' 112 | states: 113 | bus_sink: false 114 | bus_source: false 115 | bus_structure: null 116 | coordinate: [162, 132] 117 | rotation: 0 118 | state: true 119 | - name: fft_size 120 | id: parameter 121 | parameters: 122 | alias: '' 123 | comment: '' 124 | hide: none 125 | label: Frame Size 126 | short_id: '' 127 | type: intx 128 | value: int(4096*512) 129 | states: 130 | bus_sink: false 131 | bus_source: false 132 | bus_structure: null 133 | coordinate: [42, 161] 134 | rotation: 0 135 | state: true 136 | - name: pad_sink_0 137 | id: pad_sink 138 | parameters: 139 | affinity: '' 140 | alias: '' 141 | comment: '' 142 | label: out 143 | num_streams: '1' 144 | optional: 'False' 145 | type: complex 146 | vlen: '1' 147 | states: 148 | bus_sink: false 149 | bus_source: false 150 | bus_structure: null 151 | coordinate: [927, 306] 152 | rotation: 0 153 | state: true 154 | - name: pad_source_0 155 | id: pad_source 156 | parameters: 157 | affinity: '' 158 | alias: '' 159 | comment: '' 160 | label: in 161 | maxoutbuf: '0' 162 | minoutbuf: '0' 163 | num_streams: '1' 164 | optional: 'False' 165 | type: complex 166 | vlen: '1' 167 | states: 168 | bus_sink: false 169 | bus_source: false 170 | bus_structure: null 171 | coordinate: [88, 306] 172 | rotation: 0 173 | state: true 174 | 175 | connections: 176 | - [blocks_keep_one_in_n_0, '0', blocks_vector_to_stream_0, '0'] 177 | - [blocks_stream_to_vector_0, '0', blocks_keep_one_in_n_0, '0'] 178 | - [blocks_vector_to_stream_0, '0', pad_sink_0, '0'] 179 | - [pad_source_0, '0', blocks_stream_to_vector_0, '0'] 180 | 181 | metadata: 182 | file_format: 1 183 | -------------------------------------------------------------------------------- /lib/framing_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 4 | * Federico "Larroca" La Rocca 5 | * Adapted to 3.10 by Santiago Fernandez 6 | * 7 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 8 | * Universidad de la Republica, Uruguay. 9 | * 10 | * This is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3, or (at your option) 13 | * any later version. 14 | * 15 | * This software is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this software; see the file COPYING. If not, write to 22 | * the Free Software Foundation, Inc., 51 Franklin Street, 23 | * Boston, MA 02110-1301, USA. 24 | * 25 | */ 26 | 27 | #ifdef HAVE_CONFIG_H 28 | #include "config.h" 29 | #endif 30 | 31 | #include 32 | #include "framing_impl.h" 33 | 34 | namespace gr { 35 | namespace tempest { 36 | 37 | framing::sptr 38 | framing::make(int Htotal, int Vtotal, int Hdisplay, int Vdisplay) 39 | { 40 | return gnuradio::get_initial_sptr 41 | (new framing_impl(Htotal, Vtotal, Hdisplay, Vdisplay)); 42 | } 43 | 44 | /* 45 | * The private constructor 46 | */ 47 | framing_impl::framing_impl(int Htotal, int Vtotal, int Hdisplay, int Vdisplay) 48 | : gr::block("framing", 49 | gr::io_signature::make(1, 1, sizeof(float)), 50 | gr::io_signature::make(1, 1, sizeof(float))) 51 | { 52 | d_Htotal = Htotal; 53 | d_Vtotal = Vtotal; 54 | d_Hdisplay = Hdisplay; 55 | d_Vdisplay = Vdisplay; 56 | d_zeros = new float[d_Hdisplay]; 57 | for (int i=0; i 131 | // Tell runtime system how many input items we consumed on 132 | // each input stream. 133 | consume_each (d_consumed); 134 | 135 | // Tell runtime system how many output items we produced. 136 | return d_out; 137 | } 138 | 139 | } /* namespace tempest */ 140 | } /* namespace gr */ 141 | 142 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011-2020 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-tempest 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Project setup 11 | ######################################################################## 12 | cmake_minimum_required(VERSION 3.8) 13 | project(gr-tempest CXX C) 14 | enable_testing() 15 | 16 | # Install to PyBOMBS target prefix if defined 17 | if(DEFINED ENV{PYBOMBS_PREFIX}) 18 | set(CMAKE_INSTALL_PREFIX $ENV{PYBOMBS_PREFIX}) 19 | message(STATUS "PyBOMBS installed GNU Radio. Setting CMAKE_INSTALL_PREFIX to $ENV{PYBOMBS_PREFIX}") 20 | endif() 21 | 22 | # Select the release build type by default to get optimization flags 23 | if(NOT CMAKE_BUILD_TYPE) 24 | set(CMAKE_BUILD_TYPE "Release") 25 | message(STATUS "Build type not specified: defaulting to release.") 26 | endif(NOT CMAKE_BUILD_TYPE) 27 | set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") 28 | 29 | # Make sure our local CMake Modules path comes first 30 | list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) 31 | # Find gnuradio to get access to the cmake modules 32 | find_package(Gnuradio "3.10" REQUIRED COMPONENTS blocks fft filter volk) 33 | 34 | # Set the version information here 35 | set(VERSION_MAJOR 1) 36 | set(VERSION_API 0) 37 | set(VERSION_ABI 0) 38 | set(VERSION_PATCH 0) 39 | 40 | cmake_policy(SET CMP0011 NEW) 41 | 42 | # Enable generation of compile_commands.json for code completion engines 43 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 44 | 45 | ######################################################################## 46 | # Minimum Version Requirements 47 | ######################################################################## 48 | 49 | include(GrMinReq) 50 | 51 | ######################################################################## 52 | # Compiler settings 53 | ######################################################################## 54 | 55 | include(GrCompilerSettings) 56 | 57 | ######################################################################## 58 | # Install directories 59 | ######################################################################## 60 | include(GrVersion) 61 | 62 | include(GrPlatform) #define LIB_SUFFIX 63 | 64 | if(NOT CMAKE_MODULES_DIR) 65 | set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake) 66 | endif(NOT CMAKE_MODULES_DIR) 67 | 68 | set(GR_INCLUDE_DIR include/gnuradio/tempest) 69 | set(GR_CMAKE_DIR ${CMAKE_MODULES_DIR}/gnuradio-tempest) 70 | set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) 71 | set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) 72 | set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) 73 | set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) 74 | 75 | ######################################################################## 76 | # On Apple only, set install name and use rpath correctly, if not already set 77 | ######################################################################## 78 | if(APPLE) 79 | if(NOT CMAKE_INSTALL_NAME_DIR) 80 | set(CMAKE_INSTALL_NAME_DIR 81 | ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE 82 | PATH "Library Install Name Destination Directory" FORCE) 83 | endif(NOT CMAKE_INSTALL_NAME_DIR) 84 | if(NOT CMAKE_INSTALL_RPATH) 85 | set(CMAKE_INSTALL_RPATH 86 | ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE 87 | PATH "Library Install RPath" FORCE) 88 | endif(NOT CMAKE_INSTALL_RPATH) 89 | if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) 90 | set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE 91 | BOOL "Do Build Using Library Install RPath" FORCE) 92 | endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) 93 | endif(APPLE) 94 | 95 | ######################################################################## 96 | # Find gnuradio build dependencies 97 | ######################################################################## 98 | find_package(Doxygen) 99 | 100 | ######################################################################## 101 | # Setup doxygen option 102 | ######################################################################## 103 | if(DOXYGEN_FOUND) 104 | option(ENABLE_DOXYGEN "Build docs using Doxygen" ON) 105 | else(DOXYGEN_FOUND) 106 | option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF) 107 | endif(DOXYGEN_FOUND) 108 | 109 | ######################################################################## 110 | # Create uninstall target 111 | ######################################################################## 112 | configure_file( 113 | ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in 114 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 115 | @ONLY) 116 | 117 | add_custom_target(uninstall 118 | ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 119 | ) 120 | 121 | ######################################################################## 122 | # Add subdirectories 123 | ######################################################################## 124 | add_subdirectory(include/gnuradio/tempest) 125 | add_subdirectory(lib) 126 | add_subdirectory(apps) 127 | add_subdirectory(docs) 128 | # NOTE: manually update below to use GRC to generate C++ flowgraphs w/o python 129 | if(ENABLE_PYTHON) 130 | message(STATUS "PYTHON and GRC components are enabled") 131 | add_subdirectory(python/tempest) 132 | add_subdirectory(grc) 133 | else(ENABLE_PYTHON) 134 | message(STATUS "PYTHON and GRC components are disabled") 135 | endif(ENABLE_PYTHON) 136 | 137 | ######################################################################## 138 | # Install cmake search helper for this library 139 | ######################################################################## 140 | 141 | install(FILES cmake/Modules/gnuradio-tempestConfig.cmake 142 | DESTINATION ${GR_CMAKE_DIR} 143 | ) 144 | 145 | include(CMakePackageConfigHelpers) 146 | configure_package_config_file( 147 | ${PROJECT_SOURCE_DIR}/cmake/Modules/targetConfig.cmake.in 148 | ${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/${target}Config.cmake 149 | INSTALL_DESTINATION ${GR_CMAKE_DIR} 150 | ) 151 | 152 | -------------------------------------------------------------------------------- /lib/frame_drop_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /** 3 | * Copyright 2021 4 | * Pablo Bertrand 5 | * Felipe Carrau 6 | * Victoria Severi 7 | * Adapted to 3.10 by Santiago Fernandez 8 | * 9 | * Instituto de Ingeniería Eléctrica, Facultad de Ingeniería, 10 | * Universidad de la República, Uruguay. 11 | * 12 | * This is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 3, or (at your option) 15 | * any later version. 16 | * 17 | * This software is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this software; see the file COPYING. If not, write to 24 | * the Free Software Foundation, Inc., 51 Franklin Street, 25 | * Boston, MA 02110-1301, USA. 26 | * 27 | * @file frame_drop_impl.h 28 | * 29 | * @brief Block that uses the interpolation ratio to count 30 | * full frames in samples and discard some of them in order 31 | * to reduce the processing needed by other blocks to do the 32 | * interpolation. 33 | * 34 | * gr-tempest 35 | * 36 | * @date September 19, 2021 37 | * @author Pablo Bertrand 38 | * @author Felipe Carrau 39 | * @author Victoria Severi 40 | */ 41 | 42 | /********************************************************** 43 | * Constant and macro definitions 44 | **********************************************************/ 45 | 46 | #ifndef INCLUDED_TEMPEST_FRAME_DROP_IMPL_H 47 | #define INCLUDED_TEMPEST_FRAME_DROP_IMPL_H 48 | 49 | /********************************************************** 50 | * Include statements 51 | **********************************************************/ 52 | 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | 59 | namespace gr { 60 | namespace tempest { 61 | 62 | class frame_drop_impl : public frame_drop 63 | { 64 | private: 65 | 66 | /********************************************************** 67 | * Data declarations 68 | **********************************************************/ 69 | 70 | //Counters 71 | int d_display_counter; 72 | int d_frames_counter; 73 | int d_sample_counter; 74 | 75 | //Fixed parameter 76 | int d_discarded_amount_per_frame; 77 | 78 | int d_Htotal; 79 | int d_Vtotal; 80 | int d_correct_sampling; 81 | uint32_t d_required_for_interpolation; 82 | float d_max_deviation; 83 | 84 | std::geometric_distribution d_dist; 85 | std::minstd_rand d_gen; 86 | 87 | float d_proba_of_updating; 88 | int d_next_update; 89 | 90 | //double d_actual_samp_rate; 91 | double d_samp_inc_rem; 92 | double d_new_interpolation_ratio_rem; 93 | double d_samp_phase; 94 | 95 | float d_alpha_samp_inc; 96 | int d_max_deviation_px; 97 | int d_peak_line_index; 98 | 99 | float d_alpha_corr; 100 | double d_last_freq ; 101 | 102 | bool d_start_frame_drop; 103 | 104 | // the interpolating filter 105 | gr::filter::mmse_fir_interpolator_cc d_inter; 106 | gr::thread::mutex d_mutex; 107 | 108 | /********************************************************** 109 | * Private function prototypes 110 | **********************************************************/ 111 | /** 112 | * @brief Function that processes the ratio received as PMT 113 | * message from other blocks and assignes it to a variable. 114 | * 115 | * @param pmt_t msg: Message received from autocorrelation 116 | * block during runtime. 117 | */ 118 | void set_ratio_msg(pmt::pmt_t msg); 119 | //--------------------------------------------------------- 120 | 121 | public: 122 | frame_drop_impl(int Htotal, int Vtotal, int correct_sampling, float max_deviation, float update_proba, double actual_samp_rate); 123 | ~frame_drop_impl(); 124 | 125 | /********************************************************** 126 | * Public function prototypes 127 | **********************************************************/ 128 | /** 129 | * @brief Used to establish the amount of samples required 130 | * for a full work iteration. 131 | * 132 | */ 133 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 134 | //--------------------------------------------------------- 135 | /** 136 | * @brief Function that emulates the calculation made by 137 | * Fine Sampling Synchronization of the samples required 138 | * for obtained an interpolated result of a certain size. 139 | * 140 | * @param int size: amount of samples desired to result 141 | * from the interpolation process, if the was one. 142 | */ 143 | void get_required_samples(int size); 144 | //--------------------------------------------------------- 145 | /** 146 | * @brief While keeping count of the processed samples, the 147 | * function decides whether each one belongs to a frame that 148 | * it wants to display in the output or not. To do this, it 149 | * runs the calculation for the required samples to 150 | * interpolate a full frame and counts how many times it is 151 | * achieved. 152 | * 153 | */ 154 | int general_work(int noutput_items, 155 | gr_vector_int &ninput_items, 156 | gr_vector_const_void_star &input_items, 157 | gr_vector_void_star &output_items); 158 | //--------------------------------------------------------- 159 | }; 160 | 161 | } // namespace tempest 162 | } // namespace gr 163 | 164 | #endif /* INCLUDED_TEMPEST_FRAME_DROP_IMPL_H */ 165 | 166 | -------------------------------------------------------------------------------- /cmake/Modules/CMakeParseArgumentsCopy.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE_PARSE_ARGUMENTS( args...) 2 | # 3 | # CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for 4 | # parsing the arguments given to that macro or function. 5 | # It processes the arguments and defines a set of variables which hold the 6 | # values of the respective options. 7 | # 8 | # The argument contains all options for the respective macro, 9 | # i.e. keywords which can be used when calling the macro without any value 10 | # following, like e.g. the OPTIONAL keyword of the install() command. 11 | # 12 | # The argument contains all keywords for this macro 13 | # which are followed by one value, like e.g. DESTINATION keyword of the 14 | # install() command. 15 | # 16 | # The argument contains all keywords for this macro 17 | # which can be followed by more than one value, like e.g. the TARGETS or 18 | # FILES keywords of the install() command. 19 | # 20 | # When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the 21 | # keywords listed in , and 22 | # a variable composed of the given 23 | # followed by "_" and the name of the respective keyword. 24 | # These variables will then hold the respective value from the argument list. 25 | # For the keywords this will be TRUE or FALSE. 26 | # 27 | # All remaining arguments are collected in a variable 28 | # _UNPARSED_ARGUMENTS, this can be checked afterwards to see whether 29 | # your macro was called with unrecognized parameters. 30 | # 31 | # As an example here a my_install() macro, which takes similar arguments as the 32 | # real install() command: 33 | # 34 | # function(MY_INSTALL) 35 | # set(options OPTIONAL FAST) 36 | # set(oneValueArgs DESTINATION RENAME) 37 | # set(multiValueArgs TARGETS CONFIGURATIONS) 38 | # cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) 39 | # ... 40 | # 41 | # Assume my_install() has been called like this: 42 | # my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) 43 | # 44 | # After the cmake_parse_arguments() call the macro will have set the following 45 | # variables: 46 | # MY_INSTALL_OPTIONAL = TRUE 47 | # MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() 48 | # MY_INSTALL_DESTINATION = "bin" 49 | # MY_INSTALL_RENAME = "" (was not used) 50 | # MY_INSTALL_TARGETS = "foo;bar" 51 | # MY_INSTALL_CONFIGURATIONS = "" (was not used) 52 | # MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" 53 | # 54 | # You can the continue and process these variables. 55 | # 56 | # Keywords terminate lists of values, e.g. if directly after a one_value_keyword 57 | # another recognized keyword follows, this is interpreted as the beginning of 58 | # the new option. 59 | # E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in 60 | # MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would 61 | # be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefore. 62 | 63 | #============================================================================= 64 | # Copyright 2010 Alexander Neundorf 65 | # 66 | # Distributed under the OSI-approved BSD License (the "License"); 67 | # see accompanying file Copyright.txt for details. 68 | # 69 | # This software is distributed WITHOUT ANY WARRANTY; without even the 70 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 71 | # See the License for more information. 72 | #============================================================================= 73 | # (To distribute this file outside of CMake, substitute the full 74 | # License text for the above reference.) 75 | 76 | 77 | if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) 78 | return() 79 | endif() 80 | set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) 81 | 82 | 83 | function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) 84 | # first set all result variables to empty/FALSE 85 | foreach(arg_name ${_singleArgNames} ${_multiArgNames}) 86 | set(${prefix}_${arg_name}) 87 | endforeach(arg_name) 88 | 89 | foreach(option ${_optionNames}) 90 | set(${prefix}_${option} FALSE) 91 | endforeach(option) 92 | 93 | set(${prefix}_UNPARSED_ARGUMENTS) 94 | 95 | set(insideValues FALSE) 96 | set(currentArgName) 97 | 98 | # now iterate over all arguments and fill the result variables 99 | foreach(currentArg ${ARGN}) 100 | list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword 101 | list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword 102 | list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword 103 | 104 | if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) 105 | if(insideValues) 106 | if("${insideValues}" STREQUAL "SINGLE") 107 | set(${prefix}_${currentArgName} ${currentArg}) 108 | set(insideValues FALSE) 109 | elseif("${insideValues}" STREQUAL "MULTI") 110 | list(APPEND ${prefix}_${currentArgName} ${currentArg}) 111 | endif() 112 | else(insideValues) 113 | list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) 114 | endif(insideValues) 115 | else() 116 | if(NOT ${optionIndex} EQUAL -1) 117 | set(${prefix}_${currentArg} TRUE) 118 | set(insideValues FALSE) 119 | elseif(NOT ${singleArgIndex} EQUAL -1) 120 | set(currentArgName ${currentArg}) 121 | set(${prefix}_${currentArgName}) 122 | set(insideValues "SINGLE") 123 | elseif(NOT ${multiArgIndex} EQUAL -1) 124 | set(currentArgName ${currentArg}) 125 | set(${prefix}_${currentArgName}) 126 | set(insideValues "MULTI") 127 | endif() 128 | endif() 129 | 130 | endforeach(currentArg) 131 | 132 | # propagate the result variables to the caller: 133 | foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) 134 | set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) 135 | endforeach(arg_name) 136 | set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) 137 | 138 | endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) 139 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | # This file is a part of gr-tempest 6 | # 7 | # SPDX-License-Identifier: GPL-3.0-or-later 8 | # 9 | # 10 | """ 11 | A base class is created. 12 | 13 | Classes based upon this are used to make more user-friendly interfaces 14 | to the doxygen xml docs than the generated classes provide. 15 | """ 16 | 17 | import os 18 | import pdb 19 | 20 | from xml.parsers.expat import ExpatError 21 | 22 | from .generated import compound 23 | 24 | 25 | class Base(object): 26 | 27 | class Duplicate(Exception): 28 | pass 29 | 30 | class NoSuchMember(Exception): 31 | pass 32 | 33 | class ParsingError(Exception): 34 | pass 35 | 36 | def __init__(self, parse_data, top=None): 37 | self._parsed = False 38 | self._error = False 39 | self._parse_data = parse_data 40 | self._members = [] 41 | self._dict_members = {} 42 | self._in_category = {} 43 | self._data = {} 44 | if top is not None: 45 | self._xml_path = top._xml_path 46 | # Set up holder of references 47 | else: 48 | top = self 49 | self._refs = {} 50 | self._xml_path = parse_data 51 | self.top = top 52 | 53 | @classmethod 54 | def from_refid(cls, refid, top=None): 55 | """ Instantiate class from a refid rather than parsing object. """ 56 | # First check to see if its already been instantiated. 57 | if top is not None and refid in top._refs: 58 | return top._refs[refid] 59 | # Otherwise create a new instance and set refid. 60 | inst = cls(None, top=top) 61 | inst.refid = refid 62 | inst.add_ref(inst) 63 | return inst 64 | 65 | @classmethod 66 | def from_parse_data(cls, parse_data, top=None): 67 | refid = getattr(parse_data, 'refid', None) 68 | if refid is not None and top is not None and refid in top._refs: 69 | return top._refs[refid] 70 | inst = cls(parse_data, top=top) 71 | if refid is not None: 72 | inst.refid = refid 73 | inst.add_ref(inst) 74 | return inst 75 | 76 | def add_ref(self, obj): 77 | if hasattr(obj, 'refid'): 78 | self.top._refs[obj.refid] = obj 79 | 80 | mem_classes = [] 81 | 82 | def get_cls(self, mem): 83 | for cls in self.mem_classes: 84 | if cls.can_parse(mem): 85 | return cls 86 | raise Exception(("Did not find a class for object '%s'." 87 | % (mem.get_name()))) 88 | 89 | def convert_mem(self, mem): 90 | try: 91 | cls = self.get_cls(mem) 92 | converted = cls.from_parse_data(mem, self.top) 93 | if converted is None: 94 | raise Exception('No class matched this object.') 95 | self.add_ref(converted) 96 | return converted 97 | except Exception as e: 98 | print(e) 99 | 100 | @classmethod 101 | def includes(cls, inst): 102 | return isinstance(inst, cls) 103 | 104 | @classmethod 105 | def can_parse(cls, obj): 106 | return False 107 | 108 | def _parse(self): 109 | self._parsed = True 110 | 111 | def _get_dict_members(self, cat=None): 112 | """ 113 | For given category a dictionary is returned mapping member names to 114 | members of that category. For names that are duplicated the name is 115 | mapped to None. 116 | """ 117 | self.confirm_no_error() 118 | if cat not in self._dict_members: 119 | new_dict = {} 120 | for mem in self.in_category(cat): 121 | if mem.name() not in new_dict: 122 | new_dict[mem.name()] = mem 123 | else: 124 | new_dict[mem.name()] = self.Duplicate 125 | self._dict_members[cat] = new_dict 126 | return self._dict_members[cat] 127 | 128 | def in_category(self, cat): 129 | self.confirm_no_error() 130 | if cat is None: 131 | return self._members 132 | if cat not in self._in_category: 133 | self._in_category[cat] = [mem for mem in self._members 134 | if cat.includes(mem)] 135 | return self._in_category[cat] 136 | 137 | def get_member(self, name, cat=None): 138 | self.confirm_no_error() 139 | # Check if it's in a namespace or class. 140 | bits = name.split('::') 141 | first = bits[0] 142 | rest = '::'.join(bits[1:]) 143 | member = self._get_dict_members(cat).get(first, self.NoSuchMember) 144 | # Raise any errors that are returned. 145 | if member in set([self.NoSuchMember, self.Duplicate]): 146 | raise member() 147 | if rest: 148 | return member.get_member(rest, cat=cat) 149 | return member 150 | 151 | def has_member(self, name, cat=None): 152 | try: 153 | mem = self.get_member(name, cat=cat) 154 | return True 155 | except self.NoSuchMember: 156 | return False 157 | 158 | def data(self): 159 | self.confirm_no_error() 160 | return self._data 161 | 162 | def members(self): 163 | self.confirm_no_error() 164 | return self._members 165 | 166 | def process_memberdefs(self): 167 | mdtss = [] 168 | for sec in self._retrieved_data.compounddef.sectiondef: 169 | mdtss += sec.memberdef 170 | # At the moment we lose all information associated with sections. 171 | # Sometimes a memberdef is in several sectiondef. 172 | # We make sure we don't get duplicates here. 173 | uniques = set([]) 174 | for mem in mdtss: 175 | converted = self.convert_mem(mem) 176 | pair = (mem.name, mem.__class__) 177 | if pair not in uniques: 178 | uniques.add(pair) 179 | self._members.append(converted) 180 | 181 | def retrieve_data(self): 182 | filename = os.path.join(self._xml_path, self.refid + '.xml') 183 | try: 184 | self._retrieved_data = compound.parse(filename) 185 | except ExpatError: 186 | print('Error in xml in file %s' % filename) 187 | self._error = True 188 | self._retrieved_data = None 189 | 190 | def check_parsed(self): 191 | if not self._parsed: 192 | self._parse() 193 | 194 | def confirm_no_error(self): 195 | self.check_parsed() 196 | if self._error: 197 | raise self.ParsingError() 198 | 199 | def error(self): 200 | self.check_parsed() 201 | return self._error 202 | 203 | def name(self): 204 | # first see if we can do it without processing. 205 | if self._parse_data is not None: 206 | return self._parse_data.name 207 | self.check_parsed() 208 | return self._retrieved_data.compounddef.name 209 | -------------------------------------------------------------------------------- /lib/frame_drop_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /** 3 | * Copyright 2021 4 | * Pablo Bertrand 5 | * Felipe Carrau 6 | * Victoria Severi 7 | * Adapted to 3.10 by Santiago Fernandez 8 | * 9 | * Instituto de Ingeniería Eléctrica, Facultad de Ingeniería, 10 | * Universidad de la República, Uruguay. 11 | * 12 | * This is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 3, or (at your option) 15 | * any later version. 16 | * 17 | * This software is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this software; see the file COPYING. If not, write to 24 | * the Free Software Foundation, Inc., 51 Franklin Street, 25 | * Boston, MA 02110-1301, USA. 26 | * 27 | * @file frame_drop_impl.cc 28 | * 29 | * gr-tempest 30 | * 31 | * @date September 19, 2021 32 | * @author Pablo Bertrand 33 | * @author Felipe Carrau 34 | * @author Victoria Severi 35 | */ 36 | 37 | /********************************************************** 38 | * Include statements 39 | **********************************************************/ 40 | 41 | #ifdef HAVE_CONFIG_H 42 | #include "config.h" 43 | #endif 44 | 45 | #include 46 | #include 47 | #include 48 | #include "frame_drop_impl.h" 49 | #include 50 | #include 51 | #include 52 | 53 | namespace gr 54 | { 55 | namespace tempest 56 | { 57 | 58 | frame_drop::sptr 59 | frame_drop::make(int Htotal, int Vtotal, int correct_sampling, float max_deviation, float update_proba, double actual_samp_rate) 60 | { 61 | return gnuradio::get_initial_sptr 62 | (new frame_drop_impl(Htotal, Vtotal, correct_sampling, max_deviation, update_proba, actual_samp_rate)); 63 | } 64 | 65 | /********************************************************** 66 | * Function bodies 67 | **********************************************************/ 68 | /* 69 | * The private constructor 70 | */ 71 | frame_drop_impl::frame_drop_impl(int Htotal, int Vtotal, int correct_sampling, float max_deviation, float update_proba, double actual_samp_rate) 72 | : gr::block("frame_drop", 73 | gr::io_signature::make(1, 1, sizeof(gr_complex)), 74 | gr::io_signature::make(1, 1, sizeof(gr_complex))), 75 | d_inter(gr::filter::mmse_fir_interpolator_cc()), 76 | d_dist(update_proba), 77 | d_gen(std::random_device{}()) 78 | { 79 | set_relative_rate(1); 80 | 81 | //Counters 82 | d_sample_counter = 0; 83 | d_display_counter = 0; 84 | d_frames_counter = 0; 85 | 86 | //Fixed values 87 | d_discarded_amount_per_frame = 15; 88 | d_proba_of_updating = update_proba; 89 | d_max_deviation = max_deviation; 90 | d_alpha_samp_inc = 1e-1; 91 | d_last_freq = 0; 92 | d_samp_phase = 0; 93 | d_alpha_corr = 1e-6; 94 | 95 | d_start_frame_drop = 0; 96 | 97 | d_Htotal = Htotal; 98 | d_Vtotal = Vtotal; 99 | d_required_for_interpolation = d_Htotal*d_Vtotal; 100 | d_max_deviation_px = (int)std::ceil(d_Htotal*d_max_deviation); 101 | 102 | set_history(d_Vtotal*(d_Htotal+d_max_deviation_px)+1); 103 | 104 | d_peak_line_index = 0; 105 | d_samp_inc_rem = 0; 106 | d_new_interpolation_ratio_rem = 0; 107 | d_next_update = 0; 108 | 109 | // PMT port 110 | message_port_register_in(pmt::mp("ratio")); 111 | 112 | // PMT handler 113 | set_msg_handler(pmt::mp("ratio"),[this](const pmt::pmt_t& msg) {frame_drop_impl::set_ratio_msg(msg); }); 114 | 115 | } 116 | 117 | //--------------------------------------------------------- 118 | /* 119 | * Our virtual destructor. 120 | */ 121 | frame_drop_impl::~frame_drop_impl() 122 | { 123 | } 124 | 125 | //--------------------------------------------------------- 126 | 127 | void frame_drop_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required) 128 | { 129 | int ninputs = ninput_items_required.size (); 130 | for (int i = 0; i < ninputs; i++) 131 | { 132 | ninput_items_required[i] = (int)ceil((noutput_items + 1) * (2+d_samp_inc_rem)) + d_inter.ntaps() ; 133 | } 134 | } 135 | 136 | //--------------------------------------------------------- 137 | 138 | void frame_drop_impl::set_ratio_msg(pmt::pmt_t msg){ 139 | if(pmt::is_pair(msg)) { 140 | pmt::pmt_t key = pmt::car(msg); 141 | pmt::pmt_t val = pmt::cdr(msg); 142 | if(pmt::eq(key, pmt::string_to_symbol("ratio"))) { 143 | if(pmt::is_number(val)) { 144 | d_new_interpolation_ratio_rem = (double)pmt::to_double(val); 145 | printf("Frame dropper: interpolation ratio received = %f \n", d_new_interpolation_ratio_rem); 146 | } 147 | } 148 | } 149 | } 150 | 151 | //--------------------------------------------------------- 152 | 153 | void frame_drop_impl::get_required_samples(int size) 154 | { 155 | uint32_t ii = 0, incr; 156 | int oo = 0; 157 | double s, f; 158 | 159 | //d_samp_inc_rem = (1-d_alpha_samp_inc)*d_samp_inc_rem + d_alpha_samp_inc*d_new_interpolation_ratio_rem; 160 | 161 | while(oo < size) { 162 | s = d_samp_phase + d_samp_inc_rem + 1; 163 | f = floor(s); 164 | incr = (uint32_t)f; 165 | d_samp_phase = s - f; 166 | ii += incr; 167 | 168 | oo++; 169 | } 170 | d_required_for_interpolation = ii; 171 | } 172 | 173 | //--------------------------------------------------------- 174 | 175 | int frame_drop_impl::general_work (int noutput_items, 176 | gr_vector_int &ninput_items, 177 | gr_vector_const_void_star &input_items, 178 | gr_vector_void_star &output_items) 179 | { 180 | const gr_complex *in = (const gr_complex *) input_items[0]; 181 | gr_complex *out = (gr_complex *) output_items[0]; 182 | 183 | int consumed = 0, out_amount = 0, aux; 184 | 185 | d_samp_inc_rem = (1-d_alpha_samp_inc)*d_samp_inc_rem + d_alpha_samp_inc*d_new_interpolation_ratio_rem; 186 | 187 | for (int i=0; i 5 | * Adapted to 3.10 by Santiago Fernandez 6 | 7 | * 8 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 9 | * Universidad de la Republica, Uruguay. 10 | * 11 | * This is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 3, or (at your option) 14 | * any later version. 15 | * 16 | * This software is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this software; see the file COPYING. If not, write to 23 | * the Free Software Foundation, Inc., 51 Franklin Street, 24 | * Boston, MA 02110-1301, USA. 25 | * 26 | */ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include 33 | #include "sampling_synchronization_impl.h" 34 | #include 35 | #include 36 | 37 | namespace gr { 38 | namespace tempest { 39 | 40 | sampling_synchronization::sptr 41 | sampling_synchronization::make(int Htotal, double manual_correction) 42 | { 43 | return gnuradio::get_initial_sptr 44 | (new sampling_synchronization_impl(Htotal, manual_correction)); 45 | } 46 | 47 | 48 | /* 49 | * The private constructor 50 | */ 51 | sampling_synchronization_impl::sampling_synchronization_impl(int Htotal, double manual_correction) 52 | : gr::block("sampling_synchronization", 53 | gr::io_signature::make(1, 1, sizeof(gr_complex)), 54 | gr::io_signature::make(1, 1, sizeof(gr_complex))), 55 | d_inter(gr::filter::mmse_fir_interpolator_cc()), 56 | d_dist(0, 1), 57 | d_gen(std::random_device{}()) 58 | 59 | { 60 | set_relative_rate(1); 61 | d_Htotal = Htotal; 62 | 63 | //VOLK alignment as recommended by GNU Radio's Manual. It has a similar effect 64 | //than set_output_multiple(), thus we will generally get multiples of this value 65 | //as noutput_items. 66 | const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex); 67 | set_alignment(std::max(1, alignment_multiple)); 68 | 69 | d_max_deviation = 0.10; 70 | d_max_deviation_px = (int)std::ceil(Htotal*d_max_deviation); 71 | d_samp_inc_remainder = 0; 72 | d_samp_inc_correction = manual_correction; 73 | d_samp_phase = 0; 74 | d_alpha_samp_inc = 1e-3; 75 | 76 | 77 | d_current_corr = new gr_complex[2*d_max_deviation_px + 1]; 78 | d_historic_corr = new gr_complex[2*d_max_deviation_px + 1]; 79 | d_abs_historic_corr = new float[2*d_max_deviation_px + 1]; 80 | for (int i = 0; i<2*d_max_deviation_px+1; i++){ 81 | d_historic_corr[i] = 0; 82 | d_abs_historic_corr[i] = 0; 83 | } 84 | d_alpha_corr = 1e-6; 85 | 86 | d_proba_of_updating = 0.01; 87 | 88 | } 89 | 90 | /* 91 | * Our virtual destructor. 92 | */ 93 | sampling_synchronization_impl::~sampling_synchronization_impl() 94 | { 95 | delete [] d_current_corr; 96 | delete [] d_historic_corr; 97 | delete [] d_abs_historic_corr; 98 | } 99 | 100 | void 101 | sampling_synchronization_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required) 102 | { 103 | int ninputs = ninput_items_required.size (); 104 | // make sure we receive at least Hsize+max_deviation+taps_to_interpolate 105 | for (int i = 0; i < ninputs; i++) 106 | { 107 | //ninput_items_required[i] = ( d_cp_length + d_fft_length ) * (noutput_items + 1) ; 108 | ninput_items_required[i] = (int)ceil((noutput_items + 1) * (1+d_samp_inc_remainder)) + d_inter.ntaps() + d_Htotal+d_max_deviation_px ; 109 | } 110 | } 111 | 112 | void sampling_synchronization_impl::set_Htotal(int Htotal){ 113 | d_Htotal = Htotal; 114 | d_max_deviation_px = (int)std::ceil(Htotal*d_max_deviation); 115 | printf("[TEMPEST] Setting Htotal to %i in sampling synchronization block.\n", Htotal); 116 | } 117 | 118 | void sampling_synchronization_impl::set_manual_correction(double correction){ 119 | 120 | d_samp_inc_correction = correction; 121 | 122 | } 123 | 124 | void sampling_synchronization_impl::update_interpolation_ratio(const float * datain, const int datain_length){ 125 | uint16_t peak_index = 0; 126 | uint32_t d_datain_length = (uint32_t)(datain_length); 127 | volk_32f_index_max_16u(&peak_index, datain, datain_length); 128 | 129 | // the new interpolation ratio is how far the peak is from d_Htotal. 130 | d_new_interpolation_ratio = ((float)(peak_index-d_max_deviation_px + d_Htotal))/(float)d_Htotal; 131 | //for (int i=0; i 5 | * Adapted to 3.10 by Santiago Fernandez 6 | 7 | * 8 | * Instituto de Ingenieria Electrica, Facultad de Ingenieria, 9 | * Universidad de la Republica, Uruguay. 10 | * 11 | * This is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 3, or (at your option) 14 | * any later version. 15 | * 16 | * This software is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this software; see the file COPYING. If not, write to 23 | * the Free Software Foundation, Inc., 51 Franklin Street, 24 | * Boston, MA 02110-1301, USA. 25 | * 26 | */ 27 | 28 | #ifndef INCLUDED_TEMPEST_INFER_SCREEN_RESOLUTION_IMPL_H 29 | #define INCLUDED_TEMPEST_INFER_SCREEN_RESOLUTION_IMPL_H 30 | 31 | #include 32 | //#include 33 | #include 34 | #include 35 | 36 | namespace gr { 37 | namespace tempest { 38 | 39 | class infer_screen_resolution_impl : public infer_screen_resolution 40 | { 41 | private: 42 | 43 | /********************************************************** 44 | * Data declarations 45 | **********************************************************/ 46 | 47 | gr::thread::mutex d_mutex; 48 | bool d_start_fft_peak_finder = 1; 49 | 50 | //Received parameters 51 | int d_sample_rate; 52 | int d_fft_size; 53 | 54 | 55 | double d_ratio; 56 | long double d_accumulator; 57 | long double d_real_line; 58 | bool d_start; 59 | 60 | 61 | //Search values 62 | uint32_t d_search_skip; 63 | uint32_t d_search_margin; 64 | uint32_t d_vtotal_est; 65 | uint32_t d_peak_1; 66 | uint32_t d_peak_2; 67 | 68 | //Results to publish 69 | float d_refresh_rate; 70 | 71 | //Counters 72 | uint32_t d_work_counter; 73 | uint32_t d_sample_counter; 74 | int d_i; 75 | 76 | //Search values 77 | float d_refresh_rate_est; 78 | bool d_flag; 79 | bool d_mode; 80 | 81 | //Resolution results 82 | int d_Hsize; 83 | int d_Vsize; 84 | int d_Vvisible; 85 | int d_Hvisible; 86 | long d_Hblank; 87 | long d_Vblank; 88 | 89 | 90 | uint32_t calculate_peak_index_relative_to_search_skip(const float *in, uint32_t search_skip, uint32_t search_range) 91 | { 92 | uint32_t peak_index; 93 | volk_32f_index_max_32u(&peak_index, &in[search_skip], search_range); 94 | return peak_index += search_skip; 95 | }; 96 | 97 | void search_table(float fv_estimated) 98 | { 99 | if (fv_estimated<65 && fv_estimated>55) 100 | { 101 | d_refresh_rate=60; 102 | if (d_vtotal_est<576.5) 103 | { 104 | d_Vvisible=480; 105 | d_Vsize=525; 106 | d_Hvisible=640; 107 | d_Hsize=800; 108 | } 109 | else if (d_vtotal_est>576.5 && d_vtotal_est<687) 110 | { 111 | //800x600 112 | d_Hvisible=800; 113 | d_Hsize=1056; 114 | d_Vvisible=600; 115 | d_Vsize=628; 116 | } 117 | else if (d_vtotal_est>687 && d_vtotal_est<776) 118 | { 119 | //1280x720 120 | d_Hvisible=1280; 121 | d_Hsize=1664; 122 | d_Vvisible=720; 123 | d_Vsize=746; 124 | } 125 | else if (d_vtotal_est>776 && d_vtotal_est<869) 126 | { 127 | //1024x768 128 | d_Hvisible=1024; 129 | d_Hsize=1344; 130 | d_Vvisible=768; 131 | d_Vsize=806; 132 | } 133 | else if (d_vtotal_est>869 && d_vtotal_est<966) 134 | { 135 | //1600x900 136 | d_Hvisible=1600; 137 | d_Hsize=2128; 138 | d_Vvisible=900; 139 | d_Vsize=932; 140 | } 141 | else if (d_vtotal_est>966 && d_vtotal_est<1033) 142 | { 143 | //1280x960 144 | d_Hvisible=1280; 145 | d_Hsize=1800; 146 | d_Vvisible=960; 147 | d_Vsize=1000; 148 | } 149 | else if (d_vtotal_est>1033 && d_vtotal_est<1077.5) 150 | { 151 | //1280x1024 152 | d_Hvisible=1280; 153 | d_Hsize=1688; 154 | d_Vvisible=1024; 155 | d_Vsize=1066; 156 | } 157 | else if (d_vtotal_est>1077.5 && d_vtotal_est<1107) 158 | { 159 | //1680x1050 160 | d_Hvisible=1680; 161 | d_Hsize=2240; 162 | d_Vvisible=1050; 163 | d_Vsize=1089; 164 | } 165 | else if (d_vtotal_est>1107 && d_vtotal_est<1300) 166 | { 167 | //1920x1080 168 | d_Hvisible=1920; 169 | d_Hsize=2200; 170 | d_Vvisible=1080; 171 | d_Vsize=1125; 172 | } 173 | } 174 | else if (fv_estimated>65 && fv_estimated<72.5) 175 | { 176 | d_refresh_rate=(int)70.1; 177 | if (d_vtotal_est>400 && d_vtotal_est<500) 178 | { 179 | d_Hvisible=720; 180 | d_Hsize=900; 181 | d_Vvisible=400; 182 | d_Vsize=449; 183 | } 184 | } 185 | else if (fv_estimated>72.5 && fv_estimated<80) 186 | { 187 | d_refresh_rate=75; 188 | if (d_vtotal_est<562) 189 | { 190 | //640x480 191 | d_Hvisible=640; 192 | d_Hsize=840; 193 | d_Vvisible=480; 194 | d_Vsize=500; 195 | } 196 | else if (d_vtotal_est>=562 && d_vtotal_est<646) 197 | { 198 | //800x600 199 | d_Hvisible=800; 200 | d_Hsize=1056; 201 | d_Vvisible=600; 202 | d_Vsize=625; 203 | } 204 | else if (d_vtotal_est>=646 && d_vtotal_est<733) 205 | { 206 | //832x624 207 | d_refresh_rate=(int)74.6; 208 | d_Hvisible=832; 209 | d_Hsize=1152; 210 | d_Vvisible=624; 211 | d_Vsize=667; 212 | } 213 | else if (d_vtotal_est>=733 && d_vtotal_est<850) 214 | { 215 | //1024x768 216 | d_refresh_rate=(int)75.1; 217 | d_Hvisible=1024; 218 | d_Hsize=1312; 219 | d_Vvisible=768; 220 | d_Vsize=800; 221 | } 222 | else if (d_vtotal_est>850 && d_vtotal_est<983) 223 | { 224 | //1152x864 225 | d_Hvisible=1152; 226 | d_Hsize=1600; 227 | d_Vvisible=864; 228 | d_Vsize=900; 229 | } 230 | else if (d_vtotal_est>983 && d_vtotal_est<1250) 231 | { 232 | //1280x1024 233 | d_Hvisible=1280; 234 | d_Hsize=1688; 235 | d_Vvisible=1024; 236 | d_Vsize=1066; 237 | } 238 | } 239 | }; 240 | 241 | public: 242 | infer_screen_resolution_impl(int sample_rate, int fft_size, float refresh_rate, bool automatic_mode); 243 | ~infer_screen_resolution_impl(); 244 | 245 | // Where all the action really happens 246 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 247 | 248 | void set_refresh_rate(float refresh_rate); 249 | 250 | int general_work(int noutput_items, 251 | gr_vector_int &ninput_items, 252 | gr_vector_const_void_star &input_items, 253 | gr_vector_void_star &output_items); 254 | 255 | }; 256 | 257 | } // namespace tempest 258 | } // namespace gr 259 | 260 | #endif /* INCLUDED_TEMPEST_INFER_SCREEN_RESOLUTION_IMPL_H */ 261 | 262 | --------------------------------------------------------------------------------