diff options
| author | Mathias Agopian <mathias@google.com> | 2012-11-04 02:03:49 -0800 | 
|---|---|---|
| committer | Mathias Agopian <mathias@google.com> | 2012-11-05 01:03:43 -0800 | 
| commit | 46afbec3743f1d799f185273ff897d1f8e0175dd (patch) | |
| tree | ed6dbf983c554f78ab107d3002f6201e51356961 /tools/resampler_tools | |
| parent | a798c97386a842d06d290797ba5dce95d031332a (diff) | |
| download | frameworks_av-46afbec3743f1d799f185273ff897d1f8e0175dd.zip frameworks_av-46afbec3743f1d799f185273ff897d1f8e0175dd.tar.gz frameworks_av-46afbec3743f1d799f185273ff897d1f8e0175dd.tar.bz2  | |
change how we store the FIR coefficients
The coefficient table is now transposed and shows
much better its polyphase nature: we now have a FIR
per line, each line corresponding to a phase.
This doesn't change at all the results produced by
the filter, but allows us to make slightly better
use of the data cache and improves performance a bit
(although not as much as I thought it would).
The main benefit is that it is the first step
before we can make much larger optimizations
(like using NEON).
Change-Id: Iebf7695825dcbd41f25861efcaefbaa3365ecb43
Diffstat (limited to 'tools/resampler_tools')
| -rw-r--r-- | tools/resampler_tools/fir.cpp | 39 | 
1 files changed, 19 insertions, 20 deletions
diff --git a/tools/resampler_tools/fir.cpp b/tools/resampler_tools/fir.cpp index ea3ef50..cc3d509 100644 --- a/tools/resampler_tools/fir.cpp +++ b/tools/resampler_tools/fir.cpp @@ -195,7 +195,8 @@ int main(int argc, char** argv)      // total number of coefficients (one side) -    const int N = (1 << nz) * nzc; +    const int M = (1 << nz); +    const int N = M * nzc;      // generate the right half of the filter      if (!debug) { @@ -220,22 +221,25 @@ int main(int argc, char** argv)      }      if (!polyphase) { -        for (int i=0 ; i<N ; i++) { -            double x = (2.0 * M_PI * i * Fcr) / (1 << nz); -            double y = kaiser(i+N, 2*N, beta) * sinc(x) * 2.0 * Fcr; -            y *= atten; +        for (int i=0 ; i<=M ; i++) { // an extra set of coefs for interpolation +            for (int j=0 ; j<nzc ; j++) { +                int ix = j*M + i; +                double x = (2.0 * M_PI * ix * Fcr) / (1 << nz); +                double y = kaiser(ix+N, 2*N, beta) * sinc(x) * 2.0 * Fcr; +                y *= atten; -            if (!debug) { -                if ((i % (1<<nz)) == 0) -                    printf("\n    "); -            } +                if (!debug) { +                    if (j == 0) +                        printf("\n    "); +                } -            if (!format) { -                int64_t yi = floor(y * ((1ULL<<(nc-1))) + 0.5); -                if (yi >= (1LL<<(nc-1))) yi = (1LL<<(nc-1))-1; -                printf("0x%08x, ", int32_t(yi)); -            } else { -                printf("%.9g%s ", y, debug ? "," : "f,"); +                if (!format) { +                    int64_t yi = floor(y * ((1ULL<<(nc-1))) + 0.5); +                    if (yi >= (1LL<<(nc-1))) yi = (1LL<<(nc-1))-1; +                    printf("0x%08x, ", int32_t(yi)); +                } else { +                    printf("%.9g%s ", y, debug ? "," : "f,"); +                }              }          }      } else { @@ -266,11 +270,6 @@ int main(int argc, char** argv)      }      if (!debug) { -        if (!format) { -            printf("\n    0x%08x ", 0); -        } else { -            printf("\n    %.9g ", 0.0f); -        }          printf("\n};");      }      printf("\n");  | 
