diff options
author | Arwed v. Merkatz <v.merkatz@gmx.net> | 2004-11-26 23:10:28 +0000 |
---|---|---|
committer | Arwed v. Merkatz <v.merkatz@gmx.net> | 2004-11-26 23:10:28 +0000 |
commit | aeb09d35abf17934407c8e1c826de3d8fab7193d (patch) | |
tree | d0fe82628748857181a06244014a924e4655682f /gst/tta/filters.h | |
parent | 90bf594c667017695e13238ec9b5970501b34dd9 (diff) | |
download | gst-plugins-bad-aeb09d35abf17934407c8e1c826de3d8fab7193d.tar.gz gst-plugins-bad-aeb09d35abf17934407c8e1c826de3d8fab7193d.tar.bz2 gst-plugins-bad-aeb09d35abf17934407c8e1c826de3d8fab7193d.zip |
added TTA parser and decoder
Original commit message from CVS:
added TTA parser and decoder
Diffstat (limited to 'gst/tta/filters.h')
-rw-r--r-- | gst/tta/filters.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/gst/tta/filters.h b/gst/tta/filters.h new file mode 100644 index 00000000..e2c176e1 --- /dev/null +++ b/gst/tta/filters.h @@ -0,0 +1,110 @@ +/* + * filters.h + * + * Description: TTAv1 filter functions + * Developed by: Alexander Djourik <sasha@iszf.irk.ru> + * Pavel Zhilin <pzh@iszf.irk.ru> + * + * Copyright (c) 1999-2004 Alexander Djourik. All rights reserved. + * + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * aint with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please see the file COPYING in this directory for full copyright + * information. + */ + +#ifndef FILTERS_H +#define FILTERS_H + +///////// Filter Settings ////////// +static long flt_set[3] = {10, 9, 10}; + +static void +memshl (register long *pA, register long *pB) { + *pA++ = *pB++; + *pA++ = *pB++; + *pA++ = *pB++; + *pA++ = *pB++; + *pA++ = *pB++; + *pA++ = *pB++; + *pA++ = *pB++; + *pA = *pB; +} + +static void +hybrid_filter (fltst *fs, long *in) { + register long *pA = fs->dl; + register long *pB = fs->qm; + register long *pM = fs->dx; + register long sum = fs->round; + + if (!fs->error) { + sum += *pA++ * *pB, pB++; + sum += *pA++ * *pB, pB++; + sum += *pA++ * *pB, pB++; + sum += *pA++ * *pB, pB++; + sum += *pA++ * *pB, pB++; + sum += *pA++ * *pB, pB++; + sum += *pA++ * *pB, pB++; + sum += *pA++ * *pB, pB++; pM += 8; + } else if (fs->error < 0) { + sum += *pA++ * (*pB -= *pM++), pB++; + sum += *pA++ * (*pB -= *pM++), pB++; + sum += *pA++ * (*pB -= *pM++), pB++; + sum += *pA++ * (*pB -= *pM++), pB++; + sum += *pA++ * (*pB -= *pM++), pB++; + sum += *pA++ * (*pB -= *pM++), pB++; + sum += *pA++ * (*pB -= *pM++), pB++; + sum += *pA++ * (*pB -= *pM++), pB++; + } else { + sum += *pA++ * (*pB += *pM++), pB++; + sum += *pA++ * (*pB += *pM++), pB++; + sum += *pA++ * (*pB += *pM++), pB++; + sum += *pA++ * (*pB += *pM++), pB++; + sum += *pA++ * (*pB += *pM++), pB++; + sum += *pA++ * (*pB += *pM++), pB++; + sum += *pA++ * (*pB += *pM++), pB++; + sum += *pA++ * (*pB += *pM++), pB++; + } + + *(pM-0) = ((*(pA-1) >> 30) | 1) << 2; + *(pM-1) = ((*(pA-2) >> 30) | 1) << 1; + *(pM-2) = ((*(pA-3) >> 30) | 1) << 1; + *(pM-3) = ((*(pA-4) >> 30) | 1); + + fs->error = *in; + *in += (sum >> fs->shift); + *pA = *in; + + *(pA-1) = *(pA-0) - *(pA-1); + *(pA-2) = *(pA-1) - *(pA-2); + *(pA-3) = *(pA-2) - *(pA-3); + + memshl (fs->dl, fs->dl + 1); + memshl (fs->dx, fs->dx + 1); +} + +static void +filter_init (fltst *fs, long shift) { + memset (fs, 0, sizeof(fltst)); + fs->shift = shift; + fs->round = 1 << (shift - 1); +} + +#endif /* FILTERS_H */ + |