00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "dsputil.h"
00023 #include "mlp.h"
00024
00025 static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff,
00026 int firorder, int iirorder,
00027 unsigned int filter_shift, int32_t mask, int blocksize,
00028 int32_t *sample_buffer)
00029 {
00030 int32_t *firbuf = state;
00031 int32_t *iirbuf = state + MAX_BLOCKSIZE + MAX_FIR_ORDER;
00032 const int32_t *fircoeff = coeff;
00033 const int32_t *iircoeff = coeff + MAX_FIR_ORDER;
00034 int i;
00035
00036 for (i = 0; i < blocksize; i++) {
00037 int32_t residual = *sample_buffer;
00038 unsigned int order;
00039 int64_t accum = 0;
00040 int32_t result;
00041
00042 for (order = 0; order < firorder; order++)
00043 accum += (int64_t) firbuf[order] * fircoeff[order];
00044 for (order = 0; order < iirorder; order++)
00045 accum += (int64_t) iirbuf[order] * iircoeff[order];
00046
00047 accum = accum >> filter_shift;
00048 result = (accum + residual) & mask;
00049
00050 *--firbuf = result;
00051 *--iirbuf = result - accum;
00052
00053 *sample_buffer = result;
00054 sample_buffer += MAX_CHANNELS;
00055 }
00056 }
00057
00058 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx)
00059 {
00060 c->mlp_filter_channel = ff_mlp_filter_channel;
00061 if (ARCH_X86)
00062 ff_mlp_init_x86(c, avctx);
00063 }