Commit 7c70c4e6 authored by Monty's avatar Monty
Browse files

Numerous vorbisfile fixes:

Fixed a seek bug that didn't cause any wrong answers but did have a
minor negative impact on seeking performance

Corrected ov_read_float() prototype ot more closely match how
ov_read() is used.

Rendered all of vorbisfile 64 bit clean for >2GB files.  This required
changing ov_seek_raw(OggVorbis_File *vf,long position) to
ov_seek_raw(OggVorbis_File *vf,ogg_int64_t position).  This breaks lib
compatability for those using this function, please increment the
version number.

Fixed vorbisfile handling of logical streams that begin at a non-zero
PCM offset.  captured live streams, and cut streams, for example, now
behave.

svn path=/trunk/vorbis/; revision=3126
parent 0fa973e1
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
******************************************************************** ********************************************************************
function: illustrate simple use of chained bitstream and vorbisfile.a function: illustrate simple use of chained bitstream and vorbisfile.a
last mod: $Id: chaining_example.c,v 1.15 2001/12/20 01:00:24 segher Exp $ last mod: $Id: chaining_example.c,v 1.16 2002/03/07 03:41:02 xiphmont Exp $
********************************************************************/ ********************************************************************/
#include <stdlib.h>
#include <vorbis/codec.h> #include <vorbis/codec.h>
#include <vorbis/vorbisfile.h> #include <vorbis/vorbisfile.h>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
******************************************************************** ********************************************************************
function: stdio-based convenience library for opening/seeking/decoding function: stdio-based convenience library for opening/seeking/decoding
last mod: $Id: vorbisfile.h,v 1.16 2001/12/20 01:00:25 segher Exp $ last mod: $Id: vorbisfile.h,v 1.17 2002/03/07 03:41:03 xiphmont Exp $
********************************************************************/ ********************************************************************/
...@@ -62,7 +62,9 @@ typedef struct OggVorbis_File { ...@@ -62,7 +62,9 @@ typedef struct OggVorbis_File {
ogg_int64_t *offsets; ogg_int64_t *offsets;
ogg_int64_t *dataoffsets; ogg_int64_t *dataoffsets;
long *serialnos; long *serialnos;
ogg_int64_t *pcmlengths; ogg_int64_t *pcmlengths; /* overloaded to maintain binary
compatability; x2 size, stores both
beginning and end values */
vorbis_info *vi; vorbis_info *vi;
vorbis_comment *vc; vorbis_comment *vc;
...@@ -104,7 +106,7 @@ extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); ...@@ -104,7 +106,7 @@ extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
extern double ov_time_total(OggVorbis_File *vf,int i); extern double ov_time_total(OggVorbis_File *vf,int i);
extern int ov_raw_seek(OggVorbis_File *vf,long pos); extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
extern int ov_time_seek(OggVorbis_File *vf,double pos); extern int ov_time_seek(OggVorbis_File *vf,double pos);
...@@ -117,7 +119,7 @@ extern double ov_time_tell(OggVorbis_File *vf); ...@@ -117,7 +119,7 @@ extern double ov_time_tell(OggVorbis_File *vf);
extern vorbis_info *ov_info(OggVorbis_File *vf,int link); extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels, extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
int *bitstream); int *bitstream);
extern long ov_read(OggVorbis_File *vf,char *buffer,int length, extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
int bigendianp,int word,int sgned,int *bitstream); int bigendianp,int word,int sgned,int *bitstream);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
******************************************************************** ********************************************************************
function: linear scale -> dB, Bark and Mel scales function: linear scale -> dB, Bark and Mel scales
last mod: $Id: scales.h,v 1.19 2002/03/06 04:07:58 xiphmont Exp $ last mod: $Id: scales.h,v 1.20 2002/03/07 03:41:03 xiphmont Exp $
********************************************************************/ ********************************************************************/
...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
/* 20log10(x) */ /* 20log10(x) */
#ifdef VORBIS_IEEE_FLOAT32 #ifdef VORBIS_IEEE_FLOAT32
static float unitnorm(float x){
ogg_uint32_t *ix=(ogg_uint32_t *)&x;
*ix=(*ix&0x80000000UL)|(0x3f800000UL);
return(x);
}
static float todB_LOOKUP[256]={ static float todB_LOOKUP[256]={
-140.277330f, -139.633636f, -139.034372f, -138.473797f, -140.277330f, -139.633636f, -139.034372f, -138.473797f,
-137.450747f, -136.535597f, -135.707743f, -134.951972f, -137.450747f, -136.535597f, -135.707743f, -134.951972f,
...@@ -101,6 +107,11 @@ static float todB(const float *x){ ...@@ -101,6 +107,11 @@ static float todB(const float *x){
#else #else
static float unitnorm(float x){
if(x<0)return(-1.f);
return(1.f);
}
#define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f) #define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
#define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f) #define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f)
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment