viterbi: fixed incorrect initialization

master
Ismael Gomez 8 years ago
parent 17d5ebca7e
commit c732c5c5f0

@ -33,13 +33,25 @@ struct v37 {
decision_t *dp; /* Pointer to current decision */
metric_t *old_metrics, *new_metrics; /* Pointers to path metrics, swapped on every bit */
decision_t *decisions; /* Beginning of decisions for block */
uint32_t len;
};
void clear_v37(struct v37 *vp) {
bzero(vp->decisions, sizeof(decision_t)*vp->len);
vp->dp = NULL;
bzero(&vp->metrics1, sizeof(metric_t));
bzero(&vp->metrics2, sizeof(metric_t));
vp->old_metrics = NULL;
vp->new_metrics = NULL;
}
/* Initialize Viterbi decoder for start of new frame */
int init_viterbi37_port(void *p, int starting_state) {
struct v37 *vp = p;
uint32_t i;
clear_v37(vp);
if (p == NULL)
return -1;
for (i = 0; i < 64; i++)
@ -82,6 +94,8 @@ void *create_viterbi37_port(int polys[3], uint32_t len) {
return NULL ;
}
vp->len = len+6;
return vp;
}

@ -42,6 +42,7 @@ struct v37 {
decision_t *dp; /* Pointer to current decision */
metric_t *old_metrics,*new_metrics; /* Pointers to path metrics, swapped on every bit */
decision_t *decisions; /* Beginning of decisions for block */
uint32_t len;
};
void set_viterbi37_polynomial_sse(int polys[3]) {
@ -54,12 +55,23 @@ void set_viterbi37_polynomial_sse(int polys[3]) {
}
}
void clear_v37_sse(struct v37 *vp) {
bzero(vp->decisions, sizeof(decision_t)*vp->len);
vp->dp = NULL;
bzero(&vp->metrics1, sizeof(metric_t));
bzero(&vp->metrics2, sizeof(metric_t));
vp->old_metrics = NULL;
vp->new_metrics = NULL;
}
/* Initialize Viterbi decoder for start of new frame */
int init_viterbi37_sse(void *p, int starting_state) {
struct v37 *vp = p;
uint32_t i;
clear_v37_sse(vp);
for(i=0;i<64;i++)
vp->metrics1.c[i] = 63;
@ -89,6 +101,7 @@ void *create_viterbi37_sse(int polys[3], uint32_t len) {
return NULL;
}
vp->decisions = (decision_t *)p;
vp->len = len+6;
return vp;
}

Loading…
Cancel
Save