2

我需要对一些卷积编码信号进行维特比解码。我的应用程序适用于大文件,因此我无法将所有信号插入堆中,因此我需要通过一系列单独的缓冲区来处理数据。我找到了一个很好的维特比解码库——在博士的 C++ 中的编码器和维特比解码器。多布斯。我已经应用了库中的解码器,它工作正常,但没有提供连续使用的功能(考虑到先前的计算,为每个信号缓冲区多次调用一个函数)。然后我找到了 提供必要功能的GNU Radio C++ 库。但我不明白如何使用它的功能,因为它不提供文档。它包含维特比解码的例子如下:

extern "C" {
#include <gnuradio/fec/viterbi.h>
}

#include <cstdio>
#include <cmath>

#define MAXCHUNKSIZE 4096
#define MAXENCSIZE MAXCHUNKSIZE*16

int main()
{
  unsigned char data[MAXCHUNKSIZE];
  signed char syms[MAXENCSIZE];
  int count = 0;

  // Initialize metric table
  int mettab[2][256];
  int amp = 100;  // What is it? ***
  float RATE=0.5;
  float ebn0 = 12.0;
  float esn0 = RATE*pow(10.0, ebn0/10);
  gen_met(mettab, amp, esn0, 0.0, 4);

  // Initialize decoder state
  struct viterbi_state state0[64];
  struct viterbi_state state1[64];
  unsigned char viterbi_in[16];
  viterbi_chunks_init(state0);

  while (!feof(stdin)) {
    unsigned int n = fread(syms, 1, MAXENCSIZE, stdin);
    unsigned char *out = data;

    for (unsigned int i = 0; i < n; i++) {

      // FIXME: This implements hard decoding by slicing the input stream
      unsigned char sym = syms[i] > 0 ? -amp : amp; // What is it? ***

      // Write the symbol to the decoder input
      viterbi_in[count % 4] = sym;

      // Every four symbols, perform the butterfly2 operation
      if ((count % 4) == 3) {
        viterbi_butterfly2(viterbi_in, mettab, state0, state1);

    // Every sixteen symbols, perform the readback operation
        if ((count > 64) && (count % 16) == 11) {
          viterbi_get_output(state0, out);
      fwrite(out++, 1, 1, stdout);
    }
      }

      count++;
    }
  }

  return 0;
}

其中的文件viterbi.c还包含下一个函数viterbi(),但没有声明:

/* Viterbi decoder */
int viterbi(unsigned long *metric,  /* Final path metric (returned value) */
    unsigned char *data,    /* Decoded output data */
    unsigned char *symbols, /* Raw deinterleaved input symbols */
    unsigned int nbits, /* Number of output bits */
    int mettab[2][256]  /* Metric table, [sent sym][rx symbol] */
    ) { ...

我还发现了 Viterbi 解码的另一种实现方式 -螺旋项目。但它也不包含正常的描述,也不想编译。ExpertCore前向纠错 DSP 库还有两个实现。

我的问题:谁能理解如何使用上述 GNU Radio 的 Viterbi 算法实现连续用于二进制交错数字信号(我的信号的编码器参数:K=7 rate=1/2,我文件中的每一位都是解调的信号样本)?

4

0 回答 0