Skip to content

Commit

Permalink
Merge pull request #1404 from Paulo-D2000/master
Browse files Browse the repository at this point in the history
MSVC M17 FIX
  • Loading branch information
f4exb authored Sep 7, 2022
2 parents 664e627 + fc1f511 commit 1837763
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion modemm17/M17FrameDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,4 @@ struct M17FrameDecoder
State state() const { return state_; }
};

} // modemm17
} // modemm17
20 changes: 10 additions & 10 deletions modemm17/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ auto llr(float sample)
return std::get<1>(*it);
}

template <size_t IN, size_t OUT, size_t P>
size_t depuncture( // FIXME: MSVC
const std::array<int8_t, IN>& in,
std::array<int8_t, OUT>& out,
template <size_t IN1, size_t OUT1, size_t P>
size_t depuncture( // FIXED: MSVC (MULTIPLE DEFINITIONS SAME TEMPLATE)
const std::array<int8_t, IN1>& in,
std::array<int8_t, OUT1>& out,
const std::array<int8_t, P>& p
)
{
size_t index = 0;
size_t pindex = 0;
size_t bit_count = 0;
for (size_t i = 0; i != OUT && index < IN; ++i)
for (size_t i = 0; i != OUT1 && index < IN1; ++i)
{
if (!p[pindex++])
{
Expand All @@ -160,17 +160,17 @@ size_t depuncture( // FIXME: MSVC
}


template <size_t IN, size_t OUT, size_t P>
size_t puncture( // FIXME: MSVC
const std::array<uint8_t, IN>& in,
std::array<int8_t, OUT>& out,
template <size_t IN0, size_t OUT0, size_t P>
size_t puncture( // FIXED::MSVC (MULTIPLE DEFINITIONS OF THE SAME TEMPLATE)
const std::array<uint8_t, IN0>& in,
std::array<int8_t, OUT0>& out,
const std::array<int8_t, P>& p
)
{
size_t index = 0;
size_t pindex = 0;
size_t bit_count = 0;
for (size_t i = 0; i != IN && index != OUT; ++i)
for (size_t i = 0; i != IN0 && index != OUT0; ++i)
{
if (p[pindex++])
{
Expand Down
14 changes: 7 additions & 7 deletions modemm17/Viterbi.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,26 @@ struct Viterbi
*
* @return path metric for estimating BER.
*/
template <size_t IN, size_t OUT>
size_t decode(const std::array<int8_t, IN>& in, std::array<uint8_t, OUT>& out)
template <size_t IN2, size_t OUT2>
size_t decode(const std::array<int8_t, IN2>& in, std::array<uint8_t, OUT2>& out)
{
static_assert(sizeof(history_) >= IN / 2, "Invalid size");
static_assert(sizeof(history_) >= IN2 / 2, "Invalid size");

constexpr auto MAX_METRIC = std::numeric_limits<typename metrics_t::value_type>::max() / 2;

prevMetrics.fill(MAX_METRIC);
prevMetrics[0] = 0; // Starting point.

auto hbegin = history_.begin();
auto hend = history_.begin() + IN / 2;
auto hend = history_.begin() + IN2 / 2;

constexpr size_t BUTTERFLY_SIZE = NumStates / 2;

size_t hindex = 0;
std::array<int16_t, BUTTERFLY_SIZE> cost0;
std::array<int16_t, BUTTERFLY_SIZE> cost1;

for (size_t i = 0; i != IN; i += 2, hindex += 1)
for (size_t i = 0; i != IN2; i += 2, hindex += 1)
{
int16_t s0 = in[i];
int16_t s1 = in[i + 1];
Expand Down Expand Up @@ -227,11 +227,11 @@ struct Viterbi
auto hit = std::make_reverse_iterator(hend); // rbegin
auto hrend = std::make_reverse_iterator(hbegin); // rend
size_t next_element = min_element;
size_t index = IN / 2;
size_t index = IN2 / 2;
while (oit != std::rend(out) && hit != hrend)
{
auto v = (*hit++)[next_element];
if (index-- <= OUT) *oit++ = next_element & 1;
if (index-- <= OUT2) *oit++ = next_element & 1;
next_element = prevState_[next_element][v];
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/channelrx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if (ENABLE_CHANNELRX_DEMODFREEDV AND CODEC2_FOUND)
add_subdirectory(demodfreedv)
endif()

if (LINUX AND ENABLE_CHANNELRX_DEMODM17 AND CODEC2_FOUND)
if (ENABLE_CHANNELRX_DEMODM17 AND CODEC2_FOUND)
add_subdirectory(demodm17)
endif()

Expand Down
3 changes: 1 addition & 2 deletions plugins/channelrx/demodm17/m17demodplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////

#include "m17demodplugin.h"

//REMOVED REPEATED INCLUDE...
#include <QtPlugin>
#include "plugin/pluginapi.h"
#ifndef SERVER_MODE
Expand Down
2 changes: 1 addition & 1 deletion plugins/channeltx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ if (ENABLE_CHANNELTX_MODFREEDV AND CODEC2_FOUND)
add_subdirectory(modfreedv)
endif()

if (LINUX AND ENABLE_CHANNELTX_MODM17 AND CODEC2_FOUND)
if (ENABLE_CHANNELTX_MODM17 AND CODEC2_FOUND)
add_subdirectory(modm17)
endif()

0 comments on commit 1837763

Please sign in to comment.