summaryrefslogtreecommitdiff
path: root/libavcodec/arm
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-02 01:51:44 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-02 01:54:27 +0200
commit4defa68fe25eae4d7c27341e3b35811c047dcd3f (patch)
tree9d4d37343ec4c99801c1b76b813b0a5b2b04576b /libavcodec/arm
parenta2f5e14a867768019b49b830e29801f1bfb2abb7 (diff)
parentaa05f2126e18d23432bde77e6f44e41691472fef (diff)
Merge remote branch 'qatar/master'
* qatar/master: ac3enc: ARM optimised ac3_compute_matissa_size ac3: armv6 optimised bit_alloc_calc_bap fate: simplify fft test rules avio: document avio_alloc_context. lavf: make compute_chapters_end less picky. sierravmd: fix Indeo3 videos FFT: simplify fft8() fate: add fixed-point fft/mdct tests Fixed-point support in fft-test ape: check that number of seektable entries is equal to number of frames Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/arm')
-rw-r--r--libavcodec/arm/Makefile6
-rw-r--r--libavcodec/arm/ac3dsp_arm.S52
-rw-r--r--libavcodec/arm/ac3dsp_armv6.S83
-rw-r--r--libavcodec/arm/ac3dsp_init_arm.c13
4 files changed, 153 insertions, 1 deletions
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 08697da29b..3b77a5548d 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -1,6 +1,10 @@
-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o
+OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \
+ arm/ac3dsp_arm.o
+
OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \
+ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
+
OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o
OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o
OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o
diff --git a/libavcodec/arm/ac3dsp_arm.S b/libavcodec/arm/ac3dsp_arm.S
new file mode 100644
index 0000000000..d7d498e41f
--- /dev/null
+++ b/libavcodec/arm/ac3dsp_arm.S
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+function ff_ac3_compute_mantissa_size_arm, export=1
+ push {r4-r8,lr}
+ ldm r0, {r4-r8}
+ mov r3, r0
+ mov r0, #0
+1:
+ ldrb lr, [r1], #1
+ subs r2, r2, #1
+ blt 2f
+ cmp lr, #4
+ bgt 3f
+ subs lr, lr, #1
+ addlt r4, r4, #1
+ addeq r5, r5, #1
+ ble 1b
+ subs lr, lr, #2
+ addlt r6, r6, #1
+ addeq r7, r7, #1
+ addgt r8, r8, #1
+ b 1b
+3:
+ cmp lr, #14
+ sublt lr, lr, #1
+ addgt r0, r0, #16
+ addle r0, r0, lr
+ b 1b
+2:
+ stm r3, {r4-r8}
+ pop {r4-r8,pc}
+endfunc
diff --git a/libavcodec/arm/ac3dsp_armv6.S b/libavcodec/arm/ac3dsp_armv6.S
new file mode 100644
index 0000000000..7f01addbde
--- /dev/null
+++ b/libavcodec/arm/ac3dsp_armv6.S
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+function ff_ac3_bit_alloc_calc_bap_armv6, export=1
+ ldr r12, [sp]
+ cmp r12, #-960
+ beq 4f
+ push {r4-r11,lr}
+ add r5, sp, #40
+ movrel r4, X(ff_ac3_bin_to_band_tab)
+ movrel lr, X(ff_ac3_band_start_tab)
+ ldm r5, {r5-r7}
+ ldrb r4, [r4, r2]
+ add r1, r1, r2, lsl #1 @ psd + start
+ add r0, r0, r4, lsl #1 @ mask + band
+ add r4, lr, r4
+ add r7, r7, r2 @ bap + start
+ ldrb r10, [r4], #1
+1:
+ ldrsh r9, [r0], #2 @ mask[band]
+ movw r8, #0x1fe0
+ sub r9, r9, r12 @ - snr_offset
+ mov r11, r10
+ ldrb r10, [r4], #1 @ band_start_tab[band++]
+ subs r9, r9, r5 @ - floor
+ movlt r9, #0
+ cmp r10, r3 @ - end
+ and r9, r9, r8 @ & 0x1fe0
+ subgt r8, r3, r11
+ suble r8, r10, r11
+ add r9, r9, r5 @ + floor => m
+ tst r8, #1
+ add r2, r7, r8
+ bne 3f
+ b 5f
+2:
+ ldrsh r8, [r1], #2
+ ldrsh lr, [r1], #2
+ sub r8, r8, r9
+ sub lr, lr, r9
+ usat r8, #6, r8, asr #5 @ address
+ usat lr, #6, lr, asr #5
+ ldrb r8, [r6, r8] @ bap_tab[address]
+ ldrb lr, [r6, lr]
+ strb r8, [r7], #1 @ bap[bin]
+ strb lr, [r7], #1
+5: cmp r7, r2
+ blo 2b
+ cmp r3, r11
+ bgt 1b
+ pop {r4-r11,pc}
+3:
+ ldrsh r8, [r1], #2 @ psd[bin]
+ sub r8, r8, r9 @ - m
+ usat r8, #6, r8, asr #5 @ address
+ ldrb r8, [r6, r8] @ bap_tab[address]
+ strb r8, [r7], #1 @ bap[bin]
+ b 5b
+4:
+ ldr r0, [sp, #12]
+ mov r1, #0
+ mov r2, #256
+ b memset
+endfunc
diff --git a/libavcodec/arm/ac3dsp_init_arm.c b/libavcodec/arm/ac3dsp_init_arm.c
index 0dfeaa9c80..8534c9b97c 100644
--- a/libavcodec/arm/ac3dsp_init_arm.c
+++ b/libavcodec/arm/ac3dsp_init_arm.c
@@ -29,8 +29,21 @@ void ff_ac3_lshift_int16_neon(int16_t *src, unsigned len, unsigned shift);
void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift);
void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len);
+void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd,
+ int start, int end,
+ int snr_offset, int floor,
+ const uint8_t *bap_tab, uint8_t *bap);
+
+int ff_ac3_compute_mantissa_size_arm(int cnt[5], uint8_t *bap, int nb_coefs);
+
av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
{
+ c->compute_mantissa_size = ff_ac3_compute_mantissa_size_arm;
+
+ if (HAVE_ARMV6) {
+ c->bit_alloc_calc_bap = ff_ac3_bit_alloc_calc_bap_armv6;
+ }
+
if (HAVE_NEON) {
c->ac3_exponent_min = ff_ac3_exponent_min_neon;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon;