summaryrefslogtreecommitdiff
path: root/libavcodec/lsp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-28 16:28:48 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-28 16:28:48 +0200
commit416d2f7a1244e7e93e291786ac98313153f87db5 (patch)
tree231d0d704cda257e4bc2a210df6b2fe553f407c6 /libavcodec/lsp.c
parentfb6fb0dedbc103ba9cd4e7d63edee15317143b21 (diff)
parent7627c35a81241c98768d2d1f13d576591cac0b1c (diff)
downloadffmpeg-416d2f7a1244e7e93e291786ac98313153f87db5.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: vc1: export some functions configure: use HOSTCC_C/O in check_host_cc configure: use AS_O setting in check_as configure: use LD_O setting in check_ld() Revert "dsputil: make {add/put/put_signed}_pixels_clamped() non-static." build: Restore dependency of acelp_filters.o on celp_math.o celp_math: Replace duplicate ff_dot_productf() by ff_scalarproduct_c() celp_math: Move ff_cos() to the only place it is used build: Use portable abstraction for linker/hostcc output file syntax configure: Fix shared library creation for OpenBSD vp56: Don't use DECLARE_ALIGN on a typedef name mss1: move code that will be reused by MSS2 decoder into separate file mss1: merge decode_intra() and decode_inter() avprobe: Get rid of ugly casts in the options table vf_hqdn3d: Remove a duplicate inline declaration Conflicts: Makefile configure ffprobe.c libavcodec/Makefile libavcodec/amrnbdec.c libavcodec/amrwbdec.c libavcodec/celp_math.c libavcodec/celp_math.h libavcodec/dsputil.c libavcodec/lsp.c libavcodec/mss1.c libavcodec/ra288.c libavcodec/vc1dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/lsp.c')
-rw-r--r--libavcodec/lsp.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c
index c2d0c6dad4..62ac92fbe1 100644
--- a/libavcodec/lsp.c
+++ b/libavcodec/lsp.c
@@ -27,11 +27,9 @@
#define FRAC_BITS 14
#include "mathops.h"
#include "lsp.h"
-#include "celp_math.h"
#include "libavcodec/mips/lsp_mips.h"
#include "libavutil/avassert.h"
-
void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max, int lp_order)
{
int i, j;
@@ -58,6 +56,30 @@ void ff_set_min_dist_lsf(float *lsf, double min_spacing, int size)
prev = lsf[i] = FFMAX(lsf[i], prev + min_spacing);
}
+
+/* Cosine table: base_cos[i] = (1 << 15) * cos(i * PI / 64) */
+static const int16_t tab_cos[65] =
+{
+ 32767, 32738, 32617, 32421, 32145, 31793, 31364, 30860,
+ 30280, 29629, 28905, 28113, 27252, 26326, 25336, 24285,
+ 23176, 22011, 20793, 19525, 18210, 16851, 15451, 14014,
+ 12543, 11043, 9515, 7965, 6395, 4810, 3214, 1609,
+ 1, -1607, -3211, -4808, -6393, -7962, -9513, -11040,
+ -12541, -14012, -15449, -16848, -18207, -19523, -20791, -22009,
+ -23174, -24283, -25334, -26324, -27250, -28111, -28904, -29627,
+ -30279, -30858, -31363, -31792, -32144, -32419, -32616, -32736, -32768,
+};
+
+static int16_t ff_cos(uint16_t arg)
+{
+ uint8_t offset= arg;
+ uint8_t ind = arg >> 8;
+
+ assert(arg <= 0x3fff);
+
+ return tab_cos[ind] + (offset * (tab_cos[ind+1] - tab_cos[ind]) >> 8);
+}
+
void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order)
{
int i;