From ecc8b02194463476112972e7be655e8541ef253e Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 5 Dec 2012 16:53:21 +0000 Subject: [PATCH 1/6] x86: float_dsp: fix compilation of ff_vector_dmul_scalar_avx() on x86-32 Signed-off-by: Janne Grunau --- libavutil/x86/float_dsp.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/x86/float_dsp.asm b/libavutil/x86/float_dsp.asm index d8fd93a625..4a1742f63a 100644 --- a/libavutil/x86/float_dsp.asm +++ b/libavutil/x86/float_dsp.asm @@ -127,7 +127,7 @@ cglobal vector_dmul_scalar, 3,3,3, dst, src, len cglobal vector_dmul_scalar, 4,4,3, dst, src, mul, len %endif %if ARCH_X86_32 - VBROADCASTSD xmm0, mulm + VBROADCASTSD m0, mulm %else %if WIN64 movlhps xmm2, xmm2 From b64ba37c4c0df829334ff60c253e10067eb29e76 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 5 Dec 2012 13:03:08 -0500 Subject: [PATCH 2/6] Changelog: add an entry for deprecating the avconv -vol option --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index f241e6d006..22374a3990 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,7 @@ version : - ashowinfo audio filter - 24-bit FLAC encoding - audio volume filter +- deprecated the avconv -vol option. the volume filter is to be used instead. - multi-channel ALAC encoding up to 7.1 From 33086f92652b5100dbb03bb2a355ebaa575f2876 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 28 Nov 2012 19:33:19 +0100 Subject: [PATCH 3/6] fate: image: Add dependencies --- tests/fate/image.mak | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/fate/image.mak b/tests/fate/image.mak index a6768a0be1..1e4bc56407 100644 --- a/tests/fate/image.mak +++ b/tests/fate/image.mak @@ -1,10 +1,10 @@ -FATE_SAMPLES_AVCONV += fate-dpx +FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, DPX) += fate-dpx fate-dpx: CMD = framecrc -i $(SAMPLES)/dpx/lighthouse_rgb48.dpx -FATE_SAMPLES_AVCONV += fate-pictor +FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, PICTOR) += fate-pictor fate-pictor: CMD = framecrc -i $(SAMPLES)/pictor/MFISH.PIC -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += fate-ptx +FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, PTX) += fate-ptx fate-ptx: CMD = framecrc -i $(SAMPLES)/ptx/_113kw_pic.ptx -pix_fmt rgb24 FATE_SUNRASTER += fate-sunraster-1bit-raw @@ -28,8 +28,10 @@ fate-sunraster-24bit-raw: CMD = framecrc -i $(SAMPLES)/sunraster/lena-24bit-raw. FATE_SUNRASTER += fate-sunraster-24bit-rle fate-sunraster-24bit-rle: CMD = framecrc -i $(SAMPLES)/sunraster/lena-24bit-rle.sun -FATE_SAMPLES_AVCONV += $(FATE_SUNRASTER) -fate-sunraster: $(FATE_SUNRASTER) +FATE_SUNRASTER-$(call DEMDEC, IMAGE2, SUNRAST) += $(FATE_SUNRASTER) + +FATE_SAMPLES_AVCONV += $(FATE_SUNRASTER-yes) +fate-sunraster: $(FATE_SUNRASTER-yes) FATE_TARGA = CBW8 \ CCM8 \ @@ -45,8 +47,10 @@ FATE_TARGA = CBW8 \ FATE_TARGA := $(FATE_TARGA:%=fate-targa-conformance-%) \ fate-targa-top-to-bottom -FATE_SAMPLES_AVCONV += $(FATE_TARGA) -fate-targa: $(FATE_TARGA) +FATE_TARGA-$(call DEMDEC, IMAGE2, TARGA) += $(FATE_TARGA) + +FATE_SAMPLES_AVCONV += $(FATE_TARGA-yes) +fate-targa: $(FATE_TARGA-yes) fate-targa-conformance-CBW8: CMD = framecrc -i $(SAMPLES)/targa-conformance/CBW8.TGA fate-targa-conformance-CCM8: CMD = framecrc -i $(SAMPLES)/targa-conformance/CCM8.TGA -pix_fmt rgba @@ -67,5 +71,7 @@ fate-tiff-fax-g3: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31D.TIF FATE_TIFF += fate-tiff-fax-g3s fate-tiff-fax-g3s: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31DS.TIF -FATE_SAMPLES_AVCONV += $(FATE_TIFF) -fate-tiff: $(FATE_TIFF) +FATE_TIFF-$(call DEMDEC, IMAGE2, TIFF) += $(FATE_TIFF) + +FATE_SAMPLES_AVCONV += $(FATE_TIFF-yes) +fate-tiff: $(FATE_TIFF-yes) From 9a16359c38888af6beab7e688fc55eaa60c835ec Mon Sep 17 00:00:00 2001 From: Christophe Gisquet Date: Fri, 30 Nov 2012 21:49:33 +0100 Subject: [PATCH 4/6] AAC SBR: use AVFloatDSPContext's vector_fmul Around 5% speedup on the code block using 'vector_fmul_add's. Signed-off-by: Diego Biurrun --- libavcodec/aacsbr.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 3fbba6f1dc..add9f18b49 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -74,7 +74,6 @@ enum { static VLC vlc_sbr[10]; static const int8_t vlc_sbr_lav[10] = { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 }; -static const DECLARE_ALIGNED(16, float, zero64)[64]; #define SBR_INIT_VLC_STATIC(num, size) \ INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \ @@ -1174,7 +1173,7 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, * (14496-3 sp04 p206) */ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, - SBRDSPContext *sbrdsp, + SBRDSPContext *sbrdsp, AVFloatDSPContext *fdsp, float *out, float X[2][38][64], float mdct_buf[2][64], float *v0, int *v_off, const unsigned int div) @@ -1205,7 +1204,7 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, mdct->imdct_half(mdct, mdct_buf[1], X[1][i]); sbrdsp->qmf_deint_bfly(v, mdct_buf[1], mdct_buf[0]); } - dsp->vector_fmul_add(out, v , sbr_qmf_window , zero64, 64 >> div); + fdsp->vector_fmul (out, v , sbr_qmf_window , 64 >> div); dsp->vector_fmul_add(out, v + ( 192 >> div), sbr_qmf_window + ( 64 >> div), out , 64 >> div); dsp->vector_fmul_add(out, v + ( 256 >> div), sbr_qmf_window + (128 >> div), out , 64 >> div); dsp->vector_fmul_add(out, v + ( 448 >> div), sbr_qmf_window + (192 >> div), out , 64 >> div); @@ -1703,12 +1702,14 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, nch = 2; } - sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, L, sbr->X[0], sbr->qmf_filter_scratch, + sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, &ac->fdsp, + L, sbr->X[0], sbr->qmf_filter_scratch, sbr->data[0].synthesis_filterbank_samples, &sbr->data[0].synthesis_filterbank_samples_offset, downsampled); if (nch == 2) - sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, R, sbr->X[1], sbr->qmf_filter_scratch, + sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, &ac->fdsp, + R, sbr->X[1], sbr->qmf_filter_scratch, sbr->data[1].synthesis_filterbank_samples, &sbr->data[1].synthesis_filterbank_samples_offset, downsampled); From 2aef3d66c9cdf9d9ad3ecec2fb0c6b3020e9d3b0 Mon Sep 17 00:00:00 2001 From: Christophe Gisquet Date: Fri, 24 Feb 2012 22:11:19 +0100 Subject: [PATCH 5/6] SBR DSP x86: implement SSE sbr_hf_gen Start and end index are multiple of 2, therefore guaranteeing aligned access. Also, this allows to generate 4 floats per loop, keeping the alignment all along. Timing: - 32 bits: 326c -> 172c - 64 bits: 323c -> 156c Signed-off-by: Diego Biurrun --- libavcodec/x86/sbrdsp.asm | 73 +++++++++++++++++++++++++++++++++++- libavcodec/x86/sbrdsp_init.c | 4 ++ 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm index c351de4430..b87da4a072 100644 --- a/libavcodec/x86/sbrdsp.asm +++ b/libavcodec/x86/sbrdsp.asm @@ -21,8 +21,11 @@ %include "libavutil/x86/x86util.asm" -;SECTION_RODATA -SECTION .text +SECTION_RODATA +; mask equivalent for multiply by -1.0 1.0 +ps_mask times 2 dd 1<<31, 0 + +SECTION_TEXT INIT_XMM sse cglobal sbr_sum_square, 2, 3, 6 @@ -112,3 +115,69 @@ cglobal sbr_hf_g_filt, 5, 6, 5 jnz .loop1 .end: RET + +; static void sbr_hf_gen_c(float (*X_high)[2], const float (*X_low)[2], +; const float alpha0[2], const float alpha1[2], +; float bw, int start, int end) +; +cglobal sbr_hf_gen, 4,4,8, X_high, X_low, alpha0, alpha1, BW, S, E + ; load alpha factors +%define bw m0 +%if ARCH_X86_64 == 0 || WIN64 + movss bw, BWm +%endif + movlps m2, [alpha1q] + movlps m1, [alpha0q] + shufps bw, bw, 0 + mulps m2, bw ; (a1[0] a1[1])*bw + mulps m1, bw ; (a0[0] a0[1])*bw = (a2 a3) + mulps m2, bw ; (a1[0] a1[1])*bw*bw = (a0 a1) + mova m3, m1 + mova m4, m2 + mova m7, [ps_mask] + + ; Set pointers +%if ARCH_X86_64 == 0 || WIN64 + ; start and end 6th and 7th args on stack + mov r2d, Sm + mov r3d, Em +%define start r2q +%define end r3q +%else +; BW does not actually occupy a register, so shift by 1 +%define start BWq +%define end Sq +%endif + sub start, end ; neg num of loops + lea X_highq, [X_highq + end*2*4] + lea X_lowq, [X_lowq + end*2*4 - 2*2*4] + shl start, 3 ; offset from num loops + + mova m0, [X_lowq + start] + movlhps m1, m1 ; (a2 a3 a2 a3) + movlhps m2, m2 ; (a0 a1 a0 a1) + shufps m3, m3, q0101 ; (a3 a2 a3 a2) + shufps m4, m4, q0101 ; (a1 a0 a1 a0) + xorps m3, m7 ; (-a3 a2 -a3 a2) + xorps m4, m7 ; (-a1 a0 -a1 a0) +.loop2: + mova m5, m0 + mova m6, m0 + shufps m0, m0, q2200 ; {Xl[-2][0],",Xl[-1][0],"} + shufps m5, m5, q3311 ; {Xl[-2][1],",Xl[-1][1],"} + mulps m0, m2 + mulps m5, m4 + mova m7, m6 + addps m5, m0 + mova m0, [X_lowq + start + 2*2*4] + shufps m6, m0, q0022 ; {Xl[-1][0],",Xl[0][0],"} + shufps m7, m0, q1133 ; {Xl[-1][1],",Xl[1][1],"} + mulps m6, m1 + mulps m7, m3 + addps m5, m6 + addps m7, m0 + addps m5, m7 + mova [X_highq + start], m5 + add start, 16 + jnz .loop2 + RET diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c index d272896704..51c4bd4a16 100644 --- a/libavcodec/x86/sbrdsp_init.c +++ b/libavcodec/x86/sbrdsp_init.c @@ -27,6 +27,9 @@ float ff_sbr_sum_square_sse(float (*x)[2], int n); void ff_sbr_hf_g_filt_sse(float (*Y)[2], const float (*X_high)[40][2], const float *g_filt, int m_max, intptr_t ixh); +void ff_sbr_hf_gen_sse(float (*X_high)[2], const float (*X_low)[2], + const float alpha0[2], const float alpha1[2], + float bw, int start, int end); void ff_sbrdsp_init_x86(SBRDSPContext *s) { @@ -35,5 +38,6 @@ void ff_sbrdsp_init_x86(SBRDSPContext *s) if (EXTERNAL_SSE(mm_flags)) { s->sum_square = ff_sbr_sum_square_sse; s->hf_g_filt = ff_sbr_hf_g_filt_sse; + s->hf_gen = ff_sbr_hf_gen_sse; } } From c25fc5c2bb6ae8c93541c9427df3e47206d95152 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 28 Nov 2012 19:34:17 +0100 Subject: [PATCH 6/6] fate: dpcm: Add dependencies --- tests/fate/dpcm.mak | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/fate/dpcm.mak b/tests/fate/dpcm.mak index 14e77a20f4..abc25edc9b 100644 --- a/tests/fate/dpcm.mak +++ b/tests/fate/dpcm.mak @@ -1,14 +1,14 @@ -FATE_DPCM += fate-dpcm-idroq +FATE_DPCM-$(call DEMDEC, ROQ, ROQ_DPCM) += fate-dpcm-idroq fate-dpcm-idroq: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq -vn -FATE_DPCM += fate-dpcm-interplay +FATE_DPCM-$(call DEMDEC, IPMOVIE, INTERPLAY_DPCM) += fate-dpcm-interplay fate-dpcm-interplay: CMD = framecrc -i $(SAMPLES)/interplay-mve/interplay-logo-2MB.mve -vn -FATE_DPCM += fate-dpcm-sierra +FATE_DPCM-$(call DEMDEC, SOL, SOL_DPCM) += fate-dpcm-sierra fate-dpcm-sierra: CMD = md5 -i $(SAMPLES)/sol/lsl7sample.sol -f s16le -FATE_DPCM += fate-dpcm-xan +FATE_DPCM-$(call DEMDEC, AVI, XAN_DPCM) += fate-dpcm-xan fate-dpcm-xan: CMD = md5 -i $(SAMPLES)/wc4-xan/wc4_2.avi -vn -f s16le -FATE_SAMPLES_AVCONV += $(FATE_DPCM) -fate-dpcm: $(FATE_DPCM) +FATE_SAMPLES_AVCONV += $(FATE_DPCM-yes) +fate-dpcm: $(FATE_DPCM-yes)