mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1306476 - Update libvorbis. r=derf
Update to the latest upstream master of libvorbis (v1.3.5-48-ge5b1378) to pick up various fixes. MozReview-Commit-ID: KTXAtrbtWW6 --HG-- extra : rebase_source : e36f22ce74cad13851979722c40f3742dba45f8c
This commit is contained in:
parent
a0831a23a3
commit
368a366bfc
@ -1,10 +1,10 @@
|
||||
The source from this directory was copied from the libvorbis
|
||||
subversion repository using the update.sh script. The only changes
|
||||
The source from this directory was copied from the vorbis
|
||||
git repository using the update.sh script. The only changes
|
||||
made were those applied by update.sh and the addition/update of
|
||||
Makefile.in and moz.build files for the Mozilla build system.
|
||||
|
||||
The upstream version used was libvorbis 1.3.5.
|
||||
https://svn.xiph.org/tags/vorbis/libvorbis-1.3.5@19464
|
||||
The upstream version used was vorbis v1.3.5-48-ge5b1378
|
||||
from https://git.xiph.org/vorbis.git
|
||||
|
||||
Some files are renamed during the copy to prevent clashes with object
|
||||
file names with other Mozilla libraries.
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: libvorbis codec headers
|
||||
last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: vorbis encode-engine setup
|
||||
last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
function: libvorbis backend and mapping structures; needed for
|
||||
static mode headers
|
||||
last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: bitrate tracking and management
|
||||
last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
*
|
||||
* function: static codebooks for 5.1 surround
|
||||
* last modified: $Id: res_books_51.h 19057 2014-01-22 12:32:31Z xiphmont $
|
||||
* last modified: $Id$
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: static codebooks autogenerated by huff/huffbuld
|
||||
last modified: $Id: res_books_stereo.h 19057 2014-01-22 12:32:31Z xiphmont $
|
||||
last modified: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: static codebooks autogenerated by huff/huffbuld
|
||||
last modified: $Id: floor_books.h 19057 2014-01-22 12:32:31Z xiphmont $
|
||||
last modified: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: static codebooks autogenerated by huff/huffbuld
|
||||
last modified: $Id: res_books_uncoupled.h 19057 2014-01-22 12:32:31Z xiphmont $
|
||||
last modified: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: basic shared codebook operations
|
||||
last mod: $Id: codebook.h 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: libvorbis codec headers
|
||||
last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: PCM data envelope analysis and manipulation
|
||||
last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: highlevel encoder setup struct separated out for vorbisenc clarity
|
||||
last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: lookup based functions
|
||||
last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: lookup data; generated by lookups.pl; edit there
|
||||
last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: LPC low level routines
|
||||
last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: LSP (also called LSF) conversion routines
|
||||
last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: masking curve data for psychoacoustics
|
||||
last mod: $Id: masking.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: modified discrete cosine transform prototypes
|
||||
last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: miscellaneous prototypes
|
||||
last mod: $Id: misc.h 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: key floor settings
|
||||
last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: 11kHz settings
|
||||
last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: 16kHz settings
|
||||
last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: key psychoacoustic settings for 44.1/48kHz
|
||||
last mod: $Id: psych_44.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: 8kHz psychoacoustic settings
|
||||
last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel residue templates 16/22kHz
|
||||
last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel residue templates for 32/44.1/48kHz
|
||||
last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel residue templates for 32/44.1/48kHz uncoupled
|
||||
last mod: $Id: residue_44p51.h 19013 2013-11-12 04:04:50Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel residue templates for 32/44.1/48kHz uncoupled
|
||||
last mod: $Id: residue_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel residue templates 8/11kHz
|
||||
last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: 11kHz settings
|
||||
last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: 16kHz settings
|
||||
last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: 22kHz settings
|
||||
last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel settings for 32kHz
|
||||
last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel settings for 44.1/48kHz
|
||||
last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel settings for 44.1/48kHz 5.1 surround modes
|
||||
last mod: $Id: setup_44p51.h 19013 2013-11-12 04:04:50Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: toplevel settings for 44.1/48kHz uncoupled modes
|
||||
last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: 8kHz settings
|
||||
last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: catch-all toplevel settings for q modes only
|
||||
last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id: os.h 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: random psychoacoustics (not including preecho)
|
||||
last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: registry for time, floor, res backends and channel mappings
|
||||
last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: linear scale -> dB, Bark and Mel scales
|
||||
last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: fft transform
|
||||
last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: single-block PCM analysis mode dispatch
|
||||
last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: bitrate tracking and management
|
||||
last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: PCM data vector blocking, windowing and dis/reassembly
|
||||
last mod: $Id: block.c 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
Handle windowing, overlap-add, etc of the PCM vectors. This is made
|
||||
more amusing by Vorbis' current two allowed block sizes.
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: basic codebook pack/unpack/code/decode operations
|
||||
last mod: $Id: codebook.c 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: PCM data envelope analysis
|
||||
last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: floor backend 0 implementation
|
||||
last mod: $Id: floor0.c 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: floor backend 1 implementation
|
||||
last mod: $Id: floor1.c 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: maintain the info structure, info <-> header packets
|
||||
last mod: $Id: info.c 19441 2015-01-21 01:17:41Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
@ -65,11 +65,13 @@ void vorbis_comment_add(vorbis_comment *vc,const char *comment){
|
||||
}
|
||||
|
||||
void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){
|
||||
char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
|
||||
/* Length for key and value +2 for = and \0 */
|
||||
char *comment=_ogg_malloc(strlen(tag)+strlen(contents)+2);
|
||||
strcpy(comment, tag);
|
||||
strcat(comment, "=");
|
||||
strcat(comment, contents);
|
||||
vorbis_comment_add(vc, comment);
|
||||
_ogg_free(comment);
|
||||
}
|
||||
|
||||
/* This is more or less the same as strncasecmp - but that doesn't exist
|
||||
@ -88,27 +90,30 @@ char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){
|
||||
long i;
|
||||
int found = 0;
|
||||
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||
char *fulltag = alloca(taglen+ 1);
|
||||
char *fulltag = _ogg_malloc(taglen+1);
|
||||
|
||||
strcpy(fulltag, tag);
|
||||
strcat(fulltag, "=");
|
||||
|
||||
for(i=0;i<vc->comments;i++){
|
||||
if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
|
||||
if(count == found)
|
||||
if(count == found) {
|
||||
/* We return a pointer to the data, not a copy */
|
||||
return vc->user_comments[i] + taglen;
|
||||
else
|
||||
_ogg_free(fulltag);
|
||||
return vc->user_comments[i] + taglen;
|
||||
} else {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ogg_free(fulltag);
|
||||
return NULL; /* didn't find anything */
|
||||
}
|
||||
|
||||
int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
|
||||
int i,count=0;
|
||||
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||
char *fulltag = alloca(taglen+1);
|
||||
char *fulltag = _ogg_malloc(taglen+1);
|
||||
strcpy(fulltag,tag);
|
||||
strcat(fulltag, "=");
|
||||
|
||||
@ -117,6 +122,7 @@ int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
|
||||
count++;
|
||||
}
|
||||
|
||||
_ogg_free(fulltag);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: lookup based functions
|
||||
last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: LPC low level routines
|
||||
last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: LSP (also called LSF) conversion routines
|
||||
last mod: $Id: lsp.c 19453 2015-03-02 22:35:34Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
The LSP generation code is taken (with minimal modification and a
|
||||
few bugfixes) from "On the Computation of the LSP Frequencies" by
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: channel mapping 0 implementation
|
||||
last mod: $Id: mapping0.c 19441 2015-01-21 01:17:41Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
function: normalized modified discrete cosine transform
|
||||
power of two length transform only [64 <= n ]
|
||||
last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
Original algorithm adapted long ago from _The use of multirate filter
|
||||
banks for coding of high quality digital audio_, by T. Sporer,
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: psychoacoustics not including preecho
|
||||
last mod: $Id: psy.c 18077 2011-09-02 02:49:00Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: registry for time, floor, res backends and channel mappings
|
||||
last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: residue backend 0, 1 and 2 implementation
|
||||
last mod: $Id: res0.c 19441 2015-01-21 01:17:41Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,11 +11,12 @@
|
||||
********************************************************************
|
||||
|
||||
function: basic shared codebook operations
|
||||
last mod: $Id: sharedbook.c 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <ogg/ogg.h>
|
||||
@ -158,25 +159,34 @@ ogg_uint32_t *_make_words(char *l,long n,long sparsecount){
|
||||
that's portable and totally safe against roundoff, but I haven't
|
||||
thought of it. Therefore, we opt on the side of caution */
|
||||
long _book_maptype1_quantvals(const static_codebook *b){
|
||||
long vals=floor(pow((float)b->entries,1.f/b->dim));
|
||||
long vals;
|
||||
if(b->entries<1){
|
||||
return(0);
|
||||
}
|
||||
vals=floor(pow((float)b->entries,1.f/b->dim));
|
||||
|
||||
/* the above *should* be reliable, but we'll not assume that FP is
|
||||
ever reliable when bitstream sync is at stake; verify via integer
|
||||
means that vals really is the greatest value of dim for which
|
||||
vals^b->bim <= b->entries */
|
||||
/* treat the above as an initial guess */
|
||||
if(vals<1){
|
||||
vals=1;
|
||||
}
|
||||
while(1){
|
||||
long acc=1;
|
||||
long acc1=1;
|
||||
int i;
|
||||
for(i=0;i<b->dim;i++){
|
||||
if(b->entries/vals<acc)break;
|
||||
acc*=vals;
|
||||
acc1*=vals+1;
|
||||
if(LONG_MAX/(vals+1)<acc1)acc1=LONG_MAX;
|
||||
else acc1*=vals+1;
|
||||
}
|
||||
if(acc<=b->entries && acc1>b->entries){
|
||||
if(i>=b->dim && acc<=b->entries && acc1>b->entries){
|
||||
return(vals);
|
||||
}else{
|
||||
if(acc>b->entries){
|
||||
if(i<b->dim || acc>b->entries){
|
||||
vals--;
|
||||
}else{
|
||||
vals++;
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: *unnormalized* fft transform
|
||||
last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: single-block PCM synthesis
|
||||
last mod: $Id: synthesis.c 19441 2015-01-21 01:17:41Z xiphmont $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: window functions
|
||||
last mod: $Id: window.c 19028 2013-12-02 23:23:39Z tterribe $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: simple programmatic interface for encoder mode setup
|
||||
last mod: $Id: vorbisenc.c 19457 2015-03-03 00:15:29Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: window functions
|
||||
last mod: $Id: window.h 19028 2013-12-02 23:23:39Z tterribe $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user