From 741fb4b9e135cfb161a749db88713229038577bb Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 5 Sep 2013 17:55:35 +0100 Subject: making act segmenter --- ffmpeg1/libavcodec/mips/fft_mips.c | 534 ------------------------------------- 1 file changed, 534 deletions(-) delete mode 100644 ffmpeg1/libavcodec/mips/fft_mips.c (limited to 'ffmpeg1/libavcodec/mips/fft_mips.c') diff --git a/ffmpeg1/libavcodec/mips/fft_mips.c b/ffmpeg1/libavcodec/mips/fft_mips.c deleted file mode 100644 index ae4ed30..0000000 --- a/ffmpeg1/libavcodec/mips/fft_mips.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Copyright (c) 2012 - * MIPS Technologies, Inc., California. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Stanislav Ocovaj (socovaj@mips.com) - * Author: Zoran Lukic (zoranl@mips.com) - * - * Optimized MDCT/IMDCT and FFT transforms - * - * This file is part of FFmpeg. - * - * FFmpeg 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. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "config.h" -#include "libavcodec/fft.h" -#include "fft_table.h" - -/** - * FFT transform - */ - -#if HAVE_INLINE_ASM -static void ff_fft_calc_mips(FFTContext *s, FFTComplex *z) -{ - int nbits, i, n, num_transforms, offset, step; - int n4, n2, n34; - FFTSample tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; - FFTComplex *tmpz; - float w_re, w_im; - float *w_re_ptr, *w_im_ptr; - const int fft_size = (1 << s->nbits); - int s_n = s->nbits; - int tem1, tem2; - float pom, pom1, pom2, pom3; - float temp, temp1, temp3, temp4; - FFTComplex * tmpz_n2, * tmpz_n34, * tmpz_n4; - FFTComplex * tmpz_n2_i, * tmpz_n34_i, * tmpz_n4_i, * tmpz_i; - - /** - *num_transforms = (0x2aab >> (16 - s->nbits)) | 1; - */ - __asm__ volatile ( - "li %[tem1], 16 \n\t" - "sub %[s_n], %[tem1], %[s_n] \n\t" - "li %[tem2], 10923 \n\t" - "srav %[tem2], %[tem2], %[s_n] \n\t" - "ori %[num_t],%[tem2], 1 \n\t" - : [num_t]"=r"(num_transforms), [s_n]"+r"(s_n), - [tem1]"=&r"(tem1), [tem2]"=&r"(tem2) - ); - - - for (n=0; n> 1) | 1; - - for (n=0; nnbits; nbits++) { - /* - * num_transforms = (num_transforms >> 1) | 1; - */ - __asm__ volatile ( - "sra %[num_t], %[num_t], 1 \n\t" - "ori %[num_t], %[num_t], 1 \n\t" - - : [num_t] "+r" (num_transforms) - ); - n2 = 2 * n4; - n34 = 3 * n4; - - for (n=0; n>= 1; - n4 <<= 1; - } -} - -/** - * MDCT/IMDCT transforms. - */ - -static void ff_imdct_half_mips(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - int k, n8, n4, n2, n, j; - const uint16_t *revtab = s->revtab; - const FFTSample *tcos = s->tcos; - const FFTSample *tsin = s->tsin; - const FFTSample *in1, *in2, *in3, *in4; - FFTComplex *z = (FFTComplex *)output; - - int j1; - const float *tcos1, *tsin1, *tcos2, *tsin2; - float temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, - temp9, temp10, temp11, temp12, temp13, temp14, temp15, temp16; - FFTComplex *z1, *z2; - - n = 1 << s->mdct_bits; - n2 = n >> 1; - n4 = n >> 2; - n8 = n >> 3; - - /* pre rotation */ - in1 = input; - in2 = input + n2 - 1; - in3 = input + 2; - in4 = input + n2 - 3; - - tcos1 = tcos; - tsin1 = tsin; - - /* n4 = 64 or 128 */ - for(k = 0; k < n4; k += 2) { - j = revtab[k ]; - j1 = revtab[k + 1]; - - __asm__ volatile ( - "lwc1 %[temp1], 0(%[in2]) \t\n" - "lwc1 %[temp2], 0(%[tcos1]) \t\n" - "lwc1 %[temp3], 0(%[tsin1]) \t\n" - "lwc1 %[temp4], 0(%[in1]) \t\n" - "lwc1 %[temp5], 0(%[in4]) \t\n" - "mul.s %[temp9], %[temp1], %[temp2] \t\n" - "mul.s %[temp10], %[temp1], %[temp3] \t\n" - "lwc1 %[temp6], 4(%[tcos1]) \t\n" - "lwc1 %[temp7], 4(%[tsin1]) \t\n" - "nmsub.s %[temp9], %[temp9], %[temp4], %[temp3] \t\n" - "madd.s %[temp10], %[temp10], %[temp4], %[temp2] \t\n" - "mul.s %[temp11], %[temp5], %[temp6] \t\n" - "mul.s %[temp12], %[temp5], %[temp7] \t\n" - "lwc1 %[temp8], 0(%[in3]) \t\n" - "addiu %[tcos1], %[tcos1], 8 \t\n" - "addiu %[tsin1], %[tsin1], 8 \t\n" - "addiu %[in1], %[in1], 16 \t\n" - "nmsub.s %[temp11], %[temp11], %[temp8], %[temp7] \t\n" - "madd.s %[temp12], %[temp12], %[temp8], %[temp6] \t\n" - "addiu %[in2], %[in2], -16 \t\n" - "addiu %[in3], %[in3], 16 \t\n" - "addiu %[in4], %[in4], -16 \t\n" - - : [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), - [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), - [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), - [temp7]"=&f"(temp7), [temp8]"=&f"(temp8), - [temp9]"=&f"(temp9), [temp10]"=&f"(temp10), - [temp11]"=&f"(temp11), [temp12]"=&f"(temp12), - [tsin1]"+r"(tsin1), [tcos1]"+r"(tcos1), - [in1]"+r"(in1), [in2]"+r"(in2), - [in3]"+r"(in3), [in4]"+r"(in4) - : - : "memory" - ); - - z[j ].re = temp9; - z[j ].im = temp10; - z[j1].re = temp11; - z[j1].im = temp12; - } - - s->fft_calc(s, z); - - /* post rotation + reordering */ - /* n8 = 32 or 64 */ - for(k = 0; k < n8; k += 2) { - tcos1 = &tcos[n8 - k - 2]; - tsin1 = &tsin[n8 - k - 2]; - tcos2 = &tcos[n8 + k]; - tsin2 = &tsin[n8 + k]; - z1 = &z[n8 - k - 2]; - z2 = &z[n8 + k ]; - - __asm__ volatile ( - "lwc1 %[temp1], 12(%[z1]) \t\n" - "lwc1 %[temp2], 4(%[tsin1]) \t\n" - "lwc1 %[temp3], 4(%[tcos1]) \t\n" - "lwc1 %[temp4], 8(%[z1]) \t\n" - "lwc1 %[temp5], 4(%[z1]) \t\n" - "mul.s %[temp9], %[temp1], %[temp2] \t\n" - "mul.s %[temp10], %[temp1], %[temp3] \t\n" - "lwc1 %[temp6], 0(%[tsin1]) \t\n" - "lwc1 %[temp7], 0(%[tcos1]) \t\n" - "nmsub.s %[temp9], %[temp9], %[temp4], %[temp3] \t\n" - "madd.s %[temp10], %[temp10], %[temp4], %[temp2] \t\n" - "mul.s %[temp11], %[temp5], %[temp6] \t\n" - "mul.s %[temp12], %[temp5], %[temp7] \t\n" - "lwc1 %[temp8], 0(%[z1]) \t\n" - "lwc1 %[temp1], 4(%[z2]) \t\n" - "lwc1 %[temp2], 0(%[tsin2]) \t\n" - "lwc1 %[temp3], 0(%[tcos2]) \t\n" - "nmsub.s %[temp11], %[temp11], %[temp8], %[temp7] \t\n" - "madd.s %[temp12], %[temp12], %[temp8], %[temp6] \t\n" - "mul.s %[temp13], %[temp1], %[temp2] \t\n" - "mul.s %[temp14], %[temp1], %[temp3] \t\n" - "lwc1 %[temp4], 0(%[z2]) \t\n" - "lwc1 %[temp5], 12(%[z2]) \t\n" - "lwc1 %[temp6], 4(%[tsin2]) \t\n" - "lwc1 %[temp7], 4(%[tcos2]) \t\n" - "nmsub.s %[temp13], %[temp13], %[temp4], %[temp3] \t\n" - "madd.s %[temp14], %[temp14], %[temp4], %[temp2] \t\n" - "mul.s %[temp15], %[temp5], %[temp6] \t\n" - "mul.s %[temp16], %[temp5], %[temp7] \t\n" - "lwc1 %[temp8], 8(%[z2]) \t\n" - "nmsub.s %[temp15], %[temp15], %[temp8], %[temp7] \t\n" - "madd.s %[temp16], %[temp16], %[temp8], %[temp6] \t\n" - : [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), - [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), - [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), - [temp7]"=&f"(temp7), [temp8]"=&f"(temp8), - [temp9]"=&f"(temp9), [temp10]"=&f"(temp10), - [temp11]"=&f"(temp11), [temp12]"=&f"(temp12), - [temp13]"=&f"(temp13), [temp14]"=&f"(temp14), - [temp15]"=&f"(temp15), [temp16]"=&f"(temp16) - : [z1]"r"(z1), [z2]"r"(z2), - [tsin1]"r"(tsin1), [tcos1]"r"(tcos1), - [tsin2]"r"(tsin2), [tcos2]"r"(tcos2) - : "memory" - ); - - z1[1].re = temp9; - z1[1].im = temp14; - z2[0].re = temp13; - z2[0].im = temp10; - - z1[0].re = temp11; - z1[0].im = temp16; - z2[1].re = temp15; - z2[1].im = temp12; - } -} - -/** - * Compute inverse MDCT of size N = 2^nbits - * @param output N samples - * @param input N/2 samples - */ -static void ff_imdct_calc_mips(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - int k; - int n = 1 << s->mdct_bits; - int n2 = n >> 1; - int n4 = n >> 2; - - ff_imdct_half_mips(s, output+n4, input); - - for(k = 0; k < n4; k+=4) { - output[k] = -output[n2-k-1]; - output[k+1] = -output[n2-k-2]; - output[k+2] = -output[n2-k-3]; - output[k+3] = -output[n2-k-4]; - - output[n-k-1] = output[n2+k]; - output[n-k-2] = output[n2+k+1]; - output[n-k-3] = output[n2+k+2]; - output[n-k-4] = output[n2+k+3]; - } -} -#endif /* HAVE_INLINE_ASM */ - -av_cold void ff_fft_init_mips(FFTContext *s) -{ - int n=0; - - ff_fft_lut_init(fft_offsets_lut, 0, 1 << 16, &n); - ff_init_ff_cos_tabs(16); - -#if HAVE_INLINE_ASM - s->fft_calc = ff_fft_calc_mips; -#if CONFIG_MDCT - s->imdct_calc = ff_imdct_calc_mips; - s->imdct_half = ff_imdct_half_mips; -#endif -#endif -} -- cgit v1.2.3