|
Subject: |
Re: bug in recCompress.c |
|
From: |
[email protected] (Marty Kraimer) |
|
Date: |
Mon, 13 Feb 1995 12:57:04 -0600 |
> From [email protected] Mon Feb 13 07:38 CST 1995
> Date: Mon, 13 Feb 95 14:39:42 GMT
> From: "F. Gougnaud" <[email protected]>
> To: [email protected]
> Subject: bug in recCompress.c
> Content-Type> : > text>
> Content-Length: 1100
>
> Hi,
>
>
>
> I have corrected a bug in the recCompress.c file in EPICS release 3.11.
>
> The AVERAGE algorithm doesn't work when the N field is greater than 1 (!)
> because the routine array_average() doesn't update the INX record's field.
>
> The routine must be modified like this:
>
> ...
> /* do we need to calculate the result */
> inx++;
> if (pcompress->n<=0) pcompress->n=1;
> n = pcompress->n;
> pcompress->inx = inx; <---- add this line
> if (inx<n) return(1);
> if (n>1) {
> pcompress->inx = 0; <---- and this line
> psum = (double *)pcompress->sptr;
> multiplier = 1.0/((double)n);
> for (i = 0; i < nuse; i++, psum++)
> *psum = *psum * multiplier;
> }
> put_value(pcompress,pcompress->sptr,nuse);
> return(0);
>
You must have an older version of epics. The current version, which appears
to be equivalent to your suggested changes has the code:
> A static int array_average(pcompress,psource,no_elements)
struct compressRecord *pcompress;
double *psource;
long no_elements;
{
long i;
long nnow;
long nsam=pcompress->nsam;
double *psum;
double multiplier;
long inx=pcompress->inx;
struct dbAddr *pdbAddr = (struct dbAddr *)(pcompress->inp.value.db_link.pdbAddr);
long ninp=pdbAddr->no_elements;
long nuse,n;
nuse = nsam;
if(nuse>ninp) nuse = ninp;
nnow=nuse;
if(nnow>no_elements) nnow=no_elements;
psum = (double *)pcompress->sptr;
/* add in the new waveform */
if (inx == 0){
for (i = 0; i < nnow; i++)
*psum++ = *psource++;
for(i=nnow; i<nuse; i++) *psum++ = 0;
}else{
for (i = 0; i < nnow; i++)
*psum++ += *psource++;
}
/* do we need to calculate the result */
inx++;
if(pcompress->n<=0)pcompress->n=1;
n = pcompress->n;
if (inx<n) {
pcompress->inx = inx;
return(1);
}
if(n>1) {
psum = (double *)pcompress->sptr;
multiplier = 1.0/((double)n);
for (i = 0; i < nuse; i++, psum++)
*psum = *psum * multiplier;
}
put_value(pcompress,pcompress->sptr,nuse);
pcompress->inx = 0;
return(0);
}
>suggestion for the compress record type:
>
> in 3.11 it's not possible to modify the N field of a compress record from
> an application. For that, the N field definition in the compressRecord.ascii
> file need to be changed like this:
>
> (before) "N to 1 Compression" N SPC_NOMOD DBF_ULONG ...
> (after) "N to 1 Compression" N SPC_RESET DBF_ULONG ...
>
>
> Yves Lussignol.
>
Good suggestion. I am making this change to this field and also to ALG.
Marty
- Navigate by Date:
- Prev:
Re: EPICS on the Alpha 415
- Next:
Re: EPICS on the Alpha watson
- Index:
1994
<1995>
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
- Navigate by Thread:
- Prev:
Re: bug in recCompress.c Rozelle Wright
- Next:
loading ascii database records Alan K Biocca
- Index:
1994
<1995>
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
|