⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libwma.patch

📁 在mplayer播放器增加wma的定点运算补丁
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
++#endif /* __BSWAP_H__ */diff -uNr MPlayer-1.0rc2.orig/libwma/ffmpeg_config.h MPlayer-1.0rc2/libwma/ffmpeg_config.h--- MPlayer-1.0rc2.orig/libwma/ffmpeg_config.h	1969-12-31 18:00:00.000000000 -0600+++ MPlayer-1.0rc2/libwma/ffmpeg_config.h	2008-04-26 21:31:46.000000000 -0500@@ -0,0 +1,9 @@+/* Automatically generated by configure - do not modify */+#ifndef _FFMPEG_CONFIG_H+#define _FFMPEG_CONFIG_H++#ifdef CPU_ARM+#define CONFIG_ALIGN 1+#endif++#endifdiff -uNr MPlayer-1.0rc2.orig/libwma/fft.c MPlayer-1.0rc2/libwma/fft.c--- MPlayer-1.0rc2.orig/libwma/fft.c	1969-12-31 18:00:00.000000000 -0600+++ MPlayer-1.0rc2/libwma/fft.c	2008-04-27 15:37:08.000000000 -0500@@ -0,0 +1,153 @@+/*+ * WMA compatible decoder+ * Copyright (c) 2002 The FFmpeg Project.+ *+ * This library 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 of the License, or (at your option) any later version.+ *+ * This library 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 this library; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+ */++//#include "types.h"+#include "fft.h"+#include "wmafixed.h"++static FFTComplex  exptab0[512];++/* butter fly op */+#define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) \+{\+  fixed32 ax, ay, bx, by;\+  bx=pre1;\+  by=pim1;\+  ax=qre1;\+  ay=qim1;\+  pre = (bx + ax);\+  pim = (by + ay);\+  qre = (bx - ax);\+  qim = (by - ay);\+}+++int libwma_fft_calc_unscaled(FFTContext *s, FFTComplex *z)+{+    int ln = s->nbits;+    int j, np, np2;+    int nblocks, nloops;+    register FFTComplex *p, *q;+   // FFTComplex *exptab = s->exptab;+    int l;+    fixed32 tmp_re, tmp_im;+    int tabshift = 10-ln;++    np = 1 << ln;+++    /* pass 0 */++    p=&z[0];+    j=(np >> 1);+    do+    {+        BF(p[0].re, p[0].im, p[1].re, p[1].im,+           p[0].re, p[0].im, p[1].re, p[1].im);+        p+=2;+    }+    while (--j != 0);++    /* pass 1 */+++    p=&z[0];+    j=np >> 2;+    if (s->inverse)+    {+        do+        {+            BF(p[0].re, p[0].im, p[2].re, p[2].im,+               p[0].re, p[0].im, p[2].re, p[2].im);+            BF(p[1].re, p[1].im, p[3].re, p[3].im,+               p[1].re, p[1].im, -p[3].im, p[3].re);+            p+=4;+        }+        while (--j != 0);+    }+    else+    {+        do+        {+            BF(p[0].re, p[0].im, p[2].re, p[2].im,+               p[0].re, p[0].im, p[2].re, p[2].im);+            BF(p[1].re, p[1].im, p[3].re, p[3].im,+               p[1].re, p[1].im, p[3].im, -p[3].re);+            p+=4;+        }+        while (--j != 0);+    }+    /* pass 2 .. ln-1 */++    nblocks = np >> 3;+    nloops = 1 << 2;+    np2 = np >> 1;+    do+    {+        p = z;+        q = z + nloops;+        for (j = 0; j < nblocks; ++j)+        {+            BF(p->re, p->im, q->re, q->im,+               p->re, p->im, q->re, q->im);++            p++;+            q++;+            for(l = nblocks; l < np2; l += nblocks)+            {+                CMUL(&tmp_re, &tmp_im, exptab0[(l<<tabshift)].re, exptab0[(l<<tabshift)].im, q->re, q->im);+                //CMUL(&tmp_re, &tmp_im, exptab[l].re, exptab[l].im, q->re, q->im);+                BF(p->re, p->im, q->re, q->im,+                   p->re, p->im, tmp_re, tmp_im);+                p++;+                q++;+            }++            p += nloops;+            q += nloops;+        }+        nblocks = nblocks >> 1;+        nloops = nloops << 1;+    }+    while (nblocks != 0);+    return 0;+}++int libwma_fft_init_global(void)+{+    int i, n;+    fixed32 c1, s1, s2;++    n=1<<10;+    s2 = 1 ? 1 : -1;+    for(i=0;i<(n/2);++i)+    {+        fixed32 ifix = itofix32(i);+        fixed32 nfix = itofix32(n);+        fixed32 res = fixdiv32(ifix,nfix);++        s1 = fsincos(res<<16, &c1);++        exptab0[i].re = c1;+        exptab0[i].im = s1*s2;+    }++    return 0;+}+diff -uNr MPlayer-1.0rc2.orig/libwma/fft.h MPlayer-1.0rc2/libwma/fft.h--- MPlayer-1.0rc2.orig/libwma/fft.h	1969-12-31 18:00:00.000000000 -0600+++ MPlayer-1.0rc2/libwma/fft.h	2008-04-27 15:37:19.000000000 -0500@@ -0,0 +1,43 @@+/*+ * WMA compatible decoder+ * Copyright (c) 2002 The FFmpeg Project.+ *+ * This library 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 of the License, or (at your option) any later version.+ *+ * This library 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 this library; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+ */++#include "types.h"++typedef fixed32 FFTSample;++typedef struct FFTComplex+{+    fixed32 re, im;+}+FFTComplex;++typedef struct FFTContext+{+    int nbits;+    int inverse;+    uint16_t *revtab;+    FFTComplex *exptab;+    FFTComplex *exptab1; /* only used by SSE code */+    int (*fft_calc)(struct FFTContext *s, FFTComplex *z);+}+FFTContext;++int libwma_fft_calc_unscaled(FFTContext *s, FFTComplex *z);+int libwma_fft_init_global(void);+diff -uNr MPlayer-1.0rc2.orig/libwma/mdct.c MPlayer-1.0rc2/libwma/mdct.c--- MPlayer-1.0rc2.orig/libwma/mdct.c	1969-12-31 18:00:00.000000000 -0600+++ MPlayer-1.0rc2/libwma/mdct.c	2008-04-27 15:45:19.000000000 -0500@@ -0,0 +1,156 @@+/*+ * WMA compatible decoder+ * Copyright (c) 2002 The FFmpeg Project.+ *+ * This library 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 of the License, or (at your option) any later version.+ *+ * This library 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 this library; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+ */++#include "wmafixed.h"+#include "mdct.h"+#include <stdlib.h>+#include <string.h>++static fixed32 tcos0[1024], tsin0[1024]; //these are the sin and cos rotations used by the MDCT+static uint16_t revtab0[1024];++/**+ * init MDCT or IMDCT computation.+ */+int libwma_mdct_init(MDCTContext *s, int nbits, int inverse)+{+    int n;+   // fixed32 alpha;++    memset(s, 0, sizeof(*s));+    n = 1 << nbits;            //nbits ranges from 12 to 8 inclusive++    s->nbits = nbits;+    s->n = n;++    (&s->fft)->nbits = nbits-2;+    (&s->fft)->inverse = inverse;++    return 0;++}++/**+ * Compute inverse MDCT of size N = 2^nbits+ * @param output N samples+ * @param input N/2 samples+ * @param tmp N/2 samples+ */+void libwma_imdct_calc(MDCTContext *s,+                   fixed32 *output,+                   fixed32 *input)+{+    int k, n8, n4, n2, n, j,scale;+    const fixed32 *in1, *in2;+    FFTComplex *z1 = (FFTComplex *)output;+    FFTComplex *z2 = (FFTComplex *)input;+    int revtabshift = 12 - s->nbits;++    n = 1 << s->nbits;++    n2 = n >> 1;+    n4 = n >> 2;+    n8 = n >> 3;+++    /* pre rotation */+    in1 = input;+    in2 = input + n2 - 1;++    for(k = 0; k < n4; k++)+    {+        int kshift = k<<revtabshift;+        j=revtab0[kshift];+        CMUL(&z1[j].re, &z1[j].im, *in2, *in1, tcos0[kshift], tsin0[kshift]);+        in1 += 2;+        in2 -= 2;+    }++    scale = libwma_fft_calc_unscaled(&s->fft, z1);++    /* post rotation + reordering */++    for(k = 0; k < n4; k++)+    {+        int kshift = k<<revtabshift;+        CMUL(&z2[k].re, &z2[k].im, (z1[k].re), (z1[k].im), tcos0[kshift], tsin0[kshift]);+    }++    for(k = 0; k < n8; k++)+    {+        fixed32 r1,r2,r3,r4,r1n,r2n,r3n;++        r1 = z2[n8 + k].im;+        r1n = r1 * -1;+        r2 = z2[n8-1-k].re;+        r2n = r2 * -1;+        r3 = z2[k+n8].re;+        r3n = r3 * -1;+        r4 = z2[n8-k-1].im;++        output[2*k] = r1n;+        output[n2-1-2*k] = r1;++        output[2*k+1] = r2;+        output[n2-1-2*k-1] = r2n;++        output[n2 + 2*k]= r3n;+        output[n-1- 2*k]= r3n;++        output[n2 + 2*k+1]= r4;+        output[n-2 - 2 * k] = r4;+    }+}++int libwma_mdct_init_global(void)+{+    int i,j,m;+    /* init the MDCT bit reverse table here rather then in fft_init */++    for(i=0;i<1024;i++)           /*hard coded to a 2048 bit rotation*/+    {                             /*smaller sizes can reuse the largest*/+        m=0;+        for(j=0;j<10;j++)+        {+            m |= ((i >> j) & 1) << (10-j-1);+        }++       revtab0[i]=m;+    }++    for(i=0;i<1024;i++)+    {+        //fixed32 pi2 = fixmul32(0x20000, M_PI_F);+        fixed32 ip = itofix32(i) + 0x2000;+        ip = ip >> 12;+        //ip = fixdiv32(ip,itofix32(n)); // PJJ optimize+        //alpha = fixmul32(TWO_M_PI_F, ip);+        //s->tcos[i] = -fixcos32(alpha);        //alpha between 0 and pi/2+        //s->tsin[i] = -fixsin32(alpha);++        //I can't remember why this works, but it seems to agree for ~24 bits, maybe more!+        tsin0[i] = - fsincos(ip<<16, &(tcos0[i]));+        tcos0[i] *=-1;+  }++    libwma_fft_init_global();++    return 0;+}+diff -uNr MPlayer-1.0rc2.orig/libwma/mdct.h MPlayer-1.0rc2/libwma/mdct.h--- MPlayer-1.0rc2.orig/libwma/mdct.h	1969-12-31 18:00:00.000000000 -0600+++ MPlayer-1.0rc2/libwma/mdct.h	2008-04-27 15:45:35.000000000 -0500@@ -0,0 +1,35 @@+/*+ * WMA compatible decoder+ * Copyright (c) 2002 The FFmpeg Project.+ *+ * This library 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 of the License, or (at your option) any later version.+ *+ * This library 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 this library; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+ */++//#include "types.h"+#include "fft.h"++typedef struct MDCTContext+{+    int n;  /* size of MDCT (i.e. number of input data * 2) */+    int nbits; /* n = 2^nbits */+    /* pre/post rotation tables */+    FFTContext fft;+}+MDCTContext;++int libwma_mdct_init(MDCTContext *s, int nbits, int inverse);+void libwma_imdct_calc(MDCTContext *s, fixed32 *output, fixed32 *input);+int libwma_mdct_init_global(void);+diff -uNr MPlayer-1.0rc2.orig/libwma/types.h MPlayer-1.0rc2/libwma/types.h--- MPlayer-1.0rc2.orig/libwma/types.h	1969-12-31 18:00:00.000000000 -0600+++ MPlayer-1.0rc2/libwma/types.h	2008-04-26 21:37:01.000000000 -0500@@ -0,0 +1,5 @@+#include <stdint.h>++#define fixed32         int32_t+#define fixed64         int64_t+diff -uNr MPlayer-1.0rc2.orig/libwma/wmadata.h MPlayer-1.0rc2/libwma/wmadata.h--- MPlayer-1.0rc2.orig/libwma/wmadata.h	1969-12-31 18:00:00.000000000 -0600+++ MPlayer-1.0rc2/libwma/wmadata.h	2008-04-26 22:11:40.000000000 -0500@@ -0,0 +1,2609 @@+/*+ * WMA compatible decoder+ * copyright (c) 2002 The FFmpeg Project+ *+ * 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+ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -