Skip to content

Commit

Permalink
Viterbi decoder without SIMD instructions (Spiral - http://spiral.ece…
Browse files Browse the repository at this point in the history
….cmu.edu/) is added
  • Loading branch information
szabolor committed Feb 22, 2016
1 parent 88b147c commit 676fc9b
Show file tree
Hide file tree
Showing 6 changed files with 1,624 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*
!*.*
*.a
!*/

*.o
Expand Down
10 changes: 5 additions & 5 deletions smog_ref/decode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ all: libdecref dec_usage
dec_usage: libdecref dec_usage.c
$(CC) dec_usage.c $(LDFLAGS) -o dec_usage

libdecref: dec_ref.o rs/decode_rs.o viterbi/spiral-vit_v16-single.o
$(AR) rcs libdecref.a dec_ref.o rs/decode_rs.o viterbi/spiral-vit_v16-single.o
libdecref: dec_ref.o rs/decode_rs.o viterbi/spiral-vit_scalar.o
$(AR) rcs libdecref.a dec_ref.o rs/decode_rs.o viterbi/spiral-vit_scalar.o

dec_ref.o: dec_ref.c
$(CC) $(CFLAGS) -c -fPIC dec_ref.c -o dec_ref.o

rs/decode_rs.o: rs/decode_rs.c
$(CC) $(CFLAGS) -c -fPIC rs/decode_rs.c -o rs/decode_rs.o

viterbi/spiral-vit_v16-single.o: viterbi/spiral-vit_v16-single.c
$(CC) $(CFLAGS) -c -fPIC viterbi/spiral-vit_v16-single.c -o viterbi/spiral-vit_v16-single.o
viterbi/spiral-vit_scalar.o: viterbi/spiral-vit_scalar.c
$(CC) $(CFLAGS) -c -fPIC viterbi/spiral-vit_scalar.c -o viterbi/spiral-vit_scalar.o

clean: clean-debug
-$(RM) libdecref.a dec_ref.o rs/decode_rs.o viterbi/spiral-vit_v16-single.o
-$(RM) libdecref.a dec_ref.o rs/decode_rs.o viterbi/spiral-vit_scalar.o
-$(RM) dec_usage

clean-debug:
Expand Down
16 changes: 12 additions & 4 deletions smog_ref/decode/dec_ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@

/*
* Revised and modified by szabolor
* 2015
* 2015, 2016
*/

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "dec_ref.h"
#include "viterbi/spiral-vit_v16-single.h"
#include "rs/decode_rs.h"

const uint8_t Scrambler[320] = {
0xff, 0x48, 0x0e, 0xc0, 0x9a, 0x0d, 0x70, 0xbc, 0x8e, 0x2c, 0x93, 0xad, 0xa7, 0xb7, 0x46, 0xce,
Expand Down Expand Up @@ -65,6 +64,8 @@ void deinterleave(uint8_t raw[RAW_SIZE], uint8_t conv[CONV_SIZE]) {
*/
void viterbi(uint8_t conv[CONV_SIZE], uint8_t dec_data[RS_SIZE]) {
struct v *vp;
COMPUTETYPE conv_compute[CONV_SIZE];
int i;

if((vp = create_viterbi(FRAMEBITS)) == NULL){
printf("create_viterbi failed\n");
Expand All @@ -73,7 +74,14 @@ void viterbi(uint8_t conv[CONV_SIZE], uint8_t dec_data[RS_SIZE]) {

init_viterbi(vp, 0);

update_viterbi_blk(vp, conv, FRAMEBITS+(K-1));
// COMPUTETYPE is set to uint32, so convert uint8 to uint32
// but the softbit value should be between 0 and 255 (!)
i = CONV_SIZE;
while (i--) {
conv_compute[i] = conv[i];
}

update_viterbi_blk(vp, conv_compute, FRAMEBITS+(K-1));
chainback_viterbi(vp, dec_data, FRAMEBITS, 0);

delete_viterbi(vp);
Expand Down
16 changes: 9 additions & 7 deletions smog_ref/decode/dec_ref.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#ifndef DEC_REF_H
#define DEC_REF_H

#include <stdint.h> // uint8_t
#include <stdint.h>
#include "viterbi/spiral-vit_scalar.h"
#include "rs/decode_rs.h"

#define DEBUG

#define RAW_SIZE (5200)
#define CONV_SIZE (5132)
#define RAW_SIZE 5200
#define CONV_SIZE 5132

#define RS_SIZE (320)
#define DATA_SIZE (256)
#define FRAME_BITS (2560)
#define RS_BLOCK_SIZE (160)
#define RS_SIZE 320
#define DATA_SIZE 256
#define FRAME_BITS 2560
#define RS_BLOCK_SIZE 160

extern const uint8_t Scrambler[320];

Expand Down
Loading

0 comments on commit 676fc9b

Please sign in to comment.