Skip to content

Commit

Permalink
Combining files
Browse files Browse the repository at this point in the history
  • Loading branch information
buldo committed Nov 16, 2023
1 parent e409d92 commit 4d8c866
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 39 deletions.
4 changes: 3 additions & 1 deletion WBLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ target_sources(wifibroadcast PRIVATE
# radiotap and fec
${CMAKE_CURRENT_LIST_DIR}/src/external/radiotap/radiotap.c
${CMAKE_CURRENT_LIST_DIR}/src/external/fec/fec_base.cpp

${CMAKE_CURRENT_LIST_DIR}/src/fec/FEC.cpp
${CMAKE_CURRENT_LIST_DIR}/src/fec/FECDecoder.cpp
${CMAKE_CURRENT_LIST_DIR}/src/fec/FECEncoder.cpp
${CMAKE_CURRENT_LIST_DIR}/src/fec/FECStream.cpp
${CMAKE_CURRENT_LIST_DIR}/src/fec/RxBlock.cpp

${CMAKE_CURRENT_LIST_DIR}/src/WBStreamRx.cpp
${CMAKE_CURRENT_LIST_DIR}/src/WBStreamTx.cpp
${CMAKE_CURRENT_LIST_DIR}/src/WBTxRx.cpp
Expand Down
2 changes: 1 addition & 1 deletion executables/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <string>

#include "../src/Encryption.h"
#include "../src/fec/FECStream.h"
#include "../src/fec/FEC.hpp"
#include "../src/HelperSources/RandomBufferPot.hpp"
#include "../src/HelperSources/SchedulingHelper.hpp"
#include "../src/external/fec/fec_base.h"
Expand Down
1 change: 0 additions & 1 deletion executables/unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <sstream>
#include <string>

#include "../src/fec/FECStream.h"
#include "../src/fec/FEC.hpp"

#include "../src/Encryption.h"
Expand Down
2 changes: 1 addition & 1 deletion src/WBStreamRx.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "moodycamel/concurrentqueue/blockingconcurrentqueue.h"
#include "moodycamel/readerwriterqueue/readerwritercircularbuffer.h"
#include "fec/FECStream.h"
#include "fec/FEC.hpp"
#include "HelperSources/Helper.hpp"
#include "HelperSources/SequenceNumberDebugger.hpp"
#include "HelperSources/TimeHelper.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/WBStreamTx.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "moodycamel/concurrentqueue/blockingconcurrentqueue.h"
#include "moodycamel/readerwriterqueue/readerwritercircularbuffer.h"
#include "fec/FECStream.h"
#include "fec/FEC.hpp"
#include "SimpleStream.hpp"
#include "HelperSources/TimeHelper.hpp"
#include "WBTxRx.h"
Expand Down
2 changes: 0 additions & 2 deletions src/fec/FECStream.cpp → src/fec/FEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Created by consti10 on 30.06.23.
//

#include "FECStream.h"

#include <cmath>

#include "FEC.hpp"
Expand Down
27 changes: 27 additions & 0 deletions src/fec/FEC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,31 @@ std::vector<unsigned int> fecDecode(unsigned int fragmentSize,
return indicesMissingPrimaryFragments;
}

/**
* For dynamic block sizes, we switched to a FEC overhead "percentage" value.
* e.g. the final data throughput ~= original data throughput * fec overhead
* percentage Rounds up / down (.5), but always at least 1
*/
uint32_t calculate_n_secondary_fragments(uint32_t n_primary_fragments,
uint32_t fec_overhead_perc);

/**
* calculate n from k and percentage as used in FEC terms
* (k: number of primary fragments, n: primary + secondary fragments)
*/
uint32_t calculateN(uint32_t k, uint32_t percentage);

void fec_stream_print_fec_optimization_method();

// quick math regarding sequence numbers:
// uint32_t holds max 4294967295 . At 10 000 pps (packets per seconds) (which is
// already completely out of reach) this allows the tx to run for 429496.7295
// seconds
// 429496.7295 / 60 / 60 = 119.304647083 hours which is also completely overkill
// for OpenHD (and after this time span, a "reset" of the sequence number
// happens anyways) unsigned 24 bits holds 16777215 . At 1000 blocks per second
// this allows the tx to create blocks for 16777.215 seconds or 4.6 hours. That
// should cover a flight (and after 4.6h a reset happens, which means you might
// lose a couple of blocks once every 4.6 h ) and 8 bits holds max 255.

#endif //WIFIBROADCAST_FEC_H
32 changes: 0 additions & 32 deletions src/fec/FECStream.h

This file was deleted.

0 comments on commit 4d8c866

Please sign in to comment.