WLSB problems
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
rohc | Status tracked in Rohc-main | |||||
1.2.x |
Won't Fix
|
Low
|
Didier Barvaux | |||
1.3.x |
Won't Fix
|
Low
|
Didier Barvaux | |||
Rohc-main |
Fix Released
|
Low
|
Didier Barvaux |
Bug Description
During the work with the RoHC library I have found some problems and I only want to support you.
common/wlsb.c
-------
281:
/* change the minimal and maximal values if appropriate */
if(wlsb-
min = wlsb->window[
if(wlsb-
max = wlsb->window[
Is there a case where min != max after this lines of code?
However I have exchange the lines 297-303 with the following:
/* this is a short workaround, if min == max everything is calculated twice */
if (min != max)
{
/* find the minimal number of bits for the lower limit of the interval */
k1 = g(min, value, wlsb->p, wlsb->bits);
/* find the minimal number of bits for the upper limit of the interval */
k2 = g(max, value, wlsb->p, wlsb->bits);
/* keep the greatest one */
*bits_nr = (k1 > k2) ? k1 : k2;
}
else
{
/* find the minimal number of bits for the lower limit of the interval */
*bits_nr = g(min, value, wlsb->p, wlsb->bits);
}
This only reduces the count of operations.
common/interval.c
-------
68:
/* special computation for SN encoding */
if(k <= 4)
{
computed_p = 1;
}
else
{
computed_p = (1 << (k - 5)) - 1;
}
It is better to change the if statement to 'if(k <= 5)', because for 5 computed_p is zero.
You handelt the shift operator not consitent. Inside this function the shift operator is set to a positive value for a positve growing window. That works fine. But for a p given directly as parameter for the function is negative (i.a. -1).
This follows is a wrong calculated window. I have fixed this with the following lines (exchanged with lines 80-81):
/* otherwise: use the p value given as parameter */
// computed_p = p;
/* the shift defined here is positive, but a shift from the outside is negative for the same direction */
computed_p = p * (-1);
decomp/feedback.c
-------
At least a short fix for a wrong calculated SN inside the feedback.
85:
feedback->data[1] = sn & 0xff00 >> 8;
change to
feedback->data[1] = (sn & 0xff00) >> 8;
I hope that helps you a little bit. Best regards,
Arne
tags: | added: library |
For wlsb.c:
- yes, min may be different of max
- your optimisation for the min == max case is welcome. Thanks.
For interval.c:
- the k == 5 case could be handled by a 'else if' branch but not by a 'if(k <= 5)'
because currently computed_p is 0 for k ==5 not 1
- I did not understand your analysis of the shift parameter. What's the
problem with p == -1 ?
For feedback.c: you're right, could be fixed in the 1.2.x and 1.3.x branches too.
Didier