debian/0000775000000000000000000000000012264344702007174 5ustar debian/rules0000775000000000000000000000025612264344637010266 0ustar #!/usr/bin/make -f export DEB_CFLAGS_MAINT_APPEND = $(shell getconf LFS_CFLAGS) export DEB_LDFLAGS_MAINT_APPEND = $(shell getconf LFS_LDFLAGS) %: dh $@ --with autoreconf debian/watch0000664000000000000000000000013112124403162010207 0ustar version=3 http://download.videolan.org/pub/videolan/libdca/(\d.*)/libdca-(.*)\.tar\.bz2 debian/changelog0000664000000000000000000001142412264344676011062 0ustar libdca (0.0.5-6ubuntu1) trusty; urgency=medium * Use dh-autoreconf instead of autotools-dev to also fix FTBFS on ppc64el by getting new libtool macros (still updates config.{sub,guess}). -- Logan Rosen Sat, 11 Jan 2014 17:46:00 -0500 libdca (0.0.5-6) unstable; urgency=low [ Fabian Greffrath ] * Team upload. * Remove myself from Uploaders. * Port to dh9 for multiarch (Closes: #703641). * Fix passing hardening and LFS flags. * Fix vcs-field-not-canonical. * Fix missing-pre-dependency-on-multiarch-support. * Fix outdated-autotools-helper-file. * Run "wrap-and-sort -asb". [ Reinhard Tartler ] * QA upload * Orphaning the package * move the package to the collab-maint umbrella -- Reinhard Tartler Tue, 26 Mar 2013 21:25:25 +0100 libdca (0.0.5-5) unstable; urgency=low * Update my e-mail address in debian/control. * Build with large file support where necessary (Closes: #639593). -- Fabian Greffrath Wed, 05 Oct 2011 14:52:45 +0200 libdca (0.0.5-4) unstable; urgency=low * Team upload. [ Fabian Greffrath ] * Move libdts-dev to Priority optional (some other packages of this priority depend on it) and change Section to oldlibs instead. [ Alessio Treglia ] * Get rid of unneded *.la files (Closes: #621688). * Switch to packaging format "3.0 (quilt)". * Add gbp config file. * Correct team's name. * Update Standards-Version. -- Alessio Treglia Wed, 13 Apr 2011 16:46:30 +0200 libdca (0.0.5-3) unstable; urgency=low * Changed Vcs-Git and Vcs-Browser to point to the right location. * Wrapped Uploaders, Build-Depends and Depends fields. * Added quilt for patch management. * debian/patches/r83-mark-tables-as-static-constants.patch: Mark tables as static constants. * debian/patches/r84-normalisation-factor-sqrt2+output-bias.patch: Change output normalisation factor from 3/2 to sqrt(2). Fixed a bug where the output bias wasn't applied when downmixing wasn't being done. * debian/patches/r87-sanity-check-for-subframes-and- prim_channels.patch: Sanity check for subframes and prim_channels to avoid crashes with invalid streams. * debian/patches/r88-fix-random-crashes-caused-by-invalid-32-bit- shifts.patch: Fix random crashes caused by invalid 32-bit shifts on 32-bit values. * debian/patches/r89-avoid-crashing-with-invalid-frames.patch: Avoid crashing with invalid frames setting a bitalloc_huffman component to 7. -- Fabian Greffrath Tue, 16 Jun 2009 11:30:40 +0200 libdca (0.0.5-2) unstable; urgency=low * Upload to unstable. * debian/changelog: + Fixed spelling error "maintainance" in the (0.0.2-svn-2) entry. * debian/control: + Removed the "XS-" prefix from the Vcs-Svn and Vcs-Browser fields. + Bumped Standards-Version to 3.8.0. + Fixed binary-control-field-duplicates-source field "section" in package libdca0. * debian/watch: + Added. -- Fabian Greffrath Mon, 16 Feb 2009 14:44:00 +0100 libdca (0.0.5-1) experimental; urgency=low * New upstream release (Closes: #481763). + Provide a shared library (Closes: #285590). + Install .pc files for pkg-config (Closes: #313377). * debian/control: + Changed Source to libdca. + Added myself to Uploaders. + Added Build-Depends on cdbs. + Bumped Standards-Version to 3.7.3. + Added Homepage field. + Added Depends on ${shlibs:Depends} and ${misc:Depends} to all packages. + Improved package descriptions. + Added libdca0, libdca-dev and libdca-utils packages. + Made libdts-dev Priority: extra. * debian/copyright: + Converted to proposed machine-readable format. * debian/libdca0.docs: + Added to install doc/*. * debian/{libdca0,libdca-dev,libdca-utils,libdts-dev}.install: + Added. * debian/rules: + Converted Debian packaging to CDBS. + Dropped PIC static library build. * debian/Makefile.am, debian/Makefile.in: + Removed as the upstream tarball does not provide a debian/ directory anymore. -- Fabian Greffrath Tue, 28 May 2008 16:24:07 +0100 libdts (0.0.2-svn-2) unstable; urgency=low * Moved maintenance to pkg-multimedia. * debian/control: + Set pkg-multimedia-maintainers as main maintainer. + Updated VCS fields. + Set policy to 3.7.2. * debian/compat: + Set to 5. * debian/copyright: + Fixed the FSF address. + Completed list of authors and contributors. -- Sam Hocevar (Debian packages) Wed, 14 Mar 2007 23:49:06 +0100 libdts (0.0.2-svn-1) unstable; urgency=low * Initial release (Closes: #232256). -- Sam Hocevar (Debian packages) Tue, 24 Feb 2004 20:33:44 +0100 debian/libdts-dev.install0000664000000000000000000000010612124403162012605 0ustar /usr/include/dts.h /usr/lib/*/libdts.a /usr/lib/*/pkgconfig/libdts.pc debian/compat0000664000000000000000000000000212124403162010361 0ustar 9 debian/libdca-dev.install0000664000000000000000000000013312124403162012542 0ustar /usr/include/dca.h /usr/lib/*/libdca.a /usr/lib/*/libdca.so /usr/lib/*/pkgconfig/libdca.pc debian/libdca0.docs0000664000000000000000000000000612124403162011327 0ustar doc/* debian/libdca0.install0000664000000000000000000000002712124403162012050 0ustar /usr/lib/*/libdca.so.* debian/copyright0000664000000000000000000000300012124403162011107 0ustar Author: Gildas Bazin Download: http://www.videolan.org/developers/libdca.html Files: * Copyright: © 2004, Gildas Bazin © 2000-2003, Michel Lespinasse © 1999-2000, Aaron Holtzman License: GPL-2+ libdca is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . On Debian systems, the complete text of the GNU General Public License version 2 can be found in file `/usr/share/common-licenses/GPL-2'. Files: src/getopt.* Copyright: © 1987-2000, Free Software Foundation, Inc. License: LGPL-2+ The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . On Debian systems, the complete text of the GNU Library General Public License version 2 can be found in file `/usr/share/common-licenses/LGPL-2'. Files: debian/* Copyright: © 2008, Fabian Greffrath © 2004-2007, Sam Hocevar License: GPL-2+ The Debian packaging information is under the GPL, version 2 or later. . On Debian systems, the complete text of the GNU General Public License version 2 can be found in file `/usr/share/common-licenses/GPL-2'. debian/source/0000775000000000000000000000000012124403162010463 5ustar debian/source/format0000664000000000000000000000001412124403162011671 0ustar 3.0 (quilt) debian/libdca-utils.install0000664000000000000000000000002412124403162013123 0ustar /usr/bin /usr/share debian/control0000664000000000000000000000534412264344677010620 0ustar Source: libdca Section: libs Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian QA Group Build-Depends: dh-autoreconf, debhelper (>= 9) Standards-Version: 3.9.2 Vcs-Git: git://anonscm.debian.org/collab-maint/libdca.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/libdca.git;a=summary Homepage: http://www.videolan.org/developers/libdca.html Package: libdca-dev Section: libdevel Architecture: any Depends: libdca0 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Multi-Arch: same Description: decoding library for DTS Coherent Acoustics streams (development) libdca provides a low-level interface to decode audio frames encoded using DTS Coherent Acoustics. DTS Coherent Acoustics streams are commonly found on DVDs, DTS audio CDs and some radio broadcastings. libdca also provides downmixing and dynamic range compression for various output configurations. . This package contains the headers and static libraries used to build applications that use libdca. Package: libdca-utils Section: sound Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Description: decoding library for DTS Coherent Acoustics streams (utilities) libdca provides a low-level interface to decode audio frames encoded using DTS Coherent Acoustics. DTS Coherent Acoustics streams are commonly found on DVDs, DTS audio CDs and some radio broadcastings. libdca also provides downmixing and dynamic range compression for various output configurations. . This package contains additional utilities. Package: libdca0 Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Pre-Depends: ${misc:Pre-Depends} Multi-Arch: same Description: decoding library for DTS Coherent Acoustics streams libdca provides a low-level interface to decode audio frames encoded using DTS Coherent Acoustics. DTS Coherent Acoustics streams are commonly found on DVDs, DTS audio CDs and some radio broadcastings. libdca also provides downmixing and dynamic range compression for various output configurations. . This package contains the shared library. Package: libdts-dev Section: oldlibs Architecture: any Depends: libdca-dev (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Multi-Arch: same Description: backward compatibility place-holder for libdca libdca provides a low-level interface to decode audio frames encoded using DTS Coherent Acoustics. DTS Coherent Acoustics streams are commonly found on DVDs, DTS audio CDs and some radio broadcastings. libdca also provides downmixing and dynamic range compression for various output configurations. . This package contains compatibility headers used to build applications that still use libdts. debian/gbp.conf0000664000000000000000000000005712124403162010604 0ustar [DEFAULT] pristine-tar = True sign-tags = True debian/patches/0000775000000000000000000000000012124403162010612 5ustar debian/patches/r88-fix-random-crashes-caused-by-invalid-32-bit-shifts.patch0000664000000000000000000000210612124403162023535 0ustar r88 | sam | 2008-07-19 22:26:13 +0000 (Sat, 19 Jul 2008) | 2 lines * bitstream.c: fix random crashes caused by invalid 32-bit shifts on 32-bit values. --- libdca.orig/libdca/bitstream.c +++ libdca/libdca/bitstream.c @@ -25,6 +25,7 @@ #include "config.h" +#include #include #include "dca.h" @@ -46,7 +47,7 @@ state->bigendian_mode = bigendian_mode; bitstream_get (state, align * 8); } -#include + static inline void bitstream_fill_current (dca_state_t * state) { uint32_t tmp; @@ -76,12 +77,14 @@ uint32_t dca_bitstream_get_bh (dca_state_t * state, uint32_t num_bits) { - uint32_t result; - - num_bits -= state->bits_left; + uint32_t result = 0; - result = ((state->current_word << (32 - state->bits_left)) >> - (32 - state->bits_left)); + if (state->bits_left) + { + num_bits -= state->bits_left; + result = ((state->current_word << (32 - state->bits_left)) >> + (32 - state->bits_left)); + } if ( !state->word_mode && num_bits > 28 ) { bitstream_fill_current (state); debian/patches/series0000664000000000000000000000040112124403162012022 0ustar r83-mark-tables-as-static-constants.patch r84-normalisation-factor-sqrt2+output-bias.patch r87-sanity-check-for-subframes-and-prim_channels.patch r88-fix-random-crashes-caused-by-invalid-32-bit-shifts.patch r89-avoid-crashing-with-invalid-frames.patch debian/patches/r89-avoid-crashing-with-invalid-frames.patch0000664000000000000000000000210712124403162021021 0ustar r89 | sam | 2008-07-19 22:26:17 +0000 (Sat, 19 Jul 2008) | 2 lines * parse.c: avoid crashing with invalid frames setting a bitalloc_huffman component to 7. --- libdca.orig/libdca/parse.c +++ libdca/libdca/parse.c @@ -364,7 +364,10 @@ for (i = 0; i < state->prim_channels; i++) { state->bitalloc_huffman[i] = bitstream_get (state, 3); - /* if (state->bitalloc_huffman[i] == 7) bailout */ + /* There might be a way not to trash the whole frame, but for + * now we must bail out or we will buffer overflow later. */ + if (state->bitalloc_huffman[i] == 7) + return 1; #ifdef DEBUG fprintf (stderr, "bit allocation quantizer: %i\n", state->bitalloc_huffman[i]); @@ -541,6 +544,7 @@ k < state->vq_start_subband[j] && state->bitalloc[j][k] > 0) { + /* tmode cannot overflow since transient_huffman[j] < 4 */ state->transition_mode[j][k] = InverseQ (state, tmode[state->transient_huffman[j]]); } debian/patches/r83-mark-tables-as-static-constants.patch0000664000000000000000000005164412124403162020361 0ustar r83 | gbazin | 2008-05-26 12:48:45 +0000 (Mon, 26 May 2008) | 1 line Mark tables as static constants. Patch by Diego Flameeyes Petten?\195?\178 --- libdca.orig/libdca/tables_fir.h +++ libdca/libdca/tables_fir.h @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -double fir_32bands_perfect[] = +static const double fir_32bands_perfect[] = { +1.135985195E-010, -6.022448247E-007, @@ -537,7 +537,7 @@ -1.135985195E-010 }; -double fir_32bands_nonperfect[] = +static const double fir_32bands_nonperfect[] = { -1.390191784E-007, -1.693738625E-007, @@ -1053,7 +1053,7 @@ +1.390191784E-007 }; -double lfe_fir_64[] = +static const double lfe_fir_64[] = { 2.6584343868307770E-004, 8.1793652498163280E-005, @@ -1569,7 +1569,7 @@ 2.6584343868307770E-004 }; -double lfe_fir_128[] = +static const double lfe_fir_128[] = { 0.00053168571, 0.00016358691, --- libdca.orig/libdca/tables_huffman.h +++ libdca/libdca/tables_huffman.h @@ -29,7 +29,7 @@ } huff_entry_t; -huff_entry_t bitalloc_a_12[] = +static const huff_entry_t bitalloc_a_12[] = { { 1, 0, 1}, { 2, 2, 2}, { 3, 6, 3}, { 4, 14, 4}, { 5, 30, 5}, { 6, 62, 6}, { 8, 255, 7}, { 8, 254, 8}, @@ -37,7 +37,7 @@ { 0, 0, 0} }; -huff_entry_t bitalloc_b_12[] = +static const huff_entry_t bitalloc_b_12[] = { { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 5, 15, 4}, { 5, 12, 5}, { 6, 29, 6}, { 7, 57, 7}, { 7, 56, 8}, @@ -45,7 +45,7 @@ { 0, 0, 0} }; -huff_entry_t bitalloc_c_12[] = +static const huff_entry_t bitalloc_c_12[] = { { 2, 0, 1}, { 3, 7, 2}, { 3, 5, 3}, { 3, 4, 4}, { 3, 2, 5}, { 4, 13, 6}, { 4, 12, 7}, { 4, 6, 8}, @@ -53,7 +53,7 @@ { 0, 0, 0} }; -huff_entry_t bitalloc_d_12[] = +static const huff_entry_t bitalloc_d_12[] = { { 2, 3, 1}, { 2, 2, 2}, { 2, 0, 3}, { 3, 2, 4}, { 4, 6, 5}, { 5, 14, 6}, { 6, 30, 7}, { 7, 62, 8}, @@ -61,7 +61,7 @@ { 0, 0, 0} }; -huff_entry_t bitalloc_e_12[] = +static const huff_entry_t bitalloc_e_12[] = { { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 4, 6, 4}, { 5, 14, 5}, { 7, 63, 6}, { 7, 61, 7}, { 8, 124, 8}, @@ -69,7 +69,7 @@ { 0, 0, 0} }; -huff_entry_t *bitalloc_12[] = +static const huff_entry_t *const bitalloc_12[] = { bitalloc_a_12, bitalloc_b_12, @@ -78,7 +78,7 @@ bitalloc_e_12 }; -huff_entry_t scales_a_129[] = +static const huff_entry_t scales_a_129[] = { { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, @@ -115,7 +115,7 @@ {14, 15024,-64}, { 0, 0, 0} }; -huff_entry_t scales_b_129[] = +static const huff_entry_t scales_b_129[] = { { 3, 3, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2}, { 4, 14, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 10, 4}, @@ -152,7 +152,7 @@ {15, 3936,-64}, { 0, 0, 0} }; -huff_entry_t scales_c_129[] = +static const huff_entry_t scales_c_129[] = { { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2}, { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4}, @@ -189,7 +189,7 @@ {15, 20944,-64}, { 0, 0, 0} }; -huff_entry_t scales_d_129[] = +static const huff_entry_t scales_d_129[] = { { 2, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 15, 2}, { 4, 14, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 26, 4}, @@ -226,7 +226,7 @@ {15, 28516,-64}, { 0, 0, 0} }; -huff_entry_t scales_e_129[] = +static const huff_entry_t scales_e_129[] = { { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 7, 2}, { 4, 6, -2}, { 4, 3, 3}, { 4, 2, -3}, { 5, 31, 4}, @@ -263,7 +263,7 @@ {16, 57172,-64}, { 0, 0, 0} }; -huff_entry_t *scales_129[] = +static const huff_entry_t *const scales_129[] = { scales_a_129, scales_b_129, @@ -272,36 +272,36 @@ scales_e_129 }; -huff_entry_t bitalloc_a_3[] = +static const huff_entry_t bitalloc_a_3[] = { { 1, 0, 0}, { 2, 2, 1}, { 2, 3, -1}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_4[] = +static const huff_entry_t bitalloc_a_4[] = { { 1, 0, 0}, { 2, 2, 1}, { 3, 6, 2}, { 3, 7, 3}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_4[] = +static const huff_entry_t bitalloc_b_4[] = { { 2, 2, 0}, { 3, 6, 1}, { 3, 7, 2}, { 1, 0, 3}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_4[] = +static const huff_entry_t bitalloc_c_4[] = { { 3, 6, 0}, { 3, 7, 1}, { 1, 0, 2}, { 2, 2, 3}, { 0, 0, 0} }; -huff_entry_t bitalloc_d_4[] = +static const huff_entry_t bitalloc_d_4[] = { { 2, 0, 0}, { 2, 1, 1}, { 2, 2, 2}, { 2, 3, 3}, { 0, 0, 0} }; -huff_entry_t *tmode[] = +static const huff_entry_t *const tmode[] = { bitalloc_a_4, bitalloc_b_4, @@ -309,64 +309,64 @@ bitalloc_d_4 }; -huff_entry_t bitalloc_a_5[] = +static const huff_entry_t bitalloc_a_5[] = { { 1, 0, 0}, { 2, 2, 1}, { 3, 6, -1}, { 4, 14, 2}, { 4, 15, -2}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_5[] = +static const huff_entry_t bitalloc_b_5[] = { { 2, 2, 0}, { 2, 0, 1}, { 2, 1, -1}, { 3, 6, 2}, { 3, 7, -2}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_5[] = +static const huff_entry_t bitalloc_c_5[] = { { 1, 0, 0}, { 3, 4, 1}, { 3, 5, -1}, { 3, 6, 2}, { 3, 7, -2}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_7[] = +static const huff_entry_t bitalloc_a_7[] = { { 1, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 4, 2}, { 4, 14, -2}, { 5, 31, 3}, { 5, 30, -3}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_7[] = +static const huff_entry_t bitalloc_b_7[] = { { 2, 3, 0}, { 2, 1, 1}, { 2, 0, -1}, { 3, 4, 2}, { 4, 11, -2}, { 5, 21, 3}, { 5, 20, -3}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_7[] = +static const huff_entry_t bitalloc_c_7[] = { { 2, 3, 0}, { 2, 2, 1}, { 2, 1, -1}, { 4, 3, 2}, { 4, 2, -2}, { 4, 1, 3}, { 4, 0, -3}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_9[] = +static const huff_entry_t bitalloc_a_9[] = { { 1, 0, 0}, { 3, 7, 1}, { 3, 5, -1}, { 4, 13, 2}, { 4, 9, -2}, { 4, 8, 3}, { 5, 25, -3}, { 6, 49, 4}, { 6, 48, -4}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_9[] = +static const huff_entry_t bitalloc_b_9[] = { { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 3, 2}, { 3, 2, -2}, { 5, 27, 3}, { 5, 26, -3}, { 5, 25, 4}, { 5, 24, -4}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_9[] = +static const huff_entry_t bitalloc_c_9[] = { { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 6, 2}, { 3, 2, -2}, { 4, 6, 3}, { 5, 15, -3}, { 6, 29, 4}, { 6, 28, -4}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_13[] = +static const huff_entry_t bitalloc_a_13[] = { { 1, 0, 0}, { 3, 4, 1}, { 4, 15, -1}, { 4, 13, 2}, { 4, 12, -2}, { 4, 10, 3}, { 5, 29, -3}, { 5, 22, 4}, @@ -374,7 +374,7 @@ { 7, 112, -6}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_13[] = +static const huff_entry_t bitalloc_b_13[] = { { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2}, { 4, 15, -2}, { 4, 9, 3}, { 4, 7, -3}, { 4, 6, 4}, @@ -382,7 +382,7 @@ { 6, 56, -6}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_13[] = +static const huff_entry_t bitalloc_c_13[] = { { 3, 5, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 2, 2}, { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 12, 4}, @@ -390,7 +390,7 @@ { 5, 4, -6}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_17[] = +static const huff_entry_t bitalloc_a_17[] = { { 2, 1, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 4, 2}, { 3, 1, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 0, 4}, @@ -399,7 +399,7 @@ {12, 340, -8}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_17[] = +static const huff_entry_t bitalloc_b_17[] = { { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2}, { 4, 15, -2}, { 4, 9, 3}, { 4, 8, -3}, { 5, 29, 4}, @@ -408,7 +408,7 @@ { 8, 124, -8}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_17[] = +static const huff_entry_t bitalloc_c_17[] = { { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 0, 2}, { 4, 15, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 4, 4}, @@ -417,7 +417,7 @@ { 7, 44, -8}, { 0, 0, 0} }; -huff_entry_t bitalloc_d_17[] = +static const huff_entry_t bitalloc_d_17[] = { { 1, 0, 0}, { 3, 7, 1}, { 3, 6, -1}, { 4, 11, 2}, { 4, 10, -2}, { 5, 19, 3}, { 5, 18, -3}, { 6, 35, 4}, @@ -426,7 +426,7 @@ { 9, 256, -8}, { 0, 0, 0} }; -huff_entry_t bitalloc_e_17[] = +static const huff_entry_t bitalloc_e_17[] = { { 1, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 12, 2}, { 5, 31, -2}, { 5, 28, 3}, { 5, 27, -3}, { 6, 60, 4}, @@ -435,7 +435,7 @@ { 8, 232, -8}, { 0, 0, 0} }; -huff_entry_t bitalloc_f_17[] = +static const huff_entry_t bitalloc_f_17[] = { { 3, 6, 0}, { 3, 5, 1}, { 3, 4, -1}, { 3, 2, 2}, { 3, 1, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 6, 4}, @@ -444,7 +444,7 @@ { 8, 4, -8}, { 0, 0, 0} }; -huff_entry_t bitalloc_g_17[] = +static const huff_entry_t bitalloc_g_17[] = { { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2}, { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 14, 4}, @@ -453,7 +453,7 @@ { 8, 96, -8}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_25[] = +static const huff_entry_t bitalloc_a_25[] = { { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 1, 2}, { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 5, 4}, @@ -464,7 +464,7 @@ {14, 10324,-12}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_25[] = +static const huff_entry_t bitalloc_b_25[] = { { 3, 5, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2}, { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4}, @@ -475,7 +475,7 @@ { 9, 28,-12}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_25[] = +static const huff_entry_t bitalloc_c_25[] = { { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 12, 2}, { 4, 11, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4}, @@ -486,7 +486,7 @@ { 8, 76,-12}, { 0, 0, 0} }; -huff_entry_t bitalloc_d_25[] = +static const huff_entry_t bitalloc_d_25[] = { { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2}, { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 13, 4}, @@ -497,7 +497,7 @@ {12, 1920,-12}, { 0, 0, 0} }; -huff_entry_t bitalloc_e_25[] = +static const huff_entry_t bitalloc_e_25[] = { { 2, 3, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 11, 2}, { 4, 10, -2}, { 4, 1, 3}, { 4, 0, -3}, { 5, 17, 4}, @@ -508,7 +508,7 @@ { 8, 60,-12}, { 0, 0, 0} }; -huff_entry_t bitalloc_f_25[] = +static const huff_entry_t bitalloc_f_25[] = { { 3, 1, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 14, 2}, { 4, 13, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 8, 4}, @@ -519,7 +519,7 @@ {10, 804,-12}, { 0, 0, 0} }; -huff_entry_t bitalloc_g_25[] = +static const huff_entry_t bitalloc_g_25[] = { { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, @@ -530,7 +530,7 @@ {10, 936,-12}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_33[] = +static const huff_entry_t bitalloc_a_33[] = { { 3, 2, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 14, 2}, { 4, 13, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 9, 4}, @@ -543,7 +543,7 @@ {13, 5504,-16}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_33[] = +static const huff_entry_t bitalloc_b_33[] = { { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 11, 2}, { 4, 10, -2}, { 4, 8, 3}, { 4, 7, -3}, { 4, 4, 4}, @@ -556,7 +556,7 @@ {10, 780,-16}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_33[] = +static const huff_entry_t bitalloc_c_33[] = { { 4, 13, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2}, { 4, 7, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 2, 4}, @@ -569,7 +569,7 @@ { 9, 204,-16}, { 0, 0, 0} }; -huff_entry_t bitalloc_d_33[] = +static const huff_entry_t bitalloc_d_33[] = { { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, @@ -582,7 +582,7 @@ {14, 15096,-16}, { 0, 0, 0} }; -huff_entry_t bitalloc_e_33[] = +static const huff_entry_t bitalloc_e_33[] = { { 2, 2, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 12, 2}, { 4, 7, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 27, 4}, @@ -595,7 +595,7 @@ { 9, 456,-16}, { 0, 0, 0} }; -huff_entry_t bitalloc_f_33[] = +static const huff_entry_t bitalloc_f_33[] = { { 4, 13, 0}, { 4, 12, 1}, { 4, 11, -1}, { 4, 9, 2}, { 4, 8, -2}, { 4, 7, 3}, { 4, 6, -3}, { 4, 4, 4}, @@ -608,7 +608,7 @@ {11, 1828,-16}, { 0, 0, 0} }; -huff_entry_t bitalloc_g_33[] = +static const huff_entry_t bitalloc_g_33[] = { { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2}, { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4}, @@ -621,7 +621,7 @@ {10, 644,-16}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_65[] = +static const huff_entry_t bitalloc_a_65[] = { { 4, 6, 0}, { 4, 5, 1}, { 4, 4, -1}, { 4, 2, 2}, { 4, 1, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 29, 4}, @@ -642,7 +642,7 @@ {16, 40540,-32}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_65[] = +static const huff_entry_t bitalloc_b_65[] = { { 4, 4, 0}, { 4, 2, 1}, { 4, 1, -1}, { 5, 30, 2}, { 5, 29, -2}, { 5, 26, 3}, { 5, 25, -3}, { 5, 23, 4}, @@ -663,7 +663,7 @@ {12, 2700,-32}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_65[] = +static const huff_entry_t bitalloc_c_65[] = { { 5, 28, 0}, { 5, 25, 1}, { 5, 24, -1}, { 5, 23, 2}, { 5, 22, -2}, { 5, 19, 3}, { 5, 18, -3}, { 5, 16, 4}, @@ -684,7 +684,7 @@ {11, 1116,-32}, { 0, 0, 0} }; -huff_entry_t bitalloc_d_65[] = +static const huff_entry_t bitalloc_d_65[] = { { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2}, { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4}, @@ -705,7 +705,7 @@ {15, 28848,-32}, { 0, 0, 0} }; -huff_entry_t bitalloc_e_65[] = +static const huff_entry_t bitalloc_e_65[] = { { 3, 4, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 7, 2}, { 4, 6, -2}, { 5, 29, 3}, { 5, 28, -3}, { 5, 23, 4}, @@ -726,7 +726,7 @@ {10, 812,-32}, { 0, 0, 0} }; -huff_entry_t bitalloc_f_65[] = +static const huff_entry_t bitalloc_f_65[] = { { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2}, { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4}, @@ -747,7 +747,7 @@ {14, 4064,-32}, { 0, 0, 0} }; -huff_entry_t bitalloc_g_65[] = +static const huff_entry_t bitalloc_g_65[] = { { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2}, { 4, 6, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 0, 4}, @@ -768,7 +768,7 @@ {11, 268,-32}, { 0, 0, 0} }; -huff_entry_t bitalloc_a_129[] = +static const huff_entry_t bitalloc_a_129[] = { { 4, 8, 0}, { 4, 10, 1}, { 4, 9, -1}, { 4, 0, 2}, { 5, 31, -2}, { 5, 24, 3}, { 5, 23, -3}, { 5, 12, 4}, @@ -805,7 +805,7 @@ {11, 1632,-64}, { 0, 0, 0} }; -huff_entry_t bitalloc_b_129[] = +static const huff_entry_t bitalloc_b_129[] = { { 5, 10, 0}, { 5, 7, 1}, { 5, 6, -1}, { 5, 4, 2}, { 5, 3, -2}, { 5, 0, 3}, { 6, 63, -3}, { 6, 60, 4}, @@ -842,7 +842,7 @@ {14, 10716,-64}, { 0, 0, 0} }; -huff_entry_t bitalloc_c_129[] = +static const huff_entry_t bitalloc_c_129[] = { { 6, 58, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2}, { 6, 51, -2}, { 6, 49, 3}, { 6, 48, -3}, { 6, 46, 4}, @@ -879,7 +879,7 @@ {13, 3676,-64}, { 0, 0, 0} }; -huff_entry_t bitalloc_d_129[] = +static const huff_entry_t bitalloc_d_129[] = { { 4, 9, 0}, { 4, 6, 1}, { 4, 5, -1}, { 4, 2, 2}, { 4, 1, -2}, { 5, 30, 3}, { 5, 29, -3}, { 5, 26, 4}, @@ -916,7 +916,7 @@ {16, 42392,-64}, { 0, 0, 0} }; -huff_entry_t bitalloc_e_129[] = +static const huff_entry_t bitalloc_e_129[] = { { 5, 12, 0}, { 5, 11, 1}, { 5, 10, -1}, { 5, 9, 2}, { 5, 8, -2}, { 5, 7, 3}, { 5, 6, -3}, { 5, 4, 4}, @@ -953,7 +953,7 @@ {16, 41276,-64}, { 0, 0, 0} }; -huff_entry_t bitalloc_f_129[] = +static const huff_entry_t bitalloc_f_129[] = { { 6, 56, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2}, { 6, 51, -2}, { 6, 50, 3}, { 6, 49, -3}, { 6, 48, 4}, @@ -990,7 +990,7 @@ {15, 30252,-64}, { 0, 0, 0} }; -huff_entry_t bitalloc_g_129[] = +static const huff_entry_t bitalloc_g_129[] = { { 4, 0, 0}, { 5, 29, 1}, { 5, 28, -1}, { 5, 25, 2}, { 5, 24, -2}, { 5, 21, 3}, { 5, 20, -3}, { 5, 17, 4}, @@ -1027,7 +1027,7 @@ {13, 7712,-64}, { 0, 0, 0} }; -huff_entry_t *bitalloc_select[11][8] = +static const huff_entry_t *const bitalloc_select[11][8] = { { 0 }, { bitalloc_a_3, 0 }, @@ -1047,7 +1047,7 @@ bitalloc_e_129, bitalloc_f_129, bitalloc_g_129, 0 }, }; -static int InverseQ( dca_state_t * state, huff_entry_t * huff ) +static int InverseQ( dca_state_t * state, const huff_entry_t * huff ) { int value = 0; int length = 0, j; --- libdca.orig/libdca/tables_quantization.h +++ libdca/libdca/tables_quantization.h @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -int scale_factor_quant6[] = +static const int scale_factor_quant6[] = { 1, 2, 2, 3, 3, 4, 6, 7, 10, 12, 16, 20, 26, 34, 44, 56, @@ -33,7 +33,7 @@ 1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638, 0 }; -int scale_factor_quant7[] = +static const int scale_factor_quant7[] = { 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 7, 7, 8, @@ -54,7 +54,7 @@ }; /* 20bits unsigned fractional binary codes */ -int lossy_quant[] = +static const int lossy_quant[] = { 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063, 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777, @@ -62,7 +62,7 @@ 84, 42, 21, 0, 0, 0, 0, 0 }; -double lossy_quant_d[] = +static const double lossy_quant_d[] = { 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34, 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040, @@ -71,7 +71,7 @@ }; /* 20bits unsigned fractional binary codes */ -int lossless_quant[] = +static const int lossless_quant[] = { 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127, 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049, @@ -79,7 +79,7 @@ 4, 2, 1, 0, 0, 0, 0, 0 }; -double lossless_quant_d[] = +static const double lossless_quant_d[] = { 0, 1.0, 0.5, 0.33, 0.25, 0.166, 0.125, 0.083, 0.0625, 0.03125, 0.0156, 7.874E-3, 3.922E-3, 1.957E-3, --- libdca.orig/libdca/parse.c +++ libdca/libdca/parse.c @@ -548,7 +548,7 @@ /* Scale factors */ for (j = 0; j < state->prim_channels; j++) { - int *scale_table; + const int *scale_table; int scale_sum; for (k = 0; k < state->subband_activity[j]; k++) @@ -761,7 +761,7 @@ int k, l; int subsubframe = state->current_subsubframe; - double *quant_step_table; + const double *quant_step_table; /* FIXME */ double subband_samples[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]; @@ -1145,7 +1145,7 @@ double samples_in[32][8], sample_t *samples_out, double scale, sample_t bias) { - double *prCoeff; + const double *prCoeff; int i, j, k; double raXin[32]; @@ -1236,7 +1236,7 @@ */ int nDeciFactor, k, J; - double *prCoeff; + const double *prCoeff; int NumFIRCoef = 512; /* Number of FIR coefficients */ int nInterpIndex = 0; /* Index to the interpolated samples */ debian/patches/r87-sanity-check-for-subframes-and-prim_channels.patch0000664000000000000000000000136212124403162022766 0ustar r87 | sam | 2008-07-18 19:22:47 +0000 (Fri, 18 Jul 2008) | 2 lines * parse.c: sanity check for subframes and prim_channels to avoid crashes with invalid streams. --- libdca.orig/libdca/parse.c +++ libdca/libdca/parse.c @@ -305,8 +305,15 @@ /* Primary audio coding header */ state->subframes = bitstream_get (state, 4) + 1; + + if (state->subframes > DCA_SUBFRAMES_MAX) + state->subframes = DCA_SUBFRAMES_MAX; + state->prim_channels = bitstream_get (state, 3) + 1; + if (state->prim_channels > DCA_PRIM_CHANNELS_MAX) + state->prim_channels = DCA_PRIM_CHANNELS_MAX; + #ifdef DEBUG fprintf (stderr, "subframes: %i\n", state->subframes); fprintf (stderr, "prim channels: %i\n", state->prim_channels); debian/patches/r84-normalisation-factor-sqrt2+output-bias.patch0000664000000000000000000001023012124403162021716 0ustar r84 | gbazin | 2008-06-01 16:13:33 +0000 (Sun, 01 Jun 2008) | 3 lines * libdca/parse.c: Change output normalisation factor from 3/2 to sqrt(2). Thanks to Alexander E. Patrakov for finding that this is the proper normalisation factor. Fixed a bug where the output bias wasn't applied when downmixing wasn't being done. --- libdca.orig/libdca/parse.c +++ libdca/libdca/parse.c @@ -59,12 +59,11 @@ static int decode_blockcode (int code, int levels, int *values); static void qmf_32_subbands (dca_state_t * state, int chans, - double samples_in[32][8], sample_t *samples_out, - double rScale, sample_t bias); + double samples_in[32][8], sample_t *samples_out); static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample, double *samples_in, sample_t *samples_out, - double rScale, sample_t bias ); + sample_t bias); static void pre_calc_cosmod( dca_state_t * state ); @@ -123,7 +122,9 @@ bitstream_get (state, 1); *frame_length = (bitstream_get (state, 7) + 1) * 32; + if (*frame_length < 6 * 32) return 0; frame_size = bitstream_get (state, 14) + 1; + if (frame_size < 96) return 0; if (!state->word_mode) frame_size = frame_size * 8 / 14 * 2; /* Audio channel arrangement */ @@ -981,14 +982,7 @@ /* 32 subbands QMF */ for (k = 0; k < state->prim_channels; k++) { - /*static double pcm_to_float[8] = - {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/ - - qmf_32_subbands (state, k, - subband_samples[k], - &state->samples[256*k], - /*WTF ???*/ 32768.0*3/2/*pcm_to_float[state->source_pcm_res]*/, - 0/*state->bias*/); + qmf_32_subbands (state, k, subband_samples[k], &state->samples[256*k]); } /* Down/Up mixing */ @@ -1000,6 +994,10 @@ { dca_downmix (state->samples, state->amode, state->output, state->bias, state->clev, state->slev); + } else if (state->bias) + { + for ( k = 0; k < 256*state->prim_channels; k++ ) + state->samples[k] += state->bias; } /* Generate LFE samples for this subsubframe FIXME!!! */ @@ -1011,8 +1009,7 @@ lfe_interpolation_fir (state->lfe, 2 * state->lfe, state->lfe_data + lfe_samples + 2 * state->lfe * subsubframe, - &state->samples[256*i_channels], - 8388608.0, state->bias); + &state->samples[256*i_channels], state->bias); /* Outputs 20bits pcm samples */ } @@ -1142,9 +1139,9 @@ } static void qmf_32_subbands (dca_state_t * state, int chans, - double samples_in[32][8], sample_t *samples_out, - double scale, sample_t bias) + double samples_in[32][8], sample_t *samples_out) { + static const double scale = 1.4142135623730951 /* sqrt(2) */ * 32768.0; const double *prCoeff; int i, j, k; double raXin[32]; @@ -1211,7 +1208,7 @@ /* Create 32 PCM output samples */ for (i=0;i<32;i++) - samples_out[nChIndex++] = subband_fir_hist2[i] / scale + bias; + samples_out[nChIndex++] = subband_fir_hist2[i] / scale; /* Update working arrays */ for (i=511;i>=32;i--) @@ -1225,7 +1222,7 @@ static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample, double *samples_in, sample_t *samples_out, - double scale, sample_t bias) + sample_t bias) { /* samples_in: An array holding decimated samples. * Samples in current subframe starts from samples_in[0], @@ -1235,6 +1232,7 @@ * samples_out: An array holding interpolated samples */ + static const double scale = 8388608.0; int nDeciFactor, k, J; const double *prCoeff;