a52dec:moved into main for pisi 2.0

This commit is contained in:
2015-07-23 16:02:04 +03:00
parent cb7a805567
commit 1a2f14f3e6
6 changed files with 461 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get
def setup():
autotools.autoreconf("-vfi")
autotools.configure("--enable-shared \
--disable-static \
--enable-djbfft")
def build():
autotools.make('CFLAGS="%s"' % get.CFLAGS())
def install():
autotools.rawInstall('DESTDIR="%s" docdir=/%s/%s/html' % (get.installDIR(), get.docDIR(), get.srcNAME()))
pisitools.insinto("/usr/include/a52dec", "liba52/a52_internal.h")
pisitools.dodoc("AUTHORS", "ChangeLog", "NEWS", "README", "doc/liba52.txt")
@@ -0,0 +1,30 @@
diff -Naur a52dec-0.7.4.orig/liba52/Makefile.am a52dec-0.7.4/liba52/Makefile.am
--- a52dec-0.7.4.orig/liba52/Makefile.am 2002-01-27 20:36:48.000000000 -0800
+++ a52dec-0.7.4/liba52/Makefile.am 2004-11-05 01:10:21.317401872 -0800
@@ -1,4 +1,4 @@
-CFLAGS = @CFLAGS@ @LIBA52_CFLAGS@
+AM_CFLAGS = @CFLAGS@ @LIBA52_CFLAGS@
lib_LTLIBRARIES = liba52.la
diff -Naur a52dec-0.7.4.orig/liba52/configure.incl a52dec-0.7.4/liba52/configure.incl
--- a52dec-0.7.4.orig/liba52/configure.incl 2002-01-27 20:36:48.000000000 -0800
+++ a52dec-0.7.4/liba52/configure.incl 2004-11-05 01:11:38.172672216 -0800
@@ -2,7 +2,7 @@
AC_SUBST([LIBA52_LIBS])
dnl avoid -fPIC when possible
-LIBA52_CFLAGS="$LIBA52_CFLAGS -prefer-non-pic"
+dnl LIBA52_CFLAGS="$LIBA52_CFLAGS -prefer-non-pic"
AC_ARG_ENABLE([double],
[ --enable-double use double-precision samples])
diff -Naur a52dec-0.7.4.orig/src/Makefile.am a52dec-0.7.4/src/Makefile.am
--- a52dec-0.7.4.orig/src/Makefile.am 2002-06-22 18:51:57.000000000 -0700
+++ a52dec-0.7.4/src/Makefile.am 2004-11-05 01:10:21.320401375 -0800
@@ -1,4 +1,4 @@
-CFLAGS = @A52DEC_CFLAGS@
+AM_CFLAGS = @A52DEC_CFLAGS@
bin_PROGRAMS = a52dec extract_a52
a52dec_SOURCES = a52dec.c getopt.c gettimeofday.c
@@ -0,0 +1,299 @@
Index: a52dec-0.7.4/liba52/bit_allocate.c
===================================================================
--- a52dec-0.7.4.orig/liba52/bit_allocate.c
+++ a52dec-0.7.4/liba52/bit_allocate.c
@@ -28,7 +28,7 @@
#include "a52.h"
#include "a52_internal.h"
-static int hthtab[3][50] = {
+static const int hthtab[3][50] = {
{0x730, 0x730, 0x7c0, 0x800, 0x820, 0x840, 0x850, 0x850, 0x860, 0x860,
0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x890, 0x890,
0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900,
@@ -46,7 +46,7 @@ static int hthtab[3][50] = {
0x8d0, 0x8b0, 0x840, 0x7f0, 0x790, 0x760, 0x7a0, 0x7c0, 0x7b0, 0x720}
};
-static int8_t baptab[305] = {
+static const int8_t baptab[305] = {
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
@@ -71,11 +71,11 @@ static int8_t baptab[305] = {
0, 0, 0, 0 /* 148 padding elems */
};
-static int bndtab[30] = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34,
+static const int bndtab[30] = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34,
37, 40, 43, 46, 49, 55, 61, 67, 73, 79,
85, 97, 109, 121, 133, 157, 181, 205, 229, 253};
-static int8_t latab[256] = {
+static const int8_t latab[256] = {
-64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53,
-52, -52, -51, -50, -49, -48, -47, -47, -46, -45, -44, -44,
-43, -42, -41, -41, -40, -39, -38, -38, -37, -36, -36, -35,
@@ -125,9 +125,9 @@ void a52_bit_allocate (a52_state_t * sta
int start, int end, int fastleak, int slowleak,
expbap_t * expbap)
{
- static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410};
- static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100};
- static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0,
+ static const int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410};
+ static const int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100};
+ static const int floortab[8] = {0x910, 0x950, 0x990, 0x9d0,
0xa10, 0xa90, 0xb10, 0x1400};
int i, j;
@@ -135,8 +135,8 @@ void a52_bit_allocate (a52_state_t * sta
int8_t * bap;
int fdecay, fgain, sdecay, sgain, dbknee, floor, snroffset;
int psd, mask;
- int8_t * deltba;
- int * hth;
+ const int8_t * deltba;
+ const int * hth;
int halfrate;
halfrate = state->halfrate;
Index: a52dec-0.7.4/liba52/imdct.c
===================================================================
--- a52dec-0.7.4.orig/liba52/imdct.c
+++ a52dec-0.7.4/liba52/imdct.c
@@ -56,6 +56,7 @@ static uint8_t fftorder[] = {
6,134, 70,198, 38,166,230,102,246,118, 54,182, 22,150,214, 86
};
+#ifndef HARDCODED_TABLES
/* Root values for IFFT */
static sample_t roots16[3];
static sample_t roots32[7];
@@ -69,6 +70,13 @@ static complex_t pre2[64];
static complex_t post2[32];
static sample_t a52_imdct_window[256];
+#else
+# ifdef LIBA52_DOUBLE
+# include "imdct_tables_double.h"
+# else
+# include "imdct_tables_float.h"
+# endif
+#endif
static void (* ifft128) (complex_t * buf);
static void (* ifft64) (complex_t * buf);
@@ -178,7 +186,7 @@ static inline void ifft8 (complex_t * bu
BUTTERFLY_HALF (buf[1], buf[3], buf[5], buf[7], roots16[1]);
}
-static void ifft_pass (complex_t * buf, sample_t * weight, int n)
+static void ifft_pass (complex_t * buf, const sample_t * weight, int n)
{
complex_t * buf1;
complex_t * buf2;
@@ -351,6 +359,7 @@ void a52_imdct_256(sample_t * data, samp
}
}
+#ifndef HARDCODED_TABLES
static double besselI0 (double x)
{
double bessel = 1;
@@ -361,9 +370,11 @@ static double besselI0 (double x)
while (--i);
return bessel;
}
+#endif
void a52_imdct_init (uint32_t mm_accel)
{
+#ifndef HARDCODED_TABLES
int i, k;
double sum;
@@ -416,6 +427,7 @@ void a52_imdct_init (uint32_t mm_accel)
post2[i].real = cos ((M_PI / 128) * (i + 0.5));
post2[i].imag = sin ((M_PI / 128) * (i + 0.5));
}
+#endif
#ifdef LIBA52_DJBFFT
if (mm_accel & MM_ACCEL_DJBFFT) {
Index: a52dec-0.7.4/liba52/imdct-gentables.c
===================================================================
--- /dev/null
+++ a52dec-0.7.4/liba52/imdct-gentables.c
@@ -0,0 +1,139 @@
+#include <stdint.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifndef LIBA52_DOUBLE
+typedef float sample_t;
+#else
+typedef double sample_t;
+#endif
+
+typedef struct complex_s {
+ sample_t real;
+ sample_t imag;
+} complex_t;
+
+static uint8_t fftorder[] = {
+ 0,128, 64,192, 32,160,224, 96, 16,144, 80,208,240,112, 48,176,
+ 8,136, 72,200, 40,168,232,104,248,120, 56,184, 24,152,216, 88,
+ 4,132, 68,196, 36,164,228,100, 20,148, 84,212,244,116, 52,180,
+ 252,124, 60,188, 28,156,220, 92, 12,140, 76,204,236,108, 44,172,
+ 2,130, 66,194, 34,162,226, 98, 18,146, 82,210,242,114, 50,178,
+ 10,138, 74,202, 42,170,234,106,250,122, 58,186, 26,154,218, 90,
+ 254,126, 62,190, 30,158,222, 94, 14,142, 78,206,238,110, 46,174,
+ 6,134, 70,198, 38,166,230,102,246,118, 54,182, 22,150,214, 86
+};
+
+/* Root values for IFFT */
+static sample_t roots16[3];
+static sample_t roots32[7];
+static sample_t roots64[15];
+static sample_t roots128[31];
+
+/* Twiddle factors for IMDCT */
+static complex_t pre1[128];
+static complex_t post1[64];
+static complex_t pre2[64];
+static complex_t post2[32];
+
+static sample_t a52_imdct_window[256];
+
+static double besselI0 (double x)
+{
+ double bessel = 1;
+ int i = 100;
+
+ do
+ bessel = bessel * x / (i * i) + 1;
+ while (--i);
+ return bessel;
+}
+
+int main() {
+ int i, k;
+ double sum;
+
+ /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */
+ sum = 0;
+ for (i = 0; i < 256; i++) {
+ sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256));
+ a52_imdct_window[i] = sum;
+ }
+ sum++;
+ for (i = 0; i < 256; i++)
+ a52_imdct_window[i] = sqrt (a52_imdct_window[i] / sum);
+
+ for (i = 0; i < 3; i++)
+ roots16[i] = cos ((M_PI / 8) * (i + 1));
+
+ for (i = 0; i < 7; i++)
+ roots32[i] = cos ((M_PI / 16) * (i + 1));
+
+ for (i = 0; i < 15; i++)
+ roots64[i] = cos ((M_PI / 32) * (i + 1));
+
+ for (i = 0; i < 31; i++)
+ roots128[i] = cos ((M_PI / 64) * (i + 1));
+
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i] / 2 + 64;
+ pre1[i].real = cos ((M_PI / 256) * (k - 0.25));
+ pre1[i].imag = sin ((M_PI / 256) * (k - 0.25));
+ }
+
+ for (i = 64; i < 128; i++) {
+ k = fftorder[i] / 2 + 64;
+ pre1[i].real = -cos ((M_PI / 256) * (k - 0.25));
+ pre1[i].imag = -sin ((M_PI / 256) * (k - 0.25));
+ }
+
+ for (i = 0; i < 64; i++) {
+ post1[i].real = cos ((M_PI / 256) * (i + 0.5));
+ post1[i].imag = sin ((M_PI / 256) * (i + 0.5));
+ }
+
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i] / 4;
+ pre2[i].real = cos ((M_PI / 128) * (k - 0.25));
+ pre2[i].imag = sin ((M_PI / 128) * (k - 0.25));
+ }
+
+ for (i = 0; i < 32; i++) {
+ post2[i].real = cos ((M_PI / 128) * (i + 0.5));
+ post2[i].imag = sin ((M_PI / 128) * (i + 0.5));
+ }
+
+#define print_table_samples(name, size) \
+ do { \
+ int i; \
+ printf("static const sample_t " #name "[" #size "] = {\n"); \
+ for(i = 0; i < size; i++) { \
+ printf(" %a%s\n", name[i], i < size-1 ? ", " : ""); \
+ } \
+ printf("\n};\n\n"); \
+ } while(0);
+
+#define print_table_complex(name, size) \
+ do { \
+ int i; \
+ printf("static const complex_t " #name "[" #size "] = {\n"); \
+ for(i = 0; i < size; i++) { \
+ printf(" { %a, %a }%s\n", name[i].real, name[i].imag, i < size-1 ? ", " : ""); \
+ } \
+ printf("\n};\n\n"); \
+ } while(0);
+
+ print_table_samples(roots16, 3);
+ print_table_samples(roots32, 7);
+ print_table_samples(roots64, 15);
+ print_table_samples(roots128, 31);
+
+ print_table_complex(pre1, 128);
+ print_table_complex(post1, 64);
+ print_table_complex(pre2, 64);
+ print_table_complex(post2, 32);
+
+ print_table_samples(a52_imdct_window, 256);
+
+ return 0;
+}
Index: a52dec-0.7.4/liba52/Makefile.am
===================================================================
--- a52dec-0.7.4.orig/liba52/Makefile.am
+++ a52dec-0.7.4/liba52/Makefile.am
@@ -2,8 +2,26 @@ CFLAGS = @CFLAGS@ @LIBA52_CFLAGS@
lib_LTLIBRARIES = liba52.la
-liba52_la_SOURCES = bitstream.c imdct.c bit_allocate.c parse.c downmix.c
+liba52_la_SOURCES = bitstream.c imdct.c bit_allocate.c parse.c downmix.c imdct_tables_double.h imdct_tables_float.h
liba52_la_LIBADD = @LIBA52_LIBS@ -lm
liba52_la_LDFLAGS = -no-undefined
+noinst_PROGRAMS = imdct-gentables-double imdct-gentables-float
+
+imdct_gentables_double_SOURCES = imdct-gentables.c
+imdct_gentables_double_CFLAGS = $(CFLAGS) -DLIBA52_DOUBLE
+imdct_gentables_double_LDADD = -lm
+
+imdct_gentables_float_SOURCES = imdct-gentables.c
+imdct_gentables_float_CFLAGS = $(CFLAGS) -ULIBA52_DOUBLE
+imdct_gentables_float_LDADD = -lm
+
+imdct_tables_double.h: imdct-gentables-double
+ ./$^ > $@
+
+imdct_tables_float.h: imdct-gentables-float
+ ./$^ > $@
+
+imdct.c: imdct_tables_double.h imdct_tables_float.h
+
EXTRA_DIST = configure.incl a52_internal.h bitstream.h tables.h
@@ -0,0 +1,20 @@
--- liba52/imdct.c 2002-07-28 04:52:07.000000000 +0300
+++ liba52/imdct.c 2007-05-01 17:41:11.000000000 +0300
@@ -418,15 +418,12 @@
}
#ifdef LIBA52_DJBFFT
- if (mm_accel & MM_ACCEL_DJBFFT) {
fprintf (stderr, "Using djbfft for IMDCT transform\n");
ifft128 = (void (*) (complex_t *)) fftc4_un128;
ifft64 = (void (*) (complex_t *)) fftc4_un64;
- } else
-#endif
- {
+#else
fprintf (stderr, "No accelerated IMDCT transform found\n");
ifft128 = ifft128_c;
ifft64 = ifft64_c;
- }
+#endif
}
+74
View File
@@ -0,0 +1,74 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>a52dec</Name>
<Homepage>http://liba52.sourceforge.net/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>GPLv2</License>
<IsA>library</IsA>
<Summary>DVD ATSC A/52 streams decoder library</Summary>
<Description>liba52 is a free library for decoding ATSC A/52 streams. The A/52 standard is used in a variety of applications, including digital television and DVD. It is also known as AC-3.</Description>
<Archive sha1sum="79b33bd8d89dad7436f85b9154ad35667aa37321" type="targz">http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz</Archive>
<BuildDependencies>
<Dependency>glibc-devel</Dependency>
<Dependency>djbfft-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">a52dec-0.7.4-build.patch</Patch>
<Patch>use-djbfft.patch</Patch>
<Patch level="1">constant.patch</Patch>
</Patches>
</Source>
<Package>
<Name>a52dec</Name>
<RuntimeDependencies>
<Dependency>djbfft</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="executable">/usr/bin</Path>
<Path fileType="library">/usr/lib</Path>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="man">/usr/share/man</Path>
</Files>
</Package>
<Package>
<Name>a52dec-devel</Name>
<Summary>Development files for a52dec</Summary>
<RuntimeDependencies>
<Dependency release="current">a52dec</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="header">/usr/include</Path>
</Files>
</Package>
<History>
<Update release="3">
<Date>2014-05-20</Date>
<Version>0.7.4</Version>
<Comment>Rebuild.</Comment>
<Name>Serdar Soytetir</Name>
<Email>kaptan@pisilinux.org</Email>
</Update>
<Update release="2">
<Date>2014-01-31</Date>
<Version>0.7.4</Version>
<Comment>some fixes and rebuild</Comment>
<Name>Alihan Öztürk</Name>
<Email>alihan@pisilinux.org</Email>
</Update>
<Update release="1">
<Date>2010-10-12</Date>
<Version>0.7.4</Version>
<Comment>First release</Comment>
<Name>Pisi Linux Admins</Name>
<Email>admins@pisilinux.org</Email>
</Update>
</History>
</PISI>
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>a52dec</Name>
<Summary xml:lang="tr">DVD'de kullanılan ATSC A/52 akımını çözen kütüphane</Summary>
<Description xml:lang="tr">liba52 ATSC A/52 yayınlarının kodlarını çözen ücretsiz bir kütüphanedir. A/52 standart dijital televizyon ve DVD programlarını da içeren çeşitli uygulamalar tarafından kullanılmaktadır.</Description>
</Source>
<Package>
<Name>a52dec-devel</Name>
<Summary xml:lang="tr">a52dec için geliştirme dosyaları</Summary>
</Package>
</PISI>